diff --git a/.hgignore b/.hgignore
index 403b73df6d28a41d669ab8abd0236a1c3df808d0..bc3020eee4758fe74905091c141492698899e542 100644
--- a/.hgignore
+++ b/.hgignore
@@ -67,3 +67,4 @@ glob:indra/newview/filters.xml
 glob:indra/newview/avatar_icons_cache.txt
 glob:indra/newview/avatar_lad.log
 glob:*.diff
+*.rej
diff --git a/.hgtags b/.hgtags
index b863bbe37be0a42d53e9f3d65ae061a7725d0e80..4f3f55ad943007823162f38df674cdffbd7d914b 100644
--- a/.hgtags
+++ b/.hgtags
@@ -228,3 +228,72 @@ c4911ec8cd81e676dfd2af438b3e065407a94a7a 3.2.1-start
 80f3e30d8aa4d8f674a48bd742aaa6d8e9eae0b5 3.2.3-start
 a8c7030d6845186fac7c188be4323a0e887b4184 DRTVWR-99_3.2.1-release
 a8c7030d6845186fac7c188be4323a0e887b4184 3.2.1-release
+a9abb9633a266c8d2fe62411cfd1c86d32da72bf DRTVWR-60_2.7.1-release
+fe3a8e7973072ea62043c08b19b66626c1a720eb DRTVWR-60_2.7.1-release
+a9abb9633a266c8d2fe62411cfd1c86d32da72bf 2.7.1-release
+fe3a8e7973072ea62043c08b19b66626c1a720eb 2.7.1-release
+3fe994349fae64fc40874bb59db387131eb35a41 3.2.4-start
+a9abb9633a266c8d2fe62411cfd1c86d32da72bf DRTVWR-60_2.7.1-release
+fe3a8e7973072ea62043c08b19b66626c1a720eb DRTVWR-60_2.7.1-release
+a9abb9633a266c8d2fe62411cfd1c86d32da72bf 2.7.1-release
+fe3a8e7973072ea62043c08b19b66626c1a720eb 2.7.1-release
+3fe994349fae64fc40874bb59db387131eb35a41 DRTVWR-104_3.2.4-beta1
+3fe994349fae64fc40874bb59db387131eb35a41 3.2.4-beta1
+8a44ff3d2104269ce76145c2772cf1bdff2a2abe 3.2.5-start
+fe3a8e7973072ea62043c08b19b66626c1a720eb DRTVWR-62_2.7.2-release
+fe3a8e7973072ea62043c08b19b66626c1a720eb 2.7.2-release
+bd6bcde2584491fd9228f1fa51c4575f4e764e19 DRTVWR-103_3.2.4-release
+bd6bcde2584491fd9228f1fa51c4575f4e764e19 3.2.4-release
+3d2d5d244c6398a4214c666d5dd3965b0918709a DRTVWR-106_3.2.5-beta1
+3d2d5d244c6398a4214c666d5dd3965b0918709a 3.2.5-beta1
+65a2c1c8d855b88edfbea4e16ef2f27e7cff8b1d DRTVWR-107_3.2.5-beta2
+65a2c1c8d855b88edfbea4e16ef2f27e7cff8b1d 3.2.5-beta2
+c6175c955a19e9b9353d242889ec1779b5762522 DRTVWR-105_3.2.5-release
+c6175c955a19e9b9353d242889ec1779b5762522 3.2.5-release
+2174ed1c7129562428a5cfe8651ed77b8d26ae18 3.2.6-start
+286d73ff5c19f6c00e023dc1b60975ed6bbe2872 DRTVWR-109_3.2.6-beta1
+4891c46a56fed7512c783b9cbe7cb7260727bf0c 3.2.7-start
+286d73ff5c19f6c00e023dc1b60975ed6bbe2872 3.2.6-beta1
+c6175c955a19e9b9353d242889ec1779b5762522 DRTVWR-105_3.2.5-release
+c6175c955a19e9b9353d242889ec1779b5762522 3.2.5-release
+3d75c836d178c7c7e788f256afe195f6cab764a2 DRTVWR-111_3.2.7-beta1
+3d75c836d178c7c7e788f256afe195f6cab764a2 3.2.7-beta1
+89980333c99dbaf1787fe20784f1d8849e9b5d4f 3.2.8-start
+16f8e2915f3f2e4d732fb3125daf229cb0fd1875 DRTVWR-114_3.2.8-beta1
+16f8e2915f3f2e4d732fb3125daf229cb0fd1875 3.2.8-beta1
+987425b1acf4752379b2e1eb20944b4b35d67a85 DRTVWR-115_3.2.8-beta2
+987425b1acf4752379b2e1eb20944b4b35d67a85 3.2.8-beta2
+51b2fd52e36aab8f670e0874e7e1472434ec4b4a DRTVWR-113_3.2.8-release
+51b2fd52e36aab8f670e0874e7e1472434ec4b4a 3.2.8-release
+37dd400ad721e2a89ee820ffc1e7e433c68f3ca2 3.2.9-start
+e9c82fca5ae6fb8a8af29012d78fb194a29323f3 DRTVWR-117_3.2.9-beta1
+e9c82fca5ae6fb8a8af29012d78fb194a29323f3 3.2.9-beta1
+a01ef9bed28627f4ca543fbc1d70c79cc297a90f DRTVWR-118_3.2.9-beta2
+a01ef9bed28627f4ca543fbc1d70c79cc297a90f 3.2.9-beta2
+987425b1acf4752379b2e1eb20944b4b35d67a85 3.2.8-beta2
+d5f263687f43f278107363365938f0a214920a4b DRTVWR-119
+d5f263687f43f278107363365938f0a214920a4b 3.3.0-beta1
+5e8d2662f38a66eca6c591295f5880d47afc73f7 viewer-release-candidate
+5e8d2662f38a66eca6c591295f5880d47afc73f7 3.3.0-release
+d5f263687f43f278107363365938f0a214920a4b 3.3.0-start
+dffd0457ee0745de65bf95f0642a5c9e46b8e2f0 viewer-beta-candidate
+d5f263687f43f278107363365938f0a214920a4b DRTVWR-119
+d5f263687f43f278107363365938f0a214920a4b 3.3.0-beta1
+5e8d2662f38a66eca6c591295f5880d47afc73f7 viewer-release-candidate
+5e8d2662f38a66eca6c591295f5880d47afc73f7 3.3.0-release
+28b95a6a28dca3338d9a1f4f204b96678df9f6a5 viewer-beta-candidate
+b43cd25be49e3984ff5361cefad020e069131d98 3.3.1-start
+3e2fca4ed1a0dc9fe6d8a6664e71098bb035a367 DRTVWR-125
+3e2fca4ed1a0dc9fe6d8a6664e71098bb035a367 3.3.1-start
+28b95a6a28dca3338d9a1f4f204b96678df9f6a5 3.3.1-beta1
+1dc545e44617975da2a4a32fe303386c687a6ca1 viewer-beta-candidate
+1dc545e44617975da2a4a32fe303386c687a6ca1 3.3.1-beta2
+1dc545e44617975da2a4a32fe303386c687a6ca1 DRTVWR-139
+5e8d2662f38a66eca6c591295f5880d47afc73f7 viewer-release-candidate
+c623bbc854b6f7ee1b33a3718f76715046aa2937 viewer-release-candidate
+c623bbc854b6f7ee1b33a3718f76715046aa2937 3.3.1-release
+d29a260119f8d5a5d168e25fed0c7ea6b3f40161 3.3.2-beta1
+675668bd24d3bea570814f71762a2a806f7e1b8d 3.3.2-beta2
+c623bbc854b6f7ee1b33a3718f76715046aa2937 viewer-release-candidate
+675668bd24d3bea570814f71762a2a806f7e1b8d viewer-release-candidate
+675668bd24d3bea570814f71762a2a806f7e1b8d 3.3.2-release
diff --git a/BuildParams b/BuildParams
old mode 100755
new mode 100644
index 5068edb21f176a07125912d4e9a1f737d98cdac3..cff51a286b001d35f62425f46c7460bb65c1735d
--- a/BuildParams
+++ b/BuildParams
@@ -35,51 +35,27 @@ viewer-development.build_debug_release_separately = true
 # Notifications - to configure email notices, add a setting like this:
 # <username>_<reponame>.email = <email-address>
 
+
 # =================================================================
-# Viewer Development (snowstorm canonical build owned by Oz Linden)
+# Canonical viewer integration builds - Oz Linden
 # =================================================================
-snowstorm_viewer-development.viewer_channel = "Second Life Development"
-snowstorm_viewer-development.login_channel = "Second Life Development"
-snowstorm_viewer-development.build_viewer_update_version_manager = false
-snowstorm_viewer-development.email = viewer-development-builds@lists.secondlife.com
-snowstorm_viewer-development.build_enforce_coding_policy = true
-snowstorm_viewer-development.codeticket_add_context = true
-
-Snowstorm_viewer-project-review.build_debug_release_separately = true
-Snowstorm_viewer-project-review.codeticket_add_context = true
-Snowstorm_viewer-project-review.viewer_channel = "Project Viewer - Snowstorm Team"
-Snowstorm_viewer-project-review.login_channel = "Project Viewer - Snowstorm Team"
-Snowstorm_viewer-project-review.codeticket_add_context = true
+integration_viewer-development.viewer_channel = "Second Life Development"
+integration_viewer-development.login_channel = "Second Life Development"
+integration_viewer-development.build_viewer_update_version_manager = false
+integration_viewer-development.email = viewer-development-builds@lists.secondlife.com
+integration_viewer-development.build_enforce_coding_policy = true
+integration_viewer-development.codeticket_add_context = true
 
-# ========================================
-# Viewer Beta (Owner: Dessie Linden)
-# ========================================
 viewer-beta.viewer_channel = "Second Life Beta Viewer"
 viewer-beta.login_channel = "Second Life Beta Viewer"
 viewer-beta.build_debug_release_separately = true
 viewer-beta.build_viewer_update_version_manager = true
 
-viewer-pre-beta.viewer_channel = "Second Life Beta Viewer"
-viewer-pre-beta.login_channel = "Second Life Beta Viewer"
-viewer-pre-beta.build_debug_release_separately = true
-viewer-pre-beta.build_viewer_update_version_manager = true
-
-
-# ========================================
-# Viewer Release (Owner: Dessie Linden)
-# ========================================
 viewer-release.viewer_channel = "Second Life Release"
 viewer-release.login_channel = "Second Life Release"
 viewer-release.build_debug_release_separately = true
 viewer-release.build_viewer_update_version_manager = true
 
-viewer-pre-release.viewer_channel = "Second Life Release"
-viewer-pre-release.login_channel = "Second Life Release"
-viewer-pre-release.build_debug_release_separately = true
-viewer-pre-release.build_viewer_update_version_manager = true
-#viewer-pre-release.release-viewer.jira = DRTVWR-92
-
-
 # ========================================
 # mesh-development
 # ========================================
@@ -136,35 +112,31 @@ viewer-mesh.login_channel = "Project Viewer - Mesh"
 viewer-mesh.viewer_grid = aditi
 viewer-mesh.email = shining@lists.lindenlab.com
 
-
-# ========================================
-# CG
-# ========================================
-
-cg_viewer-development_lenny.show_changes_since = 4b140ce7839d
-cg_viewer-development_lenny.email = cg@lindenlab.com
-
 # ================
 # oz
 # ================
 
+Snowstorm_viewer-project-review.build_debug_release_separately = true
+Snowstorm_viewer-project-review.codeticket_add_context = true
+Snowstorm_viewer-project-review.viewer_channel = "Project Viewer - Snowstorm Team"
+Snowstorm_viewer-project-review.login_channel = "Project Viewer - Snowstorm Team"
+Snowstorm_viewer-project-review.codeticket_add_context = true
+
 oz_viewer-devreview.build_debug_release_separately = true
 oz_viewer-devreview.codeticket_add_context = false
 oz_viewer-devreview.build_enforce_coding_policy = true
+oz_viewer-devreview.email = oz@lindenlab.com
 
-oz_project-1.build_debug_release_separately = true
-oz_project-1.codeticket_add_context = false
-oz_project-2.build_debug_release_separately = true
-oz_project-2.codeticket_add_context = false
-oz_project-3.build_debug_release_separately = true
-oz_project-3.codeticket_add_context = false
-oz_project-4.build_debug_release_separately = true
-oz_project-4.codeticket_add_context = false
+oz_viewer-trial.build_debug_release_separately = true
+oz_viewer-trial.codeticket_add_context = false
+oz_viewer-trial.build_enforce_coding_policy = true
+oz_viewer-trial.email = oz@lindenlab.com
 
 oz_viewer-beta-review.build_debug_release_separately = true
 oz_viewer-beta-review.codeticket_add_context = false
 oz_viewer-beta-review.viewer_channel = "Second Life Beta Viewer"
 oz_viewer-beta-review.login_channel = "Second Life Beta Viewer"
+oz_viewer-beta-review.email = oz@lindenlab.com
 
 # =================================================================
 # asset delivery 2010 projects
diff --git a/autobuild.xml b/autobuild.xml
index 49031b9f173cd6bc4db61658bf3d362bd45b632a..0e4b81324a8ccd1fb116b2cc01d9cf793a5f766d 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -1206,9 +1206,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>7108c2443dbcf4c032305814ce65ebb7</string>
+              <string>4a98d727561cd1f4ac5ee02907411df1</string>
               <key>url</key>
-              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/244065/arch/Darwin/installer/llqtwebkit-4.7.1-darwin-20111028.tar.bz2</string>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/250147/arch/Darwin/installer/llqtwebkit-4.7.1-darwin-20120228.tar.bz2</string>
             </map>
             <key>name</key>
             <string>darwin</string>
@@ -1218,9 +1218,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>c05a33ee8b6f253b5a744596dfc3707d</string>
+              <string>f50e5f0cc880c55b3f0f7e67dc8f7221</string>
               <key>url</key>
-              <string>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-linux-qt4.6-20101013.tar.bz2</string>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/250147/arch/Linux/installer/llqtwebkit-4.7.1-linux-20120228.tar.bz2</string>
             </map>
             <key>name</key>
             <string>linux</string>
@@ -1230,9 +1230,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>24048a31d7b852774dc3117acbd4a86a</string>
+              <string>5e3cd6af397e853a963a6de40d440ff4</string>
               <key>url</key>
-              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/244065/arch/CYGWIN/installer/llqtwebkit-4.7.1-windows-20111028.tar.bz2</string>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/250147/arch/CYGWIN/installer/llqtwebkit-4.7.1-windows-20120228.tar.bz2</string>
             </map>
             <key>name</key>
             <string>windows</string>
diff --git a/build.sh b/build.sh
index c7c89fe3c2bdc40376b04230c94f1e8defe4937a..8ca3208087f6a4729a1f8a991e86f08832a40a26 100755
--- a/build.sh
+++ b/build.sh
@@ -132,10 +132,6 @@ if test -f scripts/update_version_files.py ; then
   end_section UpdateVer
 fi
 
-# Now retrieve the version for use in the version manager
-# First three parts only, $revision will be appended automatically.
-build_viewer_update_version_manager_version=`python scripts/get_version.py --viewer-version | sed 's/\.[0-9]*$//'`
-
 if [ -z "$AUTOBUILD" ]
 then
   export autobuild_dir="$here/../../../autobuild/bin/"
@@ -177,9 +173,6 @@ eval "$("$AUTOBUILD" source_environment)"
 env|sort
 
 
-# Install packages.
-"$AUTOBUILD" install --skip-license-check
-
 # Now run the build
 succeeded=true
 build_processes=
@@ -195,10 +188,19 @@ do
   begin_section "Do$variant"
   build_dir=`build_dir_$arch $variant`
   build_dir_stubs="$build_dir/win_setup/$variant"
+
+  begin_section "PreClean"
   rm -rf "$build_dir"
+  end_section "PreClean"
+
   mkdir -p "$build_dir"
   mkdir -p "$build_dir/tmp"
-  #export TMP="$build_dir/tmp"
+
+  # Install packages.
+  begin_section "AutobuildInstall" 
+  "$AUTOBUILD" install --verbose --skip-license-check
+  end_section "AutobuildInstall" 
+
   if pre_build "$variant" "$build_dir" >> "$build_log" 2>&1
   then
     if $build_link_parallel
diff --git a/doc/contributions.txt b/doc/contributions.txt
index 2b39e15e2a9cf0635d08011a0d993a61eab2ac21..04edfb4bea1a9857e1c875b3ccf4dd84c5d43ba2 100644
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -103,6 +103,7 @@ Aleric Inglewood
 	STORM-163
 	STORM-955
 	STORM-960
+	STORM-1793
 Ales Beaumont
 	VWR-9352
 	SNOW-240
@@ -159,6 +160,7 @@ Alissa Sabre
 	VWR-12620
 	VWR-12789
 	SNOW-322
+    STORM-1723
 Alliez Mysterio
 Angus Boyd
 	VWR-592
@@ -170,6 +172,8 @@ Ansariel Hiller
 	STORM-1101
 	VWR-25480
 	VWR-26150
+	STORM-1685
+	STORM-1713
 Aralara Rajal
 Ardy Lay
 	STORM-859
@@ -230,7 +234,7 @@ Borg Capalini
 Boroondas Gupte
 	OPEN-29
 	OPEN-39
-	OPEN-39
+	OPEN-54
 	OPEN-99
 	SNOW-278
 	SNOW-503
@@ -392,6 +396,8 @@ Frontera Thor
 Fury Rosewood
 Gaberoonie Zanzibar
 Ganymedes Costagravas
+Geenz Spad
+	STORM-1823
 Gene Frostbite
 GeneJ Composer
 Geneko Nemeth
@@ -463,6 +469,8 @@ Hiro Sommambulist
 	VWR-132
 	VWR-136
 	VWR-143
+Hitomi Tiponi
+	STORM-1741
 Holger Gilruth
 Horatio Freund
 Hoze Menges
@@ -482,6 +490,7 @@ Ima Mechanique
 	OPEN-76
 	STORM-959
 	STORM-1175
+	STORM-1708
 Imnotgoing Sideways
 Inma Rau
 Innula Zenovka
@@ -581,11 +590,45 @@ Jonathan Yap
 	STORM-976
 	STORM-1639
 	STORM-910
+	STORM-1653
 	STORM-1642
+	STORM-591
 	STORM-1105
+	STORM-1679
 	STORM-1222
 	STORM-1659
 	STORM-1674
+	STORM-1685
+	STORM-1718
+	STORM-1721
+	STORM-1718
+	STORM-1727
+	STORM-1725
+	STORM-1719
+	STORM-1712
+	STORM-1728
+	STORM-1736
+	STORM-1804
+	STORM-1734
+	STORM-1731
+	STORM-653
+	STORM-1737
+	STORM-1733
+	STORM-1741
+	STORM-1790
+	STORM-1795
+	STORM-1788
+	STORM-1803
+	STORM-1795
+	STORM-1799
+	STORM-1796
+	STORM-1807
+	STORM-1808
+	STORM-637
+	STORM-1822
+	STORM-1809
+	STORM-1793
+	STORM-1810
 Kadah Coba
 	STORM-1060
 Jondan Lundquist
@@ -621,6 +664,7 @@ Kitty Barnett
 	STORM-1001
 	STORM-1175
     VWR-24217
+	STORM-1804
 Kolor Fall
 Komiko Okamoto
 Korvel Noh
@@ -828,6 +872,7 @@ Nicky Perian
 	OPEN-1
 	STORM-1087
 	STORM-1090
+	STORM-1828
 Nicoladie Gymnast
 Nounouch Hapmouche
 	VWR-238
@@ -920,6 +965,7 @@ Robin Cornelius
 	SNOW-599
 	SNOW-747
 	STORM-422
+	STORM-591
 	STORM-960
 	STORM-1019
 	STORM-1095
@@ -1114,6 +1160,9 @@ Tofu Buzzard
 	CTS-411
 	STORM-546
 	VWR-24509
+    STORM-1684
+	SH-2477
+	STORM-1684
 Tony Kembia
 Torben Trautman
 TouchaHoney Perhaps
@@ -1143,6 +1192,8 @@ Unlikely Quintessa
 UsikuFarasi Kanarik
 Vadim Bigbear
 	VWR-2681
+Vaalith Jinn
+    STORM-64
 Vector Hastings
 	VWR-8726
 Veritas Raymaker
@@ -1211,6 +1262,8 @@ WolfPup Lowenhar
 	VWR-20741
 	VWR-20933
 Wundur Primbee
+Xellessanova Zenith
+	STORM-1793
 Xiki Luik
 xstorm Radek
 YongYong Francois
@@ -1233,6 +1286,7 @@ Zi Ree
 	VWR-1140
 	VWR-24017
 	VWR-25588
+	STORM-1790
 Zipherius Turas
 	VWR-76
 	VWR-77
diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index 0266239454c0f8e7feaf76c1fd85695a79661631..98eeed09b3a7448bbf504dadb27a80bbce469f16 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -46,7 +46,7 @@ if (WINDOWS)
   set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MDd /MP -D_SCL_SECURE_NO_WARNINGS=1"
       CACHE STRING "C++ compiler debug options" FORCE)
   set(CMAKE_CXX_FLAGS_RELWITHDEBINFO 
-      "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD /MP /Ob2 -D_SECURE_STL=0"
+      "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD /MP /Ob0 -D_SECURE_STL=0"
       CACHE STRING "C++ compiler release-with-debug options" FORCE)
   set(CMAKE_CXX_FLAGS_RELEASE
       "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /MD /MP /Ob2 -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0"
@@ -62,7 +62,7 @@ if (WINDOWS)
       /D_UNICODE 
       /GS
       /TP
-      /W2
+      /W3
       /c
       /Zc:forScope
       /nologo
diff --git a/indra/cmake/JsonCpp.cmake b/indra/cmake/JsonCpp.cmake
index 499b00fb444328bfc46f2b2493a7de4b3216744d..7ad73e56830a50869ef90bd988db47240d06235b 100644
--- a/indra/cmake/JsonCpp.cmake
+++ b/indra/cmake/JsonCpp.cmake
@@ -18,5 +18,5 @@ else (STANDALONE)
   elseif (LINUX)
     set(JSONCPP_LIBRARIES libjson_linux-gcc-4.1.3_libmt.a)
   endif (WINDOWS)
-  set(JSONCPP_INCLUDE_DIRS "${LIBS_PREBUILT_DIR}/include/jsoncpp" "${LIBS_PREBUILT_DIR}/include/json")
+  set(JSONCPP_INCLUDE_DIR "${LIBS_PREBUILT_DIR}/include/jsoncpp" "${LIBS_PREBUILT_DIR}/include/json")
 endif (STANDALONE)
diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake
index c5f9e2c57911298aa37a712c91ad04e12ce6e37a..47f944f9a5dd377ac5ba12b04ab107a07b7e2d1d 100644
--- a/indra/cmake/Linking.cmake
+++ b/indra/cmake/Linking.cmake
@@ -13,7 +13,7 @@ elseif (LINUX)
   set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/bin)
 elseif (DARWIN)
   set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs)
-  set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs/\$(CONFIGURATION)")
+  set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs")
 endif (WINDOWS)
 
 # Autobuild packages must provide 'release' versions of libraries, but may provide versions for
@@ -33,7 +33,14 @@ else(WINDOWS OR DARWIN)
   set(AUTOBUILD_LIBS_INSTALL_DIRS ${AUTOBUILD_INSTALL_DIR}/lib/${CMAKE_BUILD_TYPE_LOWER})
 endif(WINDOWS OR DARWIN)
 
-list(APPEND AUTOBUILD_LIBS_INSTALL_DIRS ${ARCH_PREBUILT_DIRS_RELEASE})
+if (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
+  # When we're building something other than Release, append the
+  # packages/lib/release directory to deal with autobuild packages that don't
+  # provide (e.g.) lib/debug libraries.
+  list(APPEND AUTOBUILD_LIBS_INSTALL_DIRS ${ARCH_PREBUILT_DIRS_RELEASE})
+  message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}, extending AUTOBUILD_LIBS_INSTALL_DIRS")
+endif (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
+message(STATUS "For ${CMAKE_BUILD_TYPE}, AUTOBUILD_LIBS_INSTALL_DIRS: ${AUTOBUILD_LIBS_INSTALL_DIRS}")
 link_directories(${AUTOBUILD_LIBS_INSTALL_DIRS})
 
 if (LINUX)
diff --git a/indra/cmake/VisualLeakDetector.cmake b/indra/cmake/VisualLeakDetector.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..d3ba554e462621cbc6bff6d0d670f0a89055f01e
--- /dev/null
+++ b/indra/cmake/VisualLeakDetector.cmake
@@ -0,0 +1,15 @@
+# -*- cmake -*-
+
+if (VIEWER)
+
+  set(INCLUDE_VLD_CMAKE OFF CACHE BOOL "Build the Windows viewer with Visual Leak Detector turned on or off")
+
+  if (INCLUDE_VLD_CMAKE)
+
+    if (WINDOWS)
+      add_definitions(-DINCLUDE_VLD=1)
+    endif (WINDOWS)
+
+  endif (INCLUDE_VLD_CMAKE)
+
+endif (VIEWER)
diff --git a/indra/cmake/WebKitLibPlugin.cmake b/indra/cmake/WebKitLibPlugin.cmake
index 91b49e75d737973b81bed22728f15e63685acef3..d9df78bfc8fdec62c4261b6c74208c047e999e51 100644
--- a/indra/cmake/WebKitLibPlugin.cmake
+++ b/indra/cmake/WebKitLibPlugin.cmake
@@ -70,9 +70,10 @@ elseif (LINUX)
         QtNetwork
         QtGui
         QtCore
-        qgif
-        qjpeg
-        jpeg
+        jscore
+#        qgif
+#        qjpeg
+#        jpeg
         fontconfig
         X11
         Xrender
diff --git a/indra/edit-me-to-trigger-new-build.txt b/indra/edit-me-to-trigger-new-build.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/indra/linux_crash_logger/llcrashloggerlinux.cpp b/indra/linux_crash_logger/llcrashloggerlinux.cpp
old mode 100755
new mode 100644
diff --git a/indra/linux_crash_logger/llcrashloggerlinux.h b/indra/linux_crash_logger/llcrashloggerlinux.h
old mode 100755
new mode 100644
diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp
index f0b44f97d28b0d15f3728a4546c77f32e4464b77..7f747c2eca7423591d4ad2eae87cc50c40e6ec7c 100644
--- a/indra/llaudio/llaudiodecodemgr.cpp
+++ b/indra/llaudio/llaudiodecodemgr.cpp
@@ -215,7 +215,7 @@ BOOL LLVorbisDecodeState::initDecode()
 		return(FALSE);
 	}
 	
-	S32 sample_count = ov_pcm_total(&mVF, -1);
+	S32 sample_count = (S32)ov_pcm_total(&mVF, -1);
 	size_t size_guess = (size_t)sample_count;
 	vorbis_info* vi = ov_info(&mVF, -1);
 	size_guess *= (vi? vi->channels : 1);
diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp
index 5e540ad8c58bd2b2ad4b7614329509aa43270a21..5fa28cb90254935db97094f515481b1a2754d0aa 100644
--- a/indra/llaudio/llaudioengine.cpp
+++ b/indra/llaudio/llaudioengine.cpp
@@ -1264,6 +1264,7 @@ LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32
 	mSyncSlave(false),
 	mQueueSounds(false),
 	mPlayedOnce(false),
+	mCorrupted(false),
 	mType(type),
 	mChannelp(NULL),
 	mCurrentDatap(NULL),
@@ -1296,16 +1297,25 @@ void LLAudioSource::setChannel(LLAudioChannel *channelp)
 
 void LLAudioSource::update()
 {
+	if(mCorrupted)
+	{
+		return ; //no need to update
+	}
+
 	if (!getCurrentBuffer())
 	{
 		if (getCurrentData())
 		{
 			// Hack - try and load the sound.  Will do this as a callback
 			// on decode later.
-			if (getCurrentData()->load())
+			if (getCurrentData()->load() && getCurrentData()->getBuffer())
 			{
 				play(getCurrentData()->getID());
-			}			
+			}
+			else
+			{
+				mCorrupted = true ;
+			}
 		}
 	}
 }
@@ -1421,6 +1431,11 @@ bool LLAudioSource::play(const LLUUID &audio_uuid)
 
 bool LLAudioSource::isDone() const
 {
+	if(mCorrupted)
+	{
+		return true ;
+	}
+
 	const F32 MAX_AGE = 60.f;
 	const F32 MAX_UNPLAYED_AGE = 15.f;
 	const F32 MAX_MUTED_AGE = 11.f;
@@ -1736,7 +1751,7 @@ LLAudioData::LLAudioData(const LLUUID &uuid) :
 	}
 }
 
-
+//return false when the audio file is corrupted.
 bool LLAudioData::load()
 {
 	// For now, just assume we're going to use one buffer per audiodata.
@@ -1752,7 +1767,7 @@ bool LLAudioData::load()
 	{
 		// No free buffers, abort.
 		llinfos << "Not able to allocate a new audio buffer, aborting." << llendl;
-		return false;
+		return true;
 	}
 
 	std::string uuid_str;
diff --git a/indra/llaudio/llaudioengine.h b/indra/llaudio/llaudioengine.h
index 30d24906357a724b2ab7b292c6fddfb2a54805a5..28b69e19739bfda0550fb6ed433144bb0007c21f 100644
--- a/indra/llaudio/llaudioengine.h
+++ b/indra/llaudio/llaudioengine.h
@@ -37,6 +37,7 @@
 #include "lluuid.h"
 #include "llframetimer.h"
 #include "llassettype.h"
+#include "llextendedstatus.h"
 
 #include "lllistener.h"
 
@@ -334,6 +335,7 @@ class LLAudioSource
 	bool			mSyncSlave;
 	bool			mQueueSounds;
 	bool			mPlayedOnce;
+	bool            mCorrupted;
 	S32             mType;
 	LLVector3d		mPositionGlobal;
 	LLVector3		mVelocity;
diff --git a/indra/llcharacter/llbvhloader.cpp b/indra/llcharacter/llbvhloader.cpp
index f3cf950afae70deffcafc7a07adabcb4878f415e..2a0df2638491978cfd4e7556f39b9d95383437c7 100644
--- a/indra/llcharacter/llbvhloader.cpp
+++ b/indra/llcharacter/llbvhloader.cpp
@@ -1570,7 +1570,7 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
 		constraint_it++)
 		{
 			U8 byte = constraint_it->mChainLength;
-			dp.packU8(byte, "chain_lenght");
+			dp.packU8(byte, "chain_length");
 			
 			byte = constraint_it->mConstraintType;
 			dp.packU8(byte, "constraint_type");
diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h
index e81a27c2bc1c8895fb37388429f6bfbcf2bc2e36..3ebb2bffb04ec47b8b5a44d856fbd03f0b2452a4 100644
--- a/indra/llcharacter/llcharacter.h
+++ b/indra/llcharacter/llcharacter.h
@@ -126,7 +126,7 @@ class LLCharacter
 
 	virtual void addDebugText( const std::string& text ) = 0;
 
-	virtual const LLUUID&	getID() = 0;
+	virtual const LLUUID&	getID() const = 0;
 	//-------------------------------------------------------------------------
 	// End Interface
 	//-------------------------------------------------------------------------
diff --git a/indra/llcommon/linden_common.h b/indra/llcommon/linden_common.h
index bdcc98e40208d7cd47ff2c39b383613348c4d460..5cfcdab41cd331c43df806e628e0ace851492b89 100644
--- a/indra/llcommon/linden_common.h
+++ b/indra/llcommon/linden_common.h
@@ -52,34 +52,11 @@
 #include <ctime>
 #include <iosfwd>
 
-// Work around Microsoft compiler warnings in STL headers
-#ifdef LL_WINDOWS
-#pragma warning (disable : 4702) // unreachable code
-#pragma warning (disable : 4244) // conversion from time_t to S32
-#endif	//	LL_WINDOWS
-
-// *TODO: Eliminate these, most library .cpp files don't need them.
-// Add them to llviewerprecompiledheaders.h if necessary.
-#include <list>
-#include <map>
-#include <vector>
-#include <string>
-
-#ifdef LL_WINDOWS
-// Reenable warnings we disabled above
-#pragma warning (3 : 4702) // unreachable code, we like level 3, not 4
-// moved msvc warnings to llpreprocessor.h  *TODO - delete this comment after merge conflicts are unlikely -brad
-#endif	//	LL_WINDOWS
-
 // Linden only libs in alpha-order other than stdtypes.h
 // *NOTE: Please keep includes here to a minimum, see above.
 #include "stdtypes.h"
 #include "lldefs.h"
 #include "llerror.h"
-#include "llextendedstatus.h"
-// Don't do this, adds 15K lines of header code to every library file.
-//#include "llfasttimer.h"
 #include "llfile.h"
-#include "llformat.h"
 
 #endif
diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp
index ba3dd6d6b4c0c7e86325e3627668d1cf54360f95..3206843bf4a95e76f875d7e8b9f8c95dfd7d2f25 100644
--- a/indra/llcommon/llavatarname.cpp
+++ b/indra/llcommon/llavatarname.cpp
@@ -106,6 +106,11 @@ std::string LLAvatarName::getCompleteName() const
 
 std::string LLAvatarName::getLegacyName() const
 {
+	if (mLegacyFirstName.empty() && mLegacyLastName.empty()) // display names disabled?
+	{
+		return mDisplayName;
+	}
+
 	std::string name;
 	name.reserve( mLegacyFirstName.size() + 1 + mLegacyLastName.size() );
 	name = mLegacyFirstName;
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index c35799bbb91761845f1ca616a1c3e87ffefdc7a6..e4381dbbd64de5372d288cff8114a928b5349747 100644
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -617,6 +617,12 @@ namespace LLError
 		s.defaultLevel = level;
 	}
 
+	ELevel getDefaultLevel()
+	{
+		Settings& s = Settings::get();
+		return s.defaultLevel;
+	}
+
 	void setFunctionLevel(const std::string& function_name, ELevel level)
 	{
 		Globals& g = Globals::get();
diff --git a/indra/llcommon/llerrorcontrol.h b/indra/llcommon/llerrorcontrol.h
index fb75d45e2c98779b93506e4eb8d01f18e3f948c3..ed9de002f5662418b62346bf321e52f454725b79 100644
--- a/indra/llcommon/llerrorcontrol.h
+++ b/indra/llcommon/llerrorcontrol.h
@@ -75,6 +75,7 @@ namespace LLError
 	
 	LL_COMMON_API void setPrintLocation(bool);
 	LL_COMMON_API void setDefaultLevel(LLError::ELevel);
+	LL_COMMON_API ELevel getDefaultLevel();
 	LL_COMMON_API void setFunctionLevel(const std::string& function_name, LLError::ELevel);
 	LL_COMMON_API void setClassLevel(const std::string& class_name, LLError::ELevel);
 	LL_COMMON_API void setFileLevel(const std::string& file_name, LLError::ELevel);
diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp
index db1ea4792b32546971a14e2c0cd30b7eae50802c..0855180dcd66956a39048907311097a7c6b6abb1 100644
--- a/indra/llcommon/llevents.cpp
+++ b/indra/llcommon/llevents.cpp
@@ -430,13 +430,13 @@ LLBoundListener LLEventPump::listen_impl(const std::string& name, const LLEventL
     {
         // The new node isn't last. Place it between the previous node and
         // the successor.
-        newNode = (myprev + mydmi->second)/2.0;
+        newNode = (myprev + mydmi->second)/2.f;
     }
     else
     {
         // The new node is last. Bump myprev up to the next integer, add
         // 1.0 and use that.
-        newNode = std::ceil(myprev) + 1.0;
+        newNode = std::ceil(myprev) + 1.f;
     }
     // Now that newNode has a value that places it appropriately in mSignal,
     // connect it.
diff --git a/indra/llcommon/llmd5.cpp b/indra/llcommon/llmd5.cpp
index 75fde8e5bae17f1666a3c9f32893ca6e25382004..1409c55d1c5080265eb93ffcfb670bad90917d3f 100644
--- a/indra/llcommon/llmd5.cpp
+++ b/indra/llcommon/llmd5.cpp
@@ -175,7 +175,7 @@ void LLMD5::update(std::istream& stream){
 
   while (stream.good()){
     stream.read( (char*)buffer, BLOCK_LEN); 	/* Flawfinder: ignore */		// note that return value of read is unusable.
-    len=stream.gcount();
+    len=(int)stream.gcount();
     update(buffer, len);
   }
 
diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp
index bb7998c0a882eadcac12e3bce36b4f2e86aeba9d..3b9758f996a9f07e71b34f3e2f038782dc7d7554 100644
--- a/indra/llcommon/llmemory.cpp
+++ b/indra/llcommon/llmemory.cpp
@@ -159,6 +159,7 @@ void LLMemory::logMemoryInfo(BOOL update)
 	if(update)
 	{
 		updateMemoryInfo() ;
+		LLPrivateMemoryPoolManager::getInstance()->updateStatistics() ;
 	}
 
 	llinfos << "Current allocated physical memory(KB): " << sAllocatedMemInKB << llendl ;
diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h
index 17a428753851a7d23a71de9496d018879321419d..7fdb537ab526b30ba693e0046d9102de0ff76fcb 100644
--- a/indra/llcommon/llpreprocessor.h
+++ b/indra/llcommon/llpreprocessor.h
@@ -132,7 +132,7 @@
 #pragma warning( 3       : 4265 )	// "class has virtual functions, but destructor is not virtual"
 #pragma warning( 3      :  4266 )	// 'function' : no override available for virtual member function from base 'type'; function is hidden
 #pragma warning (disable : 4180)	// qualifier applied to function type has no meaning; ignored
-#pragma warning( disable : 4284 )	// silly MS warning deep inside their <map> include file
+//#pragma warning( disable : 4284 )	// silly MS warning deep inside their <map> include file
 #pragma warning( disable : 4503 )	// 'decorated name length exceeded, name was truncated'. Does not seem to affect compilation.
 #pragma warning( disable : 4800 )	// 'BOOL' : forcing value to bool 'true' or 'false' (performance warning)
 #pragma warning( disable : 4996 )	// warning: deprecated
@@ -151,6 +151,8 @@
 
 #pragma warning (disable : 4251) // member needs to have dll-interface to be used by clients of class
 #pragma warning (disable : 4275) // non dll-interface class used as base for dll-interface class
+#pragma warning (disable : 4018) // '<' : signed/unsigned mismatch	
+
 #endif	//	LL_MSVC
 
 #if LL_WINDOWS
diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp
index 5dee7a3541ee1f4e4a161b15725286ca005d8742..1738c16dea4be7ef1ac72c80a0f4a01e9b3fdf48 100644
--- a/indra/llcommon/llqueuedthread.cpp
+++ b/indra/llcommon/llqueuedthread.cpp
@@ -109,7 +109,7 @@ void LLQueuedThread::shutdown()
 
 // MAIN THREAD
 // virtual
-S32 LLQueuedThread::update(U32 max_time_ms)
+S32 LLQueuedThread::update(F32 max_time_ms)
 {
 	if (!mStarted)
 	{
@@ -122,7 +122,7 @@ S32 LLQueuedThread::update(U32 max_time_ms)
 	return updateQueue(max_time_ms);
 }
 
-S32 LLQueuedThread::updateQueue(U32 max_time_ms)
+S32 LLQueuedThread::updateQueue(F32 max_time_ms)
 {
 	F64 max_time = (F64)max_time_ms * .001;
 	LLTimer timer;
diff --git a/indra/llcommon/llqueuedthread.h b/indra/llcommon/llqueuedthread.h
index 499d13a79201126a074feffb8cfef4cd2c26d327..d3704b0fe22ad4e43d509e99901ebb6b215951aa 100644
--- a/indra/llcommon/llqueuedthread.h
+++ b/indra/llcommon/llqueuedthread.h
@@ -173,8 +173,8 @@ class LL_COMMON_API LLQueuedThread : public LLThread
 public:
 	bool waitForResult(handle_t handle, bool auto_complete = true);
 
-	virtual S32 update(U32 max_time_ms);
-	S32 updateQueue(U32 max_time_ms);
+	virtual S32 update(F32 max_time_ms);
+	S32 updateQueue(F32 max_time_ms);
 	
 	void waitOnPending();
 	void printQueueStats();
diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp
index 6ca073744511c0052ed43be9993a215017376936..e295e3c621d7788fc6ac1475fe57965e7da463a9 100644
--- a/indra/llcommon/llsd.cpp
+++ b/indra/llcommon/llsd.cpp
@@ -24,6 +24,9 @@
  * $/LicenseInfo$
  */
 
+// Must turn on conditional declarations in header file so definitions end up
+// with proper linkage.
+#define LLSD_DEBUG_INFO
 #include "linden_common.h"
 #include "llsd.h"
 
@@ -31,6 +34,7 @@
 #include "../llmath/llmath.h"
 #include "llformat.h"
 #include "llsdserialize.h"
+#include "stringize.h"
 
 #ifndef LL_RELEASE_FOR_DOWNLOAD
 #define NAME_UNNAMED_NAMESPACE
@@ -50,6 +54,18 @@ namespace
 using namespace LLSDUnnamedNamespace;
 #endif
 
+namespace llsd
+{
+
+// statics
+S32	sLLSDAllocationCount = 0;
+S32 sLLSDNetObjects = 0;
+
+} // namespace llsd
+
+#define	ALLOC_LLSD_OBJECT			{ llsd::sLLSDNetObjects++;	llsd::sLLSDAllocationCount++;	}
+#define	FREE_LLSD_OBJECT			{ llsd::sLLSDNetObjects--;									}
+
 class LLSD::Impl
 	/**< This class is the abstract base class of the implementation of LLSD
 		 It provides the reference counting implementation, and the default
@@ -58,13 +74,10 @@ class LLSD::Impl
 		
 	*/
 {
-private:
-	U32 mUseCount;
-	
 protected:
 	Impl();
 
-	enum StaticAllocationMarker { STATIC };
+	enum StaticAllocationMarker { STATIC_USAGE_COUNT = 0xFFFFFFFF };
 	Impl(StaticAllocationMarker);
 		///< This constructor is used for static objects and causes the
 		//   suppresses adjusting the debugging counters when they are
@@ -72,8 +85,10 @@ class LLSD::Impl
 		
 	virtual ~Impl();
 	
-	bool shared() const							{ return mUseCount > 1; }
+	bool shared() const							{ return (mUseCount > 1) && (mUseCount != STATIC_USAGE_COUNT); }
 	
+	U32 mUseCount;
+
 public:
 	static void reset(Impl*& var, Impl* impl);
 		///< safely set var to refer to the new impl (possibly shared)
@@ -128,6 +143,18 @@ class LLSD::Impl
 	virtual LLSD::array_const_iterator beginArray() const { return endArray(); }
 	virtual LLSD::array_const_iterator endArray() const { static const std::vector<LLSD> empty; return empty.end(); }
 
+	virtual void dumpStats() const;
+	virtual void calcStats(S32 type_counts[], S32 share_counts[]) const;
+	// Container subclasses contain LLSD objects, rather than directly
+	// containing Impl objects. This helper forwards through LLSD.
+	void calcStats(const LLSD& llsd, S32 type_counts[], S32 share_counts[]) const
+	{
+		safe(llsd.impl).calcStats(type_counts, share_counts);
+	}
+
+	static const Impl& getImpl(const LLSD& llsd)	{ return safe(llsd.impl); }
+	static Impl& getImpl(LLSD& llsd)				{ return safe(llsd.impl); }
+
 	static const LLSD& undef();
 	
 	static U32 sAllocationCount;
@@ -360,6 +387,9 @@ namespace
 		LLSD::map_iterator endMap() { return mData.end(); }
 		virtual LLSD::map_const_iterator beginMap() const { return mData.begin(); }
 		virtual LLSD::map_const_iterator endMap() const { return mData.end(); }
+
+		virtual void dumpStats() const;
+		virtual void calcStats(S32 type_counts[], S32 share_counts[]) const;
 	};
 	
 	ImplMap& ImplMap::makeMap(LLSD::Impl*& var)
@@ -414,6 +444,34 @@ namespace
 		return i->second;
 	}
 
+	void ImplMap::dumpStats() const
+	{
+		std::cout << "Map size: " << mData.size() << std::endl;
+
+		std::cout << "LLSD Net Objects: " << llsd::sLLSDNetObjects << std::endl;
+		std::cout << "LLSD allocations: " << llsd::sLLSDAllocationCount << std::endl;
+
+		std::cout << "LLSD::Impl Net Objects: " << sOutstandingCount << std::endl;
+		std::cout << "LLSD::Impl allocations: " << sAllocationCount << std::endl;
+
+		Impl::dumpStats();
+	}
+
+	void ImplMap::calcStats(S32 type_counts[], S32 share_counts[]) const
+	{
+		LLSD::map_const_iterator iter = beginMap();
+		while (iter != endMap())
+		{
+			//std::cout << "  " << (*iter).first << ": " << (*iter).second << std::endl;
+			Impl::calcStats((*iter).second, type_counts, share_counts);
+			iter++;
+		}
+
+		// Add in the values for this map
+		Impl::calcStats(type_counts, share_counts);
+	}
+
+
 	class ImplArray : public LLSD::Impl
 	{
 	private:
@@ -449,6 +507,8 @@ namespace
 		LLSD::array_iterator endArray() { return mData.end(); }
 		virtual LLSD::array_const_iterator beginArray() const { return mData.begin(); }
 		virtual LLSD::array_const_iterator endArray() const { return mData.end(); }
+
+		virtual void calcStats(S32 type_counts[], S32 share_counts[]) const;
 	};
 
 	ImplArray& ImplArray::makeArray(Impl*& var)
@@ -490,12 +550,13 @@ namespace
 	
 	void ImplArray::insert(LLSD::Integer i, const LLSD& v)
 	{
-		if (i < 0) {
+		if (i < 0) 
+		{
 			return;
 		}
 		DataVector::size_type index = i;
 		
-		if (index >= mData.size())
+		if (index >= mData.size())	// tbd - sanity check limit for index ?
 		{
 			mData.resize(index + 1);
 		}
@@ -543,6 +604,19 @@ namespace
 		
 		return mData[index];
 	}
+
+	void ImplArray::calcStats(S32 type_counts[], S32 share_counts[]) const
+	{
+		LLSD::array_const_iterator iter = beginArray();
+		while (iter != endArray())
+		{	// Add values for all items held in the array
+			Impl::calcStats((*iter), type_counts, share_counts);
+			iter++;
+		}
+
+		// Add in the values for this array
+		Impl::calcStats(type_counts, share_counts);
+	}
 }
 
 LLSD::Impl::Impl()
@@ -564,8 +638,11 @@ LLSD::Impl::~Impl()
 
 void LLSD::Impl::reset(Impl*& var, Impl* impl)
 {
-	if (impl) ++impl->mUseCount;
-	if (var  &&  --var->mUseCount == 0)
+	if (impl && impl->mUseCount != STATIC_USAGE_COUNT) 
+	{
+		++impl->mUseCount;
+	}
+	if (var  &&  var->mUseCount != STATIC_USAGE_COUNT && --var->mUseCount == 0)
 	{
 		delete var;
 	}
@@ -574,13 +651,13 @@ void LLSD::Impl::reset(Impl*& var, Impl* impl)
 
 LLSD::Impl& LLSD::Impl::safe(Impl* impl)
 {
-	static Impl theUndefined(STATIC);
+	static Impl theUndefined(STATIC_USAGE_COUNT);
 	return impl ? *impl : theUndefined;
 }
 
 const LLSD::Impl& LLSD::Impl::safe(const Impl* impl)
 {
-	static Impl theUndefined(STATIC);
+	static Impl theUndefined(STATIC_USAGE_COUNT);
 	return impl ? *impl : theUndefined;
 }
 
@@ -656,6 +733,43 @@ const LLSD& LLSD::Impl::undef()
 	return immutableUndefined;
 }
 
+void LLSD::Impl::dumpStats() const
+{
+	S32 type_counts[LLSD::TypeLLSDNumTypes + 1];
+	memset(&type_counts, 0, sizeof(type_counts));
+
+	S32 share_counts[LLSD::TypeLLSDNumTypes + 1];
+	memset(&share_counts, 0, sizeof(share_counts));
+
+	// Add info from all the values this object has
+	calcStats(type_counts, share_counts);
+
+	S32 type_index = LLSD::TypeLLSDTypeBegin;
+	while (type_index != LLSD::TypeLLSDTypeEnd)
+	{
+		std::cout << LLSD::typeString((LLSD::Type)type_index) << " type "
+			<< type_counts[type_index] << " objects, "
+			<< share_counts[type_index] << " shared"
+			<< std::endl;
+		type_index++;
+	}
+}
+
+
+void LLSD::Impl::calcStats(S32 type_counts[], S32 share_counts[]) const
+{
+	S32 tp = S32(type());
+	if (0 <= tp && tp < LLSD::TypeLLSDNumTypes)
+	{
+		type_counts[tp]++;	
+		if (shared())
+		{
+			share_counts[tp]++;
+		}
+	}
+}
+
+
 U32 LLSD::Impl::sAllocationCount = 0;
 U32 LLSD::Impl::sOutstandingCount = 0;
 
@@ -681,10 +795,10 @@ namespace
 }
 
 
-LLSD::LLSD()							: impl(0)	{ }
-LLSD::~LLSD()							{ Impl::reset(impl, 0); }
+LLSD::LLSD() : impl(0)					{ ALLOC_LLSD_OBJECT; }
+LLSD::~LLSD()							{ FREE_LLSD_OBJECT; Impl::reset(impl, 0); }
 
-LLSD::LLSD(const LLSD& other)			: impl(0) { assign(other); }
+LLSD::LLSD(const LLSD& other) : impl(0) { ALLOC_LLSD_OBJECT;  assign(other); }
 void LLSD::assign(const LLSD& other)	{ Impl::assign(impl, other.impl); }
 
 
@@ -692,18 +806,18 @@ void LLSD::clear()						{ Impl::assignUndefined(impl); }
 
 LLSD::Type LLSD::type() const			{ return safe(impl).type(); }
 
-// Scaler Constructors
-LLSD::LLSD(Boolean v)					: impl(0) { assign(v); }
-LLSD::LLSD(Integer v)					: impl(0) { assign(v); }
-LLSD::LLSD(Real v)						: impl(0) { assign(v); }
-LLSD::LLSD(const UUID& v)				: impl(0) { assign(v); }
-LLSD::LLSD(const String& v)				: impl(0) { assign(v); }
-LLSD::LLSD(const Date& v)				: impl(0) { assign(v); }
-LLSD::LLSD(const URI& v)				: impl(0) { assign(v); }
-LLSD::LLSD(const Binary& v)				: impl(0) { assign(v); }
+// Scalar Constructors
+LLSD::LLSD(Boolean v) : impl(0)			{ ALLOC_LLSD_OBJECT;	assign(v); }
+LLSD::LLSD(Integer v) : impl(0)			{ ALLOC_LLSD_OBJECT;	assign(v); }
+LLSD::LLSD(Real v) : impl(0)			{ ALLOC_LLSD_OBJECT;	assign(v); }
+LLSD::LLSD(const UUID& v) : impl(0)		{ ALLOC_LLSD_OBJECT;	assign(v); }
+LLSD::LLSD(const String& v) : impl(0)	{ ALLOC_LLSD_OBJECT;	assign(v); }
+LLSD::LLSD(const Date& v) : impl(0)		{ ALLOC_LLSD_OBJECT;	assign(v); }
+LLSD::LLSD(const URI& v) : impl(0)		{ ALLOC_LLSD_OBJECT;	assign(v); }
+LLSD::LLSD(const Binary& v) : impl(0)	{ ALLOC_LLSD_OBJECT;	assign(v); }
 
 // Convenience Constructors
-LLSD::LLSD(F32 v)						: impl(0) { assign((Real)v); }
+LLSD::LLSD(F32 v) : impl(0)				{ ALLOC_LLSD_OBJECT;	assign((Real)v); }
 
 // Scalar Assignment
 void LLSD::assign(Boolean v)			{ safe(impl).assign(impl, v); }
@@ -726,7 +840,7 @@ LLSD::URI		LLSD::asURI() const		{ return safe(impl).asURI(); }
 LLSD::Binary	LLSD::asBinary() const	{ return safe(impl).asBinary(); }
 
 // const char * helpers
-LLSD::LLSD(const char* v)				: impl(0) { assign(v); }
+LLSD::LLSD(const char* v) : impl(0)		{ ALLOC_LLSD_OBJECT;	assign(v); }
 void LLSD::assign(const char* v)
 {
 	if(v) assign(std::string(v));
@@ -784,9 +898,6 @@ LLSD&		LLSD::operator[](Integer i)
 const LLSD& LLSD::operator[](Integer i) const
 										{ return safe(impl).ref(i); }
 
-U32 LLSD::allocationCount()				{ return Impl::sAllocationCount; }
-U32 LLSD::outstandingCount()			{ return Impl::sOutstandingCount; }
-
 static const char *llsd_dump(const LLSD &llsd, bool useXMLFormat)
 {
 	// sStorage is used to hold the string representation of the llsd last
@@ -801,15 +912,9 @@ static const char *llsd_dump(const LLSD &llsd, bool useXMLFormat)
 	{
 		std::ostringstream out;
 		if (useXMLFormat)
-		{
-			LLSDXMLStreamer xml_streamer(llsd);
-			out << xml_streamer;
-		}
+			out << LLSDXMLStreamer(llsd);
 		else
-		{
-			LLSDNotationStreamer notation_streamer(llsd);
-			out << notation_streamer;
-		}
+			out << LLSDNotationStreamer(llsd);
 		out_string = out.str();
 	}
 	int len = out_string.length();
@@ -840,3 +945,38 @@ LLSD::array_iterator		LLSD::beginArray()		{ return makeArray(impl).beginArray();
 LLSD::array_iterator		LLSD::endArray()		{ return makeArray(impl).endArray(); }
 LLSD::array_const_iterator	LLSD::beginArray() const{ return safe(impl).beginArray(); }
 LLSD::array_const_iterator	LLSD::endArray() const	{ return safe(impl).endArray(); }
+
+namespace llsd
+{
+
+U32 allocationCount()								{ return LLSD::Impl::sAllocationCount; }
+U32 outstandingCount()								{ return LLSD::Impl::sOutstandingCount; }
+
+// Diagnostic dump of contents in an LLSD object
+void dumpStats(const LLSD& llsd)					{ LLSD::Impl::getImpl(llsd).dumpStats(); }
+
+} // namespace llsd
+
+// static
+std::string		LLSD::typeString(Type type)
+{
+	static const char * sTypeNameArray[] = {
+		"Undefined",
+		"Boolean",
+		"Integer",
+		"Real",
+		"String",
+		"UUID",
+		"Date",
+		"URI",
+		"Binary",
+		"Map",
+		"Array"
+	};
+
+	if (0 <= type && type < LL_ARRAY_SIZE(sTypeNameArray))
+	{
+		return sTypeNameArray[type];
+	}
+	return STRINGIZE("** invalid type value " << type);
+}
diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h
index 90d0f978730d61f165f2e3d429f972e71211a7b4..5eb69059ac6e5f41e4f76504f6d081419652766f 100644
--- a/indra/llcommon/llsd.h
+++ b/indra/llcommon/llsd.h
@@ -40,10 +40,10 @@
 /**
 	LLSD provides a flexible data system similar to the data facilities of
 	dynamic languages like Perl and Python.  It is created to support exchange
-	of structured data between loosly coupled systems.  (Here, "loosly coupled"
+	of structured data between loosely coupled systems.  (Here, "loosely coupled"
 	means not compiled together into the same module.)
 	
-	Data in such exchanges must be highly tollerant of changes on either side
+	Data in such exchanges must be highly tolerant of changes on either side
 	such as:
 			- recompilation
 			- implementation in a different langauge
@@ -51,19 +51,19 @@
 			- execution of older versions (with fewer parameters)
 
 	To this aim, the C++ API of LLSD strives to be very easy to use, and to
-	default to "the right thing" whereever possible.  It is extremely tollerant
+	default to "the right thing" wherever possible.  It is extremely tolerant
 	of errors and unexpected situations.
 	
-	The fundimental class is LLSD.  LLSD is a value holding object.  It holds
+	The fundamental class is LLSD.  LLSD is a value holding object.  It holds
 	one value that is either undefined, one of the scalar types, or a map or an
 	array.  LLSD objects have value semantics (copying them copies the value,
-	though it can be considered efficient, due to shareing.), and mutable.
+	though it can be considered efficient, due to sharing), and mutable.
 
 	Undefined is the singular value given to LLSD objects that are not
 	initialized with any data.  It is also used as the return value for
-	operations that return an LLSD,
+	operations that return an LLSD.
 	
-	The sclar data types are:
+	The scalar data types are:
 		- Boolean	- true or false
 		- Integer	- a 32 bit signed integer
 		- Real		- a 64 IEEE 754 floating point value
@@ -80,9 +80,73 @@
 	
 	An array is a sequence of zero or more LLSD values.
 	
+	Thread Safety
+
+	In general, these LLSD classes offer *less* safety than STL container
+	classes.  Implementations prior to this one were unsafe even when
+	completely unrelated LLSD trees were in two threads due to reference
+	sharing of special 'undefined' values that participated in the reference
+	counting mechanism.
+
+	The dereference-before-refcount and aggressive tree sharing also make
+	it impractical to share an LLSD across threads.  A strategy of passing
+	ownership or a copy to another thread is still difficult due to a lack
+	of a cloning interface but it can be done with some care.
+
+	One way of transferring ownership is as follows:
+
+		void method(const LLSD input) {
+		...
+		LLSD * xfer_tree = new LLSD();
+		{
+			// Top-level values
+			(* xfer_tree)['label'] = "Some text";
+			(* xfer_tree)['mode'] = APP_MODE_CONSTANT;
+
+			// There will be a second-level
+			LLSD subtree(LLSD::emptyMap());
+			(* xfer_tree)['subtree'] = subtree;
+
+			// Do *not* copy from LLSD objects via LLSD
+			// intermediaries.  Only use plain-old-data
+			// types as intermediaries to prevent reference
+			// sharing.
+			subtree['value1'] = input['value1'].asInteger();
+			subtree['value2'] = input['value2'].asString();
+
+			// Close scope and drop 'subtree's reference.
+			// Only xfer_tree has a reference to the second
+			// level data.
+		}
+		...
+		// Transfer the LLSD pointer to another thread.  Ownership
+		// transfers, this thread no longer has a reference to any
+		// part of the xfer_tree and there's nothing to free or
+		// release here.  Receiving thread does need to delete the
+		// pointer when it is done with the LLSD.  Transfer
+		// mechanism must perform correct data ordering operations
+		// as dictated by architecture.
+		other_thread.sendMessageAndPointer("Take This", xfer_tree);
+		xfer_tree = NULL;
+
+
+	Avoid this pattern which provides half of a race condition:
+	
+		void method(const LLSD input) {
+		...
+		LLSD xfer_tree(LLSD::emptyMap());
+		xfer_tree['label'] = "Some text";
+		xfer_tree['mode'] = APP_MODE_CONSTANT;
+		...
+		other_thread.sendMessageAndPointer("Take This", xfer_tree);
+
+	
 	@nosubgrouping
 */
 
+// Normally undefined, used for diagnostics
+//#define LLSD_DEBUG_INFO	1
+
 class LL_COMMON_API LLSD
 {
 public:
@@ -202,7 +266,7 @@ class LL_COMMON_API LLSD
 	//@}
 	
 	/** @name Character Pointer Helpers
-		These are helper routines to make working with char* the same as easy as
+		These are helper routines to make working with char* as easy as
 		working with strings.
 	 */
 	//@{
@@ -266,7 +330,7 @@ class LL_COMMON_API LLSD
 	/** @name Type Testing */
 	//@{
 		enum Type {
-			TypeUndefined,
+			TypeUndefined = 0,
 			TypeBoolean,
 			TypeInteger,
 			TypeReal,
@@ -276,7 +340,10 @@ class LL_COMMON_API LLSD
 			TypeURI,
 			TypeBinary,
 			TypeMap,
-			TypeArray
+			TypeArray,
+			TypeLLSDTypeEnd,
+			TypeLLSDTypeBegin = TypeUndefined,
+			TypeLLSDNumTypes = (TypeLLSDTypeEnd - TypeLLSDTypeBegin)
 		};
 		
 		Type type() const;
@@ -302,7 +369,7 @@ class LL_COMMON_API LLSD
 		If you get a linker error about these being missing, you have made
 		mistake in your code.  DO NOT IMPLEMENT THESE FUNCTIONS as a fix.
 		
-		All of thse problems stem from trying to support char* in LLSD or in
+		All of these problems stem from trying to support char* in LLSD or in
 		std::string.  There are too many automatic casts that will lead to
 		using an arbitrary pointer or scalar type to std::string.
 	 */
@@ -311,7 +378,7 @@ class LL_COMMON_API LLSD
 		void assign(const void*);		///< assign from arbitrary pointers
 		LLSD& operator=(const void*);	///< assign from arbitrary pointers
 		
-		bool has(Integer) const;		///< has only works for Maps
+		bool has(Integer) const;		///< has() only works for Maps
 	//@}
 	
 	/** @name Implementation */
@@ -320,13 +387,7 @@ class LL_COMMON_API LLSD
 		class Impl;
 private:
 		Impl* impl;
-	//@}
-	
-	/** @name Unit Testing Interface */
-	//@{
-public:
-		static U32 allocationCount();	///< how many Impls have been made
-		static U32 outstandingCount();	///< how many Impls are still alive
+		friend class LLSD::Impl;
 	//@}
 
 private:
@@ -338,6 +399,10 @@ class LL_COMMON_API LLSD
 		/// Returns Notation version of llsd -- only to be called from debugger
 		static const char *dump(const LLSD &llsd);
 	//@}
+
+public:
+
+	static std::string		typeString(Type type);		// Return human-readable type as a string
 };
 
 struct llsd_select_bool : public std::unary_function<LLSD, LLSD::Boolean>
@@ -385,9 +450,32 @@ struct llsd_select_string : public std::unary_function<LLSD, LLSD::String>
 
 LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLSD& llsd);
 
+namespace llsd
+{
+
+#ifdef LLSD_DEBUG_INFO
+/** @name Unit Testing Interface */
+//@{
+	LL_COMMON_API void dumpStats(const LLSD&);	///< Output information on object and usage
+
+	/// @warn THE FOLLOWING COUNTS WILL NOT BE ACCURATE IN A MULTI-THREADED
+	/// ENVIRONMENT.
+	///
+	/// These counts track LLSD::Impl (hidden) objects.
+	LL_COMMON_API U32 allocationCount();	///< how many Impls have been made
+	LL_COMMON_API U32 outstandingCount();	///< how many Impls are still alive
+
+	/// These counts track LLSD (public) objects.
+	LL_COMMON_API extern S32 sLLSDAllocationCount;	///< Number of LLSD objects ever created
+	LL_COMMON_API extern S32 sLLSDNetObjects;		///< Number of LLSD objects that exist
+#endif
+//@}
+
+} // namespace llsd
+
 /** QUESTIONS & TO DOS
-	- Would Binary be more convenient as usigned char* buffer semantics?
-	- Should Binary be convertable to/from String, and if so how?
+	- Would Binary be more convenient as unsigned char* buffer semantics?
+	- Should Binary be convertible to/from String, and if so how?
 		- as UTF8 encoded strings (making not like UUID<->String)
 		- as Base64 or Base96 encoded (making like UUID<->String)
 	- Conversions to std::string and LLUUID do not result in easy assignment
diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp
index bf626005143565b67d42fdf45ddec516cc743067..b419101b7e59b9c9adee29b12e12187381cb7867 100644
--- a/indra/llcommon/llsdserialize.cpp
+++ b/indra/llcommon/llsdserialize.cpp
@@ -110,7 +110,7 @@ bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, S32 max_bytes)
 	if (!strncasecmp(LEGACY_NON_HEADER, hdr_buf, strlen(LEGACY_NON_HEADER))) /* Flawfinder: ignore */
 	{
 		legacy_no_header = true;
-		inbuf = str.gcount();
+		inbuf = (int)str.gcount();
 	}
 	else
 	{
@@ -343,7 +343,7 @@ std::istream& LLSDParser::get(
 	char delim) const
 {
 	istr.get(s, n, delim);
-	if(mCheckLimits) mMaxBytesLeft -= istr.gcount();
+	if(mCheckLimits) mMaxBytesLeft -= (int)istr.gcount();
 	return istr;
 }
 
@@ -353,7 +353,7 @@ std::istream& LLSDParser::get(
 		char delim) const		
 {
 	istr.get(sb, delim);
-	if(mCheckLimits) mMaxBytesLeft -= istr.gcount();
+	if(mCheckLimits) mMaxBytesLeft -= (int)istr.gcount();
 	return istr;
 }
 
@@ -377,7 +377,7 @@ std::istream& LLSDParser::read(
 	std::streamsize n) const
 {
 	istr.read(s, n);
-	if(mCheckLimits) mMaxBytesLeft -= istr.gcount();
+	if(mCheckLimits) mMaxBytesLeft -= (int)istr.gcount();
 	return istr;
 }
 
@@ -789,7 +789,7 @@ bool LLSDNotationParser::parseBinary(std::istream& istr, LLSD& data) const
 		if(len)
 		{
 			value.resize(len);
-			account(fullread(istr, (char *)&value[0], len));
+			account((int)fullread(istr, (char *)&value[0], len));
 		}
 		c = get(istr); // strip off the trailing double-quote
 		data = value;
@@ -1069,7 +1069,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const
 			if(size > 0)
 			{
 				value.resize(size);
-				account(fullread(istr, (char*)&value[0], size));
+				account((int)fullread(istr, (char*)&value[0], size));
 			}
 			data = value;
 		}
@@ -1200,7 +1200,7 @@ bool LLSDBinaryParser::parseString(
 	if(size)
 	{
 		buf.resize(size);
-		account(fullread(istr, &buf[0], size));
+		account((int)fullread(istr, &buf[0], size));
 		value.assign(buf.begin(), buf.end());
 	}
 	return true;
@@ -1642,7 +1642,7 @@ int deserialize_string_raw(
 	const S32 BUF_LEN = 20;
 	char buf[BUF_LEN];		/* Flawfinder: ignore */
 	istr.get(buf, BUF_LEN - 1, ')');
-	count += istr.gcount();
+	count += (int)istr.gcount();
 	int c = istr.get();
 	c = istr.get();
 	count += 2;
@@ -1657,7 +1657,7 @@ int deserialize_string_raw(
 		if(len)
 		{
 			buf.resize(len);
-			count += fullread(istr, (char *)&buf[0], len);
+			count += (int)fullread(istr, (char *)&buf[0], len);
 			value.assign(buf.begin(), buf.end());
 		}
 		c = istr.get();
diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp
index be9db539068a20fadf519c98fb447def08369553..34b3dbb99a3ff05dd5de91a06879b69ce5bcc5a6 100644
--- a/indra/llcommon/llsdserialize_xml.cpp
+++ b/indra/llcommon/llsdserialize_xml.cpp
@@ -464,7 +464,7 @@ S32 LLSDXMLParser::Impl::parseLines(std::istream& input, LLSD& data)
 			}
 		}
 
-		status = XML_ParseBuffer(mParser, num_read, false);
+		status = XML_ParseBuffer(mParser, (int)num_read, false);
 		if (status == XML_STATUS_ERROR)
 		{
 			break;
diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h
index 65c7297cbf8a7151db93f6d20935717b05e62bb8..532d3f934139c5542617d163204d5727e47464aa 100644
--- a/indra/llcommon/llsdutil.h
+++ b/indra/llcommon/llsdutil.h
@@ -308,7 +308,7 @@ class LLSDParam<T>                              \
 {                                               \
 public:                                         \
     LLSDParam(const LLSD& value):               \
-        _value(value.AS())                      \
+        _value((T)value.AS())                      \
     {}                                          \
                                                 \
     operator T() const { return _value; }       \
diff --git a/indra/llcommon/llstat.cpp b/indra/llcommon/llstat.cpp
index b2c495d093ebdbcb3fab98262f91ad0fd4114761..057257057f58a35a7de69099e4233367107394de 100644
--- a/indra/llcommon/llstat.cpp
+++ b/indra/llcommon/llstat.cpp
@@ -593,7 +593,7 @@ void LLStatTime::stop()
 {
     if ( LLStatAccum::SCALE_PER_FRAME == scale )
     {
-        return mTotalTimeInFrame;
+        return (F32)mTotalTimeInFrame;
     }
     else
     {
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp
index d781687175eb4476b1997361fa925497e92a5b38..6073bcd0a6cc8713b0d2bdbe6be3635c1be57b6c 100644
--- a/indra/llcommon/llsys.cpp
+++ b/indra/llcommon/llsys.cpp
@@ -608,6 +608,7 @@ LLCPUInfo::LLCPUInfo()
 		out << " (" << mCPUMHz << " MHz)";
 	}
 	mCPUString = out.str();
+	LLStringUtil::trim(mCPUString);
 }
 
 bool LLCPUInfo::hasAltivec() const
@@ -1363,11 +1364,21 @@ BOOL gzip_file(const std::string& srcfile, const std::string& dstfile)
 	src = LLFile::fopen(srcfile, "rb");		/* Flawfinder: ignore */
 	if (! src) goto err;
 
-	do
+	while ((bytes = (S32)fread(buffer, sizeof(U8), COMPRESS_BUFFER_SIZE, src)) > 0)
 	{
-		bytes = (S32)fread(buffer, sizeof(U8), COMPRESS_BUFFER_SIZE,src);
-		gzwrite(dst, buffer, bytes);
-	} while(feof(src) == 0);
+		if (gzwrite(dst, buffer, bytes) <= 0)
+		{
+			llwarns << "gzwrite failed: " << gzerror(dst, NULL) << llendl;
+			goto err;
+		}
+	}
+
+	if (ferror(src))
+	{
+		llwarns << "Error reading " << srcfile << llendl;
+		goto err;
+	}
+
 	gzclose(dst);
 	dst = NULL;
 #if LL_WINDOWS
diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp
index 4063cc730b49e5b470c6f534f19dc49b4e015218..a6ad6b125c1ad14cd1a9370f0713ed2159be655c 100644
--- a/indra/llcommon/llthread.cpp
+++ b/indra/llcommon/llthread.cpp
@@ -337,11 +337,7 @@ LLMutex::~LLMutex()
 
 void LLMutex::lock()
 {
-#if LL_DARWIN
-	if (mLockingThread == LLThread::currentID())
-#else
-	if (mLockingThread == sThreadID)
-#endif
+	if(isSelfLocked())
 	{ //redundant lock
 		mCount++;
 		return;
@@ -398,6 +394,15 @@ bool LLMutex::isLocked()
 	}
 }
 
+bool LLMutex::isSelfLocked()
+{
+#if LL_DARWIN
+	return mLockingThread == LLThread::currentID();
+#else
+	return mLockingThread == sThreadID;
+#endif
+}
+
 U32 LLMutex::lockingThread() const
 {
 	return mLockingThread;
diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h
index 40291a25693717f212f835c9909ceb48ad79cd0d..b52e70ab2ebcb637ac5fed388ba3b9ef285abb0e 100644
--- a/indra/llcommon/llthread.h
+++ b/indra/llcommon/llthread.h
@@ -151,6 +151,7 @@ class LL_COMMON_API LLMutex
 	void lock();		// blocks
 	void unlock();
 	bool isLocked(); 	// non-blocking, but does do a lock/unlock so not free
+	bool isSelfLocked(); //return true if locked in a same thread
 	U32 lockingThread() const; //get ID of locking thread
 	
 protected:
@@ -187,11 +188,14 @@ class LLMutexLock
 	LLMutexLock(LLMutex* mutex)
 	{
 		mMutex = mutex;
-		mMutex->lock();
+		
+		if(mMutex)
+			mMutex->lock();
 	}
 	~LLMutexLock()
 	{
-		mMutex->unlock();
+		if(mMutex)
+			mMutex->unlock();
 	}
 private:
 	LLMutex* mMutex;
diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp
index 38054b636ea03b3305c252879b8d01e624fc7904..9ebc6de7f40826a4829cdc0603fc371c405957e1 100644
--- a/indra/llcommon/lltimer.cpp
+++ b/indra/llcommon/lltimer.cpp
@@ -83,7 +83,7 @@ U32 micro_sleep(U64 us, U32 max_yields)
 {
     // max_yields is unused; just fiddle with it to avoid warnings.
     max_yields = 0;
-    ms_sleep(us / 1000);
+	ms_sleep((U32)(us / 1000));
     return 0;
 }
 #elif LL_LINUX || LL_SOLARIS || LL_DARWIN
diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h
index b50405421d1751204846b56b1c957609648f943c..fafc7506907bd414af78d9b08e4081ca36a7f464 100644
--- a/indra/llcommon/llversionviewer.h
+++ b/indra/llcommon/llversionviewer.h
@@ -28,8 +28,8 @@
 #define LL_LLVERSIONVIEWER_H
 
 const S32 LL_VERSION_MAJOR = 3;
-const S32 LL_VERSION_MINOR = 2;
-const S32 LL_VERSION_PATCH = 4;
+const S32 LL_VERSION_MINOR = 3;
+const S32 LL_VERSION_PATCH = 2;
 const S32 LL_VERSION_BUILD = 0;
 
 const char * const LL_CHANNEL = "Second Life Developer";
diff --git a/indra/llcommon/llworkerthread.cpp b/indra/llcommon/llworkerthread.cpp
index 4988bdf570054e5416d75aab5b50ce2a0d08456a..3d05a30ac2240b2d0b91f01156d7312675faa2a7 100644
--- a/indra/llcommon/llworkerthread.cpp
+++ b/indra/llcommon/llworkerthread.cpp
@@ -81,7 +81,7 @@ void LLWorkerThread::clearDeleteList()
 }
 
 // virtual
-S32 LLWorkerThread::update(U32 max_time_ms)
+S32 LLWorkerThread::update(F32 max_time_ms)
 {
 	S32 res = LLQueuedThread::update(max_time_ms);
 	// Delete scheduled workers
diff --git a/indra/llcommon/llworkerthread.h b/indra/llcommon/llworkerthread.h
index 78a4781d157b3c634f8b5fb458aa9f4ea1b09b19..be46394d6eff2ad9ffd3ae99669afe2f388cd745 100644
--- a/indra/llcommon/llworkerthread.h
+++ b/indra/llcommon/llworkerthread.h
@@ -86,7 +86,7 @@ class LL_COMMON_API LLWorkerThread : public LLQueuedThread
 	LLWorkerThread(const std::string& name, bool threaded = true, bool should_pause = false);
 	~LLWorkerThread();
 
-	/*virtual*/ S32 update(U32 max_time_ms);
+	/*virtual*/ S32 update(F32 max_time_ms);
 	
 	handle_t addWorkRequest(LLWorkerClass* workerclass, S32 param, U32 priority = PRIORITY_NORMAL);
 	
diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp
old mode 100755
new mode 100644
index 3461aa3e6ccdc4b18dcc8a8a37d8b12f003a15a3..d6dcde4b9fa26be5f298f602fc04321b9cd454fa
--- a/indra/llcrashlogger/llcrashlogger.cpp
+++ b/indra/llcrashlogger/llcrashlogger.cpp
@@ -250,7 +250,7 @@ void LLCrashLogger::gatherFiles()
 		if(minidump_stream.is_open())
 		{
 			minidump_stream.seekg(0, std::ios::end);
-			size_t length = minidump_stream.tellg();
+			size_t length = (size_t)minidump_stream.tellg();
 			minidump_stream.seekg(0, std::ios::beg);
 			
 			LLSD::Binary data;
diff --git a/indra/llcrashlogger/llcrashlogger.h b/indra/llcrashlogger/llcrashlogger.h
old mode 100755
new mode 100644
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp
index c239e3df88c361c8b3377c04511919f86cdda75a..56e01ac851e7a067bf740f3bb0a29440e003691a 100644
--- a/indra/llimage/llimage.cpp
+++ b/indra/llimage/llimage.cpp
@@ -195,7 +195,7 @@ U8* LLImageBase::allocateData(S32 size)
 		mData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size);
 		if (!mData)
 		{
-			llwarns << "allocate image data: " << size << llendl;
+			llwarns << "Failed to allocate image data size [" << size << "]" << llendl;
 			size = 0 ;
 			mWidth = mHeight = 0 ;
 			mBadBufferAllocation = true ;
diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp
index cc8cb66d7390802f2e41297367ab90b0886f5f70..8241746a74561b514bbe762ba9331a7b1ab6e37c 100644
--- a/indra/llimage/llimagej2c.cpp
+++ b/indra/llimage/llimagej2c.cpp
@@ -501,10 +501,10 @@ void LLImageCompressionTester::outputTestRecord(LLSD *sd)
 	F32 decompressionRate = 0.0f;
 	F32 compressionRate   = 0.0f;
 
-	F32 totalkBInDecompression  = (F32)(mTotalBytesInDecompression)  / 1000.0;
-	F32 totalkBOutDecompression = (F32)(mTotalBytesOutDecompression) / 1000.0;
-	F32 totalkBInCompression    = (F32)(mTotalBytesInCompression)    / 1000.0;
-	F32 totalkBOutCompression   = (F32)(mTotalBytesOutCompression)   / 1000.0;
+	F32 totalkBInDecompression  = (F32)(mTotalBytesInDecompression)  / 1000.f;
+	F32 totalkBOutDecompression = (F32)(mTotalBytesOutDecompression) / 1000.f;
+	F32 totalkBInCompression    = (F32)(mTotalBytesInCompression)    / 1000.f;
+	F32 totalkBOutCompression   = (F32)(mTotalBytesOutCompression)   / 1000.f;
 	
 	if (!is_approx_zero(mTotalTimeDecompression))
 	{
diff --git a/indra/llimage/llimagepng.cpp b/indra/llimage/llimagepng.cpp
index 8d493ecde0b6a9937a9624f6aa44efd1bf220811..294f68b1220cf0ad761a8f4daad227147007c9e0 100644
--- a/indra/llimage/llimagepng.cpp
+++ b/indra/llimage/llimagepng.cpp
@@ -60,6 +60,12 @@ BOOL LLImagePNG::updateData()
 
 	// Decode the PNG data and extract sizing information
 	LLPngWrapper pngWrapper;
+	if (!pngWrapper.isValidPng(getData()))
+	{
+		setLastError("LLImagePNG data does not have a valid PNG header!");
+		return FALSE;
+	}
+
 	LLPngWrapper::ImageInfo infop;
 	if (! pngWrapper.readPng(getData(), NULL, &infop))
 	{
@@ -90,6 +96,12 @@ BOOL LLImagePNG::decode(LLImageRaw* raw_image, F32 decode_time)
 
 	// Decode the PNG data into the raw image
 	LLPngWrapper pngWrapper;
+	if (!pngWrapper.isValidPng(getData()))
+	{
+		setLastError("LLImagePNG data does not have a valid PNG header!");
+		return FALSE;
+	}
+
 	if (! pngWrapper.readPng(getData(), raw_image))
 	{
 		setLastError(pngWrapper.getErrorMessage());
diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp
index 28dc3bd313365a58409042d40c9ad4601b0332c5..ad2eb0f69c56e1f9968940707f2b11567765d10f 100644
--- a/indra/llimage/llimageworker.cpp
+++ b/indra/llimage/llimageworker.cpp
@@ -46,7 +46,7 @@ LLImageDecodeThread::~LLImageDecodeThread()
 
 // MAIN THREAD
 // virtual
-S32 LLImageDecodeThread::update(U32 max_time_ms)
+S32 LLImageDecodeThread::update(F32 max_time_ms)
 {
 	LLMutexLock lock(mCreationMutex);
 	for (creation_list_t::iterator iter = mCreationList.begin();
diff --git a/indra/llimage/llimageworker.h b/indra/llimage/llimageworker.h
index c684222fa5f85f10794ed51217b59c35cebf1570..1bfb0ddfd3f28ca36ff3dd1b760a61dd7cff32fa 100644
--- a/indra/llimage/llimageworker.h
+++ b/indra/llimage/llimageworker.h
@@ -78,7 +78,7 @@ class LLImageDecodeThread : public LLQueuedThread
 	handle_t decodeImage(LLImageFormatted* image,
 						 U32 priority, S32 discard, BOOL needs_aux,
 						 Responder* responder);
-	S32 update(U32 max_time_ms);
+	S32 update(F32 max_time_ms);
 
 	// Used by unit tests to check the consistency of the thread instance
 	S32 tut_size();
diff --git a/indra/llinventory/lleconomy.cpp b/indra/llinventory/lleconomy.cpp
index c6eaa6d3e14b606728b142a7008fde154a4cc98f..d643ea6ed9077f118d9ced6a43bf0c441f91c021 100644
--- a/indra/llinventory/lleconomy.cpp
+++ b/indra/llinventory/lleconomy.cpp
@@ -48,6 +48,31 @@ LLGlobalEconomy::LLGlobalEconomy()
 LLGlobalEconomy::~LLGlobalEconomy()
 { }
 
+void LLGlobalEconomy::addObserver(LLEconomyObserver* observer)
+{
+	mObservers.push_back(observer);
+}
+
+void LLGlobalEconomy::removeObserver(LLEconomyObserver* observer)
+{
+	std::list<LLEconomyObserver*>::iterator it =
+		std::find(mObservers.begin(), mObservers.end(), observer);
+	if (it != mObservers.end())
+	{
+		mObservers.erase(it);
+	}
+}
+
+void LLGlobalEconomy::notifyObservers()
+{
+	for (std::list<LLEconomyObserver*>::iterator it = mObservers.begin();
+		it != mObservers.end();
+		++it)
+	{
+		(*it)->onEconomyDataChange();
+	}
+}
+
 // static
 void LLGlobalEconomy::processEconomyData(LLMessageSystem *msg, LLGlobalEconomy* econ_data)
 {
@@ -88,6 +113,8 @@ void LLGlobalEconomy::processEconomyData(LLMessageSystem *msg, LLGlobalEconomy*
 	econ_data->setTeleportPriceExponent(f);
 	msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceGroupCreate, i);
 	econ_data->setPriceGroupCreate(i);
+
+	econ_data->notifyObservers();
 }
 
 S32	LLGlobalEconomy::calculateTeleportCost(F32 distance) const
diff --git a/indra/llinventory/lleconomy.h b/indra/llinventory/lleconomy.h
index cc6643f955e468c18c3db456c6c7c18d949cf343..eb2ecf71ba41b70aaa905cbe7e99138688dbf869 100644
--- a/indra/llinventory/lleconomy.h
+++ b/indra/llinventory/lleconomy.h
@@ -31,6 +31,16 @@
 class LLMessageSystem;
 class LLVector3;
 
+/**
+ * Register an observer to be notified of economy data updates coming from server.
+ */
+class LLEconomyObserver
+{
+public:
+	virtual ~LLEconomyObserver() {}
+	virtual void onEconomyDataChange() = 0;
+};
+
 class LLGlobalEconomy
 {
 public:
@@ -46,6 +56,10 @@ class LLGlobalEconomy
 
 	virtual void print();
 
+	void	addObserver(LLEconomyObserver* observer);
+	void	removeObserver(LLEconomyObserver* observer);
+	void	notifyObservers();
+
 	static void processEconomyData(LLMessageSystem *msg, LLGlobalEconomy* econ_data);
 
 	S32		calculateTeleportCost(F32 distance) const;
@@ -89,6 +103,8 @@ class LLGlobalEconomy
 	S32		mTeleportMinPrice;
 	F32		mTeleportPriceExponent;
 	S32     mPriceGroupCreate;
+
+	std::list<LLEconomyObserver*> mObservers;
 };
 
 
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index 76760aa414375d6fe2b1e96bb9863833b0975348..fbf23bc3f09a760eee88c85f29cf41df9a1a5352 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -405,7 +405,7 @@ U32 LLInventoryItem::getCRC32() const
 	//lldebugs << "7 crc: " << std::hex << crc << std::dec << llendl;
 	crc += mSaleInfo.getCRC32();
 	//lldebugs << "8 crc: " << std::hex << crc << std::dec << llendl;
-	crc += mCreationDate;
+	crc += (U32)mCreationDate;
 	//lldebugs << "9 crc: " << std::hex << crc << std::dec << llendl;
 	return crc;
 }
@@ -521,7 +521,7 @@ void LLInventoryItem::packMessage(LLMessageSystem* msg) const
 	mSaleInfo.packMessage(msg);
 	msg->addStringFast(_PREHASH_Name, mName);
 	msg->addStringFast(_PREHASH_Description, mDescription);
-	msg->addS32Fast(_PREHASH_CreationDate, mCreationDate);
+	msg->addS32Fast(_PREHASH_CreationDate, (S32)mCreationDate);
 	U32 crc = getCRC32();
 	msg->addU32Fast(_PREHASH_CRC, crc);
 }
diff --git a/indra/llmath/CMakeLists.txt b/indra/llmath/CMakeLists.txt
index cd100cdf9fd38a0147ddb33a91da54de57f9bf28..b5e59c1ca350285bf9394089c41a2767820c0d8c 100644
--- a/indra/llmath/CMakeLists.txt
+++ b/indra/llmath/CMakeLists.txt
@@ -75,10 +75,6 @@ set(llmath_HEADER_FILES
     llvector4a.h
     llvector4a.inl
     llvector4logical.h
-    llv4math.h
-    llv4matrix3.h
-    llv4matrix4.h
-    llv4vector3.h
     llvolume.h
     llvolumemgr.h
     llvolumeoctree.h
diff --git a/indra/llmath/llcalcparser.h b/indra/llmath/llcalcparser.h
index bd9c8c251917918818eed83fcfc79e78ce4dc55d..e0ad270266eb2b742697344d4d25976f53f580b2 100644
--- a/indra/llmath/llcalcparser.h
+++ b/indra/llmath/llcalcparser.h
@@ -174,7 +174,7 @@ struct LLCalcParser : grammar<LLCalcParser>
 	F32 _log(const F32& a) const { return log(a); }
 	F32 _exp(const F32& a) const { return exp(a); }
 	F32 _fabs(const F32& a) const { return fabs(a); }
-	F32 _floor(const F32& a) const { return llfloor(a); }
+	F32 _floor(const F32& a) const { return (F32)llfloor(a); }
 	F32 _ceil(const F32& a) const { return llceil(a); }
 
 	F32 _atan2(const F32& a,const F32& b) const { return atan2(a,b); }
diff --git a/indra/llmath/llcoord.h b/indra/llmath/llcoord.h
index 706ad9278705facf7e618e824b720622fd5ace41..9b76268afde6986ee08651cb129f301db31fc29a 100644
--- a/indra/llmath/llcoord.h
+++ b/indra/llmath/llcoord.h
@@ -26,80 +26,87 @@
 #ifndef LL_LLCOORD_H
 #define LL_LLCOORD_H
 
+template<typename> class LLCoord;
+struct LL_COORD_TYPE_GL;
+struct LL_COORD_TYPE_WINDOW;
+struct LL_COORD_TYPE_SCREEN;
+
+typedef LLCoord<LL_COORD_TYPE_GL> LLCoordGL;
+typedef LLCoord<LL_COORD_TYPE_WINDOW> LLCoordWindow;
+typedef LLCoord<LL_COORD_TYPE_SCREEN> LLCoordScreen;
+
+struct LLCoordCommon
+{
+	LLCoordCommon(S32 x, S32 y) : mX(x), mY(y) {}
+	LLCoordCommon() : mX(0), mY(0) {}
+	S32 mX;
+	S32 mY;
+};
+
 // A two-dimensional pixel value
-class LLCoord
+template<typename COORD_FRAME>
+class LLCoord : protected COORD_FRAME
 {
 public:
-	S32		mX;
-	S32		mY;
+	typedef LLCoord<COORD_FRAME> self_t;
+	typename COORD_FRAME::value_t	mX;
+	typename COORD_FRAME::value_t	mY;
 
 	LLCoord():	mX(0), mY(0)
 	{}
-	LLCoord(S32 x, S32 y): mX(x), mY(y)
-	{}
-	virtual ~LLCoord()
+	LLCoord(typename COORD_FRAME::value_t x, typename COORD_FRAME::value_t y): mX(x), mY(y)
 	{}
 
-	virtual void set(S32 x, S32 y)		{ mX = x; mY = y; }
-};
+	LLCoord(const LLCoordCommon& other)
+	{
+		COORD_FRAME::convertFromCommon(other);
+	}
 
+	LLCoordCommon convert() const
+	{
+		return COORD_FRAME::convertToCommon();
+	}
 
-// GL coordinates start in the client region of a window,
-// with left, bottom = 0, 0
-class LLCoordGL : public LLCoord
-{
-public:
-	LLCoordGL() : LLCoord()
-	{}
-	LLCoordGL(S32 x, S32 y) : LLCoord(x, y)
-	{}
-	bool operator==(const LLCoordGL& other) const { return mX == other.mX && mY == other.mY; }
-	bool operator!=(const LLCoordGL& other) const { return !(*this == other); }
-};
+	void set(typename COORD_FRAME::value_t x, typename COORD_FRAME::value_t y) { mX = x; mY = y;}
+	bool operator==(const self_t& other) const { return mX == other.mX && mY == other.mY; }
+	bool operator!=(const self_t& other) const { return !(*this == other); }
 
-//bool operator ==(const LLCoordGL& a, const LLCoordGL& b);
+	static const self_t& getTypedCoords(const COORD_FRAME& self) { return static_cast<const self_t&>(self); }
+	static self_t& getTypedCoords(COORD_FRAME& self) { return static_cast<self_t&>(self); }
+};
 
-// Window coords include things like window borders,
-// menu regions, etc.
-class LLCoordWindow : public LLCoord
+struct LL_COORD_TYPE_GL 
 {
-public:
-	LLCoordWindow() : LLCoord()
-	{}
-	LLCoordWindow(S32 x, S32 y) : LLCoord(x, y)
-	{}
-	bool operator==(const LLCoordWindow& other) const { return mX == other.mX && mY == other.mY; }
-	bool operator!=(const LLCoordWindow& other) const { return !(*this == other); }
-};
+	typedef S32 value_t;
 
+	LLCoordCommon convertToCommon() const
+	{
+		const LLCoordGL& self = LLCoordGL::getTypedCoords(*this);
+		return LLCoordCommon(self.mX, self.mY);
+	}
 
-// Screen coords start at left, top = 0, 0
-class LLCoordScreen : public LLCoord
+	void convertFromCommon(const LLCoordCommon& from)
+	{
+		LLCoordGL& self = LLCoordGL::getTypedCoords(*this);
+		self.mX = from.mX;
+		self.mY = from.mY;
+	}
+};
+
+struct LL_COORD_TYPE_WINDOW 
 {
-public:
-	LLCoordScreen() : LLCoord()
-	{}
-	LLCoordScreen(S32 x, S32 y) : LLCoord(x, y)
-	{}
-	bool operator==(const LLCoordScreen& other) const { return mX == other.mX && mY == other.mY; }
-	bool operator!=(const LLCoordScreen& other) const { return !(*this == other); }
+	typedef S32 value_t;
+
+	LLCoordCommon convertToCommon() const;
+	void convertFromCommon(const LLCoordCommon& from);
 };
 
-class LLCoordFont : public LLCoord
+struct LL_COORD_TYPE_SCREEN 
 {
-public:
-	F32 mZ;
-	
-	LLCoordFont() : LLCoord(), mZ(0.f)
-	{}
-	LLCoordFont(S32 x, S32 y, F32 z = 0) : LLCoord(x,y), mZ(z)
-	{}
-	
-	void set(S32 x, S32 y) { LLCoord::set(x,y); mZ = 0.f; }
-	void set(S32 x, S32 y, F32 z) { mX = x; mY = y; mZ = z; }
-	bool operator==(const LLCoordFont& other) const { return mX == other.mX && mY == other.mY; }
-	bool operator!=(const LLCoordFont& other) const { return !(*this == other); }
+	typedef S32 value_t;
+
+	LLCoordCommon convertToCommon() const;
+	void convertFromCommon(const LLCoordCommon& from);
 };
-	
 
 #endif
diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h
index 3c1ae45d6862680e64101f2683756791675ce034..1b11e83b4af369cd4119d19e81d79f486f90014d 100644
--- a/indra/llmath/lloctree.h
+++ b/indra/llmath/lloctree.h
@@ -80,8 +80,8 @@ class LLOctreeNode : public LLTreeNode<T>
 	typedef LLOctreeTraveler<T>									oct_traveler;
 	typedef LLTreeTraveler<T>									tree_traveler;
 	typedef typename std::set<LLPointer<T> >					element_list;
-	typedef typename std::set<LLPointer<T> >::iterator			element_iter;
-	typedef typename std::set<LLPointer<T> >::const_iterator	const_element_iter;
+	typedef typename element_list::iterator						element_iter;
+	typedef typename element_list::const_iterator	const_element_iter;
 	typedef typename std::vector<LLTreeListener<T>*>::iterator	tree_listener_iter;
 	typedef typename std::vector<LLOctreeNode<T>* >				child_list;
 	typedef LLTreeNode<T>		BaseType;
@@ -114,6 +114,8 @@ class LLOctreeNode : public LLTreeNode<T>
 			mOctant = ((oct_node*) mParent)->getOctant(mCenter);
 		}
 
+		mElementCount = 0;
+
 		clearChildren();
 	}
 
@@ -219,11 +221,11 @@ class LLOctreeNode : public LLTreeNode<T>
 	void accept(oct_traveler* visitor)				{ visitor->visit(this); }
 	virtual bool isLeaf() const						{ return mChild.empty(); }
 	
-	U32 getElementCount() const						{ return mData.size(); }
+	U32 getElementCount() const						{ return mElementCount; }
 	element_list& getData()							{ return mData; }
 	const element_list& getData() const				{ return mData; }
 	
-	U32 getChildCount()	const						{ return mChild.size(); }
+	U32 getChildCount()	const						{ return mChildCount; }
 	oct_node* getChild(U32 index)					{ return mChild[index]; }
 	const oct_node* getChild(U32 index) const		{ return mChild[index]; }
 	child_list& getChildren()						{ return mChild; }
@@ -300,17 +302,13 @@ class LLOctreeNode : public LLTreeNode<T>
 			if ((getElementCount() < gOctreeMaxCapacity && contains(data->getBinRadius()) ||
 				(data->getBinRadius() > getSize()[0] &&	parent && parent->getElementCount() >= gOctreeMaxCapacity))) 
 			{ //it belongs here
-#if LL_OCTREE_PARANOIA_CHECK
 				//if this is a redundant insertion, error out (should never happen)
-				if (mData.find(data) != mData.end())
-				{
-					llwarns << "Redundant octree insertion detected. " << data << llendl;
-					return false;
-				}
-#endif
+				llassert(mData.find(data) == mData.end());
 
 				mData.insert(data);
 				BaseType::insert(data);
+
+				mElementCount = mData.size();
 				return true;
 			}
 			else
@@ -346,6 +344,8 @@ class LLOctreeNode : public LLTreeNode<T>
 				{
 					mData.insert(data);
 					BaseType::insert(data);
+
+					mElementCount = mData.size();
 					return true;
 				}
 
@@ -399,6 +399,7 @@ class LLOctreeNode : public LLTreeNode<T>
 		if (mData.find(data) != mData.end())
 		{	//we have data
 			mData.erase(data);
+			mElementCount = mData.size();
 			notifyRemoval(data);
 			checkAlive();
 			return true;
@@ -436,6 +437,7 @@ class LLOctreeNode : public LLTreeNode<T>
         if (mData.find(data) != mData.end())
 		{
 			mData.erase(data);
+			mElementCount = mData.size();
 			notifyRemoval(data);
 			llwarns << "FOUND!" << llendl;
 			checkAlive();
@@ -452,7 +454,7 @@ class LLOctreeNode : public LLTreeNode<T>
 	void clearChildren()
 	{
 		mChild.clear();
-
+		mChildCount = 0;
 		U32* foo = (U32*) mChildMap;
 		foo[0] = foo[1] = 0xFFFFFFFF;
 	}
@@ -512,9 +514,10 @@ class LLOctreeNode : public LLTreeNode<T>
 		}
 #endif
 
-		mChildMap[child->getOctant()] = (U8) mChild.size();
+		mChildMap[child->getOctant()] = mChildCount;
 
 		mChild.push_back(child);
+		++mChildCount;
 		child->setParent(this);
 
 		if (!silent)
@@ -534,21 +537,20 @@ class LLOctreeNode : public LLTreeNode<T>
 			oct_listener* listener = getOctListener(i);
 			listener->handleChildRemoval(this, getChild(index));
 		}
-
 		
-
 		if (destroy)
 		{
 			mChild[index]->destroy();
 			delete mChild[index];
 		}
 		mChild.erase(mChild.begin() + index);
+		--mChildCount;
 
 		//rebuild child map
 		U32* foo = (U32*) mChildMap;
 		foo[0] = foo[1] = 0xFFFFFFFF;
 
-		for (U32 i = 0; i < mChild.size(); ++i)
+		for (U32 i = 0; i < mChildCount; ++i)
 		{
 			mChildMap[mChild[i]->getOctant()] = i;
 		}
@@ -601,8 +603,10 @@ class LLOctreeNode : public LLTreeNode<T>
 
 	child_list mChild;
 	U8 mChildMap[8];
+	U32 mChildCount;
 
 	element_list mData;
+	U32 mElementCount;
 		
 }; 
 
diff --git a/indra/llmath/llv4math.h b/indra/llmath/llv4math.h
deleted file mode 100644
index 5f403ba52667505f4e1f05a4671549040b1728c7..0000000000000000000000000000000000000000
--- a/indra/llmath/llv4math.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/** 
- * @file llv4math.h
- * @brief LLV4* class header file - vector processor enabled math
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef	LL_LLV4MATH_H
-#define	LL_LLV4MATH_H
-
-// *NOTE: We do not support SSE acceleration on Windows builds.
-// Our minimum specification for the viewer includes 1 GHz Athlon processors,
-// which covers the Athlon Thunderbird series that does not support SSE.
-//
-// Our header files include statements like this
-//   const F32 HAVOK_TIMESTEP = 1.f / 45.f;
-// This creates "globals" that are included in each .obj file.  If a single
-// .cpp file has SSE code generation turned on (eg, llviewerjointmesh_sse.cpp)
-// these globals will be initialized using SSE instructions.  This causes SL
-// to crash before main() on processors without SSE.  Untangling all these 
-// headers/variables is too much work for the small performance gains of 
-// vectorization.
-//
-// Therefore we only support vectorization on builds where the everything is 
-// built with SSE or Altivec.  See https://jira.secondlife.com/browse/VWR-1610
-// and https://jira.lindenlab.com/browse/SL-47720 for details.
-//
-// Sorry the code is such a mess. JC
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-// LLV4MATH - GNUC
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-
-#if LL_GNUC && __GNUC__ >= 4 && __SSE__
-
-#define			LL_VECTORIZE					1
-
-#if LL_DARWIN
-
-#include <Accelerate/Accelerate.h>
-#include <xmmintrin.h>
-typedef vFloat	V4F32;
-
-#else
-
-#include <xmmintrin.h>
-typedef float	V4F32							__attribute__((vector_size(16)));
-
-#endif
-
-#endif
-#if LL_GNUC
-
-#define			LL_LLV4MATH_ALIGN_PREFIX
-#define			LL_LLV4MATH_ALIGN_POSTFIX		__attribute__((aligned(16)))
-
-#endif
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-// LLV4MATH - MSVC
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-
-// Only vectorize if the entire Windows build uses SSE.
-// _M_IX86_FP is set when SSE code generation is turned on, and I have
-// confirmed this in VS2003, VS2003 SP1, and VS2005. JC
-#if LL_MSVC && _M_IX86_FP
-
-#define			LL_VECTORIZE					1
-
-#include <xmmintrin.h>
-
-typedef __m128	V4F32;
-
-#endif
-#if LL_MSVC
-
-#define			LL_LLV4MATH_ALIGN_PREFIX		__declspec(align(16))
-#define			LL_LLV4MATH_ALIGN_POSTFIX
-
-#endif
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-// LLV4MATH - default - no vectorization
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-
-#if !LL_VECTORIZE
-
-#define			LL_VECTORIZE					0
-
-struct			V4F32							{ F32 __pad__[4]; };
-
-inline F32 llv4lerp(F32 a, F32 b, F32 w)		{ return ( b - a ) * w + a; }
-
-#endif
-
-#ifndef			LL_LLV4MATH_ALIGN_PREFIX
-#	define			LL_LLV4MATH_ALIGN_PREFIX
-#endif
-#ifndef			LL_LLV4MATH_ALIGN_POSTFIX
-#	define			LL_LLV4MATH_ALIGN_POSTFIX
-#endif
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-// LLV4MATH
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-
-
-#define			LLV4_NUM_AXIS					4
-
-class LLV4Vector3;
-class LLV4Matrix3;
-class LLV4Matrix4;
-
-#endif
diff --git a/indra/llmath/llv4matrix3.h b/indra/llmath/llv4matrix3.h
deleted file mode 100644
index 270f5d7dae41b8541aa9607dcea61d3fd8b0d12c..0000000000000000000000000000000000000000
--- a/indra/llmath/llv4matrix3.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/** 
- * @file llviewerjointmesh.cpp
- * @brief LLV4* class header file - vector processor enabled math
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLV4MATRIX3_H
-#define LL_LLV4MATRIX3_H
-
-#include "llv4math.h"
-#include "llv4vector3.h"
-#include "m3math.h"			// for operator LLMatrix3()
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-// LLV4Matrix3
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-
-LL_LLV4MATH_ALIGN_PREFIX
-
-class LLV4Matrix3
-{
-public:
-	union {
-		F32		mMatrix[LLV4_NUM_AXIS][LLV4_NUM_AXIS];
-		V4F32	mV[LLV4_NUM_AXIS];
-	};
-
-	void				lerp(const LLV4Matrix3 &a, const LLV4Matrix3 &b, const F32 &w);
-	void				multiply(const LLVector3 &a, LLVector3& out) const;
-	void				multiply(const LLVector4 &a, LLV4Vector3& out) const;
-	void				multiply(const LLVector3 &a, LLV4Vector3& out) const;
-
-	const LLV4Matrix3&	transpose();
-	const LLV4Matrix3&	operator=(const LLMatrix3& a);
-
-	operator			LLMatrix3()	const { return (reinterpret_cast<const LLMatrix4*>(const_cast<const F32*>(&mMatrix[0][0])))->getMat3(); }
-
-	friend LLVector3	operator*(const LLVector3& a, const LLV4Matrix3& b);
-}
-
-LL_LLV4MATH_ALIGN_POSTFIX;
-
-
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-// LLV4Matrix3 - SSE
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-
-#if LL_VECTORIZE
-
-inline void LLV4Matrix3::lerp(const LLV4Matrix3 &a, const LLV4Matrix3 &b, const F32 &w)
-{
-	__m128 vw = _mm_set1_ps(w);
-	mV[VX] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VX], a.mV[VX]), vw), a.mV[VX]); // ( b - a ) * w + a
-	mV[VY] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VY], a.mV[VY]), vw), a.mV[VY]);
-	mV[VZ] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VZ], a.mV[VZ]), vw), a.mV[VZ]);
-}
-
-inline void LLV4Matrix3::multiply(const LLVector3 &a, LLVector3& o) const
-{
-	LLV4Vector3 j;
-	j.v = 				 	_mm_mul_ps(_mm_set1_ps(a.mV[VX]), mV[VX]); // ( ax * vx ) + ...
-	j.v = _mm_add_ps(j.v  , _mm_mul_ps(_mm_set1_ps(a.mV[VY]), mV[VY]));
-	j.v = _mm_add_ps(j.v  , _mm_mul_ps(_mm_set1_ps(a.mV[VZ]), mV[VZ]));
-	o.setVec(j.mV);
-}
-
-inline void LLV4Matrix3::multiply(const LLVector4 &a, LLV4Vector3& o) const
-{
-	o.v =					_mm_mul_ps(_mm_set1_ps(a.mV[VX]), mV[VX]); // ( ax * vx ) + ...
-	o.v = _mm_add_ps(o.v  , _mm_mul_ps(_mm_set1_ps(a.mV[VY]), mV[VY]));
-	o.v = _mm_add_ps(o.v  , _mm_mul_ps(_mm_set1_ps(a.mV[VZ]), mV[VZ]));
-}
-
-inline void LLV4Matrix3::multiply(const LLVector3 &a, LLV4Vector3& o) const
-{
-	o.v =					_mm_mul_ps(_mm_set1_ps(a.mV[VX]), mV[VX]); // ( ax * vx ) + ...
-	o.v = _mm_add_ps(o.v  , _mm_mul_ps(_mm_set1_ps(a.mV[VY]), mV[VY]));
-	o.v = _mm_add_ps(o.v  , _mm_mul_ps(_mm_set1_ps(a.mV[VZ]), mV[VZ]));
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-// LLV4Matrix3
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-
-#else
-
-inline void LLV4Matrix3::lerp(const LLV4Matrix3 &a, const LLV4Matrix3 &b, const F32 &w)
-{
-	mMatrix[VX][VX] = llv4lerp(a.mMatrix[VX][VX], b.mMatrix[VX][VX], w);
-	mMatrix[VX][VY] = llv4lerp(a.mMatrix[VX][VY], b.mMatrix[VX][VY], w);
-	mMatrix[VX][VZ] = llv4lerp(a.mMatrix[VX][VZ], b.mMatrix[VX][VZ], w);
-
-	mMatrix[VY][VX] = llv4lerp(a.mMatrix[VY][VX], b.mMatrix[VY][VX], w);
-	mMatrix[VY][VY] = llv4lerp(a.mMatrix[VY][VY], b.mMatrix[VY][VY], w);
-	mMatrix[VY][VZ] = llv4lerp(a.mMatrix[VY][VZ], b.mMatrix[VY][VZ], w);
-
-	mMatrix[VZ][VX] = llv4lerp(a.mMatrix[VZ][VX], b.mMatrix[VZ][VX], w);
-	mMatrix[VZ][VY] = llv4lerp(a.mMatrix[VZ][VY], b.mMatrix[VZ][VY], w);
-	mMatrix[VZ][VZ] = llv4lerp(a.mMatrix[VZ][VZ], b.mMatrix[VZ][VZ], w);
-}
-
-inline void LLV4Matrix3::multiply(const LLVector3 &a, LLVector3& o) const
-{
-	o.setVec(		a.mV[VX] * mMatrix[VX][VX] + 
-					a.mV[VY] * mMatrix[VY][VX] + 
-					a.mV[VZ] * mMatrix[VZ][VX],
-					 
-					a.mV[VX] * mMatrix[VX][VY] + 
-					a.mV[VY] * mMatrix[VY][VY] + 
-					a.mV[VZ] * mMatrix[VZ][VY],
-					 
-					a.mV[VX] * mMatrix[VX][VZ] + 
-					a.mV[VY] * mMatrix[VY][VZ] + 
-					a.mV[VZ] * mMatrix[VZ][VZ]);
-}
-
-inline void LLV4Matrix3::multiply(const LLVector4 &a, LLV4Vector3& o) const
-{
-	o.setVec(		a.mV[VX] * mMatrix[VX][VX] + 
-					a.mV[VY] * mMatrix[VY][VX] + 
-					a.mV[VZ] * mMatrix[VZ][VX],
-					 
-					a.mV[VX] * mMatrix[VX][VY] + 
-					a.mV[VY] * mMatrix[VY][VY] + 
-					a.mV[VZ] * mMatrix[VZ][VY],
-					 
-					a.mV[VX] * mMatrix[VX][VZ] + 
-					a.mV[VY] * mMatrix[VY][VZ] + 
-					a.mV[VZ] * mMatrix[VZ][VZ]);
-}
-
-inline void LLV4Matrix3::multiply(const LLVector3 &a, LLV4Vector3& o) const
-{
-	o.setVec(		a.mV[VX] * mMatrix[VX][VX] + 
-					a.mV[VY] * mMatrix[VY][VX] + 
-					a.mV[VZ] * mMatrix[VZ][VX],
-					 
-					a.mV[VX] * mMatrix[VX][VY] + 
-					a.mV[VY] * mMatrix[VY][VY] + 
-					a.mV[VZ] * mMatrix[VZ][VY],
-					 
-					a.mV[VX] * mMatrix[VX][VZ] + 
-					a.mV[VY] * mMatrix[VY][VZ] + 
-					a.mV[VZ] * mMatrix[VZ][VZ]);
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-// LLV4Matrix3
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-
-#endif
-
-inline const LLV4Matrix3&	LLV4Matrix3::transpose()
-{
-#if LL_VECTORIZE && defined(_MM_TRANSPOSE4_PS)
-	_MM_TRANSPOSE4_PS(mV[VX], mV[VY], mV[VZ], mV[VW]);
-	return *this;
-#else
-	F32 temp;
-	temp = mMatrix[VX][VY]; mMatrix[VX][VY] = mMatrix[VY][VX]; mMatrix[VY][VX] = temp;
-	temp = mMatrix[VX][VZ]; mMatrix[VX][VZ] = mMatrix[VZ][VX]; mMatrix[VZ][VX] = temp;
-	temp = mMatrix[VY][VZ]; mMatrix[VY][VZ] = mMatrix[VZ][VY]; mMatrix[VZ][VY] = temp;
-#endif
-	return *this;
-}
-
-inline const LLV4Matrix3& LLV4Matrix3::operator=(const LLMatrix3& a)
-{
-	memcpy(mMatrix[VX], a.mMatrix[VX], sizeof(F32) * 3 );
-	memcpy(mMatrix[VY], a.mMatrix[VY], sizeof(F32) * 3 );
-	memcpy(mMatrix[VZ], a.mMatrix[VZ], sizeof(F32) * 3 );
-	return *this;
-}
-
-inline LLVector3 operator*(const LLVector3& a, const LLV4Matrix3& b)
-{
-	return LLVector3(
-				a.mV[VX] * b.mMatrix[VX][VX] + 
-				a.mV[VY] * b.mMatrix[VY][VX] + 
-				a.mV[VZ] * b.mMatrix[VZ][VX],
-	
-				a.mV[VX] * b.mMatrix[VX][VY] + 
-				a.mV[VY] * b.mMatrix[VY][VY] + 
-				a.mV[VZ] * b.mMatrix[VZ][VY],
-	
-				a.mV[VX] * b.mMatrix[VX][VZ] + 
-				a.mV[VY] * b.mMatrix[VY][VZ] + 
-				a.mV[VZ] * b.mMatrix[VZ][VZ] );
-}
-
-#endif
diff --git a/indra/llmath/llv4matrix4.h b/indra/llmath/llv4matrix4.h
deleted file mode 100644
index 2eb49d9294e382d3ece6082dc3caa8990f5e96d1..0000000000000000000000000000000000000000
--- a/indra/llmath/llv4matrix4.h
+++ /dev/null
@@ -1,249 +0,0 @@
-/** 
- * @file llviewerjointmesh.cpp
- * @brief LLV4* class header file - vector processor enabled math
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLV4MATRIX4_H
-#define LL_LLV4MATRIX4_H
-
-#include "llv4math.h"
-#include "llv4matrix3.h"	// just for operator LLV4Matrix3()
-#include "llv4vector3.h"
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-// LLV4Matrix4
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-
-LL_LLV4MATH_ALIGN_PREFIX
-
-class LLV4Matrix4
-{
-public:
-	union {
-		F32		mMatrix[LLV4_NUM_AXIS][LLV4_NUM_AXIS];
-		V4F32	mV[LLV4_NUM_AXIS];
-	};
-
-	void				lerp(const LLV4Matrix4 &a, const LLV4Matrix4 &b, const F32 &w);
-	void				multiply(const LLVector3 &a, LLVector3& o) const;
-	void				multiply(const LLVector3 &a, LLV4Vector3& o) const;
-
-	const LLV4Matrix4&	transpose();
-	const LLV4Matrix4&  translate(const LLVector3 &vec);
-	const LLV4Matrix4&  translate(const LLV4Vector3 &vec);
-	const LLV4Matrix4&	operator=(const LLMatrix4& a);
-
-	operator			LLMatrix4()	const { return *(reinterpret_cast<const LLMatrix4*>(const_cast<const F32*>(&mMatrix[0][0]))); }
-	operator			LLV4Matrix3()	const { return *(reinterpret_cast<const LLV4Matrix3*>(const_cast<const F32*>(&mMatrix[0][0]))); }
-	
-	friend LLVector3	operator*(const LLVector3 &a, const LLV4Matrix4 &b);
-}
-
-LL_LLV4MATH_ALIGN_POSTFIX;
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-// LLV4Matrix4 - SSE
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-
-#if LL_VECTORIZE
-
-inline void LLV4Matrix4::lerp(const LLV4Matrix4 &a, const LLV4Matrix4 &b, const F32 &w)
-{
-	__m128 vw = _mm_set1_ps(w);
-	mV[VX] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VX], a.mV[VX]), vw), a.mV[VX]); // ( b - a ) * w + a
-	mV[VY] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VY], a.mV[VY]), vw), a.mV[VY]);
-	mV[VZ] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VZ], a.mV[VZ]), vw), a.mV[VZ]);
-	mV[VW] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VW], a.mV[VW]), vw), a.mV[VW]);
-}
-
-inline void LLV4Matrix4::multiply(const LLVector3 &a, LLVector3& o) const
-{
-	LLV4Vector3 j;
-	j.v = _mm_add_ps(mV[VW], _mm_mul_ps(_mm_set1_ps(a.mV[VX]), mV[VX])); // ( ax * vx ) + vw
-	j.v = _mm_add_ps(j.v   , _mm_mul_ps(_mm_set1_ps(a.mV[VY]), mV[VY]));
-	j.v = _mm_add_ps(j.v   , _mm_mul_ps(_mm_set1_ps(a.mV[VZ]), mV[VZ]));
-	o.setVec(j.mV);
-}
-
-inline void LLV4Matrix4::multiply(const LLVector3 &a, LLV4Vector3& o) const
-{
-	o.v = _mm_add_ps(mV[VW], _mm_mul_ps(_mm_set1_ps(a.mV[VX]), mV[VX])); // ( ax * vx ) + vw
-	o.v = _mm_add_ps(o.v   , _mm_mul_ps(_mm_set1_ps(a.mV[VY]), mV[VY]));
-	o.v = _mm_add_ps(o.v   , _mm_mul_ps(_mm_set1_ps(a.mV[VZ]), mV[VZ]));
-}
-
-inline const LLV4Matrix4& LLV4Matrix4::translate(const LLV4Vector3 &vec)
-{
-	mV[VW] = _mm_add_ps(mV[VW], vec.v);
-	return (*this);
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-// LLV4Matrix4
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-
-#else
-
-inline void LLV4Matrix4::lerp(const LLV4Matrix4 &a, const LLV4Matrix4 &b, const F32 &w)
-{
-	mMatrix[VX][VX] = llv4lerp(a.mMatrix[VX][VX], b.mMatrix[VX][VX], w);
-	mMatrix[VX][VY] = llv4lerp(a.mMatrix[VX][VY], b.mMatrix[VX][VY], w);
-	mMatrix[VX][VZ] = llv4lerp(a.mMatrix[VX][VZ], b.mMatrix[VX][VZ], w);
-
-	mMatrix[VY][VX] = llv4lerp(a.mMatrix[VY][VX], b.mMatrix[VY][VX], w);
-	mMatrix[VY][VY] = llv4lerp(a.mMatrix[VY][VY], b.mMatrix[VY][VY], w);
-	mMatrix[VY][VZ] = llv4lerp(a.mMatrix[VY][VZ], b.mMatrix[VY][VZ], w);
-
-	mMatrix[VZ][VX] = llv4lerp(a.mMatrix[VZ][VX], b.mMatrix[VZ][VX], w);
-	mMatrix[VZ][VY] = llv4lerp(a.mMatrix[VZ][VY], b.mMatrix[VZ][VY], w);
-	mMatrix[VZ][VZ] = llv4lerp(a.mMatrix[VZ][VZ], b.mMatrix[VZ][VZ], w);
-
-	mMatrix[VW][VX] = llv4lerp(a.mMatrix[VW][VX], b.mMatrix[VW][VX], w);
-	mMatrix[VW][VY] = llv4lerp(a.mMatrix[VW][VY], b.mMatrix[VW][VY], w);
-	mMatrix[VW][VZ] = llv4lerp(a.mMatrix[VW][VZ], b.mMatrix[VW][VZ], w);
-}
-
-inline void LLV4Matrix4::multiply(const LLVector3 &a, LLVector3& o) const
-{
-	o.setVec(		a.mV[VX] * mMatrix[VX][VX] + 
-					a.mV[VY] * mMatrix[VY][VX] + 
-					a.mV[VZ] * mMatrix[VZ][VX] +
-					mMatrix[VW][VX],
-					 
-					a.mV[VX] * mMatrix[VX][VY] + 
-					a.mV[VY] * mMatrix[VY][VY] + 
-					a.mV[VZ] * mMatrix[VZ][VY] +
-					mMatrix[VW][VY],
-					 
-					a.mV[VX] * mMatrix[VX][VZ] + 
-					a.mV[VY] * mMatrix[VY][VZ] + 
-					a.mV[VZ] * mMatrix[VZ][VZ] +
-					mMatrix[VW][VZ]);
-}
-
-inline void LLV4Matrix4::multiply(const LLVector3 &a, LLV4Vector3& o) const
-{
-	o.setVec(		a.mV[VX] * mMatrix[VX][VX] + 
-					a.mV[VY] * mMatrix[VY][VX] + 
-					a.mV[VZ] * mMatrix[VZ][VX] +
-					mMatrix[VW][VX],
-					 
-					a.mV[VX] * mMatrix[VX][VY] + 
-					a.mV[VY] * mMatrix[VY][VY] + 
-					a.mV[VZ] * mMatrix[VZ][VY] +
-					mMatrix[VW][VY],
-					 
-					a.mV[VX] * mMatrix[VX][VZ] + 
-					a.mV[VY] * mMatrix[VY][VZ] + 
-					a.mV[VZ] * mMatrix[VZ][VZ] +
-					mMatrix[VW][VZ]);
-}
-
-inline const LLV4Matrix4& LLV4Matrix4::translate(const LLV4Vector3 &vec)
-{
-	mMatrix[3][0] += vec.mV[0];
-	mMatrix[3][1] += vec.mV[1];
-	mMatrix[3][2] += vec.mV[2];
-	return (*this);
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-// LLV4Matrix4
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-
-#endif
-
-inline const LLV4Matrix4& LLV4Matrix4::operator=(const LLMatrix4& a)
-{
-	memcpy(mMatrix, a.mMatrix, sizeof(F32) * 16 );
-	return *this;
-}
-
-inline const LLV4Matrix4& LLV4Matrix4::transpose()
-{
-#if LL_VECTORIZE && defined(_MM_TRANSPOSE4_PS)
-	_MM_TRANSPOSE4_PS(mV[VX], mV[VY], mV[VZ], mV[VW]);
-#else
-	LLV4Matrix4 mat;
-	mat.mMatrix[0][0] = mMatrix[0][0];
-	mat.mMatrix[1][0] = mMatrix[0][1];
-	mat.mMatrix[2][0] = mMatrix[0][2];
-	mat.mMatrix[3][0] = mMatrix[0][3];
-
-	mat.mMatrix[0][1] = mMatrix[1][0];
-	mat.mMatrix[1][1] = mMatrix[1][1];
-	mat.mMatrix[2][1] = mMatrix[1][2];
-	mat.mMatrix[3][1] = mMatrix[1][3];
-
-	mat.mMatrix[0][2] = mMatrix[2][0];
-	mat.mMatrix[1][2] = mMatrix[2][1];
-	mat.mMatrix[2][2] = mMatrix[2][2];
-	mat.mMatrix[3][2] = mMatrix[2][3];
-
-	mat.mMatrix[0][3] = mMatrix[3][0];
-	mat.mMatrix[1][3] = mMatrix[3][1];
-	mat.mMatrix[2][3] = mMatrix[3][2];
-	mat.mMatrix[3][3] = mMatrix[3][3];
-
-	*this = mat;
-#endif
-	return *this;
-}
-
-inline const LLV4Matrix4& LLV4Matrix4::translate(const LLVector3 &vec)
-{
-	mMatrix[3][0] += vec.mV[0];
-	mMatrix[3][1] += vec.mV[1];
-	mMatrix[3][2] += vec.mV[2];
-	return (*this);
-}
-
-inline LLVector3 operator*(const LLVector3 &a, const LLV4Matrix4 &b)
-{
-	return LLVector3(a.mV[VX] * b.mMatrix[VX][VX] + 
-					 a.mV[VY] * b.mMatrix[VY][VX] + 
-					 a.mV[VZ] * b.mMatrix[VZ][VX] +
-					 b.mMatrix[VW][VX],
-					 
-					 a.mV[VX] * b.mMatrix[VX][VY] + 
-					 a.mV[VY] * b.mMatrix[VY][VY] + 
-					 a.mV[VZ] * b.mMatrix[VZ][VY] +
-					 b.mMatrix[VW][VY],
-					 
-					 a.mV[VX] * b.mMatrix[VX][VZ] + 
-					 a.mV[VY] * b.mMatrix[VY][VZ] + 
-					 a.mV[VZ] * b.mMatrix[VZ][VZ] +
-					 b.mMatrix[VW][VZ]);
-}
-
-
-#endif
diff --git a/indra/llmath/llv4vector3.h b/indra/llmath/llv4vector3.h
deleted file mode 100644
index a340d53f5ae621169d8a41ef3d566a75c6304c92..0000000000000000000000000000000000000000
--- a/indra/llmath/llv4vector3.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/** 
- * @file llviewerjointmesh.cpp
- * @brief LLV4* class header file - vector processor enabled math
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLV4VECTOR3_H
-#define LL_LLV4VECTOR3_H
-
-#include "llv4math.h"
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-// LLV4Vector3
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-
-LL_LLV4MATH_ALIGN_PREFIX
-
-class LLV4Vector3
-{
-public:
-	union {
-		F32		mV[LLV4_NUM_AXIS];
-		V4F32	v;
-	};
-
-	enum {
-		ALIGNMENT = 16
-		};
-
-	void				setVec(F32 x, F32 y, F32 z);
-	void				setVec(F32 a);
-}
-
-LL_LLV4MATH_ALIGN_POSTFIX;
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-// LLV4Vector3
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-
-inline void	LLV4Vector3::setVec(F32 x, F32 y, F32 z)
-{
-	mV[VX] = x;
-	mV[VY] = y;
-	mV[VZ] = z;
-}
-
-inline void	LLV4Vector3::setVec(F32 a)
-{
-#if LL_VECTORIZE
-	v = _mm_set1_ps(a);
-#else
-	setVec(a, a, a);
-#endif
-}
-
-#endif
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 1a95f9cd4631e7aa2860459bfb157c8b4fe14768..cc9744756fd4d4ba19ffb11c83229f9b3f4a0d1a 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -2078,6 +2078,7 @@ LLVolume::LLVolume(const LLVolumeParams &params, const F32 detail, const BOOL ge
 	mFaceMask = 0x0;
 	mDetail = detail;
 	mSculptLevel = -2;
+	mSurfaceArea = 1.f; //only calculated for sculpts, defaults to 1 for all other prims
 	mIsMeshAssetLoaded = FALSE;
 	mLODScaleBias.setVec(1,1,1);
 	mHullPoints = NULL;
@@ -2903,7 +2904,7 @@ F32 LLVolume::sculptGetSurfaceArea()
 			// compute the area of the quad by taking the length of the cross product of the two triangles
 			LLVector3 cross1 = (p1 - p2) % (p1 - p3);
 			LLVector3 cross2 = (p4 - p2) % (p4 - p3);
-			area += (cross1.magVec() + cross2.magVec()) / 2.0;
+			area += (cross1.magVec() + cross2.magVec()) / 2.f;
 		}
 	}
 
@@ -3144,6 +3145,8 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,
 		{
 			F32 area = sculptGetSurfaceArea();
 
+			mSurfaceArea = area;
+
 			const F32 SCULPT_MAX_AREA = 384.f;
 
 			if (area < SCULPT_MIN_AREA || area > SCULPT_MAX_AREA)
@@ -4305,15 +4308,25 @@ S32 LLVolume::getNumTriangleIndices() const
 }
 
 
-S32 LLVolume::getNumTriangles() const
+S32 LLVolume::getNumTriangles(S32* vcount) const
 {
 	U32 triangle_count = 0;
+	U32 vertex_count = 0;
 
 	for (S32 i = 0; i < getNumVolumeFaces(); ++i)
 	{
-		triangle_count += getVolumeFace(i).mNumIndices/3;
+		const LLVolumeFace& face = getVolumeFace(i);
+		triangle_count += face.mNumIndices/3;
+
+		vertex_count += face.mNumVertices;
 	}
 
+
+	if (vcount)
+	{
+		*vcount = vertex_count;
+	}
+	
 	return triangle_count;
 }
 
@@ -4607,18 +4620,83 @@ S32 LLVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& en
 				genBinormals(i);
 			}
 
-			if (!face.mOctree)
-			{
-				face.createOctree();
-			}
-			
-			//LLVector4a* p = (LLVector4a*) face.mPositions;
+			if (isUnique())
+			{ //don't bother with an octree for flexi volumes
+				U32 tri_count = face.mNumIndices/3;
+
+				for (U32 j = 0; j < tri_count; ++j)
+				{
+					U16 idx0 = face.mIndices[j*3+0];
+					U16 idx1 = face.mIndices[j*3+1];
+					U16 idx2 = face.mIndices[j*3+2];
+
+					const LLVector4a& v0 = face.mPositions[idx0];
+					const LLVector4a& v1 = face.mPositions[idx1];
+					const LLVector4a& v2 = face.mPositions[idx2];
+				
+					F32 a,b,t;
 
-			LLOctreeTriangleRayIntersect intersect(start, dir, &face, &closest_t, intersection, tex_coord, normal, bi_normal);
-			intersect.traverse(face.mOctree);
-			if (intersect.mHitFace)
+					if (LLTriangleRayIntersect(v0, v1, v2,
+							start, dir, a, b, t))
+					{
+						if ((t >= 0.f) &&      // if hit is after start
+							(t <= 1.f) &&      // and before end
+							(t < closest_t))   // and this hit is closer
+						{
+							closest_t = t;
+							hit_face = i;
+
+							if (intersection != NULL)
+							{
+								LLVector4a intersect = dir;
+								intersect.mul(closest_t);
+								intersect.add(start);
+								intersection->set(intersect.getF32ptr());
+							}
+
+
+							if (tex_coord != NULL)
+							{
+								LLVector2* tc = (LLVector2*) face.mTexCoords;
+								*tex_coord = ((1.f - a - b)  * tc[idx0] +
+									a              * tc[idx1] +
+									b              * tc[idx2]);
+
+							}
+
+							if (normal!= NULL)
+							{
+								LLVector4* norm = (LLVector4*) face.mNormals;
+
+								*normal		= ((1.f - a - b)  * LLVector3(norm[idx0]) + 
+									a              * LLVector3(norm[idx1]) +
+									b              * LLVector3(norm[idx2]));
+							}
+
+							if (bi_normal != NULL)
+							{
+								LLVector4* binormal = (LLVector4*) face.mBinormals;
+								*bi_normal = ((1.f - a - b)  * LLVector3(binormal[idx0]) + 
+										a              * LLVector3(binormal[idx1]) +
+										b              * LLVector3(binormal[idx2]));
+							}
+						}
+					}
+				}
+			}
+			else
 			{
-				hit_face = i;
+				if (!face.mOctree)
+				{
+					face.createOctree();
+				}
+			
+				LLOctreeTriangleRayIntersect intersect(start, dir, &face, &closest_t, intersection, tex_coord, normal, bi_normal);
+				intersect.traverse(face.mOctree);
+				if (intersect.mHitFace)
+				{
+					hit_face = i;
+				}
 			}
 		}		
 	}
@@ -5812,7 +5890,7 @@ F32 find_vertex_score(LLVCacheVertexData& data)
 	}
 
 	//bonus points for having low valence
-	F32 valence_boost = powf(data.mActiveTriangles, -FindVertexScore_ValenceBoostPower);
+	F32 valence_boost = powf((F32)data.mActiveTriangles, -FindVertexScore_ValenceBoostPower);
 	score += FindVertexScore_ValenceBoostScale * valence_boost;
 
 	return score;
diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h
index f0e59a3c005d5ecf7f2d004beadd0f35051bfd88..76cf9de613e3fc3d6c98d82d819436506c4659ce 100644
--- a/indra/llmath/llvolume.h
+++ b/indra/llmath/llvolume.h
@@ -963,6 +963,7 @@ class LLVolume : public LLRefCount
 	S32	getNumFaces() const;
 	S32 getNumVolumeFaces() const							{ return mVolumeFaces.size(); }
 	F32 getDetail() const									{ return mDetail; }
+	F32 getSurfaceArea() const								{ return mSurfaceArea; }
 	const LLVolumeParams& getParams() const					{ return mParams; }
 	LLVolumeParams getCopyOfParams() const					{ return mParams; }
 	const LLProfile& getProfile() const						{ return *mProfilep; }
@@ -990,7 +991,7 @@ class LLVolume : public LLRefCount
 	S32 getNumTriangleIndices() const;
 	static void getLoDTriangleCounts(const LLVolumeParams& params, S32* counts);
 
-	S32 getNumTriangles() const;
+	S32 getNumTriangles(S32* vcount = NULL) const;
 
 	void generateSilhouetteVertices(std::vector<LLVector3> &vertices, 
 									std::vector<LLVector3> &normals, 
@@ -1065,6 +1066,7 @@ class LLVolume : public LLRefCount
 	BOOL mUnique;
 	F32 mDetail;
 	S32 mSculptLevel;
+	F32 mSurfaceArea; //unscaled surface area
 	BOOL mIsMeshAssetLoaded;
 	
 	LLVolumeParams mParams;
diff --git a/indra/llmath/m4math.cpp b/indra/llmath/m4math.cpp
index bad4deb4dee87498382345aa2b8da3578c80d667..6a1b4143cfd64e9474f51e94645d54e2c7cda146 100644
--- a/indra/llmath/m4math.cpp
+++ b/indra/llmath/m4math.cpp
@@ -858,25 +858,25 @@ LLSD LLMatrix4::getValue() const
 
 void LLMatrix4::setValue(const LLSD& data) 
 {
-	mMatrix[0][0] = data[0].asReal();
-	mMatrix[0][1] = data[1].asReal();
-	mMatrix[0][2] = data[2].asReal();
-	mMatrix[0][3] = data[3].asReal();
-
-	mMatrix[1][0] = data[4].asReal();
-	mMatrix[1][1] = data[5].asReal();
-	mMatrix[1][2] = data[6].asReal();
-	mMatrix[1][3] = data[7].asReal();
-
-	mMatrix[2][0] = data[8].asReal();
-	mMatrix[2][1] = data[9].asReal();
-	mMatrix[2][2] = data[10].asReal();
-	mMatrix[2][3] = data[11].asReal();
-
-	mMatrix[3][0] = data[12].asReal();
-	mMatrix[3][1] = data[13].asReal();
-	mMatrix[3][2] = data[14].asReal();
-	mMatrix[3][3] = data[15].asReal();
+	mMatrix[0][0] = (F32)data[0].asReal();
+	mMatrix[0][1] = (F32)data[1].asReal();
+	mMatrix[0][2] = (F32)data[2].asReal();
+	mMatrix[0][3] = (F32)data[3].asReal();
+
+	mMatrix[1][0] = (F32)data[4].asReal();
+	mMatrix[1][1] = (F32)data[5].asReal();
+	mMatrix[1][2] = (F32)data[6].asReal();
+	mMatrix[1][3] = (F32)data[7].asReal();
+
+	mMatrix[2][0] = (F32)data[8].asReal();
+	mMatrix[2][1] = (F32)data[9].asReal();
+	mMatrix[2][2] = (F32)data[10].asReal();
+	mMatrix[2][3] = (F32)data[11].asReal();
+
+	mMatrix[3][0] = (F32)data[12].asReal();
+	mMatrix[3][1] = (F32)data[13].asReal();
+	mMatrix[3][2] = (F32)data[14].asReal();
+	mMatrix[3][3] = (F32)data[15].asReal();
 }
 
 
diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp
index 31cdb1219bd3d1235c915c5e0c5dcafc784f6d92..9b86daebe5d93441a6541c8f47be17bd3356518f 100644
--- a/indra/llmessage/llassetstorage.cpp
+++ b/indra/llmessage/llassetstorage.cpp
@@ -149,8 +149,8 @@ void LLAssetInfo::setFromNameValue( const LLNameValue& nv )
 	setName( buf );
 	buf.assign( str, pos2, std::string::npos );
 	setDescription( buf );
-	llinfos << "uuid: " << mUuid << llendl;
-	llinfos << "creator: " << mCreatorID << llendl;
+	LL_DEBUGS("AssetStorage") << "uuid: " << mUuid << llendl;
+	LL_DEBUGS("AssetStorage") << "creator: " << mCreatorID << llendl;
 }
 
 ///----------------------------------------------------------------------------
@@ -434,9 +434,9 @@ bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAsse
 // IW - uuid is passed by value to avoid side effects, please don't re-add &    
 void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LLGetAssetCallback callback, void *user_data, BOOL is_priority)
 {
-	lldebugs << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << llendl;
+	LL_DEBUGS("AssetStorage") << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << llendl;
 
-	llinfos << "ASSET_TRACE requesting " << uuid << " type " << LLAssetType::lookup(type) << llendl;
+	LL_DEBUGS("AssetStorage") << "ASSET_TRACE requesting " << uuid << " type " << LLAssetType::lookup(type) << llendl;
 
 	if (user_data)
 	{
@@ -446,7 +446,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
 
 	if (mShutDown)
 	{
-		llinfos << "ASSET_TRACE cancelled " << uuid << " type " << LLAssetType::lookup(type) << " shutting down" << llendl;
+		LL_DEBUGS("AssetStorage") << "ASSET_TRACE cancelled " << uuid << " type " << LLAssetType::lookup(type) << " shutting down" << llendl;
 
 		if (callback)
 		{
@@ -468,7 +468,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
 	// Try static VFS first.
 	if (findInStaticVFSAndInvokeCallback(uuid,type,callback,user_data))
 	{
-		llinfos << "ASSET_TRACE asset " << uuid << " found in static VFS" << llendl;
+		LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in static VFS" << llendl;
 		return;
 	}
 
@@ -486,7 +486,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
 			callback(mVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
 		}
 
-		llinfos << "ASSET_TRACE asset " << uuid << " found in VFS" << llendl;
+		LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in VFS" << llendl;
 	}
 	else
 	{
@@ -520,7 +520,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
 		}
 		if (duplicate)
 		{
-			llinfos << "Adding additional non-duplicate request for asset " << uuid 
+			LL_DEBUGS("AssetStorage") << "Adding additional non-duplicate request for asset " << uuid 
 					<< "." << LLAssetType::lookup(type) << llendl;
 		}
 		
@@ -584,9 +584,9 @@ void LLAssetStorage::downloadCompleteCallback(
 	LLAssetType::EType file_type,
 	void* user_data, LLExtStat ext_status)
 {
-	llinfos << "ASSET_TRACE asset " << file_id << " downloadCompleteCallback" << llendl;
+	LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << file_id << " downloadCompleteCallback" << llendl;
 
-	lldebugs << "LLAssetStorage::downloadCompleteCallback() for " << file_id
+	LL_DEBUGS("AssetStorage") << "LLAssetStorage::downloadCompleteCallback() for " << file_id
 		 << "," << LLAssetType::lookup(file_type) << llendl;
 	LLAssetRequest* req = (LLAssetRequest*)user_data;
 	if(!req)
@@ -731,7 +731,7 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen
 			tpvf.setAsset(asset_id, atype);
 			tpvf.setCallback(downloadEstateAssetCompleteCallback, req);
 
-			llinfos << "Starting transfer for " << asset_id << llendl;
+			LL_DEBUGS("AssetStorage") << "Starting transfer for " << asset_id << llendl;
 			LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(source_host, LLTCT_ASSET);
 			ttcp->requestTransfer(spe, tpvf, 100.f + (is_priority ? 1.f : 0.f));
 		}
@@ -871,7 +871,7 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age
 			tpvf.setAsset(asset_id, atype);
 			tpvf.setCallback(downloadInvItemCompleteCallback, req);
 
-			llinfos << "Starting transfer for inventory asset "
+			LL_DEBUGS("AssetStorage") << "Starting transfer for inventory asset "
 				<< item_id << " owned by " << owner_id << "," << task_id
 				<< llendl;
 			LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(source_host, LLTCT_ASSET);
@@ -1211,7 +1211,7 @@ bool LLAssetStorage::deletePendingRequest(LLAssetStorage::ERequestType rt,
 	request_list_t* requests = getRequestList(rt);
 	if (deletePendingRequestImpl(requests, asset_type, asset_id))
 	{
-		llinfos << "Asset " << getRequestName(rt) << " request for "
+		LL_DEBUGS("AssetStorage") << "Asset " << getRequestName(rt) << " request for "
 				<< asset_id << "." << LLAssetType::lookup(asset_type)
 				<< " removed from pending queue." << llendl;
 		return true;
@@ -1307,7 +1307,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo
 			user_data == ((LLLegacyAssetRequest *)tmp->mUserData)->mUserData)
 		{
 			// this is a duplicate from the same subsystem - throw it away
-			llinfos << "Discarding duplicate request for UUID " << uuid << llendl;
+			LL_DEBUGS("AssetStorage") << "Discarding duplicate request for UUID " << uuid << llendl;
 			return;
 		}
 	}
@@ -1490,7 +1490,7 @@ void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::ET
 {
 	if( !metric_recipient )
 	{
-		llinfos << "Couldn't store LLAssetStoreage::reportMetric - no metrics_recipient" << llendl;
+		LL_DEBUGS("AssetStorage") << "Couldn't store LLAssetStoreage::reportMetric - no metrics_recipient" << llendl;
 		return;
 	}
 
diff --git a/indra/llmessage/llbuffer.cpp b/indra/llmessage/llbuffer.cpp
index 0316797f00c10737c817efb6d06d2f91c35b5d05..250cace6e96825881a16fe34b94efafc5bb689e8 100644
--- a/indra/llmessage/llbuffer.cpp
+++ b/indra/llmessage/llbuffer.cpp
@@ -32,6 +32,9 @@
 #include "llmath.h"
 #include "llmemtype.h"
 #include "llstl.h"
+#include "llthread.h"
+
+#define ASSERT_LLBUFFERARRAY_MUTEX_LOCKED llassert(!mMutexp || mMutexp->isSelfLocked());
 
 /** 
  * LLSegment
@@ -224,7 +227,8 @@ void LLHeapBuffer::allocate(S32 size)
  * LLBufferArray
  */
 LLBufferArray::LLBufferArray() :
-	mNextBaseChannel(0)
+	mNextBaseChannel(0),
+	mMutexp(NULL)
 {
 	LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
 }
@@ -233,6 +237,8 @@ LLBufferArray::~LLBufferArray()
 {
 	LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
 	std::for_each(mBuffers.begin(), mBuffers.end(), DeletePointer());
+
+	delete mMutexp;
 }
 
 // static
@@ -243,14 +249,57 @@ LLChannelDescriptors LLBufferArray::makeChannelConsumer(
 	return rv;
 }
 
+void LLBufferArray::lock()
+{
+	if(mMutexp)
+	{
+		mMutexp->lock() ;
+	}
+}
+
+void LLBufferArray::unlock()
+{
+	if(mMutexp)
+	{
+		mMutexp->unlock() ;
+	}
+}
+
+LLMutex* LLBufferArray::getMutex()
+{
+	return mMutexp ;
+}
+
+void LLBufferArray::setThreaded(bool threaded)
+{
+	if(threaded)
+	{
+		if(!mMutexp)
+		{
+			mMutexp = new LLMutex(NULL);
+		}
+	}
+	else
+	{
+		if(mMutexp)
+		{
+			delete mMutexp ;
+			mMutexp = NULL ;
+		}
+	}
+}
+
 LLChannelDescriptors LLBufferArray::nextChannel()
 {
 	LLChannelDescriptors rv(mNextBaseChannel++);
 	return rv;
 }
 
+//mMutexp should be locked before calling this.
 S32 LLBufferArray::capacity() const
 {
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+
 	S32 total = 0;
 	const_buffer_iterator_t iter = mBuffers.begin();
 	const_buffer_iterator_t end = mBuffers.end();
@@ -263,6 +312,8 @@ S32 LLBufferArray::capacity() const
 
 bool LLBufferArray::append(S32 channel, const U8* src, S32 len)
 {
+	LLMutexLock lock(mMutexp) ;
+
 	LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
 	std::vector<LLSegment> segments;
 	if(copyIntoBuffers(channel, src, len, segments))
@@ -273,8 +324,11 @@ bool LLBufferArray::append(S32 channel, const U8* src, S32 len)
 	return false;
 }
 
+//mMutexp should be locked before calling this.
 bool LLBufferArray::prepend(S32 channel, const U8* src, S32 len)
 {
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+
 	LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
 	std::vector<LLSegment> segments;
 	if(copyIntoBuffers(channel, src, len, segments))
@@ -293,6 +347,8 @@ bool LLBufferArray::insertAfter(
 {
 	LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
 	std::vector<LLSegment> segments;
+
+	LLMutexLock lock(mMutexp) ;
 	if(mSegments.end() != segment)
 	{
 		++segment;
@@ -305,8 +361,11 @@ bool LLBufferArray::insertAfter(
 	return false;
 }
 
+//mMutexp should be locked before calling this.
 LLBufferArray::segment_iterator_t LLBufferArray::splitAfter(U8* address)
 {
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+
 	LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
 	segment_iterator_t end = mSegments.end();
 	segment_iterator_t it = getSegment(address);
@@ -335,20 +394,26 @@ LLBufferArray::segment_iterator_t LLBufferArray::splitAfter(U8* address)
 	return rv;
 }
 							   
+//mMutexp should be locked before calling this.
 LLBufferArray::segment_iterator_t LLBufferArray::beginSegment()
 {
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
 	return mSegments.begin();
 }
 
+//mMutexp should be locked before calling this.
 LLBufferArray::segment_iterator_t LLBufferArray::endSegment()
 {
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
 	return mSegments.end();
 }
 
+//mMutexp should be locked before calling this.
 LLBufferArray::segment_iterator_t LLBufferArray::constructSegmentAfter(
 	U8* address,
 	LLSegment& segment)
 {
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
 	LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
 	segment_iterator_t rv = mSegments.begin();
 	segment_iterator_t end = mSegments.end();
@@ -395,8 +460,10 @@ LLBufferArray::segment_iterator_t LLBufferArray::constructSegmentAfter(
 	return rv;
 }
 
+//mMutexp should be locked before calling this.
 LLBufferArray::segment_iterator_t LLBufferArray::getSegment(U8* address)
 {
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
 	segment_iterator_t end = mSegments.end();
 	if(!address)
 	{
@@ -414,9 +481,11 @@ LLBufferArray::segment_iterator_t LLBufferArray::getSegment(U8* address)
 	return end;
 }
 
+//mMutexp should be locked before calling this.
 LLBufferArray::const_segment_iterator_t LLBufferArray::getSegment(
 	U8* address) const
 {
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
 	const_segment_iterator_t end = mSegments.end();
 	if(!address)
 	{
@@ -466,6 +535,8 @@ S32 LLBufferArray::countAfter(S32 channel, U8* start) const
 	S32 count = 0;
 	S32 offset = 0;
 	const_segment_iterator_t it;
+
+	LLMutexLock lock(mMutexp) ;
 	const_segment_iterator_t end = mSegments.end();
 	if(start)
 	{
@@ -517,6 +588,8 @@ U8* LLBufferArray::readAfter(
 	len = 0;
 	S32 bytes_to_copy = 0;
 	const_segment_iterator_t it;
+
+	LLMutexLock lock(mMutexp) ;
 	const_segment_iterator_t end = mSegments.end();
 	if(start)
 	{
@@ -568,6 +641,7 @@ U8* LLBufferArray::seek(
 	U8* start,
 	S32 delta) const
 {
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
 	LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
 	const_segment_iterator_t it;
 	const_segment_iterator_t end = mSegments.end();
@@ -709,9 +783,14 @@ U8* LLBufferArray::seek(
 	return rv;
 }
 
+//test use only
 bool LLBufferArray::takeContents(LLBufferArray& source)
 {
 	LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
+
+	LLMutexLock lock(mMutexp);
+	source.lock();
+
 	std::copy(
 		source.mBuffers.begin(),
 		source.mBuffers.end(),
@@ -723,13 +802,17 @@ bool LLBufferArray::takeContents(LLBufferArray& source)
 		std::back_insert_iterator<segment_list_t>(mSegments));
 	source.mSegments.clear();
 	source.mNextBaseChannel = 0;
+	source.unlock();
+
 	return true;
 }
 
+//mMutexp should be locked before calling this.
 LLBufferArray::segment_iterator_t LLBufferArray::makeSegment(
 	S32 channel,
 	S32 len)
 {
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
 	LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
 	// start at the end of the buffers, because it is the most likely
 	// to have free space.
@@ -765,8 +848,10 @@ LLBufferArray::segment_iterator_t LLBufferArray::makeSegment(
 	return send;
 }
 
+//mMutexp should be locked before calling this.
 bool LLBufferArray::eraseSegment(const segment_iterator_t& erase_iter)
 {
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
 	LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
 
 	// Find out which buffer contains the segment, and if it is found,
@@ -792,13 +877,14 @@ bool LLBufferArray::eraseSegment(const segment_iterator_t& erase_iter)
 	return rv;
 }
 
-
+//mMutexp should be locked before calling this.
 bool LLBufferArray::copyIntoBuffers(
 	S32 channel,
 	const U8* src,
 	S32 len,
 	std::vector<LLSegment>& segments)
 {
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
 	LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
 	if(!src || !len) return false;
 	S32 copied = 0;
diff --git a/indra/llmessage/llbuffer.h b/indra/llmessage/llbuffer.h
index 1c42b6fbc65c3a3b6bd4aadb232f2fd0ea09a756..ccdb9fa7ee9e04c6cae6e1c4579993cae8eb72d8 100644
--- a/indra/llmessage/llbuffer.h
+++ b/indra/llmessage/llbuffer.h
@@ -39,6 +39,7 @@
 #include <list>
 #include <vector>
 
+class LLMutex;
 /** 
  * @class LLChannelDescriptors
  * @brief A way simple interface to accesss channels inside a buffer
@@ -564,6 +565,29 @@ class LLBufferArray
 	 * @return Returns true on success.
 	 */
 	bool eraseSegment(const segment_iterator_t& iter);
+
+	/**
+	* @brief Lock the mutex if it exists
+	* This method locks mMutexp to make accessing LLBufferArray thread-safe
+	*/
+	void lock();
+
+	/**
+	* @brief Unlock the mutex if it exists
+	*/
+	void unlock();
+
+	/**
+	* @brief Return mMutexp
+	*/
+	LLMutex* getMutex();
+
+	/**
+	* @brief Set LLBufferArray to be shared across threads or not
+	* This method is to create mMutexp if is threaded.
+	* @param threaded Indicates this LLBufferArray instance is shared across threads if true.
+	*/
+	void setThreaded(bool threaded);
 	//@}
 
 protected:
@@ -595,6 +619,7 @@ class LLBufferArray
 	S32 mNextBaseChannel;
 	buffer_list_t mBuffers;
 	segment_list_t mSegments;
+	LLMutex* mMutexp;
 };
 
 #endif // LL_LLBUFFER_H
diff --git a/indra/llmessage/llbufferstream.cpp b/indra/llmessage/llbufferstream.cpp
index 6257983c436ed51167b9f5121178f421a1308f57..8d8ad05ad5c61d483626d2c88f67e3d1bc968f88 100644
--- a/indra/llmessage/llbufferstream.cpp
+++ b/indra/llmessage/llbufferstream.cpp
@@ -31,6 +31,7 @@
 
 #include "llbuffer.h"
 #include "llmemtype.h"
+#include "llthread.h"
 
 static const S32 DEFAULT_OUTPUT_SEGMENT_SIZE = 1024 * 4;
 
@@ -62,6 +63,7 @@ int LLBufferStreamBuf::underflow()
 		return EOF;
 	}
 
+	LLMutexLock lock(mBuffer->getMutex());
 	LLBufferArray::segment_iterator_t iter;
 	LLBufferArray::segment_iterator_t end = mBuffer->endSegment();
 	U8* last_pos = (U8*)gptr();
@@ -149,6 +151,7 @@ int LLBufferStreamBuf::overflow(int c)
 	// since we got here, we have a buffer, and we have a character to
 	// put on it.
 	LLBufferArray::segment_iterator_t it;
+	LLMutexLock lock(mBuffer->getMutex());
 	it = mBuffer->makeSegment(mChannels.out(), DEFAULT_OUTPUT_SEGMENT_SIZE);
 	if(it != mBuffer->endSegment())
 	{
@@ -210,6 +213,7 @@ int LLBufferStreamBuf::sync()
 
 	// *NOTE: I bet we could just --address if address is not NULL.
 	// Need to think about that.
+	LLMutexLock lock(mBuffer->getMutex());
 	address = mBuffer->seek(mChannels.out(), address, -1);
 	if(address)
 	{
@@ -273,6 +277,8 @@ streampos LLBufferStreamBuf::seekoff(
 			// NULL is fine
 			break;
 		}
+
+		LLMutexLock lock(mBuffer->getMutex());
 		address = mBuffer->seek(mChannels.in(), base_addr, off);
 		if(address)
 		{
@@ -304,6 +310,8 @@ streampos LLBufferStreamBuf::seekoff(
 			// NULL is fine
 			break;
 		}
+
+		LLMutexLock lock(mBuffer->getMutex());
 		address = mBuffer->seek(mChannels.out(), base_addr, off);
 		if(address)
 		{
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index 330028c9268cedd76f6b5c51156fd7881638b140..b93d429feb492070221bf85168214b38c439f92b 100644
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -72,10 +72,9 @@
 
 static const U32 EASY_HANDLE_POOL_SIZE		= 5;
 static const S32 MULTI_PERFORM_CALL_REPEAT	= 5;
-static const S32 CURL_REQUEST_TIMEOUT = 30; // seconds
+static const S32 CURL_REQUEST_TIMEOUT = 30; // seconds per operation
 static const S32 MAX_ACTIVE_REQUEST_COUNT = 100;
 
-static 
 // DEBUG //
 S32 gCurlEasyCount = 0;
 S32 gCurlMultiCount = 0;
@@ -86,9 +85,12 @@ S32 gCurlMultiCount = 0;
 std::vector<LLMutex*> LLCurl::sSSLMutex;
 std::string LLCurl::sCAPath;
 std::string LLCurl::sCAFile;
-
-bool LLCurl::sMultiThreaded = false;
-static U32 sMainThreadID = 0;
+LLCurlThread* LLCurl::sCurlThread = NULL ;
+LLMutex* LLCurl::sHandleMutexp = NULL ;
+S32      LLCurl::sTotalHandles = 0 ;
+bool     LLCurl::sNotQuitting = true;
+F32      LLCurl::sCurlRequestTimeOut = 120.f; //seonds
+S32      LLCurl::sMaxHandles = 256; //max number of handles, (multi handles and easy handles combined).
 
 void check_curl_code(CURLcode code)
 {
@@ -221,17 +223,20 @@ namespace boost
 
 std::set<CURL*> LLCurl::Easy::sFreeHandles;
 std::set<CURL*> LLCurl::Easy::sActiveHandles;
-LLMutex* LLCurl::Easy::sHandleMutex = NULL;
-LLMutex* LLCurl::Easy::sMultiMutex = NULL;
+LLMutex* LLCurl::Easy::sHandleMutexp = NULL ;
 
 //static
 CURL* LLCurl::Easy::allocEasyHandle()
 {
+	llassert(LLCurl::getCurlThread()) ;
+
 	CURL* ret = NULL;
-	LLMutexLock lock(sHandleMutex);
+
+	LLMutexLock lock(sHandleMutexp) ;
+
 	if (sFreeHandles.empty())
 	{
-		ret = curl_easy_init();
+		ret = LLCurl::newEasyHandle();
 	}
 	else
 	{
@@ -251,19 +256,29 @@ CURL* LLCurl::Easy::allocEasyHandle()
 //static
 void LLCurl::Easy::releaseEasyHandle(CURL* handle)
 {
+	static const S32 MAX_NUM_FREE_HANDLES = 32 ;
+
 	if (!handle)
 	{
-		llerrs << "handle cannot be NULL!" << llendl;
+		return ; //handle allocation failed.
+		//llerrs << "handle cannot be NULL!" << llendl;
 	}
 
-	LLMutexLock lock(sHandleMutex);
-	
+	LLMutexLock lock(sHandleMutexp) ;
 	if (sActiveHandles.find(handle) != sActiveHandles.end())
 	{
 		sActiveHandles.erase(handle);
+
+		if(sFreeHandles.size() < MAX_NUM_FREE_HANDLES)
+		{
 		sFreeHandles.insert(handle);
 	}
 	else
+	{
+			LLCurl::deleteEasyHandle(handle) ;
+		}
+	}
+	else
 	{
 		llerrs << "Invalid handle." << llendl;
 	}
@@ -304,6 +319,14 @@ LLCurl::Easy::~Easy()
 	--gCurlEasyCount;
 	curl_slist_free_all(mHeaders);
 	for_each(mStrings.begin(), mStrings.end(), DeletePointerArray());
+
+	if (mResponder && LLCurl::sNotQuitting) //aborted
+	{	
+		std::string reason("Request timeout, aborted.") ;
+		mResponder->completedRaw(408, //HTTP_REQUEST_TIME_OUT, timeout, abort
+			reason, mChannels, mOutput);		
+	}
+	mResponder = NULL;
 }
 
 void LLCurl::Easy::resetState()
@@ -430,9 +453,9 @@ size_t curlReadCallback(char* data, size_t size, size_t nmemb, void* user_data)
 	LLCurl::Easy* easy = (LLCurl::Easy*)user_data;
 	
 	S32 n = size * nmemb;
-	S32 startpos = easy->getInput().tellg();
+	S32 startpos = (S32)easy->getInput().tellg();
 	easy->getInput().seekg(0, std::ios::end);
-	S32 endpos = easy->getInput().tellg();
+	S32 endpos = (S32)easy->getInput().tellg();
 	easy->getInput().seekg(startpos, std::ios::beg);
 	S32 maxn = endpos - startpos;
 	n = llmin(n, maxn);
@@ -476,6 +499,7 @@ void LLCurl::Easy::prepRequest(const std::string& url,
 	LLProxy::getInstance()->applyProxySettings(this);
 
 	mOutput.reset(new LLBufferArray);
+	mOutput->setThreaded(true);
 	setopt(CURLOPT_WRITEFUNCTION, (void*)&curlWriteCallback);
 	setopt(CURLOPT_WRITEDATA, (void*)this);
 
@@ -519,48 +543,56 @@ void LLCurl::Easy::prepRequest(const std::string& url,
 }
 
 ////////////////////////////////////////////////////////////////////////////
-
-LLCurl::Multi::Multi()
-	: LLThread("Curl Multi"),
-	  mQueued(0),
+LLCurl::Multi::Multi(F32 idle_time_out)
+	: mQueued(0),
 	  mErrorCount(0),
-	  mPerformState(PERFORM_STATE_READY)
+	  mState(STATE_READY),
+	  mDead(FALSE),
+	  mMutexp(NULL),
+	  mDeletionMutexp(NULL),
+	  mEasyMutexp(NULL)
 {
-	mQuitting = false;
-
-	mThreaded = LLCurl::sMultiThreaded && LLThread::currentID() == sMainThreadID;
-	if (mThreaded)
-	{
-		mSignal = new LLCondition(NULL);
-	}
-	else
-	{
-		mSignal = NULL;
-	}
-
-	mCurlMultiHandle = curl_multi_init();
+	mCurlMultiHandle = LLCurl::newMultiHandle();
 	if (!mCurlMultiHandle)
 	{
 		llwarns << "curl_multi_init() returned NULL! Easy handles: " << gCurlEasyCount << " Multi handles: " << gCurlMultiCount << llendl;
-		mCurlMultiHandle = curl_multi_init();
+		mCurlMultiHandle = LLCurl::newMultiHandle();
 	}
 	
-	llassert_always(mCurlMultiHandle);
+	//llassert_always(mCurlMultiHandle);	
+
+	if(mCurlMultiHandle)
+	{
+	if(LLCurl::getCurlThread()->getThreaded())
+	{
+		mMutexp = new LLMutex(NULL) ;
+		mDeletionMutexp = new LLMutex(NULL) ;
+		mEasyMutexp = new LLMutex(NULL) ;
+	}
+	LLCurl::getCurlThread()->addMulti(this) ;
+
+		mIdleTimeOut = idle_time_out ;
+		if(mIdleTimeOut < LLCurl::sCurlRequestTimeOut)
+		{
+			mIdleTimeOut = LLCurl::sCurlRequestTimeOut ;
+		}
+
 	++gCurlMultiCount;
 }
+}
 
 LLCurl::Multi::~Multi()
 {
-	llassert(isStopped());
+	cleanup() ;	
+}
 
-	if (LLCurl::sMultiThreaded)
+void LLCurl::Multi::cleanup()
+{
+	if(!mCurlMultiHandle)
 	{
-		LLCurl::Easy::sMultiMutex->lock();
+		return ; //nothing to clean.
 	}
 
-	delete mSignal;
-	mSignal = NULL;
-
 	// Clean up active
 	for(easy_active_list_t::iterator iter = mEasyActiveList.begin();
 		iter != mEasyActiveList.end(); ++iter)
@@ -576,76 +608,157 @@ LLCurl::Multi::~Multi()
 	for_each(mEasyFreeList.begin(), mEasyFreeList.end(), DeletePointer());	
 	mEasyFreeList.clear();
 
-	check_curl_multi_code(curl_multi_cleanup(mCurlMultiHandle));
+	check_curl_multi_code(LLCurl::deleteMultiHandle(mCurlMultiHandle));
+	mCurlMultiHandle = NULL ;
+
+	delete mMutexp ;
+	mMutexp = NULL ;
+	delete mDeletionMutexp ;
+	mDeletionMutexp = NULL ;
+	delete mEasyMutexp ;
+	mEasyMutexp = NULL ;
+
+	mQueued = 0 ;
+	mState = STATE_COMPLETED;
+	
 	--gCurlMultiCount;
 
-	if (LLCurl::sMultiThreaded)
+	return ;
+}
+
+void LLCurl::Multi::lock()
+{
+	if(mMutexp)
 	{
-		LLCurl::Easy::sMultiMutex->unlock();
+		mMutexp->lock() ;
 	}
 }
 
-CURLMsg* LLCurl::Multi::info_read(S32* msgs_in_queue)
+void LLCurl::Multi::unlock()
 {
-	CURLMsg* curlmsg = curl_multi_info_read(mCurlMultiHandle, msgs_in_queue);
-	return curlmsg;
+	if(mMutexp)
+	{
+		mMutexp->unlock() ;
+	}
+}
+
+void LLCurl::Multi::markDead()
+{
+	LLMutexLock lock(mDeletionMutexp) ;
+	
+	mDead = TRUE ;
+	LLCurl::getCurlThread()->setPriority(mHandle, LLQueuedThread::PRIORITY_URGENT) ; 
 }
 
-void LLCurl::Multi::perform()
+void LLCurl::Multi::setState(LLCurl::Multi::ePerformState state)
 {
-	if (mThreaded)
+	lock() ;
+	mState = state ;
+	unlock() ;
+
+	if(mState == STATE_READY)
 	{
-		if (mPerformState == PERFORM_STATE_READY)
-		{
-			mSignal->signal();
-		}
+		LLCurl::getCurlThread()->setPriority(mHandle, LLQueuedThread::PRIORITY_NORMAL) ;
+	}	
+}
+
+LLCurl::Multi::ePerformState LLCurl::Multi::getState()
+{
+	return mState;
+}
+	
+bool LLCurl::Multi::isCompleted() 
+{
+	return STATE_COMPLETED == getState() ;
+}
+
+bool LLCurl::Multi::waitToComplete()
+{
+	if(!isValid())
+	{
+		return true ;
 	}
-	else
+
+	if(!mMutexp) //not threaded
+	{
+		doPerform() ;
+		return true ;
+	}
+
+	bool completed = (STATE_COMPLETED == mState) ;
+	if(!completed)
 	{
-		doPerform();
+		LLCurl::getCurlThread()->setPriority(mHandle, LLQueuedThread::PRIORITY_HIGH) ;
 	}
+	
+	return completed;
 }
 
-void LLCurl::Multi::run()
+CURLMsg* LLCurl::Multi::info_read(S32* msgs_in_queue)
 {
-	llassert(mThreaded);
+	LLMutexLock lock(mMutexp) ;
 
-	while (!mQuitting)
-	{
-		mSignal->wait();
-		mPerformState = PERFORM_STATE_PERFORMING;
-		if (!mQuitting)
-		{
-			LLMutexLock lock(LLCurl::Easy::sMultiMutex);
-			doPerform();
-		}
-	}
+	CURLMsg* curlmsg = curl_multi_info_read(mCurlMultiHandle, msgs_in_queue);
+	return curlmsg;
 }
 
-void LLCurl::Multi::doPerform()
+//return true if dead
+bool LLCurl::Multi::doPerform()
 {
-	S32 q = 0;
-	for (S32 call_count = 0;
-			call_count < MULTI_PERFORM_CALL_REPEAT;
-			call_count += 1)
+	LLMutexLock lock(mDeletionMutexp) ;
+	
+	bool dead = mDead ;
+
+	if(mDead)
 	{
-		CURLMcode code = curl_multi_perform(mCurlMultiHandle, &q);
-		if (CURLM_CALL_MULTI_PERFORM != code || q == 0)
+		setState(STATE_COMPLETED);
+		mQueued = 0 ;
+	}
+	else if(getState() != STATE_COMPLETED)
+	{		
+		setState(STATE_PERFORMING);
+
+		S32 q = 0;
+		for (S32 call_count = 0;
+				call_count < MULTI_PERFORM_CALL_REPEAT;
+				call_count++)
 		{
-			check_curl_multi_code(code);
-			break;
+			LLMutexLock lock(mMutexp) ;
+
+			//WARNING: curl_multi_perform will block for many hundreds of milliseconds
+			// NEVER call this from the main thread, and NEVER allow the main thread to 
+			// wait on a mutex held by this thread while curl_multi_perform is executing
+			CURLMcode code = curl_multi_perform(mCurlMultiHandle, &q);
+			if (CURLM_CALL_MULTI_PERFORM != code || q == 0)
+			{
+				check_curl_multi_code(code);
+			
+				break;
+			}
 		}
-	
+
+		mQueued = q;	
+		setState(STATE_COMPLETED) ;
+		mIdleTimer.reset() ;
+	}
+	else if(mIdleTimer.getElapsedTimeF32() > mIdleTimeOut) //idle for too long, remove it.
+	{
+		dead = true ;
 	}
-	mQueued = q;
-	mPerformState = PERFORM_STATE_COMPLETED;
+
+	return dead ;
 }
 
 S32 LLCurl::Multi::process()
 {
-	perform();
+	if(!isValid())
+	{
+		return 0 ;
+	}
+
+	waitToComplete() ;
 
-	if (mPerformState != PERFORM_STATE_COMPLETED)
+	if (getState() != STATE_COMPLETED)
 	{
 		return 0;
 	}
@@ -660,10 +773,19 @@ S32 LLCurl::Multi::process()
 		if (msg->msg == CURLMSG_DONE)
 		{
 			U32 response = 0;
-			easy_active_map_t::iterator iter = mEasyActiveMap.find(msg->easy_handle);
-			if (iter != mEasyActiveMap.end())
+			Easy* easy = NULL ;
+
+			{
+				LLMutexLock lock(mEasyMutexp) ;
+				easy_active_map_t::iterator iter = mEasyActiveMap.find(msg->easy_handle);
+				if (iter != mEasyActiveMap.end())
+				{
+					easy = iter->second;
+				}
+			}
+
+			if(easy)
 			{
-				Easy* easy = iter->second;
 				response = easy->report(msg->data.result);
 				removeEasy(easy);
 			}
@@ -681,25 +803,28 @@ S32 LLCurl::Multi::process()
 		}
 	}
 
-	mPerformState = PERFORM_STATE_READY;
+	setState(STATE_READY);
+
 	return processed;
 }
 
 LLCurl::Easy* LLCurl::Multi::allocEasy()
 {
-	Easy* easy = 0;
+	Easy* easy = 0;	
 
 	if (mEasyFreeList.empty())
-	{
+	{		
 		easy = Easy::getEasy();
 	}
 	else
 	{
+		LLMutexLock lock(mEasyMutexp) ;
 		easy = *(mEasyFreeList.begin());
 		mEasyFreeList.erase(easy);
 	}
 	if (easy)
 	{
+		LLMutexLock lock(mEasyMutexp) ;
 		mEasyActiveList.insert(easy);
 		mEasyActiveMap[easy->getCurlHandle()] = easy;
 	}
@@ -708,6 +833,7 @@ LLCurl::Easy* LLCurl::Multi::allocEasy()
 
 bool LLCurl::Multi::addEasy(Easy* easy)
 {
+	LLMutexLock lock(mMutexp) ;
 	CURLMcode mcode = curl_multi_add_handle(mCurlMultiHandle, easy->getCurlHandle());
 	check_curl_multi_code(mcode);
 	//if (mcode != CURLM_OK)
@@ -720,25 +846,156 @@ bool LLCurl::Multi::addEasy(Easy* easy)
 
 void LLCurl::Multi::easyFree(Easy* easy)
 {
+	if(mEasyMutexp)
+	{
+		mEasyMutexp->lock() ;
+	}
+
 	mEasyActiveList.erase(easy);
 	mEasyActiveMap.erase(easy->getCurlHandle());
+
 	if (mEasyFreeList.size() < EASY_HANDLE_POOL_SIZE)
-	{
-		easy->resetState();
+	{		
 		mEasyFreeList.insert(easy);
+		
+		if(mEasyMutexp)
+		{
+			mEasyMutexp->unlock() ;
+		}
+
+		easy->resetState();
 	}
 	else
 	{
+		if(mEasyMutexp)
+		{
+			mEasyMutexp->unlock() ;
+		}
 		delete easy;
 	}
 }
 
 void LLCurl::Multi::removeEasy(Easy* easy)
 {
-	check_curl_multi_code(curl_multi_remove_handle(mCurlMultiHandle, easy->getCurlHandle()));
+	{
+		LLMutexLock lock(mMutexp) ;
+		check_curl_multi_code(curl_multi_remove_handle(mCurlMultiHandle, easy->getCurlHandle()));
+	}
 	easyFree(easy);
 }
 
+//------------------------------------------------------------
+//LLCurlThread
+LLCurlThread::CurlRequest::CurlRequest(handle_t handle, LLCurl::Multi* multi, LLCurlThread* curl_thread) :
+	LLQueuedThread::QueuedRequest(handle, LLQueuedThread::PRIORITY_NORMAL, FLAG_AUTO_COMPLETE),
+	mMulti(multi),
+	mCurlThread(curl_thread)
+{	
+}
+
+LLCurlThread::CurlRequest::~CurlRequest()
+{	
+	if(mMulti)
+	{
+		mCurlThread->deleteMulti(mMulti) ;
+		mMulti = NULL ;
+	}
+}
+
+bool LLCurlThread::CurlRequest::processRequest()
+{
+	bool completed = true ;
+	if(mMulti)
+	{
+		completed = mCurlThread->doMultiPerform(mMulti) ;
+
+		if(!completed)
+		{
+		setPriority(LLQueuedThread::PRIORITY_LOW) ;
+	}
+	}
+
+	return completed ;
+}
+
+void LLCurlThread::CurlRequest::finishRequest(bool completed)
+{
+	if(mMulti->isDead())
+	{
+	mCurlThread->deleteMulti(mMulti) ;
+	}
+	else
+	{
+		mCurlThread->cleanupMulti(mMulti) ; //being idle too long, remove the request.
+	}
+
+	mMulti = NULL ;
+}
+	
+LLCurlThread::LLCurlThread(bool threaded) :
+	LLQueuedThread("curlthread", threaded)
+{
+}
+	
+//virtual 
+LLCurlThread::~LLCurlThread() 
+{
+}
+
+S32 LLCurlThread::update(F32 max_time_ms)
+{	
+	return LLQueuedThread::update(max_time_ms);
+}
+
+void LLCurlThread::addMulti(LLCurl::Multi* multi)
+{
+	multi->mHandle = generateHandle() ;
+
+	CurlRequest* req = new CurlRequest(multi->mHandle, multi, this) ;
+
+	if (!addRequest(req))
+	{
+		llwarns << "curl request added when the thread is quitted" << llendl;
+	}
+}
+	
+void LLCurlThread::killMulti(LLCurl::Multi* multi)
+{
+	if(!multi)
+	{
+		return ;
+	}
+
+	if(multi->isValid())
+	{
+	multi->markDead() ;
+}
+	else
+	{
+		deleteMulti(multi) ;
+	}
+}
+
+//private
+bool LLCurlThread::doMultiPerform(LLCurl::Multi* multi) 
+{
+	return multi->doPerform() ;
+}
+
+//private
+void LLCurlThread::deleteMulti(LLCurl::Multi* multi) 
+{
+	delete multi ;
+}
+
+//private
+void LLCurlThread::cleanupMulti(LLCurl::Multi* multi) 
+{
+	multi->cleanup() ;
+}
+
+//------------------------------------------------------------
+
 //static
 std::string LLCurl::strerror(CURLcode errorcode)
 {
@@ -753,39 +1010,30 @@ LLCurlRequest::LLCurlRequest() :
 	mActiveMulti(NULL),
 	mActiveRequestCount(0)
 {
-	mThreadID = LLThread::currentID();
 	mProcessing = FALSE;
 }
 
 LLCurlRequest::~LLCurlRequest()
 {
-	llassert_always(mThreadID == LLThread::currentID());
-
 	//stop all Multi handle background threads
 	for (curlmulti_set_t::iterator iter = mMultiSet.begin(); iter != mMultiSet.end(); ++iter)
 	{
-		LLCurl::Multi* multi = *iter;
-		multi->mQuitting = true;
-		if (multi->mThreaded)
-		{
-			while (!multi->isStopped())
-			{
-				multi->mSignal->signal();
-				apr_sleep(1000);
-			}
-		}
+		LLCurl::getCurlThread()->killMulti(*iter) ;
 	}
-	for_each(mMultiSet.begin(), mMultiSet.end(), DeletePointer());
+	mMultiSet.clear() ;
 }
 
 void LLCurlRequest::addMulti()
 {
-	llassert_always(mThreadID == LLThread::currentID());
 	LLCurl::Multi* multi = new LLCurl::Multi();
-	if (multi->mThreaded)
+	if(!multi->isValid())
 	{
-		multi->start();
+		LLCurl::getCurlThread()->killMulti(multi) ;
+		mActiveMulti = NULL ;
+		mActiveRequestCount = 0 ;
+		return;
 	}
+	
 	mMultiSet.insert(multi);
 	mActiveMulti = multi;
 	mActiveRequestCount = 0;
@@ -799,7 +1047,12 @@ LLCurl::Easy* LLCurlRequest::allocEasy()
 	{
 		addMulti();
 	}
-	llassert_always(mActiveMulti);
+	if(!mActiveMulti)
+	{
+		return NULL ;
+	}
+
+	//llassert_always(mActiveMulti);
 	++mActiveRequestCount;
 	LLCurl::Easy* easy = mActiveMulti->allocEasy();
 	return easy;
@@ -901,7 +1154,6 @@ bool LLCurlRequest::post(const std::string& url,
 // Note: call once per frame
 S32 LLCurlRequest::process()
 {
-	llassert_always(mThreadID == LLThread::currentID());
 	S32 res = 0;
 
 	mProcessing = TRUE;
@@ -910,22 +1162,25 @@ S32 LLCurlRequest::process()
 	{
 		curlmulti_set_t::iterator curiter = iter++;
 		LLCurl::Multi* multi = *curiter;
+
+		if(!multi->isValid())
+		{
+			if(multi == mActiveMulti)
+			{				
+				mActiveMulti = NULL ;
+				mActiveRequestCount = 0 ;
+			}
+			mMultiSet.erase(curiter) ;
+			LLCurl::getCurlThread()->killMulti(multi) ;
+			continue ;
+		}
+
 		S32 tres = multi->process();
 		res += tres;
 		if (multi != mActiveMulti && tres == 0 && multi->mQueued == 0)
 		{
 			mMultiSet.erase(curiter);
-			multi->mQuitting = true;
-			if (multi->mThreaded)
-			{
-				while (!multi->isStopped())
-				{
-					multi->mSignal->signal();
-					apr_sleep(1000);
-				}
-			}
-
-			delete multi;
+			LLCurl::getCurlThread()->killMulti(multi);
 		}
 	}
 	mProcessing = FALSE;
@@ -934,15 +1189,27 @@ S32 LLCurlRequest::process()
 
 S32 LLCurlRequest::getQueued()
 {
-	llassert_always(mThreadID == LLThread::currentID());
 	S32 queued = 0;
 	for (curlmulti_set_t::iterator iter = mMultiSet.begin();
 		 iter != mMultiSet.end(); )
 	{
 		curlmulti_set_t::iterator curiter = iter++;
 		LLCurl::Multi* multi = *curiter;
+		
+		if(!multi->isValid())
+		{
+			if(multi == mActiveMulti)
+			{				
+				mActiveMulti = NULL ;
+				mActiveRequestCount = 0 ;
+			}
+			LLCurl::getCurlThread()->killMulti(multi);
+			mMultiSet.erase(curiter) ;
+			continue ;
+		}
+
 		queued += multi->mQueued;
-		if (multi->mPerformState != LLCurl::Multi::PERFORM_STATE_READY)
+		if (multi->getState() != LLCurl::Multi::STATE_READY)
 		{
 			++queued;
 		}
@@ -959,10 +1226,9 @@ LLCurlEasyRequest::LLCurlEasyRequest()
 	  mResultReturned(false)
 {
 	mMulti = new LLCurl::Multi();
-	if (mMulti->mThreaded)
+	
+	if(mMulti->isValid())
 	{
-		mMulti->start();
-	}
 	mEasy = mMulti->allocEasy();
 	if (mEasy)
 	{
@@ -972,24 +1238,22 @@ LLCurlEasyRequest::LLCurlEasyRequest()
 		LLProxy::getInstance()->applyProxySettings(mEasy);
 	}
 }
+	else
+	{
+		LLCurl::getCurlThread()->killMulti(mMulti) ;
+		mEasy = NULL ;
+		mMulti = NULL ;
+	}
+}
 
 LLCurlEasyRequest::~LLCurlEasyRequest()
 {
-	mMulti->mQuitting = true;
-	if (mMulti->mThreaded)
-	{
-		while (!mMulti->isStopped())
-		{
-			mMulti->mSignal->signal();
-			apr_sleep(1000);
-		}
-	}
-	delete mMulti;
+	LLCurl::getCurlThread()->killMulti(mMulti) ;
 }
 	
 void LLCurlEasyRequest::setopt(CURLoption option, S32 value)
 {
-	if (mEasy)
+	if (isValid() && mEasy)
 	{
 		mEasy->setopt(option, value);
 	}
@@ -997,7 +1261,7 @@ void LLCurlEasyRequest::setopt(CURLoption option, S32 value)
 
 void LLCurlEasyRequest::setoptString(CURLoption option, const std::string& value)
 {
-	if (mEasy)
+	if (isValid() && mEasy)
 	{
 		mEasy->setoptString(option, value);
 	}
@@ -1005,7 +1269,7 @@ void LLCurlEasyRequest::setoptString(CURLoption option, const std::string& value
 
 void LLCurlEasyRequest::setPost(char* postdata, S32 size)
 {
-	if (mEasy)
+	if (isValid() && mEasy)
 	{
 		mEasy->setopt(CURLOPT_POST, 1);
 		mEasy->setopt(CURLOPT_POSTFIELDS, postdata);
@@ -1015,7 +1279,7 @@ void LLCurlEasyRequest::setPost(char* postdata, S32 size)
 
 void LLCurlEasyRequest::setHeaderCallback(curl_header_callback callback, void* userdata)
 {
-	if (mEasy)
+	if (isValid() && mEasy)
 	{
 		mEasy->setopt(CURLOPT_HEADERFUNCTION, (void*)callback);
 		mEasy->setopt(CURLOPT_HEADERDATA, userdata); // aka CURLOPT_WRITEHEADER
@@ -1024,7 +1288,7 @@ void LLCurlEasyRequest::setHeaderCallback(curl_header_callback callback, void* u
 
 void LLCurlEasyRequest::setWriteCallback(curl_write_callback callback, void* userdata)
 {
-	if (mEasy)
+	if (isValid() && mEasy)
 	{
 		mEasy->setopt(CURLOPT_WRITEFUNCTION, (void*)callback);
 		mEasy->setopt(CURLOPT_WRITEDATA, userdata);
@@ -1033,7 +1297,7 @@ void LLCurlEasyRequest::setWriteCallback(curl_write_callback callback, void* use
 
 void LLCurlEasyRequest::setReadCallback(curl_read_callback callback, void* userdata)
 {
-	if (mEasy)
+	if (isValid() && mEasy)
 	{
 		mEasy->setopt(CURLOPT_READFUNCTION, (void*)callback);
 		mEasy->setopt(CURLOPT_READDATA, userdata);
@@ -1042,7 +1306,7 @@ void LLCurlEasyRequest::setReadCallback(curl_read_callback callback, void* userd
 
 void LLCurlEasyRequest::setSSLCtxCallback(curl_ssl_ctx_callback callback, void* userdata)
 {
-	if (mEasy)
+	if (isValid() && mEasy)
 	{
 		mEasy->setopt(CURLOPT_SSL_CTX_FUNCTION, (void*)callback);
 		mEasy->setopt(CURLOPT_SSL_CTX_DATA, userdata);
@@ -1051,7 +1315,7 @@ void LLCurlEasyRequest::setSSLCtxCallback(curl_ssl_ctx_callback callback, void*
 
 void LLCurlEasyRequest::slist_append(const char* str)
 {
-	if (mEasy)
+	if (isValid() && mEasy)
 	{
 		mEasy->slist_append(str);
 	}
@@ -1062,7 +1326,7 @@ void LLCurlEasyRequest::sendRequest(const std::string& url)
 	llassert_always(!mRequestSent);
 	mRequestSent = true;
 	lldebugs << url << llendl;
-	if (mEasy)
+	if (isValid() && mEasy)
 	{
 		mEasy->setHeaders();
 		mEasy->setoptString(CURLOPT_URL, url);
@@ -1074,25 +1338,24 @@ void LLCurlEasyRequest::requestComplete()
 {
 	llassert_always(mRequestSent);
 	mRequestSent = false;
-	if (mEasy)
+	if (isValid() && mEasy)
 	{
 		mMulti->removeEasy(mEasy);
 	}
 }
 
-void LLCurlEasyRequest::perform()
-{
-	mMulti->perform();
-}
-
 // Usage: Call getRestult until it returns false (no more messages)
 bool LLCurlEasyRequest::getResult(CURLcode* result, LLCurl::TransferInfo* info)
 {
-	if (mMulti->mPerformState != LLCurl::Multi::PERFORM_STATE_COMPLETED)
+	if(!isValid())
+	{
+		return false ;
+	}
+	if (!mMulti->isCompleted())
 	{ //we're busy, try again later
 		return false;
 	}
-	mMulti->mPerformState = LLCurl::Multi::PERFORM_STATE_READY;
+	mMulti->setState(LLCurl::Multi::STATE_READY) ;
 
 	if (!mEasy)
 	{
@@ -1152,7 +1415,7 @@ CURLMsg* LLCurlEasyRequest::info_read(S32* q, LLCurl::TransferInfo* info)
 
 std::string LLCurlEasyRequest::getErrorString()
 {
-	return mEasy ? std::string(mEasy->getErrorBuffer()) : std::string();
+	return isValid() &&  mEasy ? std::string(mEasy->getErrorBuffer()) : std::string();
 }
 
 ////////////////////////////////////////////////////////////////////////////
@@ -1178,10 +1441,11 @@ unsigned long LLCurl::ssl_thread_id(void)
 }
 #endif
 
-void LLCurl::initClass(bool multi_threaded)
+void LLCurl::initClass(F32 curl_reuest_timeout, S32 max_number_handles, bool multi_threaded)
 {
-	sMainThreadID = LLThread::currentID();
-	sMultiThreaded = multi_threaded;
+	sCurlRequestTimeOut = curl_reuest_timeout ; //seconds
+	sMaxHandles = max_number_handles ; //max number of handles, (multi handles and easy handles combined).
+
 	// Do not change this "unless you are familiar with and mean to control 
 	// internal operations of libcurl"
 	// - http://curl.haxx.se/libcurl/c/curl_global_init.html
@@ -1189,9 +1453,6 @@ void LLCurl::initClass(bool multi_threaded)
 
 	check_curl_code(code);
 	
-	Easy::sHandleMutex = new LLMutex(NULL);
-	Easy::sMultiMutex = new LLMutex(NULL);
-
 #if SAFE_SSL
 	S32 mutex_count = CRYPTO_num_locks();
 	for (S32 i=0; i<mutex_count; i++)
@@ -1201,31 +1462,118 @@ void LLCurl::initClass(bool multi_threaded)
 	CRYPTO_set_id_callback(&LLCurl::ssl_thread_id);
 	CRYPTO_set_locking_callback(&LLCurl::ssl_locking_callback);
 #endif
+
+	sCurlThread = new LLCurlThread(multi_threaded) ;
+	if(multi_threaded)
+	{
+		sHandleMutexp = new LLMutex(NULL) ;
+		Easy::sHandleMutexp = new LLMutex(NULL) ;
+	}
 }
 
 void LLCurl::cleanupClass()
 {
+	sNotQuitting = false; //set quitting
+
+	//shut down curl thread
+	while(1)
+	{
+		if(!sCurlThread->update(1)) //finish all tasks
+		{
+			break ;
+		}
+	}
+	sCurlThread->shutdown() ;
+	delete sCurlThread ;
+	sCurlThread = NULL ;
+
 #if SAFE_SSL
 	CRYPTO_set_locking_callback(NULL);
 	for_each(sSSLMutex.begin(), sSSLMutex.end(), DeletePointer());
 #endif
 
-	delete Easy::sHandleMutex;
-	Easy::sHandleMutex = NULL;
-	delete Easy::sMultiMutex;
-	Easy::sMultiMutex = NULL;
-
 	for (std::set<CURL*>::iterator iter = Easy::sFreeHandles.begin(); iter != Easy::sFreeHandles.end(); ++iter)
 	{
 		CURL* curl = *iter;
-		curl_easy_cleanup(curl);
+		LLCurl::deleteEasyHandle(curl);
 	}
 
 	Easy::sFreeHandles.clear();
 
+	delete Easy::sHandleMutexp ;
+	Easy::sHandleMutexp = NULL ;
+
+	delete sHandleMutexp ;
+	sHandleMutexp = NULL ;
+
 	llassert(Easy::sActiveHandles.empty());
 }
 
+//static 
+CURLM* LLCurl::newMultiHandle()
+{
+	LLMutexLock lock(sHandleMutexp) ;
+
+	if(sTotalHandles + 1 > sMaxHandles)
+	{
+		llwarns << "no more handles available." << llendl ;
+		return NULL ; //failed
+	}
+	sTotalHandles++;
+
+	CURLM* ret = curl_multi_init() ;
+	if(!ret)
+	{
+		llwarns << "curl_multi_init failed." << llendl ;
+	}
+
+	return ret ;
+}
+
+//static 
+CURLMcode  LLCurl::deleteMultiHandle(CURLM* handle)
+{
+	if(handle)
+	{
+		LLMutexLock lock(sHandleMutexp) ;		
+		sTotalHandles-- ;
+		return curl_multi_cleanup(handle) ;
+	}
+	return CURLM_OK ;
+}
+
+//static 
+CURL*  LLCurl::newEasyHandle()
+{
+	LLMutexLock lock(sHandleMutexp) ;
+
+	if(sTotalHandles + 1 > sMaxHandles)
+	{
+		llwarns << "no more handles available." << llendl ;
+		return NULL ; //failed
+	}
+	sTotalHandles++;
+
+	CURL* ret = curl_easy_init() ;
+	if(!ret)
+	{
+		llwarns << "curl_easy_init failed." << llendl ;
+	}
+
+	return ret ;
+}
+
+//static 
+void  LLCurl::deleteEasyHandle(CURL* handle)
+{
+	if(handle)
+	{
+		LLMutexLock lock(sHandleMutexp) ;
+		curl_easy_cleanup(handle) ;
+		sTotalHandles-- ;
+	}
+}
+
 const unsigned int LLCurl::MAX_REDIRECTS = 5;
 
 // Provide access to LLCurl free functions outside of llcurl.cpp without polluting the global namespace.
diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h
old mode 100755
new mode 100644
index 87de202717ca5c03e75b53fcd350f8ecd68485f4..fd664c0fa196d3083f1072a389415d511bf71a6e
--- a/indra/llmessage/llcurl.h
+++ b/indra/llmessage/llcurl.h
@@ -42,8 +42,11 @@
 #include "lliopipe.h"
 #include "llsd.h"
 #include "llthread.h"
+#include "llqueuedthread.h"
+#include "llframetimer.h"
 
 class LLMutex;
+class LLCurlThread;
 
 // For whatever reason, this is not typedef'd in curl.h
 typedef size_t (*curl_header_callback)(void *ptr, size_t size, size_t nmemb, void *stream);
@@ -56,8 +59,6 @@ class LLCurl
 	class Easy;
 	class Multi;
 
-	static bool sMultiThreaded;
-
 	struct TransferInfo
 	{
 		TransferInfo() : mSizeDownload(0.0), mTotalTime(0.0), mSpeedDownload(0.0) {}
@@ -162,7 +163,7 @@ class LLCurl
 	/**
 	 * @ brief Initialize LLCurl class
 	 */
-	static void initClass(bool multi_threaded = false);
+	static void initClass(F32 curl_reuest_timeout = 120.f, S32 max_number_handles = 256, bool multi_threaded = false);
 
 	/**
 	 * @ brief Cleanup LLCurl class
@@ -181,10 +182,25 @@ class LLCurl
 	static void ssl_locking_callback(int mode, int type, const char *file, int line);
 	static unsigned long ssl_thread_id(void);
 
+	static LLCurlThread* getCurlThread() { return sCurlThread ;}
+
+	static CURLM* newMultiHandle() ;
+	static CURLMcode deleteMultiHandle(CURLM* handle) ;
+	static CURL*  newEasyHandle() ;
+	static void   deleteEasyHandle(CURL* handle) ;
+
 private:
 	static std::string sCAPath;
 	static std::string sCAFile;
 	static const unsigned int MAX_REDIRECTS;
+	static LLCurlThread* sCurlThread;
+
+	static LLMutex* sHandleMutexp ;
+	static S32      sTotalHandles ;
+	static S32      sMaxHandles;
+public:
+	static bool     sNotQuitting;
+	static F32      sCurlRequestTimeOut;	
 };
 
 class LLCurl::Easy
@@ -216,7 +232,7 @@ class LLCurl::Easy
 	U32 report(CURLcode);
 	void getTransferInfo(LLCurl::TransferInfo* info);
 
-	void prepRequest(const std::string& url, const std::vector<std::string>& headers, ResponderPtr, S32 time_out = 0, bool post = false);
+	void prepRequest(const std::string& url, const std::vector<std::string>& headers, LLCurl::ResponderPtr, S32 time_out = 0, bool post = false);
 
 	const char* getErrorBuffer();
 
@@ -247,64 +263,120 @@ class LLCurl::Easy
 	// Note: char*'s not strings since we pass pointers to curl
 	std::vector<char*>	mStrings;
 
-	ResponderPtr		mResponder;
+	LLCurl::ResponderPtr		mResponder;
 
 	static std::set<CURL*> sFreeHandles;
 	static std::set<CURL*> sActiveHandles;
-	static LLMutex* sHandleMutex;
-	static LLMutex* sMultiMutex;
+	static LLMutex*        sHandleMutexp ;
 };
 
-class LLCurl::Multi : public LLThread
+class LLCurl::Multi
 {
 	LOG_CLASS(Multi);
+
+	friend class LLCurlThread ;
+
+private:
+	~Multi();
+
+	void markDead() ;
+	bool doPerform();
+
 public:
 
 	typedef enum
 	{
-		PERFORM_STATE_READY=0,
-		PERFORM_STATE_PERFORMING=1,
-		PERFORM_STATE_COMPLETED=2
+		STATE_READY=0,
+		STATE_PERFORMING=1,
+		STATE_COMPLETED=2
 	} ePerformState;
 
-	Multi();
-	~Multi();
+	Multi(F32 idle_time_out = 0.f);	
 
-	Easy* allocEasy();
-	bool addEasy(Easy* easy);
+	LLCurl::Easy* allocEasy();
+	bool addEasy(LLCurl::Easy* easy);	
+	void removeEasy(LLCurl::Easy* easy);
 	
-	void removeEasy(Easy* easy);
+	void lock() ;
+	void unlock() ;
 
-	S32 process();
-	void perform();
-	void doPerform();
+	void setState(ePerformState state) ;
+	ePerformState getState() ;
 	
-	virtual void run();
+	bool isCompleted() ;
+	bool isValid() {return mCurlMultiHandle != NULL ;}
+	bool isDead() {return mDead;}
+
+	bool waitToComplete() ;
 
+	S32 process();
+	
 	CURLMsg* info_read(S32* msgs_in_queue);
 
 	S32 mQueued;
 	S32 mErrorCount;
 	
-	S32 mPerformState;
-
-	LLCondition* mSignal;
-	bool mQuitting;
-	bool mThreaded;
-
 private:
-	void easyFree(Easy*);
+	void easyFree(LLCurl::Easy*);
+	void cleanup() ;
 	
 	CURLM* mCurlMultiHandle;
 
-	typedef std::set<Easy*> easy_active_list_t;
+	typedef std::set<LLCurl::Easy*> easy_active_list_t;
 	easy_active_list_t mEasyActiveList;
-	typedef std::map<CURL*, Easy*> easy_active_map_t;
+	typedef std::map<CURL*, LLCurl::Easy*> easy_active_map_t;
 	easy_active_map_t mEasyActiveMap;
-	typedef std::set<Easy*> easy_free_list_t;
+	typedef std::set<LLCurl::Easy*> easy_free_list_t;
 	easy_free_list_t mEasyFreeList;
+
+	LLQueuedThread::handle_t mHandle ;
+	ePerformState mState;
+
+	BOOL mDead ;
+	LLMutex* mMutexp ;
+	LLMutex* mDeletionMutexp ;
+	LLMutex* mEasyMutexp ;
+	LLFrameTimer mIdleTimer ;
+	F32 mIdleTimeOut;
 };
 
+class LLCurlThread : public LLQueuedThread
+{
+public:
+
+	class CurlRequest : public LLQueuedThread::QueuedRequest
+	{
+	protected:
+		virtual ~CurlRequest(); // use deleteRequest()
+		
+	public:
+		CurlRequest(handle_t handle, LLCurl::Multi* multi, LLCurlThread* curl_thread);
+
+		/*virtual*/ bool processRequest();
+		/*virtual*/ void finishRequest(bool completed);
+
+	private:
+		// input
+		LLCurl::Multi* mMulti;
+		LLCurlThread*  mCurlThread;
+	};
+	friend class CurlRequest;
+
+public:
+	LLCurlThread(bool threaded = true) ;
+	virtual ~LLCurlThread() ;
+
+	S32 update(F32 max_time_ms);
+
+	void addMulti(LLCurl::Multi* multi) ;
+	void killMulti(LLCurl::Multi* multi) ;
+
+private:
+	bool doMultiPerform(LLCurl::Multi* multi) ;
+	void deleteMulti(LLCurl::Multi* multi) ;
+	void cleanupMulti(LLCurl::Multi* multi) ;
+} ;
+
 namespace boost
 {
 	void intrusive_ptr_add_ref(LLCurl::Responder* p);
@@ -339,7 +411,6 @@ class LLCurlRequest
 	LLCurl::Multi* mActiveMulti;
 	S32 mActiveRequestCount;
 	BOOL mProcessing;
-	U32 mThreadID; // debug
 };
 
 class LLCurlEasyRequest
@@ -357,9 +428,11 @@ class LLCurlEasyRequest
 	void slist_append(const char* str);
 	void sendRequest(const std::string& url);
 	void requestComplete();
-	void perform();
 	bool getResult(CURLcode* result, LLCurl::TransferInfo* info = NULL);
 	std::string getErrorString();
+	bool isCompleted() {return mMulti->isCompleted() ;}
+	bool wait() { return mMulti->waitToComplete(); }
+	bool isValid() {return mMulti && mMulti->isValid(); }
 
 	LLCurl::Easy* getEasy() const { return mEasy; }
 
diff --git a/indra/llmessage/llhttpassetstorage.cpp b/indra/llmessage/llhttpassetstorage.cpp
index 2bca517e97ac9d4870703a8a2ec9772882f64eae..612d765969efb92fa21695cac11faadc3e28bde3 100644
--- a/indra/llmessage/llhttpassetstorage.cpp
+++ b/indra/llmessage/llhttpassetstorage.cpp
@@ -232,7 +232,8 @@ LLSD LLHTTPAssetRequest::getFullDetails() const
 void LLHTTPAssetRequest::setupCurlHandle()
 {
 	// *NOTE: Similar code exists in mapserver/llcurlutil.cpp  JC
-	mCurlHandle = curl_easy_init();
+	mCurlHandle = LLCurl::newEasyHandle();
+	llassert_always(mCurlHandle != NULL) ;
 
 	// Apply proxy settings if configured to do so
 	LLProxy::getInstance()->applyProxySettings(mCurlHandle);
@@ -278,7 +279,7 @@ void LLHTTPAssetRequest::setupCurlHandle()
 
 void LLHTTPAssetRequest::cleanupCurlHandle()
 {
-	curl_easy_cleanup(mCurlHandle);
+	LLCurl::deleteEasyHandle(mCurlHandle);
 	if (mAssetStoragep)
 	{
 		// Terminating a request.  Thus upload or download is no longer pending.
@@ -429,12 +430,13 @@ void LLHTTPAssetStorage::_init(const std::string& web_host, const std::string& l
 
 	// curl_global_init moved to LLCurl::initClass()
 	
-	mCurlMultiHandle = curl_multi_init();
+	mCurlMultiHandle = LLCurl::newMultiHandle() ;
+	llassert_always(mCurlMultiHandle != NULL) ;
 }
 
 LLHTTPAssetStorage::~LLHTTPAssetStorage()
 {
-	curl_multi_cleanup(mCurlMultiHandle);
+	LLCurl::deleteMultiHandle(mCurlMultiHandle);
 	mCurlMultiHandle = NULL;
 	
 	// curl_global_cleanup moved to LLCurl::initClass()
diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp
index dd4e3a63007d56753fc8dd7b52df8a902a84951d..0c325a68aaed740a04a71019a4163b86b64ad999 100644
--- a/indra/llmessage/llhttpclient.cpp
+++ b/indra/llmessage/llhttpclient.cpp
@@ -158,7 +158,7 @@ namespace
 			if(fstream.is_open())
 			{
 				fstream.seekg(0, std::ios::end);
-				U32 fileSize = fstream.tellg();
+				U32 fileSize = (U32)fstream.tellg();
 				fstream.seekg(0, std::ios::beg);
 				std::vector<char> fileBuffer(fileSize);
 				fstream.read(&fileBuffer[0], fileSize);
@@ -228,6 +228,12 @@ static void request(
 	LLPumpIO::chain_t chain;
 
 	LLURLRequest* req = new LLURLRequest(method, url);
+	if(!req->isValid())//failed
+	{
+		delete req ;
+		return ;
+	}
+
 	req->setSSLVerifyCallback(LLHTTPClient::getCertVerifyCallback(), (void *)req);
 
 	
@@ -423,7 +429,9 @@ static LLSD blocking_request(
 {
 	lldebugs << "blockingRequest of " << url << llendl;
 	char curl_error_buffer[CURL_ERROR_SIZE] = "\0";
-	CURL* curlp = curl_easy_init();
+	CURL* curlp = LLCurl::newEasyHandle();
+	llassert_always(curlp != NULL) ;
+
 	LLHTTPBuffer http_buffer;
 	std::string body_str;
 	
@@ -517,7 +525,7 @@ static LLSD blocking_request(
 	}
 
 	// * Cleanup
-	curl_easy_cleanup(curlp);
+	LLCurl::deleteEasyHandle(curlp);
 	return response;
 }
 
diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp
index 73e8a690851800ca5bf7a69314e15ee446bc316e..987f386aa38545959ad082c84990ad00291a5501 100644
--- a/indra/llmessage/lliohttpserver.cpp
+++ b/indra/llmessage/lliohttpserver.cpp
@@ -818,6 +818,8 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
 
   			// Copy everything after mLast read to the out.
 			LLBufferArray::segment_iterator_t seg_iter;
+
+			buffer->lock();
 			seg_iter = buffer->splitAfter(mLastRead);
 			if(seg_iter != buffer->endSegment())
 			{
@@ -838,7 +840,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
 				}
 #endif
 			}
-
+			buffer->unlock();
 			//
 			// *FIX: get rid of extra bytes off the end
 			//
diff --git a/indra/llmessage/lliopipe.cpp b/indra/llmessage/lliopipe.cpp
index 6e4eec74a65a1579dcca38b836084b71eb2ba822..8f827f7a30756d61329902a7cc496e673b00aef3 100644
--- a/indra/llmessage/lliopipe.cpp
+++ b/indra/llmessage/lliopipe.cpp
@@ -75,6 +75,12 @@ LLIOPipe::~LLIOPipe()
 	//lldebugs << "destroying LLIOPipe" << llendl;
 }
 
+//virtual 
+bool LLIOPipe::isValid() 
+{
+	return true ;
+}
+
 // static
 std::string LLIOPipe::lookupStatusString(EStatus status)
 {
diff --git a/indra/llmessage/lliopipe.h b/indra/llmessage/lliopipe.h
index 8e656b6da1c49331e5476497b4d745cfbc62ada1..cbd17b5a3d9ba02be6430d051eecaaba6f8f571d 100644
--- a/indra/llmessage/lliopipe.h
+++ b/indra/llmessage/lliopipe.h
@@ -231,6 +231,8 @@ class LLIOPipe
 	 */
 	virtual ~LLIOPipe();
 
+	virtual bool isValid() ;
+
 protected:
 	/**
 	 * @brief Base Constructor.
diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp
index 54ceab3422c472953715a667a6319babc3c849fd..d5b4d4582107700ee7ab7cbe67933f47d35b30cf 100644
--- a/indra/llmessage/lliosocket.cpp
+++ b/indra/llmessage/lliosocket.cpp
@@ -445,6 +445,7 @@ LLIOPipe::EStatus LLIOSocketWriter::process_impl(
 	// efficient - not only because writev() is better, but also
 	// because we won't have to do as much work to find the start
 	// address.
+	buffer->lock();
 	LLBufferArray::segment_iterator_t it;
 	LLBufferArray::segment_iterator_t end = buffer->endSegment();
 	LLSegment segment;
@@ -524,6 +525,8 @@ LLIOPipe::EStatus LLIOSocketWriter::process_impl(
 		}
 
 	}
+	buffer->unlock();
+
 	PUMP_DEBUG;
 	if(done && eos)
 	{
diff --git a/indra/llmessage/llmime.cpp b/indra/llmessage/llmime.cpp
index 943a734927b933268917d38ed6ad8e2b49a65ffa..9d9c4ebd6899f8eb0c4292ae5b9d8bb3ad94f649 100644
--- a/indra/llmessage/llmime.cpp
+++ b/indra/llmessage/llmime.cpp
@@ -388,7 +388,7 @@ bool LLMimeParser::Impl::parseHeaders(
 		// not to read past limit when we get() the newline.
 		S32 max_get = llmin((S32)LINE_BUFFER_LENGTH, limit - mScanCount - 1);
 		istr.getline(mBuffer, max_get, '\r');
-		mScanCount += istr.gcount();
+		mScanCount += (S32)istr.gcount();
 		int c = istr.get();
 		if(EOF == c)
 		{
@@ -496,7 +496,7 @@ void LLMimeParser::Impl::scanPastSeparator(
 		// past limit when we get() the newline.
 		S32 max_get = llmin((S32)LINE_BUFFER_LENGTH, limit - mScanCount - 1);
 		istr.getline(mBuffer, max_get, '\r');
-		mScanCount += istr.gcount();
+		mScanCount += (S32)istr.gcount();
 		if(istr.gcount() >= LINE_BUFFER_LENGTH - 1)
 		{
 			// that's way too long to be a separator, so ignore it.
diff --git a/indra/llmessage/llpumpio.cpp b/indra/llmessage/llpumpio.cpp
index a8d2a0a22409e03b021626f57e34d8f4223d2dc6..f3ef4f26844f394c6964e02a3f3228d36f78c47c 100644
--- a/indra/llmessage/llpumpio.cpp
+++ b/indra/llmessage/llpumpio.cpp
@@ -195,7 +195,7 @@ bool LLPumpIO::prime(apr_pool_t* pool)
 	return ((pool == NULL) ? false : true);
 }
 
-bool LLPumpIO::addChain(const chain_t& chain, F32 timeout)
+bool LLPumpIO::addChain(const chain_t& chain, F32 timeout, bool has_curl_request)
 {
 	LLMemType m1(LLMemType::MTYPE_IO_PUMP);
 	if(chain.empty()) return false;
@@ -204,8 +204,10 @@ bool LLPumpIO::addChain(const chain_t& chain, F32 timeout)
 	LLScopedLock lock(mChainsMutex);
 #endif
 	LLChainInfo info;
+	info.mHasCurlRequest = has_curl_request;
 	info.setTimeoutSeconds(timeout);
 	info.mData = LLIOPipe::buffer_ptr_t(new LLBufferArray);
+	info.mData->setThreaded(has_curl_request);
 	LLLinkInfo link;
 #if LL_DEBUG_PIPE_TYPE_IN_PUMP
 	lldebugs << "LLPumpIO::addChain() " << chain[0] << " '"
@@ -440,6 +442,15 @@ void LLPumpIO::pump()
 
 static LLFastTimer::DeclareTimer FTM_PUMP_IO("Pump IO");
 
+LLPumpIO::current_chain_t LLPumpIO::removeRunningChain(LLPumpIO::current_chain_t& run_chain) 
+{
+	std::for_each(
+				(*run_chain).mDescriptors.begin(),
+				(*run_chain).mDescriptors.end(),
+				ll_delete_apr_pollset_fd_client_data());
+	return mRunningChains.erase(run_chain);
+}
+
 //timeout is in microseconds
 void LLPumpIO::pump(const S32& poll_timeout)
 {
@@ -585,10 +596,16 @@ void LLPumpIO::pump(const S32& poll_timeout)
 //						<< (*run_chain).mChainLinks[0].mPipe
 //						<< " because we reached the end." << llendl;
 #endif
-				run_chain = mRunningChains.erase(run_chain);
+				run_chain = removeRunningChain(run_chain);
 				continue;
 			}
 		}
+		else if(isChainExpired(*run_chain))
+		{
+			run_chain = removeRunningChain(run_chain);
+			continue;
+		}
+
 		PUMP_DEBUG;
 		if((*run_chain).mLock)
 		{
@@ -696,11 +713,7 @@ void LLPumpIO::pump(const S32& poll_timeout)
 			PUMP_DEBUG;
 			// This chain is done. Clean up any allocated memory and
 			// erase the chain info.
-			std::for_each(
-				(*run_chain).mDescriptors.begin(),
-				(*run_chain).mDescriptors.end(),
-				ll_delete_apr_pollset_fd_client_data());
-			run_chain = mRunningChains.erase(run_chain);
+			run_chain = removeRunningChain(run_chain);
 
 			// *NOTE: may not always need to rebuild the pollset.
 			mRebuildPollset = true;
@@ -1095,6 +1108,24 @@ void LLPumpIO::processChain(LLChainInfo& chain)
 	PUMP_DEBUG;
 }
 
+bool LLPumpIO::isChainExpired(LLChainInfo& chain)
+{
+	if(!chain.mHasCurlRequest)
+	{
+		return false ;
+	}
+
+	for(links_t::iterator iter = chain.mChainLinks.begin(); iter != chain.mChainLinks.end(); ++iter)
+	{
+		if(!(*iter).mPipe->isValid())
+		{
+			return true ;
+		}
+	}
+
+	return false ;
+}
+
 bool LLPumpIO::handleChainError(
 	LLChainInfo& chain,
 	LLIOPipe::EStatus error)
@@ -1136,6 +1167,9 @@ bool LLPumpIO::handleChainError(
 #endif
 			keep_going = false;
 			break;
+		case LLIOPipe::STATUS_EXPIRED:
+			keep_going = false;
+			break ;
 		default:
 			if(LLIOPipe::isSuccess(error))
 			{
@@ -1157,7 +1191,8 @@ bool LLPumpIO::handleChainError(
 LLPumpIO::LLChainInfo::LLChainInfo() :
 	mInit(false),
 	mLock(0),
-	mEOS(false)
+	mEOS(false),
+	mHasCurlRequest(false)
 {
 	LLMemType m1(LLMemType::MTYPE_IO_PUMP);
 	mTimer.setTimerExpirySec(DEFAULT_CHAIN_EXPIRY_SECS);
diff --git a/indra/llmessage/llpumpio.h b/indra/llmessage/llpumpio.h
index 9303c9d7fcf994e728f49507e292a49e797b8128..d2c5d3757136e57caaba21b02a01d812090c3e0f 100644
--- a/indra/llmessage/llpumpio.h
+++ b/indra/llmessage/llpumpio.h
@@ -111,9 +111,10 @@ class LLPumpIO
 	 * @param chain The pipes for the chain
 	 * @param timeout The number of seconds in the future to
 	 * expire. Pass in 0.0f to never expire.
+	 * @param has_curl_request The chain contains LLURLRequest if true.
 	 * @return Returns true if anything was added to the pump.
 	 */
-	bool addChain(const chain_t& chain, F32 timeout);
+	bool addChain(const chain_t& chain, F32 timeout, bool has_curl_request = false);
 	
 	/** 
 	 * @brief Struct to associate a pipe with it's buffer io indexes.
@@ -356,12 +357,13 @@ class LLPumpIO
 
 		// basic member data
 		bool mInit;
+		bool mEOS;
+		bool mHasCurlRequest;
 		S32 mLock;
 		LLFrameTimer mTimer;
 		links_t::iterator mHead;
 		links_t mChainLinks;
-		LLIOPipe::buffer_ptr_t mData;
-		bool mEOS;
+		LLIOPipe::buffer_ptr_t mData;		
 		LLSD mContext;
 
 		// tracking inside the pump
@@ -402,7 +404,7 @@ class LLPumpIO
 protected:
 	void initialize(apr_pool_t* pool);
 	void cleanup();
-
+	current_chain_t removeRunningChain(current_chain_t& chain) ;
 	/** 
 	 * @brief Given the internal state of the chains, rebuild the pollset
 	 * @see setConditional()
@@ -429,6 +431,9 @@ class LLPumpIO
 	 */
 	bool handleChainError(LLChainInfo& chain, LLIOPipe::EStatus error);
 
+	//if the chain is expired, remove it
+	bool isChainExpired(LLChainInfo& chain) ;
+
 public:
 	/** 
 	 * @brief Return number of running chains.
diff --git a/indra/llmessage/llsdmessage.cpp b/indra/llmessage/llsdmessage.cpp
index 9148c9dd150fd5d27bd37b2914f91b57e06ece1d..1c93c12d990a35ca97e9ae2d4b97db73f0c0ba4d 100644
--- a/indra/llmessage/llsdmessage.cpp
+++ b/indra/llmessage/llsdmessage.cpp
@@ -88,7 +88,7 @@ bool LLSDMessage::httpListener(const LLSD& request)
                                                        request,
                                                        url, "POST", reply, error),
                        LLSD(),      // headers
-                       timeout);
+                       (F32)timeout);
     return false;
 }
 
diff --git a/indra/llmessage/llsdmessagebuilder.cpp b/indra/llmessage/llsdmessagebuilder.cpp
index 2698a271ee972e4c58266b892f840e3e7bebd4b0..615221e0ad086c54288c030fc24144f8836ebca5 100644
--- a/indra/llmessage/llsdmessagebuilder.cpp
+++ b/indra/llmessage/llsdmessagebuilder.cpp
@@ -317,7 +317,7 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data)
 
 			// S64 not supported in LLSD so we just truncate it
 			case MVT_S64:
-				addS32(varname, *(S64*)mvci.getData());
+				addS32(varname, (S32)*(S64*)mvci.getData());
 				break;
 
 			case MVT_F32:
diff --git a/indra/llmessage/llsdmessagereader.cpp b/indra/llmessage/llsdmessagereader.cpp
index 304a692cdfeaea700fe2a9cbf855c3c31ca1d2d8..3d8ca2ad9f19c3a58a7271598c32f8612ad8419a 100644
--- a/indra/llmessage/llsdmessagereader.cpp
+++ b/indra/llmessage/llsdmessagereader.cpp
@@ -291,9 +291,10 @@ S32 getElementSize(const LLSD& llsd)
 	case LLSD::TypeMap:
 	case LLSD::TypeArray:
 	case LLSD::TypeUndefined:
+	default:                        // TypeLLSDTypeEnd, TypeLLSDNumTypes, etc.
 		return 0;
 	}
-	return 0;
+	//return 0;
 }
 
 //virtual 
diff --git a/indra/llmessage/llsdrpcclient.h b/indra/llmessage/llsdrpcclient.h
index 9fb49a5c3301f7af16731147c18826699104bd0c..0cecf4f68891cde2273abb9ddb5d22f440182cfe 100644
--- a/indra/llmessage/llsdrpcclient.h
+++ b/indra/llmessage/llsdrpcclient.h
@@ -240,9 +240,16 @@ class LLSDRPCClientFactory : public LLChainIOFactory
 	virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const
 	{
 		lldebugs << "LLSDRPCClientFactory::build" << llendl;
-		LLIOPipe::ptr_t service(new Client);
-		chain.push_back(service);
 		LLURLRequest* http(new LLURLRequest(LLURLRequest::HTTP_POST));
+		if(!http->isValid())
+		{
+			llwarns << "Creating LLURLRequest failed." << llendl ;
+			delete http;
+			return false;
+		}
+
+		LLIOPipe::ptr_t service(new Client);
+		chain.push_back(service);		
 		LLIOPipe::ptr_t http_pipe(http);
 		http->addHeader("Content-Type: text/llsd");
 		if(mURL.empty())
@@ -283,9 +290,16 @@ class LLXMLSDRPCClientFactory : public LLChainIOFactory
 	virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const
 	{
 		lldebugs << "LLXMLSDRPCClientFactory::build" << llendl;
-		LLIOPipe::ptr_t service(new Client);
-		chain.push_back(service);
+
 		LLURLRequest* http(new LLURLRequest(LLURLRequest::HTTP_POST));
+		if(!http->isValid())
+		{
+			llwarns << "Creating LLURLRequest failed." << llendl ;
+			delete http;
+			return false ;
+		}
+		LLIOPipe::ptr_t service(new Client);
+		chain.push_back(service);		
 		LLIOPipe::ptr_t http_pipe(http);
 		http->addHeader("Content-Type: text/xml");
 		if(mURL.empty())
diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp
index fa03bb7512f068d43683f9f2fe5bd0d784da9f2f..a16f5c7bf0ea27a314d959c4e3b75d02636e592f 100644
--- a/indra/llmessage/llurlrequest.cpp
+++ b/indra/llmessage/llurlrequest.cpp
@@ -64,7 +64,7 @@ class LLURLRequestDetail
 	~LLURLRequestDetail();
 	std::string mURL;
 	LLCurlEasyRequest* mCurlRequest;
-	LLBufferArray* mResponseBuffer;
+	LLIOPipe::buffer_ptr_t mResponseBuffer;
 	LLChannelDescriptors mChannels;
 	U8* mLastRead;
 	U32 mBodyLimit;
@@ -75,7 +75,6 @@ class LLURLRequestDetail
 
 LLURLRequestDetail::LLURLRequestDetail() :
 	mCurlRequest(NULL),
-	mResponseBuffer(NULL),
 	mLastRead(NULL),
 	mBodyLimit(0),
 	mByteAccumulator(0),
@@ -84,13 +83,18 @@ LLURLRequestDetail::LLURLRequestDetail() :
 {
 	LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
 	mCurlRequest = new LLCurlEasyRequest();
+	
+	if(!mCurlRequest->isValid()) //failed.
+	{
+		delete mCurlRequest ;
+		mCurlRequest = NULL ;
+	}
 }
 
 LLURLRequestDetail::~LLURLRequestDetail()
 {
 	LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
 	delete mCurlRequest;
-	mResponseBuffer = NULL;
 	mLastRead = NULL;
 }
 
@@ -170,6 +174,7 @@ LLURLRequest::~LLURLRequest()
 {
 	LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
 	delete mDetail;
+	mDetail = NULL ;
 }
 
 void LLURLRequest::setURL(const std::string& url)
@@ -251,12 +256,24 @@ void LLURLRequest::allowCookies()
 	mDetail->mCurlRequest->setoptString(CURLOPT_COOKIEFILE, "");
 }
 
+//virtual 
+bool LLURLRequest::isValid() 
+{
+	return mDetail->mCurlRequest && mDetail->mCurlRequest->isValid(); 
+}
+
 // virtual
 LLIOPipe::EStatus LLURLRequest::handleError(
 	LLIOPipe::EStatus status,
 	LLPumpIO* pump)
 {
 	LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
+	
+	if(!isValid())
+	{
+		return STATUS_EXPIRED ;
+	}
+
 	if(mCompletionCallback && pump)
 	{
 		LLURLRequestComplete* complete = NULL;
@@ -325,7 +342,7 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
 
 		// *FIX: bit of a hack, but it should work. The configure and
 		// callback method expect this information to be ready.
-		mDetail->mResponseBuffer = buffer.get();
+		mDetail->mResponseBuffer = buffer;
 		mDetail->mChannels = channels;
 		if(!configure())
 		{
@@ -344,7 +361,10 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
 		static LLFastTimer::DeclareTimer FTM_URL_PERFORM("Perform");
 		{
 			LLFastTimer t(FTM_URL_PERFORM);
-			mDetail->mCurlRequest->perform();
+			if(!mDetail->mCurlRequest->wait())
+			{
+				return status ;
+			}
 		}
 
 		while(1)
@@ -439,6 +459,12 @@ void LLURLRequest::initialize()
 	LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
 	mState = STATE_INITIALIZED;
 	mDetail = new LLURLRequestDetail;
+
+	if(!isValid())
+	{
+		return ;
+	}
+
 	mDetail->mCurlRequest->setopt(CURLOPT_NOSIGNAL, 1);
 	mDetail->mCurlRequest->setWriteCallback(&downCallback, (void*)this);
 	mDetail->mCurlRequest->setReadCallback(&upCallback, (void*)this);
diff --git a/indra/llmessage/llurlrequest.h b/indra/llmessage/llurlrequest.h
index ec5c2c1941493aa38331063e37a5bf4f0cdc9496..44d358d906f44485af8a193cdc2b092e305c429e 100644
--- a/indra/llmessage/llurlrequest.h
+++ b/indra/llmessage/llurlrequest.h
@@ -188,6 +188,8 @@ class LLURLRequest : public LLIOPipe
 	 */
 	void allowCookies();
 
+	/*virtual*/ bool isValid() ;
+
 public:
 	/** 
 	 * @brief Give this pipe a chance to handle a generated error
diff --git a/indra/llmessage/llxfer.h b/indra/llmessage/llxfer.h
index 989e8b2cab1bb8be75b41ba8a6b3c505997159a7..f9348eb11f100cd9e11ade66cdb27625dd8858b0 100644
--- a/indra/llmessage/llxfer.h
+++ b/indra/llmessage/llxfer.h
@@ -29,6 +29,7 @@
 
 #include "message.h"
 #include "lltimer.h"
+#include "llextendedstatus.h"
 
 const S32 LL_XFER_LARGE_PAYLOAD = 7680;
 
diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp
index d0b0e178b83625400f790737d0f45eb1d5aba00a..6a425cfe98a1c7d8a4545365393f526d4237aea4 100644
--- a/indra/llmessage/message.cpp
+++ b/indra/llmessage/message.cpp
@@ -3147,7 +3147,7 @@ bool LLMessageSystem::generateDigestForWindowAndUUIDs(char* digest, const S32 wi
 		LL_ERRS("Messaging") << "Trying to generate complex digest on a machine without a shared secret!" << llendl;
 	}
 
-	U32 now = time(NULL);
+	U32 now = (U32)time(NULL);
 
 	now /= window;
 
@@ -3167,7 +3167,7 @@ bool LLMessageSystem::isMatchingDigestForWindowAndUUIDs(const char* digest, cons
 	}
 	
 	char our_digest[MD5HEX_STR_SIZE];	/* Flawfinder: ignore */
-	U32 now = time(NULL);
+	U32 now = (U32)time(NULL);
 
 	now /= window;
 
@@ -3213,7 +3213,7 @@ bool LLMessageSystem::generateDigestForWindow(char* digest, const S32 window) co
 		LL_ERRS("Messaging") << "Trying to generate simple digest on a machine without a shared secret!" << llendl;
 	}
 
-	U32 now = time(NULL);
+	U32 now = (U32)time(NULL);
 
 	now /= window;
 
diff --git a/indra/llmessage/tests/testrunner.py b/indra/llmessage/tests/testrunner.py
index f2c841532a95e9a021aeb7c1173af03ad898b0c1..5b9beb359b8ec729f6ecb8310d0a7d7da112b578 100644
--- a/indra/llmessage/tests/testrunner.py
+++ b/indra/llmessage/tests/testrunner.py
@@ -35,7 +35,7 @@
 import errno
 import socket
 
-VERBOSE = os.environ.get("INTEGRATION_TEST_VERBOSE", "1") # default to verbose
+VERBOSE = os.environ.get("INTEGRATION_TEST_VERBOSE", "0") # default to quiet
 # Support usage such as INTEGRATION_TEST_VERBOSE=off -- distressing to user if
 # that construct actually turns on verbosity...
 VERBOSE = not re.match(r"(0|off|false|quiet)$", VERBOSE, re.IGNORECASE)
diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h
index d95fa400919d7ee592ce657363af575a6d815435..5fe8254331a3fdb143a8d3e26e88a623aaf217af 100644
--- a/indra/llplugin/llpluginclassmedia.h
+++ b/indra/llplugin/llpluginclassmedia.h
@@ -41,7 +41,7 @@ class LLPluginClassMedia : public LLPluginProcessParentOwner
 	LOG_CLASS(LLPluginClassMedia);
 public:
 	LLPluginClassMedia(LLPluginClassMediaOwner *owner);
-	~LLPluginClassMedia();
+	virtual ~LLPluginClassMedia();
 
 	// local initialization, called by the media manager when creating a source
 	bool init(const std::string &launcher_filename, 
@@ -270,7 +270,7 @@ class LLPluginClassMedia : public LLPluginProcessParentOwner
 	std::string	getHoverText() const { return mHoverText; };
 	std::string	getHoverLink() const { return mHoverLink; };
 	
-	std::string getMediaName() const { return mMediaName; };
+	const std::string& getMediaName() const { return mMediaName; };
 	std::string getMediaDescription() const { return mMediaDescription; };
 
 	// Crash the plugin.  If you use this outside of a testbed, you will be punished.
diff --git a/indra/llplugin/llplugininstance.h b/indra/llplugin/llplugininstance.h
index 3643a15d8c27cb1da54ea87cde7f538efa731487..e6926c3e3779157e38f8f2ac457621db8fc1a30f 100644
--- a/indra/llplugin/llplugininstance.h
+++ b/indra/llplugin/llplugininstance.h
@@ -39,7 +39,7 @@
 class LLPluginInstanceMessageListener
 {
 public:
-	~LLPluginInstanceMessageListener();
+	virtual ~LLPluginInstanceMessageListener();
    /** Plugin receives message from plugin loader shell. */
 	virtual void receivePluginMessage(const std::string &message) = 0;
 };
diff --git a/indra/llplugin/llpluginmessagepipe.cpp b/indra/llplugin/llpluginmessagepipe.cpp
index 8d13e38ad5c501c69749f5158219534485185a07..091e93ea4be474abbb8e0962f41754bc7f1f94c8 100644
--- a/indra/llplugin/llpluginmessagepipe.cpp
+++ b/indra/llplugin/llpluginmessagepipe.cpp
@@ -94,10 +94,10 @@ void LLPluginMessagePipeOwner::killMessagePipe(void)
 LLPluginMessagePipe::LLPluginMessagePipe(LLPluginMessagePipeOwner *owner, LLSocket::ptr_t socket):
 	mInputMutex(gAPRPoolp),
 	mOutputMutex(gAPRPoolp),
+	mOutputStartIndex(0),
 	mOwner(owner),
 	mSocket(socket)
 {
-	
 	mOwner->setMessagePipe(this);
 }
 
@@ -113,6 +113,14 @@ bool LLPluginMessagePipe::addMessage(const std::string &message)
 {
 	// queue the message for later output
 	LLMutexLock lock(&mOutputMutex);
+
+	// If we're starting to use up too much memory, clear
+	if (mOutputStartIndex > 1024 * 1024)
+	{
+		mOutput = mOutput.substr(mOutputStartIndex);
+		mOutputStartIndex = 0;
+	}
+		
 	mOutput += message;
 	mOutput += MESSAGE_DELIMITER;	// message separator
 	
@@ -165,35 +173,44 @@ bool LLPluginMessagePipe::pumpOutput()
 	if(mSocket)
 	{
 		apr_status_t status;
-		apr_size_t size;
+		apr_size_t in_size, out_size;
 		
 		LLMutexLock lock(&mOutputMutex);
-		if(!mOutput.empty())
+
+		const char * output_data = &(mOutput.data()[mOutputStartIndex]);
+		if(*output_data != '\0')
 		{
 			// write any outgoing messages
-			size = (apr_size_t)mOutput.size();
+			in_size = (apr_size_t) (mOutput.size() - mOutputStartIndex);
+			out_size = in_size;
 			
 			setSocketTimeout(0);
 			
 //			LL_INFOS("Plugin") << "before apr_socket_send, size = " << size << LL_ENDL;
 
-			status = apr_socket_send(
-					mSocket->getSocket(),
-					(const char*)mOutput.data(),
-					&size);
+			status = apr_socket_send(mSocket->getSocket(),
+									 output_data,
+									 &out_size);
 
 //			LL_INFOS("Plugin") << "after apr_socket_send, size = " << size << LL_ENDL;
 			
-			if(status == APR_SUCCESS)
+			if((status == APR_SUCCESS) || APR_STATUS_IS_EAGAIN(status))
 			{
-				// success
-				mOutput = mOutput.substr(size);
-			}
-			else if(APR_STATUS_IS_EAGAIN(status))
-			{
-				// Socket buffer is full... 
-				// remove the written part from the buffer and try again later.
-				mOutput = mOutput.substr(size);
+				// Success or Socket buffer is full... 
+				
+				// If we've pumped the entire string, clear it
+				if (out_size == in_size)
+				{
+					mOutputStartIndex = 0;
+					mOutput.clear();
+				}
+				else
+				{
+					llassert(in_size > out_size);
+					
+					// Remove the written part from the buffer and try again later.
+					mOutputStartIndex += out_size;
+				}
 			}
 			else if(APR_STATUS_IS_EOF(status))
 			{
diff --git a/indra/llplugin/llpluginmessagepipe.h b/indra/llplugin/llpluginmessagepipe.h
index beb942c0fe0f218aba4191ebfea392ded64eb678..c3498beac04849e37c7ebabd43c9192df1d5ea9f 100644
--- a/indra/llplugin/llpluginmessagepipe.h
+++ b/indra/llplugin/llpluginmessagepipe.h
@@ -40,7 +40,7 @@ class LLPluginMessagePipeOwner
 	LOG_CLASS(LLPluginMessagePipeOwner);
 public:
 	LLPluginMessagePipeOwner();
-	~LLPluginMessagePipeOwner();
+	virtual ~LLPluginMessagePipeOwner();
 
 	// called with incoming messages
 	virtual void receiveMessageRaw(const std::string &message) = 0;
@@ -86,6 +86,7 @@ class LLPluginMessagePipe
 	std::string mInput;
 	LLMutex mOutputMutex;
 	std::string mOutput;
+	std::string::size_type mOutputStartIndex;
 
 	LLPluginMessagePipeOwner *mOwner;
 	LLSocket::ptr_t mSocket;
diff --git a/indra/llplugin/llpluginprocessparent.h b/indra/llplugin/llpluginprocessparent.h
index 26c6b0c4027e5438464749561b562a5a91c341af..c66723f1753c7a7046e21b57a3a8c2789f7ccaa1 100644
--- a/indra/llplugin/llpluginprocessparent.h
+++ b/indra/llplugin/llpluginprocessparent.h
@@ -41,7 +41,7 @@
 class LLPluginProcessParentOwner
 {
 public:
-	~LLPluginProcessParentOwner();
+	virtual ~LLPluginProcessParentOwner();
 	virtual void receivePluginMessage(const LLPluginMessage &message) = 0;
 	virtual bool receivePluginMessageEarly(const LLPluginMessage &message) {return false;};
 	// This will only be called when the plugin has died unexpectedly 
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index 6e4bb7ec97322b8fe2b818cc85c9bad4c73aaa5a..cb32a510b80b62585cd3cb1863b83e178a4270e8 100644
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -31,11 +31,18 @@
 #include "llconvexdecomposition.h"
 #include "llsdserialize.h"
 #include "llvector4a.h"
-
+#if LL_MSVC
+#pragma warning (disable : 4263)
+#pragma warning (disable : 4264)
+#endif
 #include "dae.h"
 #include "dae/daeErrorHandler.h"
 #include "dom/domConstants.h"
 #include "dom/domMesh.h"
+#if LL_MSVC
+#pragma warning (default : 4263)
+#pragma warning (default : 4264)
+#endif
 
 #ifdef LL_STANDALONE
 # include <zlib.h>
diff --git a/indra/llprimitive/lltextureanim.cpp b/indra/llprimitive/lltextureanim.cpp
index 398af4e6e8ae717b19a2711ef9640515e9eeb331..185a3f69c02584c8f3c59c5dd14c25097ffb7f9c 100644
--- a/indra/llprimitive/lltextureanim.cpp
+++ b/indra/llprimitive/lltextureanim.cpp
@@ -168,8 +168,8 @@ void LLTextureAnim::unpackTAMessage(LLDataPacker &dp)
 
 	mMode = data[0];
 	mFace = data[1];
-	mSizeX = llmax((U8)1, data[2]);
-	mSizeY = llmax((U8)1, data[3]);
+	mSizeX = data[2];
+	mSizeY = data[3];
 	htonmemcpy(&mStart, data + 4, MVT_F32, sizeof(F32));
 	htonmemcpy(&mLength, data + 8, MVT_F32, sizeof(F32));
 	htonmemcpy(&mRate, data + 12, MVT_F32, sizeof(F32));
diff --git a/indra/llprimitive/llvolumexml.cpp b/indra/llprimitive/llvolumexml.cpp
index f4f9d4d713fbd313c41a7bd4fea86a28b0974e66..bf2297a0299075c7fe6bd09dab4c3c4af5b0e255 100644
--- a/indra/llprimitive/llvolumexml.cpp
+++ b/indra/llprimitive/llvolumexml.cpp
@@ -34,9 +34,9 @@
 
 //============================================================================
 
-LLXMLNode *LLVolumeXml::exportProfileParams(const LLProfileParams* params)
+LLPointer<LLXMLNode> LLVolumeXml::exportProfileParams(const LLProfileParams* params)
 {
-	LLXMLNode *ret = new LLXMLNode("profile", FALSE);
+	LLPointer<LLXMLNode> ret = new LLXMLNode("profile", FALSE);
 
 	ret->createChild("curve_type", TRUE)->setByteValue(1, &params->getCurveType());
 	ret->createChild("interval", FALSE)->setFloatValue(2, &params->getBegin());
@@ -46,9 +46,9 @@ LLXMLNode *LLVolumeXml::exportProfileParams(const LLProfileParams* params)
 }
 
 
-LLXMLNode *LLVolumeXml::exportPathParams(const LLPathParams* params)
+LLPointer<LLXMLNode> LLVolumeXml::exportPathParams(const LLPathParams* params)
 {
-	LLXMLNode *ret = new LLXMLNode("path", FALSE); 
+	LLPointer<LLXMLNode> ret = new LLXMLNode("path", FALSE); 
 	ret->createChild("curve_type", TRUE)->setByteValue(1, &params->getCurveType());
 	ret->createChild("interval", FALSE)->setFloatValue(2, &params->getBegin());
 	ret->createChild("scale", FALSE)->setFloatValue(2, params->getScale().mV);
@@ -63,12 +63,15 @@ LLXMLNode *LLVolumeXml::exportPathParams(const LLPathParams* params)
 }
 
 
-LLXMLNode *LLVolumeXml::exportVolumeParams(const LLVolumeParams* params)
+LLPointer<LLXMLNode> LLVolumeXml::exportVolumeParams(const LLVolumeParams* params)
 {
-	LLXMLNode *ret = new LLXMLNode("shape", FALSE);
+	LLPointer<LLXMLNode> ret = new LLXMLNode("shape", FALSE);
 	
-	exportPathParams(&params->getPathParams())->setParent(ret);
-	exportProfileParams(&params->getProfileParams())->setParent(ret);
+	LLPointer<LLXMLNode> node ;
+	node = exportPathParams(&params->getPathParams()) ;
+	node->setParent(ret);
+	node = exportProfileParams(&params->getProfileParams()) ;
+	node->setParent(ret);
 
 	return ret;
 }
diff --git a/indra/llprimitive/llvolumexml.h b/indra/llprimitive/llvolumexml.h
index 5e79205d9a6fd886089efc2f85cc308cf3d75466..9d4d989475da6fa48c034f7b178bc3266d7383d4 100644
--- a/indra/llprimitive/llvolumexml.h
+++ b/indra/llprimitive/llvolumexml.h
@@ -34,11 +34,11 @@
 class LLVolumeXml
 {
 public:
-	static LLXMLNode* exportProfileParams(const LLProfileParams* params);
+	static LLPointer<LLXMLNode> exportProfileParams(const LLProfileParams* params);
 
-	static LLXMLNode* exportPathParams(const LLPathParams* params);
+	static LLPointer<LLXMLNode> exportPathParams(const LLPathParams* params);
 
-	static LLXMLNode* exportVolumeParams(const LLVolumeParams* params);
+	static LLPointer<LLXMLNode> exportVolumeParams(const LLVolumeParams* params);
 };
 
 #endif // LL_LLVOLUMEXML_H
diff --git a/indra/llrender/llcubemap.cpp b/indra/llrender/llcubemap.cpp
index 1b10354c22919e597b2ee67d0660cf579d6c30fb..45a3b18179a8aff6b2646aaf02e5aea96bf05add 100644
--- a/indra/llrender/llcubemap.cpp
+++ b/indra/llrender/llcubemap.cpp
@@ -36,6 +36,7 @@
 #include "m4math.h"
 
 #include "llrender.h"
+#include "llglslshader.h"
 
 #include "llglheaders.h"
 
@@ -195,7 +196,7 @@ void LLCubeMap::enableTexture(S32 stage)
 void LLCubeMap::enableTextureCoords(S32 stage)
 {
 	mTextureCoordStage = stage;
-	if (gGLManager.mHasCubeMap && stage >= 0 && LLCubeMap::sUseCubeMaps)
+	if (!LLGLSLShader::sNoFixedFunction && gGLManager.mHasCubeMap && stage >= 0 && LLCubeMap::sUseCubeMaps)
 	{
 		if (stage > 0)
 		{
@@ -237,7 +238,7 @@ void LLCubeMap::disableTexture(void)
 
 void LLCubeMap::disableTextureCoords(void)
 {
-	if (gGLManager.mHasCubeMap && mTextureCoordStage >= 0 && LLCubeMap::sUseCubeMaps)
+	if (!LLGLSLShader::sNoFixedFunction && gGLManager.mHasCubeMap && mTextureCoordStage >= 0 && LLCubeMap::sUseCubeMaps)
 	{
 		if (mTextureCoordStage > 0)
 		{
@@ -264,19 +265,19 @@ void LLCubeMap::setMatrix(S32 stage)
 		gGL.getTexUnit(stage)->activate();
 	}
 
-	LLVector3 x(LLVector3d(gGLModelView+0));
-	LLVector3 y(LLVector3d(gGLModelView+4));
-	LLVector3 z(LLVector3d(gGLModelView+8));
+	LLVector3 x(gGLModelView+0);
+	LLVector3 y(gGLModelView+4);
+	LLVector3 z(gGLModelView+8);
 
 	LLMatrix3 mat3;
 	mat3.setRows(x,y,z);
 	LLMatrix4 trans(mat3);
 	trans.transpose();
 
-	glMatrixMode(GL_TEXTURE);
-	glPushMatrix();
-	glLoadMatrixf((F32 *)trans.mMatrix);
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.pushMatrix();
+	gGL.loadMatrix((F32 *)trans.mMatrix);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	
 	/*if (stage > 0)
 	{
@@ -292,9 +293,9 @@ void LLCubeMap::restoreMatrix()
 	{
 		gGL.getTexUnit(mMatrixStage)->activate();
 	}
-	glMatrixMode(GL_TEXTURE);
-	glPopMatrix();
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.popMatrix();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	
 	/*if (mMatrixStage > 0)
 	{
diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp
index 91c8a37022aadbe6a8c06e5b10ae41b8bcde3b8d..66d4ad2d87dc57013039f769abd67a4cf1bbafeb 100644
--- a/indra/llrender/llfontfreetype.cpp
+++ b/indra/llrender/llfontfreetype.cpp
@@ -55,7 +55,10 @@ FT_Library gFTLibrary = NULL;
 //static
 void LLFontManager::initClass()
 {
-	gFontManagerp = new LLFontManager;
+	if (!gFontManagerp) 
+	{
+		gFontManagerp = new LLFontManager;
+	}
 }
 
 //static
@@ -136,7 +139,7 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v
 		FT_Done_Face(mFTFace);
 		mFTFace = NULL;
 	}
-
+	
 	int error;
 
 	error = FT_New_Face( gFTLibrary,
diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp
index 607473d4166292f2bf55a452120eab430eb90dd0..fccbf37a8dd407f0a37c093ab931f977ef106d88 100644
--- a/indra/llrender/llfontgl.cpp
+++ b/indra/llrender/llfontgl.cpp
@@ -56,8 +56,9 @@ std::string LLFontGL::sAppDir;
 LLColor4 LLFontGL::sShadowColor(0.f, 0.f, 0.f, 1.f);
 LLFontRegistry* LLFontGL::sFontRegistry = NULL;
 
-LLCoordFont LLFontGL::sCurOrigin;
-std::vector<LLCoordFont> LLFontGL::sOriginStack;
+LLCoordGL LLFontGL::sCurOrigin;
+F32 LLFontGL::sCurDepth;
+std::vector<std::pair<LLCoordGL, F32> > LLFontGL::sOriginStack;
 
 const F32 EXT_X_BEARING = 1.f;
 const F32 EXT_Y_BEARING = 0.f;
@@ -68,20 +69,6 @@ const F32 PIXEL_CORRECTION_DISTANCE = 0.01f;
 const F32 PAD_UVY = 0.5f; // half of vertical padding between glyphs in the glyph texture
 const F32 DROP_SHADOW_SOFT_STRENGTH = 0.3f;
 
-static F32 llfont_round_x(F32 x)
-{
-	//return llfloor((x-LLFontGL::sCurOrigin.mX)/LLFontGL::sScaleX+0.5f)*LLFontGL::sScaleX+LLFontGL::sCurOrigin.mX;
-	//return llfloor(x/LLFontGL::sScaleX+0.5f)*LLFontGL::sScaleY;
-	return x;
-}
-
-static F32 llfont_round_y(F32 y)
-{
-	//return llfloor((y-LLFontGL::sCurOrigin.mY)/LLFontGL::sScaleY+0.5f)*LLFontGL::sScaleY+LLFontGL::sCurOrigin.mY;
-	//return llfloor(y+0.5f);
-	return y;
-}
-
 LLFontGL::LLFontGL()
 {
 }
@@ -115,23 +102,23 @@ static LLFastTimer::DeclareTimer FTM_RENDER_FONTS("Fonts");
 S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRect& rect, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, 
 					 ShadowType shadow, S32 max_chars, F32* right_x, BOOL use_ellipses) const
 {
-	F32 x = rect.mLeft;
+	F32 x = (F32)rect.mLeft;
 	F32 y = 0.f;
 
 	switch(valign)
 	{
 	case TOP:
-		y = rect.mTop;
+		y = (F32)rect.mTop;
 		break;
 	case VCENTER:
-		y = rect.getCenterY();
+		y = (F32)rect.getCenterY();
 		break;
 	case BASELINE:
 	case BOTTOM:
-		y = rect.mBottom;
+		y = (F32)rect.mBottom;
 		break;
 	default:
-		y = rect.mBottom;
+		y = (F32)rect.mBottom;
 		break;
 	}
 	return render(wstr, begin_offset, x, y, color, halign, valign, style, shadow, max_chars, rect.getWidth(), right_x, use_ellipses);
@@ -177,21 +164,11 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 
 	gGL.loadUIIdentity();
 	
-	//gGL.translateUI(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY), sCurOrigin.mZ);
-
-	// this code snaps the text origin to a pixel grid to start with
-	//F32 pixel_offset_x = llround((F32)sCurOrigin.mX) - (sCurOrigin.mX);
-	//F32 pixel_offset_y = llround((F32)sCurOrigin.mY) - (sCurOrigin.mY);
-	//gGL.translateUI(-pixel_offset_x, -pixel_offset_y, 0.f);
-
 	LLVector2 origin(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY));
-	// snap the text origin to a pixel grid to start with
-	origin.mV[VX] -= llround((F32)sCurOrigin.mX) - (sCurOrigin.mX);
-	origin.mV[VY] -= llround((F32)sCurOrigin.mY) - (sCurOrigin.mY);
 
-	// Depth translation, so that floating text appears 'inworld'
-	// and is correclty occluded.
-	gGL.translatef(0.f,0.f,sCurOrigin.mZ);
+	// Depth translation, so that floating text appears 'in-world'
+	// and is correctly occluded.
+	gGL.translatef(0.f,0.f,sCurDepth);
 
 	S32 chars_drawn = 0;
 	S32 i;
@@ -215,16 +192,17 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 	cur_y = ((F32)y * sScaleY) + origin.mV[VY];
 
 	// Offset y by vertical alignment.
+	// use unscaled font metrics here
 	switch (valign)
 	{
 	case TOP:
-		cur_y -= mFontFreetype->getAscenderHeight();
+		cur_y -= llceil(mFontFreetype->getAscenderHeight());
 		break;
 	case BOTTOM:
-		cur_y += mFontFreetype->getDescenderHeight();
+		cur_y += llceil(mFontFreetype->getDescenderHeight());
 		break;
 	case VCENTER:
-		cur_y -= (mFontFreetype->getAscenderHeight() - mFontFreetype->getDescenderHeight()) / 2.f;
+		cur_y -= llceil((llceil(mFontFreetype->getAscenderHeight()) - llceil(mFontFreetype->getDescenderHeight())) / 2.f);
 		break;
 	case BASELINE:
 		// Baseline, do nothing.
@@ -250,7 +228,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 	cur_render_y = cur_y;
 	cur_render_x = cur_x;
 
-	F32 start_x = llround(cur_x);
+	F32 start_x = (F32)llround(cur_x);
 
 	const LLFontBitmapCache* font_bitmap_cache = mFontFreetype->getFontBitmapCache();
 
@@ -304,6 +282,18 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 		S32 next_bitmap_num = fgi->mBitmapNum;
 		if (next_bitmap_num != bitmap_num)
 		{
+			// Actually draw the queued glyphs before switching their texture;
+			// otherwise the queued glyphs will be taken from wrong textures.
+			if (glyph_count > 0)
+			{
+				gGL.begin(LLRender::QUADS);
+				{
+					gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 4);
+				}
+				gGL.end();
+				glyph_count = 0;
+			}
+
 			bitmap_num = next_bitmap_num;
 			LLImageGL *font_image = font_bitmap_cache->getImageGL(bitmap_num);
 			gGL.getTexUnit(0)->bind(font_image);
@@ -322,10 +312,10 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 				(fgi->mXBitmapOffset + fgi->mWidth) * inv_width,
 				(fgi->mYBitmapOffset - PAD_UVY) * inv_height);
 		// snap glyph origin to whole screen pixel
-		LLRectf screen_rect(llround(cur_render_x + (F32)fgi->mXBearing),
-				    llround(cur_render_y + (F32)fgi->mYBearing),
-				    llround(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth,
-				    llround(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight);
+		LLRectf screen_rect((F32)llround(cur_render_x + (F32)fgi->mXBearing),
+				    (F32)llround(cur_render_y + (F32)fgi->mYBearing),
+				    (F32)llround(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth,
+				    (F32)llround(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight);
 		
 		if (glyph_count >= GLYPH_BATCH_SIZE)
 		{
@@ -378,12 +368,12 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 	//FIXME: add underline as glyph?
 	if (style_to_add & UNDERLINE)
 	{
-		F32 descender = mFontFreetype->getDescenderHeight();
+		F32 descender = (F32)llfloor(mFontFreetype->getDescenderHeight());
 
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 		gGL.begin(LLRender::LINES);
-		gGL.vertex2f(start_x, cur_y - (descender));
-		gGL.vertex2f(cur_x, cur_y - (descender));
+		gGL.vertex2f(start_x, cur_y - descender);
+		gGL.vertex2f(cur_x, cur_y - descender);
 		gGL.end();
 	}
 
@@ -432,19 +422,9 @@ S32 LLFontGL::renderUTF8(const std::string &text, S32 begin_offset, S32 x, S32 y
 }
 
 // font metrics - override for LLFontFreetype that returns units of virtual pixels
-F32 LLFontGL::getLineHeight() const
-{ 
-	return (F32)llround(mFontFreetype->getLineHeight() / sScaleY); 
-}
-
-F32 LLFontGL::getAscenderHeight() const
+S32 LLFontGL::getLineHeight() const
 { 
-	return (F32)llround(mFontFreetype->getAscenderHeight() / sScaleY); 
-}
-
-F32 LLFontGL::getDescenderHeight() const
-{ 
-	return (F32)llround(mFontFreetype->getDescenderHeight() / sScaleY); 
+	return llceil(mFontFreetype->getAscenderHeight() / sScaleY) + llceil(mFontFreetype->getDescenderHeight() / sScaleY);
 }
 
 S32 LLFontGL::getWidth(const std::string& utf8text) const
@@ -633,7 +613,7 @@ S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_ch
 		}
 
 		// Round after kerning.
-		cur_x = llround(cur_x);
+		cur_x = (F32)llround(cur_x);
 		drawn_x = cur_x;
 	}
 
@@ -704,7 +684,7 @@ S32	LLFontGL::firstDrawableChar(const llwchar* wchars, F32 max_pixels, S32 text_
 		}
 
 		// Round after kerning.
-		total_width = llround(total_width);
+		total_width = (F32)llround(total_width);
 	}
 
 	if (drawable_chars == 0)
@@ -787,7 +767,7 @@ S32 LLFontGL::charFromPixelOffset(const llwchar* wchars, S32 begin_offset, F32 t
 
 
 		// Round after kerning.
-		cur_x = llround(cur_x);
+		cur_x = (F32)llround(cur_x);
 	}
 
 	return llmin(max_chars, pos - begin_offset);
@@ -1134,22 +1114,22 @@ void LLFontGL::renderQuad(LLVector3* vertex_out, LLVector2* uv_out, LLColor4U* c
 {
 	S32 index = 0;
 
-	vertex_out[index] = LLVector3(llfont_round_x(screen_rect.mRight), llfont_round_y(screen_rect.mTop), 0.f);
+	vertex_out[index] = LLVector3(screen_rect.mRight, screen_rect.mTop, 0.f);
 	uv_out[index] = LLVector2(uv_rect.mRight, uv_rect.mTop);
 	colors_out[index] = color;
 	index++;
 
-	vertex_out[index] = LLVector3(llfont_round_x(screen_rect.mLeft), llfont_round_y(screen_rect.mTop), 0.f);
+	vertex_out[index] = LLVector3(screen_rect.mLeft, screen_rect.mTop, 0.f);
 	uv_out[index] = LLVector2(uv_rect.mLeft, uv_rect.mTop);
 	colors_out[index] = color;
 	index++;
 
-	vertex_out[index] = LLVector3(llfont_round_x(screen_rect.mLeft), llfont_round_y(screen_rect.mBottom), 0.f);
+	vertex_out[index] = LLVector3(screen_rect.mLeft, screen_rect.mBottom, 0.f);
 	uv_out[index] = LLVector2(uv_rect.mLeft, uv_rect.mBottom);
 	colors_out[index] = color;
 	index++;
 
-	vertex_out[index] = LLVector3(llfont_round_x(screen_rect.mRight), llfont_round_y(screen_rect.mBottom), 0.f);
+	vertex_out[index] = LLVector3(screen_rect.mRight, screen_rect.mBottom, 0.f);
 	uv_out[index] = LLVector2(uv_rect.mRight, uv_rect.mBottom);
 	colors_out[index] = color;
 }
diff --git a/indra/llrender/llfontgl.h b/indra/llrender/llfontgl.h
index dc8d848ed25a11ba7a8589f17835d7f8e5937a38..74bdbb43e7424497820c08353b7125e81295ba3f 100644
--- a/indra/llrender/llfontgl.h
+++ b/indra/llrender/llfontgl.h
@@ -115,9 +115,7 @@ class LLFontGL
 	S32 renderUTF8(const std::string &text, S32 begin_offset, S32 x, S32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style = NORMAL, ShadowType shadow = NO_SHADOW) const;
 
 	// font metrics - override for LLFontFreetype that returns units of virtual pixels
-	F32 getLineHeight() const;
-	F32 getAscenderHeight() const;
-	F32 getDescenderHeight() const;
+	S32 getLineHeight() const;
 
 	S32 getWidth(const std::string& utf8text) const;
 	S32 getWidth(const llwchar* wchars) const;
@@ -188,8 +186,9 @@ class LLFontGL
 	static std::string getFontPathLocal();
 	static std::string getFontPathSystem();
 
-	static LLCoordFont sCurOrigin;
-	static std::vector<LLCoordFont> sOriginStack;
+	static LLCoordGL sCurOrigin;
+	static F32			sCurDepth;
+	static std::vector<std::pair<LLCoordGL, F32> > sOriginStack;
 
 	static LLColor4 sShadowColor;
 
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 4e3cfb9c8aa5aba028caaaf8baa6f63549024e43..197bc2b422de9d49d62735950a6e594a7d5c5b42 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -67,6 +67,38 @@ static const std::string HEADLESS_VERSION_STRING("1.0");
 
 std::ofstream gFailLog;
 
+#if GL_ARB_debug_output
+
+#ifndef APIENTRY
+#define APIENTRY
+#endif
+
+void APIENTRY gl_debug_callback(GLenum source,
+                                GLenum type,
+                                GLuint id,
+                                GLenum severity,
+                                GLsizei length,
+                                const GLchar* message,
+                                GLvoid* userParam)
+{
+	if (severity == GL_DEBUG_SEVERITY_HIGH_ARB)
+	{
+		llwarns << "----- GL ERROR --------" << llendl;
+	}
+	else
+	{
+		llwarns << "----- GL WARNING -------" << llendl;
+	}
+	llwarns << "Type: " << std::hex << type << llendl;
+	llwarns << "ID: " << std::hex << id << llendl;
+	llwarns << "Severity: " << std::hex << severity << llendl;
+	llwarns << "Message: " << message << llendl;
+	llwarns << "-----------------------" << llendl;
+}
+#endif
+
+void parse_glsl_version(S32& major, S32& minor);
+
 void ll_init_fail_log(std::string filename)
 {
 	gFailLog.open(filename.c_str());
@@ -110,6 +142,11 @@ std::list<LLGLUpdate*> LLGLUpdate::sGLQ;
 
 #if (LL_WINDOWS || LL_LINUX || LL_SOLARIS)  && !LL_MESA_HEADLESS
 // ATI prototypes
+
+#if LL_WINDOWS
+PFNGLGETSTRINGIPROC glGetStringi = NULL;
+#endif
+
 // vertex blending prototypes
 PFNGLWEIGHTPOINTERARBPROC			glWeightPointerARB = NULL;
 PFNGLVERTEXBLENDARBPROC				glVertexBlendARB = NULL;
@@ -128,6 +165,12 @@ PFNGLUNMAPBUFFERARBPROC				glUnmapBufferARB = NULL;
 PFNGLGETBUFFERPARAMETERIVARBPROC	glGetBufferParameterivARB = NULL;
 PFNGLGETBUFFERPOINTERVARBPROC		glGetBufferPointervARB = NULL;
 
+//GL_ARB_vertex_array_object
+PFNGLBINDVERTEXARRAYPROC glBindVertexArray = NULL;
+PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays = NULL;
+PFNGLGENVERTEXARRAYSPROC glGenVertexArrays = NULL;
+PFNGLISVERTEXARRAYPROC glIsVertexArray = NULL;
+
 // GL_ARB_map_buffer_range
 PFNGLMAPBUFFERRANGEPROC			glMapBufferRange = NULL;
 PFNGLFLUSHMAPPEDBUFFERRANGEPROC	glFlushMappedBufferRange = NULL;
@@ -197,10 +240,16 @@ PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glRenderbufferStorageMultisample = NULL;
 PFNGLFRAMEBUFFERTEXTURELAYERPROC glFramebufferTextureLayer = NULL;
 
 //GL_ARB_texture_multisample
-PFNGLTEXIMAGE2DMULTISAMPLEPROC glTexImage2DMultisample;
-PFNGLTEXIMAGE3DMULTISAMPLEPROC glTexImage3DMultisample;
-PFNGLGETMULTISAMPLEFVPROC glGetMultisamplefv;
-PFNGLSAMPLEMASKIPROC glSampleMaski;
+PFNGLTEXIMAGE2DMULTISAMPLEPROC glTexImage2DMultisample = NULL;
+PFNGLTEXIMAGE3DMULTISAMPLEPROC glTexImage3DMultisample = NULL;
+PFNGLGETMULTISAMPLEFVPROC glGetMultisamplefv = NULL;
+PFNGLSAMPLEMASKIPROC glSampleMaski = NULL;
+
+//GL_ARB_debug_output
+PFNGLDEBUGMESSAGECONTROLARBPROC glDebugMessageControlARB = NULL;
+PFNGLDEBUGMESSAGEINSERTARBPROC glDebugMessageInsertARB = NULL;
+PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB = NULL;
+PFNGLGETDEBUGMESSAGELOGARBPROC glGetDebugMessageLogARB = NULL;
 
 // GL_EXT_blend_func_separate
 PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparateEXT = NULL;
@@ -248,6 +297,11 @@ PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB = NULL;
 PFNGLGETUNIFORMFVARBPROC glGetUniformfvARB = NULL;
 PFNGLGETUNIFORMIVARBPROC glGetUniformivARB = NULL;
 PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB = NULL;
+PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer = NULL;
+
+#if LL_WINDOWS
+PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL;
+#endif
 
 // vertex shader prototypes
 #if LL_LINUX || LL_SOLARIS
@@ -349,6 +403,7 @@ LLGLManager::LLGLManager() :
 	mHasBlendFuncSeparate(FALSE),
 	mHasSync(FALSE),
 	mHasVertexBufferObject(FALSE),
+	mHasVertexArrayObject(FALSE),
 	mHasMapBufferRange(FALSE),
 	mHasFlushBufferRange(FALSE),
 	mHasPBuffer(FALSE),
@@ -370,6 +425,7 @@ LLGLManager::LLGLManager() :
 	mHasAnisotropic(FALSE),
 	mHasARBEnvCombine(FALSE),
 	mHasCubeMap(FALSE),
+	mHasDebugOutput(FALSE),
 
 	mIsATI(FALSE),
 	mIsNVIDIA(FALSE),
@@ -390,7 +446,8 @@ LLGLManager::LLGLManager() :
 	mDriverVersionMinor(0),
 	mDriverVersionRelease(0),
 	mGLVersion(1.0f),
-		
+	mGLSLVersionMajor(0),
+	mGLSLVersionMinor(0),		
 	mVRAM(0),
 	mGLMaxVertexRange(0),
 	mGLMaxIndexRange(0)
@@ -409,6 +466,15 @@ void LLGLManager::initWGL()
 		LL_WARNS("RenderInit") << "No ARB pixel format extensions" << LL_ENDL;
 	}
 
+	if (ExtensionExists("WGL_ARB_create_context",gGLHExts.mSysExts))
+	{
+		GLH_EXT_NAME(wglCreateContextAttribsARB) = (PFNWGLCREATECONTEXTATTRIBSARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglCreateContextAttribsARB");
+	}
+	else
+	{
+		LL_WARNS("RenderInit") << "No ARB create context extensions" << LL_ENDL;
+	}
+	
 	if (ExtensionExists("WGL_EXT_swap_control", gGLHExts.mSysExts))
 	{
         GLH_EXT_NAME(wglSwapIntervalEXT) = (PFNWGLSWAPINTERVALEXTPROC)GLH_EXT_GET_PROC_ADDRESS("wglSwapIntervalEXT");
@@ -438,13 +504,45 @@ bool LLGLManager::initGL()
 		LL_ERRS("RenderInit") << "Calling init on LLGLManager after already initialized!" << LL_ENDL;
 	}
 
-	GLint alpha_bits;
-	glGetIntegerv( GL_ALPHA_BITS, &alpha_bits );
-	if( 8 != alpha_bits )
+	stop_glerror();
+
+#if LL_WINDOWS
+	if (!glGetStringi)
 	{
-		LL_WARNS("RenderInit") << "Frame buffer has less than 8 bits of alpha.  Avatar texture compositing will fail." << LL_ENDL;
+		glGetStringi = (PFNGLGETSTRINGIPROC) GLH_EXT_GET_PROC_ADDRESS("glGetStringi");
 	}
 
+	//reload extensions string (may have changed after using wglCreateContextAttrib)
+	if (glGetStringi)
+	{
+		std::stringstream str;
+
+		GLint count = 0;
+		glGetIntegerv(GL_NUM_EXTENSIONS, &count);
+		for (GLint i = 0; i < count; ++i)
+		{
+			std::string ext((const char*) glGetStringi(GL_EXTENSIONS, i));
+			str << ext << " ";
+			LL_DEBUGS("GLExtensions") << ext << llendl;
+		}
+		
+		{
+			PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = 0;
+			wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
+			if(wglGetExtensionsStringARB)
+			{
+				str << (const char*) wglGetExtensionsStringARB(wglGetCurrentDC());
+			}
+		}
+
+		free(gGLHExts.mSysExts);
+		std::string extensions = str.str();
+		gGLHExts.mSysExts = strdup(extensions.c_str());
+	}
+#endif
+	
+	stop_glerror();
+
 	// Extract video card strings and convert to upper case to
 	// work around driver-to-driver variation in capitalization.
 	mGLVendor = std::string((const char *)glGetString(GL_VENDOR));
@@ -459,7 +557,21 @@ bool LLGLManager::initGL()
 		&mDriverVersionVendorString );
 
 	mGLVersion = mDriverVersionMajor + mDriverVersionMinor * .1f;
-	
+
+	if (mGLVersion >= 2.f)
+	{
+		parse_glsl_version(mGLSLVersionMajor, mGLSLVersionMinor);
+
+#if LL_DARWIN
+		//never use GLSL greater than 1.20 on OSX
+		if (mGLSLVersionMajor > 1 || mGLSLVersionMinor >= 30)
+		{
+			mGLSLVersionMajor = 1;
+			mGLSLVersionMinor = 20;
+		}
+#endif
+	}
+
 	// Trailing space necessary to keep "nVidia Corpor_ati_on" cards
 	// from being recognized as ATI.
 	if (mGLVendor.substr(0,4) == "ATI ")
@@ -531,8 +643,12 @@ bool LLGLManager::initGL()
 		mGLVendorShort = "MISC";
 	}
 	
+	stop_glerror();
 	// This is called here because it depends on the setting of mIsGF2or4MX, and sets up mHasMultitexture.
 	initExtensions();
+	stop_glerror();
+
+	S32 old_vram = mVRAM;
 
 	if (mHasATIMemInfo)
 	{ //ask the gl how much vram is free at startup and attempt to use no more than half of that
@@ -548,7 +664,27 @@ bool LLGLManager::initGL()
 		mVRAM = dedicated_memory/1024;
 	}
 
-	if (mHasMultitexture)
+	if (mVRAM < 256)
+	{ //something likely went wrong using the above extensions, fall back to old method
+		mVRAM = old_vram;
+	}
+
+	stop_glerror();
+
+	stop_glerror();
+
+	if (mHasFragmentShader)
+	{
+		GLint num_tex_image_units;
+		glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &num_tex_image_units);
+		mNumTextureImageUnits = llmin(num_tex_image_units, 32);
+	}
+
+	if (LLRender::sGLCoreProfile)
+	{
+		mNumTextureUnits = llmin(mNumTextureImageUnits, MAX_GL_TEXTURE_UNITS);
+	}
+	else if (mHasMultitexture)
 	{
 		GLint num_tex_units;		
 		glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &num_tex_units);
@@ -567,12 +703,7 @@ bool LLGLManager::initGL()
 		return false;
 	}
 	
-	if (mHasFragmentShader)
-	{
-		GLint num_tex_image_units;
-		glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &num_tex_image_units);
-		mNumTextureImageUnits = llmin(num_tex_image_units, 32);
-	}
+	stop_glerror();
 
 	if (mHasTextureMultisample)
 	{
@@ -582,6 +713,21 @@ bool LLGLManager::initGL()
 		glGetIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &mMaxSampleMaskWords);
 	}
 
+	stop_glerror();
+
+#if LL_WINDOWS
+	if (mHasDebugOutput && gDebugGL)
+	{ //setup debug output callback
+		//glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, NULL, GL_TRUE);
+		glDebugMessageCallbackARB((GLDEBUGPROCARB) gl_debug_callback, NULL);
+		glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
+	}
+#endif
+
+	stop_glerror();
+
+	//HACK always disable texture multisample, use FXAA instead
+	mHasTextureMultisample = FALSE;
 #if LL_WINDOWS
 	if (mIsATI)
 	{ //using multisample textures on ATI results in black screen for some reason
@@ -593,10 +739,17 @@ bool LLGLManager::initGL()
 	{
 		glGetIntegerv(GL_MAX_SAMPLES, &mMaxSamples);
 	}
+
+	stop_glerror();
 	
 	setToDebugGPU();
 
+	stop_glerror();
+
 	initGLStates();
+
+	stop_glerror();
+
 	return true;
 }
 
@@ -700,14 +853,6 @@ std::string LLGLManager::getRawGLString()
 	return gl_string;
 }
 
-U32 LLGLManager::getNumFBOFSAASamples(U32 samples)
-{
-	samples = llmin(samples, (U32) mMaxColorTextureSamples);
-	samples = llmin(samples, (U32) mMaxDepthTextureSamples);
-	samples = llmin(samples, (U32) 4);
-	return samples;
-}
-
 void LLGLManager::shutdownGL()
 {
 	if (mInited)
@@ -774,7 +919,7 @@ void LLGLManager::initExtensions()
 	mHasVertexShader = FALSE;
 	mHasFragmentShader = FALSE;
 	mHasTextureRectangle = FALSE;
-#else // LL_MESA_HEADLESS
+#else // LL_MESA_HEADLESS //important, gGLHExts.mSysExts is uninitialized until after glh_init_extensions is called
 	mHasMultitexture = glh_init_extensions("GL_ARB_multitexture");
 	mHasATIMemInfo = ExtensionExists("GL_ATI_meminfo", gGLHExts.mSysExts);
 	mHasNVXMemInfo = ExtensionExists("GL_NVX_gpu_memory_info", gGLHExts.mSysExts);
@@ -788,6 +933,7 @@ void LLGLManager::initExtensions()
 	mHasOcclusionQuery = ExtensionExists("GL_ARB_occlusion_query", gGLHExts.mSysExts);
 	mHasOcclusionQuery2 = ExtensionExists("GL_ARB_occlusion_query2", gGLHExts.mSysExts);
 	mHasVertexBufferObject = ExtensionExists("GL_ARB_vertex_buffer_object", gGLHExts.mSysExts);
+	mHasVertexArrayObject = ExtensionExists("GL_ARB_vertex_array_object", gGLHExts.mSysExts);
 	mHasSync = ExtensionExists("GL_ARB_sync", gGLHExts.mSysExts);
 	mHasMapBufferRange = ExtensionExists("GL_ARB_map_buffer_range", gGLHExts.mSysExts);
 	mHasFlushBufferRange = ExtensionExists("GL_APPLE_flush_buffer_range", gGLHExts.mSysExts);
@@ -806,13 +952,14 @@ void LLGLManager::initExtensions()
 	mHasBlendFuncSeparate = ExtensionExists("GL_EXT_blend_func_separate", gGLHExts.mSysExts);
 	mHasTextureRectangle = ExtensionExists("GL_ARB_texture_rectangle", gGLHExts.mSysExts);
 	mHasTextureMultisample = ExtensionExists("GL_ARB_texture_multisample", gGLHExts.mSysExts);
+	mHasDebugOutput = ExtensionExists("GL_ARB_debug_output", gGLHExts.mSysExts);
 #if !LL_DARWIN
 	mHasPointParameters = !mIsATI && ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts);
 #endif
-	mHasShaderObjects = ExtensionExists("GL_ARB_shader_objects", gGLHExts.mSysExts) && ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts);
+	mHasShaderObjects = ExtensionExists("GL_ARB_shader_objects", gGLHExts.mSysExts) && (LLRender::sGLCoreProfile || ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts));
 	mHasVertexShader = ExtensionExists("GL_ARB_vertex_program", gGLHExts.mSysExts) && ExtensionExists("GL_ARB_vertex_shader", gGLHExts.mSysExts)
-						&& ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts);
-	mHasFragmentShader = ExtensionExists("GL_ARB_fragment_shader", gGLHExts.mSysExts) && ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts);
+		&& (LLRender::sGLCoreProfile || ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts));
+	mHasFragmentShader = ExtensionExists("GL_ARB_fragment_shader", gGLHExts.mSysExts) && (LLRender::sGLCoreProfile || ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts));
 #endif
 
 #if LL_LINUX || LL_SOLARIS
@@ -985,6 +1132,13 @@ void LLGLManager::initExtensions()
 			mHasVertexBufferObject = FALSE;
 		}
 	}
+	if (mHasVertexArrayObject)
+	{
+		glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC) GLH_EXT_GET_PROC_ADDRESS("glBindVertexArray");
+		glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteVertexArrays");
+		glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC) GLH_EXT_GET_PROC_ADDRESS("glGenVertexArrays");
+		glIsVertexArray = (PFNGLISVERTEXARRAYPROC) GLH_EXT_GET_PROC_ADDRESS("glIsVertexArray");
+	}
 	if (mHasSync)
 	{
 		glFenceSync = (PFNGLFENCESYNCPROC) GLH_EXT_GET_PROC_ADDRESS("glFenceSync");
@@ -1039,6 +1193,13 @@ void LLGLManager::initExtensions()
 		glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC) GLH_EXT_GET_PROC_ADDRESS("glGetMultisamplefv");
 		glSampleMaski = (PFNGLSAMPLEMASKIPROC) GLH_EXT_GET_PROC_ADDRESS("glSampleMaski");
 	}	
+	if (mHasDebugOutput)
+	{
+		glDebugMessageControlARB = (PFNGLDEBUGMESSAGECONTROLARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDebugMessageControlARB");
+		glDebugMessageInsertARB = (PFNGLDEBUGMESSAGEINSERTARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDebugMessageInsertARB");
+		glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDebugMessageCallbackARB");
+		glGetDebugMessageLogARB = (PFNGLGETDEBUGMESSAGELOGARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetDebugMessageLogARB");
+	}
 #if (!LL_LINUX && !LL_SOLARIS) || LL_LINUX_NV_GL_HEADERS
 	// This is expected to be a static symbol on Linux GL implementations, except if we use the nvidia headers - bah
 	glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)GLH_EXT_GET_PROC_ADDRESS("glDrawRangeElements");
@@ -1157,6 +1318,7 @@ void LLGLManager::initExtensions()
 		glVertexAttrib4uivARB = (PFNGLVERTEXATTRIB4UIVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4uivARB");
 		glVertexAttrib4usvARB = (PFNGLVERTEXATTRIB4USVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4usvARB");
 		glVertexAttribPointerARB = (PFNGLVERTEXATTRIBPOINTERARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttribPointerARB");
+		glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttribIPointer");
 		glEnableVertexAttribArrayARB = (PFNGLENABLEVERTEXATTRIBARRAYARBPROC) GLH_EXT_GET_PROC_ADDRESS("glEnableVertexAttribArrayARB");
 		glDisableVertexAttribArrayARB = (PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDisableVertexAttribArrayARB");
 		glProgramStringARB = (PFNGLPROGRAMSTRINGARBPROC) GLH_EXT_GET_PROC_ADDRESS("glProgramStringARB");
@@ -1193,7 +1355,7 @@ void rotate_quat(LLQuaternion& rotation)
 {
 	F32 angle_radians, x, y, z;
 	rotation.getAngleAxis(&angle_radians, &x, &y, &z);
-	glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
+	gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
 }
 
 void flush_glerror()
@@ -1230,10 +1392,6 @@ void log_glerror()
 
 void do_assert_glerror()
 {
-	if (LL_UNLIKELY(!gGLManager.mInited))
-	{
-		LL_ERRS("RenderInit") << "GL not initialized" << LL_ENDL;
-	}
 	//  Create or update texture to be used with this data 
 	GLenum error;
 	error = glGetError();
@@ -1326,11 +1484,6 @@ void LLGLState::initClass()
 	//make sure multisample defaults to disabled
 	sStateMap[GL_MULTISAMPLE_ARB] = GL_FALSE;
 	glDisable(GL_MULTISAMPLE_ARB);
-
-	sStateMap[GL_MULTISAMPLE_ARB] = GL_FALSE;
-	glDisable(GL_MULTISAMPLE_ARB);
-
-	glEnableClientState(GL_VERTEX_ARRAY);
 }
 
 //static
@@ -1604,7 +1757,7 @@ void LLGLState::checkTextureChannels(const std::string& msg)
 
 void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask)
 {
-	if (!gDebugGL)
+	if (!gDebugGL || LLGLSLShader::sNoFixedFunction)
 	{
 		return;
 	}
@@ -1625,7 +1778,7 @@ void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask)
 		error = TRUE;
 	}
 
-	glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &active_texture);
+	/*glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &active_texture);
 	if (active_texture != GL_TEXTURE0_ARB)
 	{
 		llwarns << "Active texture corrupted: " << active_texture << llendl;
@@ -1634,7 +1787,7 @@ void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask)
 			gFailLog << "Active texture corrupted: " << active_texture << std::endl;
 		}
 		error = TRUE;
-	}
+	}*/
 
 	static const char* label[] =
 	{
@@ -1661,7 +1814,7 @@ void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask)
 	};
 
 
-	for (S32 j = 0; j < 4; j++)
+	for (S32 j = 1; j < 4; j++)
 	{
 		if (glIsEnabled(value[j]))
 		{
@@ -1783,17 +1936,26 @@ LLGLState::LLGLState(LLGLenum state, S32 enabled) :
 	mState(state), mWasEnabled(FALSE), mIsEnabled(FALSE)
 {
 	if (LLGLSLShader::sNoFixedFunction)
-	{ //always disable state that's deprecated post GL 3.0
+	{ //always ignore state that's deprecated post GL 3.0
 		switch (state)
 		{
 			case GL_ALPHA_TEST:
-				enabled = 0;
+			case GL_NORMALIZE:
+			case GL_TEXTURE_GEN_R:
+			case GL_TEXTURE_GEN_S:
+			case GL_TEXTURE_GEN_T:
+			case GL_TEXTURE_GEN_Q:
+			case GL_LIGHTING:
+			case GL_COLOR_MATERIAL:
+			case GL_FOG:
+			case GL_LINE_STIPPLE:
+				mState = 0;
 				break;
 		}
 	}
 
 	stop_glerror();
-	if (state)
+	if (mState)
 	{
 		mWasEnabled = sStateMap[state];
 		llassert(mWasEnabled == glIsEnabled(state));
@@ -1875,79 +2037,6 @@ void LLGLManager::initGLStates()
 
 ////////////////////////////////////////////////////////////////////////////////
 
-void enable_vertex_weighting(const S32 index)
-{
-#if GL_ARB_vertex_program
-	if (index > 0) glEnableVertexAttribArrayARB(index);	// vertex weights
-#endif
-}
-
-void disable_vertex_weighting(const S32 index)
-{
-#if GL_ARB_vertex_program
-	if (index > 0) glDisableVertexAttribArrayARB(index);	// vertex weights
-#endif
-}
-
-void enable_binormals(const S32 index)
-{
-#if GL_ARB_vertex_program
-	if (index > 0)
-	{
-		glEnableVertexAttribArrayARB(index);	// binormals
-	}
-#endif
-}
-
-void disable_binormals(const S32 index)
-{
-#if GL_ARB_vertex_program
-	if (index > 0)
-	{
-		glDisableVertexAttribArrayARB(index);	// binormals
-	}
-#endif
-}
-
-
-void enable_cloth_weights(const S32 index)
-{
-#if GL_ARB_vertex_program
-	if (index > 0)	glEnableVertexAttribArrayARB(index);
-#endif
-}
-
-void disable_cloth_weights(const S32 index)
-{
-#if GL_ARB_vertex_program
-	if (index > 0) glDisableVertexAttribArrayARB(index);
-#endif
-}
-
-void set_vertex_weights(const S32 index, const U32 stride, const F32 *weights)
-{
-#if GL_ARB_vertex_program
-	if (index > 0) glVertexAttribPointerARB(index, 1, GL_FLOAT, FALSE, stride, weights);
-	stop_glerror();
-#endif
-}
-
-void set_vertex_clothing_weights(const S32 index, const U32 stride, const LLVector4 *weights)
-{
-#if GL_ARB_vertex_program
-	if (index > 0) glVertexAttribPointerARB(index, 4, GL_FLOAT, TRUE, stride, weights);
-	stop_glerror();
-#endif
-}
-
-void set_binormals(const S32 index, const U32 stride,const LLVector3 *binormals)
-{
-#if GL_ARB_vertex_program
-	if (index > 0) glVertexAttribPointerARB(index, 3, GL_FLOAT, FALSE, stride, binormals);
-	stop_glerror();
-#endif
-}
-
 void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor_specific )
 {
 	// GL_VERSION returns a null-terminated string with the format: 
@@ -2028,6 +2117,55 @@ void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor
 	}
 }
 
+
+void parse_glsl_version(S32& major, S32& minor)
+{
+	// GL_SHADING_LANGUAGE_VERSION returns a null-terminated string with the format: 
+	// <major>.<minor>[.<release>] [<vendor specific>]
+
+	const char* version = (const char*) glGetString(GL_SHADING_LANGUAGE_VERSION);
+	major = 0;
+	minor = 0;
+	
+	if( !version )
+	{
+		return;
+	}
+
+	std::string ver_copy( version );
+	S32 len = (S32)strlen( version );	/* Flawfinder: ignore */
+	S32 i = 0;
+	S32 start;
+	// Find the major version
+	start = i;
+	for( ; i < len; i++ )
+	{
+		if( '.' == version[i] )
+		{
+			break;
+		}
+	}
+	std::string major_str = ver_copy.substr(start,i-start);
+	LLStringUtil::convertToS32(major_str, major);
+
+	if( '.' == version[i] )
+	{
+		i++;
+	}
+
+	// Find the minor version
+	start = i;
+	for( ; i < len; i++ )
+	{
+		if( ('.' == version[i]) || isspace(version[i]) )
+		{
+			break;
+		}
+	}
+	std::string minor_str = ver_copy.substr(start,i-start);
+	LLStringUtil::convertToS32(minor_str, minor);
+}
+
 LLGLUserClipPlane::LLGLUserClipPlane(const LLPlane& p, const glh::matrix4f& modelview, const glh::matrix4f& projection, bool apply)
 {
 	mApply = apply;
@@ -2060,20 +2198,20 @@ void LLGLUserClipPlane::setPlane(F32 a, F32 b, F32 c, F32 d)
     glh::matrix4f suffix;
     suffix.set_row(2, cplane);
     glh::matrix4f newP = suffix * P;
-    glMatrixMode(GL_PROJECTION);
-	glPushMatrix();
-    glLoadMatrixf(newP.m);
+    gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.pushMatrix();
+    gGL.loadMatrix(newP.m);
 	gGLObliqueProjectionInverse = LLMatrix4(newP.inverse().transpose().m);
-    glMatrixMode(GL_MODELVIEW);
+    gGL.matrixMode(LLRender::MM_MODELVIEW);
 }
 
 LLGLUserClipPlane::~LLGLUserClipPlane()
 {
 	if (mApply)
 	{
-		glMatrixMode(GL_PROJECTION);
-		glPopMatrix();
-		glMatrixMode(GL_MODELVIEW);
+		gGL.matrixMode(LLRender::MM_PROJECTION);
+		gGL.popMatrix();
+		gGL.matrixMode(LLRender::MM_MODELVIEW);
 	}
 }
 
@@ -2263,16 +2401,16 @@ LLGLSquashToFarClip::LLGLSquashToFarClip(glh::matrix4f P, U32 layer)
 		P.element(2, i) = P.element(3, i) * depth;
 	}
 
-	glMatrixMode(GL_PROJECTION);
-	glPushMatrix();
-	glLoadMatrixf(P.m);
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.pushMatrix();
+	gGL.loadMatrix(P.m);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 }
 
 LLGLSquashToFarClip::~LLGLSquashToFarClip()
 {
-	glMatrixMode(GL_PROJECTION);
-	glPopMatrix();
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.popMatrix();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 }
 
diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h
index d736133f3ffc14ba21ec732be273c5338bcf0e76..5a33c98708356aa974c4bced60f4a91e89a0921b 100644
--- a/indra/llrender/llgl.h
+++ b/indra/llrender/llgl.h
@@ -88,6 +88,7 @@ class LLGLManager
 		
 	// ARB Extensions
 	BOOL mHasVertexBufferObject;
+	BOOL mHasVertexArrayObject;
 	BOOL mHasSync;
 	BOOL mHasMapBufferRange;
 	BOOL mHasFlushBufferRange;
@@ -112,6 +113,7 @@ class LLGLManager
 	BOOL mHasAnisotropic;
 	BOOL mHasARBEnvCombine;
 	BOOL mHasCubeMap;
+	BOOL mHasDebugOutput;
 
 	// Vendor-specific extensions
 	BOOL mIsATI;
@@ -136,6 +138,8 @@ class LLGLManager
 	S32 mDriverVersionMinor;
 	S32 mDriverVersionRelease;
 	F32 mGLVersion; // e.g = 1.4
+	S32 mGLSLVersionMajor;
+	S32 mGLSLVersionMinor;
 	std::string mDriverVersionVendorString;
 
 	S32 mVRAM; // VRAM in MB
@@ -148,7 +152,6 @@ class LLGLManager
 	void printGLInfoString();
 	void getGLInfo(LLSD& info);
 
-	U32 getNumFBOFSAASamples(U32 desired_samples = 32);
 	// In ALL CAPS
 	std::string mGLVendor;
 	std::string mGLVendorShort;
@@ -252,7 +255,7 @@ class LLGLState
 	static void dumpStates();
 	static void checkStates(const std::string& msg = "");
 	static void checkTextureChannels(const std::string& msg = "");
-	static void checkClientArrays(const std::string& msg = "", U32 data_mask = 0x0001);
+	static void checkClientArrays(const std::string& msg = "", U32 data_mask = 0);
 	
 protected:
 	static boost::unordered_map<LLGLenum, LLGLboolean> sStateMap;
@@ -419,15 +422,7 @@ extern LLMatrix4 gGLObliqueProjectionInverse;
 #include "llglstates.h"
 
 void init_glstates();
-void enable_vertex_weighting(const S32 index);
-void disable_vertex_weighting(const S32 index);
-void enable_binormals(const S32 index);
-void disable_binormals(const S32 index);
-void enable_cloth_weights(const S32 index);
-void disable_cloth_weights(const S32 index);
-void set_vertex_weights(const S32 index, const U32 stride, const F32 *weights);
-void set_vertex_clothing_weights(const S32 index, const U32 stride, const LLVector4 *weights);
-void set_binormals(const S32 index, const U32 stride, const LLVector3 *binormals);
+
 void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor_specific );
 
 extern BOOL gClothRipple;
diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h
index 851a75629e184e60767390c843360156d7d8515a..d61ec707f06c56f9c6c6ad3a56b0e0b480cfd5cd 100644
--- a/indra/llrender/llglheaders.h
+++ b/indra/llrender/llglheaders.h
@@ -68,6 +68,12 @@ extern PFNGLUNMAPBUFFERARBPROC		glUnmapBufferARB;
 extern PFNGLGETBUFFERPARAMETERIVARBPROC	glGetBufferParameterivARB;
 extern PFNGLGETBUFFERPOINTERVARBPROC	glGetBufferPointervARB;
 
+// GL_ARB_vertex_array_object
+extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
+extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays;
+extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
+extern PFNGLISVERTEXARRAYPROC glIsVertexArray;
+
 // GL_ARB_sync
 extern PFNGLFENCESYNCPROC				glFenceSync;
 extern PFNGLISSYNCPROC					glIsSync;
@@ -193,6 +199,7 @@ extern PFNGLVERTEXATTRIB4UBVARBPROC glVertexAttrib4ubvARB;
 extern PFNGLVERTEXATTRIB4UIVARBPROC glVertexAttrib4uivARB;
 extern PFNGLVERTEXATTRIB4USVARBPROC glVertexAttrib4usvARB;
 extern PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB;
+extern PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer;
 extern PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB;
 extern PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB;
 extern PFNGLPROGRAMSTRINGARBPROC glProgramStringARB;
@@ -310,6 +317,12 @@ extern PFNGLCLIENTACTIVETEXTUREARBPROC	glClientActiveTextureARB;
 extern PFNGLDRAWRANGEELEMENTSPROC 	glDrawRangeElements;
 #endif // LL_LINUX_NV_GL_HEADERS
 
+// GL_ARB_vertex_array_object
+extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
+extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays;
+extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
+extern PFNGLISVERTEXARRAYPROC glIsVertexArray;
+
 // GL_ARB_vertex_buffer_object
 extern PFNGLBINDBUFFERARBPROC		glBindBufferARB;
 extern PFNGLDELETEBUFFERSARBPROC	glDeleteBuffersARB;
@@ -448,6 +461,7 @@ extern PFNGLVERTEXATTRIB4UBVARBPROC glVertexAttrib4ubvARB;
 extern PFNGLVERTEXATTRIB4UIVARBPROC glVertexAttrib4uivARB;
 extern PFNGLVERTEXATTRIB4USVARBPROC glVertexAttrib4usvARB;
 extern PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB;
+extern PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer;
 extern PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB;
 extern PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB;
 extern PFNGLPROGRAMSTRINGARBPROC glProgramStringARB;
@@ -531,6 +545,9 @@ extern PFNGLSAMPLEMASKIPROC glSampleMaski;
 #include "GL/glext.h"
 #include "GL/glh_extensions.h"
 
+// WGL_ARB_create_context
+extern PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
+extern PFNGLGETSTRINGIPROC glGetStringi;
 
 // GL_ARB_vertex_buffer_object
 extern PFNGLBINDBUFFERARBPROC		glBindBufferARB;
@@ -545,6 +562,12 @@ extern PFNGLUNMAPBUFFERARBPROC		glUnmapBufferARB;
 extern PFNGLGETBUFFERPARAMETERIVARBPROC	glGetBufferParameterivARB;
 extern PFNGLGETBUFFERPOINTERVARBPROC	glGetBufferPointervARB;
 
+// GL_ARB_vertex_array_object
+extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
+extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays;
+extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
+extern PFNGLISVERTEXARRAYPROC glIsVertexArray;
+
 // GL_ARB_sync
 extern PFNGLFENCESYNCPROC				glFenceSync;
 extern PFNGLISSYNCPROC					glIsSync;
@@ -672,6 +695,7 @@ extern PFNGLVERTEXATTRIB4UBVARBPROC glVertexAttrib4ubvARB;
 extern PFNGLVERTEXATTRIB4UIVARBPROC glVertexAttrib4uivARB;
 extern PFNGLVERTEXATTRIB4USVARBPROC glVertexAttrib4usvARB;
 extern PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB;
+extern PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer;
 extern PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB;
 extern PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB;
 extern PFNGLPROGRAMSTRINGARBPROC glProgramStringARB;
@@ -735,6 +759,12 @@ extern PFNGLTEXIMAGE3DMULTISAMPLEPROC glTexImage3DMultisample;
 extern PFNGLGETMULTISAMPLEFVPROC glGetMultisamplefv;
 extern PFNGLSAMPLEMASKIPROC glSampleMaski;
 
+//GL_ARB_debug_output
+extern PFNGLDEBUGMESSAGECONTROLARBPROC glDebugMessageControlARB;
+extern PFNGLDEBUGMESSAGEINSERTARBPROC glDebugMessageInsertARB;
+extern PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB;
+extern PFNGLGETDEBUGMESSAGELOGARBPROC glGetDebugMessageLogARB;
+
 #elif LL_DARWIN
 //----------------------------------------------------------------------------
 // LL_DARWIN
@@ -899,6 +929,31 @@ extern void glGetBufferPointervARB (GLenum, GLenum, GLvoid* *);
 #endif /* GL_GLEXT_FUNCTION_POINTERS */
 #endif
 
+#ifndef GL_ARB_texture_rg
+#define GL_RG                             0x8227
+#define GL_RG_INTEGER                     0x8228
+#define GL_R8                             0x8229
+#define GL_R16                            0x822A
+#define GL_RG8                            0x822B
+#define GL_RG16                           0x822C
+#define GL_R16F                           0x822D
+#define GL_R32F                           0x822E
+#define GL_RG16F                          0x822F
+#define GL_RG32F                          0x8230
+#define GL_R8I                            0x8231
+#define GL_R8UI                           0x8232
+#define GL_R16I                           0x8233
+#define GL_R16UI                          0x8234
+#define GL_R32I                           0x8235
+#define GL_R32UI                          0x8236
+#define GL_RG8I                           0x8237
+#define GL_RG8UI                          0x8238
+#define GL_RG16I                          0x8239
+#define GL_RG16UI                         0x823A
+#define GL_RG32I                          0x823B
+#define GL_RG32UI                         0x823C
+#endif
+
 // May be needed for DARWIN...
 // #ifndef GL_ARB_compressed_tex_image
 // #define GL_ARB_compressed_tex_image 1
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index f51d83abe486442aa2b17e067993b4913e08d525..4b7e639aed38da9f71478844dd993d983c8a424e 100644
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -31,6 +31,7 @@
 #include "llshadermgr.h"
 #include "llfile.h"
 #include "llrender.h"
+#include "llvertexbuffer.h"
 
 #if LL_DARWIN
 #include "OpenGL/OpenGL.h"
@@ -50,6 +51,7 @@ using std::string;
 
 GLhandleARB LLGLSLShader::sCurBoundShader = 0;
 LLGLSLShader* LLGLSLShader::sCurBoundShaderPtr = NULL;
+S32 LLGLSLShader::sIndexedTextureChannels = 0;
 bool LLGLSLShader::sNoFixedFunction = false;
 
 //UI shader -- declared here so llui_libtest will link properly
@@ -62,10 +64,23 @@ BOOL shouldChange(const LLVector4& v1, const LLVector4& v2)
 }
 
 LLShaderFeatures::LLShaderFeatures()
-: calculatesLighting(false), isShiny(false), isFullbright(false), hasWaterFog(false),
-hasTransport(false), hasSkinning(false), hasObjectSkinning(false), hasAtmospherics(false), isSpecular(false),
-hasGamma(false), hasLighting(false), calculatesAtmospherics(false), mIndexedTextureChannels(0), disableTextureIndex(false),
-hasAlphaMask(false)
+	: atmosphericHelpers(false)
+	, calculatesLighting(false)
+	, calculatesAtmospherics(false)
+	, hasLighting(false)
+	, isAlphaLighting(false)
+	, isShiny(false)
+	, isFullbright(false)
+	, isSpecular(false)
+	, hasWaterFog(false)
+	, hasTransport(false)
+	, hasSkinning(false)
+	, hasObjectSkinning(false)
+	, hasAtmospherics(false)
+	, hasGamma(false)
+	, mIndexedTextureChannels(0)
+	, disableTextureIndex(false)
+	, hasAlphaMask(false)
 {
 }
 
@@ -75,6 +90,7 @@ hasAlphaMask(false)
 LLGLSLShader::LLGLSLShader()
 	: mProgramObject(0), mActiveTextureChannels(0), mShaderLevel(0), mShaderGroup(SG_DEFAULT), mUniformsDirty(FALSE)
 {
+
 }
 
 void LLGLSLShader::unload()
@@ -93,7 +109,12 @@ void LLGLSLShader::unload()
 		glGetAttachedObjectsARB(mProgramObject, 1024, &count, obj);
 		for (GLsizei i = 0; i < count; i++)
 		{
-			glDeleteObjectARB(obj[i]);
+#if !LL_DARWIN
+			if (glIsProgramARB(obj[i]))
+#endif
+			{
+				glDeleteObjectARB(obj[i]);
+			}
 		}
 
 		glDeleteObjectARB(mProgramObject);
@@ -110,17 +131,19 @@ void LLGLSLShader::unload()
 BOOL LLGLSLShader::createShader(vector<string> * attributes,
 								vector<string> * uniforms)
 {
+	//reloading, reset matrix hash values
+	for (U32 i = 0; i < LLRender::NUM_MATRIX_MODES; ++i)
+	{
+		mMatHash[i] = 0xFFFFFFFF;
+	}
+	mLightHash = 0xFFFFFFFF;
+
 	llassert_always(!mShaderFiles.empty());
 	BOOL success = TRUE;
 
 	// Create program
 	mProgramObject = glCreateProgramObjectARB();
 	
-	if (gGLManager.mGLVersion < 3.1f)
-	{ //force indexed texture channels to 1 if GL version is old (performance improvement for drivers with poor branching shader model support)
-		mFeatures.mIndexedTextureChannels = llmin(mFeatures.mIndexedTextureChannels, 1);
-	}
-
 	//compile new source
 	vector< pair<string,GLenum> >::iterator fileIter = mShaderFiles.begin();
 	for ( ; fileIter != mShaderFiles.end(); fileIter++ )
@@ -143,8 +166,9 @@ BOOL LLGLSLShader::createShader(vector<string> * attributes,
 		return FALSE;
 	}
 
-	if (gGLManager.mGLVersion < 3.1f)
-	{ //attachShaderFeatures may have set the number of indexed texture channels, so set to 1 again
+	if (gGLManager.mGLSLVersionMajor < 2 && gGLManager.mGLSLVersionMinor < 3)
+	{ //indexed texture rendering requires GLSL 1.3 or later
+		//attachShaderFeatures may have set the number of indexed texture channels, so set to 1 again
 		mFeatures.mIndexedTextureChannels = llmin(mFeatures.mIndexedTextureChannels, 1);
 	}
 
@@ -235,6 +259,13 @@ void LLGLSLShader::attachObjects(GLhandleARB* objects, S32 count)
 
 BOOL LLGLSLShader::mapAttributes(const vector<string> * attributes)
 {
+	//before linking, make sure reserved attributes always have consistent locations
+	for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++)
+	{
+		const char* name = LLShaderMgr::instance()->mReservedAttribs[i].c_str();
+		glBindAttribLocationARB(mProgramObject, i, (const GLcharARB *) name);
+	}
+	
 	//link the program
 	BOOL res = link();
 
@@ -308,7 +339,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector<string> * uniforms)
 		for (S32 i = 0; i < (S32) LLShaderMgr::instance()->mReservedUniforms.size(); i++)
 		{
 			if ( (mUniform[i] == -1)
-				&& (LLShaderMgr::instance()->mReservedUniforms[i].compare(0, length, name, LLShaderMgr::instance()->mReservedUniforms[i].length()) == 0))
+				&& (LLShaderMgr::instance()->mReservedUniforms[i] == name))
 			{
 				//found it
 				mUniform[i] = location;
@@ -322,7 +353,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector<string> * uniforms)
 			for (U32 i = 0; i < uniforms->size(); i++)
 			{
 				if ( (mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] == -1)
-					&& ((*uniforms)[i].compare(0, length, name, (*uniforms)[i].length()) == 0))
+					&& ((*uniforms)[i] == name))
 				{
 					//found it
 					mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] = location;
@@ -386,6 +417,7 @@ void LLGLSLShader::bind()
 	gGL.flush();
 	if (gGLManager.mHasShaderObjects)
 	{
+		LLVertexBuffer::unbind();
 		glUseProgramObjectARB(mProgramObject);
 		sCurBoundShader = mProgramObject;
 		sCurBoundShaderPtr = this;
@@ -411,6 +443,7 @@ void LLGLSLShader::unbind()
 				stop_glerror();
 			}
 		}
+		LLVertexBuffer::unbind();
 		glUseProgramObjectARB(0);
 		sCurBoundShader = 0;
 		sCurBoundShaderPtr = NULL;
@@ -420,9 +453,13 @@ void LLGLSLShader::unbind()
 
 void LLGLSLShader::bindNoShader(void)
 {
-	glUseProgramObjectARB(0);
-	sCurBoundShader = 0;
-	sCurBoundShaderPtr = NULL;
+	LLVertexBuffer::unbind();
+	if (gGLManager.mHasShaderObjects)
+	{
+		glUseProgramObjectARB(0);
+		sCurBoundShader = 0;
+		sCurBoundShaderPtr = NULL;
+	}
 }
 
 S32 LLGLSLShader::enableTexture(S32 uniform, LLTexUnit::eTextureType mode)
@@ -768,13 +805,17 @@ GLint LLGLSLShader::getUniformLocation(const string& uniform)
 		}
 	}
 
-	/*if (gDebugGL)
+	return ret;
+}
+
+GLint LLGLSLShader::getUniformLocation(U32 index)
+{
+	GLint ret = -1;
+	if (mProgramObject > 0)
 	{
-		if (ret == -1 && ret != glGetUniformLocationARB(mProgramObject, uniform.c_str()))
-		{
-			llerrs << "Uniform map invalid." << llendl;
-		}
-	}*/
+		llassert(index < mUniform.size());
+		return mUniform[index];
+	}
 
 	return ret;
 }
@@ -930,7 +971,9 @@ void LLGLSLShader::uniform4fv(const string& uniform, U32 count, const GLfloat* v
 		std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
 		if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
 		{
+			stop_glerror();
 			glUniform4fvARB(location, count, v);
+			stop_glerror();
 			mValue[location] = vec;
 		}
 	}
@@ -985,8 +1028,8 @@ void LLGLSLShader::vertexAttrib4fv(U32 index, GLfloat* v)
 	}
 }
 
-void LLGLSLShader::setAlphaRange(F32 minimum, F32 maximum)
+void LLGLSLShader::setMinimumAlpha(F32 minimum)
 {
-	uniform1f("minimum_alpha", minimum);
-	uniform1f("maximum_alpha", maximum);
+	gGL.flush();
+	uniform1f(LLShaderMgr::MINIMUM_ALPHA, minimum);
 }
diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h
index 558ea66b50f7bd10d6c74377914e893ec62412b2..7873fe3c4ee8e8d27bc0834a82f4fe5c70442d23 100644
--- a/indra/llrender/llglslshader.h
+++ b/indra/llrender/llglslshader.h
@@ -33,9 +33,11 @@
 class LLShaderFeatures
 {
 public:
+	bool atmosphericHelpers;
 	bool calculatesLighting;
 	bool calculatesAtmospherics;
 	bool hasLighting; // implies no transport (it's possible to have neither though)
+	bool isAlphaLighting; // indicates lighting shaders need not be linked in (lighting performed directly in alpha shader to match deferred lighting functions)
 	bool isShiny;
 	bool isFullbright; // implies no lighting
 	bool isSpecular;
@@ -69,7 +71,7 @@ class LLGLSLShader
 
 	static GLhandleARB sCurBoundShader;
 	static LLGLSLShader* sCurBoundShaderPtr;
-
+	static S32 sIndexedTextureChannels;
 	static bool sNoFixedFunction;
 
 	void unload();
@@ -108,16 +110,17 @@ class LLGLSLShader
 	void uniformMatrix3fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v);
 	void uniformMatrix4fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v);
 
-	void setAlphaRange(F32 minimum, F32 maximum);
+	void setMinimumAlpha(F32 minimum);
 
 	void vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
 	void vertexAttrib4fv(U32 index, GLfloat* v);
 	
 	GLint getUniformLocation(const std::string& uniform);
+	GLint getUniformLocation(U32 index);
+
 	GLint getAttribLocation(U32 attrib);
 	GLint mapUniformTextureChannel(GLint location, GLenum type);
 	
-
 	//enable/disable texture channel for specified uniform
 	//if given texture uniform is active in the shader, 
 	//the corresponding channel will be active upon return
@@ -132,6 +135,9 @@ class LLGLSLShader
 	// Unbinds any previously bound shader by explicitly binding no shader.
 	static void bindNoShader(void);
 
+	U32 mMatHash[LLRender::NUM_MATRIX_MODES];
+	U32 mLightHash;
+
 	GLhandleARB mProgramObject;
 	std::vector<GLint> mAttribute; //lookup table of attribute enum to attribute channel
 	std::vector<GLint> mUniform;   //lookup table of uniform enum to uniform location
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 7188b0fa440666cd39e62e0b0c58ae74d8d4ca4d..78591ddd3849facc642adb7b31b61eca3d9f350d 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -36,7 +36,9 @@
 
 #include "llmath.h"
 #include "llgl.h"
+#include "llglslshader.h"
 #include "llrender.h"
+
 //----------------------------------------------------------------------------
 const F32 MIN_TEXTURE_LIFETIME = 10.f;
 
@@ -725,7 +727,10 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
 		{
 			if (mAutoGenMips)
 			{
-				glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_GENERATE_MIPMAP_SGIS, TRUE);
+				if (!gGLManager.mHasFramebufferObject)
+				{
+					glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_GENERATE_MIPMAP_SGIS, TRUE);
+				}
 				stop_glerror();
 				{
 // 					LLFastTimer t2(FTM_TEMP4);
@@ -754,6 +759,11 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
 						stop_glerror();
 					}
 				}
+
+				if (gGLManager.mHasFramebufferObject)
+				{
+					glGenerateMipmap(LLTexUnit::getInternalType(mBindTarget));
+				}
 			}
 			else
 			{
@@ -875,6 +885,9 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
 
 BOOL LLImageGL::preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image)
 {
+	//not compatible with core GL profile
+	llassert(!LLRender::sGLCoreProfile);
+
 	if (gGLManager.mIsDisabled)
 	{
 		llwarns << "Trying to create a texture while GL is disabled!" << llendl;
@@ -901,29 +914,29 @@ BOOL LLImageGL::preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image)
 	{
 		switch (mComponents)
 		{
-		  case 1:
+			case 1:
 			// Use luminance alpha (for fonts)
 			mFormatInternal = GL_LUMINANCE8;
 			mFormatPrimary = GL_LUMINANCE;
 			mFormatType = GL_UNSIGNED_BYTE;
 			break;
-		  case 2:
+			case 2:
 			// Use luminance alpha (for fonts)
 			mFormatInternal = GL_LUMINANCE8_ALPHA8;
 			mFormatPrimary = GL_LUMINANCE_ALPHA;
 			mFormatType = GL_UNSIGNED_BYTE;
 			break;
-		  case 3:
+			case 3:
 			mFormatInternal = GL_RGB8;
 			mFormatPrimary = GL_RGB;
 			mFormatType = GL_UNSIGNED_BYTE;
 			break;
-		  case 4:
+			case 4:
 			mFormatInternal = GL_RGBA8;
 			mFormatPrimary = GL_RGBA;
 			mFormatType = GL_UNSIGNED_BYTE;
 			break;
-		  default:
+			default:
 			llerrs << "Bad number of components for texture: " << (U32)getComponents() << llendl;
 		}
 	}
@@ -1099,8 +1112,75 @@ void LLImageGL::deleteTextures(S32 numTextures, U32 *textures, bool immediate)
 // static
 void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void *pixels)
 {
-	glTexImage2D(target, miplevel, intformat, width, height, 0, pixformat, pixtype, pixels);
+	bool use_scratch = false;
+	U32* scratch = NULL;
+	if (LLRender::sGLCoreProfile)
+	{
+		if (pixformat == GL_ALPHA && pixtype == GL_UNSIGNED_BYTE) 
+		{ //GL_ALPHA is deprecated, convert to RGBA
+			use_scratch = true;
+			scratch = new U32[width*height];
+
+			U32 pixel_count = (U32) (width*height);
+			for (U32 i = 0; i < pixel_count; i++)
+			{
+				U8* pix = (U8*) &scratch[i];
+				pix[0] = pix[1] = pix[2] = 0;
+				pix[3] = ((U8*) pixels)[i];
+			}				
+			
+			pixformat = GL_RGBA;
+			intformat = GL_RGBA8;
+		}
+
+		if (pixformat == GL_LUMINANCE_ALPHA && pixtype == GL_UNSIGNED_BYTE) 
+		{ //GL_LUMINANCE_ALPHA is deprecated, convert to RGBA
+			use_scratch = true;
+			scratch = new U32[width*height];
+
+			U32 pixel_count = (U32) (width*height);
+			for (U32 i = 0; i < pixel_count; i++)
+			{
+				U8 lum = ((U8*) pixels)[i*2+0];
+				U8 alpha = ((U8*) pixels)[i*2+1];
+
+				U8* pix = (U8*) &scratch[i];
+				pix[0] = pix[1] = pix[2] = lum;
+				pix[3] = alpha;
+			}				
+			
+			pixformat = GL_RGBA;
+			intformat = GL_RGBA8;
+		}
+
+		if (pixformat == GL_LUMINANCE && pixtype == GL_UNSIGNED_BYTE) 
+		{ //GL_LUMINANCE_ALPHA is deprecated, convert to RGB
+			use_scratch = true;
+			scratch = new U32[width*height];
+
+			U32 pixel_count = (U32) (width*height);
+			for (U32 i = 0; i < pixel_count; i++)
+			{
+				U8 lum = ((U8*) pixels)[i];
+				
+				U8* pix = (U8*) &scratch[i];
+				pix[0] = pix[1] = pix[2] = lum;
+				pix[3] = 255;
+			}				
+			
+			pixformat = GL_RGBA;
+			intformat = GL_RGB8;
+		}
+	}
+
 	stop_glerror();
+	glTexImage2D(target, miplevel, intformat, width, height, 0, pixformat, pixtype, use_scratch ? scratch : pixels);
+	stop_glerror();
+
+	if (use_scratch)
+	{
+		delete [] scratch;
+	}
 }
 
 //create an empty GL texture: just create a texture name
@@ -1167,29 +1247,29 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S
 	{
 		switch (mComponents)
 		{
-		  case 1:
+			case 1:
 			// Use luminance alpha (for fonts)
 			mFormatInternal = GL_LUMINANCE8;
 			mFormatPrimary = GL_LUMINANCE;
 			mFormatType = GL_UNSIGNED_BYTE;
 			break;
-		  case 2:
+			case 2:
 			// Use luminance alpha (for fonts)
 			mFormatInternal = GL_LUMINANCE8_ALPHA8;
 			mFormatPrimary = GL_LUMINANCE_ALPHA;
 			mFormatType = GL_UNSIGNED_BYTE;
 			break;
-		  case 3:
+			case 3:
 			mFormatInternal = GL_RGB8;
 			mFormatPrimary = GL_RGB;
 			mFormatType = GL_UNSIGNED_BYTE;
 			break;
-		  case 4:
+			case 4:
 			mFormatInternal = GL_RGBA8;
 			mFormatPrimary = GL_RGBA;
 			mFormatType = GL_UNSIGNED_BYTE;
 			break;
-		  default:
+			default:
 			llerrs << "Bad number of components for texture: " << (U32)getComponents() << llendl;
 		}
 
@@ -1212,6 +1292,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S
 BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_hasmips, S32 usename)
 {
 	llassert(data_in);
+	stop_glerror();
 
 	if (discard_level < 0)
 	{
@@ -1240,8 +1321,11 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_
 		stop_glerror();
 		{
 			llverify(gGL.getTexUnit(0)->bind(this));
+			stop_glerror();
 			glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_BASE_LEVEL, 0);
+			stop_glerror();
 			glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_MAX_LEVEL,  mMaxDiscardLevel-discard_level);
+			stop_glerror();
 		}
 	}
 	if (!mTexName)
@@ -1754,7 +1838,7 @@ void LLImageGL::analyzeAlpha(const void* data_in, U32 w, U32 h)
 	// this to be an intentional effect and don't treat as a mask.
 
 	U32 midrangetotal = 0;
-	for (U32 i = 4; i < 11; i++)
+	for (U32 i = 2; i < 13; i++)
 	{
 		midrangetotal += sample[i];
 	}
@@ -1769,7 +1853,7 @@ void LLImageGL::analyzeAlpha(const void* data_in, U32 w, U32 h)
 		upperhalftotal += sample[i];
 	}
 
-	if (midrangetotal > length/16 || // lots of midrange, or
+	if (midrangetotal > length/48 || // lots of midrange, or
 	    (lowerhalftotal == length && alphatotal != 0) || // all close to transparent but not all totally transparent, or
 	    (upperhalftotal == length && alphatotal != 255*length)) // all close to opaque but not all totally opaque
 	{
diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp
index d76b2d90048a67b55e4feb03909c40e1bb7de6d2..c0045c80447bd22dd940d9ae39a149c558f8261e 100644
--- a/indra/llrender/llpostprocess.cpp
+++ b/indra/llrender/llpostprocess.cpp
@@ -466,21 +466,21 @@ void LLPostProcess::drawOrthoQuad(unsigned int width, unsigned int height, QuadT
 
 void LLPostProcess::viewOrthogonal(unsigned int width, unsigned int height)
 {
-	glMatrixMode(GL_PROJECTION);
-	glPushMatrix();
-	glLoadIdentity();
-	glOrtho( 0.f, (GLdouble) width , (GLdouble) height , 0.f, -1.f, 1.f );
-	glMatrixMode(GL_MODELVIEW);
-	glPushMatrix();
-	glLoadIdentity();
+	gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.pushMatrix();
+	gGL.loadIdentity();
+	gGL.ortho( 0.f, (GLdouble) width , (GLdouble) height , 0.f, -1.f, 1.f );
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
+	gGL.pushMatrix();
+	gGL.loadIdentity();
 }
 
 void LLPostProcess::viewPerspective(void)
 {
-	glMatrixMode( GL_PROJECTION );
-	glPopMatrix();
-	glMatrixMode( GL_MODELVIEW );
-	glPopMatrix();
+	gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.popMatrix();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
+	gGL.popMatrix();
 }
 
 void LLPostProcess::changeOrthogonal(unsigned int width, unsigned int height)
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index edcc47aa1471ab65ddd90506c0c562e3c2c0d1c2..b0ddacbb05c8dd872ffbfde26501f61639dc0f45 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -1,4 +1,4 @@
-/** 
+ /** 
  * @file llrender.cpp
  * @brief LLRender implementation
  *
@@ -34,19 +34,21 @@
 #include "llimagegl.h"
 #include "llrendertarget.h"
 #include "lltexture.h"
+#include "llshadermgr.h"
 
 LLRender gGL;
 
 // Handy copies of last good GL matrices
-F64	gGLModelView[16];
-F64	gGLLastModelView[16];
-F64 gGLLastProjection[16];
-F64 gGLProjection[16];
+F32	gGLModelView[16];
+F32	gGLLastModelView[16];
+F32 gGLLastProjection[16];
+F32 gGLProjection[16];
 S32	gGLViewport[4];
 
 U32 LLRender::sUICalls = 0;
 U32 LLRender::sUIVerts = 0;
 U32 LLTexUnit::sWhiteTexture = 0;
+bool LLRender::sGLCoreProfile = false;
 
 static const U32 LL_NUM_TEXTURE_LAYERS = 32; 
 static const U32 LL_NUM_LIGHT_UNITS = 8;
@@ -178,10 +180,13 @@ void LLTexUnit::enable(eTextureType type)
 
 	if ( (mCurrTexType != type || gGL.mDirty) && (type != TT_NONE) )
 	{
+		stop_glerror();
 		activate();
+		stop_glerror();
 		if (mCurrTexType != TT_NONE && !gGL.mDirty)
 		{
 			disable(); // Force a disable of a previous texture type if it's enabled.
+			stop_glerror();
 		}
 		mCurrTexType = type;
 
@@ -190,7 +195,9 @@ void LLTexUnit::enable(eTextureType type)
 			type != LLTexUnit::TT_MULTISAMPLE_TEXTURE &&
 			mIndex < gGLManager.mNumTextureUnits)
 		{
+			stop_glerror();
 			glEnable(sGLTextureType[type]);
+			stop_glerror();
 		}
 	}
 }
@@ -286,26 +293,35 @@ bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind)
 		{
 			return bind(LLImageGL::sDefaultGLTexture) ;
 		}
+		stop_glerror();
 		return false ;
 	}
 
 	if ((mCurrTexture != texture->getTexName()) || forceBind)
 	{
 		gGL.flush();
+		stop_glerror();
 		activate();
+		stop_glerror();
 		enable(texture->getTarget());
+		stop_glerror();
 		mCurrTexture = texture->getTexName();
 		glBindTexture(sGLTextureType[texture->getTarget()], mCurrTexture);
+		stop_glerror();
 		texture->updateBindStats(texture->mTextureMemory);		
 		mHasMipMaps = texture->mHasMipMaps;
 		if (texture->mTexOptionsDirty)
 		{
+			stop_glerror();
 			texture->mTexOptionsDirty = false;
 			setTextureAddressMode(texture->mAddressMode);
 			setTextureFilteringOption(texture->mFilterOption);
+			stop_glerror();
 		}
 	}
 
+	stop_glerror();
+
 	return true;
 }
 
@@ -814,14 +830,16 @@ LLLightState::LLLightState(S32 index)
 	mAmbient.set(0,0,0,1);
 	mPosition.set(0,0,1,0);
 	mSpotDirection.set(0,0,-1);
-
 }
 
 void LLLightState::enable()
 {
 	if (!mEnabled)
 	{
-		glEnable(GL_LIGHT0+mIndex);
+		if (!LLGLSLShader::sNoFixedFunction)
+		{
+			glEnable(GL_LIGHT0+mIndex);
+		}
 		mEnabled = true;
 	}
 }
@@ -830,7 +848,10 @@ void LLLightState::disable()
 {
 	if (mEnabled)
 	{
-		glDisable(GL_LIGHT0+mIndex);
+		if (!LLGLSLShader::sNoFixedFunction)
+		{
+			glDisable(GL_LIGHT0+mIndex);
+		}
 		mEnabled = false;
 	}
 }
@@ -839,8 +860,12 @@ void LLLightState::setDiffuse(const LLColor4& diffuse)
 {
 	if (mDiffuse != diffuse)
 	{
+		++gGL.mLightHash;
 		mDiffuse = diffuse;
-		glLightfv(GL_LIGHT0+mIndex, GL_DIFFUSE, mDiffuse.mV);
+		if (!LLGLSLShader::sNoFixedFunction)
+		{
+			glLightfv(GL_LIGHT0+mIndex, GL_DIFFUSE, mDiffuse.mV);
+		}
 	}
 }
 
@@ -848,8 +873,12 @@ void LLLightState::setAmbient(const LLColor4& ambient)
 {
 	if (mAmbient != ambient)
 	{
+		++gGL.mLightHash;
 		mAmbient = ambient;
-		glLightfv(GL_LIGHT0+mIndex, GL_AMBIENT, mAmbient.mV);
+		if (!LLGLSLShader::sNoFixedFunction)
+		{
+			glLightfv(GL_LIGHT0+mIndex, GL_AMBIENT, mAmbient.mV);
+		}
 	}
 }
 
@@ -857,16 +886,34 @@ void LLLightState::setSpecular(const LLColor4& specular)
 {
 	if (mSpecular != specular)
 	{
+		++gGL.mLightHash;
 		mSpecular = specular;
-		glLightfv(GL_LIGHT0+mIndex, GL_SPECULAR, mSpecular.mV);
+		if (!LLGLSLShader::sNoFixedFunction)
+		{
+			glLightfv(GL_LIGHT0+mIndex, GL_SPECULAR, mSpecular.mV);
+		}
 	}
 }
 
 void LLLightState::setPosition(const LLVector4& position)
 {
 	//always set position because modelview matrix may have changed
+	++gGL.mLightHash;
 	mPosition = position;
-	glLightfv(GL_LIGHT0+mIndex, GL_POSITION, mPosition.mV);
+	if (!LLGLSLShader::sNoFixedFunction)
+	{
+		glLightfv(GL_LIGHT0+mIndex, GL_POSITION, mPosition.mV);
+	}
+	else
+	{ //transform position by current modelview matrix
+		glh::vec4f pos(position.mV);
+
+		const glh::matrix4f& mat = gGL.getModelviewMatrix();
+		mat.mult_matrix_vec(pos);
+
+		mPosition.set(pos.v);
+	}
+
 }
 
 void LLLightState::setConstantAttenuation(const F32& atten)
@@ -874,7 +921,11 @@ void LLLightState::setConstantAttenuation(const F32& atten)
 	if (mConstantAtten != atten)
 	{
 		mConstantAtten = atten;
-		glLightf(GL_LIGHT0+mIndex, GL_CONSTANT_ATTENUATION, atten);
+		++gGL.mLightHash;
+		if (!LLGLSLShader::sNoFixedFunction)
+		{
+			glLightf(GL_LIGHT0+mIndex, GL_CONSTANT_ATTENUATION, atten);
+		}
 	}
 }
 
@@ -882,8 +933,12 @@ void LLLightState::setLinearAttenuation(const F32& atten)
 {
 	if (mLinearAtten != atten)
 	{
+		++gGL.mLightHash;
 		mLinearAtten = atten;
-		glLightf(GL_LIGHT0+mIndex, GL_LINEAR_ATTENUATION, atten);
+		if (!LLGLSLShader::sNoFixedFunction)
+		{
+			glLightf(GL_LIGHT0+mIndex, GL_LINEAR_ATTENUATION, atten);
+		}
 	}
 }
 
@@ -891,8 +946,12 @@ void LLLightState::setQuadraticAttenuation(const F32& atten)
 {
 	if (mQuadraticAtten != atten)
 	{
+		++gGL.mLightHash;
 		mQuadraticAtten = atten;
-		glLightf(GL_LIGHT0+mIndex, GL_QUADRATIC_ATTENUATION, atten);
+		if (!LLGLSLShader::sNoFixedFunction)
+		{
+			glLightf(GL_LIGHT0+mIndex, GL_QUADRATIC_ATTENUATION, atten);
+		}
 	}
 }
 
@@ -900,8 +959,12 @@ void LLLightState::setSpotExponent(const F32& exponent)
 {
 	if (mSpotExponent != exponent)
 	{
+		++gGL.mLightHash;
 		mSpotExponent = exponent;
-		glLightf(GL_LIGHT0+mIndex, GL_SPOT_EXPONENT, exponent);
+		if (!LLGLSLShader::sNoFixedFunction)
+		{
+			glLightf(GL_LIGHT0+mIndex, GL_SPOT_EXPONENT, exponent);
+		}
 	}
 }
 
@@ -909,21 +972,39 @@ void LLLightState::setSpotCutoff(const F32& cutoff)
 {
 	if (mSpotCutoff != cutoff)
 	{
+		++gGL.mLightHash;
 		mSpotCutoff = cutoff;
-		glLightf(GL_LIGHT0+mIndex, GL_SPOT_CUTOFF, cutoff);
+		if (!LLGLSLShader::sNoFixedFunction)
+		{
+			glLightf(GL_LIGHT0+mIndex, GL_SPOT_CUTOFF, cutoff);
+		}
 	}
 }
 
 void LLLightState::setSpotDirection(const LLVector3& direction)
 {
 	//always set direction because modelview matrix may have changed
+	++gGL.mLightHash;
 	mSpotDirection = direction;
-	glLightfv(GL_LIGHT0+mIndex, GL_SPOT_DIRECTION, direction.mV);
+	if (!LLGLSLShader::sNoFixedFunction)
+	{
+		glLightfv(GL_LIGHT0+mIndex, GL_SPOT_DIRECTION, direction.mV);
+	}
+	else
+	{ //transform direction by current modelview matrix
+		glh::vec3f dir(direction.mV);
+
+		const glh::matrix4f& mat = gGL.getModelviewMatrix();
+		mat.mult_matrix_dir(dir);
+
+		mSpotDirection.set(dir.v);
+	}
 }
 
 LLRender::LLRender()
   : mDirty(false),
     mCount(0),
+	mQuadCycle(0),
     mMode(LLRender::TRIANGLES),
     mCurrTextureUnitIndex(0),
     mMaxAnisotropy(0.f) 
@@ -951,6 +1032,17 @@ LLRender::LLRender()
 	mCurrBlendAlphaSFactor = BF_UNDEF;
 	mCurrBlendColorDFactor = BF_UNDEF;
 	mCurrBlendAlphaDFactor = BF_UNDEF;
+
+	mMatrixMode = LLRender::MM_MODELVIEW;
+	
+	for (U32 i = 0; i < NUM_MATRIX_MODES; ++i)
+	{
+		mMatIdx[i] = 0;
+		mMatHash[i] = 0;
+		mCurMatHash[i] = 0xFFFFFFFF;
+	}
+
+	mLightHash = 0;
 }
 
 LLRender::~LLRender()
@@ -961,12 +1053,13 @@ LLRender::~LLRender()
 void LLRender::init()
 {
 	llassert_always(mBuffer.isNull()) ;
-
+	stop_glerror();
 	mBuffer = new LLVertexBuffer(immediate_mask, 0);
 	mBuffer->allocateBuffer(4096, 0, TRUE);
 	mBuffer->getVertexStrider(mVerticesp);
 	mBuffer->getTexCoord0Strider(mTexcoordsp);
 	mBuffer->getColorStrider(mColorsp);
+	stop_glerror();
 }
 
 void LLRender::shutdown()
@@ -1007,28 +1100,355 @@ void LLRender::refreshState(void)
 	mDirty = false;
 }
 
+void LLRender::syncLightState()
+{
+	LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+
+	if (!shader)
+	{
+		return;
+	}
+
+	if (shader->mLightHash != mLightHash)
+	{
+		shader->mLightHash = mLightHash;
+
+		LLVector4 position[8];
+		LLVector3 direction[8];
+		LLVector3 attenuation[8];
+		LLVector3 diffuse[8];
+
+		for (U32 i = 0; i < 8; i++)
+		{
+			LLLightState* light = mLightState[i];
+
+			position[i] = light->mPosition;
+			direction[i] = light->mSpotDirection;
+			attenuation[i].set(light->mLinearAtten, light->mQuadraticAtten, light->mSpecular.mV[3]);
+			diffuse[i].set(light->mDiffuse.mV);
+		}
+
+		shader->uniform4fv(LLShaderMgr::LIGHT_POSITION, 8, position[0].mV);
+		shader->uniform3fv(LLShaderMgr::LIGHT_DIRECTION, 8, direction[0].mV);
+		shader->uniform3fv(LLShaderMgr::LIGHT_ATTENUATION, 8, attenuation[0].mV);
+		shader->uniform3fv(LLShaderMgr::LIGHT_DIFFUSE, 8, diffuse[0].mV);
+		shader->uniform4fv(LLShaderMgr::LIGHT_AMBIENT, 1, mAmbientLightColor.mV);
+		//HACK -- duplicate sunlight color for compatibility with drivers that can't deal with multiple shader objects referencing the same uniform
+		shader->uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, diffuse[0].mV);
+	}
+}
+
+void LLRender::syncMatrices()
+{
+	stop_glerror();
+
+	U32 name[] = 
+	{
+		LLShaderMgr::MODELVIEW_MATRIX,
+		LLShaderMgr::PROJECTION_MATRIX,
+		LLShaderMgr::TEXTURE_MATRIX0,
+		LLShaderMgr::TEXTURE_MATRIX1,
+		LLShaderMgr::TEXTURE_MATRIX2,
+		LLShaderMgr::TEXTURE_MATRIX3,
+	};
+
+	LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+
+	static glh::matrix4f cached_mvp;
+	static U32 cached_mvp_mdv_hash = 0xFFFFFFFF;
+	static U32 cached_mvp_proj_hash = 0xFFFFFFFF;
+	
+	static glh::matrix4f cached_normal;
+	static U32 cached_normal_hash = 0xFFFFFFFF;
+
+	if (shader)
+	{
+		llassert(shader);
+
+		bool mvp_done = false;
+
+		U32 i = MM_MODELVIEW;
+		if (mMatHash[i] != shader->mMatHash[i])
+		{ //update modelview, normal, and MVP
+			glh::matrix4f& mat = mMatrix[i][mMatIdx[i]];
+
+			shader->uniformMatrix4fv(name[i], 1, GL_FALSE, mat.m);
+			shader->mMatHash[i] = mMatHash[i];
+
+			//update normal matrix
+			S32 loc = shader->getUniformLocation(LLShaderMgr::NORMAL_MATRIX);
+			if (loc > -1)
+			{
+				if (cached_normal_hash != mMatHash[i])
+				{
+					cached_normal = mat.inverse().transpose();
+					cached_normal_hash = mMatHash[i];
+				}
+
+				glh::matrix4f& norm = cached_normal;
+
+				F32 norm_mat[] = 
+				{
+					norm.m[0], norm.m[1], norm.m[2],
+					norm.m[4], norm.m[5], norm.m[6],
+					norm.m[8], norm.m[9], norm.m[10] 
+				};
+
+				shader->uniformMatrix3fv(LLShaderMgr::NORMAL_MATRIX, 1, GL_FALSE, norm_mat);
+			}
+
+			//update MVP matrix
+			mvp_done = true;
+			loc = shader->getUniformLocation(LLShaderMgr::MODELVIEW_PROJECTION_MATRIX);
+			if (loc > -1)
+			{
+				U32 proj = MM_PROJECTION;
+
+				if (cached_mvp_mdv_hash != mMatHash[i] || cached_mvp_proj_hash != mMatHash[MM_PROJECTION])
+				{
+					cached_mvp = mat;
+					cached_mvp.mult_left(mMatrix[proj][mMatIdx[proj]]);
+					cached_mvp_mdv_hash = mMatHash[i];
+					cached_mvp_proj_hash = mMatHash[MM_PROJECTION];
+				}
+
+				shader->uniformMatrix4fv(LLShaderMgr::MODELVIEW_PROJECTION_MATRIX, 1, GL_FALSE, cached_mvp.m);
+			}
+		}
+
+
+		i = MM_PROJECTION;
+		if (mMatHash[i] != shader->mMatHash[i])
+		{ //update projection matrix, normal, and MVP
+			glh::matrix4f& mat = mMatrix[i][mMatIdx[i]];
+
+			shader->uniformMatrix4fv(name[i], 1, GL_FALSE, mat.m);
+			shader->mMatHash[i] = mMatHash[i];
+
+			if (!mvp_done)
+			{
+				//update MVP matrix
+				S32 loc = shader->getUniformLocation(LLShaderMgr::MODELVIEW_PROJECTION_MATRIX);
+				if (loc > -1)
+				{
+					if (cached_mvp_mdv_hash != mMatHash[i] || cached_mvp_proj_hash != mMatHash[MM_PROJECTION])
+					{
+						U32 mdv = MM_MODELVIEW;
+						cached_mvp = mat;
+						cached_mvp.mult_right(mMatrix[mdv][mMatIdx[mdv]]);
+						cached_mvp_mdv_hash = mMatHash[MM_MODELVIEW];
+						cached_mvp_proj_hash = mMatHash[MM_PROJECTION];
+					}
+									
+					shader->uniformMatrix4fv(LLShaderMgr::MODELVIEW_PROJECTION_MATRIX, 1, GL_FALSE, cached_mvp.m);
+				}
+			}
+		}
+
+		for (i = MM_TEXTURE0; i < NUM_MATRIX_MODES; ++i)
+		{
+			if (mMatHash[i] != shader->mMatHash[i])
+			{
+				shader->uniformMatrix4fv(name[i], 1, GL_FALSE, mMatrix[i][mMatIdx[i]].m);
+				shader->mMatHash[i] = mMatHash[i];
+			}
+		}
+
+
+		if (shader->mFeatures.hasLighting || shader->mFeatures.calculatesLighting)
+		{ //also sync light state
+			syncLightState();
+		}
+	}
+	else if (!LLGLSLShader::sNoFixedFunction)
+	{
+		GLenum mode[] = 
+		{
+			GL_MODELVIEW,
+			GL_PROJECTION,
+			GL_TEXTURE,
+			GL_TEXTURE,
+			GL_TEXTURE,
+			GL_TEXTURE,
+		};
+
+		for (U32 i = 0; i < 2; ++i)
+		{
+			if (mMatHash[i] != mCurMatHash[i])
+			{
+				glMatrixMode(mode[i]);
+				glLoadMatrixf(mMatrix[i][mMatIdx[i]].m);
+				mCurMatHash[i] = mMatHash[i];
+			}
+		}
+
+		for (U32 i = 2; i < NUM_MATRIX_MODES; ++i)
+		{
+			if (mMatHash[i] != mCurMatHash[i])
+			{
+				gGL.getTexUnit(i-2)->activate();
+				glMatrixMode(mode[i]);
+				glLoadMatrixf(mMatrix[i][mMatIdx[i]].m);
+				mCurMatHash[i] = mMatHash[i];
+			}
+		}
+	}
+
+	stop_glerror();
+}
+
 void LLRender::translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z)
 {
 	flush();
-	glTranslatef(x,y,z);
+
+	{
+		glh::matrix4f trans_mat(1,0,0,x,
+								0,1,0,y,
+								0,0,1,z,
+								0,0,0,1);
+	
+		mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].mult_right(trans_mat);
+		mMatHash[mMatrixMode]++;
+	}
 }
 
 void LLRender::scalef(const GLfloat& x, const GLfloat& y, const GLfloat& z)
 {
 	flush();
-	glScalef(x,y,z);
+	
+	{
+		glh::matrix4f scale_mat(x,0,0,0,
+								0,y,0,0,
+								0,0,z,0,
+								0,0,0,1);
+	
+		mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].mult_right(scale_mat);
+		mMatHash[mMatrixMode]++;
+	}
+}
+
+void LLRender::ortho(F32 left, F32 right, F32 bottom, F32 top, F32 zNear, F32 zFar)
+{
+	flush();
+
+	{
+
+		glh::matrix4f ortho_mat(2.f/(right-left),0,0,	-(right+left)/(right-left),
+								0,2.f/(top-bottom),0,	-(top+bottom)/(top-bottom),
+								0,0,-2.f/(zFar-zNear),	-(zFar+zNear)/(zFar-zNear),
+								0,0,0,1);
+	
+		mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].mult_right(ortho_mat);
+		mMatHash[mMatrixMode]++;
+	}
+}
+
+void LLRender::rotatef(const GLfloat& a, const GLfloat& x, const GLfloat& y, const GLfloat& z)
+{
+	flush();
+
+	{
+		F32 r = a * DEG_TO_RAD;
+
+		F32 c = cosf(r);
+		F32 s = sinf(r);
+
+		F32 ic = 1.f-c;
+
+		glh::matrix4f rot_mat(x*x*ic+c,		x*y*ic-z*s,		x*z*ic+y*s,		0,
+							  x*y*ic+z*s,	y*y*ic+c,		y*z*ic-x*s,		0,
+							  x*z*ic-y*s,	y*z*ic+x*s,		z*z*ic+c,		0,
+							  0,0,0,1);
+	
+		mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].mult_right(rot_mat);
+		mMatHash[mMatrixMode]++;
+	}
 }
 
 void LLRender::pushMatrix()
 {
 	flush();
-	glPushMatrix();
+	
+	{
+		if (mMatIdx[mMatrixMode] < LL_MATRIX_STACK_DEPTH-1)
+		{
+			mMatrix[mMatrixMode][mMatIdx[mMatrixMode]+1] = mMatrix[mMatrixMode][mMatIdx[mMatrixMode]];
+			++mMatIdx[mMatrixMode];
+		}
+		else
+		{
+			llwarns << "Matrix stack overflow." << llendl;
+		}
+	}
 }
 
 void LLRender::popMatrix()
 {
 	flush();
-	glPopMatrix();
+	{
+		if (mMatIdx[mMatrixMode] > 0)
+		{
+			--mMatIdx[mMatrixMode];
+			mMatHash[mMatrixMode]++;
+		}
+		else
+		{
+			llwarns << "Matrix stack underflow." << llendl;
+		}
+	}
+}
+
+void LLRender::loadMatrix(const GLfloat* m)
+{
+	flush();
+	{
+		mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].set_value((GLfloat*) m);
+		mMatHash[mMatrixMode]++;
+	}
+}
+
+void LLRender::multMatrix(const GLfloat* m)
+{
+	flush();
+	{
+		glh::matrix4f mat((GLfloat*) m);
+	
+		mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].mult_right(mat);
+		mMatHash[mMatrixMode]++;
+	}
+}
+
+void LLRender::matrixMode(U32 mode)
+{
+	if (mode == MM_TEXTURE)
+	{
+		mode = MM_TEXTURE0 + gGL.getCurrentTexUnitIndex();
+	}
+
+	llassert(mode < NUM_MATRIX_MODES);
+	mMatrixMode = mode;
+}
+
+void LLRender::loadIdentity()
+{
+	flush();
+
+	{
+		llassert_always(mMatrixMode < NUM_MATRIX_MODES) ;
+
+		mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].make_identity();
+		mMatHash[mMatrixMode]++;
+	}
+}
+
+const glh::matrix4f& LLRender::getModelviewMatrix()
+{
+	return mMatrix[MM_MODELVIEW][mMatIdx[MM_MODELVIEW]];
+}
+
+const glh::matrix4f& LLRender::getProjectionMatrix()
+{
+	return mMatrix[MM_PROJECTION][mMatIdx[MM_PROJECTION]];
 }
 
 void LLRender::translateUI(F32 x, F32 y, F32 z)
@@ -1284,6 +1704,19 @@ LLLightState* LLRender::getLight(U32 index)
 	return NULL;
 }
 
+void LLRender::setAmbientLightColor(const LLColor4& color)
+{
+	if (color != mAmbientLightColor)
+	{
+		++mLightHash;
+		mAmbientLightColor = color;
+		if (!LLGLSLShader::sNoFixedFunction)
+		{
+			glLightModelfv(GL_LIGHT_MODEL_AMBIENT, color.mV);
+		}
+	}
+}
+
 bool LLRender::verifyTexUnitActive(U32 unitToVerify)
 {
 	if (mCurrTextureUnitIndex == unitToVerify)
@@ -1309,6 +1742,11 @@ void LLRender::begin(const GLuint& mode)
 {
 	if (mode != mMode)
 	{
+		if (mode == LLRender::QUADS)
+		{
+			mQuadCycle = 1;
+		}
+
 		if (mMode == LLRender::QUADS ||
 			mMode == LLRender::LINES ||
 			mMode == LLRender::TRIANGLES ||
@@ -1396,7 +1834,7 @@ void LLRender::flush()
 		
 		if (gDebugGL)
 		{
-			if (mMode == LLRender::QUADS)
+			if (mMode == LLRender::QUADS && !sGLCoreProfile)
 			{
 				if (mCount%4 != 0)
 				{
@@ -1421,12 +1859,34 @@ void LLRender::flush()
 			}
 		}
 
+		//store mCount in a local variable to avoid re-entrance (drawArrays may call flush)
+		U32 count = mCount;
+		mCount = 0;
+
+		if (mBuffer->useVBOs() && !mBuffer->isLocked())
+		{ //hack to only flush the part of the buffer that was updated (relies on stream draw using buffersubdata)
+			mBuffer->getVertexStrider(mVerticesp, 0, count);
+			mBuffer->getTexCoord0Strider(mTexcoordsp, 0, count);
+			mBuffer->getColorStrider(mColorsp, 0, count);
+		}
+		
+		mBuffer->flush();
 		mBuffer->setBuffer(immediate_mask);
-		mBuffer->drawArrays(mMode, 0, mCount);
+
+		if (mMode == LLRender::QUADS && sGLCoreProfile)
+		{
+			mBuffer->drawArrays(LLRender::TRIANGLES, 0, count);
+			mQuadCycle = 1;
+		}
+		else
+		{
+			mBuffer->drawArrays(mMode, 0, count);
+		}
+		
+		mVerticesp[0] = mVerticesp[count];
+		mTexcoordsp[0] = mTexcoordsp[count];
+		mColorsp[0] = mColorsp[count];
 		
-		mVerticesp[0] = mVerticesp[mCount];
-		mTexcoordsp[0] = mTexcoordsp[mCount];
-		mColorsp[0] = mColorsp[mCount];
 		mCount = 0;
 	}
 }
@@ -1434,6 +1894,17 @@ void LLRender::flush()
 void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z)
 { 
 	//the range of mVerticesp, mColorsp and mTexcoordsp is [0, 4095]
+	if (mCount > 2048)
+	{ //break when buffer gets reasonably full to keep GL command buffers happy and avoid overflow below
+		switch (mMode)
+		{
+			case LLRender::POINTS: flush(); break;
+			case LLRender::TRIANGLES: if (mCount%3==0) flush(); break;
+			case LLRender::QUADS: if(mCount%4 == 0) flush(); break; 
+			case LLRender::LINES: if (mCount%2 == 0) flush(); break;
+		}
+	}
+			
 	if (mCount > 4094)
 	{
 	//	llwarns << "GL immediate mode overflow.  Some geometry not drawn." << llendl;
@@ -1450,10 +1921,29 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z)
 		mVerticesp[mCount] = vert;
 	}
 
+	if (mMode == LLRender::QUADS && LLRender::sGLCoreProfile)
+	{
+		mQuadCycle++;
+		if (mQuadCycle == 4)
+		{ //copy two vertices so fourth quad element will add a triangle
+			mQuadCycle = 0;
+	
+			mCount++;
+			mVerticesp[mCount] = mVerticesp[mCount-3];
+			mColorsp[mCount] = mColorsp[mCount-3];
+			mTexcoordsp[mCount] = mTexcoordsp[mCount-3];
+
+			mCount++;
+			mVerticesp[mCount] = mVerticesp[mCount-2];
+			mColorsp[mCount] = mColorsp[mCount-2];
+			mTexcoordsp[mCount] = mTexcoordsp[mCount-2];
+		}
+	}
+
 	mCount++;
 	mVerticesp[mCount] = mVerticesp[mCount-1];
 	mColorsp[mCount] = mColorsp[mCount-1];
-	mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
+	mTexcoordsp[mCount] = mTexcoordsp[mCount-1];	
 }
 
 void LLRender::vertexBatchPreTransformed(LLVector3* verts, S32 vert_count)
@@ -1464,13 +1954,50 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, S32 vert_count)
 		return;
 	}
 
-	for (S32 i = 0; i < vert_count; i++)
+	if (sGLCoreProfile && mMode == LLRender::QUADS)
+	{ //quads are deprecated, convert to triangle list
+		S32 i = 0;
+		
+		while (i < vert_count)
+		{
+			//read first three
+			mVerticesp[mCount++] = verts[i++];
+			mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
+			mColorsp[mCount] = mColorsp[mCount-1];
+
+			mVerticesp[mCount++] = verts[i++];
+			mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
+			mColorsp[mCount] = mColorsp[mCount-1];
+
+			mVerticesp[mCount++] = verts[i++];
+			mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
+			mColorsp[mCount] = mColorsp[mCount-1];
+
+			//copy two
+			mVerticesp[mCount++] = verts[i-3];
+			mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
+			mColorsp[mCount] = mColorsp[mCount-1];
+
+			mVerticesp[mCount++] = verts[i-1];
+			mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
+			mColorsp[mCount] = mColorsp[mCount-1];
+			
+			//copy last one
+			mVerticesp[mCount++] = verts[i++];
+			mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
+			mColorsp[mCount] = mColorsp[mCount-1];
+		}
+	}
+	else
 	{
-		mVerticesp[mCount] = verts[i];
+		for (S32 i = 0; i < vert_count; i++)
+		{
+			mVerticesp[mCount] = verts[i];
 
-		mCount++;
-		mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
-		mColorsp[mCount] = mColorsp[mCount-1];
+			mCount++;
+			mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
+			mColorsp[mCount] = mColorsp[mCount-1];
+		}
 	}
 
 	mVerticesp[mCount] = mVerticesp[mCount-1];
@@ -1484,13 +2011,50 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 v
 		return;
 	}
 
-	for (S32 i = 0; i < vert_count; i++)
+	if (sGLCoreProfile && mMode == LLRender::QUADS)
+	{ //quads are deprecated, convert to triangle list
+		S32 i = 0;
+
+		while (i < vert_count)
+		{
+			//read first three
+			mVerticesp[mCount] = verts[i];
+			mTexcoordsp[mCount++] = uvs[i++];
+			mColorsp[mCount] = mColorsp[mCount-1];
+
+			mVerticesp[mCount] = verts[i];
+			mTexcoordsp[mCount++] = uvs[i++];
+			mColorsp[mCount] = mColorsp[mCount-1];
+
+			mVerticesp[mCount] = verts[i];
+			mTexcoordsp[mCount++] = uvs[i++];
+			mColorsp[mCount] = mColorsp[mCount-1];
+
+			//copy last two
+			mVerticesp[mCount] = verts[i-3];
+			mTexcoordsp[mCount++] = uvs[i-3];
+			mColorsp[mCount] = mColorsp[mCount-1];
+
+			mVerticesp[mCount] = verts[i-1];
+			mTexcoordsp[mCount++] = uvs[i-1];
+			mColorsp[mCount] = mColorsp[mCount-1];
+
+			//copy last one
+			mVerticesp[mCount] = verts[i];
+			mTexcoordsp[mCount++] = uvs[i++];
+			mColorsp[mCount] = mColorsp[mCount-1];
+		}
+	}
+	else
 	{
-		mVerticesp[mCount] = verts[i];
-		mTexcoordsp[mCount] = uvs[i];
+		for (S32 i = 0; i < vert_count; i++)
+		{
+			mVerticesp[mCount] = verts[i];
+			mTexcoordsp[mCount] = uvs[i];
 
-		mCount++;
-		mColorsp[mCount] = mColorsp[mCount-1];
+			mCount++;
+			mColorsp[mCount] = mColorsp[mCount-1];
+		}
 	}
 
 	mVerticesp[mCount] = mVerticesp[mCount-1];
@@ -1505,13 +2069,51 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLCol
 		return;
 	}
 
-	for (S32 i = 0; i < vert_count; i++)
+	
+	if (sGLCoreProfile && mMode == LLRender::QUADS)
+	{ //quads are deprecated, convert to triangle list
+		S32 i = 0;
+
+		while (i < vert_count)
+		{
+			//read first three
+			mVerticesp[mCount] = verts[i];
+			mTexcoordsp[mCount] = uvs[i];
+			mColorsp[mCount++] = colors[i++];
+
+			mVerticesp[mCount] = verts[i];
+			mTexcoordsp[mCount] = uvs[i];
+			mColorsp[mCount++] = colors[i++];
+
+			mVerticesp[mCount] = verts[i];
+			mTexcoordsp[mCount] = uvs[i];
+			mColorsp[mCount++] = colors[i++];
+
+			//copy last two
+			mVerticesp[mCount] = verts[i-3];
+			mTexcoordsp[mCount] = uvs[i-3];
+			mColorsp[mCount++] = colors[i-3];
+
+			mVerticesp[mCount] = verts[i-1];
+			mTexcoordsp[mCount] = uvs[i-1];
+			mColorsp[mCount++] = colors[i-1];
+
+			//copy last one
+			mVerticesp[mCount] = verts[i];
+			mTexcoordsp[mCount] = uvs[i];
+			mColorsp[mCount++] = colors[i++];
+		}
+	}
+	else
 	{
-		mVerticesp[mCount] = verts[i];
-		mTexcoordsp[mCount] = uvs[i];
-		mColorsp[mCount] = colors[i];
+		for (S32 i = 0; i < vert_count; i++)
+		{
+			mVerticesp[mCount] = verts[i];
+			mTexcoordsp[mCount] = uvs[i];
+			mColorsp[mCount] = colors[i];
 
-		mCount++;
+			mCount++;
+		}
 	}
 
 	mVerticesp[mCount] = mVerticesp[mCount-1];
@@ -1586,6 +2188,81 @@ void LLRender::color3fv(const GLfloat* c)
 	color4f(c[0],c[1],c[2],1);
 }
 
+void LLRender::diffuseColor3f(F32 r, F32 g, F32 b)
+{
+	LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+	llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL);
+
+	if (shader)
+	{
+		shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, r,g,b,1.f);
+	}
+	else
+	{
+		glColor3f(r,g,b);
+	}
+}
+
+void LLRender::diffuseColor3fv(const F32* c)
+{
+	LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+	llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL);
+
+	if (shader)
+	{
+		shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, c[0], c[1], c[2], 1.f);
+	}
+	else
+	{
+		glColor3fv(c);
+	}
+}
+
+void LLRender::diffuseColor4f(F32 r, F32 g, F32 b, F32 a)
+{
+	LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+	llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL);
+
+	if (shader)
+	{
+		shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, r,g,b,a);
+	}
+	else
+	{
+		glColor4f(r,g,b,a);
+	}
+}
+
+void LLRender::diffuseColor4fv(const F32* c)
+{
+	LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+	llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL);
+
+	if (shader)
+	{
+		shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, c);
+	}
+	else
+	{
+		glColor4fv(c);
+	}
+}
+
+void LLRender::diffuseColor4ubv(const U8* c)
+{
+	LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+	llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL);
+
+	if (shader)
+	{
+		shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, c[0]/255.f, c[1]/255.f, c[2]/255.f, c[3]/255.f);
+	}
+	else
+	{
+		glColor4ubv(c);
+	}
+}
+
 void LLRender::debugTexUnits(void)
 {
 	LL_INFOS("TextureUnit") << "Active TexUnit: " << mCurrTextureUnitIndex << LL_ENDL;
diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h
index 8f7ee30d87e53f704387e232be8dd9ca731a556d..fa5f7f311df89eff6dedd88ffb801f7f6f9c5474 100644
--- a/indra/llrender/llrender.h
+++ b/indra/llrender/llrender.h
@@ -41,6 +41,8 @@
 #include "llstrider.h"
 #include "llpointer.h"
 #include "llglheaders.h"
+#include "llmatrix4a.h"
+#include "glh/glh_linear.h"
 
 class LLVertexBuffer;
 class LLCubeMap;
@@ -48,6 +50,8 @@ class LLImageGL;
 class LLRenderTarget;
 class LLTexture ;
 
+#define LL_MATRIX_STACK_DEPTH 32
+
 class LLTexUnit
 {
 	friend class LLRender;
@@ -235,6 +239,8 @@ class LLLightState
 	void setSpotDirection(const LLVector3& direction);
 
 protected:
+	friend class LLRender;
+
 	S32 mIndex;
 	bool mEnabled;
 	LLColor4 mDiffuse;
@@ -308,6 +314,18 @@ class LLRender
 		BF_UNDEF
 	} eBlendFactor;
 
+	typedef enum
+	{
+		MM_MODELVIEW = 0,
+		MM_PROJECTION,
+		MM_TEXTURE0,
+		MM_TEXTURE1,
+		MM_TEXTURE2,
+		MM_TEXTURE3,
+		NUM_MATRIX_MODES,
+		MM_TEXTURE
+	} eMatrixMode;
+
 	LLRender();
 	~LLRender();
 	void init() ;
@@ -319,8 +337,21 @@ class LLRender
 
 	void translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z);
 	void scalef(const GLfloat& x, const GLfloat& y, const GLfloat& z);
+	void rotatef(const GLfloat& a, const GLfloat& x, const GLfloat& y, const GLfloat& z);
+	void ortho(F32 left, F32 right, F32 bottom, F32 top, F32 zNear, F32 zFar);
+
 	void pushMatrix();
 	void popMatrix();
+	void loadMatrix(const GLfloat* m);
+	void loadIdentity();
+	void multMatrix(const GLfloat* m);
+	void matrixMode(U32 mode);	
+
+	const glh::matrix4f& getModelviewMatrix();
+	const glh::matrix4f& getProjectionMatrix();
+
+	void syncMatrices();
+	void syncLightState();
 
 	void translateUI(F32 x, F32 y, F32 z);
 	void scaleUI(F32 x, F32 y, F32 z);
@@ -351,6 +382,12 @@ class LLRender
 	void color3fv(const GLfloat* c);
 	void color4ubv(const GLubyte* c);
 
+	void diffuseColor3f(F32 r, F32 g, F32 b);
+	void diffuseColor3fv(const F32* c);
+	void diffuseColor4f(F32 r, F32 g, F32 b, F32 a);
+	void diffuseColor4fv(const F32* c);
+	void diffuseColor4ubv(const U8* c);
+
 	void vertexBatchPreTransformed(LLVector3* verts, S32 vert_count);
 	void vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 vert_count);
 	void vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLColor4U*, S32 vert_count);
@@ -368,7 +405,8 @@ class LLRender
 		       eBlendFactor alpha_sfactor, eBlendFactor alpha_dfactor);
 
 	LLLightState* getLight(U32 index);
-
+	void setAmbientLightColor(const LLColor4& color);
+	
 	LLTexUnit* getTexUnit(U32 index);
 
 	U32	getCurrentTexUnitIndex(void) const { return mCurrTextureUnitIndex; }
@@ -389,9 +427,21 @@ class LLRender
 public:
 	static U32 sUICalls;
 	static U32 sUIVerts;
+	static bool sGLCoreProfile;
 	
 private:
-	bool				mDirty;
+	friend class LLLightState;
+
+	U32 mMatrixMode;
+	U32 mMatIdx[NUM_MATRIX_MODES];
+	U32 mMatHash[NUM_MATRIX_MODES];
+	glh::matrix4f mMatrix[NUM_MATRIX_MODES][LL_MATRIX_STACK_DEPTH];
+	U32 mCurMatHash[NUM_MATRIX_MODES];
+	U32 mLightHash;
+	LLColor4 mAmbientLightColor;
+	
+	bool			mDirty;
+	U32				mQuadCycle;
 	U32				mCount;
 	U32				mMode;
 	U32				mCurrTextureUnitIndex;
@@ -419,10 +469,10 @@ class LLRender
 
 };
 
-extern F64 gGLModelView[16];
-extern F64 gGLLastModelView[16];
-extern F64 gGLLastProjection[16];
-extern F64 gGLProjection[16];
+extern F32 gGLModelView[16];
+extern F32 gGLLastModelView[16];
+extern F32 gGLLastProjection[16];
+extern F32 gGLProjection[16];
 extern S32 gGLViewport[4];
 
 extern LLRender gGL;
diff --git a/indra/llrender/llrendersphere.cpp b/indra/llrender/llrendersphere.cpp
index a5cd70445f64efb597f0d1f18da11e24a20588ce..26bfe036e88037c8576930c9e93989f0bada344b 100644
--- a/indra/llrender/llrendersphere.cpp
+++ b/indra/llrender/llrendersphere.cpp
@@ -35,106 +35,12 @@
 
 #include "llglheaders.h"
 
-GLUquadricObj *gQuadObj2 = NULL;
 LLRenderSphere gSphere;
 
-void drawSolidSphere(GLdouble radius, GLint slices, GLint stacks);
-
-void drawSolidSphere(GLdouble radius, GLint slices, GLint stacks)
-{
-	if (!gQuadObj2)
-	{
-		gQuadObj2 = gluNewQuadric();
-		if (!gQuadObj2)
-		{
-			llwarns << "drawSolidSphere couldn't allocate quadric" << llendl;
-			return;
-		}
-	}
-
-	gluQuadricDrawStyle(gQuadObj2, GLU_FILL);
-	gluQuadricNormals(gQuadObj2, GLU_SMOOTH);
-	// If we ever changed/used the texture or orientation state
-	// of quadObj, we'd need to change it to the defaults here
-	// with gluQuadricTexture and/or gluQuadricOrientation.
-	gluQuadricTexture(gQuadObj2, GL_TRUE);
-	gluSphere(gQuadObj2, radius, slices, stacks);
-}
-
-
-// A couple thoughts on sphere drawing:
-// 1) You need more slices than stacks, but little less than 2:1
-// 2) At low LOD, setting stacks to an odd number avoids a "band" around the equator, making things look smoother
-void LLRenderSphere::prerender()
-{
-	//  Create a series of display lists for different LODs
-	mDList[0] = glGenLists(1);
-	glNewList(mDList[0], GL_COMPILE);
-	drawSolidSphere(1.0, 30, 20);
-	glEndList();
-
-	mDList[1] = glGenLists(1);
-	glNewList(mDList[1], GL_COMPILE);
-	drawSolidSphere(1.0, 20, 15);
-	glEndList();
-
-	mDList[2] = glGenLists(1);
-	glNewList(mDList[2], GL_COMPILE);
-	drawSolidSphere(1.0, 12, 8);
-	glEndList();
-
-	mDList[3] = glGenLists(1);
-	glNewList(mDList[3], GL_COMPILE);
-	drawSolidSphere(1.0, 8, 5);
-	glEndList();
-}
-
-void LLRenderSphere::cleanupGL()
-{
-	for (S32 detail = 0; detail < 4; detail++)
-	{
-		glDeleteLists(mDList[detail], 1);
-		mDList[detail] = 0;
-	}
-	
-	if (gQuadObj2)
-	{
-		gluDeleteQuadric(gQuadObj2);
-		gQuadObj2 = NULL;
-	}
-}
-
-// Constants here are empirically derived from my eyeballs, JNC
-//
-// The toughest adjustment is the cutoff for the lowest LOD
-// Maybe we should have more LODs at the low end?
-void LLRenderSphere::render(F32 pixel_area)
-{
-	S32 level_of_detail;
-
-	if (pixel_area > 10000.f)
-	{
-		level_of_detail = 0;
-	}
-	else if (pixel_area > 800.f)
-	{
-		level_of_detail = 1;
-	}
-	else if (pixel_area > 100.f)
-	{
-		level_of_detail = 2;
-	}
-	else
-	{
-		level_of_detail = 3;
-	}
-	glCallList(mDList[level_of_detail]);
-}
-
-
 void LLRenderSphere::render()
 {
-	glCallList(mDList[0]);
+	renderGGL();
+	gGL.flush();
 }
 
 inline LLVector3 polar_to_cart(F32 latitude, F32 longitude)
diff --git a/indra/llrender/llrendersphere.h b/indra/llrender/llrendersphere.h
index 96a6bec80c7f708aaea5343f99d57865f8e3998f..f8e9e86e7f7b58bbbd6b6deda191ed8188623eb3 100644
--- a/indra/llrender/llrendersphere.h
+++ b/indra/llrender/llrendersphere.h
@@ -40,11 +40,6 @@ void lat2xyz(LLVector3 * result, F32 lat, F32 lon);			// utility routine
 class LLRenderSphere  
 {
 public:
-	LLGLuint	mDList[5];
-
-	void prerender();
-	void cleanupGL();
-	void render(F32 pixel_area);		// of a box of size 1.0 at that position
 	void render();						// render at highest LOD
 	void renderGGL();                   // render using LLRender
 
diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp
index 8c0d3592df9fde28330dbc706d6a70bdf5d5595a..ef2a7395dad3d1d9545176485133180ed0bfd544 100644
--- a/indra/llrender/llrendertarget.cpp
+++ b/indra/llrender/llrendertarget.cpp
@@ -31,8 +31,7 @@
 #include "llgl.h"
 
 LLRenderTarget* LLRenderTarget::sBoundTarget = NULL;
-
-
+U32 LLRenderTarget::sBytesAllocated = 0;
 
 void check_framebuffer_status()
 {
@@ -62,8 +61,7 @@ LLRenderTarget::LLRenderTarget() :
 	mStencil(0),
 	mUseDepth(false),
 	mRenderDepth(false),
-	mUsage(LLTexUnit::TT_TEXTURE),
-	mSamples(0)
+	mUsage(LLTexUnit::TT_TEXTURE)
 {
 }
 
@@ -84,20 +82,6 @@ bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, boo
 	mStencil = stencil;
 	mUsage = usage;
 	mUseDepth = depth;
-	mSamples = samples;
-
-	mSamples = gGLManager.getNumFBOFSAASamples(mSamples);
-	
-	if (mSamples > 1 && gGLManager.mHasTextureMultisample)
-	{
-		mUsage = LLTexUnit::TT_MULTISAMPLE_TEXTURE;
-		//no support for multisampled stencil targets yet
-		mStencil = false;
-	}
-	else
-	{
-		mSamples = 0;
-	}
 
 	if ((sUseFBO || use_fbo) && gGLManager.mHasFramebufferObject)
 	{
@@ -157,21 +141,6 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt)
 	stop_glerror();
 
 
-#ifdef GL_ARB_texture_multisample
-	if (mSamples > 1)
-	{
-		clear_glerror();
-		glTexImage2DMultisample(LLTexUnit::getInternalType(mUsage), mSamples, color_fmt, mResX, mResY, GL_TRUE);
-		if (glGetError() != GL_NO_ERROR)
-		{
-			llwarns << "Could not allocate multisample color buffer for render target." << llendl;
-			return false;
-		}
-	}
-	else
-#else
-	llassert_always(mSamples <= 1);
-#endif
 	{
 		clear_glerror();
 		LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, color_fmt, mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
@@ -182,32 +151,32 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt)
 		}
 	}
 	
+	sBytesAllocated += mResX*mResY*4;
+
 	stop_glerror();
 
-	if (mSamples == 0)
-	{ 
-		if (offset == 0)
-		{ //use bilinear filtering on single texture render targets that aren't multisampled
-			gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
-			stop_glerror();
-		}
-		else
-		{ //don't filter data attachments
-			gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
-			stop_glerror();
-		}
+	
+	if (offset == 0)
+	{ //use bilinear filtering on single texture render targets that aren't multisampled
+		gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
+		stop_glerror();
+	}
+	else
+	{ //don't filter data attachments
+		gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
+		stop_glerror();
+	}
 
-		if (mUsage != LLTexUnit::TT_RECT_TEXTURE)
-		{
-			gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_MIRROR);
-			stop_glerror();
-		}
-		else
-		{
-			// ATI doesn't support mirrored repeat for rectangular textures.
-			gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
-			stop_glerror();
-		}
+	if (mUsage != LLTexUnit::TT_RECT_TEXTURE)
+	{
+		gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_MIRROR);
+		stop_glerror();
+	}
+	else
+	{
+		// ATI doesn't support mirrored repeat for rectangular textures.
+		gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
+		stop_glerror();
 	}
 		
 	if (mFBO)
@@ -250,26 +219,16 @@ bool LLRenderTarget::allocateDepth()
 	{
 		LLImageGL::generateTextures(1, &mDepth);
 		gGL.getTexUnit(0)->bindManual(mUsage, mDepth);
-		if (mSamples == 0)
-		{
-			U32 internal_type = LLTexUnit::getInternalType(mUsage);
-			gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
-			stop_glerror();
-			clear_glerror();
-			LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT32, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
-		}
-#ifdef GL_ARB_texture_multisample
-		else
-		{
-			stop_glerror();
-			clear_glerror();
-			glTexImage2DMultisample(LLTexUnit::getInternalType(mUsage), mSamples, GL_DEPTH_COMPONENT32, mResX, mResY, GL_TRUE);
-		}
-#else
-		llassert_always(mSamples <= 1);
-#endif
+		
+		U32 internal_type = LLTexUnit::getInternalType(mUsage);
+		stop_glerror();
+		clear_glerror();
+		LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT24, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
+		gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
 	}
 
+	sBytesAllocated += mResX*mResY*4;
+
 	if (glGetError() != GL_NO_ERROR)
 	{
 		llwarns << "Unable to allocate depth buffer for render target." << llendl;
@@ -339,14 +298,16 @@ void LLRenderTarget::release()
 			stop_glerror();
 		}
 		mDepth = 0;
+
+		sBytesAllocated -= mResX*mResY*4;
 	}
 	else if (mUseDepth && mFBO)
 	{ //detach shared depth buffer
 		glBindFramebuffer(GL_FRAMEBUFFER, mFBO);
 		if (mStencil)
 		{ //attached as a renderbuffer
-			glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0);
 			glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0);
+			glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0);
 			mStencil = false;
 		}
 		else
@@ -364,6 +325,7 @@ void LLRenderTarget::release()
 
 	if (mTex.size() > 0)
 	{
+		sBytesAllocated -= mResX*mResY*4*mTex.size();
 		LLImageGL::deleteTextures(mTex.size(), &mTex[0], true);
 		mTex.clear();
 	}
@@ -495,7 +457,8 @@ void LLRenderTarget::copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0,
 	gGL.flush();
 	if (!source.mFBO || !mFBO)
 	{
-		llerrs << "Cannot copy framebuffer contents for non FBO render targets." << llendl;
+		llwarns << "Cannot copy framebuffer contents for non FBO render targets." << llendl;
+		return;
 	}
 
 	
diff --git a/indra/llrender/llrendertarget.h b/indra/llrender/llrendertarget.h
index dea1de12d80953a2f519e337a62b4805bb1fc068..2735ab21c560d2c676f8c2ce1bb28d46f859a40f 100644
--- a/indra/llrender/llrendertarget.h
+++ b/indra/llrender/llrendertarget.h
@@ -64,6 +64,7 @@ class LLRenderTarget
 public:
 	//whether or not to use FBO implementation
 	static bool sUseFBO; 
+	static U32 sBytesAllocated;
 
 	LLRenderTarget();
 	~LLRenderTarget();
@@ -147,7 +148,6 @@ class LLRenderTarget
 	bool mUseDepth;
 	bool mRenderDepth;
 	LLTexUnit::eTextureType mUsage;
-	U32 mSamples;
 	
 	static LLRenderTarget* sBoundTarget;
 };
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index 986c1f2774dde1f23c6416cad1313d11157e6de7..7d384450e67e16da8728b9b431b9111c3de2319a 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -81,29 +81,42 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
 	// NOTE order of shader object attaching is VERY IMPORTANT!!!
 	if (features->calculatesAtmospherics)
 	{
-		if (!shader->attachObject("windlight/atmosphericsVarsV.glsl"))
+		if (features->hasWaterFog)
+		{
+			if (!shader->attachObject("windlight/atmosphericsVarsWaterV.glsl"))
+			{
+				return FALSE;
+			}
+		}
+		else if (!shader->attachObject("windlight/atmosphericsVarsV.glsl"))
 		{
 			return FALSE;
 		}
 	}
 
-	if (features->calculatesLighting)
+	if (features->calculatesLighting || features->atmosphericHelpers)
 	{
 		if (!shader->attachObject("windlight/atmosphericsHelpersV.glsl"))
 		{
 			return FALSE;
 		}
+	}
 		
+	if (features->calculatesLighting)
+	{
 		if (features->isSpecular)
 		{
 			if (!shader->attachObject("lighting/lightFuncSpecularV.glsl"))
 			{
 				return FALSE;
 			}
-			
-			if (!shader->attachObject("lighting/sumLightsSpecularV.glsl"))
+		
+			if (!features->isAlphaLighting)
 			{
-				return FALSE;
+				if (!shader->attachObject("lighting/sumLightsSpecularV.glsl"))
+				{
+					return FALSE;
+				}
 			}
 			
 			if (!shader->attachObject("lighting/lightSpecularV.glsl"))
@@ -118,9 +131,12 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
 				return FALSE;
 			}
 			
-			if (!shader->attachObject("lighting/sumLightsV.glsl"))
+			if (!features->isAlphaLighting)
 			{
-				return FALSE;
+				if (!shader->attachObject("lighting/sumLightsV.glsl"))
+				{
+					return FALSE;
+				}
 			}
 			
 			if (!shader->attachObject("lighting/lightV.glsl"))
@@ -161,7 +177,14 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
 
 	if(features->calculatesAtmospherics)
 	{
-		if (!shader->attachObject("windlight/atmosphericsVarsF.glsl"))
+		if (features->hasWaterFog)
+		{
+			if (!shader->attachObject("windlight/atmosphericsVarsWaterF.glsl"))
+			{
+				return FALSE;
+			}
+		}
+		else if (!shader->attachObject("windlight/atmosphericsVarsF.glsl"))
 		{
 			return FALSE;
 		}
@@ -241,7 +264,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
 						return FALSE;
 					}
 				}
-				shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1;
+				shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
 			}
 		}
 		
@@ -280,9 +303,9 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
 						return FALSE;
 					}
 				}
-				shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1;
+				shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
 			}
-		}		
+		}
 	}
 	
 	// NOTE order of shader object attaching is VERY IMPORTANT!!!
@@ -304,7 +327,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
 				{
 					return FALSE;
 				}
-				shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1;
+				shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
 			}
 		}
 		else if (features->hasWaterFog)
@@ -336,7 +359,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
 				{
 					return FALSE;
 				}
-				shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1;
+				shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
 			}
 		}
 		
@@ -355,7 +378,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
 				{
 					return FALSE;
 				}
-				shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1;
+				shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
 			}
 		}
 		
@@ -395,7 +418,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
 						return FALSE;
 					}
 				}
-				shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1;
+				shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
 			}
 		}
 	}
@@ -419,7 +442,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
 				{
 					return FALSE;
 				}
-				shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1;
+				shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
 			}
 		}
 		
@@ -438,10 +461,26 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
 				{
 					return FALSE;
 				}
-				shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1;
+				shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
 			}
 		}
 	}
+
+	if (features->mIndexedTextureChannels <= 1)
+	{
+		if (!shader->attachObject("objects/nonindexedTextureV.glsl"))
+		{
+			return FALSE;
+		}
+	}
+	else
+	{
+		if (!shader->attachObject("objects/indexedTextureV.glsl"))
+		{
+			return FALSE;
+		}
+	}
+
 	return TRUE;
 }
 
@@ -477,7 +516,7 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns)
 		}
 		else
 		{
-			LL_DEBUGS("ShaderLoading") << log << LL_ENDL;
+			LL_INFOS("ShaderLoading") << log << LL_ENDL;
 		}
 	}
  }
@@ -531,23 +570,85 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
 	}
 
 	//we can't have any lines longer than 1024 characters 
-	//or any shaders longer than 1024 lines... deal - DaveP
+	//or any shaders longer than 4096 lines... deal - DaveP
 	GLcharARB buff[1024];
-	GLcharARB* text[1024];
+	GLcharARB* text[4096];
 	GLuint count = 0;
 
-	if (gGLManager.mGLVersion < 2.1f)
-	{
-		text[count++] = strdup("#version 110\n");
-	}
-	else if (gGLManager.mGLVersion < 3.f)
+	S32 major_version = gGLManager.mGLSLVersionMajor;
+	S32 minor_version = gGLManager.mGLSLVersionMinor;
+	
+	if (major_version == 1 && minor_version < 30)
 	{
-		//set version to 1.20
-		text[count++] = strdup("#version 120\n");
+		if (minor_version < 10)
+		{
+			//should NEVER get here -- if major version is 1 and minor version is less than 10, 
+			// viewer should never attempt to use shaders, continuing will result in undefined behavior
+			llerrs << "Unsupported GLSL Version." << llendl;
+		}
+
+		if (minor_version <= 19)
+		{
+			text[count++] = strdup("#version 110\n");
+			text[count++] = strdup("#define ATTRIBUTE attribute\n");
+			text[count++] = strdup("#define VARYING varying\n");
+			text[count++] = strdup("#define VARYING_FLAT varying\n");
+		}
+		else if (minor_version <= 29)
+		{
+			//set version to 1.20
+			text[count++] = strdup("#version 120\n");
+			text[count++] = strdup("#define FXAA_GLSL_120 1\n");
+			text[count++] = strdup("#define FXAA_FAST_PIXEL_OFFSET 0\n");
+			text[count++] = strdup("#define ATTRIBUTE attribute\n");
+			text[count++] = strdup("#define VARYING varying\n");
+			text[count++] = strdup("#define VARYING_FLAT varying\n");
+		}
 	}
 	else
-	{  //set version to 1.30
-		text[count++] = strdup("#version 130\n");
+	{  
+		if (major_version < 4)
+		{
+			//set version to 1.30
+			text[count++] = strdup("#version 130\n");
+
+			//some implementations of GLSL 1.30 require integer precision be explicitly declared
+			text[count++] = strdup("precision mediump int;\n");
+			text[count++] = strdup("precision highp float;\n");
+		}
+		else
+		{ //set version to 400
+			text[count++] = strdup("#version 400\n");
+		}
+
+		text[count++] = strdup("#define DEFINE_GL_FRAGCOLOR 1\n");
+		text[count++] = strdup("#define FXAA_GLSL_130 1\n");
+
+		text[count++] = strdup("#define ATTRIBUTE in\n");
+
+		if (type == GL_VERTEX_SHADER_ARB)
+		{ //"varying" state is "out" in a vertex program, "in" in a fragment program 
+			// ("varying" is deprecated after version 1.20)
+			text[count++] = strdup("#define VARYING out\n");
+			text[count++] = strdup("#define VARYING_FLAT flat out\n");
+		}
+		else
+		{
+			text[count++] = strdup("#define VARYING in\n");
+			text[count++] = strdup("#define VARYING_FLAT flat in\n");
+		}
+
+		//backwards compatibility with legacy texture lookup syntax
+		text[count++] = strdup("#define texture2D texture\n");
+		text[count++] = strdup("#define textureCube texture\n");
+		text[count++] = strdup("#define texture2DLod textureLod\n");
+		text[count++] = strdup("#define	shadow2D(a,b) vec2(texture(a,b))\n");
+
+		if (major_version > 1 || minor_version >= 40)
+		{ //GLSL 1.40 replaces texture2DRect et al with texture
+			text[count++] = strdup("#define texture2DRect texture\n");
+			text[count++] = strdup("#define shadow2DRect(a,b) vec2(texture(a,b))\n");
+		}
 	}
 
 	//copy preprocessor definitions into buffer
@@ -571,22 +672,24 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
 		.
 		uniform sampler2D texN;
 		
-		varying float vary_texture_index;
+		VARYING_FLAT ivec4 vary_texture_index;
+
+		vec4 ret = vec4(1,0,1,1);
 
 		vec4 diffuseLookup(vec2 texcoord)
 		{
-			switch (int(vary_texture_index+0.25))
+			switch (vary_texture_index.r))
 			{
-				case 0: return texture2D(tex0, texcoord);
-				case 1: return texture2D(tex1, texcoord);
-				case 2: return texture2D(tex2, texcoord);
+				case 0: ret = texture2D(tex0, texcoord); break;
+				case 1: ret = texture2D(tex1, texcoord); break;
+				case 2: ret = texture2D(tex2, texcoord); break;
 				.
 				.
 				.
-				case N: return texture2D(texN, texcoord);
+				case N: return texture2D(texN, texcoord); break;
 			}
 
-			return vec4(0,0,0,0);
+			return ret;
 		}
 		*/
 
@@ -597,7 +700,11 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
 			text[count++] = strdup(decl.c_str());
 		}
 
-		text[count++] = strdup("varying float vary_texture_index;\n");
+		if (texture_index_channels > 1)
+		{
+			text[count++] = strdup("VARYING_FLAT ivec4 vary_texture_index;\n");
+		}
+
 		text[count++] = strdup("vec4 diffuseLookup(vec2 texcoord)\n");
 		text[count++] = strdup("{\n");
 		
@@ -607,49 +714,32 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
 			text[count++] = strdup("return texture2D(tex0, texcoord);\n");
 			text[count++] = strdup("}\n");
 		}
-		else if (gGLManager.mGLVersion >= 3.f)
-		{ 
-			text[count++] = strdup("\tswitch (int(vary_texture_index+0.25))\n");
+		else if (major_version > 1 || minor_version >= 30)
+		{  //switches are supported in GLSL 1.30 and later
+			text[count++] = strdup("\tvec4 ret = vec4(1,0,1,1);\n");
+			text[count++] = strdup("\tswitch (vary_texture_index.r)\n");
 			text[count++] = strdup("\t{\n");
 		
 			//switch body
 			for (S32 i = 0; i < texture_index_channels; ++i)
 			{
-				std::string case_str = llformat("\t\tcase %d: return texture2D(tex%d, texcoord);\n", i, i);
+				std::string case_str = llformat("\t\tcase %d: ret = texture2D(tex%d, texcoord); break;\n", i, i);
 				text[count++] = strdup(case_str.c_str());
 			}
 
 			text[count++] = strdup("\t}\n");
-			text[count++] = strdup("\treturn vec4(0,0,0,0);\n");
+			text[count++] = strdup("\treturn ret;\n");
 			text[count++] = strdup("}\n");
 		}
 		else
-		{
-			//switches aren't supported, make block that looks like:
-			/*
-				int ti = int(vary_texture_index+0.25);
-				if (ti == 0) return texture2D(tex0, texcoord);
-				if (ti == 1) return texture2D(tex1, texcoord);
-				.
-				.
-				.
-				if (ti == N) return texture2D(texN, texcoord);
-			*/
-				
-			text[count++] = strdup("int ti = int(vary_texture_index+0.25);\n");
-			for (S32 i = 0; i < texture_index_channels; ++i)
-			{
-				std::string if_str = llformat("if (ti == %d) return texture2D(tex%d, texcoord);\n", i, i);
-				text[count++] = strdup(if_str.c_str());
-			}
-
-			text[count++] = strdup("\treturn vec4(0,0,0,0);\n");
-			text[count++] = strdup("}\n");
-		}			
+		{ //should never get here.  Indexed texture rendering requires GLSL 1.30 or later 
+			// (for passing integers between vertex and fragment shaders)
+			llerrs << "Indexed texture rendering requires GLSL 1.30 or later." << llendl;
+		}
 	}
 
 	//copy file into memory
-	while( fgets((char *)buff, 1024, file) != NULL && count < LL_ARRAY_SIZE(buff) ) 
+	while( fgets((char *)buff, 1024, file) != NULL && count < LL_ARRAY_SIZE(text) ) 
 	{
 		text[count++] = (GLcharARB *)strdup((char *)buff); 
 	}
@@ -704,14 +794,24 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
 				LL_WARNS("ShaderLoading") << "GLSL Compilation Error: (" << error << ") in " << filename << LL_ENDL;
 				dumpObjectLog(ret);
 
+#if LL_WINDOWS
 				std::stringstream ostr;
 				//dump shader source for debugging
 				for (GLuint i = 0; i < count; i++)
 				{
 					ostr << i << ": " << text[i];
+
+					if (i % 128 == 0)
+					{ //dump every 128 lines
+
+						LL_WARNS("ShaderLoading") << "\n" << ostr.str() << llendl;
+						ostr = std::stringstream();
+					}
+
 				}
 
 				LL_WARNS("ShaderLoading") << "\n" << ostr.str() << llendl;
+#endif // LL_WINDOWS
 
 				ret = 0;
 			}
@@ -760,28 +860,42 @@ BOOL LLShaderMgr::linkProgramObject(GLhandleARB obj, BOOL suppress_errors)
 		LL_WARNS("ShaderLoading") << "GLSL Linker Error:" << LL_ENDL;
 	}
 
-// NOTE: Removing LL_DARWIN block as it doesn't seem to actually give the correct answer, 
-// but want it for reference once I move it.
-#if 0
-	// Force an evaluation of the gl state so the driver can tell if the shader will run in hardware or software
-	// per Apple's suggestion   
-	glBegin(gGL.mMode);
-	glEnd();
+#if LL_DARWIN
 
-	// Query whether the shader can or cannot run in hardware
-	// http://developer.apple.com/qa/qa2007/qa1502.html
-	long vertexGPUProcessing;
-	CGLContextObj ctx = CGLGetCurrentContext();
-	CGLGetParameter (ctx, kCGLCPGPUVertexProcessing, &vertexGPUProcessing);	
-	long fragmentGPUProcessing;
-	CGLGetParameter (ctx, kCGLCPGPUFragmentProcessing, &fragmentGPUProcessing);
-	if (!fragmentGPUProcessing || !vertexGPUProcessing)
+	// For some reason this absolutely kills the frame rate when VBO's are enabled
+	if (0)
 	{
-		LL_WARNS("ShaderLoading") << "GLSL Linker: Running in Software:" << LL_ENDL;
-		success = GL_FALSE;
-		suppress_errors = FALSE;		
+		// Force an evaluation of the gl state so the driver can tell if the shader will run in hardware or software
+		// per Apple's suggestion
+		LLGLSLShader::sNoFixedFunction = false;
+		
+		glUseProgramObjectARB(obj);
+
+		gGL.begin(LLRender::TRIANGLES);
+		gGL.vertex3f(0.0f, 0.0f, 0.0f);
+		gGL.vertex3f(0.0f, 0.0f, 0.0f);
+		gGL.vertex3f(0.0f, 0.0f, 0.0f);
+		gGL.end();
+		gGL.flush();
+		
+		glUseProgramObjectARB(0);
+		
+		LLGLSLShader::sNoFixedFunction = true;
+
+		// Query whether the shader can or cannot run in hardware
+		// http://developer.apple.com/qa/qa2007/qa1502.html
+		GLint vertexGPUProcessing, fragmentGPUProcessing;
+		CGLContextObj ctx = CGLGetCurrentContext();
+		CGLGetParameter(ctx, kCGLCPGPUVertexProcessing, &vertexGPUProcessing);	
+		CGLGetParameter(ctx, kCGLCPGPUFragmentProcessing, &fragmentGPUProcessing);
+		if (!fragmentGPUProcessing || !vertexGPUProcessing)
+		{
+			LL_WARNS("ShaderLoading") << "GLSL Linker: Running in Software:" << LL_ENDL;
+			success = GL_FALSE;
+			suppress_errors = FALSE;		
+		}
 	}
-	
+
 #else
 	std::string log = get_object_log(obj);
 	LLStringUtil::toLower(log);
@@ -819,3 +933,183 @@ BOOL LLShaderMgr::validateProgramObject(GLhandleARB obj)
 	return success;
 }
 
+//virtual
+void LLShaderMgr::initAttribsAndUniforms()
+{
+	//MUST match order of enum in LLVertexBuffer.h
+	mReservedAttribs.push_back("position");
+	mReservedAttribs.push_back("normal");
+	mReservedAttribs.push_back("texcoord0");
+	mReservedAttribs.push_back("texcoord1");
+	mReservedAttribs.push_back("texcoord2");
+	mReservedAttribs.push_back("texcoord3");
+	mReservedAttribs.push_back("diffuse_color");
+	mReservedAttribs.push_back("emissive");
+	mReservedAttribs.push_back("binormal");
+	mReservedAttribs.push_back("weight");
+	mReservedAttribs.push_back("weight4");
+	mReservedAttribs.push_back("clothing");
+	mReservedAttribs.push_back("texture_index");
+	
+	//matrix state
+	mReservedUniforms.push_back("modelview_matrix");
+	mReservedUniforms.push_back("projection_matrix");
+	mReservedUniforms.push_back("inv_proj");
+	mReservedUniforms.push_back("modelview_projection_matrix");
+	mReservedUniforms.push_back("normal_matrix");
+	mReservedUniforms.push_back("texture_matrix0");
+	mReservedUniforms.push_back("texture_matrix1");
+	mReservedUniforms.push_back("texture_matrix2");
+	mReservedUniforms.push_back("texture_matrix3");
+	llassert(mReservedUniforms.size() == LLShaderMgr::TEXTURE_MATRIX3+1);
+
+	mReservedUniforms.push_back("viewport");
+
+	mReservedUniforms.push_back("light_position");
+	mReservedUniforms.push_back("light_direction");
+	mReservedUniforms.push_back("light_attenuation");
+	mReservedUniforms.push_back("light_diffuse");
+	mReservedUniforms.push_back("light_ambient");
+	mReservedUniforms.push_back("light_count");
+	mReservedUniforms.push_back("light");
+	mReservedUniforms.push_back("light_col");
+	mReservedUniforms.push_back("far_z");
+
+	llassert(mReservedUniforms.size() == LLShaderMgr::MULTI_LIGHT_FAR_Z+1);
+
+
+	mReservedUniforms.push_back("proj_mat");
+	mReservedUniforms.push_back("proj_near");
+	mReservedUniforms.push_back("proj_p");
+	mReservedUniforms.push_back("proj_n");
+	mReservedUniforms.push_back("proj_origin");
+	mReservedUniforms.push_back("proj_range");
+	mReservedUniforms.push_back("proj_ambiance");
+	mReservedUniforms.push_back("proj_shadow_idx");
+	mReservedUniforms.push_back("shadow_fade");
+	mReservedUniforms.push_back("proj_focus");
+	mReservedUniforms.push_back("proj_lod");
+	mReservedUniforms.push_back("proj_ambient_lod");
+
+	llassert(mReservedUniforms.size() == LLShaderMgr::PROJECTOR_AMBIENT_LOD+1);
+
+	mReservedUniforms.push_back("color");
+		
+	mReservedUniforms.push_back("diffuseMap");
+	mReservedUniforms.push_back("specularMap");
+	mReservedUniforms.push_back("bumpMap");
+	mReservedUniforms.push_back("environmentMap");
+	mReservedUniforms.push_back("cloude_noise_texture");
+	mReservedUniforms.push_back("fullbright");
+	mReservedUniforms.push_back("lightnorm");
+	mReservedUniforms.push_back("sunlight_color_copy");
+	mReservedUniforms.push_back("ambient");
+	mReservedUniforms.push_back("blue_horizon");
+	mReservedUniforms.push_back("blue_density");
+	mReservedUniforms.push_back("haze_horizon");
+	mReservedUniforms.push_back("haze_density");
+	mReservedUniforms.push_back("cloud_shadow");
+	mReservedUniforms.push_back("density_multiplier");
+	mReservedUniforms.push_back("distance_multiplier");
+	mReservedUniforms.push_back("max_y");
+	mReservedUniforms.push_back("glow");
+	mReservedUniforms.push_back("cloud_color");
+	mReservedUniforms.push_back("cloud_pos_density1");
+	mReservedUniforms.push_back("cloud_pos_density2");
+	mReservedUniforms.push_back("cloud_scale");
+	mReservedUniforms.push_back("gamma");
+	mReservedUniforms.push_back("scene_light_strength");
+
+	llassert(mReservedUniforms.size() == LLShaderMgr::SCENE_LIGHT_STRENGTH+1);
+
+	mReservedUniforms.push_back("center");
+	mReservedUniforms.push_back("size");
+	mReservedUniforms.push_back("falloff");
+
+
+	mReservedUniforms.push_back("minLuminance");
+	mReservedUniforms.push_back("maxExtractAlpha");
+	mReservedUniforms.push_back("lumWeights");
+	mReservedUniforms.push_back("warmthWeights");
+	mReservedUniforms.push_back("warmthAmount");
+	mReservedUniforms.push_back("glowStrength");
+	mReservedUniforms.push_back("glowDelta");
+
+	llassert(mReservedUniforms.size() == LLShaderMgr::GLOW_DELTA+1);
+
+
+	mReservedUniforms.push_back("minimum_alpha");
+
+	mReservedUniforms.push_back("shadow_matrix");
+	mReservedUniforms.push_back("env_mat");
+	mReservedUniforms.push_back("shadow_clip");
+	mReservedUniforms.push_back("sun_wash");
+	mReservedUniforms.push_back("shadow_noise");
+	mReservedUniforms.push_back("blur_size");
+	mReservedUniforms.push_back("ssao_radius");
+	mReservedUniforms.push_back("ssao_max_radius");
+	mReservedUniforms.push_back("ssao_factor");
+	mReservedUniforms.push_back("ssao_factor_inv");
+	mReservedUniforms.push_back("ssao_effect_mat");
+	mReservedUniforms.push_back("screen_res");
+	mReservedUniforms.push_back("near_clip");
+	mReservedUniforms.push_back("shadow_offset");
+	mReservedUniforms.push_back("shadow_bias");
+	mReservedUniforms.push_back("spot_shadow_bias");
+	mReservedUniforms.push_back("spot_shadow_offset");
+	mReservedUniforms.push_back("sun_dir");
+	mReservedUniforms.push_back("shadow_res");
+	mReservedUniforms.push_back("proj_shadow_res");
+	mReservedUniforms.push_back("depth_cutoff");
+	mReservedUniforms.push_back("norm_cutoff");
+	
+	llassert(mReservedUniforms.size() == LLShaderMgr::DEFERRED_NORM_CUTOFF+1);
+
+	mReservedUniforms.push_back("tc_scale");
+	mReservedUniforms.push_back("rcp_screen_res");
+	mReservedUniforms.push_back("rcp_frame_opt");
+	mReservedUniforms.push_back("rcp_frame_opt2");
+	
+	mReservedUniforms.push_back("focal_distance");
+	mReservedUniforms.push_back("blur_constant");
+	mReservedUniforms.push_back("tan_pixel_angle");
+	mReservedUniforms.push_back("magnification");
+	mReservedUniforms.push_back("max_cof");
+	mReservedUniforms.push_back("res_scale");
+	mReservedUniforms.push_back("dof_width");
+	mReservedUniforms.push_back("dof_height");
+
+	mReservedUniforms.push_back("depthMap");
+	mReservedUniforms.push_back("shadowMap0");
+	mReservedUniforms.push_back("shadowMap1");
+	mReservedUniforms.push_back("shadowMap2");
+	mReservedUniforms.push_back("shadowMap3");
+	mReservedUniforms.push_back("shadowMap4");
+	mReservedUniforms.push_back("shadowMap5");
+
+	llassert(mReservedUniforms.size() == LLShaderMgr::DEFERRED_SHADOW5+1);
+
+	mReservedUniforms.push_back("normalMap");
+	mReservedUniforms.push_back("positionMap");
+	mReservedUniforms.push_back("diffuseRect");
+	mReservedUniforms.push_back("specularRect");
+	mReservedUniforms.push_back("noiseMap");
+	mReservedUniforms.push_back("lightFunc");
+	mReservedUniforms.push_back("lightMap");
+	mReservedUniforms.push_back("bloomMap");
+	mReservedUniforms.push_back("projectionMap");
+
+	llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS);
+
+	std::set<std::string> dupe_check;
+
+	for (U32 i = 0; i < mReservedUniforms.size(); ++i)
+	{
+		if (dupe_check.find(mReservedUniforms[i]) != dupe_check.end())
+		{
+			llerrs << "Duplicate reserved uniform name found: " << mReservedUniforms[i] << llendl;
+		}
+		dupe_check.insert(mReservedUniforms[i]);
+	}
+}
+
diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h
index 2f3010381127f281d78f3bdf5c2739865a9ba65c..e28bda6de2d4b39a6b4af2d27f20659eecfc28df 100644
--- a/indra/llrender/llshadermgr.h
+++ b/indra/llrender/llshadermgr.h
@@ -36,9 +36,139 @@ class LLShaderMgr
 	LLShaderMgr();
 	virtual ~LLShaderMgr();
 
+	typedef enum
+	{
+		MODELVIEW_MATRIX = 0,
+		PROJECTION_MATRIX,
+		INVERSE_PROJECTION_MATRIX,
+		MODELVIEW_PROJECTION_MATRIX,
+		NORMAL_MATRIX,
+		TEXTURE_MATRIX0,
+		TEXTURE_MATRIX1,
+		TEXTURE_MATRIX2,
+		TEXTURE_MATRIX3,
+		VIEWPORT,
+		LIGHT_POSITION,
+		LIGHT_DIRECTION,
+		LIGHT_ATTENUATION,
+		LIGHT_DIFFUSE,
+		LIGHT_AMBIENT,
+		MULTI_LIGHT_COUNT,
+		MULTI_LIGHT,
+		MULTI_LIGHT_COL,
+		MULTI_LIGHT_FAR_Z,
+		PROJECTOR_MATRIX,
+		PROJECTOR_NEAR,
+		PROJECTOR_P,
+		PROJECTOR_N,
+		PROJECTOR_ORIGIN,
+		PROJECTOR_RANGE,
+		PROJECTOR_AMBIANCE,
+		PROJECTOR_SHADOW_INDEX,
+		PROJECTOR_SHADOW_FADE,
+		PROJECTOR_FOCUS,
+		PROJECTOR_LOD,
+		PROJECTOR_AMBIENT_LOD,
+		DIFFUSE_COLOR,
+		DIFFUSE_MAP,
+		SPECULAR_MAP,
+		BUMP_MAP,
+		ENVIRONMENT_MAP,
+		CLOUD_NOISE_MAP,
+		FULLBRIGHT,
+		LIGHTNORM,
+		SUNLIGHT_COLOR,
+		AMBIENT,
+		BLUE_HORIZON,
+		BLUE_DENSITY,
+		HAZE_HORIZON,
+		HAZE_DENSITY,
+		CLOUD_SHADOW,
+		DENSITY_MULTIPLIER,
+		DISTANCE_MULTIPLIER,
+		MAX_Y,
+		GLOW,
+		CLOUD_COLOR,
+		CLOUD_POS_DENSITY1,
+		CLOUD_POS_DENSITY2,
+		CLOUD_SCALE,
+		GAMMA,
+		SCENE_LIGHT_STRENGTH,
+		LIGHT_CENTER,
+		LIGHT_SIZE,
+		LIGHT_FALLOFF,
+
+		GLOW_MIN_LUMINANCE,
+		GLOW_MAX_EXTRACT_ALPHA,
+		GLOW_LUM_WEIGHTS,
+		GLOW_WARMTH_WEIGHTS,
+		GLOW_WARMTH_AMOUNT,
+		GLOW_STRENGTH,
+		GLOW_DELTA,
+
+		MINIMUM_ALPHA,
+
+		DEFERRED_SHADOW_MATRIX,
+		DEFERRED_ENV_MAT,
+		DEFERRED_SHADOW_CLIP,
+		DEFERRED_SUN_WASH,
+		DEFERRED_SHADOW_NOISE,
+		DEFERRED_BLUR_SIZE,
+		DEFERRED_SSAO_RADIUS,
+		DEFERRED_SSAO_MAX_RADIUS,
+		DEFERRED_SSAO_FACTOR,
+		DEFERRED_SSAO_FACTOR_INV,
+		DEFERRED_SSAO_EFFECT_MAT,
+		DEFERRED_SCREEN_RES,
+		DEFERRED_NEAR_CLIP,
+		DEFERRED_SHADOW_OFFSET,
+		DEFERRED_SHADOW_BIAS,
+		DEFERRED_SPOT_SHADOW_BIAS,
+		DEFERRED_SPOT_SHADOW_OFFSET,
+		DEFERRED_SUN_DIR,
+		DEFERRED_SHADOW_RES,
+		DEFERRED_PROJ_SHADOW_RES,
+		DEFERRED_DEPTH_CUTOFF,
+		DEFERRED_NORM_CUTOFF,
+
+		FXAA_TC_SCALE,
+		FXAA_RCP_SCREEN_RES,
+		FXAA_RCP_FRAME_OPT,
+		FXAA_RCP_FRAME_OPT2,
+
+		DOF_FOCAL_DISTANCE,
+		DOF_BLUR_CONSTANT,
+		DOF_TAN_PIXEL_ANGLE,
+		DOF_MAGNIFICATION,
+		DOF_MAX_COF,
+		DOF_RES_SCALE,
+		DOF_WIDTH,
+		DOF_HEIGHT,
+
+		DEFERRED_DEPTH,
+		DEFERRED_SHADOW0,
+		DEFERRED_SHADOW1,
+		DEFERRED_SHADOW2,
+		DEFERRED_SHADOW3,
+		DEFERRED_SHADOW4,
+		DEFERRED_SHADOW5,
+		DEFERRED_NORMAL,
+		DEFERRED_POSITION,
+		DEFERRED_DIFFUSE,
+		DEFERRED_SPECULAR,
+		DEFERRED_NOISE,
+		DEFERRED_LIGHTFUNC,
+		DEFERRED_LIGHT,
+		DEFERRED_BLOOM,
+		DEFERRED_PROJECTION,
+		END_RESERVED_UNIFORMS
+	} eGLSLReservedUniforms;
+
 	// singleton pattern implementation
 	static LLShaderMgr * instance();
 
+	virtual void initAttribsAndUniforms(void);
+
 	BOOL attachShaderFeatures(LLGLSLShader * shader);
 	void dumpObjectLog(GLhandleARB ret, BOOL warns = TRUE);
 	BOOL	linkProgramObject(GLhandleARB obj, BOOL suppress_errors = FALSE);
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 8fd11937801b8eba7f68933bd5692a82e19ef3cf..8b5503229f274fc3422e558f626f9a4b434aa107 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -34,39 +34,50 @@
 #include "llmemtype.h"
 #include "llrender.h"
 #include "llvector4a.h"
+#include "llshadermgr.h"
 #include "llglslshader.h"
 #include "llmemory.h"
 
+//Next Highest Power Of Two
+//helper function, returns first number > v that is a power of 2, or v if v is already a power of 2
+U32 nhpo2(U32 v)
+{
+	U32 r = 1;
+	while (r < v) {
+		r *= 2;
+	}
+	return r;
+}
+
 
 //============================================================================
 
 //static
-LLVBOPool LLVertexBuffer::sStreamVBOPool;
-LLVBOPool LLVertexBuffer::sDynamicVBOPool;
-LLVBOPool LLVertexBuffer::sStreamIBOPool;
-LLVBOPool LLVertexBuffer::sDynamicIBOPool;
+LLVBOPool LLVertexBuffer::sStreamVBOPool(GL_STREAM_DRAW_ARB, GL_ARRAY_BUFFER_ARB);
+LLVBOPool LLVertexBuffer::sDynamicVBOPool(GL_DYNAMIC_DRAW_ARB, GL_ARRAY_BUFFER_ARB);
+LLVBOPool LLVertexBuffer::sStreamIBOPool(GL_STREAM_DRAW_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB);
+LLVBOPool LLVertexBuffer::sDynamicIBOPool(GL_DYNAMIC_DRAW_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB);
+U32 LLVBOPool::sBytesPooled = 0;
 
-LLPrivateMemoryPool* LLVertexBuffer::sPrivatePoolp = NULL ;
+LLPrivateMemoryPool* LLVertexBuffer::sPrivatePoolp = NULL;
 U32 LLVertexBuffer::sBindCount = 0;
 U32 LLVertexBuffer::sSetCount = 0;
 S32 LLVertexBuffer::sCount = 0;
 S32 LLVertexBuffer::sGLCount = 0;
 S32 LLVertexBuffer::sMappedCount = 0;
-BOOL LLVertexBuffer::sDisableVBOMapping = FALSE ;
-BOOL LLVertexBuffer::sEnableVBOs = TRUE;
+bool LLVertexBuffer::sDisableVBOMapping = false;
+bool LLVertexBuffer::sEnableVBOs = true;
 U32 LLVertexBuffer::sGLRenderBuffer = 0;
+U32 LLVertexBuffer::sGLRenderArray = 0;
 U32 LLVertexBuffer::sGLRenderIndices = 0;
 U32 LLVertexBuffer::sLastMask = 0;
-BOOL LLVertexBuffer::sVBOActive = FALSE;
-BOOL LLVertexBuffer::sIBOActive = FALSE;
+bool LLVertexBuffer::sVBOActive = false;
+bool LLVertexBuffer::sIBOActive = false;
 U32 LLVertexBuffer::sAllocatedBytes = 0;
-BOOL LLVertexBuffer::sMapped = FALSE;
-BOOL LLVertexBuffer::sUseStreamDraw = TRUE;
-BOOL LLVertexBuffer::sPreferStreamDraw = FALSE;
-S32	LLVertexBuffer::sWeight4Loc = -1;
-
-std::vector<U32> LLVertexBuffer::sDeleteList;
-
+bool LLVertexBuffer::sMapped = false;
+bool LLVertexBuffer::sUseStreamDraw = true;
+bool LLVertexBuffer::sUseVAO = false;
+bool LLVertexBuffer::sPreferStreamDraw = false;
 
 const U32 FENCE_WAIT_TIME_NANOSECONDS = 10000;  //1 ms
 
@@ -84,7 +95,7 @@ class LLGLSyncFence : public LLGLFence
 #endif
 	}
 
-	~LLGLSyncFence()
+	virtual ~LLGLSyncFence()
 	{
 #ifdef GL_ARB_sync
 		if (mSync)
@@ -122,6 +133,120 @@ class LLGLSyncFence : public LLGLFence
 
 };
 
+
+//which power of 2 is i?
+//assumes i is a power of 2 > 0
+U32 wpo2(U32 i)
+{
+	llassert(i > 0);
+	llassert(nhpo2(i) == i);
+
+	U32 r = 0;
+
+	while (i >>= 1) ++r;
+
+	return r;
+}
+
+volatile U8* LLVBOPool::allocate(U32& name, U32 size)
+{
+	llassert(nhpo2(size) == size);
+
+	U32 i = wpo2(size);
+
+	if (mFreeList.size() <= i)
+	{
+		mFreeList.resize(i+1);
+	}
+
+	volatile U8* ret = NULL;
+
+	if (mFreeList[i].empty())
+	{
+		//make a new buffer
+		glGenBuffersARB(1, &name);
+		glBindBufferARB(mType, name);
+		LLVertexBuffer::sAllocatedBytes += size;
+
+		if (LLVertexBuffer::sDisableVBOMapping || mUsage != GL_DYNAMIC_DRAW_ARB)
+		{
+			glBufferDataARB(mType, size, 0, mUsage);
+			ret = (U8*) ll_aligned_malloc_16(size);
+		}
+		else
+		{ //always use a true hint of static draw when allocating non-client-backed buffers
+			glBufferDataARB(mType, size, 0, GL_STATIC_DRAW_ARB);
+		}
+
+		glBindBufferARB(mType, 0);
+	}
+	else
+	{
+		name = mFreeList[i].front().mGLName;
+		ret = mFreeList[i].front().mClientData;
+
+		sBytesPooled -= size;
+
+		mFreeList[i].pop_front();
+	}
+
+	return ret;
+}
+
+void LLVBOPool::release(U32 name, volatile U8* buffer, U32 size)
+{
+	llassert(nhpo2(size) == size);
+
+	U32 i = wpo2(size);
+
+	llassert(mFreeList.size() > i);
+
+	Record rec;
+	rec.mGLName = name;
+	rec.mClientData = buffer;
+	
+	if (buffer == NULL)
+	{
+		glDeleteBuffersARB(1, &rec.mGLName);
+	}
+	else
+	{
+		sBytesPooled += size;
+		mFreeList[i].push_back(rec);
+	}
+}
+
+void LLVBOPool::cleanup()
+{
+	U32 size = 1;
+
+	for (U32 i = 0; i < mFreeList.size(); ++i)
+	{
+		record_list_t& l = mFreeList[i];
+
+		while (!l.empty())
+		{
+			Record& r = l.front();
+
+			glDeleteBuffersARB(1, &r.mGLName);
+
+			if (r.mClientData)
+			{
+				ll_aligned_free_16((void*) r.mClientData);
+			}
+
+			l.pop_front();
+
+			LLVertexBuffer::sAllocatedBytes -= size;
+			sBytesPooled -= size;
+		}
+
+		size *= 2;
+	}
+}
+
+
+//NOTE: each component must be AT LEAST 4 bytes in size to avoid a performance penalty on AMD hardware
 S32 LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_MAX] =
 {
 	sizeof(LLVector4), // TYPE_VERTEX,
@@ -131,10 +256,12 @@ S32 LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_MAX] =
 	sizeof(LLVector2), // TYPE_TEXCOORD2,
 	sizeof(LLVector2), // TYPE_TEXCOORD3,
 	sizeof(LLColor4U), // TYPE_COLOR,
+	sizeof(LLColor4U), // TYPE_EMISSIVE, only alpha is used currently
 	sizeof(LLVector4), // TYPE_BINORMAL,
 	sizeof(F32),	   // TYPE_WEIGHT,
 	sizeof(LLVector4), // TYPE_WEIGHT4,
 	sizeof(LLVector4), // TYPE_CLOTHWEIGHT,
+	sizeof(LLVector4), // TYPE_TEXTURE_INDEX (actually exists as position.w), no extra data, but stride is 16 bytes
 };
 
 U32 LLVertexBuffer::sGLMode[LLRender::NUM_MODES] = 
@@ -149,146 +276,153 @@ U32 LLVertexBuffer::sGLMode[LLRender::NUM_MODES] =
 	GL_LINE_LOOP,
 };
 
+
 //static
 void LLVertexBuffer::setupClientArrays(U32 data_mask)
 {
-	/*if (LLGLImmediate::sStarted)
-	{
-		llerrs << "Cannot use LLGLImmediate and LLVertexBuffer simultaneously!" << llendl;
-	}*/
-
 	if (sLastMask != data_mask)
 	{
-		U32 mask[] =
+		bool error = false;
+
+		if (gGLManager.mGLSLVersionMajor < 2 && gGLManager.mGLSLVersionMinor < 30)
 		{
-			MAP_VERTEX,
-			MAP_NORMAL,
-			MAP_TEXCOORD0,
-			MAP_COLOR,
-		};
-		
-		GLenum array[] =
-		{
-			GL_VERTEX_ARRAY,
-			GL_NORMAL_ARRAY,
-			GL_TEXTURE_COORD_ARRAY,
-			GL_COLOR_ARRAY,
-		};
-
-		BOOL error = FALSE;
-		for (U32 i = 0; i < 4; ++i)
-		{
-			if (sLastMask & mask[i])
-			{ //was enabled
-				if (!(data_mask & mask[i]) && i > 0)
-				{ //needs to be disabled
-					glDisableClientState(array[i]);
+			//make sure texture index is disabled
+			data_mask = data_mask & ~MAP_TEXTURE_INDEX;
+		}
+
+		if (LLGLSLShader::sNoFixedFunction)
+		{
+			for (U32 i = 0; i < TYPE_MAX; ++i)
+			{
+				S32 loc = i;
+										
+				U32 mask = 1 << i;
+
+				if (sLastMask & (1 << i))
+				{ //was enabled
+					if (!(data_mask & mask))
+					{ //needs to be disabled
+						glDisableVertexAttribArrayARB(loc);
+					}
 				}
-				else if (gDebugGL)
-				{ //needs to be enabled, make sure it was (DEBUG TEMPORARY)
-					if (i > 0 && !glIsEnabled(array[i]))
-					{
+				else 
+				{	//was disabled
+					if (data_mask & mask)
+					{ //needs to be enabled
+						glEnableVertexAttribArrayARB(loc);
+					}
+				}
+			}
+		}
+		else
+		{
+
+			GLenum array[] =
+			{
+				GL_VERTEX_ARRAY,
+				GL_NORMAL_ARRAY,
+				GL_TEXTURE_COORD_ARRAY,
+				GL_COLOR_ARRAY,
+			};
+
+			GLenum mask[] = 
+			{
+				MAP_VERTEX,
+				MAP_NORMAL,
+				MAP_TEXCOORD0,
+				MAP_COLOR
+			};
+
+
+
+			for (U32 i = 0; i < 4; ++i)
+			{
+				if (sLastMask & mask[i])
+				{ //was enabled
+					if (!(data_mask & mask[i]))
+					{ //needs to be disabled
+						glDisableClientState(array[i]);
+					}
+					else if (gDebugGL)
+					{ //needs to be enabled, make sure it was (DEBUG)
+						if (!glIsEnabled(array[i]))
+						{
+							if (gDebugSession)
+							{
+								error = true;
+								gFailLog << "Bad client state! " << array[i] << " disabled." << std::endl;
+							}
+							else
+							{
+								llerrs << "Bad client state! " << array[i] << " disabled." << llendl;
+							}
+						}
+					}
+				}
+				else 
+				{	//was disabled
+					if (data_mask & mask[i])
+					{ //needs to be enabled
+						glEnableClientState(array[i]);
+					}
+					else if (gDebugGL && glIsEnabled(array[i]))
+					{ //needs to be disabled, make sure it was (DEBUG TEMPORARY)
 						if (gDebugSession)
 						{
-							error = TRUE;
-							gFailLog << "Bad client state! " << array[i] << " disabled." << std::endl;
+							error = true;
+							gFailLog << "Bad client state! " << array[i] << " enabled." << std::endl;
 						}
 						else
 						{
-							llerrs << "Bad client state! " << array[i] << " disabled." << llendl;
+							llerrs << "Bad client state! " << array[i] << " enabled." << llendl;
 						}
 					}
 				}
 			}
-			else 
-			{	//was disabled
-				if (data_mask & mask[i] && i > 0)
-				{ //needs to be enabled
-					glEnableClientState(array[i]);
-				}
-				else if (gDebugGL && i > 0 && glIsEnabled(array[i]))
-				{ //needs to be disabled, make sure it was (DEBUG TEMPORARY)
-					if (gDebugSession)
-					{
-						error = TRUE;
-						gFailLog << "Bad client state! " << array[i] << " enabled." << std::endl;
-					}
-					else
-					{
-						llerrs << "Bad client state! " << array[i] << " enabled." << llendl;
+		
+			U32 map_tc[] = 
+			{
+				MAP_TEXCOORD1,
+				MAP_TEXCOORD2,
+				MAP_TEXCOORD3
+			};
+
+			for (U32 i = 0; i < 3; i++)
+			{
+				if (sLastMask & map_tc[i])
+				{
+					if (!(data_mask & map_tc[i]))
+					{ //disable
+						glClientActiveTextureARB(GL_TEXTURE1_ARB+i);
+						glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+						glClientActiveTextureARB(GL_TEXTURE0_ARB);
 					}
 				}
+				else if (data_mask & map_tc[i])
+				{
+					glClientActiveTextureARB(GL_TEXTURE1_ARB+i);
+					glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+					glClientActiveTextureARB(GL_TEXTURE0_ARB);
+				}
 			}
-		}
-
-		if (error)
-		{
-			ll_fail("LLVertexBuffer::setupClientArrays failed");
-		}
 
-		U32 map_tc[] = 
-		{
-			MAP_TEXCOORD1,
-			MAP_TEXCOORD2,
-			MAP_TEXCOORD3
-		};
-
-		for (U32 i = 0; i < 3; i++)
-		{
-			if (sLastMask & map_tc[i])
+			if (sLastMask & MAP_BINORMAL)
 			{
-				if (!(data_mask & map_tc[i]))
+				if (!(data_mask & MAP_BINORMAL))
 				{
-					glClientActiveTextureARB(GL_TEXTURE1_ARB+i);
+					glClientActiveTextureARB(GL_TEXTURE2_ARB);
 					glDisableClientState(GL_TEXTURE_COORD_ARRAY);
 					glClientActiveTextureARB(GL_TEXTURE0_ARB);
 				}
 			}
-			else if (data_mask & map_tc[i])
-			{
-				glClientActiveTextureARB(GL_TEXTURE1_ARB+i);
-				glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-				glClientActiveTextureARB(GL_TEXTURE0_ARB);
-			}
-		}
-
-		if (sLastMask & MAP_BINORMAL)
-		{
-			if (!(data_mask & MAP_BINORMAL))
+			else if (data_mask & MAP_BINORMAL)
 			{
 				glClientActiveTextureARB(GL_TEXTURE2_ARB);
-				glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+				glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 				glClientActiveTextureARB(GL_TEXTURE0_ARB);
 			}
 		}
-		else if (data_mask & MAP_BINORMAL)
-		{
-			glClientActiveTextureARB(GL_TEXTURE2_ARB);
-			glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-			glClientActiveTextureARB(GL_TEXTURE0_ARB);
-		}
-	
-		if (sLastMask & MAP_WEIGHT4)
-		{
-			if (sWeight4Loc < 0)
-			{
-				llerrs << "Weighting disabled but vertex buffer still bound!" << llendl;
-			}
-
-			if (!(data_mask & MAP_WEIGHT4))
-			{ //disable 4-component skin weight			
-				glDisableVertexAttribArrayARB(sWeight4Loc);
-			}
-		}
-		else if (data_mask & MAP_WEIGHT4)
-		{
-			if (sWeight4Loc >= 0)
-			{ //enable 4-component skin weight
-				glEnableVertexAttribArrayARB(sWeight4Loc);
-			}
-		}
 				
-
 		sLastMask = data_mask;
 	}
 }
@@ -296,32 +430,90 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)
 //static
 void LLVertexBuffer::drawArrays(U32 mode, const std::vector<LLVector3>& pos, const std::vector<LLVector3>& norm)
 {
+	llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
+	gGL.syncMatrices();
+
 	U32 count = pos.size();
 	llassert_always(norm.size() >= pos.size());
-	llassert_always(count > 0) ;
+	llassert_always(count > 0);
 
 	unbind();
 	
 	setupClientArrays(MAP_VERTEX | MAP_NORMAL);
 
-	glVertexPointer(3, GL_FLOAT, 0, pos[0].mV);
-	glNormalPointer(GL_FLOAT, 0, norm[0].mV);
+	LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+
+	if (shader)
+	{
+		S32 loc = LLVertexBuffer::TYPE_VERTEX;
+		if (loc > -1)
+		{
+			glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, 0, pos[0].mV);
+		}
+		loc = LLVertexBuffer::TYPE_NORMAL;
+		if (loc > -1)
+		{
+			glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, 0, norm[0].mV);
+		}
+	}
+	else
+	{
+		glVertexPointer(3, GL_FLOAT, 0, pos[0].mV);
+		glNormalPointer(GL_FLOAT, 0, norm[0].mV);
+	}
 
 	glDrawArrays(sGLMode[mode], 0, count);
 }
 
+//static
+void LLVertexBuffer::drawElements(U32 mode, const LLVector4a* pos, const LLVector2* tc, S32 num_indices, const U16* indicesp)
+{
+	llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
+
+	gGL.syncMatrices();
+
+	U32 mask = LLVertexBuffer::MAP_VERTEX;
+	if (tc)
+	{
+		mask = mask | LLVertexBuffer::MAP_TEXCOORD0;
+	}
+
+	unbind();
+	
+	setupClientArrays(mask);
+
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		S32 loc = LLVertexBuffer::TYPE_VERTEX;
+		glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, 16, pos);
+
+		if (tc)
+		{
+			loc = LLVertexBuffer::TYPE_TEXCOORD0;
+			glVertexAttribPointerARB(loc, 2, GL_FLOAT, GL_FALSE, 0, tc);
+		}
+	}
+	else
+	{
+		glTexCoordPointer(2, GL_FLOAT, 0, tc);
+		glVertexPointer(3, GL_FLOAT, 16, pos);
+	}
+
+	glDrawElements(sGLMode[mode], num_indices, GL_UNSIGNED_SHORT, indicesp);
+}
+
 void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_offset) const
 {
-	if (start >= (U32) mRequestedNumVerts ||
-	    end >= (U32) mRequestedNumVerts)
+	if (start >= (U32) mNumVerts ||
+	    end >= (U32) mNumVerts)
 	{
-		llerrs << "Bad vertex buffer draw range: [" << start << ", " << end << "] vs " << mRequestedNumVerts << llendl;
+		llerrs << "Bad vertex buffer draw range: [" << start << ", " << end << "] vs " << mNumVerts << llendl;
 	}
 
-	llassert(mRequestedNumIndices >= 0);
+	llassert(mNumIndices >= 0);
 
-	if (indices_offset >= (U32) mRequestedNumIndices ||
-	    indices_offset + count > (U32) mRequestedNumIndices)
+	if (indices_offset >= (U32) mNumIndices ||
+	    indices_offset + count > (U32) mNumIndices)
 	{
 		llerrs << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << llendl;
 	}
@@ -336,23 +528,66 @@ void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of
 				llerrs << "Index out of range: " << idx[i] << " not in [" << start << ", " << end << "]" << llendl;
 			}
 		}
+
+		LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+
+		if (shader && shader->mFeatures.mIndexedTextureChannels > 1)
+		{
+			LLStrider<LLVector4a> v;
+			//hack to get non-const reference
+			LLVertexBuffer* vb = (LLVertexBuffer*) this;
+			vb->getVertexStrider(v);
+
+			for (U32 i = start; i < end; i++)
+			{
+				S32 idx = (S32) (v[i][3]+0.25f);
+				if (idx < 0 || idx >= shader->mFeatures.mIndexedTextureChannels)
+				{
+					llerrs << "Bad texture index found in vertex data stream." << llendl;
+				}
+			}
+		}
 	}
 }
 
 void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indices_offset) const
 {
 	validateRange(start, end, count, indices_offset);
+	mMappable = false;
+	gGL.syncMatrices();
 
-	llassert(mRequestedNumVerts >= 0);
+	llassert(mNumVerts >= 0);
+	llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
 
-	if (mGLIndices != sGLRenderIndices)
+	if (mGLArray)
+	{
+		if (mGLArray != sGLRenderArray)
+		{
+			llerrs << "Wrong vertex array bound." << llendl;
+		}
+	}
+	else
 	{
-		llerrs << "Wrong index buffer bound." << llendl;
+		if (mGLIndices != sGLRenderIndices)
+		{
+			llerrs << "Wrong index buffer bound." << llendl;
+		}
+
+		if (mGLBuffer != sGLRenderBuffer)
+		{
+			llerrs << "Wrong vertex buffer bound." << llendl;
+		}
 	}
 
-	if (mGLBuffer != sGLRenderBuffer)
+	if (gDebugGL && !mGLArray && useVBOs())
 	{
-		llerrs << "Wrong vertex buffer bound." << llendl;
+		GLint elem = 0;
+		glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &elem);
+
+		if (elem != mGLIndices)
+		{
+			llerrs << "Wrong index buffer bound!" << llendl;
+		}
 	}
 
 	if (mode >= LLRender::NUM_MODES)
@@ -372,21 +607,35 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi
 
 void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const
 {
-	llassert(mRequestedNumIndices >= 0);
-	if (indices_offset >= (U32) mRequestedNumIndices ||
-	    indices_offset + count > (U32) mRequestedNumIndices)
+	llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
+	mMappable = false;
+	gGL.syncMatrices();
+
+	llassert(mNumIndices >= 0);
+	if (indices_offset >= (U32) mNumIndices ||
+	    indices_offset + count > (U32) mNumIndices)
 	{
 		llerrs << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << llendl;
 	}
 
-	if (mGLIndices != sGLRenderIndices)
+	if (mGLArray)
 	{
-		llerrs << "Wrong index buffer bound." << llendl;
+		if (mGLArray != sGLRenderArray)
+		{
+			llerrs << "Wrong vertex array bound." << llendl;
+		}
 	}
-
-	if (mGLBuffer != sGLRenderBuffer)
+	else
 	{
-		llerrs << "Wrong vertex buffer bound." << llendl;
+		if (mGLIndices != sGLRenderIndices)
+		{
+			llerrs << "Wrong index buffer bound." << llendl;
+		}
+
+		if (mGLBuffer != sGLRenderBuffer)
+		{
+			llerrs << "Wrong vertex buffer bound." << llendl;
+		}
 	}
 
 	if (mode >= LLRender::NUM_MODES)
@@ -404,16 +653,30 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const
 
 void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
 {
-	llassert(mRequestedNumVerts >= 0);
-	if (first >= (U32) mRequestedNumVerts ||
-	    first + count > (U32) mRequestedNumVerts)
+	llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
+	mMappable = false;
+	gGL.syncMatrices();
+	
+	llassert(mNumVerts >= 0);
+	if (first >= (U32) mNumVerts ||
+	    first + count > (U32) mNumVerts)
 	{
 		llerrs << "Bad vertex buffer draw range: [" << first << ", " << first+count << "]" << llendl;
 	}
 
-	if (mGLBuffer != sGLRenderBuffer || useVBOs() != sVBOActive)
+	if (mGLArray)
+	{
+		if (mGLArray != sGLRenderArray)
+		{
+			llerrs << "Wrong vertex array bound." << llendl;
+		}
+	}
+	else
 	{
-		llerrs << "Wrong vertex buffer bound." << llendl;
+		if (mGLBuffer != sGLRenderBuffer || useVBOs() != sVBOActive)
+		{
+			llerrs << "Wrong vertex buffer bound." << llendl;
+		}
 	}
 
 	if (mode >= LLRender::NUM_MODES)
@@ -431,38 +694,37 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
 //static
 void LLVertexBuffer::initClass(bool use_vbo, bool no_vbo_mapping)
 {
-	sEnableVBOs = use_vbo && gGLManager.mHasVertexBufferObject ;
-	if(sEnableVBOs)
-	{
-		//llassert_always(glBindBufferARB) ; //double check the extention for VBO is loaded.
-
-		llinfos << "VBO is enabled." << llendl ;
-	}
-	else
-	{
-		llinfos << "VBO is disabled." << llendl ;
-	}
-
-	sDisableVBOMapping = sEnableVBOs && no_vbo_mapping ;
+	sEnableVBOs = use_vbo && gGLManager.mHasVertexBufferObject;
+	sDisableVBOMapping = sEnableVBOs && no_vbo_mapping;
 
-	if(!sPrivatePoolp)
-	{
-		sPrivatePoolp = LLPrivateMemoryPoolManager::getInstance()->newPool(LLPrivateMemoryPool::STATIC) ;
+	if (!sPrivatePoolp)
+	{ 
+		sPrivatePoolp = LLPrivateMemoryPoolManager::getInstance()->newPool(LLPrivateMemoryPool::STATIC);
 	}
 }
 
 //static 
 void LLVertexBuffer::unbind()
 {
+	if (sGLRenderArray)
+	{
+#if GL_ARB_vertex_array_object
+		glBindVertexArray(0);
+#endif
+		sGLRenderArray = 0;
+		sGLRenderIndices = 0;
+		sIBOActive = false;
+	}
+
 	if (sVBOActive)
 	{
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
-		sVBOActive = FALSE;
+		sVBOActive = false;
 	}
 	if (sIBOActive)
 	{
 		glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
-		sIBOActive = FALSE;
+		sIBOActive = false;
 	}
 
 	sGLRenderBuffer = 0;
@@ -476,63 +738,88 @@ void LLVertexBuffer::cleanupClass()
 {
 	LLMemType mt2(LLMemType::MTYPE_VERTEX_CLEANUP_CLASS);
 	unbind();
-	clientCopy(); // deletes GL buffers
+	
+	sStreamIBOPool.cleanup();
+	sDynamicIBOPool.cleanup();
+	sStreamVBOPool.cleanup();
+	sDynamicVBOPool.cleanup();
 
 	if(sPrivatePoolp)
 	{
-		LLPrivateMemoryPoolManager::getInstance()->deletePool(sPrivatePoolp) ;
-		sPrivatePoolp = NULL ;
+		LLPrivateMemoryPoolManager::getInstance()->deletePool(sPrivatePoolp);
+		sPrivatePoolp = NULL;
 	}
 }
 
-void LLVertexBuffer::clientCopy(F64 max_time)
+//----------------------------------------------------------------------------
+
+S32 LLVertexBuffer::determineUsage(S32 usage)
 {
-	if (!sDeleteList.empty())
+	S32 ret_usage = usage;
+
+	if (!sEnableVBOs)
+	{
+		ret_usage = 0;
+	}
+	
+	if (ret_usage == GL_STREAM_DRAW_ARB && !sUseStreamDraw)
 	{
-		glDeleteBuffersARB(sDeleteList.size(), (GLuint*) &(sDeleteList[0]));
-		sDeleteList.clear();
+		ret_usage = 0;
+	}
+	
+	if (ret_usage == GL_DYNAMIC_DRAW_ARB && sPreferStreamDraw)
+	{
+		ret_usage = GL_STREAM_DRAW_ARB;
+	}
+	
+	if (ret_usage == 0 && LLRender::sGLCoreProfile)
+	{ //MUST use VBOs for all rendering
+		ret_usage = GL_STREAM_DRAW_ARB;
+	}
+	
+	if (ret_usage && ret_usage != GL_STREAM_DRAW_ARB)
+	{ //only stream_draw and dynamic_draw are supported when using VBOs, dynamic draw is the default
+		if (sDisableVBOMapping)
+		{ //always use stream draw if VBO mapping is disabled
+			ret_usage = GL_STREAM_DRAW_ARB;
+		}
+		else
+		{
+			ret_usage = GL_DYNAMIC_DRAW_ARB;
+		}
 	}
+	
+	return ret_usage;
 }
 
-//----------------------------------------------------------------------------
-
 LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) :
 	LLRefCount(),
 
 	mNumVerts(0),
 	mNumIndices(0),
-	mRequestedNumVerts(-1),
-	mRequestedNumIndices(-1),
-	mUsage(usage),
+	mAlignedOffset(0),
+	mAlignedIndexOffset(0),
+	mSize(0),
+	mIndicesSize(0),
+	mTypeMask(typemask),
+	mUsage(LLVertexBuffer::determineUsage(usage)),
 	mGLBuffer(0),
-	mGLIndices(0), 
+	mGLIndices(0),
+	mGLArray(0),
 	mMappedData(NULL),
-	mMappedIndexData(NULL), 
-	mVertexLocked(FALSE),
-	mIndexLocked(FALSE),
-	mFinal(FALSE),
-	mFilthy(FALSE),
-	mEmpty(TRUE),
-	mResized(FALSE),
-	mDynamicSize(FALSE),
+	mMappedIndexData(NULL),
+	mMappedDataUsingVBOs(false),
+	mMappedIndexDataUsingVBOs(false),
+	mVertexLocked(false),
+	mIndexLocked(false),
+	mFinal(false),
+	mEmpty(true),
+	mMappable(false),
 	mFence(NULL)
 {
 	LLMemType mt2(LLMemType::MTYPE_VERTEX_CONSTRUCTOR);
-	mFence = NULL;
-	if (!sEnableVBOs)
-	{
-		mUsage = 0 ; 
-	}
 
-	if (mUsage == GL_STREAM_DRAW_ARB && !sUseStreamDraw)
-	{
-		mUsage = 0;
-	}
-	
-	if (mUsage == GL_DYNAMIC_DRAW_ARB && sPreferStreamDraw)
-	{
-		mUsage = GL_STREAM_DRAW_ARB;
-	}
+	mMappable = (mUsage == GL_DYNAMIC_DRAW_ARB && !sDisableVBOMapping);
 
 	//zero out offsets
 	for (U32 i = 0; i < TYPE_MAX; i++)
@@ -540,11 +827,6 @@ LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) :
 		mOffsets[i] = 0;
 	}
 
-	mTypeMask = typemask;
-	mSize = 0;
-	mAlignedOffset = 0;
-	mAlignedIndexOffset = 0;
-
 	sCount++;
 }
 
@@ -552,12 +834,12 @@ LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) :
 S32 LLVertexBuffer::calcOffsets(const U32& typemask, S32* offsets, S32 num_vertices)
 {
 	S32 offset = 0;
-	for (S32 i=0; i<TYPE_MAX; i++)
+	for (S32 i=0; i<TYPE_TEXTURE_INDEX; i++)
 	{
 		U32 mask = 1<<i;
 		if (typemask & mask)
 		{
-			if (offsets)
+			if (offsets && LLVertexBuffer::sTypeSize[i])
 			{
 				offsets[i] = offset;
 				offset += LLVertexBuffer::sTypeSize[i]*num_vertices;
@@ -566,6 +848,8 @@ S32 LLVertexBuffer::calcOffsets(const U32& typemask, S32* offsets, S32 num_verti
 		}
 	}
 
+	offsets[TYPE_TEXTURE_INDEX] = offsets[TYPE_VERTEX] + 12;
+	
 	return offset+16;
 }
 
@@ -573,7 +857,7 @@ S32 LLVertexBuffer::calcOffsets(const U32& typemask, S32* offsets, S32 num_verti
 S32 LLVertexBuffer::calcVertexSize(const U32& typemask)
 {
 	S32 size = 0;
-	for (S32 i = 0; i < TYPE_MAX; i++)
+	for (S32 i = 0; i < TYPE_TEXTURE_INDEX; i++)
 	{
 		U32 mask = 1<<i;
 		if (typemask & mask)
@@ -597,6 +881,14 @@ LLVertexBuffer::~LLVertexBuffer()
 	LLMemType mt2(LLMemType::MTYPE_VERTEX_DESTRUCTOR);
 	destroyGLBuffer();
 	destroyGLIndices();
+
+	if (mGLArray)
+	{
+#if GL_ARB_vertex_array_object
+		glDeleteVertexArrays(1, &mGLArray);
+#endif
+	}
+
 	sCount--;
 
 	if (mFence)
@@ -606,7 +898,7 @@ LLVertexBuffer::~LLVertexBuffer()
 	
 	mFence = NULL;
 
-	llassert_always(!mMappedData && !mMappedIndexData) ;
+	llassert_always(!mMappedData && !mMappedIndexData);
 };
 
 void LLVertexBuffer::placeFence() const
@@ -635,39 +927,35 @@ void LLVertexBuffer::waitFence() const
 
 //----------------------------------------------------------------------------
 
-void LLVertexBuffer::genBuffer()
+void LLVertexBuffer::genBuffer(U32 size)
 {
+	mSize = nhpo2(size);
+
 	if (mUsage == GL_STREAM_DRAW_ARB)
 	{
-		mGLBuffer = sStreamVBOPool.allocate();
-	}
-	else if (mUsage == GL_DYNAMIC_DRAW_ARB)
-	{
-		mGLBuffer = sDynamicVBOPool.allocate();
+		mMappedData = sStreamVBOPool.allocate(mGLBuffer, mSize);
 	}
 	else
 	{
-		BOOST_STATIC_ASSERT(sizeof(mGLBuffer) == sizeof(GLuint));
-		glGenBuffersARB(1, (GLuint*)&mGLBuffer);
+		mMappedData = sDynamicVBOPool.allocate(mGLBuffer, mSize);
 	}
+	
 	sGLCount++;
 }
 
-void LLVertexBuffer::genIndices()
+void LLVertexBuffer::genIndices(U32 size)
 {
+	mIndicesSize = nhpo2(size);
+
 	if (mUsage == GL_STREAM_DRAW_ARB)
 	{
-		mGLIndices = sStreamIBOPool.allocate();
-	}
-	else if (mUsage == GL_DYNAMIC_DRAW_ARB)
-	{
-		mGLIndices = sDynamicIBOPool.allocate();
+		mMappedIndexData = sStreamIBOPool.allocate(mGLIndices, mIndicesSize);
 	}
 	else
 	{
-		BOOST_STATIC_ASSERT(sizeof(mGLBuffer) == sizeof(GLuint));
-		glGenBuffersARB(1, (GLuint*)&mGLIndices);
+		mMappedIndexData = sDynamicIBOPool.allocate(mGLIndices, mIndicesSize);
 	}
+	
 	sGLCount++;
 }
 
@@ -675,16 +963,16 @@ void LLVertexBuffer::releaseBuffer()
 {
 	if (mUsage == GL_STREAM_DRAW_ARB)
 	{
-		sStreamVBOPool.release(mGLBuffer);
-	}
-	else if (mUsage == GL_DYNAMIC_DRAW_ARB)
-	{
-		sDynamicVBOPool.release(mGLBuffer);
+		sStreamVBOPool.release(mGLBuffer, mMappedData, mSize);
 	}
 	else
 	{
-		sDeleteList.push_back(mGLBuffer);
+		sDynamicVBOPool.release(mGLBuffer, mMappedData, mSize);
 	}
+	
+	mGLBuffer = 0;
+	mMappedData = NULL;
+
 	sGLCount--;
 }
 
@@ -692,24 +980,23 @@ void LLVertexBuffer::releaseIndices()
 {
 	if (mUsage == GL_STREAM_DRAW_ARB)
 	{
-		sStreamIBOPool.release(mGLIndices);
-	}
-	else if (mUsage == GL_DYNAMIC_DRAW_ARB)
-	{
-		sDynamicIBOPool.release(mGLIndices);
+		sStreamIBOPool.release(mGLIndices, mMappedIndexData, mIndicesSize);
 	}
 	else
 	{
-		sDeleteList.push_back(mGLIndices);
+		sDynamicIBOPool.release(mGLIndices, mMappedIndexData, mIndicesSize);
 	}
+
+	mGLIndices = 0;
+	mMappedIndexData = NULL;
+	
 	sGLCount--;
 }
 
-void LLVertexBuffer::createGLBuffer()
+void LLVertexBuffer::createGLBuffer(U32 size)
 {
 	LLMemType mt2(LLMemType::MTYPE_VERTEX_CREATE_VERTICES);
 	
-	U32 size = getSize();
 	if (mGLBuffer)
 	{
 		destroyGLBuffer();
@@ -720,27 +1007,27 @@ void LLVertexBuffer::createGLBuffer()
 		return;
 	}
 
-	mEmpty = TRUE;
+	mEmpty = true;
 
-	if (useVBOs())
+	mMappedDataUsingVBOs = useVBOs();
+	
+	if (mMappedDataUsingVBOs)
 	{
-		mMappedData = NULL;
-		genBuffer();
-		mResized = TRUE;
+		genBuffer(size);
 	}
 	else
 	{
 		static int gl_buffer_idx = 0;
 		mGLBuffer = ++gl_buffer_idx;
 		mMappedData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size);
+		mSize = size;
 	}
 }
 
-void LLVertexBuffer::createGLIndices()
+void LLVertexBuffer::createGLIndices(U32 size)
 {
 	LLMemType mt2(LLMemType::MTYPE_VERTEX_CREATE_INDICES);
-	U32 size = getIndicesSize();
-
+	
 	if (mGLIndices)
 	{
 		destroyGLIndices();
@@ -751,24 +1038,25 @@ void LLVertexBuffer::createGLIndices()
 		return;
 	}
 
-	mEmpty = TRUE;
+	mEmpty = true;
 
 	//pad by 16 bytes for aligned copies
 	size += 16;
 
-	if (useVBOs())
+	mMappedIndexDataUsingVBOs = useVBOs();
+
+	if (mMappedIndexDataUsingVBOs)
 	{
 		//pad by another 16 bytes for VBO pointer adjustment
 		size += 16;
-		mMappedIndexData = NULL;
-		genIndices();
-		mResized = TRUE;
+		genIndices(size);
 	}
 	else
 	{
 		mMappedIndexData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size);
 		static int gl_buffer_idx = 0;
 		mGLIndices = ++gl_buffer_idx;
+		mIndicesSize = size;
 	}
 }
 
@@ -777,24 +1065,16 @@ void LLVertexBuffer::destroyGLBuffer()
 	LLMemType mt2(LLMemType::MTYPE_VERTEX_DESTROY_BUFFER);
 	if (mGLBuffer)
 	{
-		if (useVBOs())
+		if (mMappedDataUsingVBOs)
 		{
-			freeClientBuffer() ;
-
-			if (mMappedData || mMappedIndexData)
-			{
-				llerrs << "Vertex buffer destroyed while mapped!" << llendl;
-			}
 			releaseBuffer();
 		}
 		else
 		{
-			FREE_MEM(sPrivatePoolp, mMappedData) ;
+			FREE_MEM(sPrivatePoolp, (void*) mMappedData);
 			mMappedData = NULL;
-			mEmpty = TRUE;
+			mEmpty = true;
 		}
-
-		sAllocatedBytes -= getSize();
 	}
 	
 	mGLBuffer = 0;
@@ -806,24 +1086,16 @@ void LLVertexBuffer::destroyGLIndices()
 	LLMemType mt2(LLMemType::MTYPE_VERTEX_DESTROY_INDICES);
 	if (mGLIndices)
 	{
-		if (useVBOs())
+		if (mMappedIndexDataUsingVBOs)
 		{
-			freeClientBuffer() ;
-
-			if (mMappedData || mMappedIndexData)
-			{
-				llerrs << "Vertex buffer destroyed while mapped." << llendl;
-			}
 			releaseIndices();
 		}
 		else
 		{
-			FREE_MEM(sPrivatePoolp, mMappedIndexData) ;
+			FREE_MEM(sPrivatePoolp, (void*) mMappedIndexData);
 			mMappedIndexData = NULL;
-			mEmpty = TRUE;
+			mEmpty = true;
 		}
-
-		sAllocatedBytes -= getIndicesSize();
 	}
 
 	mGLIndices = 0;
@@ -842,23 +1114,14 @@ void LLVertexBuffer::updateNumVerts(S32 nverts)
 		nverts = 65535;
 	}
 
-	mRequestedNumVerts = nverts;
+	U32 needed_size = calcOffsets(mTypeMask, mOffsets, nverts);
 
-	if (!mDynamicSize)
+	if (needed_size > mSize || needed_size <= mSize/2)
 	{
-		mNumVerts = nverts;
+		createGLBuffer(needed_size);
 	}
-	else if (mUsage == GL_STATIC_DRAW_ARB ||
-		nverts > mNumVerts ||
-		nverts < mNumVerts/2)
-	{
-		if (mUsage != GL_STATIC_DRAW_ARB && nverts + nverts/4 <= 65535)
-		{
-			nverts += nverts/4;
-		}
-		mNumVerts = nverts;
-	}
-	mSize = calcOffsets(mTypeMask, mOffsets, mNumVerts);
+
+	mNumVerts = nverts;
 }
 
 void LLVertexBuffer::updateNumIndices(S32 nindices)
@@ -867,28 +1130,22 @@ void LLVertexBuffer::updateNumIndices(S32 nindices)
 
 	llassert(nindices >= 0);
 
-	mRequestedNumIndices = nindices;
-	if (!mDynamicSize)
+	U32 needed_size = sizeof(U16) * nindices;
+
+	if (needed_size > mIndicesSize || needed_size <= mIndicesSize/2)
 	{
-		mNumIndices = nindices;
+		createGLIndices(needed_size);
 	}
-	else if (mUsage == GL_STATIC_DRAW_ARB ||
-		nindices > mNumIndices ||
-		nindices < mNumIndices/2)
-	{
-		if (mUsage != GL_STATIC_DRAW_ARB)
-		{
-			nindices += nindices/4;
-		}
 
-		mNumIndices = nindices;
-	}
+	mNumIndices = nindices;
 }
 
 void LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create)
 {
 	LLMemType mt2(LLMemType::MTYPE_VERTEX_ALLOCATE_BUFFER);
-		
+	
+	stop_glerror();
+
 	if (nverts < 0 || nindices < 0 ||
 		nverts > 65536)
 	{
@@ -898,139 +1155,169 @@ void LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create)
 	updateNumVerts(nverts);
 	updateNumIndices(nindices);
 	
-	if (mMappedData)
-	{
-		llerrs << "LLVertexBuffer::allocateBuffer() called redundantly." << llendl;
-	}
 	if (create && (nverts || nindices))
 	{
-		createGLBuffer();
-		createGLIndices();
+		//actually allocate space for the vertex buffer if using VBO mapping
+		flush();
+
+		if (gGLManager.mHasVertexArrayObject && useVBOs() && (LLRender::sGLCoreProfile || sUseVAO))
+		{
+#if GL_ARB_vertex_array_object
+			glGenVertexArrays(1, &mGLArray);
+#endif
+			setupVertexArray();
+		}
 	}
-	
-	sAllocatedBytes += getSize() + getIndicesSize();
 }
 
-void LLVertexBuffer::resizeBuffer(S32 newnverts, S32 newnindices)
-{
-	llassert(newnverts >= 0);
-	llassert(newnindices >= 0);
-
-	mRequestedNumVerts = newnverts;
-	mRequestedNumIndices = newnindices;
+static LLFastTimer::DeclareTimer FTM_SETUP_VERTEX_ARRAY("Setup VAO");
 
-	LLMemType mt2(LLMemType::MTYPE_VERTEX_RESIZE_BUFFER);
-	mDynamicSize = TRUE;
-	if (mUsage == GL_STATIC_DRAW_ARB)
-	{ //always delete/allocate static buffers on resize
-		destroyGLBuffer();
-		destroyGLIndices();
-		allocateBuffer(newnverts, newnindices, TRUE);
-		mFinal = FALSE;
-	}
-	else if (newnverts > mNumVerts || newnindices > mNumIndices ||
-			 newnverts < mNumVerts/2 || newnindices < mNumIndices/2)
+void LLVertexBuffer::setupVertexArray()
+{
+	if (!mGLArray)
 	{
-		sAllocatedBytes -= getSize() + getIndicesSize();
-		
-		updateNumVerts(newnverts);		
-		updateNumIndices(newnindices);
-		
-		S32 newsize = getSize();
-		S32 new_index_size = getIndicesSize();
-
-		sAllocatedBytes += newsize + new_index_size;
+		return;
+	}
 
-		if (newsize)
+	LLFastTimer t(FTM_SETUP_VERTEX_ARRAY);
+#if GL_ARB_vertex_array_object
+	glBindVertexArray(mGLArray);
+#endif
+	sGLRenderArray = mGLArray;
+
+	U32 attrib_size[] = 
+	{
+		3, //TYPE_VERTEX,
+		3, //TYPE_NORMAL,
+		2, //TYPE_TEXCOORD0,
+		2, //TYPE_TEXCOORD1,
+		2, //TYPE_TEXCOORD2,
+		2, //TYPE_TEXCOORD3,
+		4, //TYPE_COLOR,
+		4, //TYPE_EMISSIVE,
+		3, //TYPE_BINORMAL,
+		1, //TYPE_WEIGHT,
+		4, //TYPE_WEIGHT4,
+		4, //TYPE_CLOTHWEIGHT,
+		4, //TYPE_TEXTURE_INDEX
+	};
+
+	U32 attrib_type[] =
+	{
+		GL_FLOAT, //TYPE_VERTEX,
+		GL_FLOAT, //TYPE_NORMAL,
+		GL_FLOAT, //TYPE_TEXCOORD0,
+		GL_FLOAT, //TYPE_TEXCOORD1,
+		GL_FLOAT, //TYPE_TEXCOORD2,
+		GL_FLOAT, //TYPE_TEXCOORD3,
+		GL_UNSIGNED_BYTE, //TYPE_COLOR,
+		GL_UNSIGNED_BYTE, //TYPE_EMISSIVE,
+		GL_FLOAT,   //TYPE_BINORMAL,
+		GL_FLOAT, //TYPE_WEIGHT,
+		GL_FLOAT, //TYPE_WEIGHT4,
+		GL_FLOAT, //TYPE_CLOTHWEIGHT,
+		GL_UNSIGNED_BYTE, //TYPE_TEXTURE_INDEX
+	};
+
+	bool attrib_integer[] = 
+	{
+		false, //TYPE_VERTEX,
+		false, //TYPE_NORMAL,
+		false, //TYPE_TEXCOORD0,
+		false, //TYPE_TEXCOORD1,
+		false, //TYPE_TEXCOORD2,
+		false, //TYPE_TEXCOORD3,
+		false, //TYPE_COLOR,
+		false, //TYPE_EMISSIVE,
+		false, //TYPE_BINORMAL,
+		false, //TYPE_WEIGHT,
+		false, //TYPE_WEIGHT4,
+		false, //TYPE_CLOTHWEIGHT,
+		true, //TYPE_TEXTURE_INDEX
+	};
+
+	U32 attrib_normalized[] =
+	{
+		GL_FALSE, //TYPE_VERTEX,
+		GL_FALSE, //TYPE_NORMAL,
+		GL_FALSE, //TYPE_TEXCOORD0,
+		GL_FALSE, //TYPE_TEXCOORD1,
+		GL_FALSE, //TYPE_TEXCOORD2,
+		GL_FALSE, //TYPE_TEXCOORD3,
+		GL_TRUE, //TYPE_COLOR,
+		GL_TRUE, //TYPE_EMISSIVE,
+		GL_FALSE,   //TYPE_BINORMAL,
+		GL_FALSE, //TYPE_WEIGHT,
+		GL_FALSE, //TYPE_WEIGHT4,
+		GL_FALSE, //TYPE_CLOTHWEIGHT,
+		GL_FALSE, //TYPE_TEXTURE_INDEX
+	};
+
+	bindGLBuffer(true);
+	bindGLIndices(true);
+
+	for (U32 i = 0; i < TYPE_MAX; ++i)
+	{
+		if (mTypeMask & (1 << i))
 		{
-			if (!mGLBuffer)
-			{ //no buffer exists, create a new one
-				createGLBuffer();
-			}
-			else
+			glEnableVertexAttribArrayARB(i);
+
+			if (attrib_integer[i])
 			{
-				if (!useVBOs())
+#if !LL_DARWIN
+				//glVertexattribIPointer requires GLSL 1.30 or later
+				if (gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 30)
 				{
-					FREE_MEM(sPrivatePoolp, mMappedData);
-					mMappedData = (U8*)ALLOCATE_MEM(sPrivatePoolp, newsize);
+					glVertexAttribIPointer(i, attrib_size[i], attrib_type[i], sTypeSize[i], (void*) mOffsets[i]); 
 				}
-				mResized = TRUE;
-			}
-		}
-		else if (mGLBuffer)
-		{
-			destroyGLBuffer();
-		}
-		
-		if (new_index_size)
-		{
-			if (!mGLIndices)
-			{
-				createGLIndices();
+#endif
 			}
 			else
 			{
-				if (!useVBOs())
-				{
-					FREE_MEM(sPrivatePoolp, mMappedIndexData) ;
-					mMappedIndexData = (U8*)ALLOCATE_MEM(sPrivatePoolp, new_index_size);
-				}
-				mResized = TRUE;
+				glVertexAttribPointerARB(i, attrib_size[i], attrib_type[i], attrib_normalized[i], sTypeSize[i], (void*) mOffsets[i]); 
 			}
 		}
-		else if (mGLIndices)
+		else
 		{
-			destroyGLIndices();
-		}
-	}
-
-	if (mResized && useVBOs())
-	{
-		freeClientBuffer() ;
-		setBuffer(0);
+			glDisableVertexAttribArrayARB(i);
+		}
 	}
-}
 
-BOOL LLVertexBuffer::useVBOs() const
-{
-	//it's generally ineffective to use VBO for things that are streaming on apple
-		
-	if (!mUsage)
-	{
-		return FALSE;
-	}
+	//draw a dummy triangle to set index array pointer
+	//glDrawElements(GL_TRIANGLES, 0, GL_UNSIGNED_SHORT, NULL);
 
-	return TRUE;
+	unbind();
 }
 
-//----------------------------------------------------------------------------
-void LLVertexBuffer::freeClientBuffer()
+void LLVertexBuffer::resizeBuffer(S32 newnverts, S32 newnindices)
 {
-	if(useVBOs() && sDisableVBOMapping && (mMappedData || mMappedIndexData))
-	{
-		FREE_MEM(sPrivatePoolp, mMappedData) ;
-		FREE_MEM(sPrivatePoolp, mMappedIndexData) ;
-		mMappedData = NULL ;
-		mMappedIndexData = NULL ;
-	}
-}
+	llassert(newnverts >= 0);
+	llassert(newnindices >= 0);
 
-void LLVertexBuffer::allocateClientVertexBuffer()
-{
-	if(!mMappedData)
+	LLMemType mt2(LLMemType::MTYPE_VERTEX_RESIZE_BUFFER);
+	
+	updateNumVerts(newnverts);		
+	updateNumIndices(newnindices);
+	
+	if (useVBOs())
 	{
-		mMappedData = (U8*)ALLOCATE_MEM(sPrivatePoolp, getSize());
+		flush();
+
+		if (mGLArray)
+		{ //if size changed, offsets changed
+			setupVertexArray();
+		}
 	}
 }
 
-void LLVertexBuffer::allocateClientIndexBuffer()
+bool LLVertexBuffer::useVBOs() const
 {
-	if(!mMappedIndexData)
-	{
-		mMappedIndexData = (U8*)ALLOCATE_MEM(sPrivatePoolp, getIndicesSize());		
-	}
+	//it's generally ineffective to use VBO for things that are streaming on apple
+	return (mUsage != 0);
 }
 
+//----------------------------------------------------------------------------
+
 bool expand_region(LLVertexBuffer::MappedRegion& region, S32 index, S32 count)
 {
 	S32 end = index+count;
@@ -1049,9 +1336,13 @@ bool expand_region(LLVertexBuffer::MappedRegion& region, S32 index, S32 count)
 	return true;
 }
 
+static LLFastTimer::DeclareTimer FTM_VBO_MAP_BUFFER_RANGE("VBO Map Range");
+static LLFastTimer::DeclareTimer FTM_VBO_MAP_BUFFER("VBO Map");
+
 // Map for data access
-U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_range)
+volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_range)
 {
+	bindGLBuffer(true);
 	LLMemType mt2(LLMemType::MTYPE_VERTEX_MAP_BUFFER);
 	if (mFinal)
 	{
@@ -1064,7 +1355,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
 		
 	if (useVBOs())
 	{
-		if (sDisableVBOMapping || gGLManager.mHasMapBufferRange || gGLManager.mHasFlushBufferRange)
+		if (!mMappable || gGLManager.mHasMapBufferRange || gGLManager.mHasFlushBufferRange)
 		{
 			if (count == -1)
 			{
@@ -1089,7 +1380,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
 			if (!mapped)
 			{
 				//not already mapped, map new region
-				MappedRegion region(type, !sDisableVBOMapping && map_range ? -1 : index, count);
+				MappedRegion region(type, mMappable && map_range ? -1 : index, count);
 				mMappedVertexRegions.push_back(region);
 			}
 		}
@@ -1102,25 +1393,24 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
 		if (!mVertexLocked)
 		{
 			LLMemType mt_v(LLMemType::MTYPE_VERTEX_MAP_BUFFER_VERTICES);
-			setBuffer(0, type);
-			mVertexLocked = TRUE;
+			mVertexLocked = true;
 			sMappedCount++;
 			stop_glerror();	
 
-			if(sDisableVBOMapping)
+			if(!mMappable)
 			{
 				map_range = false;
-				allocateClientVertexBuffer() ;
 			}
 			else
 			{
-				U8* src = NULL;
+				volatile U8* src = NULL;
 				waitFence();
 				if (gGLManager.mHasMapBufferRange)
 				{
 					if (map_range)
 					{
 #ifdef GL_ARB_map_buffer_range
+						LLFastTimer t(FTM_VBO_MAP_BUFFER_RANGE);
 						S32 offset = mOffsets[type] + sTypeSize[type]*index;
 						S32 length = (sTypeSize[type]*count+0xF) & ~0xF;
 						src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER_ARB, offset, length, 
@@ -1132,6 +1422,19 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
 					else
 					{
 #ifdef GL_ARB_map_buffer_range
+
+						if (gDebugGL)
+						{
+							GLint size = 0;
+							glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size);
+
+							if (size < mSize)
+							{
+								llerrs << "Invalid buffer size." << llendl;
+							}
+						}
+
+						LLFastTimer t(FTM_VBO_MAP_BUFFER);
 						src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER_ARB, 0, mSize, 
 							GL_MAP_WRITE_BIT | 
 							GL_MAP_FLUSH_EXPLICIT_BIT);
@@ -1159,7 +1462,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
 
 				llassert(src != NULL);
 
-				mMappedData = LL_NEXT_ALIGNED_ADDRESS<U8>(src);
+				mMappedData = LL_NEXT_ALIGNED_ADDRESS<volatile U8>(src);
 				mAlignedOffset = mMappedData - src;
 			
 				stop_glerror();
@@ -1169,17 +1472,17 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
 			{
 				log_glerror();
 
-			//check the availability of memory
-			LLMemory::logMemoryInfo(TRUE) ; 
+				//check the availability of memory
+				LLMemory::logMemoryInfo(true);
 			
-				if(!sDisableVBOMapping)
+				if(mMappable)
 				{			
 					//--------------------
 					//print out more debug info before crash
-					llinfos << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << llendl ;
-					GLint size ;
-					glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size) ;
-					llinfos << "GL_ARRAY_BUFFER_ARB size is " << size << llendl ;
+					llinfos << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << llendl;
+					GLint size;
+					glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size);
+					llinfos << "GL_ARRAY_BUFFER_ARB size is " << size << llendl;
 					//--------------------
 
 					GLint buff;
@@ -1194,7 +1497,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
 				}
 				else
 				{
-					llerrs << "memory allocation for vertex data failed." << llendl ;
+					llerrs << "memory allocation for vertex data failed." << llendl;
 				}
 			}
 		}
@@ -1204,7 +1507,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
 		map_range = false;
 	}
 	
-	if (map_range && gGLManager.mHasMapBufferRange && !sDisableVBOMapping)
+	if (map_range && gGLManager.mHasMapBufferRange && mMappable)
 	{
 		return mMappedData;
 	}
@@ -1214,9 +1517,14 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
 	}
 }
 
-U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
+
+static LLFastTimer::DeclareTimer FTM_VBO_MAP_INDEX_RANGE("IBO Map Range");
+static LLFastTimer::DeclareTimer FTM_VBO_MAP_INDEX("IBO Map");
+
+volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
 {
 	LLMemType mt2(LLMemType::MTYPE_VERTEX_MAP_BUFFER);
+	bindGLIndices(true);
 	if (mFinal)
 	{
 		llerrs << "LLVertexBuffer::mapIndexBuffer() called on a finalized buffer." << llendl;
@@ -1228,7 +1536,7 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
 
 	if (useVBOs())
 	{
-		if (sDisableVBOMapping || gGLManager.mHasMapBufferRange || gGLManager.mHasFlushBufferRange)
+		if (!mMappable || gGLManager.mHasMapBufferRange || gGLManager.mHasFlushBufferRange)
 		{
 			if (count == -1)
 			{
@@ -1250,7 +1558,7 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
 			if (!mapped)
 			{
 				//not already mapped, map new region
-				MappedRegion region(TYPE_INDEX, !sDisableVBOMapping && map_range ? -1 : index, count);
+				MappedRegion region(TYPE_INDEX, mMappable && map_range ? -1 : index, count);
 				mMappedIndexRegions.push_back(region);
 			}
 		}
@@ -1264,25 +1572,35 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
 		{
 			LLMemType mt_v(LLMemType::MTYPE_VERTEX_MAP_BUFFER_INDICES);
 
-			setBuffer(0, TYPE_INDEX);
-			mIndexLocked = TRUE;
+			mIndexLocked = true;
 			sMappedCount++;
 			stop_glerror();	
 
-			if(sDisableVBOMapping)
+			if (gDebugGL && useVBOs())
+			{
+				GLint elem = 0;
+				glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &elem);
+
+				if (elem != mGLIndices)
+				{
+					llerrs << "Wrong index buffer bound!" << llendl;
+				}
+			}
+
+			if(!mMappable)
 			{
 				map_range = false;
-				allocateClientIndexBuffer() ;
 			}
 			else
 			{
-				U8* src = NULL;
+				volatile U8* src = NULL;
 				waitFence();
 				if (gGLManager.mHasMapBufferRange)
 				{
 					if (map_range)
 					{
 #ifdef GL_ARB_map_buffer_range
+						LLFastTimer t(FTM_VBO_MAP_INDEX_RANGE);
 						S32 offset = sizeof(U16)*index;
 						S32 length = sizeof(U16)*count;
 						src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length, 
@@ -1294,6 +1612,7 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
 					else
 					{
 #ifdef GL_ARB_map_buffer_range
+						LLFastTimer t(FTM_VBO_MAP_INDEX);
 						src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, sizeof(U16)*mNumIndices, 
 							GL_MAP_WRITE_BIT | 
 							GL_MAP_FLUSH_EXPLICIT_BIT);
@@ -1315,6 +1634,7 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
 				}
 				else
 				{
+					LLFastTimer t(FTM_VBO_MAP_INDEX);
 					map_range = false;
 					src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
 				}
@@ -1331,9 +1651,9 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
 		if (!mMappedIndexData)
 		{
 			log_glerror();
-			LLMemory::logMemoryInfo(TRUE) ;
+			LLMemory::logMemoryInfo(true);
 
-			if(!sDisableVBOMapping)
+			if(mMappable)
 			{
 				GLint buff;
 				glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff);
@@ -1346,7 +1666,7 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
 			}
 			else
 			{
-				llerrs << "memory allocation for Index data failed. " << llendl ;
+				llerrs << "memory allocation for Index data failed. " << llendl;
 			}
 		}
 	}
@@ -1355,7 +1675,7 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
 		map_range = false;
 	}
 
-	if (map_range && gGLManager.mHasMapBufferRange && !sDisableVBOMapping)
+	if (map_range && gGLManager.mHasMapBufferRange && mMappable)
 	{
 		return mMappedIndexData;
 	}
@@ -1365,21 +1685,30 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
 	}
 }
 
-void LLVertexBuffer::unmapBuffer(S32 type)
+static LLFastTimer::DeclareTimer FTM_VBO_UNMAP("VBO Unmap");
+static LLFastTimer::DeclareTimer FTM_VBO_FLUSH_RANGE("Flush VBO Range");
+
+
+static LLFastTimer::DeclareTimer FTM_IBO_UNMAP("IBO Unmap");
+static LLFastTimer::DeclareTimer FTM_IBO_FLUSH_RANGE("Flush IBO Range");
+
+void LLVertexBuffer::unmapBuffer()
 {
 	LLMemType mt2(LLMemType::MTYPE_VERTEX_UNMAP_BUFFER);
-	if (!useVBOs() || type == -2)
+	if (!useVBOs())
 	{
-		return ; //nothing to unmap
+		return; //nothing to unmap
 	}
 
-	bool updated_all = false ;
+	bool updated_all = false;
 
-	if (mMappedData && mVertexLocked && type != TYPE_INDEX)
+	if (mMappedData && mVertexLocked)
 	{
-		updated_all = (mIndexLocked && type < 0) ; //both vertex and index buffers done updating
+		LLFastTimer t(FTM_VBO_UNMAP);
+		bindGLBuffer(true);
+		updated_all = mIndexLocked; //both vertex and index buffers done updating
 
-		if(sDisableVBOMapping)
+		if(!mMappable)
 		{
 			if (!mMappedVertexRegions.empty())
 			{
@@ -1389,7 +1718,7 @@ void LLVertexBuffer::unmapBuffer(S32 type)
 					const MappedRegion& region = mMappedVertexRegions[i];
 					S32 offset = region.mIndex >= 0 ? mOffsets[region.mType]+sTypeSize[region.mType]*region.mIndex : 0;
 					S32 length = sTypeSize[region.mType]*region.mCount;
-					glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, offset, length, mMappedData+offset);
+					glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, offset, length, (U8*) mMappedData+offset);
 					stop_glerror();
 				}
 
@@ -1398,7 +1727,7 @@ void LLVertexBuffer::unmapBuffer(S32 type)
 			else
 			{
 				stop_glerror();
-				glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, getSize(), mMappedData);
+				glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, getSize(), (U8*) mMappedData);
 				stop_glerror();
 			}
 		}
@@ -1416,6 +1745,7 @@ void LLVertexBuffer::unmapBuffer(S32 type)
 						S32 length = sTypeSize[region.mType]*region.mCount;
 						if (gGLManager.mHasMapBufferRange)
 						{
+							LLFastTimer t(FTM_VBO_FLUSH_RANGE);
 #ifdef GL_ARB_map_buffer_range
 							glFlushMappedBufferRange(GL_ARRAY_BUFFER_ARB, offset, length);
 #endif
@@ -1437,13 +1767,15 @@ void LLVertexBuffer::unmapBuffer(S32 type)
 			mMappedData = NULL;
 		}
 
-		mVertexLocked = FALSE ;
+		mVertexLocked = false;
 		sMappedCount--;
 	}
 	
-	if (mMappedIndexData && mIndexLocked && (type < 0 || type == TYPE_INDEX))
+	if (mMappedIndexData && mIndexLocked)
 	{
-		if(sDisableVBOMapping)
+		LLFastTimer t(FTM_IBO_UNMAP);
+		bindGLIndices();
+		if(!mMappable)
 		{
 			if (!mMappedIndexRegions.empty())
 			{
@@ -1452,7 +1784,7 @@ void LLVertexBuffer::unmapBuffer(S32 type)
 					const MappedRegion& region = mMappedIndexRegions[i];
 					S32 offset = region.mIndex >= 0 ? sizeof(U16)*region.mIndex : 0;
 					S32 length = sizeof(U16)*region.mCount;
-					glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length, mMappedIndexData+offset);
+					glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length, (U8*) mMappedIndexData+offset);
 					stop_glerror();
 				}
 
@@ -1461,7 +1793,7 @@ void LLVertexBuffer::unmapBuffer(S32 type)
 			else
 			{
 				stop_glerror();
-				glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, getIndicesSize(), mMappedIndexData);
+				glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, getIndicesSize(), (U8*) mMappedIndexData);
 				stop_glerror();
 			}
 		}
@@ -1478,6 +1810,7 @@ void LLVertexBuffer::unmapBuffer(S32 type)
 						S32 length = sizeof(U16)*region.mCount;
 						if (gGLManager.mHasMapBufferRange)
 						{
+							LLFastTimer t(FTM_IBO_FLUSH_RANGE);
 #ifdef GL_ARB_map_buffer_range
 							glFlushMappedBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length);
 #endif
@@ -1498,30 +1831,16 @@ void LLVertexBuffer::unmapBuffer(S32 type)
 			glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB);
 			stop_glerror();
 
-			mMappedIndexData = NULL ;
+			mMappedIndexData = NULL;
 		}
 
-		mIndexLocked = FALSE ;
+		mIndexLocked = false;
 		sMappedCount--;
 	}
 
 	if(updated_all)
 	{
-		if(mUsage == GL_STATIC_DRAW_ARB)
-		{
-			//static draw buffers can only be mapped a single time
-			//throw out client data (we won't be using it again)
-			mEmpty = TRUE;
-			mFinal = TRUE;
-			if(sDisableVBOMapping)
-			{
-				freeClientBuffer() ;
-			}
-		}
-		else
-		{
-			mEmpty = FALSE;
-		}
+		mEmpty = false;
 	}
 }
 
@@ -1536,39 +1855,39 @@ template <class T,S32 type> struct VertexBufferStrider
 	{
 		if (type == LLVertexBuffer::TYPE_INDEX)
 		{
-			U8* ptr = vbo.mapIndexBuffer(index, count, map_range);
+			volatile U8* ptr = vbo.mapIndexBuffer(index, count, map_range);
 
 			if (ptr == NULL)
 			{
 				llwarns << "mapIndexBuffer failed!" << llendl;
-				return FALSE;
+				return false;
 			}
 
 			strider = (T*)ptr;
 			strider.setStride(0);
-			return TRUE;
+			return true;
 		}
 		else if (vbo.hasDataType(type))
 		{
 			S32 stride = LLVertexBuffer::sTypeSize[type];
 
-			U8* ptr = vbo.mapVertexBuffer(type, index, count, map_range);
+			volatile U8* ptr = vbo.mapVertexBuffer(type, index, count, map_range);
 
 			if (ptr == NULL)
 			{
 				llwarns << "mapVertexBuffer failed!" << llendl;
-				return FALSE;
+				return false;
 			}
 
 			strider = (T*)ptr;
 			strider.setStride(stride);
-			return TRUE;
+			return true;
 		}
 		else
 		{
 			llerrs << "VertexBufferStrider could not find valid vertex data." << llendl;
 		}
-		return FALSE;
+		return false;
 	}
 };
 
@@ -1576,6 +1895,10 @@ bool LLVertexBuffer::getVertexStrider(LLStrider<LLVector3>& strider, S32 index,
 {
 	return VertexBufferStrider<LLVector3,TYPE_VERTEX>::get(*this, strider, index, count, map_range);
 }
+bool LLVertexBuffer::getVertexStrider(LLStrider<LLVector4a>& strider, S32 index, S32 count, bool map_range)
+{
+	return VertexBufferStrider<LLVector4a,TYPE_VERTEX>::get(*this, strider, index, count, map_range);
+}
 bool LLVertexBuffer::getIndexStrider(LLStrider<U16>& strider, S32 index, S32 count, bool map_range)
 {
 	return VertexBufferStrider<U16,TYPE_INDEX>::get(*this, strider, index, count, map_range);
@@ -1601,6 +1924,10 @@ bool LLVertexBuffer::getColorStrider(LLStrider<LLColor4U>& strider, S32 index, S
 {
 	return VertexBufferStrider<LLColor4U,TYPE_COLOR>::get(*this, strider, index, count, map_range);
 }
+bool LLVertexBuffer::getEmissiveStrider(LLStrider<LLColor4U>& strider, S32 index, S32 count, bool map_range)
+{
+	return VertexBufferStrider<LLColor4U,TYPE_EMISSIVE>::get(*this, strider, index, count, map_range);
+}
 bool LLVertexBuffer::getWeightStrider(LLStrider<F32>& strider, S32 index, S32 count, bool map_range)
 {
 	return VertexBufferStrider<F32,TYPE_WEIGHT>::get(*this, strider, index, count, map_range);
@@ -1618,43 +1945,147 @@ bool LLVertexBuffer::getClothWeightStrider(LLStrider<LLVector4>& strider, S32 in
 
 //----------------------------------------------------------------------------
 
+static LLFastTimer::DeclareTimer FTM_BIND_GL_ARRAY("Bind Array");
+bool LLVertexBuffer::bindGLArray()
+{
+	if (mGLArray && sGLRenderArray != mGLArray)
+	{
+		{
+			LLFastTimer t(FTM_BIND_GL_ARRAY);
+#if GL_ARB_vertex_array_object
+			glBindVertexArray(mGLArray);
+#endif
+			sGLRenderArray = mGLArray;
+		}
+
+		//really shouldn't be necessary, but some drivers don't properly restore the
+		//state of GL_ELEMENT_ARRAY_BUFFER_BINDING
+		bindGLIndices();
+		
+		return true;
+	}
+		
+	return false;
+}
+
+static LLFastTimer::DeclareTimer FTM_BIND_GL_BUFFER("Bind Buffer");
+
+bool LLVertexBuffer::bindGLBuffer(bool force_bind)
+{
+	bindGLArray();
+
+	bool ret = false;
+
+	if (useVBOs() && (force_bind || (mGLBuffer && (mGLBuffer != sGLRenderBuffer || !sVBOActive))))
+	{
+		LLFastTimer t(FTM_BIND_GL_BUFFER);
+		/*if (sMapped)
+		{
+			llerrs << "VBO bound while another VBO mapped!" << llendl;
+		}*/
+		glBindBufferARB(GL_ARRAY_BUFFER_ARB, mGLBuffer);
+		sGLRenderBuffer = mGLBuffer;
+		sBindCount++;
+		sVBOActive = true;
+
+		if (mGLArray)
+		{
+			llassert(sGLRenderArray == mGLArray);
+			//mCachedRenderBuffer = mGLBuffer;
+		}
+
+		ret = true;
+	}
+
+	return ret;
+}
+
+static LLFastTimer::DeclareTimer FTM_BIND_GL_INDICES("Bind Indices");
+
+bool LLVertexBuffer::bindGLIndices(bool force_bind)
+{
+	bindGLArray();
+
+	bool ret = false;
+	if (useVBOs() && (force_bind || (mGLIndices && (mGLIndices != sGLRenderIndices || !sIBOActive))))
+	{
+		LLFastTimer t(FTM_BIND_GL_INDICES);
+		/*if (sMapped)
+		{
+			llerrs << "VBO bound while another VBO mapped!" << llendl;
+		}*/
+		glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mGLIndices);
+		sGLRenderIndices = mGLIndices;
+		stop_glerror();
+		sBindCount++;
+		sIBOActive = true;
+		ret = true;
+	}
+
+	return ret;
+}
+
+void LLVertexBuffer::flush()
+{
+	if (useVBOs())
+	{
+		unmapBuffer();
+	}
+}
+
 // Set for rendering
-void LLVertexBuffer::setBuffer(U32 data_mask, S32 type)
+void LLVertexBuffer::setBuffer(U32 data_mask)
 {
+	flush();
+
 	LLMemType mt2(LLMemType::MTYPE_VERTEX_SET_BUFFER);
 	//set up pointers if the data mask is different ...
-	BOOL setup = (sLastMask != data_mask);
+	bool setup = (sLastMask != data_mask);
+
+	if (gDebugGL && data_mask != 0)
+	{ //make sure data requirements are fulfilled
+		LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+		if (shader)
+		{
+			U32 required_mask = 0;
+			for (U32 i = 0; i < LLVertexBuffer::TYPE_TEXTURE_INDEX; ++i)
+			{
+				if (shader->getAttribLocation(i) > -1)
+				{
+					U32 required = 1 << i;
+					if ((data_mask & required) == 0)
+					{
+						llwarns << "Missing attribute: " << LLShaderMgr::instance()->mReservedAttribs[i] << llendl;
+					}
+
+					required_mask |= required;
+				}
+			}
+
+			if ((data_mask & required_mask) != required_mask)
+			{
+				llerrs << "Shader consumption mismatches data provision." << llendl;
+			}
+		}
+	}
 
 	if (useVBOs())
 	{
-		if (mGLBuffer && (mGLBuffer != sGLRenderBuffer || !sVBOActive))
+		if (mGLArray)
 		{
-			/*if (sMapped)
-			{
-				llerrs << "VBO bound while another VBO mapped!" << llendl;
-			}*/
-			stop_glerror();
-			glBindBufferARB(GL_ARRAY_BUFFER_ARB, mGLBuffer);
-			stop_glerror();
-			sBindCount++;
-			sVBOActive = TRUE;
-			setup = TRUE; // ... or the bound buffer changed
+			bindGLArray();
+			setup = false; //do NOT perform pointer setup if using VAO
 		}
-		if (mGLIndices && (mGLIndices != sGLRenderIndices || !sIBOActive))
+		else
 		{
-			/*if (sMapped)
-			{
-				llerrs << "VBO bound while another VBO mapped!" << llendl;
-			}*/
-			stop_glerror();
-			glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mGLIndices);
-			stop_glerror();
-			sBindCount++;
-			sIBOActive = TRUE;
+			const bool bindBuffer = bindGLBuffer();
+			const bool bindIndices = bindGLIndices();
+			
+			setup = setup || bindBuffer || bindIndices;
 		}
-		
-		BOOL error = FALSE;
-		if (gDebugGL)
+
+		bool error = false;
+		if (gDebugGL && !mGLArray)
 		{
 			GLint buff;
 			glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff);
@@ -1662,7 +2093,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask, S32 type)
 			{
 				if (gDebugSession)
 				{
-					error = TRUE;
+					error = true;
 					gFailLog << "Invalid GL vertex buffer bound: " << buff << std::endl;
 				}
 				else
@@ -1678,7 +2109,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask, S32 type)
 				{
 					if (gDebugSession)
 					{
-						error = TRUE;
+						error = true;
 						gFailLog << "Invalid GL index buffer bound: " << buff <<  std::endl;
 					}
 					else
@@ -1689,116 +2120,55 @@ void LLVertexBuffer::setBuffer(U32 data_mask, S32 type)
 			}
 		}
 
-		if (mResized)
+		
+	}
+	else
+	{	
+		if (sGLRenderArray)
 		{
-			if (gDebugGL)
-			{
-				GLint buff;
-				glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff);
-				if ((GLuint)buff != mGLBuffer)
-				{
-					if (gDebugSession)
-					{
-						error = TRUE;
-						gFailLog << "Invalid GL vertex buffer bound: " << std::endl;
-					}
-					else
-					{
-						llerrs << "Invalid GL vertex buffer bound: " << buff << llendl;
-					}
-				}
-
-				if (mGLIndices != 0)
-				{
-					glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff);
-					if ((GLuint)buff != mGLIndices)
-					{
-						if (gDebugSession)
-						{
-							error = TRUE;
-							gFailLog << "Invalid GL index buffer bound: "<< std::endl;
-						}
-						else
-						{
-							llerrs << "Invalid GL index buffer bound: " << buff << llendl;
-						}
-					}
-				}
-			}
-
-			if (mGLBuffer)
-			{
-				stop_glerror();
-				glBufferDataARB(GL_ARRAY_BUFFER_ARB, getSize(), NULL, mUsage);
-				stop_glerror();
-			}
-			if (mGLIndices)
-			{
-				stop_glerror();
-				glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, getIndicesSize(), NULL, mUsage);
-				stop_glerror();
-			}
-
-			mEmpty = TRUE;
-			mResized = FALSE;
-
-			if (data_mask != 0)
-			{
-				if (gDebugSession)
-				{
-					error = TRUE;
-					gFailLog << "Buffer set for rendering before being filled after resize." << std::endl;
-				}
-				else
-				{
-					llerrs << "Buffer set for rendering before being filled after resize." << llendl;
-				}
-			}
+#if GL_ARB_vertex_array_object
+			glBindVertexArray(0);
+#endif
+			sGLRenderArray = 0;
+			sGLRenderIndices = 0;
+			sIBOActive = false;
 		}
 
-		if (error)
-		{
-			ll_fail("LLVertexBuffer::mapBuffer failed");
-		}
-		unmapBuffer(type);
-	}
-	else
-	{		
 		if (mGLBuffer)
 		{
 			if (sVBOActive)
 			{
 				glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
 				sBindCount++;
-				sVBOActive = FALSE;
-				setup = TRUE; // ... or a VBO is deactivated
+				sVBOActive = false;
+				setup = true; // ... or a VBO is deactivated
 			}
 			if (sGLRenderBuffer != mGLBuffer)
 			{
-				setup = TRUE; // ... or a client memory pointer changed
+				sGLRenderBuffer = mGLBuffer;
+				setup = true; // ... or a client memory pointer changed
 			}
 		}
-		if (mGLIndices && sIBOActive)
+		if (mGLIndices)
 		{
-			/*if (sMapped)
+			if (sIBOActive)
 			{
-				llerrs << "VBO unbound while potentially mapped!" << llendl;
-			}*/
-			glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
-			sBindCount++;
-			sIBOActive = FALSE;
+				glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
+				sBindCount++;
+				sIBOActive = false;
+			}
+			
+			sGLRenderIndices = mGLIndices;
 		}
 	}
 
-	setupClientArrays(data_mask);
-	
-	if (mGLIndices)
+	if (!mGLArray)
 	{
-		sGLRenderIndices = mGLIndices;
+		setupClientArrays(data_mask);
 	}
+			
 	if (mGLBuffer)
 	{
-		sGLRenderBuffer = mGLBuffer;
 		if (data_mask && setup)
 		{
 			setupVertexBuffer(data_mask); // subclass specific setup (virtual function)
@@ -1808,80 +2178,153 @@ void LLVertexBuffer::setBuffer(U32 data_mask, S32 type)
 }
 
 // virtual (default)
-void LLVertexBuffer::setupVertexBuffer(U32 data_mask) const
+void LLVertexBuffer::setupVertexBuffer(U32 data_mask)
 {
 	LLMemType mt2(LLMemType::MTYPE_VERTEX_SETUP_VERTEX_BUFFER);
 	stop_glerror();
-	U8* base = useVBOs() ? (U8*) mAlignedOffset : mMappedData;
+	volatile U8* base = useVBOs() ? (U8*) mAlignedOffset : mMappedData;
 
-	if ((data_mask & mTypeMask) != data_mask)
+	/*if ((data_mask & mTypeMask) != data_mask)
 	{
 		llerrs << "LLVertexBuffer::setupVertexBuffer missing required components for supplied data mask." << llendl;
-	}
-
-	if (data_mask & MAP_NORMAL)
-	{
-		glNormalPointer(GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_NORMAL], (void*)(base + mOffsets[TYPE_NORMAL]));
-	}
-	if (data_mask & MAP_TEXCOORD3)
-	{
-		glClientActiveTextureARB(GL_TEXTURE3_ARB);
-		glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], (void*)(base + mOffsets[TYPE_TEXCOORD3]));
-		glClientActiveTextureARB(GL_TEXTURE0_ARB);
-	}
-	if (data_mask & MAP_TEXCOORD2)
-	{
-		glClientActiveTextureARB(GL_TEXTURE2_ARB);
-		glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], (void*)(base + mOffsets[TYPE_TEXCOORD2]));
-		glClientActiveTextureARB(GL_TEXTURE0_ARB);
-	}
-	if (data_mask & MAP_TEXCOORD1)
-	{
-		glClientActiveTextureARB(GL_TEXTURE1_ARB);
-		glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], (void*)(base + mOffsets[TYPE_TEXCOORD1]));
-		glClientActiveTextureARB(GL_TEXTURE0_ARB);
-	}
-	if (data_mask & MAP_BINORMAL)
-	{
-		glClientActiveTextureARB(GL_TEXTURE2_ARB);
-		glTexCoordPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_BINORMAL], (void*)(base + mOffsets[TYPE_BINORMAL]));
-		glClientActiveTextureARB(GL_TEXTURE0_ARB);
-	}
-	if (data_mask & MAP_TEXCOORD0)
-	{
-		glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], (void*)(base + mOffsets[TYPE_TEXCOORD0]));
-	}
-	if (data_mask & MAP_COLOR)
-	{
-		glColorPointer(4, GL_UNSIGNED_BYTE, LLVertexBuffer::sTypeSize[TYPE_COLOR], (void*)(base + mOffsets[TYPE_COLOR]));
-	}
-	
-	if (data_mask & MAP_WEIGHT)
-	{
-		glVertexAttribPointerARB(1, 1, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], (void*)(base + mOffsets[TYPE_WEIGHT]));
-	}
-
-	if (data_mask & MAP_WEIGHT4 && sWeight4Loc != -1)
-	{
-		glVertexAttribPointerARB(sWeight4Loc, 4, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], (void*)(base+mOffsets[TYPE_WEIGHT4]));
-	}
+	}*/
 
-	if (data_mask & MAP_CLOTHWEIGHT)
+	if (LLGLSLShader::sNoFixedFunction)
 	{
-		glVertexAttribPointerARB(4, 4, GL_FLOAT, TRUE,  LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]));
-	}
-	if (data_mask & MAP_VERTEX)
+		if (data_mask & MAP_NORMAL)
+		{
+			S32 loc = TYPE_NORMAL;
+			void* ptr = (void*)(base + mOffsets[TYPE_NORMAL]);
+			glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], ptr);
+		}
+		if (data_mask & MAP_TEXCOORD3)
+		{
+			S32 loc = TYPE_TEXCOORD3;
+			void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD3]);
+			glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], ptr);
+		}
+		if (data_mask & MAP_TEXCOORD2)
+		{
+			S32 loc = TYPE_TEXCOORD2;
+			void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD2]);
+			glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], ptr);
+		}
+		if (data_mask & MAP_TEXCOORD1)
+		{
+			S32 loc = TYPE_TEXCOORD1;
+			void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD1]);
+			glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], ptr);
+		}
+		if (data_mask & MAP_BINORMAL)
+		{
+			S32 loc = TYPE_BINORMAL;
+			void* ptr = (void*)(base + mOffsets[TYPE_BINORMAL]);
+			glVertexAttribPointerARB(loc, 3,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_BINORMAL], ptr);
+		}
+		if (data_mask & MAP_TEXCOORD0)
+		{
+			S32 loc = TYPE_TEXCOORD0;
+			void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD0]);
+			glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], ptr);
+		}
+		if (data_mask & MAP_COLOR)
+		{
+			S32 loc = TYPE_COLOR;
+			void* ptr = (void*)(base + mOffsets[TYPE_COLOR]);
+			glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], ptr);
+		}
+		if (data_mask & MAP_EMISSIVE)
+		{
+			S32 loc = TYPE_EMISSIVE;
+			void* ptr = (void*)(base + mOffsets[TYPE_EMISSIVE]);
+			glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
+		}
+		if (data_mask & MAP_WEIGHT)
+		{
+			S32 loc = TYPE_WEIGHT;
+			void* ptr = (void*)(base + mOffsets[TYPE_WEIGHT]);
+			glVertexAttribPointerARB(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr);
+		}
+		if (data_mask & MAP_WEIGHT4)
+		{
+			S32 loc = TYPE_WEIGHT4;
+			void* ptr = (void*)(base+mOffsets[TYPE_WEIGHT4]);
+			glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr);
+		}
+		if (data_mask & MAP_CLOTHWEIGHT)
+		{
+			S32 loc = TYPE_CLOTHWEIGHT;
+			void* ptr = (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]);
+			glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_TRUE,  LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr);
+		}
+		if (data_mask & MAP_TEXTURE_INDEX && 
+				(gGLManager.mGLSLVersionMajor >= 2 || gGLManager.mGLSLVersionMinor >= 30)) //indexed texture rendering requires GLSL 1.30 or later
+		{
+#if !LL_DARWIN
+			S32 loc = TYPE_TEXTURE_INDEX;
+			void *ptr = (void*) (base + mOffsets[TYPE_VERTEX] + 12);
+			glVertexAttribIPointer(loc, 4, GL_UNSIGNED_BYTE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);
+#endif
+		}
+		if (data_mask & MAP_VERTEX)
+		{
+			S32 loc = TYPE_VERTEX;
+			void* ptr = (void*)(base + mOffsets[TYPE_VERTEX]);
+			glVertexAttribPointerARB(loc, 3,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);
+		}	
+	}	
+	else
 	{
-		if (data_mask & MAP_TEXTURE_INDEX)
+		if (data_mask & MAP_NORMAL)
 		{
-			glVertexPointer(4,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0));
+			glNormalPointer(GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_NORMAL], (void*)(base + mOffsets[TYPE_NORMAL]));
 		}
-		else
+		if (data_mask & MAP_TEXCOORD3)
 		{
-			glVertexPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0));
+			glClientActiveTextureARB(GL_TEXTURE3_ARB);
+			glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], (void*)(base + mOffsets[TYPE_TEXCOORD3]));
+			glClientActiveTextureARB(GL_TEXTURE0_ARB);
+		}
+		if (data_mask & MAP_TEXCOORD2)
+		{
+			glClientActiveTextureARB(GL_TEXTURE2_ARB);
+			glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], (void*)(base + mOffsets[TYPE_TEXCOORD2]));
+			glClientActiveTextureARB(GL_TEXTURE0_ARB);
+		}
+		if (data_mask & MAP_TEXCOORD1)
+		{
+			glClientActiveTextureARB(GL_TEXTURE1_ARB);
+			glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], (void*)(base + mOffsets[TYPE_TEXCOORD1]));
+			glClientActiveTextureARB(GL_TEXTURE0_ARB);
+		}
+		if (data_mask & MAP_BINORMAL)
+		{
+			glClientActiveTextureARB(GL_TEXTURE2_ARB);
+			glTexCoordPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_BINORMAL], (void*)(base + mOffsets[TYPE_BINORMAL]));
+			glClientActiveTextureARB(GL_TEXTURE0_ARB);
 		}
+		if (data_mask & MAP_TEXCOORD0)
+		{
+			glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], (void*)(base + mOffsets[TYPE_TEXCOORD0]));
+		}
+		if (data_mask & MAP_COLOR)
+		{
+			glColorPointer(4, GL_UNSIGNED_BYTE, LLVertexBuffer::sTypeSize[TYPE_COLOR], (void*)(base + mOffsets[TYPE_COLOR]));
+		}
+		if (data_mask & MAP_VERTEX)
+		{
+			glVertexPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0));
+		}	
 	}
 
 	llglassertok();
 }
 
+LLVertexBuffer::MappedRegion::MappedRegion(S32 type, S32 index, S32 count)
+: mType(type), mIndex(index), mCount(count)
+{ 
+	llassert(mType == LLVertexBuffer::TYPE_INDEX || 
+			mType < LLVertexBuffer::TYPE_TEXTURE_INDEX);
+}	
+
+
diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h
index 578cec38859c6d88d4eda6964fad47efa7cf9f0e..d85919966309cbdc435e3dc7935603bb3e32c5c0 100644
--- a/indra/llrender/llvertexbuffer.h
+++ b/indra/llrender/llvertexbuffer.h
@@ -38,6 +38,8 @@
 #include <vector>
 #include <list>
 
+#define LL_MAX_VERTEX_ATTRIB_LOCATION 64
+
 //============================================================================
 // NOTES
 // Threading:
@@ -49,25 +51,37 @@
 
 //============================================================================
 // gl name pools for dynamic and streaming buffers
-
-class LLVBOPool : public LLGLNamePool
+class LLVBOPool
 {
-protected:
-	virtual GLuint allocateName()
-	{
-		GLuint name;
-		stop_glerror();
-		glGenBuffersARB(1, &name);
-		stop_glerror();
-		return name;
-	}
+public:
+	static U32 sBytesPooled;
+	
+	LLVBOPool(U32 vboUsage, U32 vboType)
+		: mUsage(vboUsage)
+		, mType(vboType)
+	{}
+
+	const U32 mUsage;
+	const U32 mType;
 
-	virtual void releaseName(GLuint name)
+	//size MUST be a power of 2
+	volatile U8* allocate(U32& name, U32 size);
+	
+	//size MUST be the size provided to allocate that returned the given name
+	void release(U32 name, volatile U8* buffer, U32 size);
+	
+	//destroy all records in mFreeList
+	void cleanup();
+
+	class Record
 	{
-		stop_glerror();
-		glDeleteBuffersARB(1, &name);
-		stop_glerror();
-	}
+	public:
+		U32 mGLName;
+		volatile U8* mClientData;
+	};
+
+	typedef std::list<Record> record_list_t;
+	std::vector<record_list_t> mFreeList;
 };
 
 class LLGLFence
@@ -79,7 +93,7 @@ class LLGLFence
 
 //============================================================================
 // base class 
-class LLPrivateMemoryPool ;
+class LLPrivateMemoryPool;
 class LLVertexBuffer : public LLRefCount
 {
 public:
@@ -90,12 +104,11 @@ class LLVertexBuffer : public LLRefCount
 		S32 mIndex;
 		S32 mCount;
 		
-		MappedRegion(S32 type, S32 index, S32 count)
-			: mType(type), mIndex(index), mCount(count)
-		{ }	
+		MappedRegion(S32 type, S32 index, S32 count);
 	};
 
 	LLVertexBuffer(const LLVertexBuffer& rhs)
+		: mUsage(rhs.mUsage)
 	{
 		*this = rhs;
 	}
@@ -111,18 +124,17 @@ class LLVertexBuffer : public LLRefCount
 	static LLVBOPool sStreamIBOPool;
 	static LLVBOPool sDynamicIBOPool;
 
-	static S32	sWeight4Loc;
-
-	static BOOL	sUseStreamDraw;
-	static BOOL	sPreferStreamDraw;
+	static bool	sUseStreamDraw;
+	static bool sUseVAO;
+	static bool	sPreferStreamDraw;
 
 	static void initClass(bool use_vbo, bool no_vbo_mapping);
 	static void cleanupClass();
 	static void setupClientArrays(U32 data_mask);
 	static void drawArrays(U32 mode, const std::vector<LLVector3>& pos, const std::vector<LLVector3>& norm);
+	static void drawElements(U32 mode, const LLVector4a* pos, const LLVector2* tc, S32 num_indices, const U16* indicesp);
 
- 	static void clientCopy(F64 max_time = 0.005); //copy data from client to GL
-	static void unbind(); //unbind any bound vertex buffer
+ 	static void unbind(); //unbind any bound vertex buffer
 
 	//get the size of a vertex with the given typemask
 	static S32 calcVertexSize(const U32& typemask);
@@ -133,24 +145,29 @@ class LLVertexBuffer : public LLRefCount
 	static S32 calcOffsets(const U32& typemask, S32* offsets, S32 num_vertices);		
 
 	
+	//WARNING -- when updating these enums you MUST 
+	// 1 - update LLVertexBuffer::sTypeSize
+	// 2 - add a strider accessor
+	// 3 - modify LLVertexBuffer::setupVertexBuffer
+	// 4 - modify LLVertexBuffer::setupClientArray
+	// 5 - modify LLViewerShaderMgr::mReservedAttribs
+	// 6 - update LLVertexBuffer::setupVertexArray
 	enum {
-		TYPE_VERTEX,
+		TYPE_VERTEX = 0,
 		TYPE_NORMAL,
 		TYPE_TEXCOORD0,
 		TYPE_TEXCOORD1,
 		TYPE_TEXCOORD2,
 		TYPE_TEXCOORD3,
 		TYPE_COLOR,
-		// These use VertexAttribPointer and should possibly be made generic
+		TYPE_EMISSIVE,
 		TYPE_BINORMAL,
 		TYPE_WEIGHT,
 		TYPE_WEIGHT4,
 		TYPE_CLOTHWEIGHT,
-		TYPE_MAX,
-		TYPE_INDEX,
-		
-		//no actual additional data, but indicates position.w is texture index
 		TYPE_TEXTURE_INDEX,
+		TYPE_MAX,
+		TYPE_INDEX,		
 	};
 	enum {
 		MAP_VERTEX = (1<<TYPE_VERTEX),
@@ -160,6 +177,7 @@ class LLVertexBuffer : public LLRefCount
 		MAP_TEXCOORD2 = (1<<TYPE_TEXCOORD2),
 		MAP_TEXCOORD3 = (1<<TYPE_TEXCOORD3),
 		MAP_COLOR = (1<<TYPE_COLOR),
+		MAP_EMISSIVE = (1<<TYPE_EMISSIVE),
 		// These use VertexAttribPointer and should possibly be made generic
 		MAP_BINORMAL = (1<<TYPE_BINORMAL),
 		MAP_WEIGHT = (1<<TYPE_WEIGHT),
@@ -173,33 +191,35 @@ class LLVertexBuffer : public LLRefCount
 
 	virtual ~LLVertexBuffer(); // use unref()
 
-	virtual void setupVertexBuffer(U32 data_mask) const; // pure virtual, called from mapBuffer()
+	virtual void setupVertexBuffer(U32 data_mask); // pure virtual, called from mapBuffer()
+	void setupVertexArray();
 	
-	void	genBuffer();
-	void	genIndices();
+	void	genBuffer(U32 size);
+	void	genIndices(U32 size);
+	bool	bindGLBuffer(bool force_bind = false);
+	bool	bindGLIndices(bool force_bind = false);
+	bool	bindGLArray();
 	void	releaseBuffer();
 	void	releaseIndices();
-	void	createGLBuffer();
-	void	createGLIndices();
+	void	createGLBuffer(U32 size);
+	void	createGLIndices(U32 size);
 	void 	destroyGLBuffer();
 	void 	destroyGLIndices();
 	void	updateNumVerts(S32 nverts);
 	void	updateNumIndices(S32 nindices); 
-	virtual BOOL	useVBOs() const;
-	void	unmapBuffer(S32 type);
-	void freeClientBuffer() ;
-	void allocateClientVertexBuffer() ;
-	void allocateClientIndexBuffer() ;
-
+	bool	useVBOs() const;
+	void	unmapBuffer();
+		
 public:
 	LLVertexBuffer(U32 typemask, S32 usage);
 	
 	// map for data access
-	U8*		mapVertexBuffer(S32 type, S32 index, S32 count, bool map_range);
-	U8*		mapIndexBuffer(S32 index, S32 count, bool map_range);
+	volatile U8*		mapVertexBuffer(S32 type, S32 index, S32 count, bool map_range);
+	volatile U8*		mapIndexBuffer(S32 index, S32 count, bool map_range);
 
 	// set for rendering
-	virtual void	setBuffer(U32 data_mask, S32 type = -1); 	// calls  setupVertexBuffer() if data_mask is not 0
+	virtual void	setBuffer(U32 data_mask); 	// calls  setupVertexBuffer() if data_mask is not 0
+	void flush(); //flush pending data to GL memory
 	// allocate buffer
 	void	allocateBuffer(S32 nverts, S32 nindices, bool create);
 	virtual void resizeBuffer(S32 newnverts, S32 newnindices);
@@ -212,33 +232,35 @@ class LLVertexBuffer : public LLRefCount
 	//   setVertsNorms(verts, norms);
 	//   vb->unmapBuffer();
 	bool getVertexStrider(LLStrider<LLVector3>& strider, S32 index=0, S32 count = -1, bool map_range = false);
+	bool getVertexStrider(LLStrider<LLVector4a>& strider, S32 index=0, S32 count = -1, bool map_range = false);
 	bool getIndexStrider(LLStrider<U16>& strider, S32 index=0, S32 count = -1, bool map_range = false);
 	bool getTexCoord0Strider(LLStrider<LLVector2>& strider, S32 index=0, S32 count = -1, bool map_range = false);
 	bool getTexCoord1Strider(LLStrider<LLVector2>& strider, S32 index=0, S32 count = -1, bool map_range = false);
 	bool getNormalStrider(LLStrider<LLVector3>& strider, S32 index=0, S32 count = -1, bool map_range = false);
 	bool getBinormalStrider(LLStrider<LLVector3>& strider, S32 index=0, S32 count = -1, bool map_range = false);
 	bool getColorStrider(LLStrider<LLColor4U>& strider, S32 index=0, S32 count = -1, bool map_range = false);
+	bool getEmissiveStrider(LLStrider<LLColor4U>& strider, S32 index=0, S32 count = -1, bool map_range = false);
 	bool getWeightStrider(LLStrider<F32>& strider, S32 index=0, S32 count = -1, bool map_range = false);
 	bool getWeight4Strider(LLStrider<LLVector4>& strider, S32 index=0, S32 count = -1, bool map_range = false);
 	bool getClothWeightStrider(LLStrider<LLVector4>& strider, S32 index=0, S32 count = -1, bool map_range = false);
 	
-	BOOL isEmpty() const					{ return mEmpty; }
-	BOOL isLocked() const					{ return mVertexLocked || mIndexLocked; }
+
+	bool isEmpty() const					{ return mEmpty; }
+	bool isLocked() const					{ return mVertexLocked || mIndexLocked; }
 	S32 getNumVerts() const					{ return mNumVerts; }
 	S32 getNumIndices() const				{ return mNumIndices; }
-	S32 getRequestedVerts() const			{ return mRequestedNumVerts; }
-	S32 getRequestedIndices() const			{ return mRequestedNumIndices; }
-
-	U8* getIndicesPointer() const			{ return useVBOs() ? (U8*) mAlignedIndexOffset : mMappedIndexData; }
-	U8* getVerticesPointer() const			{ return useVBOs() ? (U8*) mAlignedOffset : mMappedData; }
+	
+	volatile U8* getIndicesPointer() const			{ return useVBOs() ? (U8*) mAlignedIndexOffset : mMappedIndexData; }
+	volatile U8* getVerticesPointer() const			{ return useVBOs() ? (U8*) mAlignedOffset : mMappedData; }
 	U32 getTypeMask() const					{ return mTypeMask; }
 	bool hasDataType(S32 type) const		{ return ((1 << type) & getTypeMask()); }
 	S32 getSize() const;
-	S32 getIndicesSize() const				{ return mNumIndices * sizeof(U16); }
-	U8* getMappedData() const				{ return mMappedData; }
-	U8* getMappedIndices() const			{ return mMappedIndexData; }
+	S32 getIndicesSize() const				{ return mIndicesSize; }
+	volatile U8* getMappedData() const				{ return mMappedData; }
+	volatile U8* getMappedIndices() const			{ return mMappedIndexData; }
 	S32 getOffset(S32 type) const			{ return mOffsets[type]; }
 	S32 getUsage() const					{ return mUsage; }
+	bool isWriteable() const				{ return (mMappable || mUsage == GL_STREAM_DRAW_ARB) ? true : false; }
 
 	void draw(U32 mode, U32 count, U32 indices_offset) const;
 	void drawArrays(U32 mode, U32 offset, U32 count) const;
@@ -252,25 +274,31 @@ class LLVertexBuffer : public LLRefCount
 protected:	
 	S32		mNumVerts;		// Number of vertices allocated
 	S32		mNumIndices;	// Number of indices allocated
-	S32		mRequestedNumVerts;  // Number of vertices requested
-	S32		mRequestedNumIndices;  // Number of indices requested
-
+	
 	ptrdiff_t mAlignedOffset;
 	ptrdiff_t mAlignedIndexOffset;
 	S32		mSize;
+	S32		mIndicesSize;
 	U32		mTypeMask;
-	S32		mUsage;			// GL usage
+
+	const S32		mUsage;			// GL usage
+	
 	U32		mGLBuffer;		// GL VBO handle
 	U32		mGLIndices;		// GL IBO handle
-	U8*		mMappedData;	// pointer to currently mapped data (NULL if unmapped)
-	U8*		mMappedIndexData;	// pointer to currently mapped indices (NULL if unmapped)
-	BOOL	mVertexLocked;			// if TRUE, vertex buffer is being or has been written to in client memory
-	BOOL	mIndexLocked;			// if TRUE, index buffer is being or has been written to in client memory
-	BOOL	mFinal;			// if TRUE, buffer can not be mapped again
-	BOOL	mFilthy;		// if TRUE, entire buffer must be copied (used to prevent redundant dirty flags)
-	BOOL	mEmpty;			// if TRUE, client buffer is empty (or NULL). Old values have been discarded.	
-	BOOL	mResized;		// if TRUE, client buffer has been resized and GL buffer has not
-	BOOL	mDynamicSize;	// if TRUE, buffer has been resized at least once (and should be padded)
+	U32		mGLArray;		// GL VAO handle
+	
+	volatile U8* mMappedData;	// pointer to currently mapped data (NULL if unmapped)
+	volatile U8* mMappedIndexData;	// pointer to currently mapped indices (NULL if unmapped)
+
+	U32		mMappedDataUsingVBOs : 1;
+	U32		mMappedIndexDataUsingVBOs : 1;
+	U32		mVertexLocked : 1;			// if true, vertex buffer is being or has been written to in client memory
+	U32		mIndexLocked : 1;			// if true, index buffer is being or has been written to in client memory
+	U32		mFinal : 1;			// if true, buffer can not be mapped again
+	U32		mEmpty : 1;			// if true, client buffer is empty (or NULL). Old values have been discarded.	
+	
+	mutable bool	mMappable;     // if true, use memory mapping to upload data (otherwise doublebuffer and use glBufferSubData)
+
 	S32		mOffsets[TYPE_MAX];
 
 	std::vector<MappedRegion> mMappedVertexRegions;
@@ -281,26 +309,27 @@ class LLVertexBuffer : public LLRefCount
 	void placeFence() const;
 	void waitFence() const;
 
+	static S32 determineUsage(S32 usage);
 
 private:
-	static LLPrivateMemoryPool* sPrivatePoolp ;
+	static LLPrivateMemoryPool* sPrivatePoolp;
 
 public:
 	static S32 sCount;
 	static S32 sGLCount;
 	static S32 sMappedCount;
-	static BOOL sMapped;
-	static std::vector<U32> sDeleteList;
+	static bool sMapped;
 	typedef std::list<LLVertexBuffer*> buffer_list_t;
 		
-	static BOOL sDisableVBOMapping; //disable glMapBufferARB
-	static BOOL sEnableVBOs;
+	static bool sDisableVBOMapping; //disable glMapBufferARB
+	static bool sEnableVBOs;
 	static S32 sTypeSize[TYPE_MAX];
 	static U32 sGLMode[LLRender::NUM_MODES];
 	static U32 sGLRenderBuffer;
+	static U32 sGLRenderArray;
 	static U32 sGLRenderIndices;
-	static BOOL sVBOActive;
-	static BOOL sIBOActive;
+	static bool sVBOActive;
+	static bool sIBOActive;
 	static U32 sLastMask;
 	static U32 sAllocatedBytes;
 	static U32 sBindCount;
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp
index 4b0b7c561da6858175798772dfcc4257c9ffce0f..c025cd7939e5443cd6581d24be2821d0fd199b80 100644
--- a/indra/llui/llaccordionctrltab.cpp
+++ b/indra/llui/llaccordionctrltab.cpp
@@ -973,10 +973,10 @@ void LLAccordionCtrlTab::drawChild(const LLRect& root_rect,LLView* child)
 		
 		if ( root_rect.overlaps(screen_rect)  && LLUI::sDirtyRect.overlaps(screen_rect))
 		{
-			glMatrixMode(GL_MODELVIEW);
+			gGL.matrixMode(LLRender::MM_MODELVIEW);
 			LLUI::pushMatrix();
 			{
-				LLUI::translate((F32)child->getRect().mLeft, (F32)child->getRect().mBottom, 0.f);
+				LLUI::translate((F32)child->getRect().mLeft, (F32)child->getRect().mBottom);
 				child->draw();
 
 			}
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 74b8885e1ff4dad35cabe8dbfcc2677e3657954d..705fe165593111289a16243100e002db8c138b2c 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -115,7 +115,7 @@ LLButton::Params::Params()
 
 LLButton::LLButton(const LLButton::Params& p)
 :	LLUICtrl(p),
-	LLBadgeOwner(LLView::getHandle()),
+	LLBadgeOwner(getHandle()),
 	mMouseDownFrame(0),
 	mMouseHeldDownCount(0),
 	mBorderEnabled( FALSE ),
@@ -589,15 +589,23 @@ void LLButton::getOverlayImageSize(S32& overlay_width, S32& overlay_height)
 // virtual
 void LLButton::draw()
 {
+	static LLCachedControl<bool> sEnableButtonFlashing(*LLUI::sSettingGroups["config"], "EnableButtonFlashing", true);
 	F32 alpha = mUseDrawContextAlpha ? getDrawContext().mAlpha : getCurrentTransparency();
 	bool flash = FALSE;
 
-	if( mFlashing )
+	if( mFlashing)
 	{
-		F32 elapsed = mFlashingTimer.getElapsedTimeF32();
-		S32 flash_count = S32(elapsed * mButtonFlashRate * 2.f);
-		// flash on or off?
-		flash = (flash_count % 2 == 0) || flash_count > S32((F32)mButtonFlashCount * 2.f);
+		if ( sEnableButtonFlashing)
+		{
+			F32 elapsed = mFlashingTimer.getElapsedTimeF32();
+			S32 flash_count = S32(elapsed * mButtonFlashRate * 2.f);
+			// flash on or off?
+			flash = (flash_count % 2 == 0) || flash_count > S32((F32)mButtonFlashCount * 2.f);
+		}
+		else
+		{ // otherwise just highlight button in flash color
+			flash = true;
+		}
 	}
 
 	bool pressed_by_keyboard = FALSE;
@@ -900,9 +908,9 @@ void LLButton::draw()
 		// Not sure if it is really needed. Probably S32_MAX should be always passed as max_chars.
 		mLastDrawCharsCount = mGLFont->render(label, 0,
 			(F32)x,
-			(F32)(mBottomVPad + y_offset),
+			(F32)(getRect().getHeight() / 2 + mBottomVPad),
 			label_color % alpha,
-			mHAlign, LLFontGL::BOTTOM,
+			mHAlign, LLFontGL::VCENTER,
 			LLFontGL::NORMAL,
 			mDropShadowedText ? LLFontGL::DROP_SHADOW_SOFT : LLFontGL::NO_SHADOW,
 			S32_MAX, text_width,
@@ -1234,7 +1242,6 @@ void LLButton::resetMouseDownTimer()
 	mMouseDownTimer.reset();
 }
 
-
 BOOL LLButton::handleDoubleClick(S32 x, S32 y, MASK mask)
 {
 	// just treat a double click as a second click
diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp
index 6910b962a1932ce09c9e31bc5f120a3e460ece1b..14173fdbb0a6f9fdbb228896fd113b411875f50a 100644
--- a/indra/llui/llclipboard.cpp
+++ b/indra/llui/llclipboard.cpp
@@ -34,109 +34,113 @@
 #include "llview.h"
 #include "llwindow.h"
 
-// Global singleton
-LLClipboard gClipboard;
-
-
-LLClipboard::LLClipboard()
+LLClipboard::LLClipboard() :
+	mGeneration(0)
 {
-	mSourceItem = NULL;
+	reset();
 }
 
-
 LLClipboard::~LLClipboard()
 {
+	reset();
 }
 
-
-void LLClipboard::copyFromSubstring(const LLWString &src, S32 pos, S32 len, const LLUUID& source_id )
+void LLClipboard::reset()
 {
-	mSourceID = source_id;
-	mString = src.substr(pos, len);
-	LLView::getWindow()->copyTextToClipboard( mString );
+	// Increment the clipboard count
+	mGeneration++;
+	// Clear the clipboard
+	mObjects.clear();
+	mCutMode = false;
+	mString = LLWString();
 }
 
-void LLClipboard::copyFromString(const LLWString &src, const LLUUID& source_id )
+// Copy the input uuid to the LL clipboard
+bool LLClipboard::copyToClipboard(const LLUUID& src, const LLAssetType::EType type)
 {
-	mSourceID = source_id;
-	mString = src;
-	LLView::getWindow()->copyTextToClipboard( mString );
+	reset();
+	return addToClipboard(src, type);
 }
 
-const LLWString& LLClipboard::getPasteWString( LLUUID* source_id )
+// Add the input uuid to the LL clipboard
+// Convert the uuid to string and concatenate that string to the system clipboard if legit
+bool LLClipboard::addToClipboard(const LLUUID& src, const LLAssetType::EType type)
 {
-	if( mSourceID.notNull() )
+	bool res = false;
+	if (src.notNull())
 	{
-		LLWString temp_string;
-		LLView::getWindow()->pasteTextFromClipboard(temp_string);
-
-		if( temp_string != mString )
+		res = true;
+		if (LLAssetType::lookupIsAssetIDKnowable(type))
 		{
-			mSourceID.setNull();
-			mString = temp_string;
+			LLWString source = utf8str_to_wstring(src.asString());
+			res = addToClipboard(source, 0, source.size());
+		}
+		if (res)
+		{
+			mObjects.push_back(src);
+			mGeneration++;
 		}
 	}
-	else
-	{
-		LLView::getWindow()->pasteTextFromClipboard(mString);
-	}
+	return res;
+}
 
-	if( source_id )
+bool LLClipboard::pasteFromClipboard(std::vector<LLUUID>& inv_objects) const
+{
+	bool res = false;
+	S32 count = mObjects.size();
+	if (count > 0)
 	{
-		*source_id = mSourceID;
+		res = true;
+		inv_objects.clear();
+		for (S32 i = 0; i < count; i++)
+		{
+			inv_objects.push_back(mObjects[i]);
+		}
 	}
-
-	return mString;
+	return res;
 }
 
+// Returns true if the LL Clipboard has pasteable items in it
+bool LLClipboard::hasContents() const
+{
+	return (mObjects.size() > 0);
+}
 
-BOOL LLClipboard::canPasteString() const
+// Returns true if the input uuid is in the list of clipboard objects
+bool LLClipboard::isOnClipboard(const LLUUID& object) const
 {
-	return LLView::getWindow()->isClipboardTextAvailable();
+	std::vector<LLUUID>::const_iterator iter = std::find(mObjects.begin(), mObjects.end(), object);
+	return (iter != mObjects.end());
 }
 
+// Copy the input string to the LL and the system clipboard
+bool LLClipboard::copyToClipboard(const LLWString &src, S32 pos, S32 len, bool use_primary)
+{
+	return addToClipboard(src, pos, len, use_primary);
+}
 
-void LLClipboard::copyFromPrimarySubstring(const LLWString &src, S32 pos, S32 len, const LLUUID& source_id )
+// Concatenate the input string to the LL and the system clipboard
+bool LLClipboard::addToClipboard(const LLWString &src, S32 pos, S32 len, bool use_primary)
 {
-	mSourceID = source_id;
 	mString = src.substr(pos, len);
-	LLView::getWindow()->copyTextToPrimary( mString );
+	return (use_primary ? LLView::getWindow()->copyTextToPrimary(mString) : LLView::getWindow()->copyTextToClipboard(mString));
 }
 
-
-const LLWString& LLClipboard::getPastePrimaryWString( LLUUID* source_id )
+// Copy the System clipboard to the output string.
+// Manage the LL Clipboard / System clipboard consistency
+bool LLClipboard::pasteFromClipboard(LLWString &dst, bool use_primary)
 {
-	if( mSourceID.notNull() )
-	{
-		LLWString temp_string;
-		LLView::getWindow()->pasteTextFromPrimary(temp_string);
-
-		if( temp_string != mString )
-		{
-			mSourceID.setNull();
-			mString = temp_string;
-		}
-	}
-	else
-	{
-		LLView::getWindow()->pasteTextFromPrimary(mString);
-	}
-
-	if( source_id )
+	bool res = (use_primary ? LLView::getWindow()->pasteTextFromPrimary(dst) : LLView::getWindow()->pasteTextFromClipboard(dst));
+	if (res)
 	{
-		*source_id = mSourceID;
+		mString = dst;
 	}
-
-	return mString;
+	return res;
 }
 
-
-BOOL LLClipboard::canPastePrimaryString() const
+// Return true if there's something on the System clipboard
+bool LLClipboard::isTextAvailable(bool use_primary) const
 {
-	return LLView::getWindow()->isPrimaryTextAvailable();
+	return (use_primary ? LLView::getWindow()->isPrimaryTextAvailable() : LLView::getWindow()->isClipboardTextAvailable());
 }
 
-void LLClipboard::setSourceObject(const LLUUID& source_id, LLAssetType::EType type) 
-{
-	mSourceItem = new LLInventoryObject (source_id, LLUUID::null, type, "");
-}
diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h
index 9371b9428447ae2c8deb3ba3238d726dca41a7cb..fd2e7610df4bda53d4809748478a2479fa2b84a8 100644
--- a/indra/llui/llclipboard.h
+++ b/indra/llui/llclipboard.h
@@ -27,46 +27,68 @@
 #ifndef LL_LLCLIPBOARD_H
 #define LL_LLCLIPBOARD_H
 
+#include <boost/function.hpp>
 
 #include "llstring.h"
 #include "lluuid.h"
 #include "stdenums.h"
+#include "llsingleton.h"
+#include "llassettype.h"
 #include "llinventory.h"
 
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLClipboard
+//
+// This class is used to cut/copy/paste text strings and inventory items around 
+// the world. Use LLClipboard::instance().method() to use its methods.
+// Note that the text and UUIDs are loosely coupled only. There are few cases
+// where the viewer does offer a serialized version of the UUID on the clipboard.
+// In those case, the text is overridden when copying/cutting the item. 
+// In all other cases, the text and the UUIDs are very much independent.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-class LLClipboard
+class LLClipboard : public LLSingleton<LLClipboard>
 {
 public:
 	LLClipboard();
 	~LLClipboard();
+	
+	// Clears the clipboard
+	void reset();
+	// Returns the state of the clipboard so client can know if it has been modified (comparing with tracked state)
+	int	getGeneration() const { return mGeneration; }
 
-	/* We support two flavors of clipboard.  The default is the explicitly
-	   copy-and-pasted clipboard.  The second is the so-called 'primary' clipboard
-	   which is implicitly copied upon selection on platforms which expect this
-	   (i.e. X11/Linux). */
-
-	void		copyFromSubstring(const LLWString &copy_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null );
-	void		copyFromString(const LLWString &copy_from, const LLUUID& source_id = LLUUID::null );
-	BOOL		canPasteString() const;
-	const LLWString&	getPasteWString(LLUUID* source_id = NULL);
+	// Text strings management:
+	// ------------------------
+	// We support two flavors of text clipboards. The default is the explicitly
+	// copy-and-pasted clipboard. The second is the so-called 'primary' clipboard
+	// which is implicitly copied upon selection on platforms which expect this
+	// (i.e. X11/Linux, Mac).
+	bool copyToClipboard(const LLWString& src, S32 pos, S32 len, bool use_primary = false);
+	bool addToClipboard(const LLWString& src, S32 pos, S32 len, bool use_primary = false);
+	bool pasteFromClipboard(LLWString& dst, bool use_primary = false);
+	bool isTextAvailable(bool use_primary = false) const;
+	
+	// Object list management:
+	// -----------------------
+	// Clears and adds one single object to the clipboard
+	bool copyToClipboard(const LLUUID& src, const LLAssetType::EType type = LLAssetType::AT_NONE);
+	// Adds one object to the current list of objects on the clipboard
+	bool addToClipboard(const LLUUID& src, const LLAssetType::EType type = LLAssetType::AT_NONE);
+	// Gets a copy of the objects on the clipboard
+	bool pasteFromClipboard(std::vector<LLUUID>& inventory_objects) const;
+	
+	bool hasContents() const;										// True if the clipboard has pasteable objects
+	bool isOnClipboard(const LLUUID& object) const;					// True if the input object uuid is on the clipboard
 
-	void		copyFromPrimarySubstring(const LLWString &copy_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null );
-	BOOL		canPastePrimaryString() const;
-	const LLWString&	getPastePrimaryWString(LLUUID* source_id = NULL);	
+	bool isCutMode() const { return mCutMode; }
+	void setCutMode(bool mode) { mCutMode = mode; mGeneration++; }
 
-	// Support clipboard for object known only by their uuid and asset type
-	void		  setSourceObject(const LLUUID& source_id, LLAssetType::EType type);
-	const LLInventoryObject* getSourceObject() { return mSourceItem; }
-	
 private:
-	LLUUID      mSourceID;
-	LLWString	mString;
-	LLInventoryObject* mSourceItem;
+	std::vector<LLUUID> mObjects;		// Objects on the clipboard. Can be empty while mString contains something licit (e.g. text from chat)
+	LLWString mString;					// The text string. If mObjects is not empty, this string is reflecting them (UUIDs for the moment) if the asset type is knowable.
+	bool mCutMode;						// This is a convenience flag for the viewer.
+	int mGeneration;					// Incremented when the clipboard changes so that interested parties can check for changes on the clipboard.	
 };
 
-
-// Global singleton
-extern LLClipboard gClipboard;
-
-
 #endif  // LL_LLCLIPBOARD_H
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index 89d8842393be9247c54273ad7ea40589fd0635eb..806d2ef3f65d6b1e0aa6993e537fc2e42eaa8414 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -613,7 +613,7 @@ void LLComboBox::showList()
 	}
 	mList->setOrigin(rect.mLeft, rect.mBottom);
 	mList->reshape(rect.getWidth(), rect.getHeight());
-	mList->translateIntoRect(root_view_local, FALSE);
+	mList->translateIntoRect(root_view_local);
 
 	// Make sure we didn't go off bottom of screen
 	S32 x, y;
diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp
index 42e6c3c78621fd5c73bec8dfba5d02a92cb72472..5f69c6af31581b1024312c947e7abe332afbfb47 100644
--- a/indra/llui/lldraghandle.cpp
+++ b/indra/llui/lldraghandle.cpp
@@ -244,7 +244,7 @@ void LLDragHandleTop::reshapeTitleBox()
 	const LLFontGL* font = LLFontGL::getFontSansSerif();
 	S32 title_width = getRect().getWidth();
 	title_width -= LEFT_PAD + 2 * BORDER_PAD + getButtonsRect().getWidth();
-	S32 title_height = llround(font->getLineHeight());
+	S32 title_height = font->getLineHeight();
 	LLRect title_rect;
 	title_rect.setLeftTopAndSize( 
 		LEFT_PAD, 
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 432397d3e9fb0fa902ffded0768d305e3d195976..8ca1e685a96922a823d5b182590f53ea90b7cc01 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -58,6 +58,8 @@
 #include "llhelp.h"
 #include "llmultifloater.h"
 #include "llsdutil.h"
+#include <boost/foreach.hpp>
+
 
 // use this to control "jumping" behavior when Ctrl-Tabbing
 const S32 TABBED_FLOATER_OFFSET = 0;
@@ -66,10 +68,10 @@ namespace LLInitParam
 {
 	void TypeValues<LLFloaterEnums::EOpenPositioning>::declareValues()
 	{
-		declare("none",       LLFloaterEnums::OPEN_POSITIONING_NONE);
-		declare("cascading",  LLFloaterEnums::OPEN_POSITIONING_CASCADING);
-		declare("centered",   LLFloaterEnums::OPEN_POSITIONING_CENTERED);
-		declare("specified",  LLFloaterEnums::OPEN_POSITIONING_SPECIFIED);
+		declare("relative",   LLFloaterEnums::POSITIONING_RELATIVE);
+		declare("cascading",  LLFloaterEnums::POSITIONING_CASCADING);
+		declare("centered",   LLFloaterEnums::POSITIONING_CENTERED);
+		declare("specified",  LLFloaterEnums::POSITIONING_SPECIFIED);
 	}
 }
 
@@ -111,7 +113,6 @@ LLFloater::click_callback LLFloater::sButtonCallbacks[BUTTON_COUNT] =
 
 LLMultiFloater* LLFloater::sHostp = NULL;
 BOOL			LLFloater::sQuitting = FALSE; // Flag to prevent storing visibility controls while quitting
-LLFloater::handle_map_t	LLFloater::sFloaterMap;
 
 LLFloaterView* gFloaterView = NULL;
 
@@ -176,9 +177,7 @@ LLFloater::Params::Params()
 	save_visibility("save_visibility", false),
 	can_dock("can_dock", false),
 	show_title("show_title", true),
-	open_positioning("open_positioning", LLFloaterEnums::OPEN_POSITIONING_NONE),
-	specified_left("specified_left"),
-	specified_bottom("specified_bottom"),
+	positioning("positioning", LLFloaterEnums::POSITIONING_RELATIVE),
 	header_height("header_height", 0),
 	legacy_header_height("legacy_header_height", 0),
 	close_image("close_image"),
@@ -194,7 +193,8 @@ LLFloater::Params::Params()
 	dock_pressed_image("dock_pressed_image"),
 	help_pressed_image("help_pressed_image"),
 	open_callback("open_callback"),
-	close_callback("close_callback")
+	close_callback("close_callback"),
+	follows("follows")
 {
 	changeDefault(visible, false);
 }
@@ -247,9 +247,7 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p)
 	mCanClose(p.can_close),
 	mDragOnLeft(p.can_drag_on_left),
 	mResizable(p.can_resize),
-	mOpenPositioning(p.open_positioning),
-	mSpecifiedLeft(p.specified_left),
-	mSpecifiedBottom(p.specified_bottom),
+	mPositioning(p.positioning),
 	mMinWidth(p.min_width),
 	mMinHeight(p.min_height),
 	mHeaderHeight(p.header_height),
@@ -268,7 +266,7 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p)
 	mMinimizeSignal(NULL)
 //	mNotificationContext(NULL)
 {
-	mHandle.bind(this);
+	mPosition.setFloater(*this);
 //	mNotificationContext = new LLFloaterNotificationContext(getHandle());
 
 	// Clicks stop here.
@@ -323,9 +321,6 @@ void LLFloater::initFloater(const Params& p)
 	// Floaters are created in the invisible state	
 	setVisible(FALSE);
 
-	// add self to handle->floater map
-	sFloaterMap[mHandle] = this;
-
 	if (!getParent())
 	{
 		gFloaterView->addChild(this);
@@ -532,8 +527,6 @@ LLFloater::~LLFloater()
 	// correct, non-minimized positions.
 	setMinimized( FALSE );
 
-	sFloaterMap.erase(mHandle);
-
 	delete mDragHandle;
 	for (S32 i = 0; i < 4; i++) 
 	{
@@ -550,10 +543,18 @@ LLFloater::~LLFloater()
 
 void LLFloater::storeRectControl()
 {
-	if( mRectControl.size() > 1 )
+	if (!mRectControl.empty())
 	{
 		getControlGroup()->setRect( mRectControl, getRect() );
 	}
+	if (!mPosXControl.empty() && mPositioning == LLFloaterEnums::POSITIONING_RELATIVE)
+	{
+		getControlGroup()->setF32( mPosXControl, mPosition.mX );
+	}
+	if (!mPosYControl.empty() && mPositioning == LLFloaterEnums::POSITIONING_RELATIVE)
+	{
+		getControlGroup()->setF32( mPosYControl, mPosition.mY );
+	}
 }
 
 void LLFloater::storeVisibilityControl()
@@ -572,23 +573,6 @@ void LLFloater::storeDockStateControl()
 	}
 }
 
-LLRect LLFloater::getSavedRect() const
-{
-	LLRect rect;
-
-	if (mRectControl.size() > 1)
-	{
-		rect = getControlGroup()->getRect(mRectControl);
-	}
-
-	return rect;
-}
-
-bool LLFloater::hasSavedRect() const
-{
-	return !getSavedRect().isEmpty();
-}
-
 // static
 std::string LLFloater::getControlName(const std::string& name, const LLSD& key)
 {
@@ -866,7 +850,7 @@ void LLFloater::applyControlsAndPosition(LLFloater* other)
 	{
 		if (!applyRectControl())
 		{
-			applyPositioning(other);
+			applyPositioning(other, true);
 		}
 	}
 }
@@ -875,29 +859,68 @@ bool LLFloater::applyRectControl()
 {
 	bool saved_rect = false;
 
+	LLRect screen_rect = calcScreenRect();
+	mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert();
+	
 	LLFloater* last_in_group = LLFloaterReg::getLastFloaterInGroup(mInstanceName);
 	if (last_in_group && last_in_group != this)
 	{
 		// other floaters in our group, position ourselves relative to them and don't save the rect
 		mRectControl.clear();
-		mOpenPositioning = LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP;
+		mPositioning = LLFloaterEnums::POSITIONING_CASCADE_GROUP;
 	}
-	else if (mRectControl.size() > 1)
+	else
 	{
-		// If we have a saved rect, use it
-		const LLRect& rect = getControlGroup()->getRect(mRectControl);
-		saved_rect = rect.notEmpty();
-		if (saved_rect)
+		bool rect_specified = false;
+		if (!mRectControl.empty())
 		{
-			setOrigin(rect.mLeft, rect.mBottom);
-
-			if (mResizable)
+			// If we have a saved rect, use it
+			const LLRect& rect = getControlGroup()->getRect(mRectControl);
+			if (rect.notEmpty()) saved_rect = true;
+			if (saved_rect)
 			{
-				reshape(llmax(mMinWidth, rect.getWidth()), llmax(mMinHeight, rect.getHeight()));
+				setOrigin(rect.mLeft, rect.mBottom);
+
+				if (mResizable)
+				{
+					reshape(llmax(mMinWidth, rect.getWidth()), llmax(mMinHeight, rect.getHeight()));
+				}
+				mPositioning = LLFloaterEnums::POSITIONING_RELATIVE;
+				LLRect screen_rect = calcScreenRect();
+				mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert();
+				rect_specified = true;
 			}
 		}
+
+		LLControlVariablePtr x_control = getControlGroup()->getControl(mPosXControl);
+		LLControlVariablePtr y_control = getControlGroup()->getControl(mPosYControl);
+		if (x_control.notNull() 
+			&& y_control.notNull()
+			&& !x_control->isDefault()
+			&& !y_control->isDefault())
+		{
+			mPosition.mX = x_control->getValue().asReal();
+			mPosition.mY = y_control->getValue().asReal();
+			mPositioning = LLFloaterEnums::POSITIONING_RELATIVE;
+			applyRelativePosition();
+
+			saved_rect = true;
+		}
+
+		// remember updated position
+		if (rect_specified)
+		{
+			storeRectControl();
+		}
 	}
 
+	if (saved_rect)
+	{
+		// propagate any derived positioning data back to settings file
+		storeRectControl();
+	}
+
+
 	return saved_rect;
 }
 
@@ -914,50 +937,56 @@ bool LLFloater::applyDockState()
 	return docked;
 }
 
-void LLFloater::applyPositioning(LLFloater* other)
+void LLFloater::applyPositioning(LLFloater* other, bool on_open)
 {
 	// Otherwise position according to the positioning code
-	switch (mOpenPositioning)
+	switch (mPositioning)
 	{
-	case LLFloaterEnums::OPEN_POSITIONING_CENTERED:
+	case LLFloaterEnums::POSITIONING_CENTERED:
 		center();
 		break;
 
-	case LLFloaterEnums::OPEN_POSITIONING_SPECIFIED:
-		{
-			// Translate relative to snap rect
-			setOrigin(mSpecifiedLeft, mSpecifiedBottom);
-			const LLRect& snap_rect = gFloaterView->getSnapRect();
-			translate(snap_rect.mLeft, snap_rect.mBottom);
-			translateIntoRect(snap_rect, FALSE);
-		}
+	case LLFloaterEnums::POSITIONING_SPECIFIED:
 		break;
 
-	case LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP:
-	case LLFloaterEnums::OPEN_POSITIONING_CASCADING:
-		if (other != NULL && other != this)
+	case LLFloaterEnums::POSITIONING_CASCADING:
+		if (!on_open)
 		{
-			stackWith(*other);
+			applyRelativePosition();
 		}
-		else
+		// fall through
+	case LLFloaterEnums::POSITIONING_CASCADE_GROUP:
+		if (on_open)
 		{
-			static const U32 CASCADING_FLOATER_HOFFSET = 0;
-			static const U32 CASCADING_FLOATER_VOFFSET = 0;
+			if (other != NULL && other != this)
+			{
+				stackWith(*other);
+			}
+			else
+			{
+				static const U32 CASCADING_FLOATER_HOFFSET = 0;
+				static const U32 CASCADING_FLOATER_VOFFSET = 0;
 			
-			const LLRect& snap_rect = gFloaterView->getSnapRect();
+				const LLRect& snap_rect = gFloaterView->getSnapRect();
 
-			const S32 horizontal_offset = CASCADING_FLOATER_HOFFSET;
-			const S32 vertical_offset = snap_rect.getHeight() - CASCADING_FLOATER_VOFFSET;
+				const S32 horizontal_offset = CASCADING_FLOATER_HOFFSET;
+				const S32 vertical_offset = snap_rect.getHeight() - CASCADING_FLOATER_VOFFSET;
 
-			S32 rect_height = getRect().getHeight();
-			setOrigin(horizontal_offset, vertical_offset - rect_height);
+				S32 rect_height = getRect().getHeight();
+				setOrigin(horizontal_offset, vertical_offset - rect_height);
 
-			translate(snap_rect.mLeft, snap_rect.mBottom);
-			translateIntoRect(snap_rect, FALSE);
+				translate(snap_rect.mLeft, snap_rect.mBottom);
+			}
+			setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
 		}
 		break;
 
-	case LLFloaterEnums::OPEN_POSITIONING_NONE:
+	case LLFloaterEnums::POSITIONING_RELATIVE:
+		{
+			applyRelativePosition();
+
+			break;
+		}
 	default:
 		// Do nothing
 		break;
@@ -1038,7 +1067,9 @@ BOOL LLFloater::canSnapTo(const LLView* other_view)
 	if (other_view != getParent())
 	{
 		const LLFloater* other_floaterp = dynamic_cast<const LLFloater*>(other_view);		
-		if (other_floaterp && other_floaterp->getSnapTarget() == getHandle() && mDependents.find(other_floaterp->getHandle()) != mDependents.end())
+		if (other_floaterp 
+			&& other_floaterp->getSnapTarget() == getHandle() 
+			&& mDependents.find(other_floaterp->getHandle()) != mDependents.end())
 		{
 			// this is a dependent that is already snapped to us, so don't snap back to it
 			return FALSE;
@@ -1073,7 +1104,9 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user)
 	if (by_user && !isMinimized())
 	{
 		storeRectControl();
-		mOpenPositioning = LLFloaterEnums::OPEN_POSITIONING_NONE;
+		mPositioning = LLFloaterEnums::POSITIONING_RELATIVE;
+		LLRect screen_rect = calcScreenRect();
+		mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert();
 	}
 
 	// if not minimized, adjust all snapped dependents to new shape
@@ -1251,6 +1284,7 @@ void LLFloater::setMinimized(BOOL minimize)
 
 		// Reshape *after* setting mMinimized
 		reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE );
+		applyPositioning(NULL, false);
 	}
 
 	make_ui_sound("UISndWindowClose");
@@ -1591,7 +1625,7 @@ void LLFloater::setDocked(bool docked, bool pop_on_undock)
 		if (mDocked)
 		{
 			setMinimized(FALSE);
-			mOpenPositioning = LLFloaterEnums::OPEN_POSITIONING_NONE;
+			mPositioning = LLFloaterEnums::POSITIONING_RELATIVE;
 		}
 
 		updateTitleButtons();
@@ -1625,7 +1659,7 @@ void LLFloater::onClickTearOff(LLFloater* self)
 		self->openFloater(self->getKey());
 		
 		// only force position for floaters that don't have that data saved
-		if (self->mRectControl.size() <= 1)
+		if (self->mRectControl.empty())
 		{
 			new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - floater_header_size - 5, self->getRect().getWidth(), self->getRect().getHeight());
 			self->setRect(new_rect);
@@ -1677,18 +1711,19 @@ void LLFloater::onClickHelp( LLFloater* self )
 LLFloater* LLFloater::getClosableFloaterFromFocus()
 {
 	LLFloater* focused_floater = NULL;
-
-	handle_map_iter_t iter;
-	for(iter = sFloaterMap.begin(); iter != sFloaterMap.end(); ++iter)
+	LLInstanceTracker<LLFloater>::instance_iter it = beginInstances();
+	LLInstanceTracker<LLFloater>::instance_iter end_it = endInstances();
+	for (; it != end_it; ++it)
 	{
-		focused_floater = iter->second;
-		if (focused_floater->hasFocus())
+		if (it->hasFocus())
 		{
+			LLFloater& floater = *it;
+			focused_floater = &floater;
 			break;
 		}
 	}
 
-	if (iter == sFloaterMap.end())
+	if (it == endInstances())
 	{
 		// nothing found, return
 		return NULL;
@@ -1803,7 +1838,7 @@ void LLFloater::draw()
 				
 				const LLFontGL* font = LLFontGL::getFontSansSerif();
 				LLRect r = getRect();
-				gl_rect_2d_offset_local(0, r.getHeight(), r.getWidth(), r.getHeight() - (S32)font->getLineHeight() - 1, 
+				gl_rect_2d_offset_local(0, r.getHeight(), r.getWidth(), r.getHeight() - font->getLineHeight() - 1, 
 					titlebar_focus_color % alpha, 0, TRUE);
 			}
 		}
@@ -1949,6 +1984,12 @@ void LLFloater::setCanDrag(BOOL can_drag)
 	}
 }
 
+bool LLFloater::getCanDrag()
+{
+	return mDragHandle->getEnabled();
+}
+
+
 void LLFloater::updateTitleButtons()
 {
 	static LLUICachedControl<S32> floater_close_box_size ("UIFloaterCloseBoxSize", 0);
@@ -2158,13 +2199,15 @@ LLFloaterView::LLFloaterView (const Params& p)
 	mSnapOffsetBottom(0),
 	mSnapOffsetRight(0)
 {
+	mSnapView = getHandle();
 }
 
 // By default, adjust vertical.
 void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent)
 {
-	S32 old_width = getRect().getWidth();
-	S32 old_height = getRect().getHeight();
+	LLView::reshape(width, height, called_from_parent);
+
+	mLastSnapRect = getSnapRect();
 
 	for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
 	{
@@ -2172,66 +2215,52 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent)
 		LLFloater* floaterp = (LLFloater*)viewp;
 		if (floaterp->isDependent())
 		{
-			// dependents use same follow flags as their "dependee"
+			// dependents are moved with their "dependee"
 			continue;
 		}
 
-		// Make if follow the edge it is closest to
-		U32 follow_flags = 0x0;
-
-		if (floaterp->isMinimized())
+		if (!floaterp->isMinimized() && floaterp->getCanDrag())
 		{
-			follow_flags |= (FOLLOWS_LEFT | FOLLOWS_TOP);
-		}
-		else
-		{
-			LLRect r = floaterp->getRect();
+			LLRect old_rect = floaterp->getRect();
+			floaterp->applyPositioning(NULL, false);
+			LLRect new_rect = floaterp->getRect();
 
-			// Compute absolute distance from each edge of screen
-			S32 left_offset = llabs(r.mLeft - 0);
-			S32 right_offset = llabs(old_width - r.mRight);
+			//LLRect r = floaterp->getRect();
 
-			S32 top_offset = llabs(old_height - r.mTop);
-			S32 bottom_offset = llabs(r.mBottom - 0);
+			//// Compute absolute distance from each edge of screen
+			//S32 left_offset = llabs(r.mLeft - 0);
+			//S32 right_offset = llabs(old_right - r.mRight);
 
+			//S32 top_offset = llabs(old_top - r.mTop);
+			//S32 bottom_offset = llabs(r.mBottom - 0);
 
-			if (left_offset < right_offset)
-			{
-				follow_flags |= FOLLOWS_LEFT;
-			}
-			else
-			{
-				follow_flags |= FOLLOWS_RIGHT;
-			}
+			S32 translate_x = new_rect.mLeft - old_rect.mLeft;
+			S32 translate_y = new_rect.mBottom - old_rect.mBottom;
 
-			// "No vertical adjustment" usually means that the bottom of the view
-			// has been pushed up or down.  Hence we want the floaters to follow
-			// the top.
-			if (top_offset < bottom_offset)
-			{
-				follow_flags |= FOLLOWS_TOP;
-			}
-			else
-			{
-				follow_flags |= FOLLOWS_BOTTOM;
-			}
-		}
+			//if (left_offset > right_offset)
+			//{
+			//	translate_x = new_right - old_right;
+			//}
 
-		floaterp->setFollows(follow_flags);
+			//if (top_offset < bottom_offset)
+			//{
+			//	translate_y = new_top - old_top;
+			//}
 
-		//RN: all dependent floaters copy follow behavior of "parent"
-		for(LLFloater::handle_set_iter_t dependent_it = floaterp->mDependents.begin();
-			dependent_it != floaterp->mDependents.end(); ++dependent_it)
-		{
-			LLFloater* dependent_floaterp = dependent_it->get();
-			if (dependent_floaterp)
+			// don't reposition immovable floaters
+			//if (floaterp->getCanDrag())
+			//{
+			//	floaterp->translate(translate_x, translate_y);
+			//}
+			BOOST_FOREACH(LLHandle<LLFloater> dependent_floater, floaterp->mDependents)
 			{
-				dependent_floaterp->setFollows(follow_flags);
+				if (dependent_floater.get())
+				{
+					dependent_floater.get()->translate(translate_x, translate_y);
+				}
 			}
 		}
 	}
-
-	LLView::reshape(width, height, called_from_parent);
 }
 
 
@@ -2631,6 +2660,12 @@ void LLFloaterView::shiftFloaters(S32 x_offset, S32 y_offset)
 
 void LLFloaterView::refresh()
 {
+	LLRect snap_rect = getSnapRect();
+	if (snap_rect != mLastSnapRect)
+	{
+		reshape(getRect().getWidth(), getRect().getHeight(), TRUE);
+	}
+
 	// Constrain children to be entirely on the screen
 	for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
 	{
@@ -2643,6 +2678,8 @@ void LLFloaterView::refresh()
 	}
 }
 
+const S32 FLOATER_MIN_VISIBLE_PIXELS = 16;
+
 void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_outside)
 {
 	if (floater->getParent() != this)
@@ -2696,7 +2733,7 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out
 	}
 
 	// move window fully onscreen
-	if (floater->translateIntoRect( getSnapRect(), allow_partial_outside ))
+	if (floater->translateIntoRect( getSnapRect(), allow_partial_outside ? FLOATER_MIN_VISIBLE_PIXELS : S32_MAX ))
 	{
 		floater->clearSnapTarget();
 	}
@@ -2910,9 +2947,11 @@ void LLFloater::setInstanceName(const std::string& name)
 		std::string ctrl_name = getControlName(mInstanceName, mKey);
 
 		// save_rect and save_visibility only apply to registered floaters
-		if (!mRectControl.empty())
+		if (mSaveRect)
 		{
 			mRectControl = LLFloaterReg::declareRectControl(ctrl_name);
+			mPosXControl = LLFloaterReg::declarePosXControl(ctrl_name);
+			mPosYControl = LLFloaterReg::declarePosYControl(ctrl_name);
 		}
 		if (!mVisibilityControl.empty())
 		{
@@ -2968,6 +3007,12 @@ void LLFloater::initFromParams(const LLFloater::Params& p)
 	 // control_name, tab_stop, focus_lost_callback, initial_value, rect, enabled, visible
 	LLPanel::initFromParams(p);
 
+	// override any follows flags
+	if (mPositioning != LLFloaterEnums::POSITIONING_SPECIFIED)
+	{
+		setFollows(FOLLOWS_NONE);
+	}
+
 	mTitle = p.title;
 	mShortTitle = p.short_title;
 	applyTitle();
@@ -2985,14 +3030,9 @@ void LLFloater::initFromParams(const LLFloater::Params& p)
 	mSingleInstance = p.single_instance;
 	mReuseInstance = p.reuse_instance.isProvided() ? p.reuse_instance : p.single_instance;
 
-	mOpenPositioning = p.open_positioning;
-	mSpecifiedLeft = p.specified_left;
-	mSpecifiedBottom = p.specified_bottom;
+	mPositioning = p.positioning;
 
-	if (p.save_rect && mRectControl.empty())
-	{
-		mRectControl = "t"; // flag to build mRectControl name once mInstanceName is set
-	}
+	mSaveRect = p.save_rect;
 	if (p.save_visibility)
 	{
 		mVisibilityControl = "t"; // flag to build mVisibilityControl name once mInstanceName is set
@@ -3107,7 +3147,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str
 		params.rect.left.set(0);
 	}
 	params.from_xui = true;
-	applyXUILayout(params, parent);
+	applyXUILayout(params, parent, parent == gFloaterView ? gFloaterView->getSnapRect() : parent->getLocalRect());
  	initFromParams(params);
 
 	initFloater(params);
@@ -3266,5 +3306,140 @@ void LLFloater::stackWith(LLFloater& other)
 	next_rect.setLeftTopAndSize(next_rect.mLeft, next_rect.mTop, getRect().getWidth(), getRect().getHeight());
 	
 	setShape(next_rect);
+
+	if (!other.getHost())
+	{
+		other.mPositioning = LLFloaterEnums::POSITIONING_CASCADE_GROUP;
+		other.setFollows(FOLLOWS_LEFT | FOLLOWS_TOP);
+	}
+}
+
+void LLFloater::applyRelativePosition()
+{
+	LLRect snap_rect = gFloaterView->getSnapRect();
+	LLRect floater_view_screen_rect = gFloaterView->calcScreenRect();
+	snap_rect.translate(floater_view_screen_rect.mLeft, floater_view_screen_rect.mBottom);
+	LLRect floater_screen_rect = calcScreenRect();
+
+	LLCoordGL new_center = mPosition.convert();
+	LLCoordGL cur_center(floater_screen_rect.getCenterX(), floater_screen_rect.getCenterY());
+	translate(new_center.mX - cur_center.mX, new_center.mY - cur_center.mY);
 }
 
+
+LLCoordFloater::LLCoordFloater(F32 x, F32 y, LLFloater& floater)
+:	coord_t((S32)x, (S32)y)
+{
+	mFloater = floater.getHandle();
+}
+
+
+LLCoordFloater::LLCoordFloater(const LLCoordCommon& other, LLFloater& floater)
+{
+	mFloater = floater.getHandle();
+	convertFromCommon(other);
+}
+
+LLCoordFloater& LLCoordFloater::operator=(const LLCoordFloater& other)
+{
+	mFloater = other.mFloater;
+	coord_t::operator =(other);
+	return *this;
+}
+
+void LLCoordFloater::setFloater(LLFloater& floater)
+{
+	mFloater = floater.getHandle();
+}
+
+bool LLCoordFloater::operator==(const LLCoordFloater& other) const 
+{ 
+	return mX == other.mX && mY == other.mY && mFloater == other.mFloater; 
+}
+
+LLCoordCommon LL_COORD_FLOATER::convertToCommon() const
+{
+	const LLCoordFloater& self = static_cast<const LLCoordFloater&>(LLCoordFloater::getTypedCoords(*this));
+
+	LLRect snap_rect = gFloaterView->getSnapRect();
+	LLRect floater_view_screen_rect = gFloaterView->calcScreenRect();
+	snap_rect.translate(floater_view_screen_rect.mLeft, floater_view_screen_rect.mBottom);
+
+	LLFloater* floaterp = mFloater.get();
+	S32 floater_width = floaterp ? floaterp->getRect().getWidth() : 0;
+	S32 floater_height = floaterp ? floaterp->getRect().getHeight() : 0;
+	LLCoordCommon out;
+	if (self.mX < -0.5f)
+	{
+		out.mX = llround(rescale(self.mX, -1.f, -0.5f, snap_rect.mLeft - (floater_width - FLOATER_MIN_VISIBLE_PIXELS), snap_rect.mLeft));
+	}
+	else if (self.mX > 0.5f)
+	{
+		out.mX = llround(rescale(self.mX, 0.5f, 1.f, snap_rect.mRight - floater_width, snap_rect.mRight - FLOATER_MIN_VISIBLE_PIXELS));
+	}
+	else
+	{
+		out.mX = llround(rescale(self.mX, -0.5f, 0.5f, snap_rect.mLeft, snap_rect.mRight - floater_width));
+	}
+
+	if (self.mY < -0.5f)
+	{
+		out.mY = llround(rescale(self.mY, -1.f, -0.5f, snap_rect.mBottom - (floater_height - FLOATER_MIN_VISIBLE_PIXELS), snap_rect.mBottom));
+	}
+	else if (self.mY > 0.5f)
+	{
+		out.mY = llround(rescale(self.mY, 0.5f, 1.f, snap_rect.mTop - floater_height, snap_rect.mTop - FLOATER_MIN_VISIBLE_PIXELS));
+	}
+	else
+	{
+		out.mY = llround(rescale(self.mY, -0.5f, 0.5f, snap_rect.mBottom, snap_rect.mTop - floater_height));
+	}
+
+	// return center point instead of lower left
+	out.mX += floater_width / 2;
+	out.mY += floater_height / 2;
+
+	return out;
+}
+
+void LL_COORD_FLOATER::convertFromCommon(const LLCoordCommon& from)
+{
+	LLCoordFloater& self = static_cast<LLCoordFloater&>(LLCoordFloater::getTypedCoords(*this));
+	LLRect snap_rect = gFloaterView->getSnapRect();
+	LLRect floater_view_screen_rect = gFloaterView->calcScreenRect();
+	snap_rect.translate(floater_view_screen_rect.mLeft, floater_view_screen_rect.mBottom);
+
+
+	LLFloater* floaterp = mFloater.get();
+	S32 floater_width = floaterp ? floaterp->getRect().getWidth() : 0;
+	S32 floater_height = floaterp ? floaterp->getRect().getHeight() : 0;
+
+	S32 from_x = from.mX - floater_width / 2;
+	S32 from_y = from.mY - floater_height / 2;
+
+	if (from_x < snap_rect.mLeft)
+	{
+		self.mX = rescale(from_x, snap_rect.mLeft - (floater_width - FLOATER_MIN_VISIBLE_PIXELS), snap_rect.mLeft, -1.f, -0.5f);
+	}
+	else if (from_x + floater_width > snap_rect.mRight)
+	{
+		self.mX = rescale(from_x, snap_rect.mRight - floater_width, snap_rect.mRight - FLOATER_MIN_VISIBLE_PIXELS, 0.5f, 1.f);
+	}
+	else
+	{
+		self.mX = rescale(from_x, snap_rect.mLeft, snap_rect.mRight - floater_width, -0.5f, 0.5f);
+	}
+
+	if (from_y < snap_rect.mBottom)
+	{
+		self.mY = rescale(from_y, snap_rect.mBottom - (floater_height - FLOATER_MIN_VISIBLE_PIXELS), snap_rect.mBottom, -1.f, -0.5f);
+	}
+	else if (from_y + floater_height > snap_rect.mTop)
+	{
+		self.mY = rescale(from_y, snap_rect.mTop - floater_height, snap_rect.mTop - FLOATER_MIN_VISIBLE_PIXELS, 0.5f, 1.f);
+	}
+	else
+	{
+		self.mY = rescale(from_y, snap_rect.mBottom, snap_rect.mTop - floater_height, -0.5f, 0.5f);
+	}
+}
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 73e9c9e83107721223d15bf32678f9fac7deb2a2..64d6dcea0444afeffcd7de5758e1a40fe3953884 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -64,12 +64,12 @@ namespace LLFloaterEnums
 {
 	enum EOpenPositioning
 	{
-		OPEN_POSITIONING_NONE,
-		OPEN_POSITIONING_CASCADING,
-		OPEN_POSITIONING_CASCADE_GROUP,
-		OPEN_POSITIONING_CENTERED,
-		OPEN_POSITIONING_SPECIFIED,
-		OPEN_POSITIONING_COUNT
+		POSITIONING_RELATIVE,
+		POSITIONING_CASCADING,
+		POSITIONING_CASCADE_GROUP,
+		POSITIONING_CENTERED,
+		POSITIONING_SPECIFIED,
+		POSITIONING_COUNT
 	};
 }
 
@@ -82,8 +82,39 @@ namespace LLInitParam
 	};
 }
 
+struct LL_COORD_FLOATER
+{
+	typedef F32 value_t;
+
+	LLCoordCommon convertToCommon() const;
+	void convertFromCommon(const LLCoordCommon& from);
+protected:
+	LLHandle<LLFloater> mFloater;
+};
+
+struct LLCoordFloater : LLCoord<LL_COORD_FLOATER>
+{
+	typedef LLCoord<LL_COORD_FLOATER> coord_t;
+
+	LLCoordFloater() {}
+	LLCoordFloater(F32 x, F32 y, LLFloater& floater);
+	LLCoordFloater(const LLCoordCommon& other, LLFloater& floater);
+
+	LLCoordFloater& operator=(const LLCoordCommon& other)
+	{
+		convertFromCommon(other);
+		return *this;
+	}
 
-class LLFloater : public LLPanel
+	LLCoordFloater& operator=(const LLCoordFloater& other);
+
+	bool operator==(const LLCoordFloater& other) const;
+	bool operator!=(const LLCoordFloater& other) const { return !(*this == other); }
+
+	void setFloater(LLFloater& floater);
+};
+
+class LLFloater : public LLPanel, public LLInstanceTracker<LLFloater>
 {
 	friend class LLFloaterView;
 	friend class LLFloaterReg;
@@ -132,10 +163,7 @@ class LLFloater : public LLPanel
 								can_dock,
 								show_title;
 		
-		Optional<LLFloaterEnums::EOpenPositioning>	open_positioning;
-		Optional<S32>								specified_left;
-		Optional<S32>								specified_bottom;
-
+		Optional<LLFloaterEnums::EOpenPositioning>	positioning;
 		
 		Optional<S32>			header_height,
 								legacy_header_height; // HACK see initFromXML()
@@ -156,6 +184,8 @@ class LLFloater : public LLPanel
 		
 		Optional<CommitCallbackParam> open_callback,
 									  close_callback;
+
+		Ignored					follows;
 		
 		Params();
 	};
@@ -182,7 +212,7 @@ class LLFloater : public LLPanel
 	bool initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node = NULL);
 
 	/*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false);
-	/*virtual*/ BOOL canSnapTo(const LLView* other_view);
+	/*virtual*/ BOOL canSnapTo(const LLView* other_view); 
 	/*virtual*/ void setSnappedTo(const LLView* snap_view);
 	/*virtual*/ void setFocus( BOOL b );
 	/*virtual*/ void setIsChrome(BOOL is_chrome);
@@ -234,12 +264,11 @@ class LLFloater : public LLPanel
 	void			setCanTearOff(BOOL can_tear_off);
 	virtual void	setCanResize(BOOL can_resize);
 	void			setCanDrag(BOOL can_drag);
+	bool			getCanDrag();
 	void			setHost(LLMultiFloater* host);
 	BOOL			isResizable() const				{ return mResizable; }
 	void			setResizeLimits( S32 min_width, S32 min_height );
 	void			getResizeLimits( S32* min_width, S32* min_height ) { *min_width = mMinWidth; *min_height = mMinHeight; }
-	LLRect			getSavedRect() const;
-	bool			hasSavedRect() const;
 
 	static std::string		getControlName(const std::string& name, const LLSD& key);
 	static LLControlGroup*	getControlGroup();
@@ -282,7 +311,7 @@ class LLFloater : public LLPanel
 	void			clearSnapTarget() { mSnappedTo.markDead(); }
 	LLHandle<LLFloater>	getSnapTarget() const { return mSnappedTo; }
 
-	LLHandle<LLFloater> getHandle() const { return mHandle; }
+	LLHandle<LLFloater> getHandle() const { return getDerivedHandle<LLFloater>(); }
 	const LLSD& 	getKey() { return mKey; }
 	virtual bool	matchesKey(const LLSD& key) { return mSingleInstance || KeyCompare::equate(key, mKey); }
 	
@@ -321,7 +350,7 @@ class LLFloater : public LLPanel
 		
 	void			enableResizeCtrls(bool enable, bool width = true, bool height = true);
 
-	bool			isPositioning(LLFloaterEnums::EOpenPositioning p) const { return (p == mOpenPositioning); }
+	bool			isPositioning(LLFloaterEnums::EOpenPositioning p) const { return (p == mPositioning); }
 protected:
 	void			applyControlsAndPosition(LLFloater* other);
 
@@ -329,7 +358,9 @@ class LLFloater : public LLPanel
 
 	virtual bool	applyRectControl();
 	bool			applyDockState();
-	void			applyPositioning(LLFloater* other);
+	void			applyPositioning(LLFloater* other, bool on_open);
+	void			applyRelativePosition();
+
 	void			storeRectControl();
 	void			storeVisibilityControl();
 	void			storeDockStateControl();
@@ -393,7 +424,10 @@ class LLFloater : public LLPanel
 	commit_signal_t* mMinimizeSignal;
 
 protected:
+	bool			mSaveRect;
 	std::string		mRectControl;
+	std::string		mPosXControl;
+	std::string		mPosYControl;
 	std::string		mVisibilityControl;
 	std::string		mDocStateControl;
 	LLSD			mKey;				// Key used for retrieving instances; set (for now) by LLFLoaterReg
@@ -419,9 +453,8 @@ class LLFloater : public LLPanel
 	BOOL			mDragOnLeft;
 	BOOL			mResizable;
 
-	LLFloaterEnums::EOpenPositioning	mOpenPositioning;
-	S32									mSpecifiedLeft;
-	S32									mSpecifiedBottom;
+	LLFloaterEnums::EOpenPositioning	mPositioning;
+	LLCoordFloater	mPosition;
 	
 	S32				mMinWidth;
 	S32				mMinHeight;
@@ -460,16 +493,9 @@ class LLFloater : public LLPanel
 	typedef void(*click_callback)(LLFloater*);
 	static click_callback sButtonCallbacks[BUTTON_COUNT];
 
-	typedef std::map<LLHandle<LLFloater>, LLFloater*> handle_map_t;
-	typedef std::map<LLHandle<LLFloater>, LLFloater*>::iterator handle_map_iter_t;
-	static handle_map_t	sFloaterMap;
-
 	BOOL			mHasBeenDraggedWhileMinimized;
 	S32				mPreviousMinimizedBottom;
 	S32				mPreviousMinimizedLeft;
-
-//	LLFloaterNotificationContext* mNotificationContext;
-	LLRootHandle<LLFloater>		mHandle;	
 };
 
 
@@ -537,6 +563,7 @@ class LLFloaterView : public LLUICtrl
 private:
 	void hiddenFloaterClosed(LLFloater* floater);
 
+	LLRect				mLastSnapRect;
 	LLHandle<LLView>	mSnapView;
 	BOOL			mFocusCycleMode;
 	S32				mSnapOffsetBottom;
diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp
index e144b68f5ebb00ae3df2316233d359ff0092f8f9..9115eb71740760af6522fb80f6170b31f46b595a 100644
--- a/indra/llui/llfloaterreg.cpp
+++ b/indra/llui/llfloaterreg.cpp
@@ -96,7 +96,9 @@ LLFloater* LLFloaterReg::getLastFloaterCascading()
 		{
 			LLFloater* inst = *iter;
 
-			if (inst->getVisible() && inst->isPositioning(LLFloaterEnums::OPEN_POSITIONING_CASCADING))
+			if (inst->getVisible() 
+				&& (inst->isPositioning(LLFloaterEnums::POSITIONING_CASCADING)
+					|| inst->isPositioning(LLFloaterEnums::POSITIONING_CASCADE_GROUP)))
 			{
 				if (candidate_rect.mTop > inst->getRect().mTop)
 				{
@@ -358,9 +360,7 @@ void LLFloaterReg::restoreVisibleInstances()
 //static
 std::string LLFloaterReg::getRectControlName(const std::string& name)
 {
-	std::string res = std::string("floater_rect_") + name;
-	LLStringUtil::replaceChar( res, ' ', '_' );
-	return res;
+	return std::string("floater_rect_") + getBaseControlName(name);
 }
 
 //static
@@ -368,19 +368,48 @@ std::string LLFloaterReg::declareRectControl(const std::string& name)
 {
 	std::string controlname = getRectControlName(name);
 	LLFloater::getControlGroup()->declareRect(controlname, LLRect(),
-												 llformat("Window Position and Size for %s", name.c_str()),
+												 llformat("Window Size for %s", name.c_str()),
 												 TRUE);
 	return controlname;
 }
 
+std::string LLFloaterReg::declarePosXControl(const std::string& name)
+{
+	std::string controlname = std::string("floater_pos_") + getBaseControlName(name) + "_x";
+	LLFloater::getControlGroup()->declareF32(controlname, 
+											10.f,
+											llformat("Window X Position for %s", name.c_str()),
+											TRUE);
+	return controlname;
+}
+
+std::string LLFloaterReg::declarePosYControl(const std::string& name)
+{
+	std::string controlname = std::string("floater_pos_") + getBaseControlName(name) + "_y";
+	LLFloater::getControlGroup()->declareF32(controlname,
+											10.f,
+											llformat("Window Y Position for %s", name.c_str()),
+											TRUE);
+
+	return controlname;
+}
+
+
 //static
 std::string LLFloaterReg::getVisibilityControlName(const std::string& name)
 {
-	std::string res = std::string("floater_vis_") + name;
+	return std::string("floater_vis_") + getBaseControlName(name);
+}
+
+//static 
+std::string LLFloaterReg::getBaseControlName(const std::string& name)
+{
+	std::string res(name);
 	LLStringUtil::replaceChar( res, ' ', '_' );
 	return res;
 }
 
+
 //static
 std::string LLFloaterReg::declareVisibilityControl(const std::string& name)
 {
diff --git a/indra/llui/llfloaterreg.h b/indra/llui/llfloaterreg.h
index 534cf8b40ab882a85629aa155af26b1b2031672b..a1e1f8a98835ffa6bd8fd257a8a5799268b5e6ce 100644
--- a/indra/llui/llfloaterreg.h
+++ b/indra/llui/llfloaterreg.h
@@ -115,9 +115,11 @@ class LLFloaterReg
 	// Control Variables
 	static std::string getRectControlName(const std::string& name);
 	static std::string declareRectControl(const std::string& name);
+	static std::string declarePosXControl(const std::string& name);
+	static std::string declarePosYControl(const std::string& name);
 	static std::string getVisibilityControlName(const std::string& name);
 	static std::string declareVisibilityControl(const std::string& name);
-
+	static std::string getBaseControlName(const std::string& name);
 	static std::string declareDockStateControl(const std::string& name);
 	static std::string getDockStateControlName(const std::string& name);
 
diff --git a/indra/llui/llhandle.h b/indra/llui/llhandle.h
index 8c000eee48cc6fe4f682cd33e88dd09e52da94f5..37c657dd9229b38ace1e1e1bc6f12273afce4de4 100644
--- a/indra/llui/llhandle.h
+++ b/indra/llui/llhandle.h
@@ -28,17 +28,18 @@
 #define LLHANDLE_H
 
 #include "llpointer.h"
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/utility/enable_if.hpp>
 
-template <typename T>
 class LLTombStone : public LLRefCount
 {
 public:
-	LLTombStone(T* target = NULL) : mTarget(target) {}
+	LLTombStone(void* target = NULL) : mTarget(target) {}
 
-	void setTarget(T* target) { mTarget = target; }
-	T* getTarget() const { return mTarget; }
+	void setTarget(void* target) { mTarget = target; }
+	void* getTarget() const { return mTarget; }
 private:
-	T* mTarget;
+	mutable void* mTarget;
 };
 
 //	LLHandles are used to refer to objects whose lifetime you do not control or influence.  
@@ -53,13 +54,15 @@ class LLTombStone : public LLRefCount
 template <typename T>
 class LLHandle
 {
+	template <typename U> friend class LLHandle;
+	template <typename U> friend class LLHandleProvider;
 public:
 	LLHandle() : mTombStone(getDefaultTombStone()) {}
-	const LLHandle<T>& operator =(const LLHandle<T>& other)  
-	{ 
-		mTombStone = other.mTombStone;
-		return *this; 
-	}
+
+	template<typename U>
+	LLHandle(const LLHandle<U>& other, typename boost::enable_if< typename boost::is_convertible<U*, T*> >::type* dummy = 0)
+	: mTombStone(other.mTombStone)
+	{}
 
 	bool isDead() const 
 	{ 
@@ -73,7 +76,7 @@ class LLHandle
 
 	T* get() const
 	{
-		return mTombStone->getTarget();
+		return reinterpret_cast<T*>(mTombStone->getTarget());
 	}
 
 	friend bool operator== (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
@@ -94,12 +97,13 @@ class LLHandle
 	}
 
 protected:
-	LLPointer<LLTombStone<T> > mTombStone;
+	LLPointer<LLTombStone> mTombStone;
 
 private:
-	static LLPointer<LLTombStone<T> >& getDefaultTombStone()
+	typedef T* pointer_t;
+	static LLPointer<LLTombStone>& getDefaultTombStone()
 	{
-		static LLPointer<LLTombStone<T> > sDefaultTombStone = new LLTombStone<T>;
+		static LLPointer<LLTombStone> sDefaultTombStone = new LLTombStone;
 		return sDefaultTombStone;
 	}
 };
@@ -108,23 +112,26 @@ template <typename T>
 class LLRootHandle : public LLHandle<T>
 {
 public:
+	typedef LLRootHandle<T> self_t;
+	typedef LLHandle<T> base_t;
+
 	LLRootHandle(T* object) { bind(object); }
 	LLRootHandle() {};
 	~LLRootHandle() { unbind(); }
 
-	// this is redundant, since a LLRootHandle *is* an LLHandle
-	LLHandle<T> getHandle() { return LLHandle<T>(*this); }
+	// this is redundant, since an LLRootHandle *is* an LLHandle
+	//LLHandle<T> getHandle() { return LLHandle<T>(*this); }
 
 	void bind(T* object) 
 	{ 
 		// unbind existing tombstone
 		if (LLHandle<T>::mTombStone.notNull())
 		{
-			if (LLHandle<T>::mTombStone->getTarget() == object) return;
+			if (LLHandle<T>::mTombStone->getTarget() == (void*)object) return;
 			LLHandle<T>::mTombStone->setTarget(NULL);
 		}
 		// tombstone reference counted, so no paired delete
-		LLHandle<T>::mTombStone = new LLTombStone<T>(object);
+		LLHandle<T>::mTombStone = new LLTombStone((void*)object);
 	}
 
 	void unbind() 
@@ -142,6 +149,15 @@ class LLRootHandle : public LLHandle<T>
 template <typename T>
 class LLHandleProvider
 {
+public:
+	LLHandle<T> getHandle() const
+	{ 
+		// perform lazy binding to avoid small tombstone allocations for handle
+		// providers whose handles are never referenced
+		mHandle.bind(static_cast<T*>(const_cast<LLHandleProvider<T>* >(this))); 
+		return mHandle; 
+	}
+
 protected:
 	typedef LLHandle<T> handle_type_t;
 	LLHandleProvider() 
@@ -149,16 +165,17 @@ class LLHandleProvider
 		// provided here to enforce T deriving from LLHandleProvider<T>
 	} 
 
-	LLHandle<T> getHandle() 
-	{ 
-		// perform lazy binding to avoid small tombstone allocations for handle
-		// providers whose handles are never referenced
-		mHandle.bind(static_cast<T*>(this)); 
-		return mHandle; 
+	template <typename U>
+	LLHandle<U> getDerivedHandle(typename boost::enable_if< typename boost::is_convertible<U*, T*> >::type* dummy = 0) const
+	{
+		LLHandle<U> downcast_handle;
+		downcast_handle.mTombStone = getHandle().mTombStone;
+		return downcast_handle;
 	}
 
+
 private:
-	LLRootHandle<T> mHandle;
+	mutable LLRootHandle<T> mHandle;
 };
 
 #endif
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 0e7060e22cfc887157bdfceb40ceb5c38b1a4d40..4c730286da86a6b0a6dbbfca12216aa211db5f75 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -34,6 +34,10 @@
 #include "llpanel.h"
 #include "llresizebar.h"
 #include "llcriticaldamp.h"
+#include "boost/foreach.hpp"
+
+static const F32 MIN_FRACTIONAL_SIZE = 0.0f;
+static const F32 MAX_FRACTIONAL_SIZE = 1.f;
 
 static LLDefaultChildRegistry::Register<LLLayoutStack> register_layout_stack("layout_stack");
 static LLLayoutStack::LayoutStackRegistry::Register<LLLayoutPanel> register_layout_panel("layout_panel");
@@ -49,39 +53,29 @@ void LLLayoutStack::OrientationNames::declareValues()
 //
 LLLayoutPanel::Params::Params()	
 :	expanded_min_dim("expanded_min_dim", 0),
-	min_dim("min_dim", 0),
-	max_dim("max_dim", S32_MAX),
-	user_resize("user_resize", true),
+	min_dim("min_dim", -1),
+	user_resize("user_resize", false),
 	auto_resize("auto_resize", true)
 {
 	addSynonym(min_dim, "min_width");
 	addSynonym(min_dim, "min_height");
-	addSynonym(max_dim, "max_width");
-	addSynonym(max_dim, "max_height");
 }
 
 LLLayoutPanel::LLLayoutPanel(const Params& p)	
 :	LLPanel(p),
-	mExpandedMinDimSpecified(false),
-	mExpandedMinDim(p.min_dim),
+	mExpandedMinDim(p.expanded_min_dim.isProvided() ? p.expanded_min_dim : p.min_dim),
  	mMinDim(p.min_dim), 
- 	mMaxDim(p.max_dim), 
  	mAutoResize(p.auto_resize),
  	mUserResize(p.user_resize),
 	mCollapsed(FALSE),
 	mCollapseAmt(0.f),
 	mVisibleAmt(1.f), // default to fully visible
 	mResizeBar(NULL),
-	mFractionalSize(0.f),
+	mFractionalSize(MIN_FRACTIONAL_SIZE),
+	mTargetDim(0),
+	mIgnoreReshape(false),
 	mOrientation(LLLayoutStack::HORIZONTAL)
 {
-	// Set the expanded min dim if it is provided, otherwise it gets the p.min_dim value
-	if (p.expanded_min_dim.isProvided())
-	{
-		mExpandedMinDimSpecified = true;
-		mExpandedMinDim = p.expanded_min_dim();
-	}
-	
 	// panels initialized as hidden should not start out partially visible
 	if (!getVisible())
 	{
@@ -103,33 +97,111 @@ LLLayoutPanel::~LLLayoutPanel()
 	mResizeBar = NULL;
 }
 
-void LLLayoutPanel::reshape(S32 width, S32 height, BOOL called_from_parent)
+F32 LLLayoutPanel::getAutoResizeFactor() const
+{
+	return mVisibleAmt * (1.f - mCollapseAmt);
+}
+ 
+F32 LLLayoutPanel::getVisibleAmount() const
+{
+	return mVisibleAmt;
+}
+
+S32 LLLayoutPanel::getLayoutDim() const
+{
+	return llround((F32)((mOrientation == LLLayoutStack::HORIZONTAL)
+					? getRect().getWidth()
+					: getRect().getHeight()));
+}
+
+S32 LLLayoutPanel::getTargetDim() const
+{
+	return mTargetDim;
+}
+
+void LLLayoutPanel::setTargetDim(S32 value)
 {
+	LLRect new_rect(getRect());
 	if (mOrientation == LLLayoutStack::HORIZONTAL)
 	{
-		mFractionalSize += width - llround(mFractionalSize);
+		new_rect.mRight = new_rect.mLeft + value;
 	}
 	else
 	{
-		mFractionalSize += height - llround(mFractionalSize);
+		new_rect.mTop = new_rect.mBottom + value;
 	}
-	LLPanel::reshape(width, height, called_from_parent);
+	setShape(new_rect, true);
 }
 
-F32 LLLayoutPanel::getCollapseFactor()
+S32 LLLayoutPanel::getVisibleDim() const
 {
-	if (mOrientation == LLLayoutStack::HORIZONTAL)
+	F32 min_dim = getRelevantMinDim();
+	return llround(mVisibleAmt
+					* (min_dim
+						+ (((F32)mTargetDim - min_dim) * (1.f - mCollapseAmt))));
+}
+ 
+void LLLayoutPanel::setOrientation( LLLayoutStack::ELayoutOrientation orientation )
+{
+	mOrientation = orientation;
+	S32 layout_dim = llround((F32)((mOrientation == LLLayoutStack::HORIZONTAL)
+		? getRect().getWidth()
+		: getRect().getHeight()));
+
+	if (mAutoResize == FALSE 
+		&& mUserResize == TRUE 
+		&& mMinDim == -1 )
 	{
-		F32 collapse_amt = 
-			clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, (F32)getRelevantMinDim() / (F32)llmax(1, getRect().getWidth()));
-		return mVisibleAmt * collapse_amt;
+		setMinDim(layout_dim);
 	}
-	else
+	mTargetDim = llmax(layout_dim, getMinDim());
+}
+ 
+void LLLayoutPanel::setVisible( BOOL visible )
+{
+	if (visible != getVisible())
 	{
-		F32 collapse_amt = 
-			clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, llmin(1.f, (F32)getRelevantMinDim() / (F32)llmax(1, getRect().getHeight())));
-		return mVisibleAmt * collapse_amt;
+		LLLayoutStack* stackp = dynamic_cast<LLLayoutStack*>(getParent());
+		if (stackp)
+		{
+			stackp->mNeedsLayout = true;
+		}
 	}
+	LLPanel::setVisible(visible);
+}
+
+void LLLayoutPanel::reshape( S32 width, S32 height, BOOL called_from_parent /*= TRUE*/ )
+{
+	if (width == getRect().getWidth() && height == getRect().getHeight()) return;
+
+	if (!mIgnoreReshape && mAutoResize == false)
+	{
+		mTargetDim = (mOrientation == LLLayoutStack::HORIZONTAL) ? width : height;
+		LLLayoutStack* stackp = dynamic_cast<LLLayoutStack*>(getParent());
+		if (stackp)
+		{
+			stackp->mNeedsLayout = true;
+		}
+	}
+	LLPanel::reshape(width, height, called_from_parent);
+}
+
+void LLLayoutPanel::handleReshape(const LLRect& new_rect, bool by_user)
+{
+	LLLayoutStack* stackp = dynamic_cast<LLLayoutStack*>(getParent());
+	if (stackp)
+	{
+		if (by_user)
+		{	// tell layout stack to account for new shape
+			
+			// make sure that panels have already been auto resized
+			stackp->updateLayout();
+			// now apply requested size to panel
+			stackp->updatePanelRect(this, new_rect);
+		}
+		stackp->mNeedsLayout = true;
+	}
+	LLPanel::handleReshape(new_rect, by_user);
 }
 
 //
@@ -142,20 +214,21 @@ LLLayoutStack::Params::Params()
 	clip("clip", true),
 	open_time_constant("open_time_constant", 0.02f),
 	close_time_constant("close_time_constant", 0.03f),
+	resize_bar_overlap("resize_bar_overlap", 1),
 	border_size("border_size", LLCachedControl<S32>(*LLUI::sSettingGroups["config"], "UIResizeBarHeight", 0))
 {}
 
 LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p) 
 :	LLView(p),
-	mMinWidth(0),
-	mMinHeight(0),
 	mPanelSpacing(p.border_size),
 	mOrientation(p.orientation),
 	mAnimate(p.animate),
 	mAnimatedThisFrame(false),
+	mNeedsLayout(true),
 	mClip(p.clip),
 	mOpenTimeConstant(p.open_time_constant),
-	mCloseTimeConstant(p.close_time_constant)
+	mCloseTimeConstant(p.close_time_constant),
+	mResizeBarOverlap(p.resize_bar_overlap)
 {}
 
 LLLayoutStack::~LLLayoutStack()
@@ -169,28 +242,27 @@ void LLLayoutStack::draw()
 {
 	updateLayout();
 
-	e_panel_list_t::iterator panel_it;
-	for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
+	// always clip to stack itself
+	LLLocalClipRect clip(getLocalRect());
+	BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
 	{
 		// clip to layout rectangle, not bounding rectangle
-		LLRect clip_rect = (*panel_it)->getRect();
+		LLRect clip_rect = panelp->getRect();
 		// scale clipping rectangle by visible amount
 		if (mOrientation == HORIZONTAL)
 		{
-			clip_rect.mRight = clip_rect.mLeft + llround((F32)clip_rect.getWidth() * (*panel_it)->getCollapseFactor());
+			clip_rect.mRight = clip_rect.mLeft + panelp->getVisibleDim();
 		}
 		else
 		{
-			clip_rect.mBottom = clip_rect.mTop - llround((F32)clip_rect.getHeight() * (*panel_it)->getCollapseFactor());
+			clip_rect.mBottom = clip_rect.mTop - panelp->getVisibleDim();
 		}
 
-		LLPanel* panelp = (*panel_it);
-
-		LLLocalClipRect clip(clip_rect, mClip);
-		// only force drawing invisible children if visible amount is non-zero
-		drawChild(panelp, 0, 0, !clip_rect.isEmpty());
+		{LLLocalClipRect clip(clip_rect, mClip);
+			// only force drawing invisible children if visible amount is non-zero
+			drawChild(panelp, 0, 0, !clip_rect.isEmpty());
+		}
 	}
-	mAnimatedThisFrame = false;
 }
 
 void LLLayoutStack::removeChild(LLView* view)
@@ -201,12 +273,10 @@ void LLLayoutStack::removeChild(LLView* view)
 	{
 		mPanels.erase(std::find(mPanels.begin(), mPanels.end(), embedded_panelp));
 		delete embedded_panelp;
+		updateFractionalSizes();
+		mNeedsLayout = true;
 	}
 
-	// need to update resizebars
-
-	calcMinExtents();
-
 	LLView::removeChild(view);
 }
 
@@ -221,29 +291,15 @@ bool LLLayoutStack::addChild(LLView* child, S32 tab_group)
 	LLLayoutPanel* panelp = dynamic_cast<LLLayoutPanel*>(child);
 	if (panelp)
 	{
-		panelp->mFractionalSize = (mOrientation == HORIZONTAL)
-									? panelp->getRect().getWidth()
-									: panelp->getRect().getHeight();
 		panelp->setOrientation(mOrientation);
 		mPanels.push_back(panelp);
+		createResizeBar(panelp);
+		mNeedsLayout = true;
 	}
-	return LLView::addChild(child, tab_group);
-}
-
-void LLLayoutStack::movePanel(LLPanel* panel_to_move, LLPanel* target_panel, bool move_to_front)
-{
-	LLLayoutPanel* embedded_panel_to_move = findEmbeddedPanel(panel_to_move);
-	LLLayoutPanel* embedded_target_panel = move_to_front ? *mPanels.begin() : findEmbeddedPanel(target_panel);
+	BOOL result = LLView::addChild(child, tab_group);
 
-	if (!embedded_panel_to_move || !embedded_target_panel || embedded_panel_to_move == embedded_target_panel)
-	{
-		llwarns << "One of the panels was not found in stack or NULL was passed instead of valid panel" << llendl;
-		return;
-	}
-	e_panel_list_t::iterator it = std::find(mPanels.begin(), mPanels.end(), embedded_panel_to_move);
-	mPanels.erase(it);
-	it = move_to_front ? mPanels.begin() : std::find(mPanels.begin(), mPanels.end(), embedded_target_panel);
-	mPanels.insert(it, embedded_panel_to_move);
+	updateFractionalSizes();
+	return result;
 }
 
 void LLLayoutStack::addPanel(LLLayoutPanel* panel, EAnimate animate)
@@ -258,84 +314,281 @@ void LLLayoutStack::addPanel(LLLayoutPanel* panel, EAnimate animate)
 	}
 }
 
-void LLLayoutStack::removePanel(LLPanel* panel)
-{
-	removeChild(panel);
-}
-
 void LLLayoutStack::collapsePanel(LLPanel* panel, BOOL collapsed)
 {
 	LLLayoutPanel* panel_container = findEmbeddedPanel(panel);
 	if (!panel_container) return;
 
 	panel_container->mCollapsed = collapsed;
+	mNeedsLayout = true;
 }
 
-void LLLayoutStack::updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize)
+static LLFastTimer::DeclareTimer FTM_UPDATE_LAYOUT("Update LayoutStacks");
+
+void LLLayoutStack::updateLayout()
+{	
+	LLFastTimer ft(FTM_UPDATE_LAYOUT);
+
+	if (!mNeedsLayout) return;
+
+	bool continue_animating = animatePanels();
+	F32 total_visible_fraction = 0.f;
+	S32 space_to_distribute = (mOrientation == HORIZONTAL)
+							? getRect().getWidth()
+							: getRect().getHeight();
+
+	// first, assign minimum dimensions
+	LLLayoutPanel* panelp = NULL;
+	BOOST_FOREACH(panelp, mPanels)
+	{
+		if (panelp->mAutoResize)
+		{
+			panelp->mTargetDim = panelp->getRelevantMinDim();
+		}
+		space_to_distribute -= panelp->getVisibleDim() + llround((F32)mPanelSpacing * panelp->getVisibleAmount());
+		total_visible_fraction += panelp->mFractionalSize * panelp->getAutoResizeFactor();
+	}
+
+	llassert(total_visible_fraction < 1.05f);
+
+	// don't need spacing after last panel
+	space_to_distribute += panelp ? llround((F32)mPanelSpacing * panelp->getVisibleAmount()) : 0;
+
+	S32 remaining_space = space_to_distribute;
+	F32 fraction_distributed = 0.f;
+	if (space_to_distribute > 0 && total_visible_fraction > 0.f)
+	{	// give space proportionally to visible auto resize panels
+		BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+		{
+			if (panelp->mAutoResize)
+			{
+				F32 fraction_to_distribute = (panelp->mFractionalSize * panelp->getAutoResizeFactor()) / (total_visible_fraction);
+				S32 delta = llround((F32)space_to_distribute * fraction_to_distribute);
+				fraction_distributed += fraction_to_distribute;
+				panelp->mTargetDim += delta;
+				remaining_space -= delta;
+			}
+		}
+	}
+
+	// distribute any left over pixels to non-collapsed, visible panels
+	BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+	{
+		if (remaining_space == 0) break;
+
+		if (panelp->mAutoResize 
+			&& !panelp->mCollapsed 
+			&& panelp->getVisible())
+		{
+			S32 space_for_panel = remaining_space > 0 ? 1 : -1;
+			panelp->mTargetDim += space_for_panel;
+			remaining_space -= space_for_panel;
+		}
+	}
+
+	F32 cur_pos = (mOrientation == HORIZONTAL) ? 0.f : (F32)getRect().getHeight();
+
+	BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+	{
+		F32 panel_dim = llmax(panelp->getExpandedMinDim(), panelp->mTargetDim);
+		F32 panel_visible_dim = panelp->getVisibleDim();
+
+		LLRect panel_rect;
+		if (mOrientation == HORIZONTAL)
+		{
+			panel_rect.setLeftTopAndSize(llround(cur_pos),
+										getRect().getHeight(),
+										llround(panel_dim),
+										getRect().getHeight());
+		}
+		else
+		{
+			panel_rect.setLeftTopAndSize(0,
+										llround(cur_pos),
+										getRect().getWidth(),
+										llround(panel_dim));
+		}
+		panelp->setIgnoreReshape(true);
+		panelp->setShape(panel_rect);
+		panelp->setIgnoreReshape(false);
+
+		LLRect resize_bar_rect(panel_rect);
+
+		F32 panel_spacing = (F32)mPanelSpacing * panelp->getVisibleAmount();
+		if (mOrientation == HORIZONTAL)
+		{
+			resize_bar_rect.mLeft = panel_rect.mRight - mResizeBarOverlap;
+			resize_bar_rect.mRight = panel_rect.mRight + (S32)(llround(panel_spacing)) + mResizeBarOverlap;
+
+			cur_pos += panel_visible_dim + panel_spacing;
+		}
+		else //VERTICAL
+		{
+			resize_bar_rect.mTop = panel_rect.mBottom + mResizeBarOverlap;
+			resize_bar_rect.mBottom = panel_rect.mBottom - (S32)(llround(panel_spacing)) - mResizeBarOverlap;
+
+			cur_pos -= panel_visible_dim + panel_spacing;
+		}
+		panelp->mResizeBar->setShape(resize_bar_rect);
+	}
+
+	updateResizeBarLimits();
+
+	// clear animation flag at end, since panel resizes will set it
+	// and leave it set if there is any animation in progress
+	mNeedsLayout = continue_animating;
+} // end LLLayoutStack::updateLayout
+
+LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const
 {
-	LLLayoutPanel* panel = findEmbeddedPanelByName(panel_name);
+	if (!panelp) return NULL;
 
-	if (panel)
+	e_panel_list_t::const_iterator panel_it;
+	BOOST_FOREACH(LLLayoutPanel* p, mPanels)
 	{
-		panel->mAutoResize = auto_resize;
+		if (p == panelp)
+		{
+			return p;
+		}
 	}
+	return NULL;
 }
 
-void LLLayoutStack::setPanelUserResize(const std::string& panel_name, BOOL user_resize)
+LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) const
 {
-	LLLayoutPanel* panel = findEmbeddedPanelByName(panel_name);
+	LLLayoutPanel* result = NULL;
 
-	if (panel)
+	BOOST_FOREACH(LLLayoutPanel* p, mPanels)
 	{
-		panel->mUserResize = user_resize;
+		if (p->getName() == name)
+		{
+			result = p;
+			break;
+		}
 	}
+
+	return result;
 }
 
-bool LLLayoutStack::getPanelMinSize(const std::string& panel_name, S32* min_dimp)
+void LLLayoutStack::createResizeBar(LLLayoutPanel* panelp)
 {
-	LLLayoutPanel* panel = findEmbeddedPanelByName(panel_name);
+	BOOST_FOREACH(LLLayoutPanel* lp, mPanels)
+	{
+		if (lp->mResizeBar == NULL)
+		{
+			LLResizeBar::Side side = (mOrientation == HORIZONTAL) ? LLResizeBar::RIGHT : LLResizeBar::BOTTOM;
+			LLRect resize_bar_rect = getRect();
 
-	if (panel && min_dimp)
+			LLResizeBar::Params resize_params;
+			resize_params.name("resize");
+			resize_params.resizing_view(lp);
+			resize_params.min_size(lp->getRelevantMinDim());
+			resize_params.side(side);
+			resize_params.snapping_enabled(false);
+			LLResizeBar* resize_bar = LLUICtrlFactory::create<LLResizeBar>(resize_params);
+			lp->mResizeBar = resize_bar;
+			LLView::addChild(resize_bar, 0);
+		}
+	}
+	// bring all resize bars to the front so that they are clickable even over the panels
+	// with a bit of overlap
+	for (e_panel_list_t::iterator panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
 	{
-		*min_dimp = panel->getRelevantMinDim();
+		LLResizeBar* resize_barp = (*panel_it)->mResizeBar;
+		sendChildToFront(resize_barp);
 	}
+}
 
-	return NULL != panel;
+// update layout stack animations, etc. once per frame
+// NOTE: we use this to size world view based on animating UI, *before* we draw the UI
+// we might still need to call updateLayout during UI draw phase, in case UI elements
+// are resizing themselves dynamically
+//static 
+void LLLayoutStack::updateClass()
+{
+	for (instance_iter it = beginInstances(); it != endInstances(); ++it)
+	{
+		it->updateLayout();
+		it->mAnimatedThisFrame = false;
+	}
 }
 
-bool LLLayoutStack::getPanelMaxSize(const std::string& panel_name, S32* max_dimp)
+void LLLayoutStack::updateFractionalSizes()
 {
-	LLLayoutPanel* panel = findEmbeddedPanelByName(panel_name);
+	F32 total_resizable_dim = 0.f;
 
-	if (panel)
+	BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
 	{
-		if (max_dimp) *max_dimp = panel->mMaxDim;
+		if (panelp->mAutoResize)
+		{
+			total_resizable_dim += llmax(0, panelp->getLayoutDim() - panelp->getRelevantMinDim());
+		}
 	}
 
-	return NULL != panel;
+	BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+	{
+		if (panelp->mAutoResize)
+		{
+			F32 panel_resizable_dim = llmax(MIN_FRACTIONAL_SIZE, (F32)(panelp->getLayoutDim() - panelp->getRelevantMinDim()));
+			panelp->mFractionalSize = panel_resizable_dim > 0.f 
+				? llclamp(panel_resizable_dim / total_resizable_dim, MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE)
+				: MIN_FRACTIONAL_SIZE;
+			llassert(!llisnan(panelp->mFractionalSize));
+		}
+	}
+
+	normalizeFractionalSizes();
 }
 
-static LLFastTimer::DeclareTimer FTM_UPDATE_LAYOUT("Update LayoutStacks");
-void LLLayoutStack::updateLayout(BOOL force_resize)
+
+void LLLayoutStack::normalizeFractionalSizes()
 {
-	LLFastTimer ft(FTM_UPDATE_LAYOUT);
-	static LLUICachedControl<S32> resize_bar_overlap ("UIResizeBarOverlap", 0);
-	calcMinExtents();
-	createResizeBars();
+	S32 num_auto_resize_panels = 0;
+	F32 total_fractional_size = 0.f;
+	
+	BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+	{
+		if (panelp->mAutoResize)
+		{
+			total_fractional_size += panelp->mFractionalSize;
+			num_auto_resize_panels++;
+		}
+	}
 
-	// calculate current extents
-	F32 total_size = 0.f;
+	if (total_fractional_size == 0.f)
+	{ // equal distribution
+		BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+		{
+			if (panelp->mAutoResize)
+			{
+				panelp->mFractionalSize = MAX_FRACTIONAL_SIZE / (F32)num_auto_resize_panels;
+			}
+		}
+	}
+	else
+	{ // renormalize
+		BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+		{
+			if (panelp->mAutoResize)
+			{
+				panelp->mFractionalSize /= total_fractional_size;
+			}
+		}
+	}
+}
 
+bool LLLayoutStack::animatePanels()
+{
+	bool continue_animating = false;
+	
 	//
 	// animate visibility
 	//
-	e_panel_list_t::iterator panel_it;
-	for (panel_it = mPanels.begin(); panel_it != mPanels.end();	++panel_it)
+	BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
 	{
-		LLLayoutPanel* panelp = (*panel_it);
-		if (panelp->getVisible()) 
+		if (panelp->getVisible())
 		{
-			if (mAnimate)
+			if (mAnimate && panelp->mVisibleAmt < 1.f)
 			{
 				if (!mAnimatedThisFrame)
 				{
@@ -345,15 +598,22 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
 						panelp->mVisibleAmt = 1.f;
 					}
 				}
+				
+				mAnimatedThisFrame = true;
+				continue_animating = true;
 			}
 			else
 			{
-				panelp->mVisibleAmt = 1.f;
+				if (panelp->mVisibleAmt != 1.f)
+				{
+					panelp->mVisibleAmt = 1.f;
+					mAnimatedThisFrame = true;
+				}
 			}
 		}
 		else // not visible
 		{
-			if (mAnimate)
+			if (mAnimate && panelp->mVisibleAmt > 0.f)
 			{
 				if (!mAnimatedThisFrame)
 				{
@@ -363,297 +623,235 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
 						panelp->mVisibleAmt = 0.f;
 					}
 				}
+
+				continue_animating = true;
+				mAnimatedThisFrame = true;
 			}
 			else
 			{
-				panelp->mVisibleAmt = 0.f;
+				if (panelp->mVisibleAmt != 0.f)
+				{
+					panelp->mVisibleAmt = 0.f;
+					mAnimatedThisFrame = true;
+				}
 			}
 		}
 
 		F32 collapse_state = panelp->mCollapsed ? 1.f : 0.f;
-		panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
-
-        total_size += panelp->mFractionalSize * panelp->getCollapseFactor();
-        // want n-1 panel gaps for n panels
-		if (panel_it != mPanels.begin())
-		{
-			total_size += mPanelSpacing;
-		}
-	}
-
-	S32 num_resizable_panels = 0;
-	F32 shrink_headroom_available = 0.f;
-	F32 shrink_headroom_total = 0.f;
-	for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
-	{
-		LLLayoutPanel* panelp = (*panel_it);
-
-		// panels that are not fully visible do not count towards shrink headroom
-		if (panelp->getCollapseFactor() < 1.f) 
+		if (panelp->mCollapseAmt != collapse_state)
 		{
-			continue;
-		}
-
-		F32 cur_size = panelp->mFractionalSize;
-		F32 min_size = (F32)panelp->getRelevantMinDim();
-		
-		// if currently resizing a panel or the panel is flagged as not automatically resizing
-		// only track total available headroom, but don't use it for automatic resize logic
-		if (panelp->mResizeBar->hasMouseCapture() 
-			|| (!panelp->mAutoResize 
-				&& !force_resize))
-		{
-			shrink_headroom_total += cur_size - min_size;
-		}
-		else
-		{
-			num_resizable_panels++;
+			if (mAnimate)
+			{
+				if (!mAnimatedThisFrame)
+				{
+					panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
+				}
 			
-			shrink_headroom_available += cur_size - min_size;
-			shrink_headroom_total += cur_size - min_size;
-		}
-	}
-
-	// calculate how many pixels need to be distributed among layout panels
-	// positive means panels need to grow, negative means shrink
-	F32 pixels_to_distribute = (mOrientation == HORIZONTAL)
-							? getRect().getWidth() - total_size
-							: getRect().getHeight() - total_size;
-
-	// now we distribute the pixels...
-	F32 cur_x = 0.f;
-	F32 cur_y = (F32)getRect().getHeight();
-
-	for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
-	{
-		LLLayoutPanel* panelp = (*panel_it);
-
-		F32 min_size = panelp->getRelevantMinDim();
-		F32 delta_size = 0.f;
+				if (llabs(panelp->mCollapseAmt - collapse_state) < 0.001f)
+				{
+					panelp->mCollapseAmt = collapse_state;
+				}
 
-		// if panel can automatically resize (not animating, and resize flag set)...
-		if (panelp->getCollapseFactor() == 1.f 
-			&& (force_resize || panelp->mAutoResize) 
-			&& !panelp->mResizeBar->hasMouseCapture()) 
-		{
-			if (pixels_to_distribute < 0.f)
-			{
-				// shrink proportionally to amount over minimum
-				// so we can do this in one pass
-				delta_size = (shrink_headroom_available > 0.f) 
-					? pixels_to_distribute * ((F32)(panelp->mFractionalSize - min_size) / shrink_headroom_available) 
-					: 0.f;
-				shrink_headroom_available -= (panelp->mFractionalSize - min_size);
+				mAnimatedThisFrame = true;
+				continue_animating = true;
 			}
 			else
 			{
-				// grow all elements equally
-				delta_size = pixels_to_distribute / (F32)num_resizable_panels;
-				num_resizable_panels--;
+				panelp->mCollapseAmt = collapse_state;
+				mAnimatedThisFrame = true;
 			}
-			
-			panelp->mFractionalSize = llmax(min_size, panelp->mFractionalSize + delta_size);
-			pixels_to_distribute -= delta_size;
 		}
+	}
 
-		// adjust running headroom count based on new sizes
-		shrink_headroom_total += delta_size;
+	if (mAnimatedThisFrame) mNeedsLayout = true;
+	return continue_animating;
+}
 
-		LLRect panel_rect;
-		if (mOrientation == HORIZONTAL)
-		{
-			panel_rect.setLeftTopAndSize(llround(cur_x), 
-										llround(cur_y), 
-										llround(panelp->mFractionalSize), 
-										getRect().getHeight());
-		}
-		else
-		{
-			panel_rect.setLeftTopAndSize(llround(cur_x), 
-										llround(cur_y), 
-										getRect().getWidth(), 
-										llround(panelp->mFractionalSize));
-		}
-		panelp->setShape(panel_rect);
+void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& new_rect )
+{
+	S32 new_dim = (mOrientation == HORIZONTAL)
+					? new_rect.getWidth()
+					: new_rect.getHeight();
+	S32 delta_dim = new_dim - resized_panel->getVisibleDim();
+	if (delta_dim == 0) return;
 
-		LLRect resize_bar_rect = panel_rect;
-		if (mOrientation == HORIZONTAL)
-		{
-			resize_bar_rect.mLeft = panel_rect.mRight - resize_bar_overlap;
-			resize_bar_rect.mRight = panel_rect.mRight + mPanelSpacing + resize_bar_overlap;
-		}
-		else
-		{
-			resize_bar_rect.mTop = panel_rect.mBottom + resize_bar_overlap;
-			resize_bar_rect.mBottom = panel_rect.mBottom - mPanelSpacing - resize_bar_overlap;
-		}
-		(*panel_it)->mResizeBar->setRect(resize_bar_rect);
+	F32 total_visible_fraction = 0.f;
+	F32 delta_auto_resize_headroom = 0.f;
+	F32 original_auto_resize_headroom = 0.f;
 
-		F32 size = ((*panel_it)->mFractionalSize * (*panel_it)->getCollapseFactor()) + (F32)mPanelSpacing;
-		if (mOrientation == HORIZONTAL)
-		{
-			cur_x += size;
-		}
-		else //VERTICAL
-		{
-			cur_y -= size;
-		}
-	}
+	LLLayoutPanel* other_resize_panel = NULL;
+	LLLayoutPanel* following_panel = NULL;
 
-	// update resize bars with new limits
-	LLLayoutPanel* last_resizeable_panel = NULL;
-	for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
+	BOOST_REVERSE_FOREACH(LLLayoutPanel* panelp, mPanels)
 	{
-		LLLayoutPanel* panelp = (*panel_it);
-		S32 relevant_min = panelp->getRelevantMinDim();
-
-		if (mOrientation == HORIZONTAL)
+		if (panelp->mAutoResize)
 		{
-			(*panel_it)->mResizeBar->setResizeLimits(
-				relevant_min, 
-				relevant_min + llround(shrink_headroom_total));
+			original_auto_resize_headroom += (F32)(panelp->mTargetDim - panelp->getRelevantMinDim());
+			if (panelp->getVisible() && !panelp->mCollapsed)
+			{
+				total_visible_fraction += panelp->mFractionalSize;
+			}
 		}
-		else //VERTICAL
+
+		if (panelp == resized_panel)
 		{
-			(*panel_it)->mResizeBar->setResizeLimits(
-				relevant_min, 
-				relevant_min + llround(shrink_headroom_total));
+			other_resize_panel = following_panel;
 		}
 
-		// toggle resize bars based on panel visibility, resizability, etc
-		BOOL resize_bar_enabled = panelp->getVisible() && (*panel_it)->mUserResize;
-		(*panel_it)->mResizeBar->setVisible(resize_bar_enabled);
-
-		if ((*panel_it)->mUserResize || (*panel_it)->mAutoResize)
+		if (panelp->getVisible() && !panelp->mCollapsed)
 		{
-			last_resizeable_panel = (*panel_it);
+			following_panel = panelp;
 		}
 	}
 
-	// hide last resize bar as there is nothing past it
-	// resize bars need to be in between two resizable panels
-	if (last_resizeable_panel)
-	{
-		last_resizeable_panel->mResizeBar->setVisible(FALSE);
-	}
 
-	// not enough room to fit existing contents
-	if (force_resize == FALSE
-		// layout did not complete by reaching target position
-		&& ((mOrientation == VERTICAL && llround(cur_y) != -mPanelSpacing)
-			|| (mOrientation == HORIZONTAL && llround(cur_x) != getRect().getWidth() + mPanelSpacing)))
+	if (resized_panel->mAutoResize)
 	{
-		// do another layout pass with all stacked elements contributing
-		// even those that don't usually resize
-		llassert_always(force_resize == FALSE);
-		updateLayout(TRUE);
+		if (!other_resize_panel || !other_resize_panel->mAutoResize)
+		{
+			delta_auto_resize_headroom += delta_dim;	
+		}
 	}
-
-	 mAnimatedThisFrame = true;
-} // end LLLayoutStack::updateLayout
-
-
-LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const
-{
-	if (!panelp) return NULL;
-
-	e_panel_list_t::const_iterator panel_it;
-	for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
+	else 
 	{
-		if ((*panel_it) == panelp)
+		if (!other_resize_panel || other_resize_panel->mAutoResize)
 		{
-			return *panel_it;
+			delta_auto_resize_headroom -= delta_dim;
 		}
 	}
-	return NULL;
-}
 
-LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) const
-{
-	LLLayoutPanel* result = NULL;
+	F32 fraction_given_up = 0.f;
+	F32 fraction_remaining = 1.f;
+	F32 updated_auto_resize_headroom = original_auto_resize_headroom + delta_auto_resize_headroom;
 
-	for (e_panel_list_t::const_iterator panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
+	enum
 	{
-		LLLayoutPanel* p = *panel_it;
+		BEFORE_RESIZED_PANEL,
+		RESIZED_PANEL,
+		NEXT_PANEL,
+		AFTER_RESIZED_PANEL
+	} which_panel = BEFORE_RESIZED_PANEL;
 
-		if (p->getName() == name)
+	BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+	{
+		if (!panelp->getVisible() || panelp->mCollapsed) continue;
+
+		if (panelp == resized_panel)
 		{
-			result = p;
-			break;
+			which_panel = RESIZED_PANEL;
 		}
-	}
 
-	return result;
-}
-
-// Compute sum of min_width or min_height of children
-void LLLayoutStack::calcMinExtents()
-{
-	mMinWidth = 0;
-	mMinHeight = 0;
-
-	e_panel_list_t::iterator panel_it;
-	for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
-	{
-		if (mOrientation == HORIZONTAL)
+		switch(which_panel)
 		{
-            mMinWidth += (*panel_it)->getRelevantMinDim();
-			if (panel_it != mPanels.begin())
+		case BEFORE_RESIZED_PANEL:
+			if (panelp->mAutoResize)
+			{	// freeze current size as fraction of overall auto_resize space
+				F32 fractional_adjustment_factor = updated_auto_resize_headroom == 0.f
+													? 1.f
+													: original_auto_resize_headroom / updated_auto_resize_headroom;
+				F32 new_fractional_size = llclamp(panelp->mFractionalSize * fractional_adjustment_factor,
+													MIN_FRACTIONAL_SIZE,
+													MAX_FRACTIONAL_SIZE);
+				fraction_given_up -= new_fractional_size - panelp->mFractionalSize;
+				fraction_remaining -= panelp->mFractionalSize;
+				panelp->mFractionalSize = new_fractional_size;
+				llassert(!llisnan(panelp->mFractionalSize));
+			}
+			else
 			{
-				mMinWidth += mPanelSpacing;
+				// leave non auto-resize panels alone
 			}
-		}
-		else //VERTICAL
-		{
-			mMinHeight += (*panel_it)->getRelevantMinDim();
-			if (panel_it != mPanels.begin())
+			break;
+		case RESIZED_PANEL:
+			if (panelp->mAutoResize)
+			{	// freeze new size as fraction
+				F32 new_fractional_size = (updated_auto_resize_headroom == 0.f)
+					? MAX_FRACTIONAL_SIZE
+					: llclamp(total_visible_fraction * (F32)(new_dim - panelp->getRelevantMinDim()) / updated_auto_resize_headroom, MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE);
+				fraction_given_up -= new_fractional_size - panelp->mFractionalSize;
+				fraction_remaining -= panelp->mFractionalSize;
+				panelp->mFractionalSize = new_fractional_size;
+				llassert(!llisnan(panelp->mFractionalSize));
+			}
+			else
+			{	// freeze new size as original size
+				panelp->mTargetDim = new_dim;
+			}
+			which_panel = NEXT_PANEL;
+			break;
+		case NEXT_PANEL:
+			if (panelp->mAutoResize)
+			{
+				fraction_remaining -= panelp->mFractionalSize;
+				if (resized_panel->mAutoResize)
+				{
+					panelp->mFractionalSize = llclamp(panelp->mFractionalSize + fraction_given_up, MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE);
+					fraction_given_up = 0.f;
+				}
+				else
+				{
+					F32 new_fractional_size = llclamp(total_visible_fraction * (F32)(panelp->mTargetDim - panelp->getRelevantMinDim() + delta_auto_resize_headroom) 
+														/ updated_auto_resize_headroom,
+													MIN_FRACTIONAL_SIZE,
+													MAX_FRACTIONAL_SIZE);
+					fraction_given_up -= new_fractional_size - panelp->mFractionalSize;
+					panelp->mFractionalSize = new_fractional_size;
+				}
+			}
+			else
 			{
-				mMinHeight += mPanelSpacing;
+				panelp->mTargetDim -= delta_dim;
 			}
+			which_panel = AFTER_RESIZED_PANEL;
+			break;
+		case AFTER_RESIZED_PANEL:
+			if (panelp->mAutoResize && fraction_given_up != 0.f)
+			{
+				panelp->mFractionalSize = llclamp(panelp->mFractionalSize + (panelp->mFractionalSize / fraction_remaining) * fraction_given_up,
+												MIN_FRACTIONAL_SIZE,
+												MAX_FRACTIONAL_SIZE);
+			}
+		default:
+			break;
 		}
 	}
+	updateLayout();
+	normalizeFractionalSizes();
 }
 
-void LLLayoutStack::createResizeBars()
+void LLLayoutStack::reshape(S32 width, S32 height, BOOL called_from_parent)
 {
-	for (e_panel_list_t::iterator panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
+	mNeedsLayout = true;
+	LLView::reshape(width, height, called_from_parent);
+}
+
+void LLLayoutStack::updateResizeBarLimits()
+{
+	LLLayoutPanel* previous_visible_panelp = NULL;
+	BOOST_REVERSE_FOREACH(LLLayoutPanel* visible_panelp, mPanels)
 	{
-		LLLayoutPanel* lp = (*panel_it);
-		if (lp->mResizeBar == NULL)
+		if (!visible_panelp->getVisible() || visible_panelp->mCollapsed)
 		{
-			LLResizeBar::Side side = (mOrientation == HORIZONTAL) ? LLResizeBar::RIGHT : LLResizeBar::BOTTOM;
-			LLRect resize_bar_rect = getRect();
-
-			LLResizeBar::Params resize_params;
-			resize_params.name("resize");
-			resize_params.resizing_view(lp);
-			resize_params.min_size(lp->getRelevantMinDim());
-			resize_params.side(side);
-			resize_params.snapping_enabled(false);
-			LLResizeBar* resize_bar = LLUICtrlFactory::create<LLResizeBar>(resize_params);
-			lp->mResizeBar = resize_bar;
-			LLView::addChild(resize_bar, 0);
+			visible_panelp->mResizeBar->setVisible(FALSE);
+			continue;
+		}
 
-			// bring all resize bars to the front so that they are clickable even over the panels
-			// with a bit of overlap
-			for (e_panel_list_t::iterator panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
-			{
-				LLResizeBar* resize_barp = (*panel_it)->mResizeBar;
-				sendChildToFront(resize_barp);
-			}
+		// toggle resize bars based on panel visibility, resizability, etc
+		if (previous_visible_panelp
+			&& (visible_panelp->mUserResize || previous_visible_panelp->mUserResize)				// one of the pair is user resizable
+			&& (visible_panelp->mAutoResize || visible_panelp->mUserResize)							// current panel is resizable
+			&& (previous_visible_panelp->mAutoResize || previous_visible_panelp->mUserResize))		// previous panel is resizable
+		{
+			visible_panelp->mResizeBar->setVisible(TRUE);
+			S32 previous_panel_headroom = previous_visible_panelp->getVisibleDim() - previous_visible_panelp->getRelevantMinDim();
+			visible_panelp->mResizeBar->setResizeLimits(visible_panelp->getRelevantMinDim(), 
+														visible_panelp->getVisibleDim() + previous_panel_headroom);
+		}
+		else
+		{
+			visible_panelp->mResizeBar->setVisible(FALSE);
 		}
-	}
-}
 
-// update layout stack animations, etc. once per frame
-// NOTE: we use this to size world view based on animating UI, *before* we draw the UI
-// we might still need to call updateLayout during UI draw phase, in case UI elements
-// are resizing themselves dynamically
-//static 
-void LLLayoutStack::updateClass()
-{
-	for (instance_iter it = beginInstances(); it != endInstances(); ++it)
-	{
-		it->updateLayout();
+		previous_visible_panelp = visible_panelp;
 	}
 }
diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h
index ede6149a800da8c15b6de93079cb2845a767d0e5..648cd5fdce202d209758295b4f72da4228ff1569 100644
--- a/indra/llui/lllayoutstack.h
+++ b/indra/llui/lllayoutstack.h
@@ -5,7 +5,7 @@
  *
  * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * Copyright (C) 2010, Linden Reshasearch, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -60,6 +60,7 @@ class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack>
 								clip;
 		Optional<F32>			open_time_constant,
 								close_time_constant;
+		Optional<S32>			resize_bar_overlap;
 
 		Params();
 	};
@@ -71,13 +72,12 @@ class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack>
 	/*virtual*/ void draw();
 	/*virtual*/ void removeChild(LLView*);
 	/*virtual*/ BOOL postBuild();
-	/*virtual*/ bool addChild(LLView* child, S32 tab_group = 0);
+	/*virtual*/ bool addChild(LLView* child, S32 tab_groupdatefractuiona = 0);
+	/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+
 
 	static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL);
 
-	S32 getMinWidth() const { return mMinWidth; }
-	S32 getMinHeight() const { return mMinHeight; }
-	
 	typedef enum e_animate
 	{
 		NO_ANIMATE,
@@ -85,47 +85,24 @@ class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack>
 	} EAnimate;
 
 	void addPanel(LLLayoutPanel* panel, EAnimate animate = NO_ANIMATE);
-	void removePanel(LLPanel* panel);
 	void collapsePanel(LLPanel* panel, BOOL collapsed = TRUE);
 	S32 getNumPanels() { return mPanels.size(); }
-	/**
-	 * Moves panel_to_move before target_panel inside layout stack (both panels should already be there).
-	 * If move_to_front is true target_panel is ignored and panel_to_move is moved to the beginning of mPanels
-	 */
-	void movePanel(LLPanel* panel_to_move, LLPanel* target_panel, bool move_to_front = false);
-
-	void updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize);
-	void setPanelUserResize(const std::string& panel_name, BOOL user_resize);
-	
-	/**
-	 * Gets minimal dimension along layout_stack axis of the specified by name panel.
-	 *
-	 * @returns true if specified by panel_name internal panel exists, false otherwise.
-	 */
-	bool getPanelMinSize(const std::string& panel_name, S32* min_dimp);
-
-	/**
-	 * Gets maximal dimension along layout_stack axis of the specified by name panel.
-	 *
-	 * @returns true if specified by panel_name internal panel exists, false otherwise.
-	 */
-	bool getPanelMaxSize(const std::string& panel_name, S32* max_dim);
-	
-	void updateLayout(BOOL force_resize = FALSE);
-	
+
+	void updateLayout();
+
 	S32 getPanelSpacing() const { return mPanelSpacing; }
-	BOOL getAnimate () const { return mAnimate; }
-	void setAnimate (BOOL animate) { mAnimate = animate; }
 	
 	static void updateClass();
 
 protected:
 	LLLayoutStack(const Params&);
 	friend class LLUICtrlFactory;
+	friend class LLLayoutPanel;
 
 private:
-	void createResizeBars();
-	void calcMinExtents();
+	void updateResizeBarLimits();
+	bool animatePanels();
+	void createResizeBar(LLLayoutPanel* panel);
 
 	const ELayoutOrientation mOrientation;
 
@@ -134,17 +111,20 @@ class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack>
 
 	LLLayoutPanel* findEmbeddedPanel(LLPanel* panelp) const;
 	LLLayoutPanel* findEmbeddedPanelByName(const std::string& name) const;
+	void updateFractionalSizes();
+	void normalizeFractionalSizes();
+	void updatePanelRect( LLLayoutPanel* param1, const LLRect& new_rect );
 
-	S32 mMinWidth;  // calculated by calcMinExtents
-	S32 mMinHeight;  // calculated by calcMinExtents
 	S32 mPanelSpacing;
 
 	// true if we already applied animation this frame
 	bool mAnimatedThisFrame;
 	bool mAnimate;
 	bool mClip;
-	F32 mOpenTimeConstant;
-	F32 mCloseTimeConstant;
+	F32  mOpenTimeConstant;
+	F32  mCloseTimeConstant;
+	bool mNeedsLayout;
+	S32  mResizeBarOverlap;
 }; // end class LLLayoutStack
 
 
@@ -156,8 +136,7 @@ friend class LLUICtrlFactory;
 	struct Params : public LLInitParam::Block<Params, LLPanel::Params>
 	{
 		Optional<S32>			expanded_min_dim,
-								min_dim,
-								max_dim;
+								min_dim;
 		Optional<bool>			user_resize,
 								auto_resize;
 
@@ -168,16 +147,21 @@ friend class LLUICtrlFactory;
 
 	void initFromParams(const Params& p);
 
+	void handleReshape(const LLRect& new_rect, bool by_user);
+
 	void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+	
 
-	S32 getMinDim() const { return mMinDim; }
-	void setMinDim(S32 value) { mMinDim = value; if (!mExpandedMinDimSpecified) mExpandedMinDim = value; }
+	void setVisible(BOOL visible);
 
-	S32 getMaxDim() const { return mMaxDim; }
-	void setMaxDim(S32 value) { mMaxDim = value; }
+	S32 getLayoutDim() const;
+	S32 getTargetDim() const;
+	void setTargetDim(S32 value);
+	S32 getMinDim() const { return llmax(0, mMinDim); }
+	void setMinDim(S32 value) { mMinDim = value; }
 
-	S32 getExpandedMinDim() const { return mExpandedMinDim; }
-	void setExpandedMinDim(S32 value) { mExpandedMinDim = value; mExpandedMinDimSpecified = true; }
+	S32 getExpandedMinDim() const { return mExpandedMinDim >= 0 ? mExpandedMinDim : getMinDim(); }
+	void setExpandedMinDim(S32 value) { mExpandedMinDim = value; }
 	
 	S32 getRelevantMinDim() const
 	{
@@ -185,30 +169,35 @@ friend class LLUICtrlFactory;
 		
 		if (!mCollapsed)
 		{
-			min_dim = mExpandedMinDim;
+			min_dim = getExpandedMinDim();
 		}
 		
 		return min_dim;
 	}
 
-	void setOrientation(LLLayoutStack::ELayoutOrientation orientation) { mOrientation = orientation; }
+	F32 getAutoResizeFactor() const;
+	F32 getVisibleAmount() const;
+	S32 getVisibleDim() const;
+
+	void setOrientation(LLLayoutStack::ELayoutOrientation orientation);
+	void storeOriginalDim();
+
+	void setIgnoreReshape(bool ignore) { mIgnoreReshape = ignore; }
 
 protected:
 	LLLayoutPanel(const Params& p);
 	
-	F32 getCollapseFactor();
+	const bool	mAutoResize;
+	const bool	mUserResize;
 
-	bool	mExpandedMinDimSpecified;
 	S32		mExpandedMinDim;
-	
 	S32		mMinDim;
-	S32		mMaxDim;
-	bool	mAutoResize;
-	bool	mUserResize;
 	bool	mCollapsed;
 	F32		mVisibleAmt;
 	F32		mCollapseAmt;
 	F32		mFractionalSize;
+	S32		mTargetDim;
+	bool	mIgnoreReshape;
 	LLLayoutStack::ELayoutOrientation mOrientation;
 	class LLResizeBar* mResizeBar;
 };
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 06dfc90d83ba51ca21dba130e00683383727dc87..d0fbf4b91370d6c7f46c2e3addb9306cca2cbaa5 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -1047,7 +1047,7 @@ void LLLineEditor::cut()
 		// Prepare for possible rollback
 		LLLineEditorRollback rollback( this );
 
-		gClipboard.copyFromSubstring( mText.getWString(), left_pos, length );
+		LLClipboard::instance().copyToClipboard( mText.getWString(), left_pos, length );
 		deleteSelection();
 
 		// Validate new string and rollback the if needed.
@@ -1078,13 +1078,13 @@ void LLLineEditor::copy()
 	{
 		S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
 		S32 length = llabs( mSelectionStart - mSelectionEnd );
-		gClipboard.copyFromSubstring( mText.getWString(), left_pos, length );
+		LLClipboard::instance().copyToClipboard( mText.getWString(), left_pos, length );
 	}
 }
 
 BOOL LLLineEditor::canPaste() const
 {
-	return !mReadOnly && gClipboard.canPasteString(); 
+	return !mReadOnly && LLClipboard::instance().isTextAvailable(); 
 }
 
 void LLLineEditor::paste()
@@ -1115,14 +1115,7 @@ void LLLineEditor::pasteHelper(bool is_primary)
 	if (can_paste_it)
 	{
 		LLWString paste;
-		if (is_primary)
-		{
-			paste = gClipboard.getPastePrimaryWString();
-		}
-		else 
-		{
-			paste = gClipboard.getPasteWString();
-		}
+		LLClipboard::instance().pasteFromClipboard(paste, is_primary);
 
 		if (!paste.empty())
 		{
@@ -1209,13 +1202,13 @@ void LLLineEditor::copyPrimary()
 	{
 		S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
 		S32 length = llabs( mSelectionStart - mSelectionEnd );
-		gClipboard.copyFromPrimarySubstring( mText.getWString(), left_pos, length );
+		LLClipboard::instance().copyToClipboard( mText.getWString(), left_pos, length, true);
 	}
 }
 
 BOOL LLLineEditor::canPastePrimary() const
 {
-	return !mReadOnly && gClipboard.canPastePrimaryString(); 
+	return !mReadOnly && LLClipboard::instance().isTextAvailable(true); 
 }
 
 void LLLineEditor::updatePrimary()
@@ -1630,7 +1623,7 @@ void LLLineEditor::draw()
 	LLRect background( 0, getRect().getHeight(), getRect().getWidth(), 0 );
 	background.stretch( -mBorderThickness );
 
-	S32 lineeditor_v_pad = llround((background.getHeight() - mGLFont->getLineHeight())/2);
+	S32 lineeditor_v_pad = (background.getHeight() - mGLFont->getLineHeight()) / 2;
 
 	drawBackground();
 	
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index cb237fca7c81264161693370adcf030dc595347a..ff6928ffda10b9ebf2188483c286338a736d97ba 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -317,7 +317,7 @@ void LLMenuItemGL::setJumpKey(KEY key)
 // virtual 
 U32 LLMenuItemGL::getNominalHeight( void ) const 
 { 
-	return llround(mFont->getLineHeight()) + MENU_ITEM_PADDING; 
+	return mFont->getLineHeight() + MENU_ITEM_PADDING;
 }
 
 //virtual
@@ -508,19 +508,19 @@ void LLMenuItemGL::draw( void )
 	{
 		if( !mDrawBoolLabel.empty() )
 		{
-			mFont->render( mDrawBoolLabel.getWString(), 0, (F32)LEFT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
+			mFont->render( mDrawBoolLabel.getWString(), 0, (F32)LEFT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color,
 						   LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE );
 		}
-		mFont->render( mLabel.getWString(), 0, (F32)LEFT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
+		mFont->render( mLabel.getWString(), 0, (F32)LEFT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color,
 					   LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE );
 		if( !mDrawAccelLabel.empty() )
 		{
-			mFont->render( mDrawAccelLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
+			mFont->render( mDrawAccelLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color,
 						   LLFontGL::RIGHT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE );
 		}
 		if( !mDrawBranchLabel.empty() )
 		{
-			mFont->render( mDrawBranchLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
+			mFont->render( mDrawBranchLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color,
 						   LLFontGL::RIGHT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE );
 		}
 	}
@@ -947,9 +947,14 @@ LLMenuItemBranchGL::LLMenuItemBranchGL(const LLMenuItemBranchGL::Params& p)
 
 LLMenuItemBranchGL::~LLMenuItemBranchGL()
 {
-	delete mBranchHandle.get();
+	if (mBranchHandle.get())
+	{
+		mBranchHandle.get()->die();
+	}
 }
 
+
+
 // virtual
 LLView* LLMenuItemBranchGL::getChildView(const std::string& name, BOOL recurse) const
 {
@@ -1961,7 +1966,7 @@ void LLMenuGL::arrange( void )
 
 		// *FIX: create the item first and then ask for its dimensions?
 		S32 spillover_item_width = PLAIN_PAD_PIXELS + LLFontGL::getFontSansSerif()->getWidth( std::string("More") ); // *TODO: Translate
-		S32 spillover_item_height = llround(LLFontGL::getFontSansSerif()->getLineHeight()) + MENU_ITEM_PADDING;
+		S32 spillover_item_height = LLFontGL::getFontSansSerif()->getLineHeight() + MENU_ITEM_PADDING;
 
 		// Scrolling support
 		item_list_t::iterator first_visible_item_iter;
@@ -3077,7 +3082,7 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y)
 		mouse_y + MOUSE_CURSOR_PADDING, 
 		CURSOR_WIDTH + MOUSE_CURSOR_PADDING * 2, 
 		CURSOR_HEIGHT + MOUSE_CURSOR_PADDING * 2);
-	menu->translateIntoRectWithExclusion( menu_region_rect, mouse_rect, FALSE );
+	menu->translateIntoRectWithExclusion( menu_region_rect, mouse_rect );
 	menu->getParent()->sendChildToFront(menu);
 }
 
@@ -3420,7 +3425,7 @@ void LLMenuHolderGL::draw()
 		
 		LLUI::pushMatrix();
 		{
-			LLUI::translate((F32)item_rect.mLeft, (F32)item_rect.mBottom, 0.f);
+			LLUI::translate((F32)item_rect.mLeft, (F32)item_rect.mBottom);
 			selecteditem->getMenu()->drawBackground(selecteditem, interpolant);
 			selecteditem->draw();
 		}
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index bdae899933b6c0b5e9cf47a2a3fa19512683affe..36f3ba34b9b5e45c3271563e0efc7224acbb86fe 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -681,7 +681,7 @@ class LLContextMenu
 
 			BOOL	appendContextSubMenu(LLContextMenu *menu);
 
-			LLHandle<LLContextMenu> getHandle() { mHandle.bind(this); return mHandle; }
+			LLHandle<LLContextMenu> getHandle() { return getDerivedHandle<LLContextMenu>(); }
 
 protected:
 	BOOL						mHoveredAnyItem;
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 8f7025a9a66b72a1a26e2ba6b7e7475725140fdd..8aa548b9749f4446e7c68f072f93583346fef815 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -1412,6 +1412,7 @@ void addPathIfExists(const std::string& new_path, std::vector<std::string>& path
 
 bool LLNotifications::loadTemplates()
 {
+	llinfos << "Reading notifications template" << llendl;
 	std::vector<std::string> search_paths;
 	
 	std::string skin_relative_path = gDirUtilp->getDirDelimiter() + LLUI::getSkinPath() + gDirUtilp->getDirDelimiter() + "notifications.xml";
@@ -1484,6 +1485,8 @@ bool LLNotifications::loadTemplates()
 		mTemplates[notification.name] = LLNotificationTemplatePtr(new LLNotificationTemplate(notification));
 	}
 
+	llinfos << "...done" << llendl;
+
 	return true;
 }
 
@@ -1624,7 +1627,7 @@ LLNotificationPtr LLNotifications::find(LLUUID uuid)
 	LLNotificationSet::iterator it=mItems.find(target);
 	if (it == mItems.end())
 	{
-		llwarns << "Tried to dereference uuid '" << uuid << "' as a notification key but didn't find it." << llendl;
+		LL_DEBUGS("Notifications") << "Tried to dereference uuid '" << uuid << "' as a notification key but didn't find it." << llendl;
 		return LLNotificationPtr((LLNotification*)NULL);
 	}
 	else
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h
index 462d69be2e1b3bea6eb5339d0eca4d6371682e56..3df2efcac3a66b63d7dbb092091f84c377bccdf1 100644
--- a/indra/llui/llnotifications.h
+++ b/indra/llui/llnotifications.h
@@ -690,7 +690,7 @@ typedef std::multimap<std::string, LLNotificationPtr> LLNotificationMap;
 // Abstract base class (interface) for a channel; also used for the master container.
 // This lets us arrange channels into a call hierarchy.
 
-// We maintain a heirarchy of notification channels; events are always started at the top
+// We maintain a hierarchy of notification channels; events are always started at the top
 // and propagated through the hierarchy only if they pass a filter.
 // Any channel can be created with a parent. A null parent (empty string) means it's
 // tied to the root of the tree (the LLNotifications class itself).
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index a45b617c2ecb8f5d2af50c13c203c653b391fdaa..00318cec6b0b3043863eae2754ad9565b0ae1c38 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -122,8 +122,6 @@ LLPanel::LLPanel(const LLPanel::Params& p)
 	{
 		addBorder(p.border);
 	}
-	
-	mPanelHandle.bind(this);
 }
 
 LLPanel::~LLPanel()
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index ab1c87caffeb571417a5c003d1045a3ab26ff841..f62020102022ce71c9e729012bfa1180be8a0f2c 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -135,6 +135,8 @@ class LLPanel : public LLUICtrl, public LLBadgeHolder
 	const LLColor4&	getBackgroundColor() const { return mBgOpaqueColor; }
 	void			setTransparentColor(const LLColor4& color) { mBgAlphaColor = color; }
 	const LLColor4& getTransparentColor() const { return mBgAlphaColor; }
+	void			setBackgroundImage(LLUIImage* image) { mBgOpaqueImage = image; }
+	void			setTransparentImage(LLUIImage* image) { mBgAlphaImage = image; }
 	LLPointer<LLUIImage> getBackgroundImage() const { return mBgOpaqueImage; }
 	LLPointer<LLUIImage> getTransparentImage() const { return mBgAlphaImage; }
 	LLColor4		getBackgroundImageOverlay() { return mBgOpaqueImageOverlay; }
@@ -153,7 +155,7 @@ class LLPanel : public LLUICtrl, public LLBadgeHolder
 	
 	void			setCtrlsEnabled(BOOL b);
 
-	LLHandle<LLPanel>	getHandle() const { return mPanelHandle; }
+	LLHandle<LLPanel>	getHandle() const { return getDerivedHandle<LLPanel>(); }
 
 	const LLCallbackMap::map_t& getFactoryMap() const { return mFactoryMap; }
 	
@@ -278,7 +280,6 @@ class LLPanel : public LLUICtrl, public LLBadgeHolder
 	LLViewBorder*	mBorder;
 	LLButton*		mDefaultBtn;
 	LLUIString		mLabel;
-	LLRootHandle<LLPanel> mPanelHandle;
 
 	typedef std::map<std::string, std::string> ui_string_map_t;
 	ui_string_map_t	mUIStrings;
diff --git a/indra/llui/llresizebar.cpp b/indra/llui/llresizebar.cpp
index 02f60c76fafb36a17c869aabd6eac2684fef606f..87aeb4d7a74b6755b58263c84ccaff2ac92b05d7 100644
--- a/indra/llui/llresizebar.cpp
+++ b/indra/llui/llresizebar.cpp
@@ -79,6 +79,8 @@ LLResizeBar::LLResizeBar(const LLResizeBar::Params& p)
 
 BOOL LLResizeBar::handleMouseDown(S32 x, S32 y, MASK mask)
 {
+	if (!canResize()) return FALSE;
+
 	// Route future Mouse messages here preemptively.  (Release on mouse up.)
 	// No handler needed for focus lost since this clas has no state that depends on it.
 	gFocusMgr.setMouseCapture( this );
@@ -243,7 +245,7 @@ BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask)
 		handled = TRUE;
 	}
 
-	if( handled )
+	if( handled && canResize() )
 	{
 		switch( mSide )
 		{
diff --git a/indra/llui/llresizebar.h b/indra/llui/llresizebar.h
index 0725fbd846ac64313b304636b46f31ba296862a0..6daf191918558f1076a3dea4fb43ef23094db756 100644
--- a/indra/llui/llresizebar.h
+++ b/indra/llui/llresizebar.h
@@ -70,6 +70,7 @@ class LLResizeBar : public LLView
 	void			setResizeLimits( S32 min_size, S32 max_size ) { mMinSize = min_size; mMaxSize = max_size; }
 	void			setEnableSnapping(BOOL enable) { mSnappingEnabled = enable; }
 	void			setAllowDoubleClickSnapping(BOOL allow) { mAllowDoubleClickSnapping = allow; }
+	bool			canResize() { return getEnabled() && mMaxSize > mMinSize; }
 
 private:
 	S32				mDragLastScreenX;
diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp
index fe3f688fc50851cf9dcab9d5d9d06c5fa67b24d7..9b7e30bb048733ce8e8b193dc40918a1571f1c36 100644
--- a/indra/llui/llscrollcontainer.cpp
+++ b/indra/llui/llscrollcontainer.cpp
@@ -378,19 +378,24 @@ void LLScrollContainer::calcVisibleSize( S32 *visible_width, S32 *visible_height
 
 	if (!mHideScrollbar)
 	{
-		if( *visible_height < doc_height )
+		// Note: 1 pixel change can happen on final animation and should not trigger 
+		// the display of sliders.
+		if ((doc_height - *visible_height) > 1)
 		{
 			*show_v_scrollbar = TRUE;
 			*visible_width -= scrollbar_size;
 		}
-
-		if( *visible_width < doc_width )
+		if ((doc_width - *visible_width) > 1)
 		{
 			*show_h_scrollbar = TRUE;
 			*visible_height -= scrollbar_size;
 
+			// The view inside the scroll container should not be extended
+			// to container's full height to ensure the correct computation
+			// of *show_v_scrollbar after subtracting horizontal scrollbar_size.
+
 			// Must retest now that visible_height has changed
-			if( !*show_v_scrollbar && (*visible_height < doc_height) )
+			if( !*show_v_scrollbar && ((doc_height - *visible_height) > 1) )
 			{
 				*show_v_scrollbar = TRUE;
 				*visible_width -= scrollbar_size;
@@ -424,63 +429,66 @@ void LLScrollContainer::draw()
 		focusFirstItem();
 	}
 
-	// Draw background
-	if( mIsOpaque )
+	if (getRect().isValid()) 
 	{
-		F32 alpha = getCurrentTransparency();
+		// Draw background
+		if( mIsOpaque )
+		{
+			F32 alpha = getCurrentTransparency();
 
-		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-		gl_rect_2d(mInnerRect, mBackgroundColor.get() % alpha);
-	}
+			gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+			gl_rect_2d(mInnerRect, mBackgroundColor.get() % alpha);
+		}
 	
-	// Draw mScrolledViews and update scroll bars.
-	// get a scissor region ready, and draw the scrolling view. The
-	// scissor region ensures that we don't draw outside of the bounds
-	// of the rectangle.
-	if( mScrolledView )
-	{
-		updateScroll();
-
-		// Draw the scrolled area.
+		// Draw mScrolledViews and update scroll bars.
+		// get a scissor region ready, and draw the scrolling view. The
+		// scissor region ensures that we don't draw outside of the bounds
+		// of the rectangle.
+		if( mScrolledView )
 		{
-			S32 visible_width = 0;
-			S32 visible_height = 0;
-			BOOL show_v_scrollbar = FALSE;
-			BOOL show_h_scrollbar = FALSE;
-			calcVisibleSize( &visible_width, &visible_height, &show_h_scrollbar, &show_v_scrollbar );
-
-			LLLocalClipRect clip(LLRect(mInnerRect.mLeft, 
-					mInnerRect.mBottom + (show_h_scrollbar ? scrollbar_size : 0) + visible_height,
-					mInnerRect.mRight - (show_v_scrollbar ? scrollbar_size: 0),
-					mInnerRect.mBottom + (show_h_scrollbar ? scrollbar_size : 0)
-					));
-			drawChild(mScrolledView);
-		}
-	}
-
-	// Highlight border if a child of this container has keyboard focus
-	if( mBorder->getVisible() )
-	{
-		mBorder->setKeyboardFocusHighlight( gFocusMgr.childHasKeyboardFocus(this) );
-	}
+			updateScroll();
 
-	// Draw all children except mScrolledView
-	// Note: scrollbars have been adjusted by above drawing code
-	for (child_list_const_reverse_iter_t child_iter = getChildList()->rbegin();
-		 child_iter != getChildList()->rend(); ++child_iter)
-	{
-		LLView *viewp = *child_iter;
-		if( sDebugRects )
-		{
-			sDepth++;
+			// Draw the scrolled area.
+			{
+				S32 visible_width = 0;
+				S32 visible_height = 0;
+				BOOL show_v_scrollbar = FALSE;
+				BOOL show_h_scrollbar = FALSE;
+				calcVisibleSize( &visible_width, &visible_height, &show_h_scrollbar, &show_v_scrollbar );
+
+				LLLocalClipRect clip(LLRect(mInnerRect.mLeft, 
+						mInnerRect.mBottom + (show_h_scrollbar ? scrollbar_size : 0) + visible_height,
+						mInnerRect.mRight - (show_v_scrollbar ? scrollbar_size: 0),
+						mInnerRect.mBottom + (show_h_scrollbar ? scrollbar_size : 0)
+						));
+				drawChild(mScrolledView);
+			}
 		}
-		if( (viewp != mScrolledView) && viewp->getVisible() )
+
+		// Highlight border if a child of this container has keyboard focus
+		if( mBorder->getVisible() )
 		{
-			drawChild(viewp);
+			mBorder->setKeyboardFocusHighlight( gFocusMgr.childHasKeyboardFocus(this) );
 		}
-		if( sDebugRects )
+
+		// Draw all children except mScrolledView
+		// Note: scrollbars have been adjusted by above drawing code
+		for (child_list_const_reverse_iter_t child_iter = getChildList()->rbegin();
+			 child_iter != getChildList()->rend(); ++child_iter)
 		{
-			sDepth--;
+			LLView *viewp = *child_iter;
+			if( sDebugRects )
+			{
+				sDepth++;
+			}
+			if( (viewp != mScrolledView) && viewp->getVisible() )
+			{
+				drawChild(viewp);
+			}
+			if( sDebugRects )
+			{
+				sDepth--;
+			}
 		}
 	}
 } // end draw
diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h
index 3aa79cc255b47d5bd4d7c158fca21f92fe6d1d65..d87c95b3d759f2348b6657c833c13c398f9cbbb4 100644
--- a/indra/llui/llscrollcontainer.h
+++ b/indra/llui/llscrollcontainer.h
@@ -91,7 +91,7 @@ class LLScrollContainer : public LLUICtrl
 	void			setReserveScrollCorner( BOOL b ) { mReserveScrollCorner = b; }
 	LLRect			getVisibleContentRect();
 	LLRect			getContentWindowRect();
-	const LLRect&	getScrolledViewRect() const { return mScrolledView ? mScrolledView->getRect() : LLRect::null; }
+	virtual const LLRect	getScrolledViewRect() const { return mScrolledView ? mScrolledView->getRect() : LLRect::null; }
 	void			pageUp(S32 overlap = 0);
 	void			pageDown(S32 overlap = 0);
 	void			goToTop();
@@ -116,6 +116,9 @@ class LLScrollContainer : public LLUICtrl
 	
 	bool autoScroll(S32 x, S32 y);
 
+protected:
+	LLView*		mScrolledView;
+
 private:
 	// internal scrollbar handlers
 	virtual void scrollHorizontal( S32 new_pos );
@@ -124,7 +127,6 @@ class LLScrollContainer : public LLUICtrl
 	void calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const;
 
 	LLScrollbar* mScrollbar[SCROLLBAR_COUNT];
-	LLView*		mScrolledView;
 	S32			mSize;
 	BOOL		mIsOpaque;
 	LLUIColor	mBackgroundColor;
diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp
index 9d25c7180dd4db401d5089b39fc9ddd6847f5eb3..8000efad0e2c31927092168f7c90e283707b66bf 100644
--- a/indra/llui/llscrolllistcell.cpp
+++ b/indra/llui/llscrolllistcell.cpp
@@ -232,7 +232,7 @@ BOOL LLScrollListText::getVisible() const
 //virtual 
 S32 LLScrollListText::getHeight() const
 {
-	return llround(mFont->getLineHeight());
+	return mFont->getLineHeight();
 }
 
 
@@ -306,7 +306,7 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col
 			break;
 		}
 		LLRect highlight_rect(left - 2, 
-				llround(mFont->getLineHeight()) + 1, 
+				mFont->getLineHeight() + 1, 
 				left + mFont->getWidth(mText.getString(), mHighlightOffset, mHighlightCount) + 1, 
 				1);
 		mRoundedRectImage->draw(highlight_rect, highlight_color);
@@ -329,7 +329,7 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col
 		break;
 	}
 	mFont->render(mText.getWString(), 0, 
-					start_x, 2.f,
+					start_x, 0.f,
 					display_color,
 					mFontAlignment,
 					LLFontGL::BOTTOM, 
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 622f3e215c923f62d6deea4e7e2f19cbb4333c92..b3e1b63db58a4d788001458509c34c8aacc87b2e 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -175,6 +175,7 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p)
 	mBorder(NULL),
 	mSortCallback(NULL),
 	mPopupMenu(NULL),
+	mCommentTextView(NULL),
 	mNumDynamicWidthColumns(0),
 	mTotalStaticColumnWidth(0),
 	mTotalColumnPadding(0),
@@ -476,7 +477,12 @@ void LLScrollListCtrl::updateLayout()
 		getRect().getWidth() - 2 * mBorderThickness,
 		getRect().getHeight() - (2 * mBorderThickness ) - heading_size );
 
-	getChildView("comment_text")->setShape(mItemListRect);
+	if (mCommentTextView == NULL)
+	{
+		mCommentTextView = getChildView("comment_text");
+	}
+
+	mCommentTextView->setShape(mItemListRect);
 
 	// how many lines of content in a single "page"
 	S32 page_lines =  getLinesPerPage();
@@ -2498,7 +2504,7 @@ void	LLScrollListCtrl::copy()
 	{
 		buffer += (*itor)->getContentsCSV() + "\n";
 	}
-	gClipboard.copyFromSubstring(utf8str_to_wstring(buffer), 0, buffer.length());
+	LLClipboard::instance().copyToClipboard(utf8str_to_wstring(buffer), 0, buffer.length());
 }
 
 // virtual
diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h
index 09ab89960da1814d99d5ae91da24b8f873a08fa0..ae8aea92457bb98fb8c531b3bf911f9937a2bab5 100644
--- a/indra/llui/llscrolllistctrl.h
+++ b/indra/llui/llscrolllistctrl.h
@@ -480,6 +480,8 @@ class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler,
 	S32				mHighlightedItem;
 	class LLViewBorder*	mBorder;
 	LLContextMenu	*mPopupMenu;
+	
+	LLView			*mCommentTextView;
 
 	LLWString		mSearchString;
 	LLFrameTimer	mSearchTimer;
diff --git a/indra/llui/llscrolllistitem.cpp b/indra/llui/llscrolllistitem.cpp
index d95752e31cb982cc5d132e00c1cbfd53cdac7477..5a1e96ab034cc74fd1be5aa766c45b7c0b20f8c1 100644
--- a/indra/llui/llscrolllistitem.cpp
+++ b/indra/llui/llscrolllistitem.cpp
@@ -138,7 +138,7 @@ void LLScrollListItem::draw(const LLRect& rect, const LLColor4& fg_color, const
 
 		LLUI::pushMatrix();
 		{
-			LLUI::translate((F32) cur_x, (F32) rect.mBottom, 0.0f);
+			LLUI::translate((F32) cur_x, (F32) rect.mBottom);
 
 			cell->draw( fg_color, highlight_color );
 		}
diff --git a/indra/llui/llscrolllistitem.h b/indra/llui/llscrolllistitem.h
index 611df729b41fb17d3a7ce239cd70bf671d6472ff..13655b5873b9f5cf8e35938e6e0ea92442632f9b 100644
--- a/indra/llui/llscrolllistitem.h
+++ b/indra/llui/llscrolllistitem.h
@@ -33,10 +33,10 @@
 #include "v4color.h"
 #include "llinitparam.h"
 #include "llscrolllistcell.h"
+#include "llcoord.h"
 
 #include <vector>
 
-class LLCoordGL;
 class LLCheckBoxCtrl;
 class LLResizeBar;
 class LLScrollListCtrl;
diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h
index d197084e38fac9c3c572a012d8577daf6e64e333..87814f838e8d2c47a814b0036dd1fb23520a988e 100644
--- a/indra/llui/llspinctrl.h
+++ b/indra/llui/llspinctrl.h
@@ -96,6 +96,9 @@ class LLSpinCtrl
 
 	void			onUpBtn(const LLSD& data);
 	void			onDownBtn(const LLSD& data);
+	
+	const LLColor4&	getEnabledTextColor() const	{ return mTextEnabledColor.get(); }
+	const LLColor4&	getDisabledTextColor() const { return mTextDisabledColor.get(); }
 
 private:
 	void			updateLabelColor();
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index ad1f3c504da89f8271c89c215ff9b3d8f415606f..5fc2cc350dc7b347bda5a7325c76182e40f86d68 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -98,24 +98,25 @@ class LLCustomButtonIconCtrl : public LLButton
 {
 public:
 	struct Params
-	: public LLInitParam::Block<Params, LLButton::Params>
+	:	public LLInitParam::Block<Params, LLButton::Params>
 	{
 		// LEFT, RIGHT, TOP, BOTTOM paddings of LLIconCtrl in this class has same value
 		Optional<S32>					icon_ctrl_pad;
 
-		Params():
-		icon_ctrl_pad("icon_ctrl_pad", 1)
+		Params()
+		:	icon_ctrl_pad("icon_ctrl_pad", 1)
 		{}
 	};
 
 protected:
 	friend class LLUICtrlFactory;
-	LLCustomButtonIconCtrl(const Params& p):
-		LLButton(p),
+
+	LLCustomButtonIconCtrl(const Params& p)
+	:	LLButton(p),
 		mIcon(NULL),
 		mIconAlignment(LLFontGL::HCENTER),
 		mIconCtrlPad(p.icon_ctrl_pad)
-		{}
+	{}
 
 public:
 
@@ -214,6 +215,7 @@ LLTabContainer::Params::Params()
 	middle_tab("middle_tab"),
 	last_tab("last_tab"),
 	use_custom_icon_ctrl("use_custom_icon_ctrl", false),
+	open_tabs_on_drag_and_drop("open_tabs_on_drag_and_drop", false),
 	tab_icon_ctrl_pad("tab_icon_ctrl_pad", 0),
 	use_ellipses("use_ellipses"),
 	font_halign("halign")
@@ -250,6 +252,7 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p)
 	mMiddleTabParams(p.middle_tab),
 	mLastTabParams(p.last_tab),
 	mCustomIconCtrlUsed(p.use_custom_icon_ctrl),
+	mOpenTabsOnDragAndDrop(p.open_tabs_on_drag_and_drop),
 	mTabIconCtrlPad(p.tab_icon_ctrl_pad),
 	mUseTabEllipses(p.use_ellipses)
 {
@@ -812,50 +815,62 @@ BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask,	BOOL drop,	EDrag
 {
 	BOOL has_scroll_arrows = (getMaxScrollPos() > 0);
 
-	if( !getTabsHidden()
-		&& mDragAndDropDelayTimer.getStarted() 
-		&& mDragAndDropDelayTimer.getElapsedTimeF32() > SCROLL_DELAY_TIME )
+	if(mOpenTabsOnDragAndDrop && !getTabsHidden())
 	{
-		if (has_scroll_arrows)
+		// In that case, we'll open the hovered tab while dragging and dropping items.
+		// This allows for drilling through tabs.
+		if (mDragAndDropDelayTimer.getStarted())
 		{
-			if (mJumpPrevArrowBtn && mJumpPrevArrowBtn->getRect().pointInRect(x, y))
-			{
-				S32	local_x	= x	- mJumpPrevArrowBtn->getRect().mLeft;
-				S32	local_y	= y	- mJumpPrevArrowBtn->getRect().mBottom;
-				mJumpPrevArrowBtn->handleHover(local_x,	local_y, mask);
-			}
-			if (mJumpNextArrowBtn && mJumpNextArrowBtn->getRect().pointInRect(x, y))
-			{
-				S32	local_x	= x	- mJumpNextArrowBtn->getRect().mLeft;
-				S32	local_y	= y	- mJumpNextArrowBtn->getRect().mBottom;
-				mJumpNextArrowBtn->handleHover(local_x,	local_y, mask);
-			}
-			if (mPrevArrowBtn->getRect().pointInRect(x,	y))
-			{
-				S32	local_x	= x	- mPrevArrowBtn->getRect().mLeft;
-				S32	local_y	= y	- mPrevArrowBtn->getRect().mBottom;
-				mPrevArrowBtn->handleHover(local_x,	local_y, mask);
-			}
-			else if	(mNextArrowBtn->getRect().pointInRect(x, y))
+			if (mDragAndDropDelayTimer.getElapsedTimeF32() > SCROLL_DELAY_TIME)
 			{
-				S32	local_x	= x	- mNextArrowBtn->getRect().mLeft;
-				S32	local_y	= y	- mNextArrowBtn->getRect().mBottom;
-				mNextArrowBtn->handleHover(local_x, local_y, mask);
-			}
-		}
+				if (has_scroll_arrows)
+				{
+					if (mJumpPrevArrowBtn && mJumpPrevArrowBtn->getRect().pointInRect(x, y))
+					{
+						S32	local_x	= x	- mJumpPrevArrowBtn->getRect().mLeft;
+						S32	local_y	= y	- mJumpPrevArrowBtn->getRect().mBottom;
+						mJumpPrevArrowBtn->handleHover(local_x,	local_y, mask);
+					}
+					if (mJumpNextArrowBtn && mJumpNextArrowBtn->getRect().pointInRect(x, y))
+					{
+						S32	local_x	= x	- mJumpNextArrowBtn->getRect().mLeft;
+						S32	local_y	= y	- mJumpNextArrowBtn->getRect().mBottom;
+						mJumpNextArrowBtn->handleHover(local_x,	local_y, mask);
+					}
+					if (mPrevArrowBtn->getRect().pointInRect(x,	y))
+					{
+						S32	local_x	= x	- mPrevArrowBtn->getRect().mLeft;
+						S32	local_y	= y	- mPrevArrowBtn->getRect().mBottom;
+						mPrevArrowBtn->handleHover(local_x,	local_y, mask);
+					}
+					else if	(mNextArrowBtn->getRect().pointInRect(x, y))
+					{
+						S32	local_x	= x	- mNextArrowBtn->getRect().mLeft;
+						S32	local_y	= y	- mNextArrowBtn->getRect().mBottom;
+						mNextArrowBtn->handleHover(local_x, local_y, mask);
+					}
+				}
 
-		for(tuple_list_t::iterator iter	= mTabList.begin();	iter !=	 mTabList.end(); ++iter)
-		{
-			LLTabTuple*	tuple =	*iter;
-			tuple->mButton->setVisible(	TRUE );
-			S32	local_x	= x	- tuple->mButton->getRect().mLeft;
-			S32	local_y	= y	- tuple->mButton->getRect().mBottom;
-			if (tuple->mButton->pointInView(local_x, local_y) &&  tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible())
-			{
-				tuple->mButton->onCommit();
+				for(tuple_list_t::iterator iter	= mTabList.begin();	iter !=	 mTabList.end(); ++iter)
+				{
+					LLTabTuple*	tuple =	*iter;
+					tuple->mButton->setVisible(	TRUE );
+					S32	local_x	= x	- tuple->mButton->getRect().mLeft;
+					S32	local_y	= y	- tuple->mButton->getRect().mBottom;
+					if (tuple->mButton->pointInView(local_x, local_y) &&  tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible())
+					{
+						tuple->mButton->onCommit();
+					}
+				}
+				// Stop the timer whether successful or not. Don't let it run forever.
 				mDragAndDropDelayTimer.stop();
 			}
 		}
+		else 
+		{
+			// Start a timer so we don't open tabs as soon as we hover on them
+			mDragAndDropDelayTimer.start();
+		}
 	}
 
 	return LLView::handleDragAndDrop(x,	y, mask, drop, type, cargo_data,  accept, tooltip);
@@ -1025,85 +1040,50 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel)
 	}
 	else
 	{
+		LLButton::Params& p = (mCustomIconCtrlUsed ? custom_btn_params : normal_btn_params);
+		
+		p.rect(btn_rect);
+		p.font(mFont);
+		p.font_halign = mFontHalign;
+		p.label(trimmed_label);
+		p.click_callback.function(boost::bind(&LLTabContainer::onTabBtn, this, _2, child));
+		if (indent)
+		{
+			p.pad_left(indent);
+		}
+		p.pad_bottom( mLabelPadBottom );
+		p.scale_image(true);
+		p.tab_stop(false);
+		p.label_shadow(false);
+		p.follows.flags = FOLLOWS_LEFT;
+		
 		if (mIsVertical)
 		{
-			LLButton::Params& p = (mCustomIconCtrlUsed)?
-					custom_btn_params:normal_btn_params;
-
 			p.name(std::string("vert tab button"));
-			p.rect(btn_rect);
-			p.follows.flags(FOLLOWS_TOP | FOLLOWS_LEFT);
-			p.click_callback.function(boost::bind(&LLTabContainer::onTabBtn, this, _2, child));
-			p.font(mFont);
-			p.label(trimmed_label);
 			p.image_unselected(mMiddleTabParams.tab_left_image_unselected);
 			p.image_selected(mMiddleTabParams.tab_left_image_selected);
-			p.scale_image(true);
-			p.font_halign = mFontHalign;
-			p.pad_bottom( mLabelPadBottom );
-			p.tab_stop(false);
-			p.label_shadow(false);
-			if (indent)
-			{
-				p.pad_left(indent);
-			}
-			
-			
-			if(mCustomIconCtrlUsed)
-			{
-				btn = LLUICtrlFactory::create<LLCustomButtonIconCtrl>(custom_btn_params);
-				
-			}
-			else
-			{
-				btn = LLUICtrlFactory::create<LLButton>(p);
-			}
+			p.follows.flags = p.follows.flags() | FOLLOWS_TOP;
 		}
 		else
 		{
-			LLButton::Params& p = (mCustomIconCtrlUsed)?
-					custom_btn_params:normal_btn_params;
 			p.name(std::string(child->getName()) + " tab");
-			p.rect(btn_rect);
-			p.click_callback.function(boost::bind(&LLTabContainer::onTabBtn, this, _2, child));
-			p.font(mFont);
-			p.label(trimmed_label);
 			p.visible(false);
-			p.scale_image(true);
 			p.image_unselected(tab_img);
 			p.image_selected(tab_selected_img);
-			p.tab_stop(false);
-			p.label_shadow(false);
+			p.follows.flags = p.follows.flags() | (getTabPosition() == TOP ? FOLLOWS_TOP : FOLLOWS_BOTTOM);
 			// Try to squeeze in a bit more text
 			p.pad_left( mLabelPadLeft );
 			p.pad_right(2);
-			p.pad_bottom( mLabelPadBottom );
-			p.font_halign = mFontHalign;
-			p.follows.flags = FOLLOWS_LEFT;
-			p.follows.flags = FOLLOWS_LEFT;
-	
-			if (indent)
-			{
-				p.pad_left(indent);
-			}
-
-			if( getTabPosition() == TOP )
-			{
-				p.follows.flags = p.follows.flags() | FOLLOWS_TOP;
-			}
-			else
-			{
-				p.follows.flags = p.follows.flags() | FOLLOWS_BOTTOM;
-			}
-
-			if(mCustomIconCtrlUsed)
-			{
-				btn = LLUICtrlFactory::create<LLCustomButtonIconCtrl>(custom_btn_params);
-			}
-			else
-			{
-				btn = LLUICtrlFactory::create<LLButton>(p);
-			}
+		}
+		
+		// *TODO : It seems wrong not to use p in both cases considering the way p is initialized
+		if (mCustomIconCtrlUsed)
+		{
+			btn = LLUICtrlFactory::create<LLCustomButtonIconCtrl>(custom_btn_params);
+		}
+		else
+		{
+			btn = LLUICtrlFactory::create<LLButton>(p);
 		}
 	}
 	
@@ -1280,6 +1260,10 @@ void LLTabContainer::enableTabButton(S32 which, BOOL enable)
 	{
 		mTabList[which]->mButton->setEnabled(enable);
 	}
+	// Stop the DaD timer as it might run forever
+	// enableTabButton() is typically called on refresh and draw when anything changed
+	// in the tab container so it's a good time to reset that.
+	mDragAndDropDelayTimer.stop();
 }
 
 void LLTabContainer::deleteAllTabs()
diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h
index eaa2fd54e06d7eabb8e62126d453255d25a8792b..cebace2ceba344847fb59859adfe0e69761d20d4 100644
--- a/indra/llui/lltabcontainer.h
+++ b/indra/llui/lltabcontainer.h
@@ -104,6 +104,11 @@ class LLTabContainer : public LLPanel
 		 */
 		Optional<bool>						use_custom_icon_ctrl;
 
+		/**
+		 * Open tabs on hover in drag and drop situations
+		 */
+		Optional<bool>						open_tabs_on_drag_and_drop;
+		
 		/**
 		 *  Paddings for LLIconCtrl in case of LLCustomButtonIconCtrl usage(use_custom_icon_ctrl = true)
 		 */
@@ -300,6 +305,7 @@ class LLTabContainer : public LLPanel
 	TabParams						mLastTabParams;
 
 	bool							mCustomIconCtrlUsed;
+	bool							mOpenTabsOnDragAndDrop;
 	S32								mTabIconCtrlPad;
 	bool							mUseTabEllipses;
 };
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 919364be632a6dce3b38ae2f7885770366fe97e5..7aeeae298f754407abcf026372b21c6d6935ba8b 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -598,7 +598,7 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s
 
 	pos = getEditableIndex(pos, true);
 
-	segment_set_t::iterator seg_iter = getSegIterContaining(pos);
+	segment_set_t::iterator seg_iter = getEditableSegIterContaining(pos);
 
 	LLTextSegmentPtr default_segment;
 
@@ -1192,7 +1192,10 @@ void LLTextBase::reflow()
 
 		// shrink document to minimum size (visible portion of text widget)
 		// to force inlined widgets with follows set to shrink
-		mDocumentView->reshape(mVisibleTextRect.getWidth(), mDocumentView->getRect().getHeight());
+		if (mWordWrap)
+		{
+			mDocumentView->reshape(mVisibleTextRect.getWidth(), mDocumentView->getRect().getHeight());
+		}
 
 		S32 cur_top = 0;
 
@@ -1510,8 +1513,48 @@ void LLTextBase::getSegmentAndOffset( S32 startpos, segment_set_t::iterator* seg
 	}
 }
 
+LLTextBase::segment_set_t::iterator LLTextBase::getEditableSegIterContaining(S32 index)
+{
+	segment_set_t::iterator it = getSegIterContaining(index);
+	segment_set_t::iterator orig_it = it;
+
+	if (it == mSegments.end()) return it;
+
+	if (!(*it)->canEdit() 
+		&& index == (*it)->getStart() 
+		&& it != mSegments.begin())
+	{
+		it--;
+		if ((*it)->canEdit())
+		{
+			return it;
+		}
+	}
+	return orig_it;
+}
+
+LLTextBase::segment_set_t::const_iterator LLTextBase::getEditableSegIterContaining(S32 index) const
+{
+	segment_set_t::const_iterator it = getSegIterContaining(index);
+	segment_set_t::const_iterator orig_it = it;
+	if (it == mSegments.end()) return it;
+
+	if (!(*it)->canEdit() 
+		&& index == (*it)->getStart() 
+		&& it != mSegments.begin())
+	{
+		it--;
+		if ((*it)->canEdit())
+		{
+			return it;
+		}
+	}
+	return orig_it;
+}
+
 LLTextBase::segment_set_t::iterator LLTextBase::getSegIterContaining(S32 index)
 {
+
 	static LLPointer<LLIndexSegment> index_segment = new LLIndexSegment();
 
 	if (index > getLength()) { return mSegments.end(); }
@@ -2117,7 +2160,7 @@ LLRect LLTextBase::getLocalRectFromDocIndex(S32 pos) const
 	{ 
 		// return default height rect in upper left
 		local_rect = content_window_rect;
-		local_rect.mBottom = local_rect.mTop - (S32)(mDefaultFont->getLineHeight());
+		local_rect.mBottom = local_rect.mTop - mDefaultFont->getLineHeight();
 		return local_rect;
 	}
 
@@ -2340,6 +2383,9 @@ S32 LLTextBase::getEditableIndex(S32 index, bool increasing_direction)
 
 void LLTextBase::updateRects()
 {
+	LLRect old_text_rect = mVisibleTextRect;
+	mVisibleTextRect = mScroller ? mScroller->getContentWindowRect() : getLocalRect();
+
 	if (mLineInfoList.empty()) 
 	{
 		mTextBoundingRect = LLRect(0, mVPad, mHPad, 0);
@@ -2355,10 +2401,24 @@ void LLTextBase::updateRects()
 		}
 
 		mTextBoundingRect.mTop += mVPad;
-		// subtract a pixel off the bottom to deal with rounding errors in measuring font height
-		mTextBoundingRect.mBottom -= 1;
 
-		S32 delta_pos = -mTextBoundingRect.mBottom;
+		S32 delta_pos = 0;
+		
+		switch(mVAlign)
+		{
+		case LLFontGL::TOP:
+			delta_pos = llmax(mVisibleTextRect.getHeight() - mTextBoundingRect.mTop, -mTextBoundingRect.mBottom);
+			break;
+		case LLFontGL::VCENTER:
+			delta_pos = (llmax(mVisibleTextRect.getHeight() - mTextBoundingRect.mTop, -mTextBoundingRect.mBottom) + (mVisibleTextRect.mBottom - mTextBoundingRect.mBottom)) / 2;
+			break;
+		case LLFontGL::BOTTOM:
+			delta_pos = mVisibleTextRect.mBottom - mTextBoundingRect.mBottom;
+			break;
+		case LLFontGL::BASELINE:
+			// do nothing
+			break;
+		}
 		// move line segments to fit new document rect
 		for (line_list_t::iterator it = mLineInfoList.begin(); it != mLineInfoList.end(); ++it)
 		{
@@ -2368,8 +2428,9 @@ void LLTextBase::updateRects()
 	}
 
 	// update document container dimensions according to text contents
-	LLRect doc_rect = mTextBoundingRect;
+	LLRect doc_rect;
 	// use old mVisibleTextRect constraint document to width of viewable region
+	doc_rect.mBottom = llmin(mVisibleTextRect.mBottom,  mTextBoundingRect.mBottom);
 	doc_rect.mLeft = 0;
 
 	// allow horizontal scrolling?
@@ -2379,11 +2440,22 @@ void LLTextBase::updateRects()
 	doc_rect.mRight = mScroller 
 		? llmax(mVisibleTextRect.getWidth(), mTextBoundingRect.mRight)
 		: mVisibleTextRect.getWidth();
+	doc_rect.mTop = llmax(mVisibleTextRect.mTop, mTextBoundingRect.mTop);
 
 	if (!mScroller)
 	{
 		// push doc rect to top of text widget
-		doc_rect.translate(0, mVisibleTextRect.getHeight() - doc_rect.mTop);
+		switch(mVAlign)
+		{
+		case LLFontGL::TOP:
+			doc_rect.translate(0, mVisibleTextRect.getHeight() - doc_rect.mTop);
+			break;
+		case LLFontGL::VCENTER:
+			doc_rect.translate(0, (mVisibleTextRect.getHeight() - doc_rect.mTop) / 2);
+		case LLFontGL::BOTTOM:
+		default:
+			break;
+		}
 	}
 
 	mDocumentView->setShape(doc_rect);
@@ -2391,7 +2463,6 @@ void LLTextBase::updateRects()
 	//update mVisibleTextRect *after* mDocumentView has been resized
 	// so that scrollbars are added if document needs to scroll
 	// since mVisibleTextRect does not include scrollbars
-	LLRect old_text_rect = mVisibleTextRect;
 	mVisibleTextRect = mScroller ? mScroller->getContentWindowRect() : getLocalRect();
 	//FIXME: replace border with image?
 	if (mBorderVisible)
@@ -2404,9 +2475,27 @@ void LLTextBase::updateRects()
 	}
 
 	// update document container again, using new mVisibleTextRect (that has scrollbars enabled as needed)
+	doc_rect.mBottom = llmin(mVisibleTextRect.mBottom,  mTextBoundingRect.mBottom);
+	doc_rect.mLeft = 0;
 	doc_rect.mRight = mScroller 
 		? llmax(mVisibleTextRect.getWidth(), mTextBoundingRect.mRight)
 		: mVisibleTextRect.getWidth();
+	doc_rect.mTop = llmax(mVisibleTextRect.mTop, mTextBoundingRect.mTop);
+	if (!mScroller)
+	{
+		// push doc rect to top of text widget
+		switch(mVAlign)
+		{
+		case LLFontGL::TOP:
+			doc_rect.translate(0, mVisibleTextRect.getHeight() - doc_rect.mTop);
+			break;
+		case LLFontGL::VCENTER:
+			doc_rect.translate(0, (mVisibleTextRect.getHeight() - doc_rect.mTop) / 2);
+		case LLFontGL::BOTTOM:
+		default:
+			break;
+		}
+	}
 	mDocumentView->setShape(doc_rect);
 }
 
@@ -2518,7 +2607,10 @@ BOOL LLTextSegment::handleDoubleClick(S32 x, S32 y, MASK mask) { return FALSE; }
 BOOL LLTextSegment::handleHover(S32 x, S32 y, MASK mask) { return FALSE; }
 BOOL LLTextSegment::handleScrollWheel(S32 x, S32 y, S32 clicks) { return FALSE; }
 BOOL LLTextSegment::handleToolTip(S32 x, S32 y, MASK mask) { return FALSE; }
-std::string	LLTextSegment::getName() const { return ""; }
+const std::string&	LLTextSegment::getName() const 
+{
+	return LLStringUtil::null;
+}
 void LLTextSegment::onMouseCaptureLost() {}
 void LLTextSegment::screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const {}
 void LLTextSegment::localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const {}
@@ -2534,7 +2626,7 @@ LLNormalTextSegment::LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 e
 	mToken(NULL),
 	mEditor(editor)
 {
-	mFontHeight = llceil(mStyle->getFont()->getLineHeight());
+	mFontHeight = mStyle->getFont()->getLineHeight();
 
 	LLUIImagePtr image = mStyle->getImage();
 	if (image.notNull())
@@ -2550,7 +2642,7 @@ LLNormalTextSegment::LLNormalTextSegment( const LLColor4& color, S32 start, S32
 {
 	mStyle = new LLStyle(LLStyle::Params().visible(is_visible).color(color));
 
-	mFontHeight = llceil(mStyle->getFont()->getLineHeight());
+	mFontHeight = mStyle->getFont()->getLineHeight();
 }
 
 LLNormalTextSegment::~LLNormalTextSegment()
@@ -2918,11 +3010,11 @@ LLLineBreakTextSegment::LLLineBreakTextSegment(S32 pos):LLTextSegment(pos,pos+1)
 {
 	LLStyleSP s( new LLStyle(LLStyle::Params().visible(true)));
 
-	mFontHeight = llceil(s->getFont()->getLineHeight());
+	mFontHeight = s->getFont()->getLineHeight();
 }
 LLLineBreakTextSegment::LLLineBreakTextSegment(LLStyleConstSP style,S32 pos):LLTextSegment(pos,pos+1)
 {
-	mFontHeight = llceil(style->getFont()->getLineHeight());
+	mFontHeight = style->getFont()->getLineHeight();
 }
 LLLineBreakTextSegment::~LLLineBreakTextSegment()
 {
@@ -2959,7 +3051,7 @@ static const S32 IMAGE_HPAD = 3;
 bool LLImageTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const
 {
 	width = 0;
-	height = llceil(mStyle->getFont()->getLineHeight());;
+	height = mStyle->getFont()->getLineHeight();
 
 	LLUIImagePtr image = mStyle->getImage();
 	if( num_chars>0 && image.notNull())
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index 384d9116fc0b7d6b11bdf788a1ca028911988be2..0549141b72a20531d5b10af3601bbf36eeb52bf9 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -84,7 +84,7 @@ class LLTextSegment : public LLRefCount, public LLMouseHandler
 	/*virtual*/ BOOL			handleHover(S32 x, S32 y, MASK mask);
 	/*virtual*/ BOOL			handleScrollWheel(S32 x, S32 y, S32 clicks);
 	/*virtual*/ BOOL			handleToolTip(S32 x, S32 y, MASK mask);
-	/*virtual*/ std::string		getName() const;
+	/*virtual*/ const std::string&	getName() const;
 	/*virtual*/ void			onMouseCaptureLost();
 	/*virtual*/ void			screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const;
 	/*virtual*/ void			localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const;
@@ -461,6 +461,8 @@ class LLTextBase
 	void                			getSegmentAndOffset( S32 startpos, segment_set_t::const_iterator* seg_iter, S32* offsetp ) const;
 	void                			getSegmentAndOffset( S32 startpos, segment_set_t::iterator* seg_iter, S32* offsetp );
 	LLTextSegmentPtr    			getSegmentAtLocalPos( S32 x, S32 y, bool hit_past_end_of_line = true);
+	segment_set_t::iterator			getEditableSegIterContaining(S32 index);
+	segment_set_t::const_iterator	getEditableSegIterContaining(S32 index) const;
 	segment_set_t::iterator			getSegIterContaining(S32 index);
 	segment_set_t::const_iterator	getSegIterContaining(S32 index) const;
 	void                			clearSegments();
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 9bd445988d559ad6d3ebfccc00833860c00ebdbf..9720dded6c658e5844fe04a949a5997b4060d742 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -1332,7 +1332,7 @@ void LLTextEditor::cut()
 	}
 	S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
 	S32 length = llabs( mSelectionStart - mSelectionEnd );
-	gClipboard.copyFromSubstring( getWText(), left_pos, length, mSourceID );
+	LLClipboard::instance().copyToClipboard( getWText(), left_pos, length);
 	deleteSelection( FALSE );
 
 	onKeyStroke();
@@ -1352,12 +1352,12 @@ void LLTextEditor::copy()
 	}
 	S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
 	S32 length = llabs( mSelectionStart - mSelectionEnd );
-	gClipboard.copyFromSubstring(getWText(), left_pos, length, mSourceID);
+	LLClipboard::instance().copyToClipboard(getWText(), left_pos, length);
 }
 
 BOOL LLTextEditor::canPaste() const
 {
-	return !mReadOnly && gClipboard.canPasteString();
+	return !mReadOnly && LLClipboard::instance().isTextAvailable();
 }
 
 // paste from clipboard
@@ -1393,16 +1393,8 @@ void LLTextEditor::pasteHelper(bool is_primary)
 		return;
 	}
 
-	LLUUID source_id;
 	LLWString paste;
-	if (is_primary)
-	{
-		paste = gClipboard.getPastePrimaryWString(&source_id);
-	}
-	else 
-	{
-		paste = gClipboard.getPasteWString(&source_id);
-	}
+	LLClipboard::instance().pasteFromClipboard(paste, is_primary);
 
 	if (paste.empty())
 	{
@@ -1475,12 +1467,12 @@ void LLTextEditor::copyPrimary()
 	}
 	S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
 	S32 length = llabs( mSelectionStart - mSelectionEnd );
-	gClipboard.copyFromPrimarySubstring(getWText(), left_pos, length, mSourceID);
+	LLClipboard::instance().copyToClipboard(getWText(), left_pos, length, true);
 }
 
 BOOL LLTextEditor::canPastePrimary() const
 {
-	return !mReadOnly && gClipboard.canPastePrimaryString();
+	return !mReadOnly && LLClipboard::instance().isTextAvailable(true);
 }
 
 void LLTextEditor::updatePrimary()
@@ -1992,7 +1984,7 @@ void LLTextEditor::drawPreeditMarker()
 		return;
 	}
 		
-	const S32 line_height = llround( mDefaultFont->getLineHeight() );
+	const S32 line_height = mDefaultFont->getLineHeight();
 
 	S32 line_start = getLineStart(cur_line);
 	S32 line_y = mVisibleTextRect.mTop - line_height;
@@ -2250,6 +2242,22 @@ void LLTextEditor::insertText(const std::string &new_text)
 	setEnabled( enabled );
 }
 
+void LLTextEditor::insertText(LLWString &new_text)
+{
+	BOOL enabled = getEnabled();
+	setEnabled( TRUE );
+
+	// Delete any selected characters (the insertion replaces them)
+	if( hasSelection() )
+	{
+		deleteSelection(TRUE);
+	}
+
+	setCursorPos(mCursorPos + insert( mCursorPos, new_text, FALSE, LLTextSegmentPtr() ));
+
+	setEnabled( enabled );
+}
+
 void LLTextEditor::appendWidget(const LLInlineViewSegment::Params& params, const std::string& text, bool allow_undo)
 {
 	// Save old state
@@ -2699,7 +2707,7 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
 
     const LLWString textString(getWText());
 	const llwchar * const text = textString.c_str();
-	const S32 line_height = llround(mDefaultFont->getLineHeight());
+	const S32 line_height = mDefaultFont->getLineHeight();
 
 	if (coord)
 	{
@@ -2802,7 +2810,7 @@ void LLTextEditor::markAsPreedit(S32 position, S32 length)
 
 S32 LLTextEditor::getPreeditFontSize() const
 {
-	return llround(mDefaultFont->getLineHeight() * LLUI::sGLScaleFactor.mV[VY]);
+	return llround((F32)mDefaultFont->getLineHeight() * LLUI::sGLScaleFactor.mV[VY]);
 }
 
 BOOL LLTextEditor::isDirty() const
@@ -2838,3 +2846,13 @@ void LLTextEditor::clear()
 	getViewModel()->setDisplay(LLWStringUtil::null);
 	clearSegments();
 }
+
+bool LLTextEditor::canLoadOrSaveToFile()
+{
+	return !mReadOnly;
+}
+
+S32 LLTextEditor::spacesPerTab()
+{
+	return SPACES_PER_TAB;
+}
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index 9e4b95003b7f45aeb1c32094a32332f83b40b8ba..40821ae9fbc58f994a81f58e03ca1522bcc5b46a 100644
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -92,6 +92,8 @@ class LLTextEditor :
 
 	void	setParseHighlights(BOOL parsing) {mParseHighlights=parsing;}
 
+	static S32		spacesPerTab();
+
 	// mousehandler overrides
 	virtual BOOL	handleMouseDown(S32 x, S32 y, MASK mask);
 	virtual BOOL	handleMouseUp(S32 x, S32 y, MASK mask);
@@ -140,6 +142,8 @@ class LLTextEditor :
 	virtual void	selectAll();
 	virtual BOOL	canSelectAll()	const;
 
+	virtual bool	canLoadOrSaveToFile();
+
 	void			selectNext(const std::string& search_text_in, BOOL case_insensitive, BOOL wrap = TRUE);
 	BOOL			replaceText(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive, BOOL wrap = TRUE);
 	void			replaceTextAll(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive);
@@ -158,6 +162,7 @@ class LLTextEditor :
 
 	// inserts text at cursor
 	void			insertText(const std::string &text);
+	void			insertText(LLWString &text);
 
 	void			appendWidget(const LLInlineViewSegment::Params& params, const std::string& text, bool allow_undo);
 	// Non-undoable
diff --git a/indra/llui/lltextparser.cpp b/indra/llui/lltextparser.cpp
index a4fe4f6ca8b4d8b246c2aa30b330a2266384da46..8a85f99e0cf87d05f881ee48ffe6f68595e80486 100644
--- a/indra/llui/lltextparser.cpp
+++ b/indra/llui/lltextparser.cpp
@@ -46,8 +46,6 @@ LLTextParser::LLTextParser()
 {}
 
 
-// Moved triggerAlerts() to llfloaterchat.cpp to break llui/llaudio library dependency.
-
 S32 LLTextParser::findPattern(const std::string &text, LLSD highlight)
 {
 	if (!highlight.has("pattern")) return -1;
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index e7642ae1901deefc6cab0cd204eef8b0c5ab4a00..81ea0ebf0ca603099532841ee5cbf50e1ce75f1c 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -151,14 +151,20 @@ void LLToolBar::createContextMenu()
 		if (menu)
 		{
 			menu->setBackgroundColor(LLUIColorTable::instance().getColor("MenuPopupBgColor"));
-
 			mPopupMenuHandle = menu->getHandle();
+			mRemoveButtonHandle = menu->getChild<LLView>("Remove button")->getHandle();
 		}
 		else
 		{
 			llwarns << "Unable to load toolbars context menu." << llendl;
 		}
 	}
+	
+	if (mRemoveButtonHandle.get())
+	{
+		// Disable/Enable the "Remove button" menu item depending on whether or not a button was clicked
+		mRemoveButtonHandle.get()->setEnabled(mRightMouseTargetButton != NULL);
+	}
 }
 
 void LLToolBar::initFromParams(const LLToolBar::Params& p)
@@ -401,6 +407,7 @@ BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask)
 	{
 		// Determine which button the mouse was over during the click in case the context menu action
 		// is intended to affect the button.
+		mRightMouseTargetButton = NULL;
 		BOOST_FOREACH(LLToolBarButton* button, mButtons)
 		{
 			LLRect button_rect;
@@ -770,6 +777,12 @@ void LLToolBar::updateLayoutAsNeeded()
 	// re-center toolbar buttons
 	mCenteringStack->updateLayout();
 
+	if (!mButtons.empty())
+	{
+		mButtonPanel->setVisible(TRUE);
+		mButtonPanel->setMouseOpaque(TRUE);
+	}
+
 	// don't clear flag until after we've resized ourselves, to avoid laying out every frame
 	mNeedsLayout = false;
 }
@@ -814,7 +827,7 @@ void LLToolBar::draw()
 	// rect may have shifted during layout
 	LLUI::popMatrix();
 	LLUI::pushMatrix();
-	LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom, 0.f);
+	LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom);
 
 	// Position the caret 
 	LLIconCtrl* caret = getChild<LLIconCtrl>("caret");
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index 51fe23ddd1823094892558d1eb7c8d04bdb8c4a4..a50c60282c453b2283cd42511583a4bacabfbfdb 100644
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -271,6 +271,7 @@ class LLToolBar
 	LLLayoutStack*					mCenteringStack;
 	LLPanel*						mButtonPanel;
 	LLHandle<class LLContextMenu>	mPopupMenuHandle;
+	LLHandle<class LLView>			mRemoveButtonHandle;
 
 	LLToolBarButton*				mRightMouseTargetButton;
 
diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp
index 23cdd9ad9a4817e17384bcd20fe094b1b58df30c..f737d48abfaade2245b71b1c486a80663a7bae54 100644
--- a/indra/llui/lltooltip.cpp
+++ b/indra/llui/lltooltip.cpp
@@ -180,6 +180,7 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
 	params.font = p.font;
 	params.use_ellipses = true;
 	params.wrap = p.wrap;
+	params.font_valign = LLFontGL::VCENTER;
 	params.parse_urls = false; // disallow hyperlinks in tooltips, as they want to spawn their own explanatory tooltips
 	mTextBox = LLUICtrlFactory::create<LLTextBox> (params);
 	addChild(mTextBox);
@@ -190,7 +191,6 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
 	{
 		LLButton::Params icon_params;
 		icon_params.name = "tooltip_info";
-		icon_params.label(""); // provid label but set to empty so name does not overwrite it -angela
 		LLRect icon_rect;
 		LLUIImage* imagep = p.image;
 		TOOLTIP_ICON_SIZE = (imagep ? imagep->getWidth() : 16);
@@ -291,6 +291,12 @@ void LLToolTip::initFromParams(const LLToolTip::Params& p)
 	S32 text_width = llmin(p.max_width(), mTextBox->getTextPixelWidth());
 	S32 text_height = mTextBox->getTextPixelHeight();
 	mTextBox->reshape(text_width, text_height);
+	if (mInfoButton)
+	{
+		LLRect text_rect = mTextBox->getRect();
+		LLRect icon_rect = mInfoButton->getRect();
+		mTextBox->translate(0, icon_rect.getCenterY() - text_rect.getCenterY());
+	}
 
 	// reshape tooltip panel to fit text box
 	LLRect tooltip_rect = calcBoundingRect();
@@ -299,6 +305,8 @@ void LLToolTip::initFromParams(const LLToolTip::Params& p)
 	tooltip_rect.mBottom = 0;
 	tooltip_rect.mLeft = 0;
 
+	mTextBox->reshape(mTextBox->getRect().getWidth(), llmax(mTextBox->getRect().getHeight(), tooltip_rect.getHeight() - 2 * mPadding));
+
 	setShape(tooltip_rect);
 }
 
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 79ad99a7704303214c9048cbf8f695b728c226f1..b5e27616b72c74261820f8bae9078e44fe8bd24d 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -153,11 +153,11 @@ void gl_state_for_2d(S32 width, S32 height)
 	F32 window_width = (F32) width;//gViewerWindow->getWindowWidth();
 	F32 window_height = (F32) height;//gViewerWindow->getWindowHeight();
 
-	glMatrixMode(GL_PROJECTION);
-	glLoadIdentity();
-	glOrtho(0.0f, llmax(window_width, 1.f), 0.0f, llmax(window_height,1.f), -1.0f, 1.0f);
-	glMatrixMode(GL_MODELVIEW);
-	glLoadIdentity();
+	gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.loadIdentity();
+	gGL.ortho(0.0f, llmax(window_width, 1.f), 0.0f, llmax(window_height,1.f), -1.0f, 1.0f);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
+	gGL.loadIdentity();
 	stop_glerror();
 }
 
@@ -537,7 +537,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex
 		}
 	}
 
-	gGL.getTexUnit(0)->bind(image);
+	gGL.getTexUnit(0)->bind(image, true);
 
 	gGL.color4fv(color.mV);
 	
@@ -735,7 +735,7 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
 	LLGLSUIDefault gls_ui;
 
 
-	gGL.getTexUnit(0)->bind(image);
+	gGL.getTexUnit(0)->bind(image, true);
 
 	gGL.color4fv(color.mV);
 
@@ -788,7 +788,7 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
 
 		LLMatrix3 quat(0.f, 0.f, degrees*DEG_TO_RAD);
 		
-		gGL.getTexUnit(0)->bind(image);
+		gGL.getTexUnit(0)->bind(image, true);
 
 		gGL.color4fv(color.mV);
 		
@@ -955,10 +955,12 @@ void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor
 		if( render_center )
 		{
 			gGL.color4fv(center_color.mV);
+			gGL.diffuseColor4fv(center_color.mV);
 			gl_deep_circle( radius, width, steps );
 		}
 		else
 		{
+			gGL.diffuseColor4fv(side_color.mV);
 			gl_washer_2d(radius, radius - width, steps, side_color, side_color);
 			gGL.translateUI(0.f, 0.f, width);
 			gl_washer_2d(radius - width, radius, steps, side_color, side_color);
@@ -970,35 +972,53 @@ void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor
 // Draw gray and white checkerboard with black border
 void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha)
 {
-	// Initialize the first time this is called.
-	const S32 PIXELS = 32;
-	static GLubyte checkerboard[PIXELS * PIXELS];
-	static BOOL first = TRUE;
-	if( first )
-	{
-		for( S32 i = 0; i < PIXELS; i++ )
+	if (!LLGLSLShader::sNoFixedFunction)
+	{ 
+		// Initialize the first time this is called.
+		const S32 PIXELS = 32;
+		static GLubyte checkerboard[PIXELS * PIXELS];
+		static BOOL first = TRUE;
+		if( first )
 		{
-			for( S32 j = 0; j < PIXELS; j++ )
+			for( S32 i = 0; i < PIXELS; i++ )
 			{
-				checkerboard[i * PIXELS + j] = ((i & 1) ^ (j & 1)) * 0xFF;
+				for( S32 j = 0; j < PIXELS; j++ )
+				{
+					checkerboard[i * PIXELS + j] = ((i & 1) ^ (j & 1)) * 0xFF;
+				}
 			}
+			first = FALSE;
 		}
-		first = FALSE;
-	}
 	
-	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 
-	// ...white squares
-	gGL.color4f( 1.f, 1.f, 1.f, alpha );
-	gl_rect_2d(rect);
+		// ...white squares
+		gGL.color4f( 1.f, 1.f, 1.f, alpha );
+		gl_rect_2d(rect);
 
-	// ...gray squares
-	gGL.color4f( .7f, .7f, .7f, alpha );
-	gGL.flush();
-	glPolygonStipple( checkerboard );
+		// ...gray squares
+		gGL.color4f( .7f, .7f, .7f, alpha );
+		gGL.flush();
 
-	LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE);
-	gl_rect_2d(rect);
+		glPolygonStipple( checkerboard );
+
+		LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE);
+		gl_rect_2d(rect);
+	}
+	else
+	{ //polygon stipple is deprecated, use "Checker" texture
+		LLPointer<LLUIImage> img = LLUI::getUIImage("Checker");
+		gGL.getTexUnit(0)->bind(img->getImage());
+		gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
+		gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
+
+		LLColor4 color(1.f, 1.f, 1.f, alpha);
+		LLRectf uv_rect(0, 0, rect.getWidth()/32.f, rect.getHeight()/32.f);
+
+		gl_draw_scaled_image(rect.mLeft, rect.mBottom, rect.getWidth(), rect.getHeight(),
+			img->getImage(), color, uv_rect);
+	}
+	
 	gGL.flush();
 }
 
@@ -1678,21 +1698,22 @@ void LLUI::translate(F32 x, F32 y, F32 z)
 	gGL.translateUI(x,y,z);
 	LLFontGL::sCurOrigin.mX += (S32) x;
 	LLFontGL::sCurOrigin.mY += (S32) y;
-	LLFontGL::sCurOrigin.mZ += z;
+	LLFontGL::sCurDepth += z;
 }
 
 //static
 void LLUI::pushMatrix()
 {
 	gGL.pushUIMatrix();
-	LLFontGL::sOriginStack.push_back(LLFontGL::sCurOrigin);
+	LLFontGL::sOriginStack.push_back(std::make_pair(LLFontGL::sCurOrigin, LLFontGL::sCurDepth));
 }
 
 //static
 void LLUI::popMatrix()
 {
 	gGL.popUIMatrix();
-	LLFontGL::sCurOrigin = *LLFontGL::sOriginStack.rbegin();
+	LLFontGL::sCurOrigin = LLFontGL::sOriginStack.back().first;
+	LLFontGL::sCurDepth = LLFontGL::sOriginStack.back().second;
 	LLFontGL::sOriginStack.pop_back();
 }
 
@@ -1702,7 +1723,7 @@ void LLUI::loadIdentity()
 	gGL.loadUIIdentity(); 
 	LLFontGL::sCurOrigin.mX = 0;
 	LLFontGL::sCurOrigin.mY = 0;
-	LLFontGL::sCurOrigin.mZ = 0;
+	LLFontGL::sCurDepth = 0.f;
 }
 
 //static
@@ -1725,10 +1746,7 @@ void LLUI::setMousePositionScreen(S32 x, S32 y)
 	screen_x = llround((F32)x * sGLScaleFactor.mV[VX]);
 	screen_y = llround((F32)y * sGLScaleFactor.mV[VY]);
 	
-	LLCoordWindow window_point;
-	LLView::getWindow()->convertCoords(LLCoordGL(screen_x, screen_y), &window_point);
-
-	LLView::getWindow()->setCursorPosition(window_point);
+	LLView::getWindow()->setCursorPosition(LLCoordGL(screen_x, screen_y).convert());
 }
 
 //static 
@@ -1736,8 +1754,7 @@ void LLUI::getMousePositionScreen(S32 *x, S32 *y)
 {
 	LLCoordWindow cursor_pos_window;
 	getWindow()->getCursorPosition(&cursor_pos_window);
-	LLCoordGL cursor_pos_gl;
-	getWindow()->convertCoords(cursor_pos_window, &cursor_pos_gl);
+	LLCoordGL cursor_pos_gl(cursor_pos_window.convert());
 	*x = llround((F32)cursor_pos_gl.mX / sGLScaleFactor.mV[VX]);
 	*y = llround((F32)cursor_pos_gl.mY / sGLScaleFactor.mV[VX]);
 }
@@ -1823,9 +1840,12 @@ void LLUI::setupPaths()
 	LLXMLNodePtr root;
 	BOOL success  = LLXMLNode::parseFile(filename, root, NULL);
 	Paths paths;
-	LLXUIParser parser;
-	parser.readXUI(root, paths, filename);
 
+	if(success)
+	{
+		LLXUIParser parser;
+		parser.readXUI(root, paths, filename);
+	}
 	sXUIPaths.clear();
 	
 	if (success && paths.validateBlock())
@@ -2039,7 +2059,7 @@ void LLUI::positionViewNearMouse(LLView* view, S32 spawn_x, S32 spawn_y)
 	// Start at spawn position (using left/top)
 	view->setOrigin( local_x, local_y - view->getRect().getHeight());
 	// Make sure we're on-screen and not overlapping the mouse
-	view->translateIntoRectWithExclusion( virtual_window_rect, mouse_rect, FALSE );
+	view->translateIntoRectWithExclusion( virtual_window_rect, mouse_rect );
 }
 
 LLView* LLUI::resolvePath(LLView* context, const std::string& path)
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index 2fa260ded1e537c4ed6c5d32055ba303f4207650..b9c843e931c4aa657eec7a3f3bed2d127870b230 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -118,7 +118,6 @@ LLUICtrl::LLUICtrl(const LLUICtrl::Params& p, const LLViewModelPtr& viewmodel)
 	mDoubleClickSignal(NULL),
 	mTransparencyType(TT_DEFAULT)
 {
-	mUICtrlHandle.bind(this);
 }
 
 void LLUICtrl::initFromParams(const Params& p)
@@ -460,7 +459,7 @@ void LLUICtrl::setControlVariable(LLControlVariable* control)
 	if (control)
 	{
 		mControlVariable = control;
-		mControlConnection = mControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getUICtrlHandle(), std::string("value")));
+		mControlConnection = mControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getHandle(), std::string("value")));
 		setValue(mControlVariable->getValue());
 	}
 }
@@ -491,7 +490,7 @@ void LLUICtrl::setEnabledControlVariable(LLControlVariable* control)
 	if (control)
 	{
 		mEnabledControlVariable = control;
-		mEnabledControlConnection = mEnabledControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getUICtrlHandle(), std::string("enabled")));
+		mEnabledControlConnection = mEnabledControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getHandle(), std::string("enabled")));
 		setEnabled(mEnabledControlVariable->getValue().asBoolean());
 	}
 }
@@ -506,7 +505,7 @@ void LLUICtrl::setDisabledControlVariable(LLControlVariable* control)
 	if (control)
 	{
 		mDisabledControlVariable = control;
-		mDisabledControlConnection = mDisabledControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getUICtrlHandle(), std::string("disabled")));
+		mDisabledControlConnection = mDisabledControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getHandle(), std::string("disabled")));
 		setEnabled(!(mDisabledControlVariable->getValue().asBoolean()));
 	}
 }
@@ -521,7 +520,7 @@ void LLUICtrl::setMakeVisibleControlVariable(LLControlVariable* control)
 	if (control)
 	{
 		mMakeVisibleControlVariable = control;
-		mMakeVisibleControlConnection = mMakeVisibleControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getUICtrlHandle(), std::string("visible")));
+		mMakeVisibleControlConnection = mMakeVisibleControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getHandle(), std::string("visible")));
 		setVisible(mMakeVisibleControlVariable->getValue().asBoolean());
 	}
 }
@@ -536,7 +535,7 @@ void LLUICtrl::setMakeInvisibleControlVariable(LLControlVariable* control)
 	if (control)
 	{
 		mMakeInvisibleControlVariable = control;
-		mMakeInvisibleControlConnection = mMakeInvisibleControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getUICtrlHandle(), std::string("invisible")));
+		mMakeInvisibleControlConnection = mMakeInvisibleControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getHandle(), std::string("invisible")));
 		setVisible(!(mMakeInvisibleControlVariable->getValue().asBoolean()));
 	}
 }
diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h
index 3e055a9d06229c671de929b0feb93646acdd7b7d..fb2196bb1640a164a23b390a27c9927a3d7f7e61 100644
--- a/indra/llui/lluictrl.h
+++ b/indra/llui/lluictrl.h
@@ -223,7 +223,7 @@ class LLUICtrl
 	BOOL	focusLastItem(BOOL prefer_text_fields = FALSE);
 
 	// Non Virtuals
-	LLHandle<LLUICtrl> getUICtrlHandle() const { return mUICtrlHandle; }
+	LLHandle<LLUICtrl> getHandle() const { return getDerivedHandle<LLUICtrl>(); }
 	BOOL			getIsChrome() const;
 	
 	void			setTabStop( BOOL b );
@@ -313,7 +313,6 @@ class LLUICtrl
 	BOOL			mRequestsFront;
 	BOOL			mTabStop;
 	BOOL			mTentative;
-	LLRootHandle<LLUICtrl> mUICtrlHandle;
 
 	ETypeTransparency mTransparencyType;
 
diff --git a/indra/llui/lluistring.cpp b/indra/llui/lluistring.cpp
index ac69d3bf8513074cb22fd7519aae0823217cd442..c4e073ccdb9cb9892a7fe502a4d56daaca8f8b1b 100644
--- a/indra/llui/lluistring.cpp
+++ b/indra/llui/lluistring.cpp
@@ -128,17 +128,13 @@ void LLUIString::updateResult() const
 	}
 	mResult = mOrig;
 	
-	// get the defailt args + local args
-	if (!mArgs || mArgs->empty())
+	// get the default args + local args
+	LLStringUtil::format_map_t combined_args = LLTrans::getDefaultArgs();
+	if (mArgs && !mArgs->empty())
 	{
-		LLStringUtil::format(mResult, LLTrans::getDefaultArgs());
-	}
-	else
-	{
-		LLStringUtil::format_map_t combined_args = LLTrans::getDefaultArgs();
 		combined_args.insert(mArgs->begin(), mArgs->end());
-		LLStringUtil::format(mResult, combined_args);
 	}
+	LLStringUtil::format(mResult, combined_args);
 }
 
 void LLUIString::updateWResult() const
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 3fd7e48428915cc6b02f39226b0f7012673369ce..54843227b74c4f99263a5dcbd4d70d7dfba9629a 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -121,6 +121,7 @@ LLView::Params::Params()
 
 LLView::LLView(const LLView::Params& p)
 :	mVisible(p.visible),
+	mInDraw(false),
 	mName(p.name),
 	mParentView(NULL),
 	mReshapeFlags(FOLLOWS_NONE),
@@ -225,9 +226,11 @@ BOOL LLView::getUseBoundingRect() const
 }
 
 // virtual
-std::string LLView::getName() const
+const std::string& LLView::getName() const
 {
-	return mName.empty() ? std::string("(no name)") : mName;
+	static std::string no_name("(no name)");
+
+	return mName.empty() ? no_name : mName;
 }
 
 void LLView::sendChildToFront(LLView* child)
@@ -331,6 +334,8 @@ void LLView::removeChild(LLView* child)
 	//llassert_always(sDepth == 0); // Avoid re-ordering while drawing; it can cause subtle iterator bugs
 	if (child->mParentView == this) 
 	{
+		// if we are removing an item we are currently iterating over, that would be bad
+		llassert(child->mInDraw == false);
 		mChildList.remove( child );
 		child->mParentView = NULL;
 		if (child->isCtrl())
@@ -1088,6 +1093,11 @@ void LLView::drawChildren()
 		{
 			child_list_reverse_iter_t child = child_iter++;
 			LLView *viewp = *child;
+			
+			if (viewp == NULL)
+			{
+				continue;
+			}
 
 			if (viewp->getVisible() && viewp->getRect().isValid())
 			{
@@ -1096,8 +1106,11 @@ void LLView::drawChildren()
 				{
 					LLUI::pushMatrix();
 					{
-						LLUI::translate((F32)viewp->getRect().mLeft, (F32)viewp->getRect().mBottom, 0.f);
+						LLUI::translate((F32)viewp->getRect().mLeft, (F32)viewp->getRect().mBottom);
+						// flag the fact we are in draw here, in case overridden draw() method attempts to remove this widget
+						viewp->mInDraw = true;
 						viewp->draw();
+						viewp->mInDraw = false;
 
 						if (sDebugRects)
 						{
@@ -1146,7 +1159,7 @@ void LLView::drawDebugRect()
 
 		if (getUseBoundingRect())
 		{
-			LLUI::translate((F32)mBoundingRect.mLeft - (F32)mRect.mLeft, (F32)mBoundingRect.mBottom - (F32)mRect.mBottom, 0.f);
+			LLUI::translate((F32)mBoundingRect.mLeft - (F32)mRect.mLeft, (F32)mBoundingRect.mBottom - (F32)mRect.mBottom);
 		}
 
 		LLRect debug_rect = getUseBoundingRect() ? mBoundingRect : mRect;
@@ -1215,10 +1228,10 @@ void LLView::drawChild(LLView* childp, S32 x_offset, S32 y_offset, BOOL force_dr
 		if ((childp->getVisible() && childp->getRect().isValid()) 
 			|| force_draw)
 		{
-			glMatrixMode(GL_MODELVIEW);
+			gGL.matrixMode(LLRender::MM_MODELVIEW);
 			LLUI::pushMatrix();
 			{
-				LLUI::translate((F32)childp->getRect().mLeft + x_offset, (F32)childp->getRect().mBottom + y_offset, 0.f);
+				LLUI::translate((F32)childp->getRect().mLeft + x_offset, (F32)childp->getRect().mBottom + y_offset);
 				childp->draw();
 			}
 			LLUI::popMatrix();
@@ -1287,7 +1300,10 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent)
 			S32 delta_x = child_rect.mLeft - viewp->getRect().mLeft;
 			S32 delta_y = child_rect.mBottom - viewp->getRect().mBottom;
 			viewp->translate( delta_x, delta_y );
-			viewp->reshape(child_rect.getWidth(), child_rect.getHeight());
+			if (child_rect.getWidth() != viewp->getRect().getWidth() || child_rect.getHeight() != viewp->getRect().getHeight())
+			{
+				viewp->reshape(child_rect.getWidth(), child_rect.getHeight());
+			}
 		}
 	}
 
@@ -1603,59 +1619,30 @@ LLView* LLView::findNextSibling(LLView* child)
 }
 
 
-LLCoordGL getNeededTranslation(const LLRect& input, const LLRect& constraint, BOOL allow_partial_outside)
+LLCoordGL getNeededTranslation(const LLRect& input, const LLRect& constraint, S32 min_overlap_pixels)
 {
 	LLCoordGL delta;
 
-	if (allow_partial_outside)
-	{
-		const S32 KEEP_ONSCREEN_PIXELS = 16;
+	const S32 KEEP_ONSCREEN_PIXELS_WIDTH = llmin(min_overlap_pixels, input.getWidth());
+	const S32 KEEP_ONSCREEN_PIXELS_HEIGHT = llmin(min_overlap_pixels, input.getHeight());
 
-		if( input.mRight - KEEP_ONSCREEN_PIXELS < constraint.mLeft )
-		{
-			delta.mX = constraint.mLeft - (input.mRight - KEEP_ONSCREEN_PIXELS);
-		}
-		else
-		if( input.mLeft + KEEP_ONSCREEN_PIXELS > constraint.mRight )
-		{
-			delta.mX = constraint.mRight - (input.mLeft + KEEP_ONSCREEN_PIXELS);
-		}
+	if( input.mRight - KEEP_ONSCREEN_PIXELS_WIDTH < constraint.mLeft )
+	{
+		delta.mX = constraint.mLeft - (input.mRight - KEEP_ONSCREEN_PIXELS_WIDTH);
+	}
+	else if( input.mLeft + KEEP_ONSCREEN_PIXELS_WIDTH > constraint.mRight )
+	{
+		delta.mX = constraint.mRight - (input.mLeft + KEEP_ONSCREEN_PIXELS_WIDTH);
+	}
 
-		if( input.mTop > constraint.mTop )
-		{
-			delta.mY = constraint.mTop - input.mTop;
-		}
-		else
-		if( input.mTop - KEEP_ONSCREEN_PIXELS < constraint.mBottom )
-		{
-			delta.mY = constraint.mBottom - (input.mTop - KEEP_ONSCREEN_PIXELS);
-		}
+	if( input.mTop > constraint.mTop )
+	{
+		delta.mY = constraint.mTop - input.mTop;
 	}
 	else
+	if( input.mTop - KEEP_ONSCREEN_PIXELS_HEIGHT < constraint.mBottom )
 	{
-		if( input.mLeft < constraint.mLeft )
-		{
-			delta.mX = constraint.mLeft - input.mLeft;
-		}
-		else
-		if( input.mRight > constraint.mRight )
-		{
-			delta.mX = constraint.mRight - input.mRight;
-			// compensate for left edge possible going off screen
-			delta.mX += llmax( 0, input.getWidth() - constraint.getWidth() );
-		}
-
-		if( input.mTop > constraint.mTop )
-		{
-			delta.mY = constraint.mTop - input.mTop;
-		}
-		else
-		if( input.mBottom < constraint.mBottom )
-		{
-			delta.mY = constraint.mBottom - input.mBottom;
-			// compensate for top edge possible going off screen
-			delta.mY -= llmax( 0, input.getHeight() - constraint.getHeight() );
-		}
+		delta.mY = constraint.mBottom - (input.mTop - KEEP_ONSCREEN_PIXELS_HEIGHT);
 	}
 
 	return delta;
@@ -1664,9 +1651,9 @@ LLCoordGL getNeededTranslation(const LLRect& input, const LLRect& constraint, BO
 // Moves the view so that it is entirely inside of constraint.
 // If the view will not fit because it's too big, aligns with the top and left.
 // (Why top and left?  That's where the drag bars are for floaters.)
-BOOL LLView::translateIntoRect(const LLRect& constraint, BOOL allow_partial_outside )
+BOOL LLView::translateIntoRect(const LLRect& constraint, S32 min_overlap_pixels)
 {
-	LLCoordGL translation = getNeededTranslation(getRect(), constraint, allow_partial_outside);
+	LLCoordGL translation = getNeededTranslation(getRect(), constraint, min_overlap_pixels);
 
 	if (translation.mX != 0 || translation.mY != 0)
 	{
@@ -1678,9 +1665,9 @@ BOOL LLView::translateIntoRect(const LLRect& constraint, BOOL allow_partial_outs
 
 // move this view into "inside" but not onto "exclude"
 // NOTE: if this view is already contained in "inside", we ignore the "exclude" rect
-BOOL LLView::translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, BOOL allow_partial_outside )
+BOOL LLView::translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, S32 min_overlap_pixels)
 {
-	LLCoordGL translation = getNeededTranslation(getRect(), inside, allow_partial_outside);
+	LLCoordGL translation = getNeededTranslation(getRect(), inside, min_overlap_pixels);
 	
 	if (translation.mX != 0 || translation.mY != 0)
 	{
@@ -1848,7 +1835,10 @@ const LLCtrlQuery & LLView::getFocusRootsQuery()
 
 void	LLView::setShape(const LLRect& new_rect, bool by_user)
 {
-	handleReshape(new_rect, by_user);
+	if (new_rect != getRect())
+	{
+		handleReshape(new_rect, by_user);
+	}
 }
 
 void LLView::handleReshape(const LLRect& new_rect, bool by_user)
@@ -2238,145 +2228,163 @@ static bool get_last_child_rect(LLView* parent, LLRect *rect)
 }
 
 //static
-void LLView::applyXUILayout(LLView::Params& p, LLView* parent)
+void LLView::applyXUILayout(LLView::Params& p, LLView* parent, LLRect layout_rect)
 {
+	if (!parent) return;
+
 	const S32 VPAD = 4;
 	const S32 MIN_WIDGET_HEIGHT = 10;
 	
 	// *NOTE:  This will confuse export of floater/panel coordinates unless
 	// the default is also "topleft".  JC
-	if (p.layout().empty() && parent)
+	if (p.layout().empty())
 	{
 		p.layout = parent->getLayout();
 	}
 
-	if (parent)
+	if (layout_rect.isEmpty())
 	{
-		LLRect parent_rect = parent->getLocalRect();
-		// overwrite uninitialized rect params, using context
-		LLRect default_rect = parent->getLocalRect();
+		layout_rect = parent->getLocalRect();
+	}
 
-		bool layout_topleft = (p.layout() == "topleft");
+	// overwrite uninitialized rect params, using context
+	LLRect default_rect = parent->getLocalRect();
 
-		// convert negative or centered coordinates to parent relative values
-		// Note: some of this logic matches the logic in TypedParam<LLRect>::setValueFromBlock()
-		if (p.rect.left.isProvided() && p.rect.left < 0) p.rect.left = p.rect.left + parent_rect.getWidth();
-		if (p.rect.right.isProvided() && p.rect.right < 0) p.rect.right = p.rect.right + parent_rect.getWidth();
-		if (p.rect.bottom.isProvided() && p.rect.bottom < 0) p.rect.bottom = p.rect.bottom + parent_rect.getHeight();
-		if (p.rect.top.isProvided() && p.rect.top < 0) p.rect.top = p.rect.top + parent_rect.getHeight();
+	bool layout_topleft = (p.layout() == "topleft");
 
+	// convert negative or centered coordinates to parent relative values
+	// Note: some of this logic matches the logic in TypedParam<LLRect>::setValueFromBlock()
+	if (p.rect.left.isProvided()) 
+	{
+		p.rect.left = p.rect.left + ((p.rect.left >= 0) ? layout_rect.mLeft : layout_rect.mRight);
+	}
+	if (p.rect.right.isProvided())
+	{
+		p.rect.right = p.rect.right + ((p.rect.right >= 0) ? layout_rect.mLeft : layout_rect.mRight);
+	}
+	if (p.rect.bottom.isProvided()) 
+	{
+		p.rect.bottom = p.rect.bottom + ((p.rect.bottom >= 0) ? layout_rect.mBottom : layout_rect.mTop);
 		if (layout_topleft)
 		{
 			//invert top to bottom
-			if (p.rect.top.isProvided()) p.rect.top = parent_rect.getHeight() - p.rect.top;
-			if (p.rect.bottom.isProvided()) p.rect.bottom = parent_rect.getHeight() - p.rect.bottom;
+			p.rect.bottom = layout_rect.mBottom + layout_rect.mTop - p.rect.bottom;
 		}
-
-		// DEPRECATE: automatically fall back to height of MIN_WIDGET_HEIGHT pixels
-		if (!p.rect.height.isProvided() && !p.rect.top.isProvided() && p.rect.height == 0)
+	}
+	if (p.rect.top.isProvided())
+	{
+		p.rect.top = p.rect.top + ((p.rect.top >= 0) ? layout_rect.mBottom : layout_rect.mTop);
+		if (layout_topleft)
 		{
-			p.rect.height = MIN_WIDGET_HEIGHT;
+			//invert top to bottom
+			p.rect.top = layout_rect.mBottom + layout_rect.mTop - p.rect.top;
 		}
+	}
 
-		default_rect.translate(0, default_rect.getHeight());
+	// DEPRECATE: automatically fall back to height of MIN_WIDGET_HEIGHT pixels
+	if (!p.rect.height.isProvided() && !p.rect.top.isProvided() && p.rect.height == 0)
+	{
+		p.rect.height = MIN_WIDGET_HEIGHT;
+	}
 
-		// If there was a recently constructed child, use its rectangle
-		get_last_child_rect(parent, &default_rect);
+	default_rect.translate(0, default_rect.getHeight());
 
-		if (layout_topleft)
+	// If there was a recently constructed child, use its rectangle
+	get_last_child_rect(parent, &default_rect);
+
+	if (layout_topleft)
+	{
+		// Invert the sense of bottom_delta for topleft layout
+		if (p.bottom_delta.isProvided())
 		{
-			// Invert the sense of bottom_delta for topleft layout
-			if (p.bottom_delta.isProvided())
-			{
-				p.bottom_delta = -p.bottom_delta;
-			}
-			else if (p.top_pad.isProvided()) 
-			{
-				p.bottom_delta = -(p.rect.height + p.top_pad);
-			}
-			else if (p.top_delta.isProvided())
-			{
-				p.bottom_delta =
-					-(p.top_delta + p.rect.height - default_rect.getHeight());
-			}
-			else if (!p.left_delta.isProvided()
-					 && !p.left_pad.isProvided())
-			{
-				// set default position is just below last rect
-				p.bottom_delta.set(-(p.rect.height + VPAD), false);
-			}
-			else
-			{
-				p.bottom_delta.set(0, false);
-			}
-	
-			// default to same left edge
-			if (!p.left_delta.isProvided())
-			{
-				p.left_delta.set(0, false);
-			}
-			if (p.left_pad.isProvided())
-			{
-				// left_pad is based on prior widget's right edge
-				p.left_delta.set(p.left_pad + default_rect.getWidth(), false);
-			}
-			
-			default_rect.translate(p.left_delta, p.bottom_delta);				
+			p.bottom_delta = -p.bottom_delta;
 		}
-		else
-		{	
-			// set default position is just below last rect
-			if (!p.bottom_delta.isProvided())
-			{
-				p.bottom_delta.set(-(p.rect.height + VPAD), false);
-			}
-			if (!p.left_delta.isProvided())
-			{
-				p.left_delta.set(0, false);
-			}
-			default_rect.translate(p.left_delta, p.bottom_delta);
+		else if (p.top_pad.isProvided()) 
+		{
+			p.bottom_delta = -(p.rect.height + p.top_pad);
 		}
-
-		// this handles case where *both* x and x_delta are provided
-		// ignore x in favor of default x + x_delta
-		if (p.bottom_delta.isProvided()) p.rect.bottom.set(0, false);
-		if (p.left_delta.isProvided()) p.rect.left.set(0, false);
-
-		// selectively apply rectangle defaults, making sure that
-		// params are not flagged as having been "provided"
-		// as rect params are overconstrained and rely on provided flags
-		if (!p.rect.left.isProvided())
+		else if (p.top_delta.isProvided())
 		{
-			p.rect.left.set(default_rect.mLeft, false);
-			//HACK: get around the fact that setting a rect param component value won't invalidate the existing rect object value
-			p.rect.paramChanged(p.rect.left, true);
+			p.bottom_delta =
+				-(p.top_delta + p.rect.height - default_rect.getHeight());
 		}
-		if (!p.rect.bottom.isProvided())
+		else if (!p.left_delta.isProvided()
+					&& !p.left_pad.isProvided())
 		{
-			p.rect.bottom.set(default_rect.mBottom, false);
-			p.rect.paramChanged(p.rect.bottom, true);
+			// set default position is just below last rect
+			p.bottom_delta.set(-(p.rect.height + VPAD), false);
 		}
-		if (!p.rect.top.isProvided())
+		else
 		{
-			p.rect.top.set(default_rect.mTop, false);
-			p.rect.paramChanged(p.rect.top, true);
+			p.bottom_delta.set(0, false);
 		}
-		if (!p.rect.right.isProvided())
+	
+		// default to same left edge
+		if (!p.left_delta.isProvided())
 		{
-			p.rect.right.set(default_rect.mRight, false);
-			p.rect.paramChanged(p.rect.right, true);
-
+			p.left_delta.set(0, false);
 		}
-		if (!p.rect.width.isProvided())
+		if (p.left_pad.isProvided())
 		{
-			p.rect.width.set(default_rect.getWidth(), false);
-			p.rect.paramChanged(p.rect.width, true);
+			// left_pad is based on prior widget's right edge
+			p.left_delta.set(p.left_pad + default_rect.getWidth(), false);
 		}
-		if (!p.rect.height.isProvided())
+			
+		default_rect.translate(p.left_delta, p.bottom_delta);				
+	}
+	else
+	{	
+		// set default position is just below last rect
+		if (!p.bottom_delta.isProvided())
+		{
+			p.bottom_delta.set(-(p.rect.height + VPAD), false);
+		}
+		if (!p.left_delta.isProvided())
 		{
-			p.rect.height.set(default_rect.getHeight(), false);
-			p.rect.paramChanged(p.rect.height, true);
+			p.left_delta.set(0, false);
 		}
+		default_rect.translate(p.left_delta, p.bottom_delta);
+	}
+
+	// this handles case where *both* x and x_delta are provided
+	// ignore x in favor of default x + x_delta
+	if (p.bottom_delta.isProvided()) p.rect.bottom.set(0, false);
+	if (p.left_delta.isProvided()) p.rect.left.set(0, false);
+
+	// selectively apply rectangle defaults, making sure that
+	// params are not flagged as having been "provided"
+	// as rect params are overconstrained and rely on provided flags
+	if (!p.rect.left.isProvided())
+	{
+		p.rect.left.set(default_rect.mLeft, false);
+		//HACK: get around the fact that setting a rect param component value won't invalidate the existing rect object value
+		p.rect.paramChanged(p.rect.left, true);
+	}
+	if (!p.rect.bottom.isProvided())
+	{
+		p.rect.bottom.set(default_rect.mBottom, false);
+		p.rect.paramChanged(p.rect.bottom, true);
+	}
+	if (!p.rect.top.isProvided())
+	{
+		p.rect.top.set(default_rect.mTop, false);
+		p.rect.paramChanged(p.rect.top, true);
+	}
+	if (!p.rect.right.isProvided())
+	{
+		p.rect.right.set(default_rect.mRight, false);
+		p.rect.paramChanged(p.rect.right, true);
+
+	}
+	if (!p.rect.width.isProvided())
+	{
+		p.rect.width.set(default_rect.getWidth(), false);
+		p.rect.paramChanged(p.rect.width, true);
+	}
+	if (!p.rect.height.isProvided())
+	{
+		p.rect.height.set(default_rect.getHeight(), false);
+		p.rect.paramChanged(p.rect.height, true);
 	}
 }
 
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 08828e55e6a0ae216be8328b99f0453af0cd6ae9..1c353495107b1f09426693ed6aabdd76195f7661 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -97,7 +97,11 @@ class LLViewDrawContext
 	static std::vector<LLViewDrawContext*> sDrawContextStack;
 };
 
-class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElement
+class LLView 
+:	public LLMouseHandler,			// handles mouse events
+	public LLFocusableElement,		// handles keyboard events
+	public LLMortician,				// lazy deletion
+	public LLHandleProvider<LLView>	// passes out weak references to self
 {
 public:
 	struct Follows : public LLInitParam::ChoiceBlock<Follows>
@@ -306,8 +310,6 @@ class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElem
 	void			popVisible()				{ setVisible(mLastVisible); }
 	BOOL			getLastVisible()	const	{ return mLastVisible; }
 
-	LLHandle<LLView>	getHandle()				{ mHandle.bind(this); return mHandle; }
-
 	U32			getFollows() const				{ return mReshapeFlags; }
 	BOOL		followsLeft() const				{ return mReshapeFlags & FOLLOWS_LEFT; }
 	BOOL		followsRight() const			{ return mReshapeFlags & FOLLOWS_RIGHT; }
@@ -368,8 +370,8 @@ class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElem
 	virtual void	reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
 	virtual void	translate( S32 x, S32 y );
 	void			setOrigin( S32 x, S32 y )	{ mRect.translate( x - mRect.mLeft, y - mRect.mBottom ); }
-	BOOL			translateIntoRect( const LLRect& constraint, BOOL allow_partial_outside );
-	BOOL			translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, BOOL allow_partial_outside );
+	BOOL			translateIntoRect( const LLRect& constraint, S32 min_overlap_pixels = S32_MAX);
+	BOOL			translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, S32 min_overlap_pixels = S32_MAX);
 	void			centerWithin(const LLRect& bounds);
 
 	void	setShape(const LLRect& new_rect, bool by_user = false);
@@ -431,7 +433,7 @@ class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElem
 	/*virtual*/ BOOL	handleRightMouseUp(S32 x, S32 y, MASK mask);	
 	/*virtual*/ BOOL	handleToolTip(S32 x, S32 y, MASK mask);
 
-	/*virtual*/ std::string	getName() const;
+	/*virtual*/ const std::string& getName() const;
 	/*virtual*/ void	onMouseCaptureLost();
 	/*virtual*/ BOOL	hasMouseCapture();
 	/*virtual*/ void	screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const;
@@ -503,7 +505,7 @@ class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElem
 
 	// Set up params after XML load before calling new(),
 	// usually to adjust layout.
-	static void applyXUILayout(Params& p, LLView* parent);
+	static void applyXUILayout(Params& p, LLView* parent, LLRect layout_rect = LLRect());
 
 	// For re-export of floaters and panels, convert the coordinate system
 	// to be top-left based.
@@ -606,11 +608,12 @@ class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElem
 	BOOL		mIsFocusRoot;
 	BOOL		mUseBoundingRect; // hit test against bounding rectangle that includes all child elements
 
-	LLRootHandle<LLView> mHandle;
 	BOOL		mLastVisible;
 
 	S32			mNextInsertionOrdinal;
 
+	bool		mInDraw;
+
 	static LLWindow* sWindow;	// All root views must know about their window.
 
 	typedef std::map<std::string, LLView*> default_widget_map_t;
diff --git a/indra/llui/llwindowshade.cpp b/indra/llui/llwindowshade.cpp
index cf76202215526725897aefd2b2ac86eb98e34286..f5c463c96148dce6f08bb89464e502eac337d361 100644
--- a/indra/llui/llwindowshade.cpp
+++ b/indra/llui/llwindowshade.cpp
@@ -37,10 +37,13 @@
 const S32 MIN_NOTIFICATION_AREA_HEIGHT = 30;
 const S32 MAX_NOTIFICATION_AREA_HEIGHT = 100;
 
+static LLDefaultChildRegistry::Register<LLWindowShade> r("window_shade");
+
 LLWindowShade::Params::Params()
 :	bg_image("bg_image"),
 	modal("modal", false),
 	text_color("text_color"),
+	shade_color("shade_color"),
 	can_close("can_close", true)
 {
 	changeDefault(mouse_opaque, false);
@@ -48,7 +51,6 @@ LLWindowShade::Params::Params()
 
 LLWindowShade::LLWindowShade(const LLWindowShade::Params& params)
 :	LLUICtrl(params),
-	mNotification(params.notification),
 	mModal(params.modal),
 	mFormHeight(0),
 	mTextColor(params.text_color)
@@ -72,7 +74,7 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params)
 	addChild(stackp);
 
 	LLLayoutPanel::Params panel_p;
-	panel_p.rect = LLRect(0, 30, 800, 0);
+	panel_p.rect = LLRect(0, MIN_NOTIFICATION_AREA_HEIGHT, 800, 0);
 	panel_p.name = "notification_area";
 	panel_p.visible = false;
 	panel_p.user_resize = false;
@@ -89,7 +91,7 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params)
 	panel_p.name = "background_area";
 	panel_p.mouse_opaque = false;
 	panel_p.background_visible = false;
-	panel_p.bg_alpha_color = LLColor4(0.f, 0.f, 0.f, 0.2f);
+	panel_p.bg_alpha_color = params.shade_color;
 	LLLayoutPanel* dummy_panel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p);
 	stackp->addChild(dummy_panel);
 
@@ -107,11 +109,11 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params)
 
 	LLIconCtrl::Params icon_p;
 	icon_p.name = "notification_icon";
-	icon_p.rect = LLRect(5, 23, 21, 8);
+	icon_p.rect = LLRect(5, 25, 21, 10);
 	panel->addChild(LLUICtrlFactory::create<LLIconCtrl>(icon_p));
 
 	LLTextBox::Params text_p;
-	text_p.rect = LLRect(31, 20, panel->getRect().getWidth() - 5, 0);
+	text_p.rect = LLRect(31, 23, panel->getRect().getWidth() - 5, 3);
 	text_p.follows.flags = FOLLOWS_ALL;
 	text_p.text_color = mTextColor;
 	text_p.font = LLFontGL::getFontSansSerifSmall();
@@ -125,41 +127,132 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params)
 	panel_p.auto_resize = false;
 	panel_p.user_resize = false;
 	panel_p.name="form_elements";
-	panel_p.rect = LLRect(0, 30, 130, 0);
+	panel_p.rect = LLRect(0, MIN_NOTIFICATION_AREA_HEIGHT, 130, 0);
 	LLLayoutPanel* form_elements_panel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p);
 	stackp->addChild(form_elements_panel);
 
-	if (params.can_close)
+	panel_p = LLUICtrlFactory::getDefaultParams<LLLayoutPanel>();
+	panel_p.auto_resize = false;
+	panel_p.user_resize = false;
+	panel_p.rect = LLRect(0, MIN_NOTIFICATION_AREA_HEIGHT, 25, 0);
+	panel_p.name = "close_panel";
+	LLLayoutPanel* close_panel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p);
+	stackp->addChild(close_panel);
+
+	LLButton::Params button_p;
+	button_p.name = "close_notification";
+	button_p.rect = LLRect(5, 23, 21, 7);
+	button_p.image_color.control="DkGray_66";
+	button_p.image_unselected.name="Icon_Close_Foreground";
+	button_p.image_selected.name="Icon_Close_Press";
+	button_p.click_callback.function = boost::bind(&LLWindowShade::onCloseNotification, this);
+
+	close_panel->addChild(LLUICtrlFactory::create<LLButton>(button_p));
+	
+	close_panel->setVisible(params.can_close);
+}
+
+void LLWindowShade::draw()
+{
+	LLRect message_rect = getChild<LLTextBox>("notification_text")->getTextBoundingRect();
+
+	LLLayoutPanel* notification_area = getChild<LLLayoutPanel>("notification_area");
+
+	notification_area->reshape(notification_area->getRect().getWidth(), 
+		llclamp(message_rect.getHeight() + 15, 
+				llmax(mFormHeight, MIN_NOTIFICATION_AREA_HEIGHT),
+				MAX_NOTIFICATION_AREA_HEIGHT));
+
+	LLUICtrl::draw();
+
+	while(!mNotifications.empty() && !mNotifications.back()->isActive())
+	{
+		mNotifications.pop_back();
+		// go ahead and hide 
+		hide();
+	}
+
+	if (mNotifications.empty())
+	{
+		hide();
+	}
+	else if (notification_area->getVisibleAmount() < 0.01f)
+	{
+		displayLatestNotification();
+	}
+
+	if (!notification_area->getVisible() && (notification_area->getVisibleAmount() < 0.001f))
 	{
-		panel_p = LLUICtrlFactory::getDefaultParams<LLLayoutPanel>();
-		panel_p.auto_resize = false;
-		panel_p.user_resize = false;
-		panel_p.rect = LLRect(0, 30, 25, 0);
-		LLLayoutPanel* close_panel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p);
-		stackp->addChild(close_panel);
-
-		LLButton::Params button_p;
-		button_p.name = "close_notification";
-		button_p.rect = LLRect(5, 23, 21, 7);
-		button_p.image_color.control="DkGray_66";
-		button_p.image_unselected.name="Icon_Close_Foreground";
-		button_p.image_selected.name="Icon_Close_Press";
-		button_p.click_callback.function = boost::bind(&LLWindowShade::onCloseNotification, this);
-
-		close_panel->addChild(LLUICtrlFactory::create<LLButton>(button_p));
+		getChildRef<LLLayoutPanel>("background_area").setBackgroundVisible(false);
+		setMouseOpaque(false);
 	}
+}
+
+void LLWindowShade::hide()
+{
+	getChildRef<LLLayoutPanel>("notification_area").setVisible(false);
+}
+
+void LLWindowShade::onCloseNotification()
+{
+	if (!mNotifications.empty())
+		LLNotifications::instance().cancel(mNotifications.back());
+}
+
+void LLWindowShade::onClickIgnore(LLUICtrl* ctrl)
+{
+	LLNotificationPtr notify = getCurrentNotification();
+	if (!notify) return;
+
+	bool check = ctrl->getValue().asBoolean();
+	if (notify->getForm()->getIgnoreType() == LLNotificationForm::IGNORE_SHOW_AGAIN)
+	{
+		// question was "show again" so invert value to get "ignore"
+		check = !check;
+	}
+	notify->setIgnored(check);
+}
+
+void LLWindowShade::onClickNotificationButton(const std::string& name)
+{
+	LLNotificationPtr notify = getCurrentNotification();
+	if (!notify) return;
 
-	LLSD payload = mNotification->getPayload();
+	mNotificationResponse[name] = true;
+
+	notify->respond(mNotificationResponse);
+}
 
-	LLNotificationFormPtr formp = mNotification->getForm();
+void LLWindowShade::onEnterNotificationText(LLUICtrl* ctrl, const std::string& name)
+{
+	mNotificationResponse[name] = ctrl->getValue().asString();
+}
+
+void LLWindowShade::show(LLNotificationPtr notification)
+{
+	mNotifications.push_back(notification);
+
+	displayLatestNotification();
+}
+
+void LLWindowShade::displayLatestNotification()
+{
+	if (mNotifications.empty()) return;
+
+	LLNotificationPtr notification = mNotifications.back();
+
+	LLSD payload = notification->getPayload();
+
+	LLNotificationFormPtr formp = notification->getForm();
 	LLLayoutPanel& notification_area = getChildRef<LLLayoutPanel>("notification_area");
-	notification_area.getChild<LLUICtrl>("notification_icon")->setValue(mNotification->getIcon());
-	notification_area.getChild<LLUICtrl>("notification_text")->setValue(mNotification->getMessage());
-	notification_area.getChild<LLUICtrl>("notification_text")->setToolTip(mNotification->getMessage());
+	notification_area.getChild<LLUICtrl>("notification_icon")->setValue(notification->getIcon());
+	notification_area.getChild<LLUICtrl>("notification_text")->setValue(notification->getMessage());
+	notification_area.getChild<LLUICtrl>("notification_text")->setToolTip(notification->getMessage());
 
 	LLNotificationForm::EIgnoreType ignore_type = formp->getIgnoreType(); 
 	LLLayoutPanel& form_elements = notification_area.getChildRef<LLLayoutPanel>("form_elements");
 	form_elements.deleteAllChildren();
+	form_elements.reshape(form_elements.getRect().getWidth(), MIN_NOTIFICATION_AREA_HEIGHT);
 
 	const S32 FORM_PADDING_HORIZONTAL = 10;
 	const S32 FORM_PADDING_VERTICAL = 3;
@@ -229,7 +322,7 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params)
 			label_p.v_pad = 5;
 			LLTextBox* textbox = LLUICtrlFactory::create<LLTextBox>(label_p);
 			textbox->reshapeToFitText();
-			textbox->reshape(textbox->getRect().getWidth(), form_elements.getRect().getHeight() - 2 * FORM_PADDING_VERTICAL); 
+			textbox->reshape(textbox->getRect().getWidth(), MIN_NOTIFICATION_AREA_HEIGHT - 2 * FORM_PADDING_VERTICAL); 
 			form_elements.addChild(textbox);
 			cur_x = textbox->getRect().mRight + FORM_PADDING_HORIZONTAL;
 
@@ -249,7 +342,7 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params)
 		}
 	}
 
-	mFormHeight = form_elements.getRect().getHeight() - (cur_y - FORM_PADDING_VERTICAL) + WIDGET_HEIGHT;
+	mFormHeight = form_elements.getRect().getHeight() - (cur_y - WIDGET_HEIGHT - FORM_PADDING_VERTICAL);
 	form_elements.reshape(form_width, mFormHeight);
 	form_elements.setMinDim(form_width);
 
@@ -261,68 +354,39 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params)
 	{
 		(*it)->translate(0, delta_y);
 	}
-}
 
-void LLWindowShade::show()
-{
 	getChildRef<LLLayoutPanel>("notification_area").setVisible(true);
 	getChildRef<LLLayoutPanel>("background_area").setBackgroundVisible(mModal);
 
 	setMouseOpaque(mModal);
 }
 
-void LLWindowShade::draw()
+void LLWindowShade::setBackgroundImage(LLUIImage* image)
 {
-	LLRect message_rect = getChild<LLTextBox>("notification_text")->getTextBoundingRect();
-
-	LLLayoutPanel* notification_area = getChild<LLLayoutPanel>("notification_area");
-
-	notification_area->reshape(notification_area->getRect().getWidth(), 
-		llclamp(message_rect.getHeight() + 10, 
-				llmin(mFormHeight, MAX_NOTIFICATION_AREA_HEIGHT),
-				MAX_NOTIFICATION_AREA_HEIGHT));
-
-	LLUICtrl::draw();
-	if (mNotification && !mNotification->isActive())
-	{
-		hide();
-	}
+	getChild<LLLayoutPanel>("notification_area")->setTransparentImage(image);
 }
 
-void LLWindowShade::hide()
+void LLWindowShade::setTextColor(LLColor4 color)
 {
-	getChildRef<LLLayoutPanel>("notification_area").setVisible(false);
-	getChildRef<LLLayoutPanel>("background_area").setBackgroundVisible(false);
-
-	setMouseOpaque(false);
+	getChild<LLTextBox>("notification_text")->setColor(color);
 }
 
-void LLWindowShade::onCloseNotification()
+bool LLWindowShade::isShown() const
 {
-	LLNotifications::instance().cancel(mNotification);
+	return getChildRef<LLLayoutPanel>("notification_area").getVisible();
 }
 
-void LLWindowShade::onClickIgnore(LLUICtrl* ctrl)
+void LLWindowShade::setCanClose(bool can_close)
 {
-	bool check = ctrl->getValue().asBoolean();
-	if (mNotification && mNotification->getForm()->getIgnoreType() == LLNotificationForm::IGNORE_SHOW_AGAIN)
-	{
-		// question was "show again" so invert value to get "ignore"
-		check = !check;
-	}
-	mNotification->setIgnored(check);
+	getChildView("close_panel")->setVisible(can_close);
 }
 
-void LLWindowShade::onClickNotificationButton(const std::string& name)
+LLNotificationPtr LLWindowShade::getCurrentNotification()
 {
-	if (!mNotification) return;
-
-	mNotificationResponse[name] = true;
-
-	mNotification->respond(mNotificationResponse);
+	if (mNotifications.empty())
+	{
+		return LLNotificationPtr();
+	}
+	return mNotifications.back();
 }
 
-void LLWindowShade::onEnterNotificationText(LLUICtrl* ctrl, const std::string& name)
-{
-	mNotificationResponse[name] = ctrl->getValue().asString();
-}
diff --git a/indra/llui/llwindowshade.h b/indra/llui/llwindowshade.h
index 09ffc2cd54ba26fe487480c8244d726fd0ff0974..6d753d1161047ae5f3784e6e8eddf19641326447 100644
--- a/indra/llui/llwindowshade.h
+++ b/indra/llui/llwindowshade.h
@@ -36,20 +36,28 @@ class LLWindowShade : public LLUICtrl
 public:
 	struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
 	{
-		Mandatory<LLNotificationPtr>	notification;
 		Optional<LLUIImage*>			bg_image;
-		Optional<LLUIColor>				text_color;
+		Optional<LLUIColor>				text_color,
+										shade_color;
 		Optional<bool>					modal,
 										can_close;
 
 		Params();
 	};
 
-	void show();
+	void show(LLNotificationPtr);
 	/*virtual*/ void draw();
 	void hide();
+	
+	bool isShown() const;
+
+	void setBackgroundImage(LLUIImage* image);
+	void setTextColor(LLColor4 color);
+	void setCanClose(bool can_close);
 
 private:
+	void displayLatestNotification();
+	LLNotificationPtr getCurrentNotification();
 	friend class LLUICtrlFactory;
 
 	LLWindowShade(const Params& p);
@@ -60,7 +68,7 @@ class LLWindowShade : public LLUICtrl
 	void onEnterNotificationText(LLUICtrl* ctrl, const std::string& name);
 	void onClickIgnore(LLUICtrl* ctrl);
 
-	LLNotificationPtr	mNotification;
+	std::vector<LLNotificationPtr>	mNotifications;
 	LLSD				mNotificationResponse;
 	bool				mModal;
 	S32					mFormHeight;
diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp
index 4f251db93bb42def54896da5a95b9fdf8ef1ab6a..c75df868918d1f67350fdd0d5c5ac711be0a0709 100644
--- a/indra/llui/tests/llurlentry_stub.cpp
+++ b/indra/llui/tests/llurlentry_stub.cpp
@@ -105,8 +105,6 @@ LLStyle::Params::Params()
 
 namespace LLInitParam
 {
-	BaseBlock::BaseBlock() {}
-	BaseBlock::~BaseBlock() {}
 	Param::Param(BaseBlock* enclosing_block)
 	:	mIsProvided(false)
 	{
@@ -114,7 +112,6 @@ namespace LLInitParam
 		const U8* block_addr = reinterpret_cast<const U8*>(enclosing_block);
 		mEnclosingBlockOffset = (U16)(my_addr - block_addr);
 	}
-	void BaseBlock::paramChanged(const Param& last_param, bool user_provided) {}
 
 	void BaseBlock::addParam(BlockDescriptor& block_data, const ParamDescriptorPtr in_param, const char* char_name){}
 	void BaseBlock::addSynonym(Param& param, const std::string& synonym) {}
diff --git a/indra/llui/tests/llurlmatch_test.cpp b/indra/llui/tests/llurlmatch_test.cpp
index 627f3129e93608efafcc6513554479d13136e2c9..7183413463fabf21b587d1fc2446a0b7de6dbd61 100644
--- a/indra/llui/tests/llurlmatch_test.cpp
+++ b/indra/llui/tests/llurlmatch_test.cpp
@@ -63,9 +63,6 @@ S32 LLUIImage::getHeight() const
 
 namespace LLInitParam
 {
-	BaseBlock::BaseBlock() {}
-	BaseBlock::~BaseBlock() {}
-
 	BlockDescriptor::BlockDescriptor() {}
 	ParamDescriptor::ParamDescriptor(param_handle_t p, 
 						merge_func_t merge_func, 
@@ -77,8 +74,6 @@ namespace LLInitParam
 						S32 max_count){}
 	ParamDescriptor::~ParamDescriptor() {}
 
-	void BaseBlock::paramChanged(const Param& last_param, bool user_provided) {}
-
 	void BaseBlock::addParam(BlockDescriptor& block_data, const ParamDescriptorPtr in_param, const char* char_name){}
 	param_handle_t BaseBlock::getHandleFromParam(const Param* param) const {return 0;}
 	void BaseBlock::addSynonym(Param& param, const std::string& synonym) {}
diff --git a/indra/llvfs/lllfsthread.cpp b/indra/llvfs/lllfsthread.cpp
index 3d3ed9f6d4d32f34999a3b36bc659b19461e6a8b..073b1af2a1b3b029231d8d9b6b4710d2f7711a7c 100644
--- a/indra/llvfs/lllfsthread.cpp
+++ b/indra/llvfs/lllfsthread.cpp
@@ -45,7 +45,7 @@ void LLLFSThread::initClass(bool local_is_threaded)
 //static
 S32 LLLFSThread::updateClass(U32 ms_elapsed)
 {
-	sLocal->update(ms_elapsed);
+	sLocal->update((F32)ms_elapsed);
 	return sLocal->getPending();
 }
 
diff --git a/indra/llvfs/llvfsthread.cpp b/indra/llvfs/llvfsthread.cpp
index 254f8b55ba3b4af3e3e7c81e09f5040ae3446f18..a57e2b15abc68f42ee607b48776abbf08fcca717 100644
--- a/indra/llvfs/llvfsthread.cpp
+++ b/indra/llvfs/llvfsthread.cpp
@@ -46,7 +46,7 @@ void LLVFSThread::initClass(bool local_is_threaded)
 //static
 S32 LLVFSThread::updateClass(U32 ms_elapsed)
 {
-	sLocal->update(ms_elapsed);
+	sLocal->update((F32)ms_elapsed);
 	return sLocal->getPending();
 }
 
diff --git a/indra/llwindow/lldragdropwin32.cpp b/indra/llwindow/lldragdropwin32.cpp
index d4d444eb2886c4e3b08742e66cc13cc9f7ff8654..15acddd987682a605ce90c0e5a449ada22c26e50 100644
--- a/indra/llwindow/lldragdropwin32.cpp
+++ b/indra/llwindow/lldragdropwin32.cpp
@@ -124,10 +124,9 @@ class LLDragDropWin32Target:
 						ScreenToClient( mAppWindowHandle, &pt2 );
 
 						LLCoordWindow cursor_coord_window( pt2.x, pt2.y );
-						window_imp->convertCoords(cursor_coord_window, &gl_coord);
 						MASK mask = gKeyboard->currentMask(TRUE);
 
-						LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( gl_coord, mask, 
+						LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( cursor_coord_window.convert(), mask, 
 							LLWindowCallbacks::DNDA_START_TRACKING, mDropUrl );
 
 						switch (result)
@@ -180,10 +179,9 @@ class LLDragDropWin32Target:
 					ScreenToClient( mAppWindowHandle, &pt2 );
 
 					LLCoordWindow cursor_coord_window( pt2.x, pt2.y );
-					window_imp->convertCoords(cursor_coord_window, &gl_coord);
 					MASK mask = gKeyboard->currentMask(TRUE);
 
-					LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( gl_coord, mask, 
+					LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( cursor_coord_window.convert(), mask, 
 						LLWindowCallbacks::DNDA_TRACK, mDropUrl );
 					
 					switch (result)
@@ -237,15 +235,13 @@ class LLDragDropWin32Target:
 				LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong( mAppWindowHandle, GWL_USERDATA );
 				if ( NULL != window_imp )
 				{
-					LLCoordGL gl_coord( 0, 0 );
-
 					POINT pt_client;
 					pt_client.x = pt.x;
 					pt_client.y = pt.y;
 					ScreenToClient( mAppWindowHandle, &pt_client );
 
 					LLCoordWindow cursor_coord_window( pt_client.x, pt_client.y );
-					window_imp->convertCoords(cursor_coord_window, &gl_coord);
+					LLCoordGL gl_coord(cursor_coord_window.convert());
 					llinfos << "### (Drop) URL is: " << mDropUrl << llendl;
 					llinfos << "###        raw coords are: " << pt.x << " x " << pt.y << llendl;
 					llinfos << "###	    client coords are: " << pt_client.x << " x " << pt_client.y << llendl;
diff --git a/indra/llwindow/llmousehandler.h b/indra/llwindow/llmousehandler.h
index bbbc3d4406b9ac4bb849db4f4e7656dcaef9c38b..d825a3424c0bb2524b718ad87a75fa3fc2bccf16 100644
--- a/indra/llwindow/llmousehandler.h
+++ b/indra/llwindow/llmousehandler.h
@@ -65,7 +65,7 @@ class LLMouseHandler
 	virtual BOOL	handleHover(S32 x, S32 y, MASK mask) = 0;
 	virtual BOOL	handleScrollWheel(S32 x, S32 y, S32 clicks) = 0;
 	virtual BOOL	handleToolTip(S32 x, S32 y, MASK mask) = 0;
-	virtual std::string getName() const = 0;
+	virtual const std::string& getName() const = 0;
 
 	virtual void	onMouseCaptureLost() = 0;
 
diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp
index dc3a1099b112a56ddeef08e54c82e65023391c84..5b7424acbb69dcf2762f78236ef68e96342c1e87 100644
--- a/indra/llwindow/llwindow.cpp
+++ b/indra/llwindow/llwindow.cpp
@@ -108,9 +108,12 @@ LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags)
 	  mSupportedResolutions(NULL),
 	  mNumSupportedResolutions(0),
 	  mCurrentCursor(UI_CURSOR_ARROW),
+	  mNextCursor(UI_CURSOR_ARROW),
 	  mCursorHidden(FALSE),
 	  mBusyCount(0),
 	  mIsMouseClipping(FALSE),
+	  mMinWindowWidth(0),
+	  mMinWindowHeight(0),
 	  mSwapMethod(SWAP_METHOD_UNDEFINED),
 	  mHideCursorPermanent(FALSE),
 	  mFlags(flags),
@@ -179,6 +182,51 @@ void *LLWindow::getMediaWindow()
 	return getPlatformWindow();
 }
 
+BOOL LLWindow::setSize(LLCoordScreen size)
+{
+	if (!getMaximized())
+	{
+		size.mX = llmax(size.mX, mMinWindowWidth);
+		size.mY = llmax(size.mY, mMinWindowHeight);
+	}
+	return setSizeImpl(size);
+}
+
+BOOL LLWindow::setSize(LLCoordWindow size)
+{
+	//HACK: we are inconsistently using minimum window dimensions
+	// in this case, we are constraining the inner "client" rect and other times
+	// we constrain the outer "window" rect
+	// There doesn't seem to be a good way to do this consistently without a bunch of platform
+	// specific code
+	if (!getMaximized())
+	{
+		size.mX = llmax(size.mX, mMinWindowWidth);
+		size.mY = llmax(size.mY, mMinWindowHeight);
+	}
+	return setSizeImpl(size);
+}
+
+
+// virtual
+void LLWindow::setMinSize(U32 min_width, U32 min_height, bool enforce_immediately)
+{
+	mMinWindowWidth = min_width;
+	mMinWindowHeight = min_height;
+
+	if (enforce_immediately)
+	{
+		LLCoordScreen cur_size;
+		if (!getMaximized() && getSize(&cur_size))
+		{
+			if (cur_size.mX < mMinWindowWidth || cur_size.mY < mMinWindowHeight)
+			{
+				setSizeImpl(LLCoordScreen(llmin(cur_size.mX, mMinWindowWidth), llmin(cur_size.mY, mMinWindowHeight)));
+			}
+		}
+	}
+}
+
 //virtual
 void LLWindow::processMiscNativeEvents()
 {
@@ -403,3 +451,42 @@ BOOL LLWindowManager::isWindowValid(LLWindow *window)
 {
 	return sWindowList.find(window) != sWindowList.end();
 }
+
+//coordinate conversion utility funcs that forward to llwindow
+LLCoordCommon LL_COORD_TYPE_WINDOW::convertToCommon() const
+{
+	const LLCoordWindow& self = LLCoordWindow::getTypedCoords(*this);
+
+	LLWindow* windowp = &(*LLWindow::beginInstances());
+	LLCoordGL out;
+	windowp->convertCoords(self, &out);
+	return out.convert();
+}
+
+void LL_COORD_TYPE_WINDOW::convertFromCommon(const LLCoordCommon& from)
+{
+	LLCoordWindow& self = LLCoordWindow::getTypedCoords(*this);
+
+	LLWindow* windowp = &(*LLWindow::beginInstances());
+	LLCoordGL from_gl(from);
+	windowp->convertCoords(from_gl, &self);
+}
+
+LLCoordCommon LL_COORD_TYPE_SCREEN::convertToCommon() const
+{
+	const LLCoordScreen& self = LLCoordScreen::getTypedCoords(*this);
+
+	LLWindow* windowp = &(*LLWindow::beginInstances());
+	LLCoordGL out;
+	windowp->convertCoords(self, &out);
+	return out.convert();
+}
+
+void LL_COORD_TYPE_SCREEN::convertFromCommon(const LLCoordCommon& from)
+{
+	LLCoordScreen& self = LLCoordScreen::getTypedCoords(*this);
+
+	LLWindow* windowp = &(*LLWindow::beginInstances());
+	LLCoordGL from_gl(from);
+	windowp->convertCoords(from_gl, &self);
+}
diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h
index e8a86a188072c90f6563f47681d266a4e9eea196..4da87f4e068d64d90f5d039b8e9f3ca0fe890db5 100644
--- a/indra/llwindow/llwindow.h
+++ b/indra/llwindow/llwindow.h
@@ -39,7 +39,7 @@ class LLWindowCallbacks;
 
 // Refer to llwindow_test in test/common/llwindow for usage example
 
-class LLWindow
+class LLWindow : public LLInstanceTracker<LLWindow>
 {
 public:
 	struct LLWindowResolution
@@ -72,7 +72,9 @@ class LLWindow
 	virtual BOOL getSize(LLCoordScreen *size) = 0;
 	virtual BOOL getSize(LLCoordWindow *size) = 0;
 	virtual BOOL setPosition(LLCoordScreen position) = 0;
-	virtual BOOL setSize(LLCoordScreen size) = 0;
+	BOOL setSize(LLCoordScreen size);
+	BOOL setSize(LLCoordWindow size);
+	virtual void setMinSize(U32 min_width, U32 min_height, bool enforce_immediately = true);
 	virtual BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) = 0;
 	virtual BOOL setCursorPosition(LLCoordWindow position) = 0;
 	virtual BOOL getCursorPosition(LLCoordWindow *position) = 0;
@@ -91,8 +93,9 @@ class LLWindow
 	virtual S32 getBusyCount() const;
 
 	// Sets cursor, may set to arrow+hourglass
-	virtual void setCursor(ECursorType cursor) = 0;
+	virtual void setCursor(ECursorType cursor) { mNextCursor = cursor; };
 	virtual ECursorType getCursor() const;
+	virtual void updateCursor() = 0;
 
 	virtual void captureMouse() = 0;
 	virtual void releaseMouse() = 0;
@@ -169,6 +172,9 @@ class LLWindow
 	// Defaults to true
 	virtual BOOL canDelete();
 
+	virtual BOOL setSizeImpl(LLCoordScreen size) = 0;
+	virtual BOOL setSizeImpl(LLCoordWindow size) = 0;
+
 protected:
 	LLWindowCallbacks*	mCallbacks;
 
@@ -181,6 +187,7 @@ class LLWindow
 	LLWindowResolution* mSupportedResolutions;
 	S32			mNumSupportedResolutions;
 	ECursorType	mCurrentCursor;
+	ECursorType	mNextCursor;
 	BOOL		mCursorHidden;
 	S32			mBusyCount;	// how deep is the "cursor busy" stack?
 	BOOL		mIsMouseClipping;  // Is this window currently clipping the mouse
@@ -188,6 +195,8 @@ class LLWindow
 	BOOL		mHideCursorPermanent;
 	U32			mFlags;
 	U16			mHighSurrogate;
+	S32			mMinWindowWidth;
+	S32			mMinWindowHeight;
 
  	// Handle a UTF-16 encoding unit received from keyboard.
  	// Converting the series of UTF-16 encoding units to UTF-32 data,
diff --git a/indra/llwindow/llwindowcallbacks.cpp b/indra/llwindow/llwindowcallbacks.cpp
index c2705bbf746e3b5ef209c9d29515bc06f8e9195e..9712ae1d91a39111a0db162da0055a5214d16732 100644
--- a/indra/llwindow/llwindowcallbacks.cpp
+++ b/indra/llwindow/llwindowcallbacks.cpp
@@ -28,8 +28,6 @@
 
 #include "llwindowcallbacks.h"
 
-#include "llcoord.h"
-
 //
 // LLWindowCallbacks
 //
diff --git a/indra/llwindow/llwindowcallbacks.h b/indra/llwindow/llwindowcallbacks.h
index 8572b442f1d2ddcfaf31f5f16be997bfdeb3fd2d..7da5959700ce51a8fcf720a16e2cc799b57afadd 100644
--- a/indra/llwindow/llwindowcallbacks.h
+++ b/indra/llwindow/llwindowcallbacks.h
@@ -26,7 +26,7 @@
 #ifndef LLWINDOWCALLBACKS_H
 #define LLWINDOWCALLBACKS_H
 
-class LLCoordGL;
+#include "llcoord.h"
 class LLWindow;
 
 class LLWindowCallbacks
diff --git a/indra/llwindow/llwindowheadless.h b/indra/llwindow/llwindowheadless.h
index ac53e6a86ee833f70383393dd56ab065f7fdc441..1f767f4c97d65716942ba819684b4fc217478951 100644
--- a/indra/llwindow/llwindowheadless.h
+++ b/indra/llwindow/llwindowheadless.h
@@ -46,7 +46,8 @@ class LLWindowHeadless : public LLWindow
 	/*virtual*/ BOOL getSize(LLCoordScreen *size) {return FALSE;};
 	/*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;};
 	/*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;};
-	/*virtual*/ BOOL setSize(LLCoordScreen size) {return FALSE;};
+	/*virtual*/ BOOL setSizeImpl(LLCoordScreen size) {return FALSE;};
+	/*virtual*/ BOOL setSizeImpl(LLCoordWindow size) {return FALSE;};
 	/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) {return FALSE;};
 	/*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;};
 	/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;};
@@ -55,7 +56,7 @@ class LLWindowHeadless : public LLWindow
 	/*virtual*/ void showCursorFromMouseMove() {};
 	/*virtual*/ void hideCursorUntilMouseMove() {};
 	/*virtual*/ BOOL isCursorHidden() {return FALSE;};
-	/*virtual*/ void setCursor(ECursorType cursor) {};
+	/*virtual*/ void updateCursor() {};
 	//virtual ECursorType getCursor() { return mCurrentCursor; };
 	/*virtual*/ void captureMouse() {};
 	/*virtual*/ void releaseMouse() {};
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 80575067360f8b985f34c168d71747c61df958a3..32bb84cba59171dfe2450ea77801103682e094e8 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -1,25 +1,25 @@
-/** 
+/**
  * @file llwindowmacosx.cpp
  * @brief Platform-dependent implementation of llwindow
  *
  * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  * Second Life Viewer Source Code
  * Copyright (C) 2010, Linden Research, Inc.
- * 
+ *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation;
  * version 2.1 of the License only.
- * 
+ *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
+ *
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
@@ -220,10 +220,10 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
 	// Route them to a dummy callback structure until the end of constructor.
 	LLWindowCallbacks null_callbacks;
 	mCallbacks = &null_callbacks;
-	
+
 	// Voodoo for calling cocoa from carbon (see llwindowmacosx-objc.mm).
 	setupCocoa();
-	
+
 	// Initialize the keyboard
 	gKeyboard = new LLKeyboardMacOSX();
 	gKeyboard->setCallbacks(callbacks);
@@ -254,10 +254,10 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
 	mRawKeyEvent = NULL;
 	mFSAASamples = fsaa_samples;
 	mForceRebuild = FALSE;
-	
+
 	// For reasons that aren't clear to me, LLTimers seem to be created in the "started" state.
 	// Since the started state of this one is used to track whether the NMRec has been installed, it wants to start out in the "stopped" state.
-	mBounceTimer.stop();	
+	mBounceTimer.stop();
 
 	// Get the original aspect ratio of the main device.
 	mOriginalAspectRatio = (double)CGDisplayPixelsWide(mDisplay) / (double)CGDisplayPixelsHigh(mDisplay);
@@ -270,7 +270,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
 	mMoveEventCampartorUPP = NewEventComparatorUPP(staticMoveEventComparator);
 	mGlobalHandlerRef = NULL;
 	mWindowHandlerRef = NULL;
-	
+
 	mDragOverrideCursor = -1;
 
 	// We're not clipping yet
@@ -445,7 +445,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 			mFullscreenBits    = -1;
 			mFullscreenRefresh = -1;
 
-			std::string error= llformat("Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);	
+			std::string error= llformat("Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);
 			OSMessageBox(error, "Error", OSMB_OK);
 		}
 	}
@@ -477,7 +477,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 			kFirstWindowOfClass,
 			true,
 			(long)this);
-		
+
 		if (!mWindow)
 		{
 			setupFailure("Window creation error", "Error", OSMB_OK);
@@ -493,7 +493,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 		InstallStandardEventHandler(GetWindowEventTarget(mWindow));
 		InstallWindowEventHandler(mWindow, mEventHandlerUPP, GetEventTypeCount (WindowHandlerEventList), WindowHandlerEventList, (void*)this, &mWindowHandlerRef); // add event handler
 #if LL_OS_DRAGDROP_ENABLED
-		InstallTrackingHandler( dragTrackingHandler, mWindow, (void*)this );		
+		InstallTrackingHandler( dragTrackingHandler, mWindow, (void*)this );
 		InstallReceiveHandler( dragReceiveHandler, mWindow, (void*)this );
 #endif // LL_OS_DRAGDROP_ENABLED
 	}
@@ -790,7 +790,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 		LL_DEBUGS("GLinit") << "Keeping vertical sync" << LL_ENDL;
 		frames_per_swap = 1;
 	}
-	aglSetInteger(mContext, AGL_SWAP_INTERVAL, &frames_per_swap);  
+	aglSetInteger(mContext, AGL_SWAP_INTERVAL, &frames_per_swap);
 
 	//enable multi-threaded OpenGL
 	if (sUseMultGL)
@@ -803,7 +803,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 		if (cgl_err != kCGLNoError )
 		{
 			LL_DEBUGS("GLInit") << "Multi-threaded OpenGL not available." << LL_ENDL;
-		}    
+		}
 		else
 		{
 			LL_DEBUGS("GLInit") << "Multi-threaded OpenGL enabled." << LL_ENDL;
@@ -1109,7 +1109,7 @@ BOOL LLWindowMacOSX::maximize()
 	{
 		ZoomWindow(mWindow, inContent, true);
 	}
-	
+
 	return mMaximized;
 }
 
@@ -1164,6 +1164,8 @@ void LLWindowMacOSX::gatherInput()
 
 		}
 	}
+	
+	updateCursor();
 }
 
 BOOL LLWindowMacOSX::getPosition(LLCoordScreen *position)
@@ -1254,7 +1256,7 @@ BOOL LLWindowMacOSX::setPosition(const LLCoordScreen position)
 	return TRUE;
 }
 
-BOOL LLWindowMacOSX::setSize(const LLCoordScreen size)
+BOOL LLWindowMacOSX::setSizeImpl(const LLCoordScreen size)
 {
 	if(mWindow)
 	{
@@ -1264,9 +1266,33 @@ BOOL LLWindowMacOSX::setSize(const LLCoordScreen size)
 	return TRUE;
 }
 
+BOOL LLWindowMacOSX::setSizeImpl(const LLCoordWindow size)
+{
+	Rect client_rect;
+	if (mWindow)
+	{
+		OSStatus err = GetWindowBounds(mWindow, kWindowContentRgn, &client_rect);
+		if (err == noErr)
+		{
+			client_rect.right = client_rect.left + size.mX;
+			client_rect.bottom = client_rect.top + size.mY;
+			err = SetWindowBounds(mWindow, kWindowContentRgn, &client_rect);
+		}
+		if (err == noErr)
+		{
+			return TRUE;
+		}
+		else
+		{
+			llinfos << "Error setting size" << err << llendl;
+			return FALSE;
+		}
+	}
+	return FALSE;
+}
+
 void LLWindowMacOSX::swapBuffers()
 {
-	glFinish();
 	aglSwapBuffers(mContext);
 }
 
@@ -1433,7 +1459,7 @@ static void fixOrigin(void)
 	GrafPtr port;
 	Rect portrect;
 
-	::GetPort(&port);	
+	::GetPort(&port);
 	::GetPortBounds(port, &portrect);
 	if((portrect.left != 0) || (portrect.top != 0))
 	{
@@ -1447,17 +1473,17 @@ BOOL LLWindowMacOSX::getCursorPosition(LLCoordWindow *position)
 	Point cursor_point;
 	LLCoordScreen screen_pos;
 	GrafPtr save;
-	
+
 	if(mWindow == NULL)
 		return FALSE;
-		
+
 	::GetPort(&save);
 	::SetPort(GetWindowPort(mWindow));
 	fixOrigin();
 
 	// gets the mouse location in local coordinates
 	::GetMouse(&cursor_point);
-	
+
 //	lldebugs << "getCursorPosition(): cursor is at " << cursor_point.h << ", " << cursor_point.v << "  port origin: " << portrect.left << ", " << portrect.top << llendl;
 
 	::SetPort(save);
@@ -1522,7 +1548,7 @@ F32 LLWindowMacOSX::getNativeAspectRatio()
 	{
 		// The constructor for this class grabs the aspect ratio of the monitor before doing any resolution
 		// switching, and stashes it in mOriginalAspectRatio.  Here, we just return it.
-	
+
 		if (mOverrideAspectRatio > 0.f)
 		{
 			return mOverrideAspectRatio;
@@ -1997,7 +2023,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 					if (mPreeditor
 						&& (result = GetEventParameter(event, kEventParamTextInputSendFixLen,
 										typeLongInteger, &param_type, sizeof(fix_len), NULL, &fix_len)) == noErr
-						&& typeLongInteger == param_type 
+						&& typeLongInteger == param_type
 						&& (result = GetEventParameter(event, kEventParamTextInputSendText,
 										typeUnicodeText, &param_type, 0, &text_len, NULL)) == noErr
 						&& typeUnicodeText == param_type)
@@ -2017,7 +2043,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 							mPreeditor->markAsPreedit(location, length);
 						}
 						mPreeditor->resetPreedit();
-						
+
 						// Receive the text from input method.
 						U16 *const text = new U16[text_len / sizeof(U16)];
 						GetEventParameter(event, kEventParamTextInputSendText, typeUnicodeText, NULL, text_len, NULL, text);
@@ -2056,11 +2082,11 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 							GetEventParameter(event, kEventParamTextInputSendHiliteRng, typeTextRangeArray,
 									NULL, text_range_array_size, NULL, text_range_array);
 
-							// WARNING: We assume ranges are in ascending order, 
+							// WARNING: We assume ranges are in ascending order,
 							// although the condition is undocumented.  It seems
 							// OK to assume this.  I also assumed
 							// the ranges are contiguous in previous versions, but I
-							// have heard a rumore that older versions os ATOK may 
+							// have heard a rumore that older versions os ATOK may
 							// return ranges with some _gap_.  I don't know whether
 							// it is true, but I'm preparing my code for the case.
 
@@ -2124,7 +2150,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 					}
 				}
 				break;
-				
+
 			case kEventTextInputUnicodeForKeyEvent:
 				{
 					UInt32 modifiers = 0;
@@ -2133,7 +2159,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 					// First, process the raw event.
 					{
 						EventRef rawEvent = NULL;
-						
+
 						// Get the original event and extract the modifier keys, so we can ignore command-key events.
 						if (GetEventParameter(event, kEventParamTextInputSendKeyboardEvent, typeEventRef, NULL, sizeof(rawEvent), NULL, &rawEvent) == noErr)
 						{
@@ -2142,7 +2168,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 
 							// and call this function recursively to handle the raw key event.
 							eventHandler (myHandler, rawEvent);
-							
+
 							// save the raw event until we're done processing the unicode input as well.
 							mRawKeyEvent = rawEvent;
 						}
@@ -2173,7 +2199,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 						else
 						{
 							MASK mask = LLWindowMacOSX::modifiersToMask(modifiers);
-							
+
 							llassert( actualType == typeUnicodeText );
 
 							// The result is a UTF16 buffer.  Pass the characters in turn to handleUnicodeChar.
@@ -2199,7 +2225,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 					result = err;
 				}
 				break;
-				
+
 			case kEventTextInputOffsetToPos:
 				{
 					EventParamType param_type;
@@ -2212,7 +2238,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 						S32 preedit, preedit_length;
 						mPreeditor->getPreeditRange(&preedit, &preedit_length);
 						const LLWString & text = mPreeditor->getPreeditString();
-						 
+
 						LLCoordGL caret_coord;
 						LLRect preedit_bounds;
 						if (0 <= offset
@@ -2226,10 +2252,10 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 							qd_point.h = caret_base_coord_screen.mX;
 							qd_point.v = caret_base_coord_screen.mY;
 							SetEventParameter(event, kEventParamTextInputReplyPoint, typeQDPoint, sizeof(qd_point), &qd_point);
-							
+
 							short line_height = (short) preedit_bounds.getHeight();
 							SetEventParameter(event, kEventParamTextInputReplyLineHeight, typeShortInteger, sizeof(line_height), &line_height);
-							
+
 							result = noErr;
 						}
 						else
@@ -2282,7 +2308,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 			case kEventRawKeyRepeat:
 				if (gDebugWindowProc)
 				{
-					printf("key down, key code = 0x%08x, char code = 0x%02x (%c), modifiers = 0x%08x\n", 
+					printf("key down, key code = 0x%08x, char code = 0x%02x (%c), modifiers = 0x%08x\n",
 							(unsigned int)keyCode, charCode, (char)charCode, (unsigned int)modifiers);
 					fflush(stdout);
 				}
@@ -2293,7 +2319,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 			case kEventRawKeyUp:
 				if (gDebugWindowProc)
 				{
-					printf("key up,   key code = 0x%08x, char code = 0x%02x (%c), modifiers = 0x%08x\n", 
+					printf("key up,   key code = 0x%08x, char code = 0x%02x (%c), modifiers = 0x%08x\n",
 							(unsigned int)keyCode, charCode, (char)charCode, (unsigned int)modifiers);
 					fflush(stdout);
 				}
@@ -2351,7 +2377,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 				}
 
 				// When the state of the 'Fn' key (the one that changes some of the mappings on a powerbook/macbook keyboard
-				// to an embedded keypad) changes, it may subsequently cause a key up event to be lost, which may lead to 
+				// to an embedded keypad) changes, it may subsequently cause a key up event to be lost, which may lead to
 				// a movement key getting "stuck" down.  This is bad.
 				// This is an OS bug -- even the GetKeys() API doesn't tell you the key has been released.
 				// This workaround causes all held-down keys to be reset whenever the state of the Fn key changes.  This isn't
@@ -2361,14 +2387,14 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 					if (gDebugWindowProc) printf("Fn key state change event\n");
 					gKeyboard->resetKeys();
 				}
-				
+
 				if (gDebugWindowProc) fflush(stdout);
 
 				mLastModifiers = modifiers;
 				result = eventNotHandledErr;
 				break;
 			}
-			
+
 			mRawKeyEvent = NULL;
 		}
 		break;
@@ -2463,7 +2489,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 					case kEventMouseButtonSecondary:
 						mCallbacks->handleRightMouseDown(this, outCoords, mask);
 						break;
-					
+
 					case kEventMouseButtonTertiary:
 						mCallbacks->handleMiddleMouseDown(this, outCoords, mask);
 						break;
@@ -2525,7 +2551,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 
 	case kEventClassWindow:
 		switch(evtKind)
-		{		
+		{
 		case kEventWindowActivated:
 			if (mTSMDocument)
 			{
@@ -2540,20 +2566,20 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 			}
 			mCallbacks->handleFocusLost(this);
 			break;
-			
+
 		case kEventWindowBoundsChanging:
 			{
 				// This is where we would constrain move/resize to a particular screen
 
-				const S32 MIN_WIDTH  = 1024;
-				const S32 MIN_HEIGHT = 768;
-				
+				const S32 MIN_WIDTH  = mMinWindowWidth;
+				const S32 MIN_HEIGHT = mMinWindowHeight;
+
 				Rect currentBounds;
 				Rect previousBounds;
 
 				GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &currentBounds);
 				GetEventParameter(event, kEventParamPreviousBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &previousBounds);
-				
+
 				// Put an offset into window un-maximize operation since the kEventWindowGetIdealSize
 				// event only allows the specification of size and not position.
 				if (mMaximized)
@@ -2561,7 +2587,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 					short leftOffset = mPreviousWindowRect.left - currentBounds.left;
 					currentBounds.left += leftOffset;
 					currentBounds.right += leftOffset;
-					
+
 					short topOffset = mPreviousWindowRect.top - currentBounds.top;
 					currentBounds.top += topOffset;
 					currentBounds.bottom += topOffset;
@@ -2581,7 +2607,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 				{
 					currentBounds.bottom = currentBounds.top + MIN_HEIGHT;
 				}
-				
+
 				SetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, sizeof(Rect), &currentBounds);
 				result = noErr;
 			}
@@ -2592,38 +2618,38 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 				// Get new window bounds
 				Rect newBounds;
 				GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &newBounds);
-				
+
 				// Get previous window bounds
 				Rect oldBounds;
 				GetEventParameter(event, kEventParamPreviousBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &oldBounds);
-				
+
 				// Determine if the new size is larger than the old
 				bool newBoundsLarger = ((newBounds.right - newBounds.left) >= (oldBounds.right - oldBounds.left));
 				newBoundsLarger &= ((newBounds.bottom - newBounds.top) >= (oldBounds.bottom - oldBounds.top));
-				
+
 				// Check to see if this is a zoom event (+ button on window pane)
 				unsigned int eventParams;
 				GetEventParameter(event, kEventParamAttributes, typeUInt32, NULL, sizeof(int), NULL, &eventParams);
 				bool isZoomEvent = ((eventParams & kWindowBoundsChangeZoom) != 0);
-				
+
 				// Maximized flag is if zoom event and increasing window size
 				mMaximized = (isZoomEvent && newBoundsLarger);
-				
+
 				aglUpdateContext(mContext);
-				
+
 				mCallbacks->handleResize(this, newBounds.right - newBounds.left, newBounds.bottom - newBounds.top);
 			}
 			break;
-			
+
 		case kEventWindowGetIdealSize:
 			// Only recommend a new ideal size when un-maximizing
 			if (mMaximized == TRUE)
 			{
 				Point nonMaximizedSize;
-				
+
 				nonMaximizedSize.v = mPreviousWindowRect.bottom - mPreviousWindowRect.top;
 				nonMaximizedSize.h = mPreviousWindowRect.right - mPreviousWindowRect.left;
-				
+
 				SetEventParameter(event, kEventParamDimensions, typeQDPoint, sizeof(Point), &nonMaximizedSize);
 				result = noErr;
 			}
@@ -2678,7 +2704,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 		if (mPreeditor)
 		{
 			switch(evtKind)
-			{		
+			{
 
 			case kEventTSMDocumentAccessGetLength:
 				{
@@ -2697,14 +2723,14 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 				{
 					// Return the selected range, excluding preedit.
 					// In our preeditor, preedit and selection are exclusive, so,
-					// when it has a preedit, there is no selection and the 
+					// when it has a preedit, there is no selection and the
 					// insertion point is on the preedit that corrupses into the
 					// beginning of the preedit when the preedit was removed.
 
 					S32 preedit, preedit_length;
 					mPreeditor->getPreeditRange(&preedit, &preedit_length);
 					const LLWString & text = mPreeditor->getPreeditString();
-					
+
 					CFRange range;
 					if (preedit_length)
 					{
@@ -2768,7 +2794,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 						memcpy(target_pointer, text_utf16.c_str() + range.location, range.length * sizeof(UniChar));
 
 						// Note that result has already been set above.
-					}					
+					}
 				}
 				break;
 
@@ -2815,14 +2841,14 @@ const char* cursorIDToName(int id)
 		case UI_CURSOR_TOOLPLAY:		return "UI_CURSOR_TOOLPLAY";
 		case UI_CURSOR_TOOLPAUSE:		return "UI_CURSOR_TOOLPAUSE";
 		case UI_CURSOR_TOOLMEDIAOPEN:	return "UI_CURSOR_TOOLMEDIAOPEN";
-		case UI_CURSOR_PIPETTE:			return "UI_CURSOR_PIPETTE";		
+		case UI_CURSOR_PIPETTE:			return "UI_CURSOR_PIPETTE";
 		case UI_CURSOR_TOOLSIT:			return "UI_CURSOR_TOOLSIT";
 		case UI_CURSOR_TOOLBUY:			return "UI_CURSOR_TOOLBUY";
 		case UI_CURSOR_TOOLOPEN:		return "UI_CURSOR_TOOLOPEN";
 	}
 
 	llerrs << "cursorIDToName: unknown cursor id" << id << llendl;
-	
+
 	return "UI_CURSOR_ARROW";
 }
 
@@ -2838,42 +2864,42 @@ static void initPixmapCursor(int cursorid, int hotspotX, int hotspotY)
 	fullpath += gDirUtilp->getDirDelimiter();
 	fullpath += cursorIDToName(cursorid);
 	fullpath += ".tif";
-	
+
 	gCursors[cursorid] = createImageCursor(fullpath.c_str(), hotspotX, hotspotY);
 }
 
-void LLWindowMacOSX::setCursor(ECursorType cursor)
+void LLWindowMacOSX::updateCursor()
 {
 	OSStatus result = noErr;
 
-	if (mDragOverrideCursor != -1) 
+	if (mDragOverrideCursor != -1)
 	{
 		// A drag is in progress...remember the requested cursor and we'll
 		// restore it when it is done
-		mCurrentCursor = cursor;
+		mCurrentCursor = mNextCursor;
 		return;
 	}
 		
-	if (cursor == UI_CURSOR_ARROW
+	if (mNextCursor == UI_CURSOR_ARROW
 		&& mBusyCount > 0)
 	{
-		cursor = UI_CURSOR_WORKING;
+		mNextCursor = UI_CURSOR_WORKING;
 	}
 	
-	if(mCurrentCursor == cursor)
+	if(mCurrentCursor == mNextCursor)
 		return;
 
 	// RN: replace multi-drag cursors with single versions
-	if (cursor == UI_CURSOR_ARROWDRAGMULTI)
+	if (mNextCursor == UI_CURSOR_ARROWDRAGMULTI)
 	{
-		cursor = UI_CURSOR_ARROWDRAG;
+		mNextCursor = UI_CURSOR_ARROWDRAG;
 	}
-	else if (cursor == UI_CURSOR_ARROWCOPYMULTI)
+	else if (mNextCursor == UI_CURSOR_ARROWCOPYMULTI)
 	{
-		cursor = UI_CURSOR_ARROWCOPY;
+		mNextCursor = UI_CURSOR_ARROWCOPY;
 	}
 
-	switch(cursor)
+	switch(mNextCursor)
 	{
 	default:
 	case UI_CURSOR_ARROW:
@@ -2924,7 +2950,7 @@ void LLWindowMacOSX::setCursor(ECursorType cursor)
 	case UI_CURSOR_TOOLSIT:
 	case UI_CURSOR_TOOLBUY:
 	case UI_CURSOR_TOOLOPEN:
-		result = setImageCursor(gCursors[cursor]);
+		result = setImageCursor(gCursors[mNextCursor]);
 		break;
 
 	}
@@ -2934,7 +2960,7 @@ void LLWindowMacOSX::setCursor(ECursorType cursor)
 		InitCursor();
 	}
 
-	mCurrentCursor = cursor;
+	mCurrentCursor = mNextCursor;
 }
 
 ECursorType LLWindowMacOSX::getCursor() const
@@ -3269,14 +3295,14 @@ void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url, bool async)
 LLSD LLWindowMacOSX::getNativeKeyData()
 {
 	LLSD result = LLSD::emptyMap();
-	
+
 	if(mRawKeyEvent)
 	{
 		char char_code = 0;
 		UInt32 key_code = 0;
 		UInt32 modifiers = 0;
 		UInt32 keyboard_type = 0;
-		
+
 		GetEventParameter (mRawKeyEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &char_code);
 		GetEventParameter (mRawKeyEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &key_code);
 		GetEventParameter (mRawKeyEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
@@ -3286,7 +3312,7 @@ LLSD LLWindowMacOSX::getNativeKeyData()
 		result["key_code"] = (S32)key_code;
 		result["modifiers"] = (S32)modifiers;
 		result["keyboard_type"] = (S32)keyboard_type;
-		
+
 #if 0
 		// This causes trouble for control characters -- apparently character codes less than 32 (escape, control-A, etc)
 		// cause llsd serialization to create XML that the llsd deserializer won't parse!
@@ -3295,7 +3321,7 @@ LLSD LLWindowMacOSX::getNativeKeyData()
 		EventParamType actualType = typeUTF8Text;
 		UInt32 actualSize = 0;
 		char *buffer = NULL;
-		
+
 		err = GetEventParameter (mRawKeyEvent, kEventParamKeyUnicodes, typeUTF8Text, &actualType, 0, &actualSize, NULL);
 		if(err == noErr)
 		{
@@ -3308,7 +3334,7 @@ LLSD LLWindowMacOSX::getNativeKeyData()
 			}
 			delete[] buffer;
 		}
-		
+
 		result["unicode"] = unicode;
 #endif
 
@@ -3316,7 +3342,7 @@ LLSD LLWindowMacOSX::getNativeKeyData()
 
 
 	lldebugs << "native key data is: " << result << llendl;
-	
+
 	return result;
 }
 
@@ -3363,17 +3389,17 @@ void *LLWindowMacOSX::getPlatformWindow()
 
 void *LLWindowMacOSX::getMediaWindow()
 {
-	/* 
-		Mozilla needs to be initialized with a WindowRef to function properly.  
+	/*
+		Mozilla needs to be initialized with a WindowRef to function properly.
 		(There's no good reason for this, since it shouldn't be interacting with our window in any way, but that's another issue.)
-		If we're in windowed mode, we _could_ hand it our actual window pointer, but a subsequent switch to fullscreen will destroy that window, 
+		If we're in windowed mode, we _could_ hand it our actual window pointer, but a subsequent switch to fullscreen will destroy that window,
 		which trips up Mozilla.
 		Instead of using our actual window, we create an invisible window which will persist for the lifetime of the application and pass that to Mozilla.
 		This satisfies its deep-seated need to latch onto a WindowRef and solves the issue with switching between fullscreen and windowed modes.
 
 		Note that we will never destroy this window (by design!), but since only one will ever be created per run of the application, that's okay.
 	*/
-	
+
 	if(sMediaWindow == NULL)
 	{
 		Rect window_rect = {100, 100, 200, 200};
@@ -3382,13 +3408,13 @@ void *LLWindowMacOSX::getMediaWindow()
 			NULL,
 			&window_rect,
 			(ConstStr255Param) "\p",
-			false,				// Create the window invisible.  
+			false,				// Create the window invisible.
 			zoomDocProc,		// Window with a grow box and a zoom box
 			kLastWindowOfClass,		// create it behind other windows
 			false,					// no close box
 			0);
 	}
-	
+
 	return (void*)sMediaWindow;
 }
 
@@ -3438,7 +3464,7 @@ void LLWindowMacOSX::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b)
 	}
 
 	UseInputWindow(mTSMDocument, !b);
-	
+
 	// Take care of old and new preeditors.
 	if (preeditor != mPreeditor || !b)
 	{
@@ -3457,7 +3483,7 @@ void LLWindowMacOSX::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b)
 		return;
 	}
 	mLanguageTextInputAllowed = b;
-	
+
 	if (b)
 	{
 		if (mTSMScriptCode != smRoman)
@@ -3506,7 +3532,7 @@ MASK LLWindowMacOSX::modifiersToMask(SInt16 modifiers)
 	if(modifiers & (cmdKey | controlKey)) { mask |= MASK_CONTROL; }
 	if(modifiers & optionKey) { mask |= MASK_ALT; }
 	return mask;
-}	
+}
 
 #if LL_OS_DRAGDROP_ENABLED
 
@@ -3517,53 +3543,53 @@ OSErr LLWindowMacOSX::dragTrackingHandler(DragTrackingMessage message, WindowRef
 	LLWindowMacOSX *self = (LLWindowMacOSX*)handlerRefCon;
 
 	lldebugs << "drag tracking handler, message = " << message << llendl;
-	
+
 	switch(message)
 	{
 		case kDragTrackingInWindow:
 			result = self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_TRACK);
 		break;
-		
+
 		case kDragTrackingEnterHandler:
 			result = self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_START_TRACKING);
 		break;
-		
+
 		case kDragTrackingLeaveHandler:
 			result = self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_STOP_TRACKING);
 		break;
-		
+
 		default:
 		break;
 	}
-	
+
 	return result;
 }
 
-OSErr LLWindowMacOSX::dragReceiveHandler(WindowRef theWindow, void * handlerRefCon,	
+OSErr LLWindowMacOSX::dragReceiveHandler(WindowRef theWindow, void * handlerRefCon,
 										 DragRef drag)
-{	
+{
 	LLWindowMacOSX *self = (LLWindowMacOSX*)handlerRefCon;
 	return self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_DROPPED);
 
 }
 
 OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDropAction action)
-{	
+{
 	OSErr result = dragNotAcceptedErr;	// overall function result
 	OSErr err = noErr;	// for local error handling
-	
+
 	// Get the mouse position and modifiers of this drag.
 	SInt16 modifiers, mouseDownModifiers, mouseUpModifiers;
 	::GetDragModifiers(drag, &modifiers, &mouseDownModifiers, &mouseUpModifiers);
 	MASK mask = LLWindowMacOSX::modifiersToMask(modifiers);
-	
+
 	Point mouse_point;
 	// This will return the mouse point in global screen coords
 	::GetDragMouse(drag, &mouse_point, NULL);
 	LLCoordScreen screen_coords(mouse_point.h, mouse_point.v);
 	LLCoordGL gl_pos;
 	convertCoords(screen_coords, &gl_pos);
-	
+
 	// Look at the pasteboard and try to extract an URL from it
 	PasteboardRef   pasteboard;
 	if(GetDragPasteboard(drag, &pasteboard) == noErr)
@@ -3571,22 +3597,22 @@ OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDrop
 		ItemCount num_items = 0;
 		// Treat an error here as an item count of 0
 		(void)PasteboardGetItemCount(pasteboard, &num_items);
-		
+
 		// Only deal with single-item drags.
 		if(num_items == 1)
 		{
 			PasteboardItemID item_id = NULL;
 			CFArrayRef flavors = NULL;
 			CFDataRef data = NULL;
-			
+
 			err = PasteboardGetItemIdentifier(pasteboard, 1, &item_id); // Yes, this really is 1-based.
-			
+
 			// Try to extract an URL from the pasteboard
 			if(err == noErr)
 			{
 				err = PasteboardCopyItemFlavors( pasteboard, item_id, &flavors);
 			}
-			
+
 			if(err == noErr)
 			{
 				if(CFArrayContainsValue(flavors, CFRangeMake(0, CFArrayGetCount(flavors)), kUTTypeURL))
@@ -3599,9 +3625,9 @@ OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDrop
 					// This is a string that might be an URL.
 					err = PasteboardCopyItemFlavorData(pasteboard, item_id, kUTTypeUTF8PlainText, &data);
 				}
-				
+
 			}
-			
+
 			if(flavors != NULL)
 			{
 				CFRelease(flavors);
@@ -3612,12 +3638,12 @@ OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDrop
 				std::string url;
 				url.assign((char*)CFDataGetBytePtr(data), CFDataGetLength(data));
 				CFRelease(data);
-				
+
 				if(!url.empty())
 				{
-					LLWindowCallbacks::DragNDropResult res = 
+					LLWindowCallbacks::DragNDropResult res =
 						mCallbacks->handleDragNDrop(this, gl_pos, mask, action, url);
-					
+
 					switch (res) {
 						case LLWindowCallbacks::DND_NONE:		// No drop allowed
 							if (action == LLWindowCallbacks::DNDA_TRACK)
@@ -3652,7 +3678,7 @@ OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDrop
 						// Restore the cursor
 						ECursorType temp_cursor = mCurrentCursor;
 						// get around the "setting the same cursor" code in setCursor()
-						mCurrentCursor = UI_CURSOR_COUNT; 
+						mCurrentCursor = UI_CURSOR_COUNT;
  						setCursor(temp_cursor);
 					}
 					else {
@@ -3664,7 +3690,7 @@ OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDrop
 			}
 		}
 	}
-	
+
 	return result;
 }
 
diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h
index 6c9e075a219b0d92adafdb9cb60f78d542106f32..52ba8b3bf3eb7f43c7044f08317aacc920887482 100644
--- a/indra/llwindow/llwindowmacosx.h
+++ b/indra/llwindow/llwindowmacosx.h
@@ -58,7 +58,8 @@ class LLWindowMacOSX : public LLWindow
 	/*virtual*/ BOOL getSize(LLCoordScreen *size);
 	/*virtual*/ BOOL getSize(LLCoordWindow *size);
 	/*virtual*/ BOOL setPosition(LLCoordScreen position);
-	/*virtual*/ BOOL setSize(LLCoordScreen size);
+	/*virtual*/ BOOL setSizeImpl(LLCoordScreen size);
+	/*virtual*/ BOOL setSizeImpl(LLCoordWindow size);
 	/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
 	/*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
 	/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
@@ -67,7 +68,7 @@ class LLWindowMacOSX : public LLWindow
 	/*virtual*/ void showCursorFromMouseMove();
 	/*virtual*/ void hideCursorUntilMouseMove();
 	/*virtual*/ BOOL isCursorHidden();
-	/*virtual*/ void setCursor(ECursorType cursor);
+	/*virtual*/ void updateCursor();
 	/*virtual*/ ECursorType getCursor() const;
 	/*virtual*/ void captureMouse();
 	/*virtual*/ void releaseMouse();
diff --git a/indra/llwindow/llwindowmesaheadless.h b/indra/llwindow/llwindowmesaheadless.h
index fd4bd635e2eb6170710b23a2a1b08d4c4b9d2b7d..8f70aee4f61c9c031d85a5b5dcf7cf8fcd1e102b 100644
--- a/indra/llwindow/llwindowmesaheadless.h
+++ b/indra/llwindow/llwindowmesaheadless.h
@@ -50,7 +50,7 @@ class LLWindowMesaHeadless : public LLWindow
 	/*virtual*/ BOOL getSize(LLCoordScreen *size) {return FALSE;};
 	/*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;};
 	/*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;};
-	/*virtual*/ BOOL setSize(LLCoordScreen size) {return FALSE;};
+	/*virtual*/ BOOL setSizeImpl(LLCoordScreen size) {return FALSE;};
 	/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) {return FALSE;};
 	/*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;};
 	/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;};
@@ -59,7 +59,7 @@ class LLWindowMesaHeadless : public LLWindow
 	/*virtual*/ void showCursorFromMouseMove() {};
 	/*virtual*/ void hideCursorUntilMouseMove() {};
 	/*virtual*/ BOOL isCursorHidden() {return FALSE;};
-	/*virtual*/ void setCursor(ECursorType cursor) {};
+	/*virtual*/ void updateCursor() {};
 	//virtual ECursorType getCursor() { return mCurrentCursor; };
 	/*virtual*/ void captureMouse() {};
 	/*virtual*/ void releaseMouse() {};
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index da2222ad51288bc8c8d7a5d9fe332046a525fd27..3d33af9d9bc97289a4f67030576d2f3f75613983 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -63,9 +63,6 @@ extern BOOL gDebugWindowProc;
 
 const S32 MAX_NUM_RESOLUTIONS = 200;
 
-const S32 MIN_WINDOW_WIDTH = 1024;
-const S32 MIN_WINDOW_HEIGHT = 768;
-
 // static variable for ATI mouse cursor crash work-around:
 static bool ATIbug = false; 
 
@@ -966,7 +963,7 @@ BOOL LLWindowSDL::setPosition(const LLCoordScreen position)
 	return TRUE;
 }
 
-BOOL LLWindowSDL::setSize(const LLCoordScreen size)
+BOOL LLWindowSDL::setSizeImpl(const LLCoordScreen size)
 {
 	if(mWindow)
 	{
@@ -984,11 +981,29 @@ BOOL LLWindowSDL::setSize(const LLCoordScreen size)
 	return FALSE;
 }
 
+BOOL LLWindowSDL::setSizeImpl(const LLCoordWindow size)
+{
+	if(mWindow)
+	{
+		// Push a resize event onto SDL's queue - we'll handle it
+		// when it comes out again.
+		SDL_Event event;
+		event.type = SDL_VIDEORESIZE;
+		event.resize.w = size.mX;
+		event.resize.h = size.mY;
+		SDL_PushEvent(&event); // copied into queue
+
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+
 void LLWindowSDL::swapBuffers()
 {
 	if (mWindow)
 	{	
-		glFinish();
 		SDL_GL_SwapBuffers();
 	}
 }
@@ -1037,6 +1052,25 @@ void LLWindowSDL::setMouseClipping( BOOL b )
     //SDL_WM_GrabInput(b ? SDL_GRAB_ON : SDL_GRAB_OFF);
 }
 
+// virtual
+void LLWindowSDL::setMinSize(U32 min_width, U32 min_height, bool enforce_immediately)
+{
+	LLWindow::setMinSize(min_width, min_height, enforce_immediately);
+
+#if LL_X11
+	// Set the minimum size limits for X11 window
+	// so the window manager doesn't allow resizing below those limits.
+	XSizeHints* hints = XAllocSizeHints();
+	hints->flags |= PMinSize;
+	hints->min_width = mMinWindowWidth;
+	hints->min_height = mMinWindowHeight;
+
+	XSetWMNormalHints(mSDL_Display, mSDL_XWindowID, hints);
+
+	XFree(hints);
+#endif
+}
+
 BOOL LLWindowSDL::setCursorPosition(const LLCoordWindow position)
 {
 	BOOL result = TRUE;
@@ -1850,8 +1884,8 @@ void LLWindowSDL::gatherInput()
 		llinfos << "Handling a resize event: " << event.resize.w <<
 			"x" << event.resize.h << llendl;
 
-		S32 width = llmax(event.resize.w, MIN_WINDOW_WIDTH);
-		S32 height = llmax(event.resize.h, MIN_WINDOW_HEIGHT);
+		S32 width = llmax(event.resize.w, (S32)mMinWindowWidth);
+		S32 height = llmax(event.resize.h, (S32)mMinWindowHeight);
 
 		// *FIX: I'm not sure this is necessary!
 		mWindow = SDL_SetVideoMode(width, height, 32, mSDLFlags);
@@ -1867,7 +1901,7 @@ void LLWindowSDL::gatherInput()
     			}
                 break;
 		}
-		
+
 		mCallbacks->handleResize(this, width, height);
                 break;
             }
@@ -1921,6 +1955,8 @@ void LLWindowSDL::gatherInput()
 		break;
         }
     }
+	
+	updateCursor();
 
 #if LL_X11
     // This is a good time to stop flashing the icon if our mFlashTimer has
@@ -2007,7 +2043,7 @@ static SDL_Cursor *makeSDLCursorFromBMP(const char *filename, int hotx, int hoty
 	return sdlcursor;
 }
 
-void LLWindowSDL::setCursor(ECursorType cursor)
+void LLWindowSDL::updateCursor()
 {
 	if (ATIbug) {
 		// cursor-updating is very flaky when this bug is
@@ -2015,11 +2051,11 @@ void LLWindowSDL::setCursor(ECursorType cursor)
 		return;
 	}
 
-	if (mCurrentCursor != cursor)
+	if (mCurrentCursor != mNextCursor)
 	{
-		if (cursor < UI_CURSOR_COUNT)
+		if (mNextCursor < UI_CURSOR_COUNT)
 		{
-			SDL_Cursor *sdlcursor = mSDLCursors[cursor];
+			SDL_Cursor *sdlcursor = mSDLCursors[mNextCursor];
 			// Try to default to the arrow for any cursors that
 			// did not load correctly.
 			if (!sdlcursor && mSDLCursors[UI_CURSOR_ARROW])
@@ -2027,9 +2063,9 @@ void LLWindowSDL::setCursor(ECursorType cursor)
 			if (sdlcursor)
 				SDL_SetCursor(sdlcursor);
 		} else {
-			llwarns << "Tried to set invalid cursor number " << cursor << llendl;
+			llwarns << "Tried to set invalid cursor number " << mNextCursor << llendl;
 		}
-		mCurrentCursor = cursor;
+		mCurrentCursor = mNextCursor;
 	}
 }
 
diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h
index fa544b16cef171ff8b6097c5db880a6a6ff9da6c..4e2a269ea33b4587c903662e55106c05e22d8a8d 100644
--- a/indra/llwindow/llwindowsdl.h
+++ b/indra/llwindow/llwindowsdl.h
@@ -63,7 +63,8 @@ class LLWindowSDL : public LLWindow
 	/*virtual*/ BOOL getSize(LLCoordScreen *size);
 	/*virtual*/ BOOL getSize(LLCoordWindow *size);
 	/*virtual*/ BOOL setPosition(LLCoordScreen position);
-	/*virtual*/ BOOL setSize(LLCoordScreen size);
+	/*virtual*/ BOOL setSizeImpl(LLCoordScreen size);
+	/*virtual*/ BOOL setSizeImpl(LLCoordWindow size);
 	/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
 	/*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
 	/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
@@ -72,10 +73,11 @@ class LLWindowSDL : public LLWindow
 	/*virtual*/ void showCursorFromMouseMove();
 	/*virtual*/ void hideCursorUntilMouseMove();
 	/*virtual*/ BOOL isCursorHidden();
-	/*virtual*/ void setCursor(ECursorType cursor);
+	/*virtual*/ void updateCursor();
 	/*virtual*/ void captureMouse();
 	/*virtual*/ void releaseMouse();
 	/*virtual*/ void setMouseClipping( BOOL b );
+	/*virtual*/	void setMinSize(U32 min_width, U32 min_height, bool enforce_immediately = true);
 
 	/*virtual*/ BOOL isClipboardTextAvailable();
 	/*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst);
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index a84bd5fb08a4a1cc7807ac5ab6339a60a974eaf5..bc85acbf4593a29926ae3cf44d256f0a294348ab 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -41,6 +41,7 @@
 #include "llgl.h"
 #include "llstring.h"
 #include "lldir.h"
+#include "llglslshader.h"
 
 // System includes
 #include <commdlg.h>
@@ -861,7 +862,7 @@ BOOL LLWindowWin32::setPosition(const LLCoordScreen position)
 	return TRUE;
 }
 
-BOOL LLWindowWin32::setSize(const LLCoordScreen size)
+BOOL LLWindowWin32::setSizeImpl(const LLCoordScreen size)
 {
 	LLCoordScreen position;
 
@@ -871,10 +872,30 @@ BOOL LLWindowWin32::setSize(const LLCoordScreen size)
 		return FALSE;
 	}
 
+	WINDOWPLACEMENT placement;
+	placement.length = sizeof(WINDOWPLACEMENT);
+
+	if (!GetWindowPlacement(mWindowHandle, &placement)) return FALSE;
+
+	placement.showCmd = SW_RESTORE;
+
+	if (!SetWindowPlacement(mWindowHandle, &placement)) return FALSE;
+
 	moveWindow(position, size);
 	return TRUE;
 }
 
+BOOL LLWindowWin32::setSizeImpl(const LLCoordWindow size)
+{
+	RECT window_rect = {0, 0, size.mX, size.mY };
+	DWORD dw_ex_style = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
+	DWORD dw_style = WS_OVERLAPPEDWINDOW;
+
+	AdjustWindowRectEx(&window_rect, dw_style, FALSE, dw_ex_style);
+
+	return setSizeImpl(LLCoordScreen(window_rect.right - window_rect.left, window_rect.bottom - window_rect.top));
+}
+
 // changing fullscreen resolution
 BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp)
 {
@@ -885,12 +906,12 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 	DWORD	current_refresh;
 	DWORD	dw_ex_style;
 	DWORD	dw_style;
-	RECT	window_rect;
+	RECT	window_rect = {0, 0, 0, 0};
 	S32 width = size.mX;
 	S32 height = size.mY;
 	BOOL auto_show = FALSE;
 
-	if (mhRC)
+	if (mhRC)	
 	{
 		auto_show = TRUE;
 		resetDisplayResolution();
@@ -985,7 +1006,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 			dw_ex_style = WS_EX_APPWINDOW;
 			dw_style = WS_POPUP;
 
-			// Move window borders out not to cover window contents
+			// Move window borders out not to cover window contents.
+			// This converts client rect to window rect, i.e. expands it by the window border size.
 			AdjustWindowRectEx(&window_rect, dw_style, FALSE, dw_ex_style);
 		}
 		// If it failed, we don't want to run fullscreen
@@ -1013,6 +1035,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 		dw_style = WS_OVERLAPPEDWINDOW;
 	}
 
+
 	// don't post quit messages when destroying old windows
 	mPostQuit = FALSE;
 
@@ -1064,6 +1087,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 		return FALSE;
 	}
 
+	LL_INFOS("Window") << "Device context retrieved." << llendl ;
+
 	if (!(pixel_format = ChoosePixelFormat(mhDC, &pfd)))
 	{
 		close();
@@ -1072,6 +1097,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 		return FALSE;
 	}
 
+	LL_INFOS("Window") << "Pixel format chosen." << llendl ;
+
 	// Verify what pixel format we actually received.
 	if (!DescribePixelFormat(mhDC, pixel_format, sizeof(PIXELFORMATDESCRIPTOR),
 		&pfd))
@@ -1082,6 +1109,37 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 		return FALSE;
 	}
 
+	// (EXP-1765) dump pixel data to see if there is a pattern that leads to unreproducible crash
+	LL_INFOS("Window") << "--- begin pixel format dump ---" << llendl ;
+	LL_INFOS("Window") << "pixel_format is " << pixel_format << llendl ;
+	LL_INFOS("Window") << "pfd.nSize:            " << pfd.nSize << llendl ;
+	LL_INFOS("Window") << "pfd.nVersion:         " << pfd.nVersion << llendl ;
+	LL_INFOS("Window") << "pfd.dwFlags:          0x" << std::hex << pfd.dwFlags << std::dec << llendl ;
+	LL_INFOS("Window") << "pfd.iPixelType:       " << (int)pfd.iPixelType << llendl ;
+	LL_INFOS("Window") << "pfd.cColorBits:       " << (int)pfd.cColorBits << llendl ;
+	LL_INFOS("Window") << "pfd.cRedBits:         " << (int)pfd.cRedBits << llendl ;
+	LL_INFOS("Window") << "pfd.cRedShift:        " << (int)pfd.cRedShift << llendl ;
+	LL_INFOS("Window") << "pfd.cGreenBits:       " << (int)pfd.cGreenBits << llendl ;
+	LL_INFOS("Window") << "pfd.cGreenShift:      " << (int)pfd.cGreenShift << llendl ;
+	LL_INFOS("Window") << "pfd.cBlueBits:        " << (int)pfd.cBlueBits << llendl ;
+	LL_INFOS("Window") << "pfd.cBlueShift:       " << (int)pfd.cBlueShift << llendl ;
+	LL_INFOS("Window") << "pfd.cAlphaBits:       " << (int)pfd.cAlphaBits << llendl ;
+	LL_INFOS("Window") << "pfd.cAlphaShift:      " << (int)pfd.cAlphaShift << llendl ;
+	LL_INFOS("Window") << "pfd.cAccumBits:       " << (int)pfd.cAccumBits << llendl ;
+	LL_INFOS("Window") << "pfd.cAccumRedBits:    " << (int)pfd.cAccumRedBits << llendl ;
+	LL_INFOS("Window") << "pfd.cAccumGreenBits:  " << (int)pfd.cAccumGreenBits << llendl ;
+	LL_INFOS("Window") << "pfd.cAccumBlueBits:   " << (int)pfd.cAccumBlueBits << llendl ;
+	LL_INFOS("Window") << "pfd.cAccumAlphaBits:  " << (int)pfd.cAccumAlphaBits << llendl ;
+	LL_INFOS("Window") << "pfd.cDepthBits:       " << (int)pfd.cDepthBits << llendl ;
+	LL_INFOS("Window") << "pfd.cStencilBits:     " << (int)pfd.cStencilBits << llendl ;
+	LL_INFOS("Window") << "pfd.cAuxBuffers:      " << (int)pfd.cAuxBuffers << llendl ;
+	LL_INFOS("Window") << "pfd.iLayerType:       " << (int)pfd.iLayerType << llendl ;
+	LL_INFOS("Window") << "pfd.bReserved:        " << (int)pfd.bReserved << llendl ;
+	LL_INFOS("Window") << "pfd.dwLayerMask:      " << pfd.dwLayerMask << llendl ;
+	LL_INFOS("Window") << "pfd.dwVisibleMask:    " << pfd.dwVisibleMask << llendl ;
+	LL_INFOS("Window") << "pfd.dwDamageMask:     " << pfd.dwDamageMask << llendl ;
+	LL_INFOS("Window") << "--- end pixel format dump ---" << llendl ;
+
 	if (pfd.cColorBits < 32)
 	{
 		close();
@@ -1125,7 +1183,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 	LL_INFOS("Window") << "Drawing context is created." << llendl ;
 
 	gGLManager.initWGL();
-
+	
 	if (wglChoosePixelFormatARB)
 	{
 		// OK, at this point, use the ARB wglChoosePixelFormatsARB function to see if we
@@ -1384,7 +1442,53 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 		return FALSE;
 	}
 
-	if (!(mhRC = wglCreateContext(mhDC)))
+	mhRC = 0;
+	if (wglCreateContextAttribsARB)
+	{ //attempt to create a specific versioned context
+		S32 attribs[] = 
+		{ //start at 4.2
+			WGL_CONTEXT_MAJOR_VERSION_ARB, 4,
+			WGL_CONTEXT_MINOR_VERSION_ARB, 2,
+			WGL_CONTEXT_PROFILE_MASK_ARB,  LLRender::sGLCoreProfile ? WGL_CONTEXT_CORE_PROFILE_BIT_ARB : WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
+			WGL_CONTEXT_FLAGS_ARB, gDebugGL ? WGL_CONTEXT_DEBUG_BIT_ARB : 0,
+			0
+		};
+
+		bool done = false;
+		while (!done)
+		{
+			mhRC = wglCreateContextAttribsARB(mhDC, mhRC, attribs);
+
+			if (!mhRC)
+			{
+				if (attribs[3] > 0)
+				{ //decrement minor version
+					attribs[3]--;
+				}
+				else if (attribs[1] > 3)
+				{ //decrement major version and start minor version over at 3
+					attribs[1]--;
+					attribs[3] = 3;
+				}
+				else
+				{ //we reached 3.0 and still failed, bail out
+					done = true;
+				}
+			}
+			else
+			{
+				llinfos << "Created OpenGL " << llformat("%d.%d", attribs[1], attribs[3]) << " context." << llendl;
+				done = true;
+
+				if (LLRender::sGLCoreProfile)
+				{
+					LLGLSLShader::sNoFixedFunction = true;
+				}
+			}
+		}
+	}
+
+	if (!mhRC && !(mhRC = wglCreateContext(mhDC)))
 	{
 		close();
 		OSMessageBox(mCallbacks->translateString("MBGLContextErr"), mCallbacks->translateString("MBError"), OSMB_OK);
@@ -1404,7 +1508,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 		OSMessageBox(mCallbacks->translateString("MBVideoDrvErr"), mCallbacks->translateString("MBError"), OSMB_OK);
 		return FALSE;
 	}
-
+	
 	// Disable vertical sync for swap
 	if (disable_vsync && wglSwapIntervalEXT)
 	{
@@ -1463,24 +1567,16 @@ void LLWindowWin32::moveWindow( const LLCoordScreen& position, const LLCoordScre
 
 BOOL LLWindowWin32::setCursorPosition(const LLCoordWindow position)
 {
-	LLCoordScreen screen_pos;
-
 	mMousePositionModified = TRUE;
 	if (!mWindowHandle)
 	{
 		return FALSE;
 	}
 
-	if (!convertCoords(position, &screen_pos))
-	{
-		return FALSE;
-	}
 
 	// Inform the application of the new mouse position (needed for per-frame
 	// hover/picking to function).
-	LLCoordGL gl_pos;
-	convertCoords(position, &gl_pos);
-	mCallbacks->handleMouseMove(this, gl_pos, (MASK)0);
+	mCallbacks->handleMouseMove(this, position.convert(), (MASK)0);
 	
 	// DEV-18951 VWR-8524 Camera moves wildly when alt-clicking.
 	// Because we have preemptively notified the application of the new
@@ -1490,24 +1586,23 @@ BOOL LLWindowWin32::setCursorPosition(const LLCoordWindow position)
 	while (PeekMessage(&msg, NULL, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE))
 	{ }
 
-	return SetCursorPos(screen_pos.mX, screen_pos.mY);
+	LLCoordScreen screen_pos(position.convert());
+	return ::SetCursorPos(screen_pos.mX, screen_pos.mY);
 }
 
 BOOL LLWindowWin32::getCursorPosition(LLCoordWindow *position)
 {
 	POINT cursor_point;
-	LLCoordScreen screen_pos;
 
-	if (!mWindowHandle ||
-		!GetCursorPos(&cursor_point))
+	if (!mWindowHandle 
+		|| !GetCursorPos(&cursor_point)
+		|| !position)
 	{
 		return FALSE;
 	}
 
-	screen_pos.mX = cursor_point.x;
-	screen_pos.mY = cursor_point.y;
-
-	return convertCoords(screen_pos, position);
+	*position = LLCoordScreen(cursor_point.x, cursor_point.y).convert();
+	return TRUE;
 }
 
 void LLWindowWin32::hideCursor()
@@ -1620,18 +1715,18 @@ void LLWindowWin32::initCursors()
 
 
 
-void LLWindowWin32::setCursor(ECursorType cursor)
+void LLWindowWin32::updateCursor()
 {
-	if (cursor == UI_CURSOR_ARROW
+	if (mNextCursor == UI_CURSOR_ARROW
 		&& mBusyCount > 0)
 	{
-		cursor = UI_CURSOR_WORKING;
+		mNextCursor = UI_CURSOR_WORKING;
 	}
 
-	if( mCurrentCursor != cursor )
+	if( mCurrentCursor != mNextCursor )
 	{
-		mCurrentCursor = cursor;
-		SetCursor( mCursor[cursor] );
+		mCurrentCursor = mNextCursor;
+		SetCursor( mCursor[mNextCursor] );
 	}
 }
 
@@ -1669,7 +1764,7 @@ void LLWindowWin32::gatherInput()
 
 	LLMemType m1(LLMemType::MTYPE_GATHER_INPUT);
 
-	while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) && msg_count < MAX_MESSAGE_PER_UPDATE)
+	while ((msg_count < MAX_MESSAGE_PER_UPDATE) && PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
 	{
 		mCallbacks->handlePingWatchdog(this, "Main:TranslateGatherInput");
 		TranslateMessage(&msg);
@@ -1713,6 +1808,8 @@ void LLWindowWin32::gatherInput()
 
 	mInputProcessingPaused = FALSE;
 
+	updateCursor();
+
 	// clear this once we've processed all mouse messages that might have occurred after
 	// we slammed the mouse position
 	mMousePositionModified = FALSE;
@@ -1723,6 +1820,10 @@ static LLFastTimer::DeclareTimer FTM_MOUSEHANDLER("Handle Mouse");
 
 LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_param, LPARAM l_param)
 {
+	// Ignore clicks not originated in the client area, i.e. mouse-up events not preceded with a WM_LBUTTONDOWN.
+	// This helps prevent avatar walking after maximizing the window by double-clicking the title bar.
+	static bool sHandleLeftMouseUp = true;
+
 	LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong(h_wnd, GWL_USERDATA);
 
 
@@ -2069,10 +2170,20 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 			window_imp->handleUnicodeUTF16((U16)w_param, gKeyboard->currentMask(FALSE));
 			return 0;
 
+		case WM_NCLBUTTONDOWN:
+			{
+				window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_NCLBUTTONDOWN");
+				// A click in a non-client area, e.g. title bar or window border.
+				sHandleLeftMouseUp = false;
+			}
+			break;
+
 		case WM_LBUTTONDOWN:
 			{
 				window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_LBUTTONDOWN");
 				LLFastTimer t2(FTM_MOUSEHANDLER);
+				sHandleLeftMouseUp = true;
+
 				if (LLWinImm::isAvailable() && window_imp->mPreeditor)
 				{
 					window_imp->interruptLanguageTextInput();
@@ -2083,15 +2194,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 				// If we don't do this, many clicks could get buffered up, and if the
 				// first click changes the cursor position, all subsequent clicks
 				// will occur at the wrong location.  JC
-				LLCoordWindow cursor_coord_window;
 				if (window_imp->mMousePositionModified)
 				{
+					LLCoordWindow cursor_coord_window;
 					window_imp->getCursorPosition(&cursor_coord_window);
-					window_imp->convertCoords(cursor_coord_window, &gl_coord);
+					gl_coord = cursor_coord_window.convert();
 				}
 				else
 				{
-					window_imp->convertCoords(window_coord, &gl_coord);
+					gl_coord = window_coord.convert();
 				}
 				MASK mask = gKeyboard->currentMask(TRUE);
 				// generate move event to update mouse coordinates
@@ -2113,15 +2224,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 				// If we don't do this, many clicks could get buffered up, and if the
 				// first click changes the cursor position, all subsequent clicks
 				// will occur at the wrong location.  JC
-				LLCoordWindow cursor_coord_window;
 				if (window_imp->mMousePositionModified)
 				{
+					LLCoordWindow cursor_coord_window;
 					window_imp->getCursorPosition(&cursor_coord_window);
-					window_imp->convertCoords(cursor_coord_window, &gl_coord);
+					gl_coord = cursor_coord_window.convert();
 				}
 				else
 				{
-					window_imp->convertCoords(window_coord, &gl_coord);
+					gl_coord = window_coord.convert();
 				}
 				MASK mask = gKeyboard->currentMask(TRUE);
 				// generate move event to update mouse coordinates
@@ -2137,6 +2248,13 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 			{
 				window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_LBUTTONUP");
 				LLFastTimer t2(FTM_MOUSEHANDLER);
+
+				if (!sHandleLeftMouseUp)
+				{
+					sHandleLeftMouseUp = true;
+					break;
+				}
+
 				//if (gDebugClicks)
 				//{
 				//	LL_INFOS("Window") << "WndProc left button up" << LL_ENDL;
@@ -2146,15 +2264,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 				// If we don't do this, many clicks could get buffered up, and if the
 				// first click changes the cursor position, all subsequent clicks
 				// will occur at the wrong location.  JC
-				LLCoordWindow cursor_coord_window;
 				if (window_imp->mMousePositionModified)
 				{
+					LLCoordWindow cursor_coord_window;
 					window_imp->getCursorPosition(&cursor_coord_window);
-					window_imp->convertCoords(cursor_coord_window, &gl_coord);
+					gl_coord = cursor_coord_window.convert();
 				}
 				else
 				{
-					window_imp->convertCoords(window_coord, &gl_coord);
+					gl_coord = window_coord.convert();
 				}
 				MASK mask = gKeyboard->currentMask(TRUE);
 				// generate move event to update mouse coordinates
@@ -2181,15 +2299,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 				// If we don't do this, many clicks could get buffered up, and if the
 				// first click changes the cursor position, all subsequent clicks
 				// will occur at the wrong location.  JC
-				LLCoordWindow cursor_coord_window;
 				if (window_imp->mMousePositionModified)
 				{
+					LLCoordWindow cursor_coord_window;
 					window_imp->getCursorPosition(&cursor_coord_window);
-					window_imp->convertCoords(cursor_coord_window, &gl_coord);
+					gl_coord = cursor_coord_window.convert();
 				}
 				else
 				{
-					window_imp->convertCoords(window_coord, &gl_coord);
+					gl_coord = window_coord.convert();
 				}
 				MASK mask = gKeyboard->currentMask(TRUE);
 				// generate move event to update mouse coordinates
@@ -2210,15 +2328,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 				// If we don't do this, many clicks could get buffered up, and if the
 				// first click changes the cursor position, all subsequent clicks
 				// will occur at the wrong location.  JC
-				LLCoordWindow cursor_coord_window;
 				if (window_imp->mMousePositionModified)
 				{
+					LLCoordWindow cursor_coord_window;
 					window_imp->getCursorPosition(&cursor_coord_window);
-					window_imp->convertCoords(cursor_coord_window, &gl_coord);
+					gl_coord = cursor_coord_window.convert();
 				}
 				else
 				{
-					window_imp->convertCoords(window_coord, &gl_coord);
+					gl_coord = window_coord.convert();
 				}
 				MASK mask = gKeyboard->currentMask(TRUE);
 				// generate move event to update mouse coordinates
@@ -2245,15 +2363,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 				// If we don't do this, many clicks could get buffered up, and if the
 				// first click changes the cursor position, all subsequent clicks
 				// will occur at the wrong location.  JC
-				LLCoordWindow cursor_coord_window;
 				if (window_imp->mMousePositionModified)
 				{
+					LLCoordWindow cursor_coord_window;
 					window_imp->getCursorPosition(&cursor_coord_window);
-					window_imp->convertCoords(cursor_coord_window, &gl_coord);
+					gl_coord = cursor_coord_window.convert();
 				}
 				else
 				{
-					window_imp->convertCoords(window_coord, &gl_coord);
+					gl_coord = window_coord.convert();
 				}
 				MASK mask = gKeyboard->currentMask(TRUE);
 				// generate move event to update mouse coordinates
@@ -2274,15 +2392,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 				// If we don't do this, many clicks could get buffered up, and if the
 				// first click changes the cursor position, all subsequent clicks
 				// will occur at the wrong location.  JC
-				LLCoordWindow cursor_coord_window;
 				if (window_imp->mMousePositionModified)
 				{
+					LLCoordWindow cursor_coord_window;
 					window_imp->getCursorPosition(&cursor_coord_window);
-					window_imp->convertCoords(cursor_coord_window, &gl_coord);
+					gl_coord = cursor_coord_window.convert();
 				}
 				else
 				{
-					window_imp->convertCoords(window_coord, &gl_coord);
+					gl_coord = window_coord.convert();
 				}
 				MASK mask = gKeyboard->currentMask(TRUE);
 				// generate move event to update mouse coordinates
@@ -2354,17 +2472,16 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 		case WM_MOUSEMOVE:
 			{
 				window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MOUSEMOVE");
-				window_imp->convertCoords(window_coord, &gl_coord);
 				MASK mask = gKeyboard->currentMask(TRUE);
-				window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
+				window_imp->mCallbacks->handleMouseMove(window_imp, window_coord.convert(), mask);
 				return 0;
 			}
 
 		case WM_GETMINMAXINFO:
 			{
 				LPMINMAXINFO min_max = (LPMINMAXINFO)l_param;
-				min_max->ptMinTrackSize.x = 1024;
-				min_max->ptMinTrackSize.y = 768;
+				min_max->ptMinTrackSize.x = window_imp->mMinWindowWidth;
+				min_max->ptMinTrackSize.y = window_imp->mMinWindowHeight;
 				return 0;
 			}
 
@@ -2910,7 +3027,6 @@ BOOL LLWindowWin32::resetDisplayResolution()
 
 void LLWindowWin32::swapBuffers()
 {
-	glFinish();
 	SwapBuffers(mhDC);
 }
 
@@ -3245,7 +3361,7 @@ void LLWindowWin32::setLanguageTextInput( const LLCoordGL & position )
 
 			LLWinImm::setCompositionWindow( himc, &ime_form );
 
-			sWinIMEWindowPosition.set( win_pos.mX, win_pos.mY );
+			sWinIMEWindowPosition = win_pos;
 		}
 
 		LLWinImm::releaseContext(mWindowHandle, himc);
diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h
index 387e4cbdb65a8767ecf8ddf220b4438669ff6111..54c9ac4d4d182fd52349e67caeaf56fa92999b5c 100644
--- a/indra/llwindow/llwindowwin32.h
+++ b/indra/llwindow/llwindowwin32.h
@@ -57,7 +57,8 @@ class LLWindowWin32 : public LLWindow
 	/*virtual*/ BOOL getSize(LLCoordScreen *size);
 	/*virtual*/ BOOL getSize(LLCoordWindow *size);
 	/*virtual*/ BOOL setPosition(LLCoordScreen position);
-	/*virtual*/ BOOL setSize(LLCoordScreen size);
+	/*virtual*/ BOOL setSizeImpl(LLCoordScreen size);
+	/*virtual*/ BOOL setSizeImpl(LLCoordWindow size);
 	/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
 	/*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
 	/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
@@ -66,7 +67,7 @@ class LLWindowWin32 : public LLWindow
 	/*virtual*/ void showCursorFromMouseMove();
 	/*virtual*/ void hideCursorUntilMouseMove();
 	/*virtual*/ BOOL isCursorHidden();
-	/*virtual*/ void setCursor(ECursorType cursor);
+	/*virtual*/ void updateCursor();
 	/*virtual*/ ECursorType getCursor() const;
 	/*virtual*/ void captureMouse();
 	/*virtual*/ void releaseMouse();
diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h
index bf38a8b062dbcddacdf34e3faa751abe0ecf3960..597031ec707a6dd09b8db07be710685f16d8a330 100644
--- a/indra/llxml/llcontrol.h
+++ b/indra/llxml/llcontrol.h
@@ -92,6 +92,8 @@ typedef enum e_control_type
 
 class LLControlVariable : public LLRefCount
 {
+	LOG_CLASS(LLControlVariable);
+
 	friend class LLControlGroup;
 	
 public:
@@ -180,6 +182,8 @@ T convert_from_llsd(const LLSD& sd, eControlType type, const std::string& contro
 //const U32 STRING_CACHE_SIZE = 10000;
 class LLControlGroup : public LLInstanceTracker<LLControlGroup, std::string>
 {
+	LOG_CLASS(LLControlGroup);
+
 protected:
 	typedef std::map<std::string, LLControlVariablePtr > ctrl_name_table_t;
 	ctrl_name_table_t mNameTable;
diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp
index 9f1e249ddda37f0f9a6d40d53f3d4857061951d3..2ffb0d8503cd662c106704c3f53d781a7ee55261 100644
--- a/indra/llxml/llxmlnode.cpp
+++ b/indra/llxml/llxmlnode.cpp
@@ -631,13 +631,14 @@ bool LLXMLNode::updateNode(
 	}
 
 	//update all of node's children with updateNodes children that match name
-	LLXMLNodePtr child;
+	LLXMLNodePtr child = node->getFirstChild();
+	LLXMLNodePtr last_child = child;
 	LLXMLNodePtr updateChild;
 	
 	for (updateChild = update_node->getFirstChild(); updateChild.notNull(); 
 		 updateChild = updateChild->getNextSibling())
 	{
-		for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
+		while(child.notNull())
 		{
 			std::string nodeName;
 			std::string updateName;
@@ -656,6 +657,22 @@ bool LLXMLNode::updateNode(
 			if ((nodeName != "") && (updateName == nodeName))
 			{
 				updateNode(child, updateChild);
+				last_child = child;
+				child = child->getNextSibling();
+				if (child.isNull())
+				{
+					child = node->getFirstChild();
+				}
+				break;
+			}
+			
+			child = child->getNextSibling();
+			if (child.isNull())
+			{
+				child = node->getFirstChild();
+			}
+			if (child == last_child)
+			{
 				break;
 			}
 		}
@@ -693,7 +710,7 @@ bool LLXMLNode::parseFile(const std::string& filename, LLXMLNodePtr& node, LLXML
 	LLFILE* fp = LLFile::fopen(filename, "rb");		/* Flawfinder: ignore */
 	if (fp == NULL)
 	{
-		node = new LLXMLNode();
+		node = NULL ;
 		return false;
 	}
 	fseek(fp, 0, SEEK_END);
@@ -746,7 +763,7 @@ bool LLXMLNode::parseBuffer(
 	{
 		llwarns << "Parse failure - wrong number of top-level nodes xml."
 				<< llendl;
-		node = new LLXMLNode();
+		node = NULL ;
 		return false;
 	}
 
@@ -784,7 +801,7 @@ bool LLXMLNode::parseStream(
 	while(str.good())
 	{
 		str.read((char*)buffer, BUFSIZE);
-		int count = str.gcount();
+		int count = (int)str.gcount();
 		
 		if (XML_Parse(my_parser, (const char *)buffer, count, !str.good()) != XML_STATUS_OK)
 		{
@@ -805,7 +822,7 @@ bool LLXMLNode::parseStream(
 	{
 		llwarns << "Parse failure - wrong number of top-level nodes xml."
 				<< llendl;
-		node = new LLXMLNode();
+		node = NULL;
 		return false;
 	}
 
@@ -882,11 +899,8 @@ bool LLXMLNode::getLayeredXMLNode(LLXMLNodePtr& root,
 
 	for (itor = paths.begin(), ++itor; itor != paths.end(); ++itor)
 	{
-		std::string nodeName;
-		std::string updateName;
-
 		std::string layer_filename = *itor;
-		if(layer_filename.empty())
+		if(layer_filename.empty() || layer_filename == filename)
 		{
 			// no localized version of this file, that's ok, keep looking
 			continue;
@@ -898,6 +912,9 @@ bool LLXMLNode::getLayeredXMLNode(LLXMLNodePtr& root,
 			return false;
 		}
 
+		std::string nodeName;
+		std::string updateName;
+
 		updateRoot->getAttributeString("name", updateName);
 		root->getAttributeString("name", nodeName);
 
@@ -1206,7 +1223,7 @@ bool LLXMLNode::getChild(const LLStringTableEntry* name, LLXMLNodePtr& node, BOO
 	{
 		return mDefault->getChild(name, node, FALSE);
 	}
-	node = new LLXMLNode();
+	node = NULL;
 	return false;
 }
 
@@ -1277,7 +1294,7 @@ bool LLXMLNode::getAttribute(const LLStringTableEntry* name, LLXMLNodePtr& node,
 	{
 		return mDefault->getAttribute(name, node, FALSE);
 	}
-	node = new LLXMLNode();
+	
 	return false;
 }
 
diff --git a/indra/llxuixml/llinitparam.cpp b/indra/llxuixml/llinitparam.cpp
index 482064ed7b6e7606107c8d6c886c958362801426..db72aa19b98ce2127e7892ff9cf1c12e12a8cb7b 100644
--- a/indra/llxuixml/llinitparam.cpp
+++ b/indra/llxuixml/llinitparam.cpp
@@ -40,7 +40,7 @@ namespace LLInitParam
 	{
 		const U8* my_addr = reinterpret_cast<const U8*>(this);
 		const U8* block_addr = reinterpret_cast<const U8*>(enclosing_block);
-		mEnclosingBlockOffset = 0x7FFFffff & ((U32)(my_addr - block_addr));
+		mEnclosingBlockOffset = 0x7FFFffff & (U32)(my_addr - block_addr);
 	}
 
 	//
@@ -118,16 +118,6 @@ namespace LLInitParam
 		mCurrentBlockPtr(NULL)
 	{}
 
-	//
-	// BaseBlock
-	//
-	BaseBlock::BaseBlock()
-	:	mChangeVersion(0)
-	{}
-
-	BaseBlock::~BaseBlock()
-	{}
-
 	// called by each derived class in least to most derived order
 	void BaseBlock::init(BlockDescriptor& descriptor, BlockDescriptor& base_descriptor, size_t block_size)
 	{
@@ -427,14 +417,6 @@ namespace LLInitParam
 		}
 	}
 
-	void BaseBlock::paramChanged(const Param& changed_param, bool user_provided)
-	{ 
-		if (user_provided)
-		{
-			mChangeVersion++;
-		}
-	}
-
 	const std::string& BaseBlock::getParamName(const BlockDescriptor& block_data, const Param* paramp) const
 	{
 		param_handle_t handle = getHandleFromParam(paramp);
@@ -478,6 +460,7 @@ namespace LLInitParam
 			if (merge_func)
 			{
 				Param* paramp = getParamFromHandle((*it)->mParamHandle);
+				llassert(paramp->mEnclosingBlockOffset == (*it)->mParamHandle);
 				some_param_changed |= merge_func(*paramp, *other_paramp, overwrite);
 			}
 		}
diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h
index 183472450dbc2ba75372a6f8df80612e7548d7d4..4ab1d891a366b168e52a52ef91985c8029c813e6 100644
--- a/indra/llxuixml/llinitparam.h
+++ b/indra/llxuixml/llinitparam.h
@@ -51,7 +51,7 @@ namespace LLInitParam
 			return a == b;
 		}
     };
-    
+
 	// boost function types are not comparable
 	template<typename T>
 	struct ParamCompare<T, true>
@@ -74,6 +74,7 @@ namespace LLInitParam
 		static bool equals(const Flag& a, const Flag& b) { return false; }
 	};
 
+
 	// helper functions and classes
 	typedef ptrdiff_t param_handle_t;
 
@@ -82,8 +83,11 @@ namespace LLInitParam
 	template <typename T>
 	class TypeValues
 	{
+	private:
+		struct Inaccessable{};
 	public:
 		typedef std::map<std::string, T> value_name_map_t;
+		typedef Inaccessable name_t;
 
 		void setValueName(const std::string& key) {}
 		std::string getValueName() const { return ""; }
@@ -113,6 +117,7 @@ namespace LLInitParam
 	{
 	public:
 		typedef typename std::map<std::string, T> value_name_map_t;
+		typedef std::string name_t;
 
 		//TODO: cache key by index to save on param block size
 		void setValueName(const std::string& value_name) 
@@ -293,36 +298,7 @@ namespace LLInitParam
 		parser_inspect_func_map_t*	mParserInspectFuncs;
 	};
 
-	class BaseBlock;
-
-	class Param
-	{
-	public:
-		// public to allow choice blocks to clear provided flag on stale choices
-		void setProvided(bool is_provided) { mIsProvided = is_provided; }
-
-	protected:
-		bool anyProvided() const { return mIsProvided; }
-
-		Param(BaseBlock* enclosing_block);
-
-		// store pointer to enclosing block as offset to reduce space and allow for quick copying
-		BaseBlock& enclosingBlock() const
-		{ 
-			const U8* my_addr = reinterpret_cast<const U8*>(this);
-			// get address of enclosing BLOCK class using stored offset to enclosing BaseBlock class
-			return *const_cast<BaseBlock*>
-				(reinterpret_cast<const BaseBlock*>
-					(my_addr - (ptrdiff_t)(S32)mEnclosingBlockOffset));
-		}
-
-	private:
-		friend class BaseBlock;
-
-		U32		mEnclosingBlockOffset:31;
-		U32		mIsProvided:1;
-
-	};
+	class Param;
 
 	// various callbacks and constraints associated with an individual param
 	struct ParamDescriptor
@@ -390,12 +366,91 @@ namespace LLInitParam
 		all_params_list_t				mAllParams;				// all parameters, owns descriptors
 		size_t							mMaxParamOffset;
 		EInitializationState			mInitializationState;	// whether or not static block data has been initialized
-		BaseBlock*						mCurrentBlockPtr;		// pointer to block currently being constructed
+		class BaseBlock*				mCurrentBlockPtr;		// pointer to block currently being constructed
 	};
 
 	class BaseBlock
 	{
 	public:
+		//TODO: implement in terms of owned_ptr
+		template<typename T>
+		class Lazy
+		{
+		public:
+			Lazy()
+				: mPtr(NULL)
+			{}
+
+			~Lazy()
+			{
+				delete mPtr;
+			}
+
+			Lazy(const Lazy& other)
+			{
+				if (other.mPtr)
+				{
+					mPtr = new T(*other.mPtr);
+				}
+				else
+				{
+					mPtr = NULL;
+				}
+			}
+
+			Lazy<T>& operator = (const Lazy<T>& other)
+			{
+				if (other.mPtr)
+				{
+					mPtr = new T(*other.mPtr);
+				}
+				else
+				{
+					mPtr = NULL;
+				}
+				return *this;
+			}
+
+			bool empty() const
+			{
+				return mPtr == NULL;
+			}
+
+			void set(const T& other)
+			{
+				delete mPtr;
+				mPtr = new T(other);
+			}
+
+			const T& get() const
+			{
+				return ensureInstance();
+			}
+
+			T& get()
+			{
+				return ensureInstance();
+			}
+
+		private:
+			// lazily allocate an instance of T
+			T* ensureInstance() const
+			{
+				if (mPtr == NULL)
+				{
+					mPtr = new T();
+				}
+				return mPtr;
+			}
+
+		private:
+			// if you get a compilation error with this, that means you are using a forward declared struct for T
+			// unfortunately, the type traits we rely on don't work with forward declared typed
+			//static const int dummy = sizeof(T);
+
+			mutable T* mPtr;
+		};
+
 		// "Multiple" constraint types, put here in root class to avoid ambiguity during use
 		struct AnyAmount
 		{
@@ -436,8 +491,7 @@ namespace LLInitParam
 		LOG_CLASS(BaseBlock);
 		friend class Param;
 
-		BaseBlock();
-		virtual ~BaseBlock();
+		virtual ~BaseBlock() {}
 		bool submitValue(Parser::name_stack_t& name_stack, Parser& p, bool silent=false);
 
 		param_handle_t getHandleFromParam(const Param* param) const;
@@ -460,9 +514,7 @@ namespace LLInitParam
 		void addSynonym(Param& param, const std::string& synonym);
 
 		// Blocks can override this to do custom tracking of changes
-		virtual void paramChanged(const Param& changed_param, bool user_provided);
-
-		S32 getLastChangeVersion() const { return mChangeVersion; }
+		virtual void paramChanged(const Param& changed_param, bool user_provided) {}
 
 		bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name);
 		void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const;
@@ -498,9 +550,6 @@ namespace LLInitParam
 		// take all provided params from other and apply to self
 		bool mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite);
 
-		// can be updated in getters
-		mutable S32				mChangeVersion;
-
 		static BlockDescriptor& selfBlockDescriptor()
 		{
 			static BlockDescriptor sBlockDescriptor;
@@ -511,18 +560,73 @@ namespace LLInitParam
 		const std::string& getParamName(const BlockDescriptor& block_data, const Param* paramp) const;
 	};
 
+	template<typename T>
+	struct ParamCompare<BaseBlock::Lazy<T>, false >
+	{
+		static bool equals(const BaseBlock::Lazy<T>& a, const BaseBlock::Lazy<T>& b) { return !a.empty() || !b.empty(); }
+	};
+
+	class Param
+	{
+	public:
+		void setProvided(bool is_provided = true)
+		{
+			mIsProvided = is_provided;
+			enclosingBlock().paramChanged(*this, is_provided);
+		}
+
+		Param& operator =(const Param& other)
+		{
+			mIsProvided = other.mIsProvided;
+			// don't change mEnclosingblockoffset
+			return *this;
+		}
+	protected:
+
+		bool anyProvided() const { return mIsProvided; }
+
+		Param(BaseBlock* enclosing_block);
+
+		// store pointer to enclosing block as offset to reduce space and allow for quick copying
+		BaseBlock& enclosingBlock() const
+		{ 
+			const U8* my_addr = reinterpret_cast<const U8*>(this);
+			// get address of enclosing BLOCK class using stored offset to enclosing BaseBlock class
+			return *const_cast<BaseBlock*>
+				(reinterpret_cast<const BaseBlock*>
+					(my_addr - (ptrdiff_t)(S32)mEnclosingBlockOffset));
+		}
+
+	private:
+		friend class BaseBlock;
+
+		U32		mEnclosingBlockOffset:31;
+		U32		mIsProvided:1;
+
+	};
+
 	// these templates allow us to distinguish between template parameters
 	// that derive from BaseBlock and those that don't
 	template<typename T, typename Void = void>
 	struct IsBlock
 	{
 		static const bool value = false;
+		struct EmptyBase {};
+		typedef EmptyBase base_class_t;
 	};
 
 	template<typename T>
 	struct IsBlock<T, typename T::baseblock_base_class_t>
 	{
 		static const bool value = true;
+		typedef BaseBlock base_class_t;
+	};
+
+	template<typename T>
+	struct IsBlock<BaseBlock::Lazy<T>, typename T::baseblock_base_class_t >
+	{
+		static const bool value = true;
+		typedef BaseBlock base_class_t;
 	};
 
 	template<typename T, typename NAME_VALUE_LOOKUP, bool VALUE_IS_BLOCK = IsBlock<T>::value>
@@ -530,6 +634,8 @@ namespace LLInitParam
 	{
 	public:
 		typedef const T&							value_assignment_t;
+		typedef T									value_t;
+		typedef ParamValue<T, NAME_VALUE_LOOKUP, VALUE_IS_BLOCK>	self_t;
 
 		ParamValue(): mValue() {}
 		ParamValue(value_assignment_t other) : mValue(other) {}
@@ -559,8 +665,22 @@ namespace LLInitParam
 			return mValue;
 		}
 
+		void operator ()(const typename NAME_VALUE_LOOKUP::name_t& name)
+		{
+			*this = name;
+		}
 
-	private:
+		self_t& operator =(const typename NAME_VALUE_LOOKUP::name_t& name)
+		{
+			if (NAME_VALUE_LOOKUP::getValueFromName(name, mValue))
+			{
+				setValueName(name);
+			}
+
+			return *this;
+		}
+
+	protected:
 		T mValue;
 	};
 
@@ -571,18 +691,16 @@ namespace LLInitParam
 	{
 	public:
 		typedef const T&							value_assignment_t;
+		typedef T									value_t;
+		typedef ParamValue<T, NAME_VALUE_LOOKUP, true>	self_t;
 
 		ParamValue() 
 		:	T(),
-			mKeyVersion(0),
-			mValidatedVersion(-1),
 			mValidated(false)
 		{}
 
 		ParamValue(value_assignment_t other)
 		:	T(other),
-			mKeyVersion(0),
-			mValidatedVersion(-1),
 			mValidated(false)
 		{}
 
@@ -611,13 +729,74 @@ namespace LLInitParam
 			return *this;
 		}
 
-		S32 			mKeyVersion;
+		void operator ()(const typename NAME_VALUE_LOOKUP::name_t& name)
+		{
+			*this = name;
+		}
+
+		self_t& operator =(const typename NAME_VALUE_LOOKUP::name_t& name)
+		{
+			if (NAME_VALUE_LOOKUP::getValueFromName(name, *this))
+			{
+				setValueName(name);
+			}
+
+			return *this;
+		}
 
 	protected:
-		mutable S32 	mValidatedVersion;
 		mutable bool 	mValidated; // lazy validation flag
 	};
 
+	template<typename NAME_VALUE_LOOKUP>
+	class ParamValue<std::string, NAME_VALUE_LOOKUP, false>
+	: public NAME_VALUE_LOOKUP
+	{
+	public:
+		typedef const std::string&	value_assignment_t;
+		typedef std::string			value_t;
+		typedef ParamValue<std::string, NAME_VALUE_LOOKUP, false>	self_t;
+
+		ParamValue(): mValue() {}
+		ParamValue(value_assignment_t other) : mValue(other) {}
+
+		void setValue(value_assignment_t val)
+		{
+			if (NAME_VALUE_LOOKUP::getValueFromName(val, mValue))
+			{
+				NAME_VALUE_LOOKUP::setValueName(val);
+			}
+			else
+			{
+				mValue = val;
+			}
+		}
+
+		value_assignment_t getValue() const
+		{
+			return mValue;
+		}
+
+		std::string& getValue()
+		{
+			return mValue;
+		}
+
+		operator value_assignment_t() const
+		{
+			return mValue;
+		}
+
+		value_assignment_t operator()() const
+		{
+			return mValue;
+		}
+
+	protected:
+		std::string mValue;
+	};
+
+
 	template<typename T, typename NAME_VALUE_LOOKUP = TypeValues<T> >
 	struct ParamIterator
 	{
@@ -636,10 +815,12 @@ namespace LLInitParam
 		public ParamValue<T, NAME_VALUE_LOOKUP>
 	{
 	public:
-		typedef const T&																	value_assignment_t;
 		typedef	TypedParam<T, NAME_VALUE_LOOKUP, HAS_MULTIPLE_VALUES, VALUE_IS_BLOCK>		self_t;
-		typedef NAME_VALUE_LOOKUP															name_value_lookup_t;
 		typedef ParamValue<T, NAME_VALUE_LOOKUP>											param_value_t;
+		typedef typename param_value_t::value_assignment_t				value_assignment_t;
+		typedef NAME_VALUE_LOOKUP															name_value_lookup_t;
+
+		using param_value_t::operator();
 
 		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)
@@ -671,8 +852,7 @@ namespace LLInitParam
 				if (parser.readValue(typed_param.getValue()))
 				{
 					typed_param.clearValueName();
-					typed_param.setProvided(true);
-					typed_param.enclosingBlock().paramChanged(param, true);
+					typed_param.setProvided();
 					return true;
 				}
 				
@@ -687,8 +867,7 @@ namespace LLInitParam
 						if (name_value_lookup_t::getValueFromName(name, typed_param.getValue()))
 						{
 							typed_param.setValueName(name);
-							typed_param.setProvided(true);
-							typed_param.enclosingBlock().paramChanged(param, true);
+							typed_param.setProvided();
 							return true;
 						}
 
@@ -746,14 +925,25 @@ namespace LLInitParam
 
 		void set(value_assignment_t val, bool flag_as_provided = true)
 		{
-			setValue(val);
 			param_value_t::clearValueName();
+			setValue(val);
 			setProvided(flag_as_provided);
-			Param::enclosingBlock().paramChanged(*this, flag_as_provided);
+		}
+
+		self_t& operator =(const typename NAME_VALUE_LOOKUP::name_t& name)
+		{
+			return static_cast<self_t&>(param_value_t::operator =(name));
 		}
 
 	protected:
 
+		self_t& operator =(const self_t& other)
+		{
+			param_value_t::operator =(other);
+			Param::operator =(other);
+			return *this;
+		}
+
 		static bool mergeWith(Param& dst, const Param& src, bool overwrite)
 		{
 			const self_t& src_typed_param = static_cast<const self_t&>(src);
@@ -776,12 +966,12 @@ namespace LLInitParam
 		public ParamValue<T, NAME_VALUE_LOOKUP>
 	{
 	public:
-		typedef const T											value_const_t;
-		typedef T												value_t;
-		typedef value_const_t&									value_assignment_t;
+		typedef ParamValue<T, NAME_VALUE_LOOKUP>				param_value_t;
+		typedef typename param_value_t::value_assignment_t		value_assignment_t;
 		typedef TypedParam<T, NAME_VALUE_LOOKUP, false, true>	self_t;
 		typedef NAME_VALUE_LOOKUP								name_value_lookup_t;
-		typedef ParamValue<T, NAME_VALUE_LOOKUP>				param_value_t;
+
+		using param_value_t::operator();
 
 		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),
@@ -808,8 +998,7 @@ namespace LLInitParam
 			if(typed_param.deserializeBlock(parser, name_stack_range, new_name))
 			{
 				typed_param.clearValueName();
-				typed_param.enclosingBlock().paramChanged(param, true);
-				typed_param.setProvided(true);
+				typed_param.setProvided();
 				return true;
 			}
 
@@ -822,10 +1011,8 @@ namespace LLInitParam
 					// try to parse a per type named value
 					if (name_value_lookup_t::getValueFromName(name, typed_param.getValue()))
 					{
-						typed_param.enclosingBlock().paramChanged(param, true);
 						typed_param.setValueName(name);
-						typed_param.setProvided(true);
-						typed_param.mKeyVersion = typed_param.getLastChangeVersion();
+						typed_param.setProvided();
 						return true;
 					}
 
@@ -845,7 +1032,7 @@ namespace LLInitParam
 			}
 
 			std::string key = typed_param.getValueName();
-			if (!key.empty() && typed_param.mKeyVersion == typed_param.getLastChangeVersion())
+			if (!key.empty())
 			{
 				if (!parser.writeValue(key, name_stack))
 				{
@@ -870,11 +1057,10 @@ namespace LLInitParam
 		bool isProvided() const 
 		{ 
 			// only validate block when it hasn't already passed validation with current data
-			if (Param::anyProvided() && param_value_t::mValidatedVersion < param_value_t::getLastChangeVersion())
+			if (Param::anyProvided() && !param_value_t::mValidated)
 			{
 				// a sub-block is "provided" when it has been filled in enough to be valid
 				param_value_t::mValidated = param_value_t::validateBlock(false);
-				param_value_t::mValidatedVersion = param_value_t::getLastChangeVersion();
 			}
 			return Param::anyProvided() && param_value_t::mValidated;
 		}
@@ -884,28 +1070,44 @@ namespace LLInitParam
 		{
 			setValue(val);
 			param_value_t::clearValueName();
-			// force revalidation of block by clearing known provided version
+			// force revalidation of block
 			// next call to isProvided() will update provision status based on validity
-			param_value_t::mValidatedVersion = -1;
+			param_value_t::mValidated = false;
 			setProvided(flag_as_provided);
-			Param::enclosingBlock().paramChanged(*this, flag_as_provided);
+		}
+
+		self_t& operator =(const typename NAME_VALUE_LOOKUP::name_t& name)
+		{
+			return static_cast<self_t&>(param_value_t::operator =(name));
 		}
 
 		// propagate changed status up to enclosing block
 		/*virtual*/ void paramChanged(const Param& changed_param, bool user_provided)
 		{ 
 			param_value_t::paramChanged(changed_param, user_provided);
-			Param::enclosingBlock().paramChanged(*this, user_provided);
 			if (user_provided)
 			{
 				// a child param has been explicitly changed
 				// so *some* aspect of this block is now provided
-				setProvided(true);
+				param_value_t::mValidated = false;
+				setProvided();
+				param_value_t::clearValueName();
+			}
+			else
+			{
+				Param::enclosingBlock().paramChanged(*this, user_provided);
 			}
 		}
 
 	protected:
 
+		self_t& operator =(const self_t& other)
+		{
+			param_value_t::operator =(other);
+			Param::operator =(other);
+			return *this;
+		}
+
 		static bool mergeWith(Param& dst, const Param& src, bool overwrite)
 		{
 			const self_t& src_typed_param = static_cast<const self_t&>(src);
@@ -917,7 +1119,6 @@ namespace LLInitParam
 				{
 					dst_typed_param.clearValueName();
 					dst_typed_param.setProvided(true);
-					dst_typed_param.enclosingBlock().paramChanged(dst_typed_param, true);
 					return true;
 				}
 			}
@@ -936,7 +1137,7 @@ namespace LLInitParam
 		typedef typename std::vector<param_value_t>							container_t;
 		typedef const container_t&											value_assignment_t;
 
-		typedef VALUE_TYPE													value_t;
+		typedef typename param_value_t::value_t								value_t;
 		typedef NAME_VALUE_LOOKUP											name_value_lookup_t;
 		
 		TypedParam(BlockDescriptor& block_descriptor, const char* name, value_assignment_t value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) 
@@ -1004,7 +1205,7 @@ namespace LLInitParam
 				it != end_it;
 				++it)
 			{
-				std::string key = it->getValue();
+				std::string key = it->getValueName();
 				name_stack.back().second = true;
 
 				if(key.empty())
@@ -1013,7 +1214,7 @@ namespace LLInitParam
 					bool value_written = parser.writeValue(*it, name_stack);
 					if (!value_written)
 					{
-						std::string calculated_key = it->calcValueName(key);
+						std::string calculated_key = it->calcValueName(it->getValue());
 						if (!parser.writeValue(calculated_key, name_stack))
 						{
 							break;
@@ -1043,22 +1244,36 @@ namespace LLInitParam
 		{
 			mValues = val;
 			setProvided(flag_as_provided);
-			Param::enclosingBlock().paramChanged(*this, flag_as_provided);
 		}
 
-		value_t& add()
+		param_value_t& add()
 		{
 			mValues.push_back(param_value_t(value_t()));
-			setProvided(true);
-			Param::enclosingBlock().paramChanged(*this, true);
+			Param::setProvided();
 			return mValues.back();
 		}
 
-		void add(const value_t& item)
+		self_t& add(const value_t& item)
+		{
+			param_value_t param_value;
+			param_value.setValue(item);
+			mValues.push_back(param_value);
+			setProvided();
+			return *this;
+		}
+
+		self_t& add(const typename name_value_lookup_t::name_t& name)
 		{
-			mValues.push_back(param_value_t(item));
-			setProvided(true);
-			Param::enclosingBlock().paramChanged(*this, true);
+			value_t value;
+
+			// try to parse a per type named value
+			if (name_value_lookup_t::getValueFromName(name, value))
+			{
+				add(value);
+				mValues.back().setValueName(name);
+			}
+
+			return *this;
 		}
 
 		// implicit conversion
@@ -1099,8 +1314,7 @@ namespace LLInitParam
 
 			if (src_typed_param.begin() != src_typed_param.end())
 			{
-				dst_typed_param.setProvided(true);
-				dst_typed_param.enclosingBlock().paramChanged(dst_typed_param, true);
+				dst_typed_param.setProvided();
 			}
 			return true;
 		}
@@ -1116,9 +1330,9 @@ namespace LLInitParam
 	public:
 		typedef TypedParam<VALUE_TYPE, NAME_VALUE_LOOKUP, true, true>	self_t;
 		typedef ParamValue<VALUE_TYPE, NAME_VALUE_LOOKUP>				param_value_t;
-		typedef typename std::vector<param_value_t>				container_t;
+		typedef typename std::vector<param_value_t>						container_t;
 		typedef const container_t&										value_assignment_t;
-		typedef VALUE_TYPE												value_t;
+		typedef typename param_value_t::value_t							value_t;
 		typedef NAME_VALUE_LOOKUP										name_value_lookup_t;
 
 		TypedParam(BlockDescriptor& block_descriptor, const char* name, value_assignment_t value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) 
@@ -1158,8 +1372,7 @@ namespace LLInitParam
 			// attempt to parse block...
 			if(value.deserializeBlock(parser, name_stack_range, new_name))
 			{
-				typed_param.enclosingBlock().paramChanged(param, true);
-				typed_param.setProvided(true);
+				typed_param.setProvided();
 				return true;
 			}
 			else if(name_value_lookup_t::valueNamesExist())
@@ -1172,9 +1385,7 @@ namespace LLInitParam
 					if (name_value_lookup_t::getValueFromName(name, value.getValue()))
 					{
 						typed_param.mValues.back().setValueName(name);
-						typed_param.mValues.back().mKeyVersion = value.getLastChangeVersion();
-						typed_param.enclosingBlock().paramChanged(param, true);
-						typed_param.setProvided(true);
+						typed_param.setProvided();
 						return true;
 					}
 
@@ -1201,7 +1412,7 @@ namespace LLInitParam
 				name_stack.back().second = true;
 
 				std::string key = it->getValueName();
-				if (!key.empty() && it->mKeyVersion == it->getLastChangeVersion())
+				if (!key.empty())
 				{
 					parser.writeValue(key, name_stack);
 				}
@@ -1224,22 +1435,33 @@ namespace LLInitParam
 		{
 			mValues = val;
 			setProvided(flag_as_provided);
-			Param::enclosingBlock().paramChanged(*this, flag_as_provided);
 		}
 
-		value_t& add()
+		param_value_t& add()
 		{
 			mValues.push_back(value_t());
-			setProvided(true);
-			Param::enclosingBlock().paramChanged(*this, true);
+			setProvided();
 			return mValues.back();
 		}
 
-		void add(const value_t& item)
+		self_t& add(const value_t& item)
 		{
 			mValues.push_back(item);
-			setProvided(true);
-			Param::enclosingBlock().paramChanged(*this, true);
+			setProvided();
+			return *this;
+		}
+
+		self_t& add(const typename name_value_lookup_t::name_t& name)
+		{
+			value_t value;
+
+			// try to parse a per type named value
+			if (name_value_lookup_t::getValueFromName(name, value))
+			{
+				add(value);
+				mValues.back().setValueName(name);
+			}
+			return *this;
 		}
 
 		// implicit conversion
@@ -1288,8 +1510,7 @@ namespace LLInitParam
 
 			if (src_typed_param.begin() != src_typed_param.end())
 			{
-				dst_typed_param.setProvided(true);
-				dst_typed_param.enclosingBlock().paramChanged(dst_typed_param, true);
+				dst_typed_param.setProvided();
 			}
 
 			return true;
@@ -1298,24 +1519,25 @@ namespace LLInitParam
 		container_t			mValues;
 	};
 
-	template <typename DERIVED_BLOCK>
-	class ChoiceBlock : public BaseBlock
+	template <typename DERIVED_BLOCK, typename BASE_BLOCK = BaseBlock>
+	class ChoiceBlock : public BASE_BLOCK
 	{
-		typedef ChoiceBlock<DERIVED_BLOCK>	self_t;
-		typedef ChoiceBlock<DERIVED_BLOCK>	enclosing_block_t;
+		typedef ChoiceBlock<DERIVED_BLOCK, BASE_BLOCK>	self_t;
+		typedef ChoiceBlock<DERIVED_BLOCK, BASE_BLOCK>	enclosing_block_t;
+		typedef BASE_BLOCK								base_block_t;
 		
 		LOG_CLASS(self_t);
 	public:
 		// take all provided params from other and apply to self
 		bool overwriteFrom(const self_t& other)
 		{
-			return mergeBlock(selfBlockDescriptor(), other, true);
+			return static_cast<DERIVED_BLOCK*>(this)->mergeBlock(selfBlockDescriptor(), other, true);
 		}
 
 		// take all provided params that are not already provided, and apply to self
 		bool fillFrom(const self_t& other)
 		{
-			return mergeBlock(selfBlockDescriptor(), other, false);
+			return static_cast<DERIVED_BLOCK*>(this)->mergeBlock(selfBlockDescriptor(), other, false);
 		}
 
 		bool mergeBlockParam(bool source_provided, bool dest_provided, BlockDescriptor& block_data, const self_t& source, bool overwrite)
@@ -1333,25 +1555,25 @@ namespace LLInitParam
 		bool mergeBlock(BlockDescriptor& block_data, const self_t& other, bool overwrite)
 		{
 			mCurChoice = other.mCurChoice;
-			return BaseBlock::mergeBlock(selfBlockDescriptor(), other, overwrite);
+			return base_block_t::mergeBlock(selfBlockDescriptor(), other, overwrite);
 		}
 
 		// clear out old choice when param has changed
 		/*virtual*/ void paramChanged(const Param& changed_param, bool user_provided)
 		{ 
-			param_handle_t changed_param_handle = BaseBlock::getHandleFromParam(&changed_param);
+			param_handle_t changed_param_handle = base_block_t::getHandleFromParam(&changed_param);
 			// if we have a new choice...
 			if (changed_param_handle != mCurChoice)
 			{
 				// clear provided flag on previous choice
-				Param* previous_choice = BaseBlock::getParamFromHandle(mCurChoice);
+				Param* previous_choice = base_block_t::getParamFromHandle(mCurChoice);
 				if (previous_choice) 
 				{
 					previous_choice->setProvided(false);
 				}
 				mCurChoice = changed_param_handle;
 			}
-			BaseBlock::paramChanged(changed_param, user_provided);
+			base_block_t::paramChanged(changed_param, user_provided);
 		}
 
 		virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return selfBlockDescriptor(); }
@@ -1361,7 +1583,7 @@ namespace LLInitParam
 		ChoiceBlock()
 		:	mCurChoice(0)
 		{
-			BaseBlock::init(selfBlockDescriptor(), BaseBlock::selfBlockDescriptor(), sizeof(DERIVED_BLOCK));
+			BaseBlock::init(selfBlockDescriptor(), base_block_t::selfBlockDescriptor(), sizeof(DERIVED_BLOCK));
 		}
 
 		// Alternatives are mutually exclusive wrt other Alternatives in the same block.  
@@ -1377,6 +1599,8 @@ namespace LLInitParam
 			typedef TypedParam<T, NAME_VALUE_LOOKUP, false, IsBlock<ParamValue<T, NAME_VALUE_LOOKUP> >::value>		super_t;
 			typedef typename super_t::value_assignment_t								value_assignment_t;
 
+			using super_t::operator =;
+
 			explicit Alternative(const char* name = "", value_assignment_t val = defaultValue<T>())
 			:	super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, NULL, 0, 1),
 				mOriginalValue(val)
@@ -1402,7 +1626,7 @@ namespace LLInitParam
 				super_t::set(val);
 			}
 
-			void operator=(value_assignment_t val)
+			void operator =(value_assignment_t val)
 			{
 				super_t::set(val);
 			}
@@ -1447,7 +1671,7 @@ namespace LLInitParam
 
 		const Param* getCurrentChoice() const
 		{
-			return BaseBlock::getParamFromHandle(mCurChoice);
+			return base_block_t::getParamFromHandle(mCurChoice);
 		}
 	};
 
@@ -1493,13 +1717,16 @@ namespace LLInitParam
 			typedef TypedParam<T, NAME_VALUE_LOOKUP, false, IsBlock<ParamValue<T, NAME_VALUE_LOOKUP> >::value>		super_t;
 			typedef typename super_t::value_assignment_t								value_assignment_t;
 
+			using super_t::operator();
+			using super_t::operator =;
+			
 			explicit Optional(const char* name = "", value_assignment_t val = defaultValue<T>())
 			:	super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, NULL, 0, 1)
 			{
 				//#pragma message("Parsing LLInitParam::Block::Optional")
 			}
 
-			Optional& operator=(value_assignment_t val)
+			Optional& operator =(value_assignment_t val)
 			{
 				set(val);
 				return *this;
@@ -1510,7 +1737,6 @@ namespace LLInitParam
 				super_t::set(val);
 				return static_cast<DERIVED_BLOCK&>(Param::enclosingBlock());
 			}
-			using super_t::operator();
 		};
 
 		template <typename T, typename NAME_VALUE_LOOKUP = TypeValues<T> >
@@ -1521,12 +1747,15 @@ namespace LLInitParam
 			typedef Mandatory<T, NAME_VALUE_LOOKUP>										self_t;
 			typedef typename super_t::value_assignment_t								value_assignment_t;
 
+			using super_t::operator();
+			using super_t::operator =;
+
 			// mandatory parameters require a name to be parseable
 			explicit Mandatory(const char* name = "", value_assignment_t val = defaultValue<T>())
 			:	super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, &validate, 1, 1)
 			{}
 
-			Mandatory& operator=(value_assignment_t val)
+			Mandatory& operator =(value_assignment_t val)
 			{
 				set(val);
 				return *this;
@@ -1537,7 +1766,6 @@ namespace LLInitParam
 				super_t::set(val);
 				return static_cast<DERIVED_BLOCK&>(Param::enclosingBlock());
 			}
-			using super_t::operator();
 
 			static bool validate(const Param* p)
 			{
@@ -1562,7 +1790,7 @@ namespace LLInitParam
 			:	super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, container_t(), &validate, RANGE::minCount, RANGE::maxCount)
 			{}
 
-			Multiple& operator=(value_assignment_t val)
+			Multiple& operator =(value_assignment_t val)
 			{
 				set(val);
 				return *this;
@@ -1690,18 +1918,15 @@ namespace LLInitParam
 	public:
 		typedef BatchBlock<DERIVED_BLOCK, BASE_BLOCK> block_t;
 		typedef const BatchBlock<DERIVED_BLOCK, BASE_BLOCK>&	value_assignment_t;
+		typedef block_t value_t;
 
 		ParamValue()
 		:	block_t(),
-			mKeyVersion(0),
-			mValidatedVersion(-1),
 			mValidated(false)
 		{}
 
 		ParamValue(value_assignment_t other)
 		:	block_t(other),
-			mKeyVersion(0),
-			mValidatedVersion(-1),
 			mValidated(false)
 		{
 		}
@@ -1731,11 +1956,80 @@ namespace LLInitParam
 			return *this;
 		}
 
-		S32 			mKeyVersion;
+	protected:
+		mutable bool 	mValidated; // lazy validation flag
+	};
+
+	template<typename T, bool IS_BLOCK>
+	class ParamValue <BaseBlock::Lazy<T>,
+					TypeValues<T>,
+					IS_BLOCK>
+	:	public IsBlock<T>::base_class_t
+	{
+	public:
+		typedef ParamValue <BaseBlock::Lazy<T>, TypeValues<T>, false> self_t;
+		typedef const T& value_assignment_t;
+		typedef T value_t;
+	
+		ParamValue()
+		:	mValue(),
+			mValidated(false)
+		{}
+
+		ParamValue(value_assignment_t other)
+		:	mValue(other),
+			mValidated(false)
+		{}
+
+		void setValue(value_assignment_t val)
+		{
+			mValue.set(val);
+		}
+
+		value_assignment_t getValue() const
+		{
+			return mValue.get();
+		}
+
+		T& getValue()
+		{
+			return mValue.get();
+		}
+
+		operator value_assignment_t() const
+		{
+			return mValue.get();
+		}
+
+		value_assignment_t operator()() const
+		{
+			return mValue.get();
+		}
+
+		bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name)
+		{
+			return mValue.get().deserializeBlock(p, name_stack_range, new_name);
+		}
+
+		void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const
+		{
+			if (mValue.empty()) return;
+			
+			mValue.get().serializeBlock(p, name_stack, diff_block);
+		}
+
+		bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const
+		{
+			if (mValue.empty()) return false;
+
+			return mValue.get().inspectBlock(p, name_stack, min_count, max_count);
+		}
 
 	protected:
-		mutable S32 	mValidatedVersion;
 		mutable bool 	mValidated; // lazy validation flag
+
+	private:
+		BaseBlock::Lazy<T>	mValue;
 	};
 
 	template <>
@@ -1750,15 +2044,11 @@ namespace LLInitParam
 		typedef const LLSD&	value_assignment_t;
 
 		ParamValue()
-		:	mKeyVersion(0),
-			mValidatedVersion(-1),
-			mValidated(false)
+		:	mValidated(false)
 		{}
 
 		ParamValue(value_assignment_t other)
 		:	mValue(other),
-			mKeyVersion(0),
-			mValidatedVersion(-1),
 			mValidated(false)
 		{}
 
@@ -1770,7 +2060,6 @@ namespace LLInitParam
 		operator value_assignment_t() const { return mValue; }
 		value_assignment_t operator()() const { return mValue; }
 		
-		S32 			mKeyVersion;
 
 		// block param interface
 		bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name);
@@ -1782,7 +2071,6 @@ namespace LLInitParam
 		}
 
 	protected:
-		mutable S32 	mValidatedVersion;
 		mutable bool 	mValidated; // lazy validation flag
 
 	private:
@@ -1806,14 +2094,14 @@ namespace LLInitParam
 
 		typedef ParamValue<T, TypeValues<T> >	derived_t;
 		typedef CustomParamValue<T>				self_t;
-		typedef Block<derived_t>		block_t;
+		typedef Block<derived_t>				block_t;
 		typedef const T&						value_assignment_t;
+		typedef T								value_t;
+
 
 		CustomParamValue(const T& value = T())
 		:	mValue(value),
 			mValueAge(VALUE_AUTHORITATIVE),
-			mKeyVersion(0),
-			mValidatedVersion(-1),
 			mValidated(false)
 		{}
 
@@ -1966,8 +2254,6 @@ namespace LLInitParam
 			return getValue();
 		}
 
-		S32 				mKeyVersion;
-
 	protected:
 
 		// use this from within updateValueFromBlock() to set the value without making it authoritative
@@ -2001,7 +2287,6 @@ namespace LLInitParam
 			return block_t::mergeBlock(block_data, source, overwrite);
 		}
 
-		mutable S32			mValidatedVersion;
 		mutable bool 		mValidated; // lazy validation flag
 
 	private:
diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp
index 878f9921783fb1a2b466f5d20b0af7085445accd..afc76024d1e0ef0f8688b8de638cbe52c29843e2 100644
--- a/indra/llxuixml/llxuiparser.cpp
+++ b/indra/llxuixml/llxuiparser.cpp
@@ -59,28 +59,24 @@ const char* NO_VALUE_MARKER = "no_value";
 
 const S32 LINE_NUMBER_HERE = 0;
 
-struct MaxOccur : public LLInitParam::ChoiceBlock<MaxOccur>
+struct MaxOccursValues : public LLInitParam::TypeValuesHelper<U32, MaxOccursValues>
 {
-	Alternative<int> count;
-	Alternative<std::string> unbounded;
-
-	MaxOccur()
-	:	unbounded("", "unbounded")
-	{}
+	static void declareValues()
+	{
+		declare("unbounded", U32_MAX);
+	}
 };
 
 struct Occurs : public LLInitParam::Block<Occurs>
 {
-	Optional<S32>	minOccurs;
-	Optional<MaxOccur>	maxOccurs;
+	Optional<U32>					minOccurs;
+	Optional<U32, MaxOccursValues>	maxOccurs;
 
 	Occurs()
-	:	minOccurs("minOccurs"),
-		maxOccurs("maxOccurs")
-	{
-		minOccurs = 0;
-		maxOccurs.unbounded.choose();
-	}
+	:	minOccurs("minOccurs", 0),
+		maxOccurs("maxOccurs", U32_MAX)
+
+	{}
 };
 
 
@@ -103,18 +99,15 @@ namespace LLInitParam
 	};
 }
 
-struct Name : public LLInitParam::Block<Name>
-{
-	Mandatory<std::string> name;
-
-	Name()
-	:	name("name")
-	{}
-};
+struct Element;
+struct Group;
+struct Choice;
+struct Sequence;
+struct Any;
 
 struct Attribute : public LLInitParam::Block<Attribute>
 {
-	Mandatory<Name>			name;
+	Mandatory<std::string>	name;
 	Mandatory<std::string>	type;
 	Mandatory<EUse>			use;
 	
@@ -122,41 +115,170 @@ struct Attribute : public LLInitParam::Block<Attribute>
 	:	name("name"),
 		type("type"),
 		use("use")
+	{}
+};
+
+struct Any : public LLInitParam::Block<Any, Occurs>
+{
+	Optional<std::string> _namespace;
+
+	Any()
+	:	_namespace("namespace")
+	{}
+};
+
+struct All : public LLInitParam::Block<All, Occurs>
+{
+	Multiple< Lazy<Element> > elements;
+
+	All()
+	:	elements("element")
 	{
+		maxOccurs = 1;
 	}
 };
 
-struct ComplexType : public LLInitParam::Block<ComplexType>
+struct Choice : public LLInitParam::ChoiceBlock<Choice, Occurs>
+{
+	Alternative< Lazy<Element> >	element;
+	Alternative< Lazy<Group> >		group;
+	Alternative< Lazy<Choice> >		choice;
+	Alternative< Lazy<Sequence> >	sequence;
+	Alternative< Lazy<Any> >		any;
+
+	Choice()
+	:	element("element"),
+		group("group"),
+		choice("choice"),
+		sequence("sequence"),
+		any("any")
+	{}
+
+};
+
+struct Sequence : public LLInitParam::ChoiceBlock<Sequence, Occurs>
 {
-	Multiple<Attribute>			attribute;
-	//Multiple<struct Element>	elements;
-	Optional<bool>				mixed;
+	Alternative< Lazy<Element> >	element;
+	Alternative< Lazy<Group> >		group;
+	Alternative< Lazy<Choice> >		choice;
+	Alternative< Lazy<Sequence> >	sequence;
+	Alternative< Lazy<Any> >		any;
+};
+
+struct GroupContents : public LLInitParam::ChoiceBlock<GroupContents, Occurs>
+{
+	Alternative<All>		all;
+	Alternative<Choice>		choice;
+	Alternative<Sequence>	sequence;
+
+	GroupContents()
+	:	all("all"),
+		choice("choice"),
+		sequence("sequence")
+	{}
+};
+
+struct Group : public LLInitParam::Block<Group, GroupContents>
+{
+	Optional<std::string>	name,
+							ref;
+
+	Group()
+	:	name("name"),
+		ref("ref")
+	{}
+};
+
+struct Restriction : public LLInitParam::Block<Restriction>
+{
+};
+
+struct Extension : public LLInitParam::Block<Extension>
+{
+};
+
+struct SimpleContent : public LLInitParam::ChoiceBlock<SimpleContent>
+{
+	Alternative<Restriction> restriction;
+	Alternative<Extension> extension;
+
+	SimpleContent()
+	:	restriction("restriction"),
+		extension("extension")
+	{}
+};
+
+struct SimpleType : public LLInitParam::Block<SimpleType>
+{
+	// TODO
+};
+
+struct ComplexContent : public LLInitParam::Block<ComplexContent, SimpleContent>
+{
+	Optional<bool> mixed;
+
+	ComplexContent()
+	:	mixed("mixed", true)
+	{}
+};
+
+struct ComplexTypeContents : public LLInitParam::ChoiceBlock<ComplexTypeContents>
+{
+	Alternative<SimpleContent>	simple_content;
+	Alternative<ComplexContent> complex_content;
+	Alternative<Group>			group;
+	Alternative<All>			all;
+	Alternative<Choice>			choice;
+	Alternative<Sequence>		sequence;
+
+	ComplexTypeContents()
+	:	simple_content("simpleContent"),
+		complex_content("complexContent"),
+		group("group"),
+		all("all"),
+		choice("choice"),
+		sequence("sequence")
+	{}
+};
+
+struct ComplexType : public LLInitParam::Block<ComplexType, ComplexTypeContents>
+{
+	Optional<std::string>			name;
+	Optional<bool>					mixed;
+
+	Multiple<Attribute>				attribute;
+	Multiple< Lazy<Element> >			elements;
 
 	ComplexType()
-	:	attribute("xs:attribute"),
-		//elements("xs:element"),
+	:	name("name"),
+		attribute("xs:attribute"),
+		elements("xs:element"),
 		mixed("mixed")
 	{
-		mixed = true;
 	}
 };
 
-struct Element : public LLInitParam::Block<Element, Occurs>
+struct ElementContents : public LLInitParam::ChoiceBlock<ElementContents, Occurs>
 {
-	Mandatory<ComplexType>	complexType;
-	Mandatory<Name>			name;
+	Alternative<SimpleType>		simpleType;
+	Alternative<ComplexType>	complexType;
 
-	Element()
-	:	complexType("xs:complexType")
+	ElementContents()
+	:	simpleType("simpleType"),
+		complexType("complexType")
 	{}
 };
 
-struct Elements : public LLInitParam::Block<Elements, Occurs>
+struct Element : public LLInitParam::Block<Element, ElementContents>
 {
-	Multiple<Element> elements;
+	Optional<std::string>	name,
+							ref,
+							type;
 
-	Elements()
-	:	elements("xs:element")
+	Element()
+	:	name("xs:name"),
+		ref("xs:ref"),
+		type("xs:type")
 	{}
 };
 
@@ -164,28 +286,32 @@ struct Schema : public LLInitParam::Block<Schema>
 {
 private:
 	Mandatory<std::string>	targetNamespace,
-							xmlns;
+							xmlns,
+							xs;
 
 public:
 	Optional<std::string>	attributeFormDefault,
-							elementFormDefault,
-							xs;
+							elementFormDefault;
 
-	Optional<Elements>		elements;
+	Mandatory<Element>		root_element;
 	
 	void setNameSpace(const std::string& ns) {targetNamespace = ns; xmlns = ns;}
 
-	Schema()
+	Schema(const std::string& ns = LLStringUtil::null)
 	:	attributeFormDefault("attributeFormDefault"),
 		elementFormDefault("elementFormDefault"),
 		xs("xmlns:xs"),
 		targetNamespace("targetNamespace"),
 		xmlns("xmlns"),
-		elements("xs:choice")
+		root_element("xs:element")
 	{
 		attributeFormDefault = "unqualified";
 		elementFormDefault = "qualified";
 		xs = "http://www.w3.org/2001/XMLSchema";
+		if (!ns.empty())
+		{
+			setNameSpace(ns);
+		};
 	}
 
 };
@@ -214,22 +340,30 @@ LLXSDWriter::LLXSDWriter()
 
 void LLXSDWriter::writeXSD(const std::string& type_name, LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const std::string& xml_namespace)
 {
+	Schema schema(xml_namespace);
+
+	schema.root_element.name = type_name;
+	Choice& choice = schema.root_element.complexType.choice;
+
+	choice.minOccurs = 0;
+	choice.maxOccurs = "unbounded";
+
 	mSchemaNode = node;
-	node->setName("xs:schema");
-	node->createChild("attributeFormDefault", true)->setStringValue("unqualified");
-	node->createChild("elementFormDefault", true)->setStringValue("qualified");
-	node->createChild("targetNamespace", true)->setStringValue(xml_namespace);
-	node->createChild("xmlns:xs", true)->setStringValue("http://www.w3.org/2001/XMLSchema");
-	node->createChild("xmlns", true)->setStringValue(xml_namespace);
-
-	node = node->createChild("xs:complexType", false);
-	node->createChild("name", true)->setStringValue(type_name);
-	node->createChild("mixed", true)->setStringValue("true");
-
-	mAttributeNode = node;
-	mElementNode = node->createChild("xs:choice", false);
-	mElementNode->createChild("minOccurs", true)->setStringValue("0");
-	mElementNode->createChild("maxOccurs", true)->setStringValue("unbounded");
+	//node->setName("xs:schema");
+	//node->createChild("attributeFormDefault", true)->setStringValue("unqualified");
+	//node->createChild("elementFormDefault", true)->setStringValue("qualified");
+	//node->createChild("targetNamespace", true)->setStringValue(xml_namespace);
+	//node->createChild("xmlns:xs", true)->setStringValue("http://www.w3.org/2001/XMLSchema");
+	//node->createChild("xmlns", true)->setStringValue(xml_namespace);
+
+	//node = node->createChild("xs:complexType", false);
+	//node->createChild("name", true)->setStringValue(type_name);
+	//node->createChild("mixed", true)->setStringValue("true");
+
+	//mAttributeNode = node;
+	//mElementNode = node->createChild("xs:choice", false);
+	//mElementNode->createChild("minOccurs", true)->setStringValue("0");
+	//mElementNode->createChild("maxOccurs", true)->setStringValue("unbounded");
 	block.inspectBlock(*this);
 
 	// duplicate element choices
@@ -1247,6 +1381,7 @@ bool LLSimpleXUIParser::readXUI(const std::string& filename, LLInitParam::BaseBl
 	if( !file.isOpen() )
 	{
 		LL_WARNS("ReadXUI") << "Unable to open file " << filename << LL_ENDL;
+		XML_ParserFree( mParser );
 		return false;
 	}
 
diff --git a/indra/lscript/lscript_byteformat.h b/indra/lscript/lscript_byteformat.h
index 7dd21bb1ad4f227c52b9c768e630f152ec6c1e05..a294def73418f26165796f8480a36f07ae2f0f86 100644
--- a/indra/lscript/lscript_byteformat.h
+++ b/indra/lscript/lscript_byteformat.h
@@ -529,6 +529,7 @@ typedef enum e_lscript_runtime_permissions
 	SCRIPT_PERMISSION_CHANGE_PERMISSIONS,
 	SCRIPT_PERMISSION_TRACK_CAMERA,
 	SCRIPT_PERMISSION_CONTROL_CAMERA,
+	SCRIPT_PERMISSION_TELEPORT,
 	SCRIPT_PERMISSION_EOF
 } LSCRIPTRunTimePermissions;
 
@@ -545,6 +546,7 @@ const U32 LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_EOF] =
 	(0x1 << 9),	//	SCRIPT_PERMISSION_CHANGE_PERMISSIONS
 	(0x1 << 10),//	SCRIPT_PERMISSION_TRACK_CAMERA
 	(0x1 << 11),//	SCRIPT_PERMISSION_CONTROL_CAMERA
+	(0x1 << 12),//	SCRIPT_PERMISSION_TELEPORT
 };
 
 // http_request string constants
diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l
index 4e103ae2ba4f4d164846a085eabd1b48b1b8f332..96b7e57e9781bd3cb766c96418a88547c7685667 100644
--- a/indra/lscript/lscript_compile/indra.l
+++ b/indra/lscript/lscript_compile/indra.l
@@ -212,7 +212,8 @@ extern "C" { int yyerror(const char *fmt, ...); }
 "PERMISSION_CHANGE_JOINTS"		{ count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_CHANGE_JOINTS]; return(INTEGER_CONSTANT); }
 "PERMISSION_CHANGE_PERMISSIONS"	{ count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_CHANGE_PERMISSIONS]; return(INTEGER_CONSTANT); }
 "PERMISSION_TRACK_CAMERA"		{ count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TRACK_CAMERA]; return(INTEGER_CONSTANT); }
-"PERMISSION_CONTROL_CAMERA"			{ count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_CONTROL_CAMERA]; return(INTEGER_CONSTANT); }
+"PERMISSION_CONTROL_CAMERA"		{ count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_CONTROL_CAMERA]; return(INTEGER_CONSTANT); }
+"PERMISSION_TELEPORT"			{ count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TELEPORT]; return(INTEGER_CONSTANT); }
 
 "INVENTORY_TEXTURE"					{ count(); yylval.ival = LLAssetType::AT_TEXTURE; return(INTEGER_CONSTANT); }
 "INVENTORY_SOUND"					{ count(); yylval.ival = LLAssetType::AT_SOUND; return(INTEGER_CONSTANT); }
diff --git a/indra/mac_crash_logger/llcrashloggermac.cpp b/indra/mac_crash_logger/llcrashloggermac.cpp
old mode 100755
new mode 100644
diff --git a/indra/media_plugins/quicktime/media_plugin_quicktime.cpp b/indra/media_plugins/quicktime/media_plugin_quicktime.cpp
index 999f754dcf8e3b54d560c13607188e12b665ec45..24328202cb11c30cb64a52e906593e801e3aa74d 100644
--- a/indra/media_plugins/quicktime/media_plugin_quicktime.cpp
+++ b/indra/media_plugins/quicktime/media_plugin_quicktime.cpp
@@ -705,7 +705,7 @@ class MediaPluginQuickTime : public MediaPluginBase
 		// look up "Display Name" in meta data
 		OSType meta_data_key = kQTMetaDataCommonKeyDisplayName;
 		QTMetaDataItem item = kQTMetaDataItemUninitialized;
-		result = QTMetaDataGetNextItem( media_data_ref, kQTMetaDataStorageFormatWildcard, 
+		result = (OSErr)QTMetaDataGetNextItem( media_data_ref, kQTMetaDataStorageFormatWildcard, 
 										0, kQTMetaDataKeyFormatCommon, 
 										(const UInt8 *)&meta_data_key, 
 										sizeof( meta_data_key ), &item );
@@ -714,14 +714,14 @@ class MediaPluginQuickTime : public MediaPluginBase
 
 		// find the size of the title
 		ByteCount size;
-		result = QTMetaDataGetItemValue( media_data_ref, item, NULL, 0, &size );
+		result = (OSErr)QTMetaDataGetItemValue( media_data_ref, item, NULL, 0, &size );
 		if ( noErr != result || size <= 0 /*|| size > 1024  FIXME: arbitrary limit */ ) 
 			return false;
 
 		// allocate some space and grab it
 		UInt8* item_data = new UInt8[ size + 1 ];
 		memset( item_data, 0, ( size + 1 ) * sizeof( UInt8 ) );
-		result = QTMetaDataGetItemValue( media_data_ref, item, item_data, size, NULL );
+		result = (OSErr)QTMetaDataGetItemValue( media_data_ref, item, item_data, size, NULL );
 		if ( noErr != result ) 
 		{
 			delete [] item_data;
diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp
index 13d51099a807f2d403d24092f1519cd93a269559..1812abd7d54656c5784864b958ae4374837c7fef 100644
--- a/indra/media_plugins/webkit/media_plugin_webkit.cpp
+++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp
@@ -382,9 +382,9 @@ class MediaPluginWebKit :
 		
 		//lldebugs << "data url is: " << url.str() << llendl;
 
-		// loading overlay debug screen follows media debugging flag from client for now.
+		// always display loading overlay now
 #if LLQTWEBKIT_API_VERSION >= 16
-		LLQtWebKit::getInstance()->enableLoadingOverlay(mBrowserWindowId, mEnableMediaPluginDebugging);
+		LLQtWebKit::getInstance()->enableLoadingOverlay(mBrowserWindowId, true);
 #else
 		llwarns << "Ignoring enableLoadingOverlay() call (llqtwebkit version is too old)." << llendl;
 #endif
@@ -991,7 +991,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
 		{
 			if(message_name == "set_volume")
 			{
-				F32 volume = message_in.getValueReal("volume");
+				F32 volume = (F32)message_in.getValueReal("volume");
 				setVolume(volume);
 			}
 		}
@@ -1057,9 +1057,9 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
 				S32 height = message_in.getValueS32("height");
 				S32 texture_width = message_in.getValueS32("texture_width");
 				S32 texture_height = message_in.getValueS32("texture_height");
-				mBackgroundR = message_in.getValueReal("background_r");
-				mBackgroundG = message_in.getValueReal("background_g");
-				mBackgroundB = message_in.getValueReal("background_b");
+				mBackgroundR = (F32)message_in.getValueReal("background_r");
+				mBackgroundG = (F32)message_in.getValueReal("background_g");
+				mBackgroundB = (F32)message_in.getValueReal("background_b");
 //				mBackgroundA = message_in.setValueReal("background_a");		// Ignore any alpha
 								
 				if(!name.empty())
@@ -1245,9 +1245,9 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
 			if(message_name == "js_agent_location")
 			{
 #if LLQTWEBKIT_API_VERSION >= 9
-				F32 x = message_in.getValueReal("x");
-				F32 y = message_in.getValueReal("y");
-				F32 z = message_in.getValueReal("z");
+				F32 x = (F32)message_in.getValueReal("x");
+				F32 y = (F32)message_in.getValueReal("y");
+				F32 z = (F32)message_in.getValueReal("z");
 				LLQtWebKit::getInstance()->setAgentLocation( x, y, z );
 				LLQtWebKit::getInstance()->emitLocation();
 #endif
@@ -1256,9 +1256,9 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
 			if(message_name == "js_agent_global_location")
 			{
 #if LLQTWEBKIT_API_VERSION >= 9
-				F32 x = message_in.getValueReal("x");
-				F32 y = message_in.getValueReal("y");
-				F32 z = message_in.getValueReal("z");
+				F32 x = (F32)message_in.getValueReal("x");
+				F32 y = (F32)message_in.getValueReal("y");
+				F32 z = (F32)message_in.getValueReal("z");
 				LLQtWebKit::getInstance()->setAgentGlobalLocation( x, y, z );
 				LLQtWebKit::getInstance()->emitLocation();
 #endif
@@ -1267,7 +1267,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
 			if(message_name == "js_agent_orientation")
 			{
 #if LLQTWEBKIT_API_VERSION >= 9
-				F32 angle = message_in.getValueReal("angle");
+				F32 angle = (F32)message_in.getValueReal("angle");
 				LLQtWebKit::getInstance()->setAgentOrientation( angle );
 				LLQtWebKit::getInstance()->emitLocation();
 #endif
@@ -1323,7 +1323,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
 			else if(message_name == "set_page_zoom_factor")
 			{
 #if LLQTWEBKIT_API_VERSION >= 15
-				F32 factor = message_in.getValueReal("factor");
+				F32 factor = (F32)message_in.getValueReal("factor");
 				LLQtWebKit::getInstance()->setPageZoomFactor(factor);
 #else
 				llwarns << "Ignoring setPageZoomFactor message (llqtwebkit version is too old)." << llendl;
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index ba05f6288bfcdd93e9b084cc4c77fc052c0abd96..9aaefa9c6ae8e1b74c49c2a069cce26cd3468bcf 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -41,12 +41,13 @@ include(UnixInstall)
 include(LLKDU)
 include(ViewerMiscLibs)
 include(LLLogin)
+include(VisualLeakDetector)
 include(GLOD)
 include(CMakeCopyIfDifferent)
 
 include_directories(
     ${DBUSGLIB_INCLUDE_DIRS}
-    ${JSONCPP_INCLUDE_DIRS}
+    ${JSONCPP_INCLUDE_DIR}
     ${GLOD_INCLUDE_DIR}
     ${LLAUDIO_INCLUDE_DIRS}
     ${LLCHARACTER_INCLUDE_DIRS}
@@ -166,7 +167,7 @@ set(viewer_SOURCE_FILES
     llfirstuse.cpp
     llflexibleobject.cpp
     llfloaterabout.cpp
-    llfloateranimpreview.cpp
+    llfloaterbvhpreview.cpp
     llfloaterauction.cpp
     llfloateravatar.cpp
     llfloateravatarpicker.cpp
@@ -216,6 +217,7 @@ set(viewer_SOURCE_FILES
     llfloaternotificationsconsole.cpp
     llfloaterobjectweights.cpp
     llfloateropenobject.cpp
+    llfloateroutbox.cpp
     llfloaterpay.cpp
     llfloaterperms.cpp
     llfloaterpostprocess.cpp
@@ -244,6 +246,7 @@ set(viewer_SOURCE_FILES
     llfloaterurlentry.cpp
     llfloatervoiceeffect.cpp
     llfloaterwebcontent.cpp
+    llfloaterwebprofile.cpp
     llfloaterwhitelistentry.cpp
     llfloaterwindowsize.cpp
     llfloaterworldmap.cpp
@@ -285,7 +288,6 @@ set(viewer_SOURCE_FILES
     llinspectremoteobject.cpp
     llinspecttoast.cpp
     llinventorybridge.cpp
-    llinventoryclipboard.cpp
     llinventoryfilter.cpp
     llinventoryfunctions.cpp
     llinventoryicon.cpp
@@ -301,6 +303,7 @@ set(viewer_SOURCE_FILES
     lllistbrowser.cpp
     lllistcontextmenu.cpp
     lllistview.cpp
+    lllocalbitmaps.cpp
     lllocaltextureobject.cpp
     lllocationhistory.cpp
     lllocationinputctrl.cpp
@@ -313,10 +316,11 @@ set(viewer_SOURCE_FILES
     llmaniprotate.cpp
     llmanipscale.cpp
     llmaniptranslate.cpp
+    llmarketplacefunctions.cpp
+    llmarketplacenotifications.cpp
     llmediactrl.cpp
     llmediadataclient.cpp
     llmemoryview.cpp
-    llmenucommands.cpp
     llmeshrepository.cpp
     llmimetypes.cpp
     llmorphview.cpp
@@ -370,7 +374,6 @@ set(viewer_SOURCE_FILES
     llpanelmaininventory.cpp
     llpanelmarketplaceinbox.cpp
     llpanelmarketplaceinboxinventory.cpp
-    llpanelmarketplaceoutbox.cpp
     llpanelmarketplaceoutboxinventory.cpp
     llpanelmediasettingsgeneral.cpp
     llpanelmediasettingspermissions.cpp
@@ -393,7 +396,6 @@ set(viewer_SOURCE_FILES
     llpanelplacestab.cpp
     llpanelprimmediacontrols.cpp
     llpanelprofile.cpp
-    llpanelprofileview.cpp
     llpanelsnapshot.cpp
     llpanelsnapshotinventory.cpp
     llpanelsnapshotlocal.cpp
@@ -545,9 +547,6 @@ set(viewer_SOURCE_FILES
     llviewerjoint.cpp
     llviewerjointattachment.cpp
     llviewerjointmesh.cpp
-    llviewerjointmesh_sse.cpp
-    llviewerjointmesh_sse2.cpp
-    llviewerjointmesh_vec.cpp
     llviewerjoystick.cpp
     llviewerkeyboard.cpp
     llviewerlayer.cpp
@@ -595,7 +594,6 @@ set(viewer_SOURCE_FILES
     llvopartgroup.cpp
     llvosky.cpp
     llvosurfacepatch.cpp
-    llvotextbubble.cpp
     llvotree.cpp
     llvovolume.cpp
     llvowater.cpp
@@ -631,20 +629,6 @@ set(viewer_SOURCE_FILES
 set(VIEWER_BINARY_NAME "secondlife-bin" CACHE STRING
     "The name of the viewer executable to create.")
 
-if (LINUX)
-  # We can't set these flags for Darwin, because they get passed to
-  # the PPC compiler.  Ugh.
-
-  set_source_files_properties(
-      llviewerjointmesh_sse.cpp
-      PROPERTIES COMPILE_FLAGS "-msse -mfpmath=sse"
-      )
-  set_source_files_properties(
-      llviewerjointmesh_sse2.cpp
-      PROPERTIES COMPILE_FLAGS "-msse2 -mfpmath=sse"
-      )
-endif (LINUX)
-
 set(viewer_HEADER_FILES
     CMakeLists.txt
     ViewerInstall.cmake
@@ -739,7 +723,7 @@ set(viewer_HEADER_FILES
     llfirstuse.h
     llflexibleobject.h
     llfloaterabout.h
-    llfloateranimpreview.h
+    llfloaterbvhpreview.h
     llfloaterauction.h
     llfloateravatar.h
     llfloateravatarpicker.h
@@ -789,6 +773,7 @@ set(viewer_HEADER_FILES
     llfloaternotificationsconsole.h
     llfloaterobjectweights.h
     llfloateropenobject.h
+    llfloateroutbox.h
     llfloaterpay.h
     llfloaterperms.h
     llfloaterpostprocess.h
@@ -817,6 +802,7 @@ set(viewer_HEADER_FILES
     llfloaterurlentry.h
     llfloatervoiceeffect.h
     llfloaterwebcontent.h
+    llfloaterwebprofile.h
     llfloaterwhitelistentry.h
     llfloaterwindowsize.h
     llfloaterworldmap.h
@@ -857,7 +843,6 @@ set(viewer_HEADER_FILES
     llinspectremoteobject.h
     llinspecttoast.h
     llinventorybridge.h
-    llinventoryclipboard.h
     llinventoryfilter.h
     llinventoryfunctions.h
     llinventoryicon.h
@@ -874,6 +859,7 @@ set(viewer_HEADER_FILES
     lllistbrowser.h
     lllistcontextmenu.h
     lllistview.h
+    lllocalbitmaps.h
     lllocaltextureobject.h
     lllocationhistory.h
     lllocationinputctrl.h
@@ -886,10 +872,11 @@ set(viewer_HEADER_FILES
     llmaniprotate.h
     llmanipscale.h
     llmaniptranslate.h
+    llmarketplacefunctions.h
+    llmarketplacenotifications.h
     llmediactrl.h
     llmediadataclient.h
     llmemoryview.h
-    llmenucommands.h
     llmeshrepository.h
     llmimetypes.h
     llmorphview.h
@@ -937,7 +924,6 @@ set(viewer_HEADER_FILES
     llpanelmaininventory.h
     llpanelmarketplaceinbox.h
     llpanelmarketplaceinboxinventory.h
-    llpanelmarketplaceoutbox.h
     llpanelmarketplaceoutboxinventory.h
     llpanelmediasettingsgeneral.h
     llpanelmediasettingspermissions.h
@@ -960,7 +946,6 @@ set(viewer_HEADER_FILES
     llpanelplacestab.h
     llpanelprimmediacontrols.h
     llpanelprofile.h
-    llpanelprofileview.h
     llpanelsnapshot.h
     llpanelteleporthistory.h
     llpaneltiptoast.h
@@ -1156,7 +1141,6 @@ set(viewer_HEADER_FILES
     llvopartgroup.h
     llvosky.h
     llvosurfacepatch.h
-    llvotextbubble.h
     llvotree.h
     llvotreenew.h
     llvovolume.h
@@ -1362,7 +1346,9 @@ if (WINDOWS)
         DXGUID_LIBRARY
         )
 
+# see EXP-1765 - theory is opengl32.lib needs to be included before gdi32.lib (windows libs)
     set(viewer_LIBRARIES
+        opengl32
         ${WINDOWS_LIBRARIES}
         comdlg32
         ${DINPUT_LIBRARY}
@@ -1372,7 +1358,6 @@ if (WINDOWS)
         odbccp32
         ole32
         oleaut32
-        opengl32
         shell32
         Vfw32
         winspool
diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml
index a44b895f7bcf1b79f486065ec9b8cb3ecf2cf447..73df064ab29026cf8a2ef95bf0928e3157de7c58 100644
--- a/indra/newview/app_settings/commands.xml
+++ b/indra/newview/app_settings/commands.xml
@@ -37,6 +37,8 @@
            tooltip_ref="Command_Build_Tooltip"
            execute_function="Build.Toggle"
            execute_parameters="build"
+           is_enabled_function="Build.Enabled"
+           is_enabled_parameters="build"
            is_running_function="Floater.IsOpen"
            is_running_parameters="build"
            />
@@ -135,6 +137,16 @@
            is_running_function="Floater.IsOpen"
            is_running_parameters="moveview"
            />
+  <command name="outbox"
+           available_in_toybox="false"
+           icon="Command_Outbox_Icon"
+           label_ref="Command_Outbox_Label"
+           tooltip_ref="Command_Outbox_Tooltip"
+           execute_function="Floater.ToggleOrBringToFront"
+           execute_parameters="outbox"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="outbox"
+           />
   <command name="people"
            available_in_toybox="true"
            icon="Command_People_Icon"
diff --git a/indra/newview/app_settings/keywords.ini b/indra/newview/app_settings/keywords.ini
index 82b43432eb32bcbbc2374e093af4d08e6158b90d..318b69438a761e4d4cff495aa80f535295517a85 100644
--- a/indra/newview/app_settings/keywords.ini
+++ b/indra/newview/app_settings/keywords.ini
@@ -91,6 +91,7 @@ PERMISSION_CHANGE_LINKS			Passed to llRequestPermissions library function to req
 # PERMISSION_CHANGE_PERMISSIONS Passed to llRequestPermissions library function to request permission to change permissions
 PERMISSION_TRACK_CAMERA			Passed to llRequestPermissions library function to request permission to track agent's camera
 PERMISSION_CONTROL_CAMERA		Passed to llRequestPermissions library function to request permission to change agent's camera
+PERMISSION_TELEPORT				Passed to llRequestPermissions library function to request permission to teleport agent
 
 DEBUG_CHANNEL		Chat channel reserved for debug and error messages from scripts
 PUBLIC_CHANNEL		Chat channel that broadcasts to all nearby users
diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml
index ae72dee9002f13939ae85e7e919eb40a7749c614..a76eb3cd372d9dcf1875b042b0200ff0bae9b7db 100644
--- a/indra/newview/app_settings/logcontrol.xml
+++ b/indra/newview/app_settings/logcontrol.xml
@@ -43,7 +43,7 @@
 					<key>tags</key>
 						<array>
 							<!-- sample entry for debugging a specific item	-->
-<!--						<string>Voice</string>							-->
+<!--						<string>Voice</string>		-->
 						</array>
 				</map>
 			</array>
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
old mode 100755
new mode 100644
index 9c055bdc5a4fcb71554c902ca696a52f93d77920..05c05b9393e6ebe87e8a3a2a8f2f3ec458a2926d
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -621,6 +621,28 @@
       <key>Value</key>
       <string>http://lecs-viewer-web-components.s3.amazonaws.com/v3.0/[GRID_LOWERCASE]/avatars.html</string>
     </map>
+    <key>AvatarRotateThresholdSlow</key>
+    <map>
+      <key>Comment</key>
+      <string>Angle between avatar facing and camera facing at which avatar turns to face same direction as camera, when moving slowly (degrees)</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>F32</string>
+      <key>Value</key>
+      <integer>60</integer>
+    </map>  
+    <key>AvatarRotateThresholdFast</key>
+    <map>
+      <key>Comment</key>
+      <string>Angle between avatar facing and camera facing at which avatar turns to face same direction as camera, when moving fast (degrees)</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>F32</string>
+      <key>Value</key>
+      <integer>2</integer>
+    </map>  
     <key>AvatarBakedTextureUploadTimeout</key>
     <map>
       <key>Comment</key>
@@ -1150,6 +1172,17 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
+    <key>EnableButtonFlashing</key>
+    <map>
+      <key>Comment</key>
+      <string>Allow UI to flash buttons to get your attention</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>1</integer>
+    </map>
     <key>ButtonHPad</key>
     <map>
       <key>Comment</key>
@@ -1392,6 +1425,18 @@
     <real>0.5</real>
   </map>
 
+  <key>CameraMaxCoF</key>
+  <map>
+    <key>Comment</key>
+    <string>Maximum camera circle of confusion for DoF effect</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>F32</string>
+    <key>Value</key>
+    <real>10.0</real>
+  </map>
+
   <key>CameraFNumber</key>
   <map>
     <key>Comment</key>
@@ -1550,17 +1595,6 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
-    <key>ChatVisible</key>
-    <map>
-      <key>Comment</key>
-      <string>Chat bar is visible</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>1</integer>
-    </map>
     <key>ChatWindow</key>
     <map>
       <key>Comment</key>
@@ -1816,6 +1850,28 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
+  <key>CurlMaximumNumberOfHandles</key>
+  <map>
+    <key>Comment</key>
+    <string>Maximum number of handles curl can use (requires restart)</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>S32</string>
+    <key>Value</key>
+    <integer>256</integer>
+  </map>
+  <key>CurlRequestTimeOut</key>
+  <map>
+    <key>Comment</key>
+    <string>Max idle time of a curl request before killed (requires restart)</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>F32</string>
+    <key>Value</key>
+    <real>120.0</real>
+  </map>
   <key>CurlUseMultipleThreads</key>
   <map>
     <key>Comment</key>
@@ -1893,6 +1949,17 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
+    <key>DebugHideEmptySystemFolders</key>
+    <map>
+      <key>Comment</key>
+      <string>Hide empty system folders when on</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>1</integer>
+    </map>
     <key>DebugInventoryFilters</key>
     <map>
       <key>Comment</key>
@@ -3115,17 +3182,6 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
-    <key>EnableRippleWater</key>
-    <map>
-      <key>Comment</key>
-      <string>Whether to use ripple water shader or not</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>1</integer>
-    </map>
     <key>EnableTextureAtlas</key>
     <map>
       <key>Comment</key>
@@ -4259,16 +4315,49 @@
 		<key>Value</key>
 		<integer>0</integer>
 	</map>
-    <key>InventoryMarketplaceUserStatus</key>
+	<key>InventoryOutboxLogging</key>
+	<map>
+		<key>Comment</key>
+		<string>Enable debug output associated with the Merchant Outbox.</string>
+		<key>Persist</key>
+		<integer>1</integer>
+		<key>Type</key>
+		<string>Boolean</string>
+		<key>Value</key>
+		<integer>0</integer>
+	</map>
+    <key>InventoryOutboxMaxFolderCount</key>
     <map>
       <key>Comment</key>
-      <string>Marketplace user status.</string>
+      <string>Maximum number of subfolders allowed in a listing in the merchant outbox.</string>
       <key>Persist</key>
-      <integer>1</integer>
+      <integer>0</integer>
       <key>Type</key>
-      <string>String</string>
+      <string>U32</string>
       <key>Value</key>
-      <string />
+      <integer>21</integer>
+    </map>
+    <key>InventoryOutboxMaxFolderDepth</key>
+    <map>
+      <key>Comment</key>
+      <string>Maximum number of nested levels of subfolders allowed in a listing in the merchant outbox.</string>
+      <key>Persist</key>
+      <integer>0</integer>
+      <key>Type</key>
+      <string>U32</string>
+      <key>Value</key>
+      <integer>4</integer>
+    </map>
+    <key>InventoryOutboxMaxItemCount</key>
+    <map>
+      <key>Comment</key>
+      <string>Maximum number of items allowed in a listing in the merchant outbox.</string>
+      <key>Persist</key>
+      <integer>0</integer>
+      <key>Type</key>
+      <string>U32</string>
+      <key>Value</key>
+      <integer>200</integer>
     </map>
     <key>InventorySortOrder</key>
     <map>
@@ -7796,7 +7885,7 @@
     <key>Type</key>
     <string>U32</string>
     <key>Value</key>
-    <integer>6</integer>
+    <integer>16</integer>
   </map>
     <key>RenderDebugTextureBind</key>
     <map>
@@ -7857,162 +7946,6 @@
     <integer>0</integer>
   </map>
 
-  <key>RenderAnimateTrees</key>
-  <map>
-    <key>Comment</key>
-    <string>Use GL matrix ops to animate tree branches.</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>Boolean</string>
-    <key>Value</key>
-    <integer>0</integer>
-  </map>
-
-  <key>RenderGIRange</key>
-  <map>
-    <key>Comment</key>
-    <string>Distance to cut off GI effect.</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>F32</string>
-    <key>Value</key>
-    <real>96</real>
-  </map>
-
-  <key>RenderGILuminance</key>
-  <map>
-    <key>Comment</key>
-    <string>Luminance factor of global illumination contribution.</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>F32</string>
-    <key>Value</key>
-    <real>0.075</real>
-  </map>
-  
-  <key>RenderGIBrightness</key>
-  <map>
-    <key>Comment</key>
-    <string>Brightness factor of global illumination contribution.</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>F32</string>
-    <key>Value</key>
-    <real>0.3</real>
-  </map>
-
-  <key>RenderGINoise</key>
-  <map>
-    <key>Comment</key>
-    <string>Noise of position sampling for GI photon mapping.</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>F32</string>
-    <key>Value</key>
-    <real>0.7</real>
-  </map>
-
-  <key>RenderGIAttenuation</key>
-  <map>
-    <key>Comment</key>
-    <string>Distance attenuation factor for indirect lighting.</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>F32</string>
-    <key>Value</key>
-    <real>0.1</real>
-  </map>
-
-  <key>RenderGIBlurBrightness</key>
-  <map>
-    <key>Comment</key>
-    <string>Brightness factor of global illumination blur effect.</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>F32</string>
-    <key>Value</key>
-    <real>1.025</real>
-  </map>
-
-  <key>RenderGIBlurEdgeWeight</key>
-  <map>
-    <key>Comment</key>
-    <string>Edge weight for GI soften filter (sharpness).</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>F32</string>
-    <key>Value</key>
-    <real>0.8</real>
-  </map>
-
-  <key>RenderGIBlurIncrement</key>
-  <map>
-    <key>Comment</key>
-    <string>Increment of scale for each pass of global illumination blur effect.</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>F32</string>
-    <key>Value</key>
-    <real>0.8</real>
-  </map>
-
-  <key>RenderLuminanceScale</key>
-  <map>
-    <key>Comment</key>
-    <string>Luminance value scalar for darkening effect.</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>F32</string>
-    <key>Value</key>
-    <real>1.0</real>
-  </map>
-
-  <key>RenderSunLuminanceScale</key>
-  <map>
-    <key>Comment</key>
-    <string>Sun Luminance value scalar for darkening effect.</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>F32</string>
-    <key>Value</key>
-    <real>1.0</real>
-  </map>
-
-  <key>RenderSunLuminanceOffset</key>
-  <map>
-    <key>Comment</key>
-    <string>Sun Luminance value offset for darkening effect.</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>F32</string>
-    <key>Value</key>
-    <real>0</real>
-  </map>
-
-  <key>RenderLuminanceDetail</key>
-  <map>
-    <key>Comment</key>
-    <string>Mipmap level to use for luminance</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>F32</string>
-    <key>Value</key>
-    <real>16.0</real>
-   </map>
-
   <key>RenderMinimumLODTriangleCount</key>
   <map>
     <key>Comment</key>
@@ -8149,7 +8082,19 @@
     <key>Value</key>
     <integer>0</integer>
   </map>
-  
+
+  <key>CameraDoFResScale</key>
+  <map>
+    <key>Comment</key>
+    <string>Amount to scale down depth of field resolution.  Valid range is 0.25 (quarter res) to 1.0 (full res)</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>F32</string>
+    <key>Value</key>
+    <real>0.7</real>
+  </map>
+
   <key>RenderSpotLightsInNondeferred</key>
   <map>
     <key>Comment</key>
@@ -8294,7 +8239,7 @@
     <key>Type</key>
     <string>U32</string>
     <key>Value</key>
-    <real>128</real>
+    <real>512</real>
   </map>
 
   <key>RenderSpecularResY</key>
@@ -8318,7 +8263,7 @@
     <key>Type</key>
     <string>F32</string>
     <key>Value</key>
-    <real>8</real>
+    <real>384</real>
   </map>
 
   <key>RenderDeferred</key>
@@ -8333,18 +8278,6 @@
     <integer>0</integer>
   </map>
 
-  <key>RenderDeferredGI</key>
-  <map>
-    <key>Comment</key>
-    <string>Enable GI in deferred renderer.</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>Boolean</string>
-    <key>Value</key>
-    <integer>0</integer>
-  </map>
-
   <key>RenderDeferredSun</key>
   <map>
     <key>Comment</key>
@@ -8488,92 +8421,6 @@
     <real>0</real>
   </map>
 
-  <key>RenderGIAmbiance</key>
-  <map>
-    <key>Comment</key>
-    <string>Ambiance factor of global illumination contribution.</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>F32</string>
-    <key>Value</key>
-    <real>0.5</real>
-  </map>
-
-  <key>RenderGIMinRenderSize</key>
-  <map>
-    <key>Comment</key>
-    <string>Minimum size of objects to put into GI source map.</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>F32</string>
-    <key>Value</key>
-    <real>0.5</real>
-  </map>
-
-  <key>RenderGIBlurColorCurve</key>
-  <map>
-    <key>Comment</key>
-    <string>Color curve for GI softening kernel</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>Vector3</string>
-    <key>Value</key>
-    <array>
-      <real>1.0</real>
-      <real>0.6</real>
-      <real>0.02</real>
-    </array>
-  </map>
-
-  <key>RenderGIBlurPasses</key>
-  <map>
-    <key>Comment</key>
-    <string>Scale of GI softening kernel.</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>U32</string>
-    <key>Value</key>
-    <real>4</real>
-  </map>
-
-  <key>RenderGIBlurSize</key>
-  <map>
-    <key>Comment</key>
-    <string>Scale of GI softening kernel.</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>F32</string>
-    <key>Value</key>
-    <real>4.0</real>
-  </map>
-  <key>RenderGIBlurSamples</key>
-  <map>
-    <key>Comment</key>
-    <string>Number of samples to take for each pass of GI blur (value range 1-16).  Actual number of samples is value * 2 - 1.</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>U32</string>
-    <key>Value</key>
-    <real>16</real>
-  </map>
-  <key>RenderGIBlurDistFactor</key>
-  <map>
-    <key>Comment</key>
-    <string>Distance scaler for GI blur.</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>F32</string>
-    <key>Value</key>
-    <real>0.0</real>
-  </map>
-
   <key>RenderDynamicLOD</key>
     <map>
       <key>Comment</key>
@@ -8616,7 +8463,7 @@
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>1</integer>
     </map>
     <key>RenderAutoMaskAlphaDeferred</key>
     <map>
@@ -8673,6 +8520,17 @@
       <key>Value</key>
       <real>1.0</real>
     </map>
+    <key>RenderGLCoreProfile</key>
+    <map>
+      <key>Comment</key>
+      <string>Don't use a compatibility profile OpenGL context.  Requires restart.  Basic shaders MUST be enabled.</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
     <key>RenderGlow</key>
     <map>
       <key>Comment</key>
@@ -9243,6 +9101,28 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
+  <key>RenderAutoMuteByteLimit</key>
+  <map>
+    <key>Comment</key>
+    <string>Maximum bytes of attachments before an avatar is automatically visually muted (0 for no limit).</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>U32</string>
+    <key>Value</key>
+    <integer>0</integer>
+  </map>
+  <key>RenderAutoMuteSurfaceAreaLimit</key>
+  <map>
+    <key>Comment</key>
+    <string>Maximum surface area of attachments before an avatar is automatically visually muted (0 for no limit).</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>F32</string>
+    <key>Value</key>
+    <integer>0</integer>
+  </map>
     <key>RenderUseShaderLOD</key>
     <map>
       <key>Comment</key>
@@ -9276,6 +9156,17 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
+    <key>RenderUseVAO</key>
+    <map>
+      <key>Comment</key>
+      <string>Use GL Vertex Array Objects</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
     <key>RenderVBOMappingDisable</key>
     <map>
       <key>Comment</key>
@@ -9285,7 +9176,7 @@
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>1</integer>
     </map>
   <key>RenderUseStreamVBO</key>
   <map>
@@ -9739,18 +9630,29 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
-    <key>ShowConsoleWindow</key>
-    <map>
-      <key>Comment</key>
-      <string>Show log in separate OS window</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
-    <key>NavBarShowCoordinates</key>
+  <key>ShowConsoleWindow</key>
+  <map>
+    <key>Comment</key>
+    <string>Show log in separate OS window</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>Boolean</string>
+    <key>Value</key>
+    <integer>0</integer>
+  </map>
+  <key>EnableVisualLeakDetector</key>
+  <map>
+    <key>Comment</key>
+    <string>EnableVisualLeakDetector</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>Boolean</string>
+    <key>Value</key>
+    <integer>0</integer>
+  </map>
+  <key>NavBarShowCoordinates</key>
     <map>
       <key>Comment</key>
       <string>Show coordinates in navigation bar</string>
@@ -10586,39 +10488,6 @@
       <key>Value</key>
       <integer>0</integer>
     </map>  
-    <key>SnapshotLocalLastResolution</key>
-    <map>
-      <key>Comment</key>
-      <string>Take next local snapshot at this resolution</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>S32</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
-    <key>SnapshotProfileLastResolution</key>
-    <map>
-      <key>Comment</key>
-      <string>Take next profile snapshot at this resolution</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>S32</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
-    <key>SnapshotPostcardLastResolution</key>
-    <map>
-      <key>Comment</key>
-      <string>Take next postcard snapshot at this resolution</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>S32</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
     <key>SnapshotQuality</key>
     <map>
       <key>Comment</key>
@@ -10652,17 +10521,6 @@
       <key>Value</key>
       <string>http://photos.apps.staging.avatarsunited.com/viewer_config</string>
     </map>
-    <key>SnapshotTextureLastResolution</key>
-    <map>
-      <key>Comment</key>
-      <string>Take next texture snapshot at this resolution</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>S32</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
     <key>SpeedTest</key>
     <map>
       <key>Comment</key>
@@ -11597,17 +11455,6 @@
       <key>Value</key>
       <real>3</real>
     </map>
-    <key>UIResizeBarOverlap</key>
-    <map>
-      <key>Comment</key>
-      <string>Size of UI resize bar overlap</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>S32</string>
-      <key>Value</key>
-      <real>1</real>
-    </map>
     <key>UIScaleFactor</key>
     <map>
       <key>Comment</key>
@@ -12277,7 +12124,7 @@
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>1</integer>
+      <boolean>1</boolean>
     </map>
     <key>UseFreezeFrame</key>
     <map>
@@ -12421,50 +12268,6 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
-    <key>VectorizeEnable</key>
-    <map>
-      <key>Comment</key>
-      <string>Enable general vector operations and data alignment.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
-    <key>VectorizePerfTest</key>
-    <map>
-      <key>Comment</key>
-      <string>Test SSE/vectorization performance and choose fastest version.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>1</integer>
-    </map>
-    <key>VectorizeProcessor</key>
-    <map>
-      <key>Comment</key>
-      <string>0=Compiler Default, 1=SSE, 2=SSE2, autodetected</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>U32</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
-    <key>VectorizeSkin</key>
-    <map>
-      <key>Comment</key>
-      <string>Enable vector operations for avatar skinning.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>1</integer>
-    </map>
     <key>VelocityInterpolate</key>
     <map>
       <key>Comment</key>
@@ -12916,10 +12719,10 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
-    <key>WindowFullScreen</key>
+    <key>FullScreen</key>
     <map>
       <key>Comment</key>
-      <string>SL viewer window full screen</string>
+      <string>run a fullscreen session</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
@@ -12927,6 +12730,17 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
+    <key>MinWindowHeight</key>
+    <map>
+      <key>Comment</key>
+      <string>SL viewer minimum window height in pixels</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>U32</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
     <key>WindowHeight</key>
     <map>
       <key>Comment</key>
@@ -12934,7 +12748,7 @@
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>S32</string>
+      <string>U32</string>
       <key>Value</key>
       <integer>738</integer>
     </map>
@@ -12949,6 +12763,17 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
+    <key>MinWindowWidth</key>
+    <map>
+      <key>Comment</key>
+      <string>SL viewer minimum window width in pixels</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>U32</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
     <key>WindowWidth</key>
     <map>
       <key>Comment</key>
@@ -12956,14 +12781,14 @@
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>S32</string>
+      <string>U32</string>
       <key>Value</key>
       <integer>1024</integer>
     </map>
     <key>WindowX</key>
     <map>
       <key>Comment</key>
-      <string>X coordinate of lower left corner of SL viewer window, relative to primary display (pixels)</string>
+      <string>X coordinate of upper left corner of SL viewer window, relative to upper left corner of primary display (pixels)</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
@@ -12974,7 +12799,7 @@
     <key>WindowY</key>
     <map>
       <key>Comment</key>
-      <string>Y coordinate of lower left corner of SL viewer window, relative to primary display (pixels)</string>
+      <string>Y coordinate of upper left corner of SL viewer window, relative to upper left corner of primary display (pixels)</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
@@ -13653,10 +13478,10 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
-     <key>WebProfileRect</key>
+     <key>WebProfileFloaterRect</key>
     <map>
       <key>Comment</key>
-      <string>Web profile dimensions</string>
+      <string>Web profile floater dimensions</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
@@ -13664,8 +13489,8 @@
       <key>Value</key>
       <array>
         <integer>0</integer>
-        <integer>650</integer>
-        <integer>490</integer>
+        <integer>680</integer>
+        <integer>485</integer>
         <integer>0</integer>
         </array>
         </map>
diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml
index 8cdd8ed838084dce4e1ff7a53f6fe2fa945d5d3b..143126b3345307e4d16083378d5ee539da0637d1 100644
--- a/indra/newview/app_settings/settings_per_account.xml
+++ b/indra/newview/app_settings/settings_per_account.xml
@@ -33,6 +33,28 @@
         <key>Value</key>
             <string />
         </map>
+    <key>InventoryInboxHeight</key>
+    <map>
+        <key>Comment</key>
+            <string>Inventory inbox panel height in Inventory floater.</string>
+        <key>Persist</key>
+            <integer>1</integer>
+        <key>Type</key>
+            <string>S32</string>
+        <key>Value</key>
+            <integer>200</integer>
+    </map>
+    <key>InventoryInboxToggleState</key>
+    <map>
+        <key>Comment</key>
+            <string>Stores the open/closed state of inventory Received Items panel.</string>
+        <key>Persist</key>
+            <integer>1</integer>
+        <key>Type</key>
+            <string>Boolean</string>
+        <key>Value</key>
+            <integer>0</integer>
+    </map>
     <key>DisplayDestinationsOnInitialRun</key>
         <map>
         <key>Comment</key>
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
index c72da8d75824c92d59dfa0594e4ff9f90e6f1401..bc63d07d726ccda9dee47a148166cd0592cea4be 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
@@ -24,8 +24,7 @@
  */
  
 
-
-attribute vec4 weight;  //1
+ATTRIBUTE vec4 weight;
 
 uniform vec4 matrixPalette[45];
 
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
index c2fe60ddaf8daf8d7200fe369a830c41ea7cec7a..19203ab6707879df20d56cdc4c3e678d9e2b2e09 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
@@ -22,8 +22,17 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
+uniform vec4 color;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 mat4 getSkinnedTransform();
@@ -31,32 +40,30 @@ void calcAtmospherics(vec3 inPositionEye);
 
 void main()
 {
-	gl_TexCoord[0] = gl_MultiTexCoord0;
+	vary_texcoord0 = texcoord0;
 				
 	vec4 pos;
 	vec3 norm;
 	
+	vec4 pos_in = vec4(position.xyz, 1.0);
+
 	mat4 trans = getSkinnedTransform();
-	pos.x = dot(trans[0], gl_Vertex);
-	pos.y = dot(trans[1], gl_Vertex);
-	pos.z = dot(trans[2], gl_Vertex);
+	pos.x = dot(trans[0], pos_in);
+	pos.y = dot(trans[1], pos_in);
+	pos.z = dot(trans[2], pos_in);
 	pos.w = 1.0;
 	
-	norm.x = dot(trans[0].xyz, gl_Normal);
-	norm.y = dot(trans[1].xyz, gl_Normal);
-	norm.z = dot(trans[2].xyz, gl_Normal);
+	norm.x = dot(trans[0].xyz, normal);
+	norm.y = dot(trans[1].xyz, normal);
+	norm.z = dot(trans[2].xyz, normal);
 	norm = normalize(norm);
 		
-	gl_Position = gl_ProjectionMatrix * pos;
-	
-	//gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+	gl_Position = projection_matrix * pos;
 	
-	gl_FogFragCoord = length(pos.xyz);
-
 	calcAtmospherics(pos.xyz);
 
-	vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0,0,0,0));
-	gl_FrontColor = color; 
+	vec4 col = calcLighting(pos.xyz, norm, color, vec4(0,0,0,0));
+	vertex_color = col; 
 
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
index 1a0866be0a8c8292cbcd1ed16ef2b22caae068e7..82db15c3aeb0e6116a2c7d2a13c73ac6e429854c 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
@@ -22,8 +22,19 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
@@ -31,17 +42,18 @@ void calcAtmospherics(vec3 inPositionEye);
 void main()
 {
 	//transform vertex
-	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+	vec3 pos = (modelview_matrix * vec4(position.xyz, 1.0)).xyz;
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	
 	
-	vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
-	vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+	vec3 norm = normalize(normal_matrix * normal);
 		
 	calcAtmospherics(pos.xyz);
 
 	vec4 specular = vec4(1.0);
-	vec4 color = calcLightingSpecular(pos, norm, gl_Color, specular, vec4(0.0));	
-	gl_FrontColor = color;
+	vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0));	
+	vertex_color = color;
 
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
index 09688b2be2260f948654f25c067c519a3dc1df78..43ed41a2050c11affab3e55a044787fa7be14bf3 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
@@ -24,7 +24,7 @@
 
 
 
-attribute vec4 object_weight;  
+ATTRIBUTE vec4 weight4;  
 
 uniform mat4 matrixPalette[32];
 
@@ -32,8 +32,8 @@ mat4 getObjectSkinnedTransform()
 {
 	int i; 
 	
-	vec4 w = fract(object_weight);
-	vec4 index = floor(object_weight);
+	vec4 w = fract(weight4);
+	vec4 index = floor(weight4);
 	
 	float scale = 1.0/(w.x+w.y+w.z+w.w);
 	w *= scale;
diff --git a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl
index 374808c091121226134a1b57585437cf1e6c5a49..7a359052801af826a0c6d4be01879fe815131465 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl
@@ -22,12 +22,19 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 uniform sampler2D diffuseMap;
 
 void main() 
 {
-	gl_FragColor = vec4(gl_Color.rgb, texture2D(diffuseMap, gl_TexCoord[0].xy).a);
+	frag_color = vec4(vertex_color.rgb, texture2D(diffuseMap, vary_texcoord0.xy).a);
 }
diff --git a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl
index e25d84a594c2b9bae5eb32fd3285588f4dc182b2..78b5328c9a3a16a839375ab3caa9765a1b0fd7cf 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl
@@ -22,22 +22,29 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 mat4 getSkinnedTransform();
 
 void main()
 {
 	vec4 pos;
-		
+	vec4 pos_in = vec4(position, 1.0);
 	mat4 trans = getSkinnedTransform();
-	pos.x = dot(trans[0], gl_Vertex);
-	pos.y = dot(trans[1], gl_Vertex);
-	pos.z = dot(trans[2], gl_Vertex);
+	pos.x = dot(trans[0], pos_in);
+	pos.y = dot(trans[1], pos_in);
+	pos.z = dot(trans[2], pos_in);
 	pos.w = 1.0;
 			
-	gl_FrontColor = gl_Color;
-	gl_TexCoord[0] = gl_MultiTexCoord0;
-	gl_Position = gl_ProjectionMatrix * pos;
+	vertex_color = diffuse_color;
+	vary_texcoord0 = texcoord0;
+	gl_Position = projection_matrix * pos;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 19de0c0b39f3048fb14552e1cd3894011c8a7369..dd87ddb330edbfa39b2a079b1b57b603e2c43cbc 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -23,41 +23,33 @@
  * $/LicenseInfo$
  */
  
-
-
 #extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform sampler2DRect depthMap;
 
 vec4 diffuseLookup(vec2 texcoord);
 
-uniform mat4 shadow_matrix[6];
-uniform vec4 shadow_clip;
 uniform vec2 screen_res;
 
 vec3 atmosLighting(vec3 light);
 vec3 scaleSoftClip(vec3 light);
 
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_fragcoord;
-varying vec3 vary_position;
-varying vec3 vary_pointlight_col;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_position;
+VARYING vec3 vary_pointlight_col;
 
-uniform mat4 inv_proj;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
-vec4 getPosition(vec2 pos_screen)
-{
-	float depth = texture2DRect(depthMap, pos_screen.xy).a;
-	vec2 sc = pos_screen.xy*2.0;
-	sc /= screen_res;
-	sc -= vec2(1.0,1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
+uniform mat4 inv_proj;
 
 void main() 
 {
@@ -66,9 +58,9 @@ void main()
 	
 	vec4 pos = vec4(vary_position, 1.0);
 	
-	vec4 diff= diffuseLookup(gl_TexCoord[0].xy);
+	vec4 diff= diffuseLookup(vary_texcoord0.xy);
 
-	vec4 col = vec4(vary_ambient + vary_directional.rgb, gl_Color.a);
+	vec4 col = vec4(vary_ambient + vary_directional.rgb, vertex_color.a);
 	vec4 color = diff * col;
 	
 	color.rgb = atmosLighting(color.rgb);
@@ -77,9 +69,6 @@ void main()
 
 	color.rgb += diff.rgb * vary_pointlight_col.rgb;
 
-	gl_FragColor = color;
-	//gl_FragColor = vec4(1,0,1,1);
-	//gl_FragColor = vec4(1,0,1,1)*shadow;
-	
+	frag_color = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl
index d4f56896cfa6f75bca10c07d91d626cd6092cfee..beb329018727a568f9ff25e6966a2e8cc1b2bb93 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl
@@ -23,26 +23,30 @@
  * $/LicenseInfo$
  */
  
-
-
 #extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform sampler2DRect depthMap;
 uniform sampler2D diffuseMap;
 
 
-uniform mat4 shadow_matrix[6];
-uniform vec4 shadow_clip;
 uniform vec2 screen_res;
 
 vec3 atmosLighting(vec3 light);
 vec3 scaleSoftClip(vec3 light);
 
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_fragcoord;
-varying vec3 vary_position;
-varying vec3 vary_pointlight_col;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_position;
+VARYING vec3 vary_pointlight_col;
+VARYING vec2 vary_texcoord0;
+VARYING vec4 vertex_color;
 
 uniform mat4 inv_proj;
 
@@ -66,9 +70,9 @@ void main()
 	
 	vec4 pos = vec4(vary_position, 1.0);
 	
-	vec4 diff= texture2D(diffuseMap,gl_TexCoord[0].xy);
+	vec4 diff= texture2D(diffuseMap,vary_texcoord0.xy);
 
-	vec4 col = vec4(vary_ambient + vary_directional.rgb, gl_Color.a);
+	vec4 col = vec4(vary_ambient + vary_directional.rgb, vertex_color.a);
 	vec4 color = diff * col;
 	
 	color.rgb = atmosLighting(color.rgb);
@@ -77,9 +81,9 @@ void main()
 
 	color.rgb += diff.rgb * vary_pointlight_col.rgb;
 
-	gl_FragColor = color;
-	//gl_FragColor = vec4(1,0,1,1);
-	//gl_FragColor = vec4(1,0,1,1)*shadow;
+	frag_color = color;
+	//frag_color = vec4(1,0,1,1);
+	//frag_color = vec4(1,0,1,1)*shadow;
 	
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..cb87b754b429e06c52c5999ece6570be92bd7950
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl
@@ -0,0 +1,84 @@
+/** 
+ * @file alphaNonIndexedNoColorF.glsl
+ *
+ * $LicenseInfo:firstyear=2005&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2005, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+ 
+#extension GL_ARB_texture_rectangle : enable
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+uniform sampler2DRect depthMap;
+uniform sampler2D diffuseMap;
+
+uniform vec2 screen_res;
+
+vec3 atmosLighting(vec3 light);
+vec3 scaleSoftClip(vec3 light);
+
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_position;
+VARYING vec3 vary_pointlight_col;
+VARYING vec2 vary_texcoord0;
+
+uniform mat4 inv_proj;
+
+vec4 getPosition(vec2 pos_screen)
+{
+	float depth = texture2DRect(depthMap, pos_screen.xy).a;
+	vec2 sc = pos_screen.xy*2.0;
+	sc /= screen_res;
+	sc -= vec2(1.0,1.0);
+	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
+	vec4 pos = inv_proj * ndc;
+	pos /= pos.w;
+	pos.w = 1.0;
+	return pos;
+}
+
+void main() 
+{
+	vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
+	frag *= screen_res;
+	
+	vec4 pos = vec4(vary_position, 1.0);
+	
+	vec4 diff= texture2D(diffuseMap,vary_texcoord0.xy);
+
+	vec4 col = vec4(vary_ambient + vary_directional.rgb, 1.0);
+	vec4 color = diff * col;
+	
+	color.rgb = atmosLighting(color.rgb);
+
+	color.rgb = scaleSoftClip(color.rgb);
+
+	color.rgb += diff.rgb * vary_pointlight_col.rgb;
+
+	frag_color = color;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
index d57b8f8525e9c15b28e549d168caf21dcc6d59cb..5a0e8ff68490f5c6860f5e3df697c4da06829bfe 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
@@ -21,10 +21,15 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 projection_matrix;
+uniform mat4 modelview_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
 
-vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 mat4 getObjectSkinnedTransform();
 void calcAtmospherics(vec3 inPositionEye);
 
@@ -32,35 +37,46 @@ float calcDirectionalLight(vec3 n, vec3 l);
 
 vec3 atmosAmbient(vec3 light);
 vec3 atmosAffectDirectionalLight(float lightIntensity);
-vec3 scaleDownLight(vec3 light);
-vec3 scaleUpLight(vec3 light);
 
-varying vec3 vary_position;
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_normal;
-varying vec3 vary_fragcoord;
-varying vec3 vary_pointlight_col;
+VARYING vec3 vary_position;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_pointlight_col;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 
 uniform float near_clip;
 
+uniform vec4 light_position[8];
+uniform vec3 light_direction[8];
+uniform vec3 light_attenuation[8]; 
+uniform vec3 light_diffuse[8];
+
+float calcDirectionalLight(vec3 n, vec3 l)
+{
+        float a = max(dot(n,l),0.0);
+        return a;
+}
+
 float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
 {
 	//get light vector
 	vec3 lv = lp.xyz-v;
 	
 	//get distance
-	float d = length(lv);
+	float d = dot(lv,lv);
 	
 	float da = 0.0;
 
 	if (d > 0.0 && la > 0.0 && fa > 0.0)
 	{
 		//normalize light vector
-		lv *= 1.0/d;
+		lv = normalize(lv);
 	
 		//distance attenuation
-		float dist2 = d*d/(la*la);
+		float dist2 = d/la;
 		da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
 
 		// spotlight coefficient.
@@ -68,7 +84,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
 		da *= spot*spot; // GL_SPOT_EXPONENT=2
 
 		//angular attenuation
-		da *= calcDirectionalLight(n, lv);
+		da *= max(dot(n, lv), 0.0);		
 	}
 
 	return da;	
@@ -76,52 +92,51 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
 
 void main()
 {
-	gl_TexCoord[0] = gl_MultiTexCoord0;
+	vary_texcoord0 = texcoord0;
 				
 	vec4 pos;
 	vec3 norm;
 	
 	mat4 trans = getObjectSkinnedTransform();
-	trans = gl_ModelViewMatrix * trans;
+	trans = modelview_matrix * trans;
 	
-	pos = trans * gl_Vertex;
+	pos = trans * vec4(position.xyz, 1.0);
 	
-	norm = gl_Vertex.xyz + gl_Normal.xyz;
+	norm = position.xyz + normal.xyz;
 	norm = normalize(( trans*vec4(norm, 1.0) ).xyz-pos.xyz);
 	
-	vec4 frag_pos = gl_ProjectionMatrix * pos;
+	vec4 frag_pos = projection_matrix * pos;
 	gl_Position = frag_pos;
 	
 	vary_position = pos.xyz;
-	vary_normal = norm;	
-	
+		
 	calcAtmospherics(pos.xyz);
 
-	vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+	vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);
 
 	// Collect normal lights
-	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
-	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a);
-	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a);
-	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a);
-	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
-	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
-	
-	vary_pointlight_col = col.rgb*gl_Color.rgb;
+	col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].y, light_attenuation[2].z);
+	col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].y, light_attenuation[3].z);
+	col.rgb += light_diffuse[4].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[4], light_direction[4], light_attenuation[4].x, light_attenuation[4].y, light_attenuation[4].z);
+	col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].y, light_attenuation[5].z);
+	col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].y, light_attenuation[6].z);
+	col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].y, light_attenuation[7].z);
+
+	vary_pointlight_col = col.rgb*diffuse_color.rgb;
 
 	col.rgb = vec3(0,0,0);
 
 	// Add windlight lights
 	col.rgb = atmosAmbient(vec3(0.));
 	
-	vary_ambient = col.rgb*gl_Color.rgb;
-	vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+	vary_ambient = col.rgb*diffuse_color.rgb;
+	vary_directional = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a)));
 	
-	col.rgb = min(col.rgb*gl_Color.rgb, 1.0);
+	col.rgb = min(col.rgb*diffuse_color.rgb, 1.0);
 	
-	gl_FrontColor = col;
+	vertex_color = col;
 
-	gl_FogFragCoord = pos.z;
+	
 	
 	vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
index f6a280462e133464eec35bd1d1e63ac7e3858478..cf38a2f4f7908a1afff98b720d5160721ae7240b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
@@ -23,7 +23,16 @@
  * $/LicenseInfo$
  */
 
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
 
+ATTRIBUTE vec3 position;
+void passTextureIndex();
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
@@ -35,35 +44,48 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
 vec3 scaleDownLight(vec3 light);
 vec3 scaleUpLight(vec3 light);
 
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_fragcoord;
-varying vec3 vary_position;
-varying vec3 vary_light;
-varying vec3 vary_pointlight_col;
-varying float vary_texture_index;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_position;
+VARYING vec3 vary_pointlight_col;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 
 uniform float near_clip;
 uniform float shadow_offset;
 uniform float shadow_bias;
 
+uniform vec4 light_position[8];
+uniform vec3 light_direction[8];
+uniform vec3 light_attenuation[8]; 
+uniform vec3 light_diffuse[8];
+
+float calcDirectionalLight(vec3 n, vec3 l)
+{
+        float a = max(dot(n,l),0.0);
+        return a;
+}
+
 float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
 {
 	//get light vector
 	vec3 lv = lp.xyz-v;
 	
 	//get distance
-	float d = length(lv);
+	float d = dot(lv,lv);
 	
 	float da = 0.0;
 
 	if (d > 0.0 && la > 0.0 && fa > 0.0)
 	{
 		//normalize light vector
-		lv *= 1.0/d;
+		lv = normalize(lv);
 	
 		//distance attenuation
-		float dist2 = d*d/(la*la);
+		float dist2 = d/la;
 		da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
 
 		// spotlight coefficient.
@@ -71,7 +93,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
 		da *= spot*spot; // GL_SPOT_EXPONENT=2
 
 		//angular attenuation
-		da *= calcDirectionalLight(n, lv);
+		da *= max(dot(n, lv), 0.0);		
 	}
 
 	return da;	
@@ -80,50 +102,47 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
 void main()
 {
 	//transform vertex
-	vec4 vert = vec4(gl_Vertex.xyz, 1.0);
-	vary_texture_index = gl_Vertex.w;
-	gl_Position = gl_ModelViewProjectionMatrix * vert; 
+	vec4 vert = vec4(position.xyz, 1.0);
+	passTextureIndex();
+	vec4 pos = (modelview_matrix * vert);
+	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
 	
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
-	vec4 pos = (gl_ModelViewMatrix * vert);
-	vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+	vec3 norm = normalize(normal_matrix * normal);
 	
-	float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz));
-	vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset;
+	float dp_directional_light = max(0.0, dot(norm, light_position[0].xyz));
+	vary_position = pos.xyz + light_position[0].xyz * (1.0-dp_directional_light)*shadow_offset;
 		
 	calcAtmospherics(pos.xyz);
 
-	//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
-	vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+	//vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
+	vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);
 
 	// Collect normal lights
-	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
-	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a);
-	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a);
-	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a);
-	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
-	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
+	col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].y, light_attenuation[2].z);
+	col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].y, light_attenuation[3].z);
+	col.rgb += light_diffuse[4].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[4], light_direction[4], light_attenuation[4].x, light_attenuation[4].y, light_attenuation[4].z);
+	col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].y, light_attenuation[5].z);
+	col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].y, light_attenuation[6].z);
+	col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].y, light_attenuation[7].z);
 	
-	vary_pointlight_col = col.rgb*gl_Color.rgb;
-
+	vary_pointlight_col = col.rgb*diffuse_color.rgb;
 	col.rgb = vec3(0,0,0);
 
 	// Add windlight lights
 	col.rgb = atmosAmbient(vec3(0.));
 	
-	vary_light = gl_LightSource[0].position.xyz;
+	vary_ambient = col.rgb*diffuse_color.rgb;
+	vary_directional.rgb = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a)));
 	
-	vary_ambient = col.rgb*gl_Color.rgb;
-	vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+	col.rgb = col.rgb*diffuse_color.rgb;
 	
-	col.rgb = col.rgb*gl_Color.rgb;
-	
-	gl_FrontColor = col;
+	vertex_color = col;
 
-	gl_FogFragCoord = pos.z;
 	
-	pos = gl_ModelViewProjectionMatrix * vert;
+	
+	pos = modelview_projection_matrix * vert;
 	vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
 	
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl
index 0c930848e58e09f3ad8074acdad57caa489f589e..22c9a4d14e3d88137df21be5e1e4139713b12b31 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl
@@ -22,14 +22,18 @@
  * $/LicenseInfo$
  */
 
-
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
 uniform sampler2D diffuseMap;
 
+VARYING vec2 vary_texcoord0;
 
 void main() 
 {
-	//gl_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy).a);
-	gl_FragColor = vec4(1,1,1,1);
+	frag_color = vec4(1,1,1,1);
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl
index bf4e79d815e3106d98d89b5385b35dfdcbfbc5f7..81961d7746053e0ebcb9570583b10b7423df5495 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl
@@ -22,23 +22,24 @@
  * $/LicenseInfo$
  */
 
+uniform mat4 projection_matrix;
+uniform mat4 modelview_matrix;
+uniform mat4 texture_matrix0;
 
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
 
 mat4 getObjectSkinnedTransform();
 
 void main()
 {
 	//transform vertex
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-	
 	mat4 mat = getObjectSkinnedTransform();
 	
-	mat = gl_ModelViewMatrix * mat;
-	vec3 pos = (mat*gl_Vertex).xyz;
-	
-	gl_FrontColor = gl_Color;
+	mat = modelview_matrix * mat;
+	vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
 	
-	vec4 p = gl_ProjectionMatrix * vec4(pos, 1.0);
+	vec4 p = projection_matrix * vec4(pos, 1.0);
 	p.z = max(p.z, -p.w+0.01);
 	gl_Position = p;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..5f395801e510fa4d1a1069665518dd5beced0350
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl
@@ -0,0 +1,148 @@
+/** 
+ * @file avatarAlphaNoColorV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+uniform mat4 projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+
+vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
+mat4 getSkinnedTransform();
+void calcAtmospherics(vec3 inPositionEye);
+
+float calcDirectionalLight(vec3 n, vec3 l);
+float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
+
+vec3 atmosAmbient(vec3 light);
+vec3 atmosAffectDirectionalLight(float lightIntensity);
+vec3 scaleDownLight(vec3 light);
+vec3 scaleUpLight(vec3 light);
+
+VARYING vec3 vary_position;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_pointlight_col;
+VARYING vec2 vary_texcoord0;
+
+
+uniform float near_clip;
+
+uniform vec4 color;
+
+uniform vec4 light_position[8];
+uniform vec3 light_direction[8];
+uniform vec3 light_attenuation[8]; 
+uniform vec3 light_diffuse[8];
+
+float calcDirectionalLight(vec3 n, vec3 l)
+{
+        float a = max(dot(n,l),0.0);
+        return a;
+}
+
+float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
+{
+	//get light vector
+	vec3 lv = lp.xyz-v;
+	
+	//get distance
+	float d = dot(lv,lv);
+	
+	float da = 0.0;
+
+	if (d > 0.0 && la > 0.0 && fa > 0.0)
+	{
+		//normalize light vector
+		lv = normalize(lv);
+	
+		//distance attenuation
+		float dist2 = d/la;
+		da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
+
+		// spotlight coefficient.
+		float spot = max(dot(-ln, lv), is_pointlight);
+		da *= spot*spot; // GL_SPOT_EXPONENT=2
+
+		//angular attenuation
+		da *= max(dot(n, lv), 0.0);		
+	}
+
+	return da;	
+}
+
+void main()
+{
+	vary_texcoord0 = texcoord0;
+				
+	vec4 pos;
+	vec3 norm;
+	
+	mat4 trans = getSkinnedTransform();
+	vec4 pos_in = vec4(position.xyz, 1.0);
+	pos.x = dot(trans[0], pos_in);
+	pos.y = dot(trans[1], pos_in);
+	pos.z = dot(trans[2], pos_in);
+	pos.w = 1.0;
+	
+	norm.x = dot(trans[0].xyz, normal);
+	norm.y = dot(trans[1].xyz, normal);
+	norm.z = dot(trans[2].xyz, normal);
+	norm = normalize(norm);
+		
+	vec4 frag_pos = projection_matrix * pos;
+	gl_Position = frag_pos;
+	
+	vary_position = pos.xyz;
+	
+	calcAtmospherics(pos.xyz);
+
+	vec4 col = vec4(0.0, 0.0, 0.0, 1.0);
+
+	// Collect normal lights
+	col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].y, light_attenuation[2].z);
+	col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].y, light_attenuation[3].z);
+	col.rgb += light_diffuse[4].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[4], light_direction[4], light_attenuation[4].x, light_attenuation[4].y, light_attenuation[4].z);
+	col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].y, light_attenuation[5].z);
+	col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].y, light_attenuation[6].z);
+	col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].y, light_attenuation[7].z);
+	
+	vary_pointlight_col = col.rgb*color.rgb;
+
+	col.rgb = vec3(0,0,0);
+
+	// Add windlight lights
+	col.rgb = atmosAmbient(vec3(0.));
+	
+	vary_ambient = col.rgb*color.rgb;
+	vary_directional = color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), 0.0));
+	
+	col.rgb = col.rgb * color.rgb;
+	
+	vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip);
+}
+
+
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl
index f70ea4da526afecaf1172b3b7f7975da6536ad10..d6149fcc32ac9b02785ff3b47e9489141edf0e02 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl
@@ -22,8 +22,12 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 mat4 getSkinnedTransform();
@@ -37,31 +41,47 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
 vec3 scaleDownLight(vec3 light);
 vec3 scaleUpLight(vec3 light);
 
-varying vec3 vary_position;
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_fragcoord;
-varying vec3 vary_pointlight_col;
+VARYING vec3 vary_position;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_pointlight_col;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 
 uniform float near_clip;
 
+uniform vec4 color;
+
+uniform vec4 light_position[8];
+uniform vec3 light_direction[8];
+uniform vec3 light_attenuation[8]; 
+uniform vec3 light_diffuse[8];
+
+float calcDirectionalLight(vec3 n, vec3 l)
+{
+        float a = max(dot(n,l),0.0);
+        return a;
+}
+
 float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
 {
 	//get light vector
 	vec3 lv = lp.xyz-v;
 	
 	//get distance
-	float d = length(lv);
+	float d = dot(lv,lv);
 	
 	float da = 0.0;
 
 	if (d > 0.0 && la > 0.0 && fa > 0.0)
 	{
 		//normalize light vector
-		lv *= 1.0/d;
+		lv = normalize(lv);
 	
 		//distance attenuation
-		float dist2 = d*d/(la*la);
+		float dist2 = d/la;
 		da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
 
 		// spotlight coefficient.
@@ -69,7 +89,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
 		da *= spot*spot; // GL_SPOT_EXPONENT=2
 
 		//angular attenuation
-		da *= calcDirectionalLight(n, lv);
+		da *= max(dot(n, lv), 0.0);		
 	}
 
 	return da;	
@@ -77,56 +97,55 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
 
 void main()
 {
-	gl_TexCoord[0] = gl_MultiTexCoord0;
+	vary_texcoord0 = texcoord0;
 				
 	vec4 pos;
 	vec3 norm;
 	
 	mat4 trans = getSkinnedTransform();
-	pos.x = dot(trans[0], gl_Vertex);
-	pos.y = dot(trans[1], gl_Vertex);
-	pos.z = dot(trans[2], gl_Vertex);
+	vec4 pos_in = vec4(position.xyz, 1.0);
+	pos.x = dot(trans[0], pos_in);
+	pos.y = dot(trans[1], pos_in);
+	pos.z = dot(trans[2], pos_in);
 	pos.w = 1.0;
 	
-	norm.x = dot(trans[0].xyz, gl_Normal);
-	norm.y = dot(trans[1].xyz, gl_Normal);
-	norm.z = dot(trans[2].xyz, gl_Normal);
+	norm.x = dot(trans[0].xyz, normal);
+	norm.y = dot(trans[1].xyz, normal);
+	norm.z = dot(trans[2].xyz, normal);
 	norm = normalize(norm);
 		
-	vec4 frag_pos = gl_ProjectionMatrix * pos;
+	vec4 frag_pos = projection_matrix * pos;
 	gl_Position = frag_pos;
 	
 	vary_position = pos.xyz;
 	
 	calcAtmospherics(pos.xyz);
 
-	//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
-
-	vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+	vec4 col = vec4(0.0, 0.0, 0.0, 1.0);
 
 	// Collect normal lights
-	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
-	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a);
-	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a);
-	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a);
-	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
-	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
+	col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].y, light_attenuation[2].z);
+	col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].y, light_attenuation[3].z);
+	col.rgb += light_diffuse[4].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[4], light_direction[4], light_attenuation[4].x, light_attenuation[4].y, light_attenuation[4].z);
+	col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].y, light_attenuation[5].z);
+	col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].y, light_attenuation[6].z);
+	col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].y, light_attenuation[7].z);
 	
-	vary_pointlight_col = col.rgb*gl_Color.rgb;
+	vary_pointlight_col = col.rgb*color.rgb;
 
 	col.rgb = vec3(0,0,0);
 
 	// Add windlight lights
 	col.rgb = atmosAmbient(vec3(0.));
 	
-	vary_ambient = col.rgb*gl_Color.rgb;
-	vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+	vary_ambient = col.rgb*color.rgb;
+	vary_directional = color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), 0.0));
 	
-	col.rgb = min(col.rgb*gl_Color.rgb, 1.0);
+	col.rgb = col.rgb * color.rgb;
 	
-	gl_FrontColor = col;
+	vertex_color = col;
 
-	gl_FogFragCoord = pos.z;
+	
 	
 	vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
index d0f33979325dfdb8ff268b620c1c3cdef117fb7d..01ffb862f70e9aed4a1a342fee2ec1706264214a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
@@ -22,18 +22,27 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
 
-varying vec3 vary_normal;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec3 vary_normal;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	//transform vertex
-	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; 
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); 
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
-	vary_normal = normalize(gl_NormalMatrix * gl_Normal);
+	vary_normal = normalize(normal_matrix * normal);
 
-	gl_FrontColor = gl_Color;
+	vertex_color = diffuse_color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
index 3f30402583d9cd23c4854e63f6dcd8af4951cdcc..46d2aa4877e610ab84ef1256cbc487476c4f2be6 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
@@ -22,25 +22,30 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_data[3];
+#else
+#define frag_data gl_FragData
+#endif
 
 uniform sampler2D diffuseMap;
 
-varying vec3 vary_normal;
+VARYING vec3 vary_normal;
+VARYING vec2 vary_texcoord0;
 
 void main() 
 {
-	vec4 diff = gl_Color*texture2D(diffuseMap, gl_TexCoord[0].xy);
+	vec4 diff = texture2D(diffuseMap, vary_texcoord0.xy);
 	
 	if (diff.a < 0.2)
 	{
 		discard;
 	}
 	
-	gl_FragData[0] = vec4(diff.rgb, 0.0);
-	gl_FragData[1] = vec4(0,0,0,0);
+	frag_data[0] = vec4(diff.rgb, 0.0);
+	frag_data[1] = vec4(0,0,0,0);
 	vec3 nvn = normalize(vary_normal);
-	gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
+	frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl
index c9a349f0263b041a17f021b21d5e56df75366c9b..3686f2f647cedf8f932f2bdf4811a3fa4501423b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl
@@ -23,16 +23,19 @@
  * $/LicenseInfo$
  */
  
-
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
 uniform sampler2D diffuseMap;
 
-varying vec4 post_pos;
+VARYING vec4 post_pos;
 
 void main() 
 {
-	//gl_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy).a);
-	gl_FragColor = vec4(1,1,1,1);
+	frag_color = vec4(1,1,1,1);
 
 	gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
index 3d2ad397dfb86fc2ff465a9753aad9aeed0842d2..23feb09d7233b8dea4a042712593574f06ff5b2e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
@@ -23,38 +23,37 @@
  * $/LicenseInfo$
  */
  
-
+uniform mat4 projection_matrix;
 
 mat4 getSkinnedTransform();
 
-attribute vec4 weight;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
 
-varying vec4 post_pos;
+VARYING vec4 post_pos;
 
 void main()
 {
-	gl_TexCoord[0] = gl_MultiTexCoord0;
-				
 	vec4 pos;
 	vec3 norm;
 	
+	vec4 pos_in = vec4(position.xyz, 1.0);
 	mat4 trans = getSkinnedTransform();
-	pos.x = dot(trans[0], gl_Vertex);
-	pos.y = dot(trans[1], gl_Vertex);
-	pos.z = dot(trans[2], gl_Vertex);
+	pos.x = dot(trans[0], pos_in);
+	pos.y = dot(trans[1], pos_in);
+	pos.z = dot(trans[2], pos_in);
 	pos.w = 1.0;
 	
-	norm.x = dot(trans[0].xyz, gl_Normal);
-	norm.y = dot(trans[1].xyz, gl_Normal);
-	norm.z = dot(trans[2].xyz, gl_Normal);
+	norm.x = dot(trans[0].xyz, normal);
+	norm.y = dot(trans[1].xyz, normal);
+	norm.z = dot(trans[2].xyz, normal);
 	norm = normalize(norm);
 	
-	pos = gl_ProjectionMatrix * pos;
+	pos = projection_matrix * pos;
 	post_pos = pos;
 
 	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w);
-	
-	gl_FrontColor = gl_Color;
 }
 
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
index 37fcef81f3f9de0418ae7ecc7f773f95d2ac5601..1bd8fee7c974949ee9e43f1f520ec441c7cc6644 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
@@ -23,38 +23,41 @@
  * $/LicenseInfo$
  */
  
+uniform mat4 projection_matrix;
 
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
 
 mat4 getSkinnedTransform();
 
-attribute vec4 weight;
+ATTRIBUTE vec4 weight;
 
-varying vec3 vary_normal;
+VARYING vec3 vary_normal;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
-	gl_TexCoord[0] = gl_MultiTexCoord0;
+	vary_texcoord0 = texcoord0;
 				
 	vec4 pos;
 	vec3 norm;
 	
+	vec4 pos_in = vec4(position.xyz, 1.0);
 	mat4 trans = getSkinnedTransform();
-	pos.x = dot(trans[0], gl_Vertex);
-	pos.y = dot(trans[1], gl_Vertex);
-	pos.z = dot(trans[2], gl_Vertex);
+	pos.x = dot(trans[0], pos_in);
+	pos.y = dot(trans[1], pos_in);
+	pos.z = dot(trans[2], pos_in);
 	pos.w = 1.0;
 	
-	norm.x = dot(trans[0].xyz, gl_Normal);
-	norm.y = dot(trans[1].xyz, gl_Normal);
-	norm.z = dot(trans[2].xyz, gl_Normal);
+	norm.x = dot(trans[0].xyz, normal);
+	norm.y = dot(trans[1].xyz, normal);
+	norm.z = dot(trans[2].xyz, normal);
 	norm = normalize(norm);
 	
 	vary_normal = norm;
 	
-	gl_Position = gl_ProjectionMatrix * pos;
-	//gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;	
-	
-	gl_FrontColor = gl_Color;
+	gl_Position = projection_matrix * pos;
 }
 
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
index 3609cc054b9980b596d2dfcfb297998e9bbeca4c..f400eb7a5bc9521f9fce2c83529633cdc0b76e87 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
@@ -22,11 +22,15 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
-
 
 #extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform sampler2DRect depthMap;
 uniform sampler2DRect normalMap;
 uniform sampler2DRect lightMap;
@@ -37,11 +41,16 @@ uniform vec2 delta;
 uniform vec3 kern[4];
 uniform float kern_scale;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 uniform mat4 inv_proj;
 uniform vec2 screen_res;
 
+vec3 getKern(int i)
+{
+	return kern[i];
+}
+
 vec4 getPosition(vec2 pos_screen)
 {
 	float depth = texture2DRect(depthMap, pos_screen.xy).r;
@@ -66,41 +75,44 @@ void main()
 	vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy);
 	dlt /= max(-pos.z*dist_factor, 1.0);
 	
-	vec2 defined_weight = kern[0].xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free'
+	vec2 defined_weight = getKern(0).xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free'
 	vec4 col = defined_weight.xyxx * ccol;
 
 	// relax tolerance according to distance to avoid speckling artifacts, as angles and distances are a lot more abrupt within a small screen area at larger distances
 	float pointplanedist_tolerance_pow2 = pos.z*pos.z*0.00005;
 
 	// perturb sampling origin slightly in screen-space to hide edge-ghosting artifacts where smoothing radius is quite large
-	tc += ( (mod(tc.x+tc.y,2) - 0.5) * kern[1].z * dlt * 0.5 );
+	float tc_mod = 0.5*(tc.x + tc.y); // mod(tc.x+tc.y,2)
+	tc_mod -= floor(tc_mod);
+	tc_mod *= 2.0;
+	tc += ( (tc_mod - 0.5) * getKern(1).z * dlt * 0.5 );
 
 	for (int i = 1; i < 4; i++)
 	{
-		vec2 samptc = tc + kern[i].z*dlt;
+		vec2 samptc = tc + getKern(i).z*dlt;
 	        vec3 samppos = getPosition(samptc).xyz; 
 		float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
 		if (d*d <= pointplanedist_tolerance_pow2)
 		{
-			col += texture2DRect(lightMap, samptc)*kern[i].xyxx;
-			defined_weight += kern[i].xy;
+			col += texture2DRect(lightMap, samptc)*getKern(i).xyxx;
+			defined_weight += getKern(i).xy;
 		}
 	}
 	for (int i = 1; i < 4; i++)
 	{
-		vec2 samptc = tc - kern[i].z*dlt;
+		vec2 samptc = tc - getKern(i).z*dlt;
 	        vec3 samppos = getPosition(samptc).xyz; 
 		float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
 		if (d*d <= pointplanedist_tolerance_pow2)
 		{
-			col += texture2DRect(lightMap, samptc)*kern[i].xyxx;
-			defined_weight += kern[i].xy;
+			col += texture2DRect(lightMap, samptc)*getKern(i).xyxx;
+			defined_weight += getKern(i).xy;
 		}
 	}
 
 	col /= defined_weight.xyxx;
 	col.y *= col.y;
 	
-	gl_FragColor = col;
+	frag_color = col;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl
deleted file mode 100644
index c858eb7a3a8e3fe2424e34f03dc208617fd09ace..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl
+++ /dev/null
@@ -1,131 +0,0 @@
-/** 
- * @file blurLightF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-uniform sampler2DMS depthMap;
-uniform sampler2DMS normalMap;
-uniform sampler2DRect lightMap;
-
-uniform float dist_factor;
-uniform float blur_size;
-uniform vec2 delta;
-uniform vec3 kern[4];
-uniform float kern_scale;
-
-varying vec2 vary_fragcoord;
-
-uniform mat4 inv_proj;
-uniform vec2 screen_res;
-
-vec3 texture2DMS3(sampler2DMS tex, ivec2 tc)
-{
-	vec3 ret = vec3(0,0,0);
-	for (int i = 0; i < samples; i++)
-	{
-		ret += texelFetch(tex, tc, i).rgb;
-	}
-
-	return ret/samples;
-}
-
-float texture2DMS1(sampler2DMS tex, ivec2 tc)
-{
-	float ret = 0;
-	for (int i = 0; i < samples; i++)
-	{
-		ret += texelFetch(tex, tc, i).r;
-	}
-
-	return ret/samples;
-}
-
-vec4 getPosition(ivec2 pos_screen)
-{
-	float depth = texture2DMS1(depthMap, pos_screen.xy);
-	vec2 sc = pos_screen.xy*2.0;
-	sc /= screen_res;
-	sc -= vec2(1.0,1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
-void main() 
-{
-    vec2 tc = vary_fragcoord.xy;
-	ivec2 itc = ivec2(tc);
-
-	vec3 norm = texture2DMS3(normalMap, itc).xyz;
-	norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
-	vec3 pos = getPosition(itc).xyz;
-	vec4 ccol = texture2DRect(lightMap, tc).rgba;
-	
-	vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy);
-	dlt /= max(-pos.z*dist_factor, 1.0);
-	
-	vec2 defined_weight = kern[0].xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free'
-	vec4 col = defined_weight.xyxx * ccol;
-
-	// relax tolerance according to distance to avoid speckling artifacts, as angles and distances are a lot more abrupt within a small screen area at larger distances
-	float pointplanedist_tolerance_pow2 = pos.z*pos.z*0.00005;
-
-	// perturb sampling origin slightly in screen-space to hide edge-ghosting artifacts where smoothing radius is quite large
-	tc += ( (mod(tc.x+tc.y,2) - 0.5) * kern[1].z * dlt * 0.5 );
-
-	for (int i = 1; i < 4; i++)
-	{
-		vec2 samptc = tc + kern[i].z*dlt;
-		vec3 samppos = getPosition(ivec2(samptc)).xyz; 
-		float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
-		if (d*d <= pointplanedist_tolerance_pow2)
-		{
-			col += texture2DRect(lightMap, samptc)*kern[i].xyxx;
-			defined_weight += kern[i].xy;
-		}
-	}
-	for (int i = 1; i < 4; i++)
-	{
-		vec2 samptc = vec2(tc - kern[i].z*dlt);
-		vec3 samppos = getPosition(ivec2(samptc)).xyz; 
-		float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
-		if (d*d <= pointplanedist_tolerance_pow2)
-		{
-			col += texture2DRect(lightMap, samptc)*kern[i].xyxx;
-			defined_weight += kern[i].xy;
-		}
-	}
-
-	col /= defined_weight.xyxx;
-	col.y *= col.y;
-
-	gl_FragColor = col;
-}
-
diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl
index e904b7ded006c69cd7a6bb9b022d8f4e7ba2e423..212f7e56adff95dc365e2673f47b416045361411 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl
@@ -22,16 +22,18 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 modelview_projection_matrix;
 
-varying vec2 vary_fragcoord;
+ATTRIBUTE vec3 position;
+
+VARYING vec2 vary_fragcoord;
 uniform vec2 screen_res;
 
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform(); 
-	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	gl_Position = pos; 
 	vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl
index 429a891f0734b5579a8daa9f3b8c399a5de0e2cb..680eadb852444a5db066a5bbdfae06ca509f2a30 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl
@@ -23,27 +23,34 @@
  * $/LicenseInfo$
  */
  
-
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_data[3];
+#else
+#define frag_data gl_FragData
+#endif
 
 uniform sampler2D diffuseMap;
 uniform sampler2D bumpMap;
 
-varying vec3 vary_mat0;
-varying vec3 vary_mat1;
-varying vec3 vary_mat2;
+VARYING vec3 vary_mat0;
+VARYING vec3 vary_mat1;
+VARYING vec3 vary_mat2;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main() 
 {
-	vec3 col = gl_Color.rgb * texture2D(diffuseMap, gl_TexCoord[0].xy).rgb;
-	vec3 norm = texture2D(bumpMap, gl_TexCoord[0].xy).rgb * 2.0 - 1.0;
+	vec3 col = vertex_color.rgb * texture2D(diffuseMap, vary_texcoord0.xy).rgb;
+	vec3 norm = texture2D(bumpMap, vary_texcoord0.xy).rgb * 2.0 - 1.0;
 
 	vec3 tnorm = vec3(dot(norm,vary_mat0),
 			  dot(norm,vary_mat1),
 			  dot(norm,vary_mat2));
 						
-	gl_FragData[0] = vec4(col, 0.0);
-	gl_FragData[1] = gl_Color.aaaa; // spec
-	//gl_FragData[1] = vec4(vec3(gl_Color.a), gl_Color.a+(1.0-gl_Color.a)*gl_Color.a); // spec - from former class3 - maybe better, but not so well tested
+	frag_data[0] = vec4(col, 0.0);
+	frag_data[1] = vertex_color.aaaa; // spec
+	//frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
 	vec3 nvn = normalize(tnorm);
-	gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
+	frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl
index 7d934e7ff836f1353d21de682fa3eb2c49c5f602..8ba75010a2cdf2a0c534ab94738e529e61a43e0a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl
@@ -22,33 +22,43 @@
  * $/LicenseInfo$
  */
 
+uniform mat4 projection_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
 
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec3 binormal;
 
-varying vec3 vary_mat0;
-varying vec3 vary_mat1;
-varying vec3 vary_mat2;
+VARYING vec3 vary_mat0;
+VARYING vec3 vary_mat1;
+VARYING vec3 vary_mat2;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 mat4 getObjectSkinnedTransform();
 
 void main()
 {
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	mat4 mat = getObjectSkinnedTransform();
 	
-	mat = gl_ModelViewMatrix * mat;
+	mat = modelview_matrix * mat;
 	
-	vec3 pos = (mat*gl_Vertex).xyz;
+	vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
 	
 	
-	vec3 n = normalize((mat * vec4(gl_Normal.xyz+gl_Vertex.xyz, 1.0)).xyz-pos.xyz);
-	vec3 b = normalize((mat * vec4(gl_MultiTexCoord2.xyz+gl_Vertex.xyz, 1.0)).xyz-pos.xyz);
+	vec3 n = normalize((mat * vec4(normal.xyz+position.xyz, 1.0)).xyz-pos.xyz);
+	vec3 b = normalize((mat * vec4(binormal.xyz+position.xyz, 1.0)).xyz-pos.xyz);
 	vec3 t = cross(b, n);
 	
 	vary_mat0 = vec3(t.x, b.x, n.x);
 	vary_mat1 = vec3(t.y, b.y, n.y);
 	vary_mat2 = vec3(t.z, b.z, n.z);
 	
-	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
-	gl_FrontColor = gl_Color;
+	gl_Position = projection_matrix*vec4(pos, 1.0);
+	vertex_color = diffuse_color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl
index 92fd41554db63f0ce9290a1ae7c70aa978279100..c8d38bb8f74e72dd4ad681f1fb43b94cec2f6b00 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl
@@ -22,26 +22,36 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
 
-varying vec3 vary_mat0;
-varying vec3 vary_mat1;
-varying vec3 vary_mat2;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec3 binormal;
+
+VARYING vec3 vary_mat0;
+VARYING vec3 vary_mat1;
+VARYING vec3 vary_mat2;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform(); 
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); 
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
-	vec3 n = normalize(gl_NormalMatrix * gl_Normal);
-	vec3 b = normalize(gl_NormalMatrix * gl_MultiTexCoord2.xyz);
+	vec3 n = normalize(normal_matrix * normal);
+	vec3 b = normalize(normal_matrix * binormal);
 	vec3 t = cross(b, n);
 	
 	vary_mat0 = vec3(t.x, b.x, n.x);
 	vary_mat1 = vec3(t.y, b.y, n.y);
 	vary_mat2 = vec3(t.z, b.z, n.z);
 	
-	gl_FrontColor = gl_Color;
+	vertex_color = diffuse_color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
index f4310dae958796b181a132ff98192ffabad5ebe5..1d8ca04ccd3ff27d7a783f82a537bcc27f896549 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
@@ -24,20 +24,30 @@
  */
  
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_data[3];
+#else
+#define frag_data gl_FragData
+#endif
 
 /////////////////////////////////////////////////////////////////////////
 // The fragment shader for the sky
 /////////////////////////////////////////////////////////////////////////
 
-varying vec4 vary_CloudColorSun;
-varying vec4 vary_CloudColorAmbient;
-varying float vary_CloudDensity;
+VARYING vec4 vary_CloudColorSun;
+VARYING vec4 vary_CloudColorAmbient;
+VARYING float vary_CloudDensity;
 
 uniform sampler2D cloud_noise_texture;
 uniform vec4 cloud_pos_density1;
 uniform vec4 cloud_pos_density2;
 uniform vec4 gamma;
 
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
+VARYING vec2 vary_texcoord2;
+VARYING vec2 vary_texcoord3;
+
 /// Soft clips the light with a gamma correction
 vec3 scaleSoftClip(vec3 light) {
 	//soft clip effect:
@@ -50,14 +60,14 @@ vec3 scaleSoftClip(vec3 light) {
 void main()
 {
 	// Set variables
-	vec2 uv1 = gl_TexCoord[0].xy;
-	vec2 uv2 = gl_TexCoord[1].xy;
+	vec2 uv1 = vary_texcoord0.xy;
+	vec2 uv2 = vary_texcoord1.xy;
 
 	vec4 cloudColorSun = vary_CloudColorSun;
 	vec4 cloudColorAmbient = vary_CloudColorAmbient;
 	float cloudDensity = vary_CloudDensity;
-	vec2 uv3 = gl_TexCoord[2].xy;
-	vec2 uv4 = gl_TexCoord[3].xy;
+	vec2 uv3 = vary_texcoord2.xy;
+	vec2 uv4 = vary_texcoord3.xy;
 
 	// Offset texture coords
 	uv1 += cloud_pos_density1.xy;	//large texture, visible density
@@ -90,8 +100,8 @@ void main()
 	color *= 2.;
 
 	/// Gamma correct for WL (soft clip effect).
-	gl_FragData[0] = vec4(scaleSoftClip(color.rgb), alpha1);
-	gl_FragData[1] = vec4(0.0,0.0,0.0,0.0);
-	gl_FragData[2] = vec4(0,0,1,0);
+	frag_data[0] = vec4(scaleSoftClip(color.rgb), alpha1);
+	frag_data[1] = vec4(0.0,0.0,0.0,0.0);
+	frag_data[2] = vec4(0,0,1,0);
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
index c175a834c23386c0e5c866fdf0aaf57efd74b078..17f425475c85e1ad4606b6645c3c4d797fa4ff0f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
@@ -22,17 +22,25 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
 
 //////////////////////////////////////////////////////////////////////////
 // The vertex shader for creating the atmospheric sky
 ///////////////////////////////////////////////////////////////////////////////
 
 // Output parameters
-varying vec4 vary_CloudColorSun;
-varying vec4 vary_CloudColorAmbient;
-varying float vary_CloudDensity;
+VARYING vec4 vary_CloudColorSun;
+VARYING vec4 vary_CloudColorAmbient;
+VARYING float vary_CloudDensity;
+
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
+VARYING vec2 vary_texcoord2;
+VARYING vec2 vary_texcoord3;
 
 // Inputs
 uniform vec3 camPosLocal;
@@ -42,34 +50,34 @@ uniform vec4 sunlight_color;
 uniform vec4 ambient;
 uniform vec4 blue_horizon;
 uniform vec4 blue_density;
-uniform vec4 haze_horizon;
-uniform vec4 haze_density;
+uniform float haze_horizon;
+uniform float haze_density;
 
-uniform vec4 cloud_shadow;
-uniform vec4 density_multiplier;
-uniform vec4 max_y;
+uniform float cloud_shadow;
+uniform float density_multiplier;
+uniform float max_y;
 
 uniform vec4 glow;
 
 uniform vec4 cloud_color;
 
-uniform vec4 cloud_scale;
+uniform float cloud_scale;
 
 void main()
 {
 
 	// World / view / projection
-	gl_Position = ftransform();
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
 
-	gl_TexCoord[0] = gl_MultiTexCoord0;
+	vary_texcoord0 = texcoord0;
 
 	// Get relative position
-	vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0);
+	vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
 
 	// Set altitude
 	if (P.y > 0.)
 	{
-		P *= (max_y.x / P.y);
+		P *= (max_y / P.y);
 	}
 	else
 	{
@@ -91,12 +99,12 @@ void main()
 
 	// Sunlight attenuation effect (hue and brightness) due to atmosphere
 	// this is used later for sunlight modulation at various altitudes
-	light_atten = (blue_density * 1.0 + haze_density.x * 0.25) * (density_multiplier.x * max_y.x);
+	light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
 
 	// Calculate relative weights
-	temp1 = blue_density + haze_density.x;
+	temp1 = blue_density + haze_density;
 	blue_weight = blue_density / temp1;
-	haze_weight = haze_density.x / temp1;
+	haze_weight = haze_density / temp1;
 
 	// Compute sunlight from P & lightnorm (for long rays like sky)
 	temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y );
@@ -104,7 +112,7 @@ void main()
 	sunlight *= exp( - light_atten * temp2.y);
 
 	// Distance
-	temp2.z = Plen * density_multiplier.x;
+	temp2.z = Plen * density_multiplier;
 
 	// Transparency (-> temp1)
 	// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
@@ -128,14 +136,14 @@ void main()
 
 	// Increase ambient when there are more clouds
 	vec4 tmpAmbient = ambient;
-	tmpAmbient += (1. - tmpAmbient) * cloud_shadow.x * 0.5; 
+	tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; 
 
 	// Dim sunlight by cloud shadow percentage
-	sunlight *= (1. - cloud_shadow.x);
+	sunlight *= (1. - cloud_shadow);
 
 	// Haze color below cloud
 	vec4 additiveColorBelowCloud = (	  blue_horizon * blue_weight * (sunlight + tmpAmbient)
-				+ (haze_horizon.r * haze_weight) * (sunlight * temp2.x + tmpAmbient)
+				+ (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient)
 			 );	
 
 	// CLOUDS
@@ -156,21 +164,21 @@ void main()
 	vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - temp1);
 
 	// Make a nice cloud density based on the cloud_shadow value that was passed in.
-	vary_CloudDensity = 2. * (cloud_shadow.x - 0.25);
+	vary_CloudDensity = 2. * (cloud_shadow - 0.25);
 
 
 	// Texture coords
-	gl_TexCoord[0] = gl_MultiTexCoord0;
-	gl_TexCoord[0].xy -= 0.5;
-	gl_TexCoord[0].xy /= cloud_scale.x;
-	gl_TexCoord[0].xy += 0.5;
+	vary_texcoord0 = texcoord0;
+	vary_texcoord0.xy -= 0.5;
+	vary_texcoord0.xy /= cloud_scale;
+	vary_texcoord0.xy += 0.5;
 
-	gl_TexCoord[1] = gl_TexCoord[0];
-	gl_TexCoord[1].x += lightnorm.x * 0.0125;
-	gl_TexCoord[1].y += lightnorm.z * 0.0125;
+	vary_texcoord1 = vary_texcoord0;
+	vary_texcoord1.x += lightnorm.x * 0.0125;
+	vary_texcoord1.y += lightnorm.z * 0.0125;
 
-	gl_TexCoord[2] = gl_TexCoord[0] * 16.;
-	gl_TexCoord[3] = gl_TexCoord[1] * 16.;
+	vary_texcoord2 = vary_texcoord0 * 16.;
+	vary_texcoord3 = vary_texcoord1 * 16.;
 
 	// Combine these to minimize register use
 	vary_CloudColorAmbient += oHazeColorBelowCloud;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl
similarity index 59%
rename from indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl
rename to indra/newview/app_settings/shaders/class1/deferred/cofF.glsl
index d9eafb6ebadaf1188940f7d6da702a89076c8069..ccbc3c557cc80a9d66f396bcaf164ba599f723ca 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl
@@ -1,5 +1,5 @@
 /** 
- * @file edgeF.glsl
+ * @file cofF.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -22,22 +22,32 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
-
 
 #extension GL_ARB_texture_rectangle : enable
 
-uniform sampler2DRect depthMap;
-uniform sampler2DRect normalMap;
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
-varying vec2 vary_fragcoord;
+uniform sampler2DRect diffuseRect;
+uniform sampler2DRect depthMap;
+uniform sampler2D bloomMap;
 
 uniform float depth_cutoff;
 uniform float norm_cutoff;
+uniform float focal_distance;
+uniform float blur_constant;
+uniform float tan_pixel_angle;
+uniform float magnification;
+uniform float max_cof;
 
 uniform mat4 inv_proj;
 uniform vec2 screen_res;
 
+VARYING vec2 vary_fragcoord;
+
 float getDepth(vec2 pos_screen)
 {
 	float z = texture2DRect(depthMap, pos_screen.xy).r;
@@ -47,35 +57,34 @@ float getDepth(vec2 pos_screen)
 	return p.z/p.w;
 }
 
-void main() 
+float calc_cof(float depth)
 {
-	vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz;
-	norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
-	float depth = getDepth(vary_fragcoord.xy);
+	float sc = (depth-focal_distance)/-depth*blur_constant;
+		
+	sc /= magnification;
 	
-	vec2 tc = vary_fragcoord.xy;
+	// tan_pixel_angle = pixel_length/-depth;
+	float pixel_length =  tan_pixel_angle*-focal_distance;
 	
-	float sc = 0.75;
+	sc = sc/pixel_length;
+	sc *= 1.414;
 	
-	vec2 de;
-	de.x = (depth-getDepth(tc+vec2(sc, sc))) + (depth-getDepth(tc+vec2(-sc, -sc)));
-	de.y = (depth-getDepth(tc+vec2(-sc, sc))) + (depth-getDepth(tc+vec2(sc, -sc)));
-	de /= depth;
-	de *= de;
-	de = step(depth_cutoff, de);
+	return sc;
+}
+
+void main() 
+{
+	vec2 tc = vary_fragcoord.xy;
 	
-	vec2 ne;
-	vec3 nexnorm = texture2DRect(normalMap, tc+vec2(-sc,-sc)).rgb;
-	nexnorm = vec3((nexnorm.xy-0.5)*2.0,nexnorm.z); // unpack norm
-	ne.x = dot(nexnorm, norm);
-	vec3 neynorm = texture2DRect(normalMap, tc+vec2(sc,sc)).rgb;
-	neynorm = vec3((neynorm.xy-0.5)*2.0,neynorm.z); // unpack norm
-	ne.y = dot(neynorm, norm);
+	float depth = getDepth(tc);
 	
-	ne = 1.0-ne;
+	vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy);
 	
-	ne = step(norm_cutoff, ne);
+	float sc = calc_cof(depth);
+	sc = min(sc, max_cof);
+	sc = max(sc, -max_cof);
 	
-	gl_FragColor.a = dot(de,de)+dot(ne,ne);
-	//gl_FragColor.a = dot(de,de);
+	vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res);
+	frag_color.rgb = diff.rgb + bloom.rgb;
+	frag_color.a = sc/max_cof*0.5+0.5;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
index 933e50fed148d8808782596e86dfd27a0bf2fb64..b2027d3a5d0287753c7660d52726734f7bc56787 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
@@ -1,5 +1,5 @@
 /** 
- * @file diffuseF.glsl
+ * @file diffuseAlphaMaskF.glsl
  *
  * $LicenseInfo:firstyear=2011&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -22,27 +22,33 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_data[3];
+#else
+#define frag_data gl_FragData
+#endif
 
 uniform float minimum_alpha;
-uniform float maximum_alpha;
 
 uniform sampler2D diffuseMap;
 
-varying vec3 vary_normal;
+VARYING vec3 vary_normal;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main() 
 {
-	vec4 col = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color;
+	vec4 col = texture2D(diffuseMap, vary_texcoord0.xy) * vertex_color;
 	
-	if (col.a < minimum_alpha || col.a > maximum_alpha)
+	if (col.a < minimum_alpha)
 	{
 		discard;
 	}
 
-	gl_FragData[0] = vec4(col.rgb, 0.0);
-	gl_FragData[1] = vec4(0,0,0,0); // spec
+	frag_data[0] = vec4(col.rgb, 0.0);
+	frag_data[1] = vec4(0,0,0,0); // spec
 	vec3 nvn = normalize(vary_normal);
-	gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
+	frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl
index f3ad6f92de58686a6bdf79d7f7a3b40fa04a6a24..ead384b07c192b7406023c06ed9266c0467c95a3 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl
@@ -22,23 +22,31 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
-varying vec3 vary_normal;
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_data[3];
+#else
+#define frag_data gl_FragData
+#endif
+
+VARYING vec3 vary_normal;
 
 uniform float minimum_alpha;
-uniform float maximum_alpha;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main() 
 {
-	vec4 col = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
+	vec4 col = diffuseLookup(vary_texcoord0.xy) * vertex_color;
 	
-	if (col.a < minimum_alpha || col.a > maximum_alpha)
+	if (col.a < minimum_alpha)
 	{
 		discard;
 	}
 
-	gl_FragData[0] = vec4(col.rgb, 0.0);
-	gl_FragData[1] = vec4(0,0,0,0);
+	frag_data[0] = vec4(col.rgb, 0.0);
+	frag_data[1] = vec4(0,0,0,0);
 	vec3 nvn = normalize(vary_normal);
-	gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
+	frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..f73fa6f2310141570a41f6dc6d57e003398312cb
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl
@@ -0,0 +1,54 @@
+/** 
+ * @file diffuseAlphaMaskNoColorF.glsl
+ *
+ * $LicenseInfo:firstyear=2005&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2005, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+ 
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_data[3];
+#else
+#define frag_data gl_FragData
+#endif
+
+uniform float minimum_alpha;
+
+uniform sampler2D diffuseMap;
+
+VARYING vec3 vary_normal;
+VARYING vec2 vary_texcoord0;
+
+void main() 
+{
+	vec4 col = texture2D(diffuseMap, vary_texcoord0.xy);
+	
+	if (col.a < minimum_alpha)
+	{
+		discard;
+	}
+
+	frag_data[0] = vec4(col.rgb, 0.0);
+	frag_data[1] = vec4(0,0,0,0); // spec
+	vec3 nvn = normalize(vary_normal);
+	frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl
index 9c9a8b56c59085b950fe7d8201c25133fceff97a..227aa2aae3c4f9c19df00a376314b5a5c55adcf4 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl
@@ -23,19 +23,25 @@
  * $/LicenseInfo$
  */
  
-
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_data[3];
+#else
+#define frag_data gl_FragData
+#endif
 
 uniform sampler2D diffuseMap;
 
-varying vec3 vary_normal;
+VARYING vec3 vary_normal;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main() 
 {
-	vec3 col = gl_Color.rgb * texture2D(diffuseMap, gl_TexCoord[0].xy).rgb;
-	gl_FragData[0] = vec4(col, 0.0);
-	gl_FragData[1] = gl_Color.aaaa; // spec
-	//gl_FragData[1] = vec4(vec3(gl_Color.a), gl_Color.a+(1.0-gl_Color.a)*gl_Color.a); // spec - from former class3 - maybe better, but not so well tested
+	vec3 col = vertex_color.rgb * texture2D(diffuseMap, vary_texcoord0.xy).rgb;
+	frag_data[0] = vec4(col, 0.0);
+	frag_data[1] = vertex_color.aaaa; // spec
+	//frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
 	vec3 nvn = normalize(vary_normal);
-	gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
+	frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl
index 4d996a099dcfdf00edff08c4d2b1436af1c94134..d442e5403a47ad3f37b90ee330635d852318cdfb 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl
@@ -22,16 +22,24 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
-varying vec3 vary_normal;
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_data[3];
+#else
+#define frag_data gl_FragData
+#endif
+
+VARYING vec3 vary_normal;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main() 
 {
-	vec3 col = gl_Color.rgb * diffuseLookup(gl_TexCoord[0].xy).rgb;
+	vec3 col = vertex_color.rgb * diffuseLookup(vary_texcoord0.xy).rgb;
 
-	gl_FragData[0] = vec4(col, 0.0);
-	gl_FragData[1] = gl_Color.aaaa; // spec
-	//gl_FragData[1] = vec4(vec3(gl_Color.a), gl_Color.a+(1.0-gl_Color.a)*gl_Color.a); // spec - from former class3 - maybe better, but not so well tested
+	frag_data[0] = vec4(col, 0.0);
+	frag_data[1] = vertex_color.aaaa; // spec
+	//frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
 	vec3 nvn = normalize(vary_normal);
-	gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
+	frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
 }
diff --git a/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl
similarity index 65%
rename from indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl
rename to indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl
index 2d99ef5481777c7ba2019d3a783f5d2b0b19de0e..9461e3e32e52ee78d018925fd0c7d936932dfd96 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl
@@ -1,7 +1,7 @@
 /** 
- * @file giV.glsl
+ * @file diffuseNoColorV.glsl
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
  * Copyright (C) 2007, Linden Research, Inc.
  * 
@@ -22,19 +22,24 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix; 
 
-varying vec2 vary_fragcoord;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
 
-uniform vec2 screen_res;
+VARYING vec3 vary_normal;
+
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform(); 
-	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
-	vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;	
-
-	gl_FrontColor = gl_Color;
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); 
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	
+	vary_normal = normalize(normal_matrix * normal);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl
index 1470d7c9ca8bcbfbf4427f8e8acd0712fe03ab13..a74290bfcd0c60ba2f123e535f862ed017e18f62 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl
@@ -22,29 +22,38 @@
  * $/LicenseInfo$
  */
 
+uniform mat4 projection_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
 
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
 
-varying vec3 vary_normal;
+VARYING vec3 vary_normal;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 mat4 getObjectSkinnedTransform();
 
 void main()
 {
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	mat4 mat = getObjectSkinnedTransform();
 	
-	mat = gl_ModelViewMatrix * mat;
-	vec3 pos = (mat*gl_Vertex).xyz;
+	mat = modelview_matrix * mat;
+	vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
 	
-	vec4 norm = gl_Vertex;
-	norm.xyz += gl_Normal.xyz;
+	vec4 norm = vec4(position.xyz, 1.0);
+	norm.xyz += normal.xyz;
 	norm.xyz = (mat*norm).xyz;
 	norm.xyz = normalize(norm.xyz-pos.xyz);
 
 	vary_normal = norm.xyz;
 			
-	gl_FrontColor = gl_Color;
+	vertex_color = diffuse_color;
 	
-	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
+	gl_Position = projection_matrix*vec4(pos, 1.0);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl
index 7c5a4d35b380e05fb85e63b1db9684c9c521892e..76d29b1df7dce0986ccdbe508f33cd13a42b1fdd 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl
@@ -22,20 +22,31 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
 
-varying vec3 vary_normal;
-varying float vary_texture_index;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec3 vary_normal;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
+void passTextureIndex();
 
 void main()
 {
 	//transform vertex
-	gl_Position = gl_ModelViewProjectionMatrix * vec4(gl_Vertex.xyz, 1.0); 
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); 
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
-	vary_texture_index = gl_Vertex.w;
-	vary_normal = normalize(gl_NormalMatrix * gl_Normal);
+	passTextureIndex();
+	vary_normal = normalize(normal_matrix * normal);
 
-	gl_FrontColor = gl_Color;
+	vertex_color = diffuse_color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..a425e5062eba23e7b8c429233b56b411235a60e8
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl
@@ -0,0 +1,79 @@
+/** 
+ * @file dofCombineF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#extension GL_ARB_texture_rectangle : enable
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+uniform sampler2DRect diffuseRect;
+uniform sampler2DRect lightMap;
+
+uniform mat4 inv_proj;
+uniform vec2 screen_res;
+
+uniform float max_cof;
+uniform float res_scale;
+uniform float dof_width;
+uniform float dof_height;
+
+VARYING vec2 vary_fragcoord;
+
+vec4 dofSample(sampler2DRect tex, vec2 tc)
+{
+	tc.x = min(tc.x, dof_width);
+	tc.y = min(tc.y, dof_height);
+
+	return texture2DRect(tex, tc);
+}
+
+void main() 
+{
+	vec2 tc = vary_fragcoord.xy;
+	
+	vec4 dof = dofSample(diffuseRect, vary_fragcoord.xy*res_scale);
+	
+	vec4 diff = texture2DRect(lightMap, vary_fragcoord.xy);
+
+	float a = min(abs(diff.a*2.0-1.0) * max_cof*res_scale*res_scale, 1.0);
+
+	if (a > 0.25 && a < 0.75)
+	{ //help out the transition a bit
+		float sc = a/res_scale;
+		
+		vec4 col;
+		col = texture2DRect(lightMap, vary_fragcoord.xy+vec2(sc,sc));
+		col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(-sc,sc));
+		col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(sc,-sc));
+		col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(-sc,-sc));
+		
+		diff = mix(diff, col*0.25, a);
+	}
+
+	frag_color = mix(diff, dof, a);
+}
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
similarity index 70%
rename from indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl
rename to indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
index f03b1fdc749102c3976ed93de01afb145d5a01fd..6aa4d7b4ed198e29e557a6edec9b3ff5fd17a86a 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
@@ -1,9 +1,9 @@
 /** 
- * @file lightFullbrightF.glsl
+ * @file emissiveF.glsl
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2005&license=viewerlgpl$
  * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
+ * Copyright (C) 2005, Linden Research, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -23,19 +23,30 @@
  * $/LicenseInfo$
  */
  
+#extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
 vec3 fullbrightAtmosTransport(vec3 light);
 vec3 fullbrightScaleSoftClip(vec3 light);
 
-void fullbright_lighting()
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
+void main() 
 {
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
+	float shadow = 1.0;
+
+	vec4 color = diffuseLookup(vary_texcoord0.xy)*vertex_color;
 	
 	color.rgb = fullbrightAtmosTransport(color.rgb);
-	
+
 	color.rgb = fullbrightScaleSoftClip(color.rgb);
 
-	gl_FragColor = color;
+	frag_color = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..115b04797f8a1bfc346cc14057f08d77f9d47d82
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl
@@ -0,0 +1,63 @@
+/** 
+ * @file emissiveV.glsl
+ *
+  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+void passTextureIndex();
+ATTRIBUTE vec4 emissive;
+ATTRIBUTE vec2 texcoord0;
+
+void calcAtmospherics(vec3 inPositionEye);
+
+vec3 atmosAmbient(vec3 light);
+vec3 atmosAffectDirectionalLight(float lightIntensity);
+vec3 scaleDownLight(vec3 light);
+vec3 scaleUpLight(vec3 light);
+
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
+
+void main()
+{
+	//transform vertex
+	vec4 vert = vec4(position.xyz, 1.0);
+	vec4 pos = (modelview_matrix * vert);
+	passTextureIndex();
+
+	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+	
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	
+	calcAtmospherics(pos.xyz);
+	
+	vertex_color = emissive;
+
+	
+}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
index 6c506676afd2ced5770dc4cefad12a8ce8f824ca..36433a5827d7dde0c5ff091167ab11ecd0d8e226 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
@@ -23,9 +23,16 @@
  * $/LicenseInfo$
  */
  
+#extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
-#extension GL_ARB_texture_rectangle : enable
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 vec3 fullbrightAtmosTransport(vec3 light);
 vec3 fullbrightScaleSoftClip(vec3 light);
@@ -35,12 +42,12 @@ void main()
 {
 	float shadow = 1.0;
 
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy)*gl_Color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy)*vertex_color;
 	
 	color.rgb = fullbrightAtmosTransport(color.rgb);
 
 	color.rgb = fullbrightScaleSoftClip(color.rgb);
 
-	gl_FragColor = color;
+	frag_color = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl
index a4ff0b80e2df9b14fb601d032a3f1a30c6350c32..2e6982d101791c337bb96c3775a40cdd0912a821 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl
@@ -22,8 +22,16 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+
+ATTRIBUTE vec3 position;
+void passTextureIndex();
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
 
 void calcAtmospherics(vec3 inPositionEye);
 
@@ -32,23 +40,25 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
 vec3 scaleDownLight(vec3 light);
 vec3 scaleUpLight(vec3 light);
 
-varying float vary_texture_index;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 
 void main()
 {
 	//transform vertex
-	vec4 vert = vec4(gl_Vertex.xyz, 1.0);
-	vary_texture_index = gl_Vertex.w;
+	vec4 vert = vec4(position.xyz, 1.0);
+	vec4 pos = (modelview_matrix * vert);
+	passTextureIndex();
 
-	gl_Position = gl_ModelViewProjectionMatrix*vert; 
+	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
 	
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
-	vec4 pos = (gl_ModelViewMatrix * vert);
-				
 	calcAtmospherics(pos.xyz);
 	
-	gl_FrontColor = gl_Color;
+	vertex_color = diffuse_color;
 
-	gl_FogFragCoord = pos.z;
+	
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..e02a7b405b866b7d18bec0698475a0dfafdbe474
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl
@@ -0,0 +1,2125 @@
+/** 
+ * @file fxaaF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+ 
+#extension GL_ARB_texture_rectangle : enable
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+#define FXAA_PC 1
+//#define FXAA_GLSL_130 1
+#define FXAA_QUALITY__PRESET 12
+
+/*============================================================================
+
+
+                    NVIDIA FXAA 3.11 by TIMOTHY LOTTES
+
+
+------------------------------------------------------------------------------
+COPYRIGHT (C) 2010, 2011 NVIDIA CORPORATION. ALL RIGHTS RESERVED.
+------------------------------------------------------------------------------
+TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
+*AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA
+OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR
+CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR
+LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION,
+OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE
+THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+------------------------------------------------------------------------------
+                           INTEGRATION CHECKLIST
+------------------------------------------------------------------------------
+(1.)
+In the shader source, setup defines for the desired configuration.
+When providing multiple shaders (for different presets),
+simply setup the defines differently in multiple files.
+Example,
+
+  #define FXAA_PC 1
+  #define FXAA_HLSL_5 1
+  #define FXAA_QUALITY__PRESET 12
+
+Or,
+
+  #define FXAA_360 1
+  
+Or,
+
+  #define FXAA_PS3 1
+  
+Etc.
+
+(2.)
+Then include this file,
+
+  #include "Fxaa3_11.h"
+
+(3.)
+Then call the FXAA pixel shader from within your desired shader.
+Look at the FXAA Quality FxaaPixelShader() for docs on inputs.
+As for FXAA 3.11 all inputs for all shaders are the same 
+to enable easy porting between platforms.
+
+  return FxaaPixelShader(...);
+
+(4.)
+Insure pass prior to FXAA outputs RGBL (see next section).
+Or use,
+
+  #define FXAA_GREEN_AS_LUMA 1
+
+(5.)
+Setup engine to provide the following constants
+which are used in the FxaaPixelShader() inputs,
+
+  FxaaFloat2 fxaaQualityRcpFrame,
+  FxaaFloat4 fxaaConsoleRcpFrameOpt,
+  FxaaFloat4 fxaaConsoleRcpFrameOpt2,
+  FxaaFloat4 fxaaConsole360RcpFrameOpt2,
+  FxaaFloat fxaaQualitySubpix,
+  FxaaFloat fxaaQualityEdgeThreshold,
+  FxaaFloat fxaaQualityEdgeThresholdMin,
+  FxaaFloat fxaaConsoleEdgeSharpness,
+  FxaaFloat fxaaConsoleEdgeThreshold,
+  FxaaFloat fxaaConsoleEdgeThresholdMin,
+  FxaaFloat4 fxaaConsole360ConstDir
+
+Look at the FXAA Quality FxaaPixelShader() for docs on inputs.
+
+(6.)
+Have FXAA vertex shader run as a full screen triangle,
+and output "pos" and "fxaaConsolePosPos" 
+such that inputs in the pixel shader provide,
+
+  // {xy} = center of pixel
+  FxaaFloat2 pos,
+
+  // {xy__} = upper left of pixel
+  // {__zw} = lower right of pixel
+  FxaaFloat4 fxaaConsolePosPos,
+
+(7.)
+Insure the texture sampler(s) used by FXAA are set to bilinear filtering.
+
+
+------------------------------------------------------------------------------
+                    INTEGRATION - RGBL AND COLORSPACE
+------------------------------------------------------------------------------
+FXAA3 requires RGBL as input unless the following is set, 
+
+  #define FXAA_GREEN_AS_LUMA 1
+
+In which case the engine uses green in place of luma,
+and requires RGB input is in a non-linear colorspace.
+
+RGB should be LDR (low dynamic range).
+Specifically do FXAA after tonemapping.
+
+RGB data as returned by a texture fetch can be non-linear,
+or linear when FXAA_GREEN_AS_LUMA is not set.
+Note an "sRGB format" texture counts as linear,
+because the result of a texture fetch is linear data.
+Regular "RGBA8" textures in the sRGB colorspace are non-linear.
+
+If FXAA_GREEN_AS_LUMA is not set,
+luma must be stored in the alpha channel prior to running FXAA.
+This luma should be in a perceptual space (could be gamma 2.0).
+Example pass before FXAA where output is gamma 2.0 encoded,
+
+  color.rgb = ToneMap(color.rgb); // linear color output
+  color.rgb = sqrt(color.rgb);    // gamma 2.0 color output
+  return color;
+
+To use FXAA,
+
+  color.rgb = ToneMap(color.rgb);  // linear color output
+  color.rgb = sqrt(color.rgb);     // gamma 2.0 color output
+  color.a = dot(color.rgb, FxaaFloat3(0.299, 0.587, 0.114)); // compute luma
+  return color;
+
+Another example where output is linear encoded,
+say for instance writing to an sRGB formated render target,
+where the render target does the conversion back to sRGB after blending,
+
+  color.rgb = ToneMap(color.rgb); // linear color output
+  return color;
+
+To use FXAA,
+
+  color.rgb = ToneMap(color.rgb); // linear color output
+  color.a = sqrt(dot(color.rgb, FxaaFloat3(0.299, 0.587, 0.114))); // compute luma
+  return color;
+
+Getting luma correct is required for the algorithm to work correctly.
+
+
+------------------------------------------------------------------------------
+                          BEING LINEARLY CORRECT?
+------------------------------------------------------------------------------
+Applying FXAA to a framebuffer with linear RGB color will look worse.
+This is very counter intuitive, but happends to be true in this case.
+The reason is because dithering artifacts will be more visiable 
+in a linear colorspace.
+
+
+------------------------------------------------------------------------------
+                             COMPLEX INTEGRATION
+------------------------------------------------------------------------------
+Q. What if the engine is blending into RGB before wanting to run FXAA?
+
+A. In the last opaque pass prior to FXAA,
+   have the pass write out luma into alpha.
+   Then blend into RGB only.
+   FXAA should be able to run ok
+   assuming the blending pass did not any add aliasing.
+   This should be the common case for particles and common blending passes.
+
+A. Or use FXAA_GREEN_AS_LUMA.
+
+============================================================================*/
+
+/*============================================================================
+
+                             INTEGRATION KNOBS
+
+============================================================================*/
+//
+// FXAA_PS3 and FXAA_360 choose the console algorithm (FXAA3 CONSOLE).
+// FXAA_360_OPT is a prototype for the new optimized 360 version.
+//
+// 1 = Use API.
+// 0 = Don't use API.
+//
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_PS3
+    #define FXAA_PS3 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_360
+    #define FXAA_360 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_360_OPT
+    #define FXAA_360_OPT 0
+#endif
+/*==========================================================================*/
+#ifndef FXAA_PC
+    //
+    // FXAA Quality
+    // The high quality PC algorithm.
+    //
+    #define FXAA_PC 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_PC_CONSOLE
+    //
+    // The console algorithm for PC is included
+    // for developers targeting really low spec machines.
+    // Likely better to just run FXAA_PC, and use a really low preset.
+    //
+    #define FXAA_PC_CONSOLE 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_GLSL_120
+    #define FXAA_GLSL_120 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_GLSL_130
+    #define FXAA_GLSL_130 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_HLSL_3
+    #define FXAA_HLSL_3 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_HLSL_4
+    #define FXAA_HLSL_4 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_HLSL_5
+    #define FXAA_HLSL_5 0
+#endif
+/*==========================================================================*/
+#ifndef FXAA_GREEN_AS_LUMA
+    //
+    // For those using non-linear color,
+    // and either not able to get luma in alpha, or not wanting to,
+    // this enables FXAA to run using green as a proxy for luma.
+    // So with this enabled, no need to pack luma in alpha.
+    //
+    // This will turn off AA on anything which lacks some amount of green.
+    // Pure red and blue or combination of only R and B, will get no AA.
+    //
+    // Might want to lower the settings for both,
+    //    fxaaConsoleEdgeThresholdMin
+    //    fxaaQualityEdgeThresholdMin
+    // In order to insure AA does not get turned off on colors 
+    // which contain a minor amount of green.
+    //
+    // 1 = On.
+    // 0 = Off.
+    //
+    #define FXAA_GREEN_AS_LUMA 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_EARLY_EXIT
+    //
+    // Controls algorithm's early exit path.
+    // On PS3 turning this ON adds 2 cycles to the shader.
+    // On 360 turning this OFF adds 10ths of a millisecond to the shader.
+    // Turning this off on console will result in a more blurry image.
+    // So this defaults to on.
+    //
+    // 1 = On.
+    // 0 = Off.
+    //
+    #define FXAA_EARLY_EXIT 1
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_DISCARD
+    //
+    // Only valid for PC OpenGL currently.
+    // Probably will not work when FXAA_GREEN_AS_LUMA = 1.
+    //
+    // 1 = Use discard on pixels which don't need AA.
+    //     For APIs which enable concurrent TEX+ROP from same surface.
+    // 0 = Return unchanged color on pixels which don't need AA.
+    //
+    #define FXAA_DISCARD 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_FAST_PIXEL_OFFSET
+    //
+    // Used for GLSL 120 only.
+    //
+    // 1 = GL API supports fast pixel offsets
+    // 0 = do not use fast pixel offsets
+    //
+    #ifdef GL_EXT_gpu_shader4
+        #define FXAA_FAST_PIXEL_OFFSET 1
+    #endif
+    #ifdef GL_NV_gpu_shader5
+        #define FXAA_FAST_PIXEL_OFFSET 1
+    #endif
+    #ifdef GL_ARB_gpu_shader5
+        #define FXAA_FAST_PIXEL_OFFSET 1
+    #endif
+    #ifndef FXAA_FAST_PIXEL_OFFSET
+        #define FXAA_FAST_PIXEL_OFFSET 0
+    #endif
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_GATHER4_ALPHA
+    //
+    // 1 = API supports gather4 on alpha channel.
+    // 0 = API does not support gather4 on alpha channel.
+    //
+	#if (FXAA_GLSL_130 == 0)
+		#define FXAA_GATHER4_ALPHA 0
+	#endif
+    #if (FXAA_HLSL_5 == 1)
+        #define FXAA_GATHER4_ALPHA 1
+    #endif
+    #ifndef FXAA_GATHER4_ALPHA
+		#ifdef GL_ARB_gpu_shader5
+			#define FXAA_GATHER4_ALPHA 1
+		#endif
+	    #ifdef GL_NV_gpu_shader5
+		    #define FXAA_GATHER4_ALPHA 1
+		#endif
+		#ifndef FXAA_GATHER4_ALPHA
+			#define FXAA_GATHER4_ALPHA 0
+		#endif
+	#endif
+#endif
+
+/*============================================================================
+                      FXAA CONSOLE PS3 - TUNING KNOBS
+============================================================================*/
+#ifndef FXAA_CONSOLE__PS3_EDGE_SHARPNESS
+    //
+    // Consoles the sharpness of edges on PS3 only.
+    // Non-PS3 tuning is done with shader input.
+    //
+    // Due to the PS3 being ALU bound,
+    // there are only two safe values here: 4 and 8.
+    // These options use the shaders ability to a free *|/ by 2|4|8.
+    //
+    // 8.0 is sharper
+    // 4.0 is softer
+    // 2.0 is really soft (good for vector graphics inputs)
+    //
+    #if 1
+        #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 8.0
+    #endif
+    #if 0
+        #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 4.0
+    #endif
+    #if 0
+        #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 2.0
+    #endif
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_CONSOLE__PS3_EDGE_THRESHOLD
+    //
+    // Only effects PS3.
+    // Non-PS3 tuning is done with shader input.
+    //
+    // The minimum amount of local contrast required to apply algorithm.
+    // The console setting has a different mapping than the quality setting.
+    //
+    // This only applies when FXAA_EARLY_EXIT is 1.
+    //
+    // Due to the PS3 being ALU bound,
+    // there are only two safe values here: 0.25 and 0.125.
+    // These options use the shaders ability to a free *|/ by 2|4|8.
+    //
+    // 0.125 leaves less aliasing, but is softer
+    // 0.25 leaves more aliasing, and is sharper
+    //
+    #if 1
+        #define FXAA_CONSOLE__PS3_EDGE_THRESHOLD 0.125
+    #else
+        #define FXAA_CONSOLE__PS3_EDGE_THRESHOLD 0.25
+    #endif
+#endif
+
+/*============================================================================
+                        FXAA QUALITY - TUNING KNOBS
+------------------------------------------------------------------------------
+NOTE the other tuning knobs are now in the shader function inputs!
+============================================================================*/
+#ifndef FXAA_QUALITY__PRESET
+    //
+    // Choose the quality preset.
+    // This needs to be compiled into the shader as it effects code.
+    // Best option to include multiple presets is to 
+    // in each shader define the preset, then include this file.
+    // 
+    // OPTIONS
+    // -----------------------------------------------------------------------
+    // 10 to 15 - default medium dither (10=fastest, 15=highest quality)
+    // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)
+    // 39       - no dither, very expensive 
+    //
+    // NOTES
+    // -----------------------------------------------------------------------
+    // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)
+    // 13 = about same speed as FXAA 3.9 and better than 12
+    // 23 = closest to FXAA 3.9 visually and performance wise
+    //  _ = the lowest digit is directly related to performance
+    // _  = the highest digit is directly related to style
+    // 
+    #define FXAA_QUALITY__PRESET 12
+#endif
+
+
+/*============================================================================
+
+                           FXAA QUALITY - PRESETS
+
+============================================================================*/
+
+/*============================================================================
+                     FXAA QUALITY - MEDIUM DITHER PRESETS
+============================================================================*/
+#if (FXAA_QUALITY__PRESET == 10)
+    #define FXAA_QUALITY__PS 3
+    #define FXAA_QUALITY__P0 1.5
+    #define FXAA_QUALITY__P1 3.0
+    #define FXAA_QUALITY__P2 12.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 11)
+    #define FXAA_QUALITY__PS 4
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.5
+    #define FXAA_QUALITY__P2 3.0
+    #define FXAA_QUALITY__P3 12.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 12)
+    #define FXAA_QUALITY__PS 5
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.5
+    #define FXAA_QUALITY__P2 2.0
+    #define FXAA_QUALITY__P3 4.0
+    #define FXAA_QUALITY__P4 12.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 13)
+    #define FXAA_QUALITY__PS 6
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.5
+    #define FXAA_QUALITY__P2 2.0
+    #define FXAA_QUALITY__P3 2.0
+    #define FXAA_QUALITY__P4 4.0
+    #define FXAA_QUALITY__P5 12.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 14)
+    #define FXAA_QUALITY__PS 7
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.5
+    #define FXAA_QUALITY__P2 2.0
+    #define FXAA_QUALITY__P3 2.0
+    #define FXAA_QUALITY__P4 2.0
+    #define FXAA_QUALITY__P5 4.0
+    #define FXAA_QUALITY__P6 12.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 15)
+    #define FXAA_QUALITY__PS 8
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.5
+    #define FXAA_QUALITY__P2 2.0
+    #define FXAA_QUALITY__P3 2.0
+    #define FXAA_QUALITY__P4 2.0
+    #define FXAA_QUALITY__P5 2.0
+    #define FXAA_QUALITY__P6 4.0
+    #define FXAA_QUALITY__P7 12.0
+#endif
+
+/*============================================================================
+                     FXAA QUALITY - LOW DITHER PRESETS
+============================================================================*/
+#if (FXAA_QUALITY__PRESET == 20)
+    #define FXAA_QUALITY__PS 3
+    #define FXAA_QUALITY__P0 1.5
+    #define FXAA_QUALITY__P1 2.0
+    #define FXAA_QUALITY__P2 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 21)
+    #define FXAA_QUALITY__PS 4
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.5
+    #define FXAA_QUALITY__P2 2.0
+    #define FXAA_QUALITY__P3 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 22)
+    #define FXAA_QUALITY__PS 5
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.5
+    #define FXAA_QUALITY__P2 2.0
+    #define FXAA_QUALITY__P3 2.0
+    #define FXAA_QUALITY__P4 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 23)
+    #define FXAA_QUALITY__PS 6
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.5
+    #define FXAA_QUALITY__P2 2.0
+    #define FXAA_QUALITY__P3 2.0
+    #define FXAA_QUALITY__P4 2.0
+    #define FXAA_QUALITY__P5 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 24)
+    #define FXAA_QUALITY__PS 7
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.5
+    #define FXAA_QUALITY__P2 2.0
+    #define FXAA_QUALITY__P3 2.0
+    #define FXAA_QUALITY__P4 2.0
+    #define FXAA_QUALITY__P5 3.0
+    #define FXAA_QUALITY__P6 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 25)
+    #define FXAA_QUALITY__PS 8
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.5
+    #define FXAA_QUALITY__P2 2.0
+    #define FXAA_QUALITY__P3 2.0
+    #define FXAA_QUALITY__P4 2.0
+    #define FXAA_QUALITY__P5 2.0
+    #define FXAA_QUALITY__P6 4.0
+    #define FXAA_QUALITY__P7 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 26)
+    #define FXAA_QUALITY__PS 9
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.5
+    #define FXAA_QUALITY__P2 2.0
+    #define FXAA_QUALITY__P3 2.0
+    #define FXAA_QUALITY__P4 2.0
+    #define FXAA_QUALITY__P5 2.0
+    #define FXAA_QUALITY__P6 2.0
+    #define FXAA_QUALITY__P7 4.0
+    #define FXAA_QUALITY__P8 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 27)
+    #define FXAA_QUALITY__PS 10
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.5
+    #define FXAA_QUALITY__P2 2.0
+    #define FXAA_QUALITY__P3 2.0
+    #define FXAA_QUALITY__P4 2.0
+    #define FXAA_QUALITY__P5 2.0
+    #define FXAA_QUALITY__P6 2.0
+    #define FXAA_QUALITY__P7 2.0
+    #define FXAA_QUALITY__P8 4.0
+    #define FXAA_QUALITY__P9 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 28)
+    #define FXAA_QUALITY__PS 11
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.5
+    #define FXAA_QUALITY__P2 2.0
+    #define FXAA_QUALITY__P3 2.0
+    #define FXAA_QUALITY__P4 2.0
+    #define FXAA_QUALITY__P5 2.0
+    #define FXAA_QUALITY__P6 2.0
+    #define FXAA_QUALITY__P7 2.0
+    #define FXAA_QUALITY__P8 2.0
+    #define FXAA_QUALITY__P9 4.0
+    #define FXAA_QUALITY__P10 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 29)
+    #define FXAA_QUALITY__PS 12
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.5
+    #define FXAA_QUALITY__P2 2.0
+    #define FXAA_QUALITY__P3 2.0
+    #define FXAA_QUALITY__P4 2.0
+    #define FXAA_QUALITY__P5 2.0
+    #define FXAA_QUALITY__P6 2.0
+    #define FXAA_QUALITY__P7 2.0
+    #define FXAA_QUALITY__P8 2.0
+    #define FXAA_QUALITY__P9 2.0
+    #define FXAA_QUALITY__P10 4.0
+    #define FXAA_QUALITY__P11 8.0
+#endif
+
+/*============================================================================
+                     FXAA QUALITY - EXTREME QUALITY
+============================================================================*/
+#if (FXAA_QUALITY__PRESET == 39)
+    #define FXAA_QUALITY__PS 12
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.0
+    #define FXAA_QUALITY__P2 1.0
+    #define FXAA_QUALITY__P3 1.0
+    #define FXAA_QUALITY__P4 1.0
+    #define FXAA_QUALITY__P5 1.5
+    #define FXAA_QUALITY__P6 2.0
+    #define FXAA_QUALITY__P7 2.0
+    #define FXAA_QUALITY__P8 2.0
+    #define FXAA_QUALITY__P9 2.0
+    #define FXAA_QUALITY__P10 4.0
+    #define FXAA_QUALITY__P11 8.0
+#endif
+
+
+
+/*============================================================================
+
+                                API PORTING
+
+============================================================================*/
+#if (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)
+    #define FxaaBool bool
+    #define FxaaDiscard discard
+    #define FxaaFloat float
+    #define FxaaFloat2 vec2
+    #define FxaaFloat3 vec3
+    #define FxaaFloat4 vec4
+    #define FxaaHalf float
+    #define FxaaHalf2 vec2
+    #define FxaaHalf3 vec3
+    #define FxaaHalf4 vec4
+    #define FxaaInt2 ivec2
+    #define FxaaSat(x) clamp(x, 0.0, 1.0)
+    #define FxaaTex sampler2D
+#else
+    #define FxaaBool bool
+    #define FxaaDiscard clip(-1)
+    #define FxaaFloat float
+    #define FxaaFloat2 float2
+    #define FxaaFloat3 float3
+    #define FxaaFloat4 float4
+    #define FxaaHalf half
+    #define FxaaHalf2 half2
+    #define FxaaHalf3 half3
+    #define FxaaHalf4 half4
+    #define FxaaSat(x) saturate(x)
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_GLSL_120 == 1)
+    // Requires,
+    //  #version 120
+    // And at least,
+    //  #extension GL_EXT_gpu_shader4 : enable
+    //  (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)
+    #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)
+    #if (FXAA_FAST_PIXEL_OFFSET == 1)
+        #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)
+    #else
+        #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)
+    #endif
+    #if (FXAA_GATHER4_ALPHA == 1)
+        // use #extension GL_ARB_gpu_shader5 : enable
+        #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)
+        #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)
+        #define FxaaTexGreen4(t, p) textureGather(t, p, 1)
+        #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)
+    #endif
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_GLSL_130 == 1)
+    // Requires "#version 130" or better
+    #define FxaaTexTop(t, p) textureLod(t, p, 0.0)
+    #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)
+    #if (FXAA_GATHER4_ALPHA == 1)
+        // use #extension GL_ARB_gpu_shader5 : enable
+        #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)
+        #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)
+        #define FxaaTexGreen4(t, p) textureGather(t, p, 1)
+        #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)
+    #endif
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_HLSL_3 == 1) || (FXAA_360 == 1) || (FXAA_PS3 == 1)
+    #define FxaaInt2 float2
+    #define FxaaTex sampler2D
+    #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))
+    #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_HLSL_4 == 1)
+    #define FxaaInt2 int2
+    struct FxaaTex { SamplerState smpl; Texture2D tex; };
+    #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)
+    #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_HLSL_5 == 1)
+    #define FxaaInt2 int2
+    struct FxaaTex { SamplerState smpl; Texture2D tex; };
+    #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)
+    #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)
+    #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)
+    #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)
+    #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)
+    #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)
+#endif
+
+
+/*============================================================================
+                   GREEN AS LUMA OPTION SUPPORT FUNCTION
+============================================================================*/
+#if (FXAA_GREEN_AS_LUMA == 0)
+    FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }
+#else
+    FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }
+#endif    
+
+
+
+
+/*============================================================================
+
+                             FXAA3 QUALITY - PC
+
+============================================================================*/
+#if (FXAA_PC == 1)
+/*--------------------------------------------------------------------------*/
+FxaaFloat4 FxaaPixelShader(
+    //
+    // Use noperspective interpolation here (turn off perspective interpolation).
+    // {xy} = center of pixel
+    FxaaFloat2 pos,
+    //
+    // Used only for FXAA Console, and not used on the 360 version.
+    // Use noperspective interpolation here (turn off perspective interpolation).
+    // {xy__} = upper left of pixel
+    // {__zw} = lower right of pixel
+    FxaaFloat4 fxaaConsolePosPos,
+    //
+    // Input color texture.
+    // {rgb_} = color in linear or perceptual color space
+    // if (FXAA_GREEN_AS_LUMA == 0)
+    //     {___a} = luma in perceptual color space (not linear)
+    FxaaTex tex,
+    //
+    // Only used on the optimized 360 version of FXAA Console.
+    // For everything but 360, just use the same input here as for "tex".
+    // For 360, same texture, just alias with a 2nd sampler.
+    // This sampler needs to have an exponent bias of -1.
+    FxaaTex fxaaConsole360TexExpBiasNegOne,
+    //
+    // Only used on the optimized 360 version of FXAA Console.
+    // For everything but 360, just use the same input here as for "tex".
+    // For 360, same texture, just alias with a 3nd sampler.
+    // This sampler needs to have an exponent bias of -2.
+    FxaaTex fxaaConsole360TexExpBiasNegTwo,
+    //
+    // Only used on FXAA Quality.
+    // This must be from a constant/uniform.
+    // {x_} = 1.0/screenWidthInPixels
+    // {_y} = 1.0/screenHeightInPixels
+    FxaaFloat2 fxaaQualityRcpFrame,
+    //
+    // Only used on FXAA Console.
+    // This must be from a constant/uniform.
+    // This effects sub-pixel AA quality and inversely sharpness.
+    //   Where N ranges between,
+    //     N = 0.50 (default)
+    //     N = 0.33 (sharper)
+    // {x___} = -N/screenWidthInPixels  
+    // {_y__} = -N/screenHeightInPixels
+    // {__z_} =  N/screenWidthInPixels  
+    // {___w} =  N/screenHeightInPixels 
+    FxaaFloat4 fxaaConsoleRcpFrameOpt,
+    //
+    // Only used on FXAA Console.
+    // Not used on 360, but used on PS3 and PC.
+    // This must be from a constant/uniform.
+    // {x___} = -2.0/screenWidthInPixels  
+    // {_y__} = -2.0/screenHeightInPixels
+    // {__z_} =  2.0/screenWidthInPixels  
+    // {___w} =  2.0/screenHeightInPixels 
+    FxaaFloat4 fxaaConsoleRcpFrameOpt2,
+    //
+    // Only used on FXAA Console.
+    // Only used on 360 in place of fxaaConsoleRcpFrameOpt2.
+    // This must be from a constant/uniform.
+    // {x___} =  8.0/screenWidthInPixels  
+    // {_y__} =  8.0/screenHeightInPixels
+    // {__z_} = -4.0/screenWidthInPixels  
+    // {___w} = -4.0/screenHeightInPixels 
+    FxaaFloat4 fxaaConsole360RcpFrameOpt2,
+    //
+    // Only used on FXAA Quality.
+    // This used to be the FXAA_QUALITY__SUBPIX define.
+    // It is here now to allow easier tuning.
+    // Choose the amount of sub-pixel aliasing removal.
+    // This can effect sharpness.
+    //   1.00 - upper limit (softer)
+    //   0.75 - default amount of filtering
+    //   0.50 - lower limit (sharper, less sub-pixel aliasing removal)
+    //   0.25 - almost off
+    //   0.00 - completely off
+    FxaaFloat fxaaQualitySubpix,
+    //
+    // Only used on FXAA Quality.
+    // This used to be the FXAA_QUALITY__EDGE_THRESHOLD define.
+    // It is here now to allow easier tuning.
+    // The minimum amount of local contrast required to apply algorithm.
+    //   0.333 - too little (faster)
+    //   0.250 - low quality
+    //   0.166 - default
+    //   0.125 - high quality 
+    //   0.063 - overkill (slower)
+    FxaaFloat fxaaQualityEdgeThreshold,
+    //
+    // Only used on FXAA Quality.
+    // This used to be the FXAA_QUALITY__EDGE_THRESHOLD_MIN define.
+    // It is here now to allow easier tuning.
+    // Trims the algorithm from processing darks.
+    //   0.0833 - upper limit (default, the start of visible unfiltered edges)
+    //   0.0625 - high quality (faster)
+    //   0.0312 - visible limit (slower)
+    // Special notes when using FXAA_GREEN_AS_LUMA,
+    //   Likely want to set this to zero.
+    //   As colors that are mostly not-green
+    //   will appear very dark in the green channel!
+    //   Tune by looking at mostly non-green content,
+    //   then start at zero and increase until aliasing is a problem.
+    FxaaFloat fxaaQualityEdgeThresholdMin,
+    // 
+    // Only used on FXAA Console.
+    // This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define.
+    // It is here now to allow easier tuning.
+    // This does not effect PS3, as this needs to be compiled in.
+    //   Use FXAA_CONSOLE__PS3_EDGE_SHARPNESS for PS3.
+    //   Due to the PS3 being ALU bound,
+    //   there are only three safe values here: 2 and 4 and 8.
+    //   These options use the shaders ability to a free *|/ by 2|4|8.
+    // For all other platforms can be a non-power of two.
+    //   8.0 is sharper (default!!!)
+    //   4.0 is softer
+    //   2.0 is really soft (good only for vector graphics inputs)
+    FxaaFloat fxaaConsoleEdgeSharpness,
+    //
+    // Only used on FXAA Console.
+    // This used to be the FXAA_CONSOLE__EDGE_THRESHOLD define.
+    // It is here now to allow easier tuning.
+    // This does not effect PS3, as this needs to be compiled in.
+    //   Use FXAA_CONSOLE__PS3_EDGE_THRESHOLD for PS3.
+    //   Due to the PS3 being ALU bound,
+    //   there are only two safe values here: 1/4 and 1/8.
+    //   These options use the shaders ability to a free *|/ by 2|4|8.
+    // The console setting has a different mapping than the quality setting.
+    // Other platforms can use other values.
+    //   0.125 leaves less aliasing, but is softer (default!!!)
+    //   0.25 leaves more aliasing, and is sharper
+    FxaaFloat fxaaConsoleEdgeThreshold,
+    //
+    // Only used on FXAA Console.
+    // This used to be the FXAA_CONSOLE__EDGE_THRESHOLD_MIN define.
+    // It is here now to allow easier tuning.
+    // Trims the algorithm from processing darks.
+    // The console setting has a different mapping than the quality setting.
+    // This only applies when FXAA_EARLY_EXIT is 1.
+    // This does not apply to PS3, 
+    // PS3 was simplified to avoid more shader instructions.
+    //   0.06 - faster but more aliasing in darks
+    //   0.05 - default
+    //   0.04 - slower and less aliasing in darks
+    // Special notes when using FXAA_GREEN_AS_LUMA,
+    //   Likely want to set this to zero.
+    //   As colors that are mostly not-green
+    //   will appear very dark in the green channel!
+    //   Tune by looking at mostly non-green content,
+    //   then start at zero and increase until aliasing is a problem.
+    FxaaFloat fxaaConsoleEdgeThresholdMin,
+    //    
+    // Extra constants for 360 FXAA Console only.
+    // Use zeros or anything else for other platforms.
+    // These must be in physical constant registers and NOT immedates.
+    // Immedates will result in compiler un-optimizing.
+    // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)
+    FxaaFloat4 fxaaConsole360ConstDir
+) {
+/*--------------------------------------------------------------------------*/
+    FxaaFloat2 posM;
+    posM.x = pos.x;
+    posM.y = pos.y;
+    #if (FXAA_GATHER4_ALPHA == 1)
+        #if (FXAA_DISCARD == 0)
+            FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
+            #if (FXAA_GREEN_AS_LUMA == 0)
+                #define lumaM rgbyM.w
+            #else
+                #define lumaM rgbyM.y
+            #endif
+        #endif
+        #if (FXAA_GREEN_AS_LUMA == 0)
+            FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);
+            FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));
+        #else
+            FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);
+            FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));
+        #endif
+        #if (FXAA_DISCARD == 1)
+            #define lumaM luma4A.w
+        #endif
+        #define lumaE luma4A.z
+        #define lumaS luma4A.x
+        #define lumaSE luma4A.y
+        #define lumaNW luma4B.w
+        #define lumaN luma4B.z
+        #define lumaW luma4B.x
+    #else
+        FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
+        #if (FXAA_GREEN_AS_LUMA == 0)
+            #define lumaM rgbyM.w
+        #else
+            #define lumaM rgbyM.y
+        #endif
+        FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));
+        FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));
+        FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));
+        FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));
+    #endif
+/*--------------------------------------------------------------------------*/
+    FxaaFloat maxSM = max(lumaS, lumaM);
+    FxaaFloat minSM = min(lumaS, lumaM);
+    FxaaFloat maxESM = max(lumaE, maxSM);
+    FxaaFloat minESM = min(lumaE, minSM);
+    FxaaFloat maxWN = max(lumaN, lumaW);
+    FxaaFloat minWN = min(lumaN, lumaW);
+    FxaaFloat rangeMax = max(maxWN, maxESM);
+    FxaaFloat rangeMin = min(minWN, minESM);
+    FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;
+    FxaaFloat range = rangeMax - rangeMin;
+    FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);
+    FxaaBool earlyExit = range < rangeMaxClamped;
+/*--------------------------------------------------------------------------*/
+    if(earlyExit)
+        #if (FXAA_DISCARD == 1)
+            FxaaDiscard;
+        #else
+            return rgbyM;
+        #endif
+/*--------------------------------------------------------------------------*/
+    #if (FXAA_GATHER4_ALPHA == 0)
+        FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));
+        FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));
+        FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));
+        FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
+    #else
+        FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));
+        FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
+    #endif
+/*--------------------------------------------------------------------------*/
+    FxaaFloat lumaNS = lumaN + lumaS;
+    FxaaFloat lumaWE = lumaW + lumaE;
+    FxaaFloat subpixRcpRange = 1.0/range;
+    FxaaFloat subpixNSWE = lumaNS + lumaWE;
+    FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;
+    FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;
+/*--------------------------------------------------------------------------*/
+    FxaaFloat lumaNESE = lumaNE + lumaSE;
+    FxaaFloat lumaNWNE = lumaNW + lumaNE;
+    FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;
+    FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;
+/*--------------------------------------------------------------------------*/
+    FxaaFloat lumaNWSW = lumaNW + lumaSW;
+    FxaaFloat lumaSWSE = lumaSW + lumaSE;
+    FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);
+    FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);
+    FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;
+    FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;
+    FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;
+    FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;
+/*--------------------------------------------------------------------------*/
+    FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;
+    FxaaFloat lengthSign = fxaaQualityRcpFrame.x;
+    FxaaBool horzSpan = edgeHorz >= edgeVert;
+    FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;
+/*--------------------------------------------------------------------------*/
+    if(!horzSpan) lumaN = lumaW;
+    if(!horzSpan) lumaS = lumaE;
+    if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;
+    FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;
+/*--------------------------------------------------------------------------*/
+    FxaaFloat gradientN = lumaN - lumaM;
+    FxaaFloat gradientS = lumaS - lumaM;
+    FxaaFloat lumaNN = lumaN + lumaM;
+    FxaaFloat lumaSS = lumaS + lumaM;
+    FxaaBool pairN = abs(gradientN) >= abs(gradientS);
+    FxaaFloat gradient = max(abs(gradientN), abs(gradientS));
+    if(pairN) lengthSign = -lengthSign;
+    FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);
+/*--------------------------------------------------------------------------*/
+    FxaaFloat2 posB;
+    posB.x = posM.x;
+    posB.y = posM.y;
+    FxaaFloat2 offNP;
+    offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;
+    offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;
+    if(!horzSpan) posB.x += lengthSign * 0.5;
+    if( horzSpan) posB.y += lengthSign * 0.5;
+/*--------------------------------------------------------------------------*/
+    FxaaFloat2 posN;
+    posN.x = posB.x - offNP.x * FXAA_QUALITY__P0;
+    posN.y = posB.y - offNP.y * FXAA_QUALITY__P0;
+    FxaaFloat2 posP;
+    posP.x = posB.x + offNP.x * FXAA_QUALITY__P0;
+    posP.y = posB.y + offNP.y * FXAA_QUALITY__P0;
+    FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;
+    FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));
+    FxaaFloat subpixE = subpixC * subpixC;
+    FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));
+/*--------------------------------------------------------------------------*/
+    if(!pairN) lumaNN = lumaSS;
+    FxaaFloat gradientScaled = gradient * 1.0/4.0;
+    FxaaFloat lumaMM = lumaM - lumaNN * 0.5;
+    FxaaFloat subpixF = subpixD * subpixE;
+    FxaaBool lumaMLTZero = lumaMM < 0.0;
+/*--------------------------------------------------------------------------*/
+    lumaEndN -= lumaNN * 0.5;
+    lumaEndP -= lumaNN * 0.5;
+    FxaaBool doneN = abs(lumaEndN) >= gradientScaled;
+    FxaaBool doneP = abs(lumaEndP) >= gradientScaled;
+    if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P1;
+    if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P1;
+    FxaaBool doneNP = (!doneN) || (!doneP);
+    if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P1;
+    if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P1;
+/*--------------------------------------------------------------------------*/
+    if(doneNP) {
+        if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+        if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+        if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+        if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+        doneN = abs(lumaEndN) >= gradientScaled;
+        doneP = abs(lumaEndP) >= gradientScaled;
+        if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P2;
+        if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P2;
+        doneNP = (!doneN) || (!doneP);
+        if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P2;
+        if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P2;
+/*--------------------------------------------------------------------------*/
+        #if (FXAA_QUALITY__PS > 3)
+        if(doneNP) {
+            if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+            if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+            if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+            if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+            doneN = abs(lumaEndN) >= gradientScaled;
+            doneP = abs(lumaEndP) >= gradientScaled;
+            if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P3;
+            if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P3;
+            doneNP = (!doneN) || (!doneP);
+            if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P3;
+            if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P3;
+/*--------------------------------------------------------------------------*/
+            #if (FXAA_QUALITY__PS > 4)
+            if(doneNP) {
+                if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+                if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+                if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+                if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+                doneN = abs(lumaEndN) >= gradientScaled;
+                doneP = abs(lumaEndP) >= gradientScaled;
+                if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P4;
+                if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P4;
+                doneNP = (!doneN) || (!doneP);
+                if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P4;
+                if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P4;
+/*--------------------------------------------------------------------------*/
+                #if (FXAA_QUALITY__PS > 5)
+                if(doneNP) {
+                    if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+                    if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+                    if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+                    if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+                    doneN = abs(lumaEndN) >= gradientScaled;
+                    doneP = abs(lumaEndP) >= gradientScaled;
+                    if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P5;
+                    if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P5;
+                    doneNP = (!doneN) || (!doneP);
+                    if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P5;
+                    if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P5;
+/*--------------------------------------------------------------------------*/
+                    #if (FXAA_QUALITY__PS > 6)
+                    if(doneNP) {
+                        if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+                        if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+                        if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+                        if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+                        doneN = abs(lumaEndN) >= gradientScaled;
+                        doneP = abs(lumaEndP) >= gradientScaled;
+                        if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P6;
+                        if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P6;
+                        doneNP = (!doneN) || (!doneP);
+                        if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P6;
+                        if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P6;
+/*--------------------------------------------------------------------------*/
+                        #if (FXAA_QUALITY__PS > 7)
+                        if(doneNP) {
+                            if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+                            if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+                            if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+                            if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+                            doneN = abs(lumaEndN) >= gradientScaled;
+                            doneP = abs(lumaEndP) >= gradientScaled;
+                            if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P7;
+                            if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P7;
+                            doneNP = (!doneN) || (!doneP);
+                            if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P7;
+                            if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P7;
+/*--------------------------------------------------------------------------*/
+    #if (FXAA_QUALITY__PS > 8)
+    if(doneNP) {
+        if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+        if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+        if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+        if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+        doneN = abs(lumaEndN) >= gradientScaled;
+        doneP = abs(lumaEndP) >= gradientScaled;
+        if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P8;
+        if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P8;
+        doneNP = (!doneN) || (!doneP);
+        if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P8;
+        if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P8;
+/*--------------------------------------------------------------------------*/
+        #if (FXAA_QUALITY__PS > 9)
+        if(doneNP) {
+            if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+            if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+            if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+            if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+            doneN = abs(lumaEndN) >= gradientScaled;
+            doneP = abs(lumaEndP) >= gradientScaled;
+            if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P9;
+            if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P9;
+            doneNP = (!doneN) || (!doneP);
+            if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P9;
+            if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P9;
+/*--------------------------------------------------------------------------*/
+            #if (FXAA_QUALITY__PS > 10)
+            if(doneNP) {
+                if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+                if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+                if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+                if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+                doneN = abs(lumaEndN) >= gradientScaled;
+                doneP = abs(lumaEndP) >= gradientScaled;
+                if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P10;
+                if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P10;
+                doneNP = (!doneN) || (!doneP);
+                if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P10;
+                if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P10;
+/*--------------------------------------------------------------------------*/
+                #if (FXAA_QUALITY__PS > 11)
+                if(doneNP) {
+                    if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+                    if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+                    if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+                    if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+                    doneN = abs(lumaEndN) >= gradientScaled;
+                    doneP = abs(lumaEndP) >= gradientScaled;
+                    if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P11;
+                    if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P11;
+                    doneNP = (!doneN) || (!doneP);
+                    if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P11;
+                    if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P11;
+/*--------------------------------------------------------------------------*/
+                    #if (FXAA_QUALITY__PS > 12)
+                    if(doneNP) {
+                        if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+                        if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+                        if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+                        if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+                        doneN = abs(lumaEndN) >= gradientScaled;
+                        doneP = abs(lumaEndP) >= gradientScaled;
+                        if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P12;
+                        if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P12;
+                        doneNP = (!doneN) || (!doneP);
+                        if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P12;
+                        if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P12;
+/*--------------------------------------------------------------------------*/
+                    }
+                    #endif
+/*--------------------------------------------------------------------------*/
+                }
+                #endif
+/*--------------------------------------------------------------------------*/
+            }
+            #endif
+/*--------------------------------------------------------------------------*/
+        }
+        #endif
+/*--------------------------------------------------------------------------*/
+    }
+    #endif
+/*--------------------------------------------------------------------------*/
+                        }
+                        #endif
+/*--------------------------------------------------------------------------*/
+                    }
+                    #endif
+/*--------------------------------------------------------------------------*/
+                }
+                #endif
+/*--------------------------------------------------------------------------*/
+            }
+            #endif
+/*--------------------------------------------------------------------------*/
+        }
+        #endif
+/*--------------------------------------------------------------------------*/
+    }
+/*--------------------------------------------------------------------------*/
+    FxaaFloat dstN = posM.x - posN.x;
+    FxaaFloat dstP = posP.x - posM.x;
+    if(!horzSpan) dstN = posM.y - posN.y;
+    if(!horzSpan) dstP = posP.y - posM.y;
+/*--------------------------------------------------------------------------*/
+    FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;
+    FxaaFloat spanLength = (dstP + dstN);
+    FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;
+    FxaaFloat spanLengthRcp = 1.0/spanLength;
+/*--------------------------------------------------------------------------*/
+    FxaaBool directionN = dstN < dstP;
+    FxaaFloat dst = min(dstN, dstP);
+    FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;
+    FxaaFloat subpixG = subpixF * subpixF;
+    FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;
+    FxaaFloat subpixH = subpixG * fxaaQualitySubpix;
+/*--------------------------------------------------------------------------*/
+    FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;
+    FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);
+    if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;
+    if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;
+    #if (FXAA_DISCARD == 1)
+        return FxaaTexTop(tex, posM);
+    #else
+        return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);
+    #endif
+}
+/*==========================================================================*/
+#endif
+
+
+
+
+/*============================================================================
+
+                         FXAA3 CONSOLE - PC VERSION
+                         
+------------------------------------------------------------------------------
+Instead of using this on PC, I'd suggest just using FXAA Quality with
+    #define FXAA_QUALITY__PRESET 10
+Or 
+    #define FXAA_QUALITY__PRESET 20
+Either are higher qualilty and almost as fast as this on modern PC GPUs.
+============================================================================*/
+#if (FXAA_PC_CONSOLE == 1)
+/*--------------------------------------------------------------------------*/
+FxaaFloat4 FxaaPixelShader(
+    // See FXAA Quality FxaaPixelShader() source for docs on Inputs!
+    FxaaFloat2 pos,
+    FxaaFloat4 fxaaConsolePosPos,
+    FxaaTex tex,
+    FxaaTex fxaaConsole360TexExpBiasNegOne,
+    FxaaTex fxaaConsole360TexExpBiasNegTwo,
+    FxaaFloat2 fxaaQualityRcpFrame,
+    FxaaFloat4 fxaaConsoleRcpFrameOpt,
+    FxaaFloat4 fxaaConsoleRcpFrameOpt2,
+    FxaaFloat4 fxaaConsole360RcpFrameOpt2,
+    FxaaFloat fxaaQualitySubpix,
+    FxaaFloat fxaaQualityEdgeThreshold,
+    FxaaFloat fxaaQualityEdgeThresholdMin,
+    FxaaFloat fxaaConsoleEdgeSharpness,
+    FxaaFloat fxaaConsoleEdgeThreshold,
+    FxaaFloat fxaaConsoleEdgeThresholdMin,
+    FxaaFloat4 fxaaConsole360ConstDir
+) {
+/*--------------------------------------------------------------------------*/
+    FxaaFloat lumaNw = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.xy));
+    FxaaFloat lumaSw = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.xw));
+    FxaaFloat lumaNe = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.zy));
+    FxaaFloat lumaSe = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.zw));
+/*--------------------------------------------------------------------------*/
+    FxaaFloat4 rgbyM = FxaaTexTop(tex, pos.xy);
+    #if (FXAA_GREEN_AS_LUMA == 0)
+        FxaaFloat lumaM = rgbyM.w;
+    #else
+        FxaaFloat lumaM = rgbyM.y;
+    #endif
+/*--------------------------------------------------------------------------*/
+    FxaaFloat lumaMaxNwSw = max(lumaNw, lumaSw);
+    lumaNe += 1.0/384.0;
+    FxaaFloat lumaMinNwSw = min(lumaNw, lumaSw);
+/*--------------------------------------------------------------------------*/
+    FxaaFloat lumaMaxNeSe = max(lumaNe, lumaSe);
+    FxaaFloat lumaMinNeSe = min(lumaNe, lumaSe);
+/*--------------------------------------------------------------------------*/
+    FxaaFloat lumaMax = max(lumaMaxNeSe, lumaMaxNwSw);
+    FxaaFloat lumaMin = min(lumaMinNeSe, lumaMinNwSw);
+/*--------------------------------------------------------------------------*/
+    FxaaFloat lumaMaxScaled = lumaMax * fxaaConsoleEdgeThreshold;
+/*--------------------------------------------------------------------------*/
+    FxaaFloat lumaMinM = min(lumaMin, lumaM);
+    FxaaFloat lumaMaxScaledClamped = max(fxaaConsoleEdgeThresholdMin, lumaMaxScaled);
+    FxaaFloat lumaMaxM = max(lumaMax, lumaM);
+    FxaaFloat dirSwMinusNe = lumaSw - lumaNe;
+    FxaaFloat lumaMaxSubMinM = lumaMaxM - lumaMinM;
+    FxaaFloat dirSeMinusNw = lumaSe - lumaNw;
+    if(lumaMaxSubMinM < lumaMaxScaledClamped) return rgbyM;
+/*--------------------------------------------------------------------------*/
+    FxaaFloat2 dir;
+    dir.x = dirSwMinusNe + dirSeMinusNw;
+    dir.y = dirSwMinusNe - dirSeMinusNw;
+/*--------------------------------------------------------------------------*/
+    FxaaFloat2 dir1 = normalize(dir.xy);
+    FxaaFloat4 rgbyN1 = FxaaTexTop(tex, pos.xy - dir1 * fxaaConsoleRcpFrameOpt.zw);
+    FxaaFloat4 rgbyP1 = FxaaTexTop(tex, pos.xy + dir1 * fxaaConsoleRcpFrameOpt.zw);
+/*--------------------------------------------------------------------------*/
+    FxaaFloat dirAbsMinTimesC = min(abs(dir1.x), abs(dir1.y)) * fxaaConsoleEdgeSharpness;
+    FxaaFloat2 dir2 = clamp(dir1.xy / dirAbsMinTimesC, -2.0, 2.0);
+/*--------------------------------------------------------------------------*/
+    FxaaFloat4 rgbyN2 = FxaaTexTop(tex, pos.xy - dir2 * fxaaConsoleRcpFrameOpt2.zw);
+    FxaaFloat4 rgbyP2 = FxaaTexTop(tex, pos.xy + dir2 * fxaaConsoleRcpFrameOpt2.zw);
+/*--------------------------------------------------------------------------*/
+    FxaaFloat4 rgbyA = rgbyN1 + rgbyP1;
+    FxaaFloat4 rgbyB = ((rgbyN2 + rgbyP2) * 0.25) + (rgbyA * 0.25);
+/*--------------------------------------------------------------------------*/
+    #if (FXAA_GREEN_AS_LUMA == 0)
+        FxaaBool twoTap = (rgbyB.w < lumaMin) || (rgbyB.w > lumaMax);
+    #else
+        FxaaBool twoTap = (rgbyB.y < lumaMin) || (rgbyB.y > lumaMax);
+    #endif
+    if(twoTap) rgbyB.xyz = rgbyA.xyz * 0.5;
+    return rgbyB; }
+/*==========================================================================*/
+#endif
+
+
+
+/*============================================================================
+
+                      FXAA3 CONSOLE - 360 PIXEL SHADER 
+
+------------------------------------------------------------------------------
+This optimized version thanks to suggestions from Andy Luedke.
+Should be fully tex bound in all cases.
+As of the FXAA 3.11 release, I have still not tested this code,
+however I fixed a bug which was in both FXAA 3.9 and FXAA 3.10.
+And note this is replacing the old unoptimized version.
+If it does not work, please let me know so I can fix it.
+============================================================================*/
+#if (FXAA_360 == 1)
+/*--------------------------------------------------------------------------*/
+[reduceTempRegUsage(4)]
+float4 FxaaPixelShader(
+    // See FXAA Quality FxaaPixelShader() source for docs on Inputs!
+    FxaaFloat2 pos,
+    FxaaFloat4 fxaaConsolePosPos,
+    FxaaTex tex,
+    FxaaTex fxaaConsole360TexExpBiasNegOne,
+    FxaaTex fxaaConsole360TexExpBiasNegTwo,
+    FxaaFloat2 fxaaQualityRcpFrame,
+    FxaaFloat4 fxaaConsoleRcpFrameOpt,
+    FxaaFloat4 fxaaConsoleRcpFrameOpt2,
+    FxaaFloat4 fxaaConsole360RcpFrameOpt2,
+    FxaaFloat fxaaQualitySubpix,
+    FxaaFloat fxaaQualityEdgeThreshold,
+    FxaaFloat fxaaQualityEdgeThresholdMin,
+    FxaaFloat fxaaConsoleEdgeSharpness,
+    FxaaFloat fxaaConsoleEdgeThreshold,
+    FxaaFloat fxaaConsoleEdgeThresholdMin,
+    FxaaFloat4 fxaaConsole360ConstDir
+) {
+/*--------------------------------------------------------------------------*/
+    float4 lumaNwNeSwSe;
+    #if (FXAA_GREEN_AS_LUMA == 0)
+        asm { 
+            tfetch2D lumaNwNeSwSe.w___, tex, pos.xy, OffsetX = -0.5, OffsetY = -0.5, UseComputedLOD=false
+            tfetch2D lumaNwNeSwSe._w__, tex, pos.xy, OffsetX =  0.5, OffsetY = -0.5, UseComputedLOD=false
+            tfetch2D lumaNwNeSwSe.__w_, tex, pos.xy, OffsetX = -0.5, OffsetY =  0.5, UseComputedLOD=false
+            tfetch2D lumaNwNeSwSe.___w, tex, pos.xy, OffsetX =  0.5, OffsetY =  0.5, UseComputedLOD=false
+        };
+    #else
+        asm { 
+            tfetch2D lumaNwNeSwSe.y___, tex, pos.xy, OffsetX = -0.5, OffsetY = -0.5, UseComputedLOD=false
+            tfetch2D lumaNwNeSwSe._y__, tex, pos.xy, OffsetX =  0.5, OffsetY = -0.5, UseComputedLOD=false
+            tfetch2D lumaNwNeSwSe.__y_, tex, pos.xy, OffsetX = -0.5, OffsetY =  0.5, UseComputedLOD=false
+            tfetch2D lumaNwNeSwSe.___y, tex, pos.xy, OffsetX =  0.5, OffsetY =  0.5, UseComputedLOD=false
+        };
+    #endif
+/*--------------------------------------------------------------------------*/
+    lumaNwNeSwSe.y += 1.0/384.0;
+    float2 lumaMinTemp = min(lumaNwNeSwSe.xy, lumaNwNeSwSe.zw);
+    float2 lumaMaxTemp = max(lumaNwNeSwSe.xy, lumaNwNeSwSe.zw);
+    float lumaMin = min(lumaMinTemp.x, lumaMinTemp.y);
+    float lumaMax = max(lumaMaxTemp.x, lumaMaxTemp.y);
+/*--------------------------------------------------------------------------*/
+    float4 rgbyM = tex2Dlod(tex, float4(pos.xy, 0.0, 0.0));
+    #if (FXAA_GREEN_AS_LUMA == 0)
+        float lumaMinM = min(lumaMin, rgbyM.w);
+        float lumaMaxM = max(lumaMax, rgbyM.w);
+    #else
+        float lumaMinM = min(lumaMin, rgbyM.y);
+        float lumaMaxM = max(lumaMax, rgbyM.y);
+    #endif        
+    if((lumaMaxM - lumaMinM) < max(fxaaConsoleEdgeThresholdMin, lumaMax * fxaaConsoleEdgeThreshold)) return rgbyM;
+/*--------------------------------------------------------------------------*/
+    float2 dir;
+    dir.x = dot(lumaNwNeSwSe, fxaaConsole360ConstDir.yyxx);
+    dir.y = dot(lumaNwNeSwSe, fxaaConsole360ConstDir.xyxy);
+    dir = normalize(dir);
+/*--------------------------------------------------------------------------*/
+    float4 dir1 = dir.xyxy * fxaaConsoleRcpFrameOpt.xyzw;
+/*--------------------------------------------------------------------------*/
+    float4 dir2;
+    float dirAbsMinTimesC = min(abs(dir.x), abs(dir.y)) * fxaaConsoleEdgeSharpness;
+    dir2 = saturate(fxaaConsole360ConstDir.zzww * dir.xyxy / dirAbsMinTimesC + 0.5);
+    dir2 = dir2 * fxaaConsole360RcpFrameOpt2.xyxy + fxaaConsole360RcpFrameOpt2.zwzw;
+/*--------------------------------------------------------------------------*/
+    float4 rgbyN1 = tex2Dlod(fxaaConsole360TexExpBiasNegOne, float4(pos.xy + dir1.xy, 0.0, 0.0));
+    float4 rgbyP1 = tex2Dlod(fxaaConsole360TexExpBiasNegOne, float4(pos.xy + dir1.zw, 0.0, 0.0));
+    float4 rgbyN2 = tex2Dlod(fxaaConsole360TexExpBiasNegTwo, float4(pos.xy + dir2.xy, 0.0, 0.0));
+    float4 rgbyP2 = tex2Dlod(fxaaConsole360TexExpBiasNegTwo, float4(pos.xy + dir2.zw, 0.0, 0.0));
+/*--------------------------------------------------------------------------*/
+    float4 rgbyA = rgbyN1 + rgbyP1;
+    float4 rgbyB = rgbyN2 + rgbyP2 * 0.5 + rgbyA;
+/*--------------------------------------------------------------------------*/
+    float4 rgbyR = ((rgbyB.w - lumaMax) > 0.0) ? rgbyA : rgbyB;
+    rgbyR = ((rgbyB.w - lumaMin) > 0.0) ? rgbyR : rgbyA;
+    return rgbyR; }
+/*==========================================================================*/
+#endif
+
+
+
+/*============================================================================
+
+         FXAA3 CONSOLE - OPTIMIZED PS3 PIXEL SHADER (NO EARLY EXIT)
+
+==============================================================================
+The code below does not exactly match the assembly.
+I have a feeling that 12 cycles is possible, but was not able to get there.
+Might have to increase register count to get full performance.
+Note this shader does not use perspective interpolation.
+
+Use the following cgc options,
+
+  --fenable-bx2 --fastmath --fastprecision --nofloatbindings
+
+------------------------------------------------------------------------------
+                             NVSHADERPERF OUTPUT
+------------------------------------------------------------------------------
+For reference and to aid in debug, output of NVShaderPerf should match this,
+
+Shader to schedule:
+  0: texpkb h0.w(TRUE), v5.zyxx, #0
+  2: addh h2.z(TRUE), h0.w, constant(0.001953, 0.000000, 0.000000, 0.000000).x
+  4: texpkb h0.w(TRUE), v5.xwxx, #0
+  6: addh h0.z(TRUE), -h2, h0.w
+  7: texpkb h1.w(TRUE), v5, #0
+  9: addh h0.x(TRUE), h0.z, -h1.w
+ 10: addh h3.w(TRUE), h0.z, h1
+ 11: texpkb h2.w(TRUE), v5.zwzz, #0
+ 13: addh h0.z(TRUE), h3.w, -h2.w
+ 14: addh h0.x(TRUE), h2.w, h0
+ 15: nrmh h1.xz(TRUE), h0_n
+ 16: minh_m8 h0.x(TRUE), |h1|, |h1.z|
+ 17: maxh h4.w(TRUE), h0, h1
+ 18: divx h2.xy(TRUE), h1_n.xzzw, h0_n
+ 19: movr r1.zw(TRUE), v4.xxxy
+ 20: madr r2.xz(TRUE), -h1, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zzww, r1.zzww
+ 22: minh h5.w(TRUE), h0, h1
+ 23: texpkb h0(TRUE), r2.xzxx, #0
+ 25: madr r0.zw(TRUE), h1.xzxz, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w), r1
+ 27: maxh h4.x(TRUE), h2.z, h2.w
+ 28: texpkb h1(TRUE), r0.zwzz, #0
+ 30: addh_d2 h1(TRUE), h0, h1
+ 31: madr r0.xy(TRUE), -h2, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz
+ 33: texpkb h0(TRUE), r0, #0
+ 35: minh h4.z(TRUE), h2, h2.w
+ 36: fenct TRUE
+ 37: madr r1.xy(TRUE), h2, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz
+ 39: texpkb h2(TRUE), r1, #0
+ 41: addh_d2 h0(TRUE), h0, h2
+ 42: maxh h2.w(TRUE), h4, h4.x
+ 43: minh h2.x(TRUE), h5.w, h4.z
+ 44: addh_d2 h0(TRUE), h0, h1
+ 45: slth h2.x(TRUE), h0.w, h2
+ 46: sgth h2.w(TRUE), h0, h2
+ 47: movh h0(TRUE), h0
+ 48: addx.c0 rc(TRUE), h2, h2.w
+ 49: movh h0(c0.NE.x), h1
+
+IPU0 ------ Simplified schedule: --------
+Pass |  Unit  |  uOp |  PC:  Op
+-----+--------+------+-------------------------
+   1 | SCT0/1 |  mov |   0:  TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0;
+     |    TEX |  txl |   0:  TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0;
+     |   SCB1 |  add |   2:  ADDh h2.z, h0.--w-, const.--x-;
+     |        |      |
+   2 | SCT0/1 |  mov |   4:  TXLr h0.w, g[TEX1].xwxx, const.xxxx, TEX0;
+     |    TEX |  txl |   4:  TXLr h0.w, g[TEX1].xwxx, const.xxxx, TEX0;
+     |   SCB1 |  add |   6:  ADDh h0.z,-h2, h0.--w-;
+     |        |      |
+   3 | SCT0/1 |  mov |   7:  TXLr h1.w, g[TEX1], const.xxxx, TEX0;
+     |    TEX |  txl |   7:  TXLr h1.w, g[TEX1], const.xxxx, TEX0;
+     |   SCB0 |  add |   9:  ADDh h0.x, h0.z---,-h1.w---;
+     |   SCB1 |  add |  10:  ADDh h3.w, h0.---z, h1;
+     |        |      |
+   4 | SCT0/1 |  mov |  11:  TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0;
+     |    TEX |  txl |  11:  TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0;
+     |   SCB0 |  add |  14:  ADDh h0.x, h2.w---, h0;
+     |   SCB1 |  add |  13:  ADDh h0.z, h3.--w-,-h2.--w-;
+     |        |      |
+   5 |   SCT1 |  mov |  15:  NRMh h1.xz, h0;
+     |    SRB |  nrm |  15:  NRMh h1.xz, h0;
+     |   SCB0 |  min |  16:  MINh*8 h0.x, |h1|, |h1.z---|;
+     |   SCB1 |  max |  17:  MAXh h4.w, h0, h1;
+     |        |      |
+   6 |   SCT0 |  div |  18:  DIVx h2.xy, h1.xz--, h0;
+     |   SCT1 |  mov |  19:  MOVr r1.zw, g[TEX0].--xy;
+     |   SCB0 |  mad |  20:  MADr r2.xz,-h1, const.z-w-, r1.z-w-;
+     |   SCB1 |  min |  22:  MINh h5.w, h0, h1;
+     |        |      |
+   7 | SCT0/1 |  mov |  23:  TXLr h0, r2.xzxx, const.xxxx, TEX0;
+     |    TEX |  txl |  23:  TXLr h0, r2.xzxx, const.xxxx, TEX0;
+     |   SCB0 |  max |  27:  MAXh h4.x, h2.z---, h2.w---;
+     |   SCB1 |  mad |  25:  MADr r0.zw, h1.--xz, const, r1;
+     |        |      |
+   8 | SCT0/1 |  mov |  28:  TXLr h1, r0.zwzz, const.xxxx, TEX0;
+     |    TEX |  txl |  28:  TXLr h1, r0.zwzz, const.xxxx, TEX0;
+     | SCB0/1 |  add |  30:  ADDh/2 h1, h0, h1;
+     |        |      |
+   9 |   SCT0 |  mad |  31:  MADr r0.xy,-h2, const.xy--, r1.zw--;
+     |   SCT1 |  mov |  33:  TXLr h0, r0, const.zzzz, TEX0;
+     |    TEX |  txl |  33:  TXLr h0, r0, const.zzzz, TEX0;
+     |   SCB1 |  min |  35:  MINh h4.z, h2, h2.--w-;
+     |        |      |
+  10 |   SCT0 |  mad |  37:  MADr r1.xy, h2, const.xy--, r1.zw--;
+     |   SCT1 |  mov |  39:  TXLr h2, r1, const.zzzz, TEX0;
+     |    TEX |  txl |  39:  TXLr h2, r1, const.zzzz, TEX0;
+     | SCB0/1 |  add |  41:  ADDh/2 h0, h0, h2;
+     |        |      |
+  11 |   SCT0 |  min |  43:  MINh h2.x, h5.w---, h4.z---;
+     |   SCT1 |  max |  42:  MAXh h2.w, h4, h4.---x;
+     | SCB0/1 |  add |  44:  ADDh/2 h0, h0, h1;
+     |        |      |
+  12 |   SCT0 |  set |  45:  SLTh h2.x, h0.w---, h2;
+     |   SCT1 |  set |  46:  SGTh h2.w, h0, h2;
+     | SCB0/1 |  mul |  47:  MOVh h0, h0;
+     |        |      |
+  13 |   SCT0 |  mad |  48:  ADDxc0_s rc, h2, h2.w---;
+     | SCB0/1 |  mul |  49:  MOVh h0(NE0.xxxx), h1;
+ 
+Pass   SCT  TEX  SCB
+  1:   0% 100%  25%
+  2:   0% 100%  25%
+  3:   0% 100%  50%
+  4:   0% 100%  50%
+  5:   0%   0%  50%
+  6: 100%   0%  75%
+  7:   0% 100%  75%
+  8:   0% 100% 100%
+  9:   0% 100%  25%
+ 10:   0% 100% 100%
+ 11:  50%   0% 100%
+ 12:  50%   0% 100%
+ 13:  25%   0% 100%
+
+MEAN:  17%  61%  67%
+
+Pass   SCT0  SCT1   TEX  SCB0  SCB1
+  1:    0%    0%  100%    0%  100%
+  2:    0%    0%  100%    0%  100%
+  3:    0%    0%  100%  100%  100%
+  4:    0%    0%  100%  100%  100%
+  5:    0%    0%    0%  100%  100%
+  6:  100%  100%    0%  100%  100%
+  7:    0%    0%  100%  100%  100%
+  8:    0%    0%  100%  100%  100%
+  9:    0%    0%  100%    0%  100%
+ 10:    0%    0%  100%  100%  100%
+ 11:  100%  100%    0%  100%  100%
+ 12:  100%  100%    0%  100%  100%
+ 13:  100%    0%    0%  100%  100%
+
+MEAN:   30%   23%   61%   76%  100%
+Fragment Performance Setup: Driver RSX Compiler, GPU RSX, Flags 0x5
+Results 13 cycles, 3 r regs, 923,076,923 pixels/s
+============================================================================*/
+#if (FXAA_PS3 == 1) && (FXAA_EARLY_EXIT == 0)
+/*--------------------------------------------------------------------------*/
+#pragma regcount 7
+#pragma disablepc all
+#pragma option O3
+#pragma option OutColorPrec=fp16
+#pragma texformat default RGBA8
+/*==========================================================================*/
+half4 FxaaPixelShader(
+    // See FXAA Quality FxaaPixelShader() source for docs on Inputs!
+    FxaaFloat2 pos,
+    FxaaFloat4 fxaaConsolePosPos,
+    FxaaTex tex,
+    FxaaTex fxaaConsole360TexExpBiasNegOne,
+    FxaaTex fxaaConsole360TexExpBiasNegTwo,
+    FxaaFloat2 fxaaQualityRcpFrame,
+    FxaaFloat4 fxaaConsoleRcpFrameOpt,
+    FxaaFloat4 fxaaConsoleRcpFrameOpt2,
+    FxaaFloat4 fxaaConsole360RcpFrameOpt2,
+    FxaaFloat fxaaQualitySubpix,
+    FxaaFloat fxaaQualityEdgeThreshold,
+    FxaaFloat fxaaQualityEdgeThresholdMin,
+    FxaaFloat fxaaConsoleEdgeSharpness,
+    FxaaFloat fxaaConsoleEdgeThreshold,
+    FxaaFloat fxaaConsoleEdgeThresholdMin,
+    FxaaFloat4 fxaaConsole360ConstDir
+) {
+/*--------------------------------------------------------------------------*/
+// (1)
+    half4 dir;
+    half4 lumaNe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zy, 0, 0));
+    #if (FXAA_GREEN_AS_LUMA == 0)
+        lumaNe.w += half(1.0/512.0);
+        dir.x = -lumaNe.w;
+        dir.z = -lumaNe.w;
+    #else
+        lumaNe.y += half(1.0/512.0);
+        dir.x = -lumaNe.y;
+        dir.z = -lumaNe.y;
+    #endif
+/*--------------------------------------------------------------------------*/
+// (2)
+    half4 lumaSw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xw, 0, 0));
+    #if (FXAA_GREEN_AS_LUMA == 0)
+        dir.x += lumaSw.w;
+        dir.z += lumaSw.w;
+    #else
+        dir.x += lumaSw.y;
+        dir.z += lumaSw.y;
+    #endif        
+/*--------------------------------------------------------------------------*/
+// (3)
+    half4 lumaNw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xy, 0, 0));
+    #if (FXAA_GREEN_AS_LUMA == 0)
+        dir.x -= lumaNw.w;
+        dir.z += lumaNw.w;
+    #else
+        dir.x -= lumaNw.y;
+        dir.z += lumaNw.y;
+    #endif
+/*--------------------------------------------------------------------------*/
+// (4)
+    half4 lumaSe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zw, 0, 0));
+    #if (FXAA_GREEN_AS_LUMA == 0)
+        dir.x += lumaSe.w;
+        dir.z -= lumaSe.w;
+    #else
+        dir.x += lumaSe.y;
+        dir.z -= lumaSe.y;
+    #endif
+/*--------------------------------------------------------------------------*/
+// (5)
+    half4 dir1_pos;
+    dir1_pos.xy = normalize(dir.xyz).xz;
+    half dirAbsMinTimesC = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__PS3_EDGE_SHARPNESS);
+/*--------------------------------------------------------------------------*/
+// (6)
+    half4 dir2_pos;
+    dir2_pos.xy = clamp(dir1_pos.xy / dirAbsMinTimesC, half(-2.0), half(2.0));
+    dir1_pos.zw = pos.xy;
+    dir2_pos.zw = pos.xy;
+    half4 temp1N;
+    temp1N.xy = dir1_pos.zw - dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw;
+/*--------------------------------------------------------------------------*/
+// (7)
+    temp1N = h4tex2Dlod(tex, half4(temp1N.xy, 0.0, 0.0));
+    half4 rgby1;
+    rgby1.xy = dir1_pos.zw + dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw;
+/*--------------------------------------------------------------------------*/
+// (8)
+    rgby1 = h4tex2Dlod(tex, half4(rgby1.xy, 0.0, 0.0));
+    rgby1 = (temp1N + rgby1) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (9)
+    half4 temp2N;
+    temp2N.xy = dir2_pos.zw - dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw;
+    temp2N = h4tex2Dlod(tex, half4(temp2N.xy, 0.0, 0.0));
+/*--------------------------------------------------------------------------*/
+// (10)
+    half4 rgby2;
+    rgby2.xy = dir2_pos.zw + dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw;
+    rgby2 = h4tex2Dlod(tex, half4(rgby2.xy, 0.0, 0.0));
+    rgby2 = (temp2N + rgby2) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (11)
+    // compilier moves these scalar ops up to other cycles
+    #if (FXAA_GREEN_AS_LUMA == 0)
+        half lumaMin = min(min(lumaNw.w, lumaSw.w), min(lumaNe.w, lumaSe.w));
+        half lumaMax = max(max(lumaNw.w, lumaSw.w), max(lumaNe.w, lumaSe.w));
+    #else
+        half lumaMin = min(min(lumaNw.y, lumaSw.y), min(lumaNe.y, lumaSe.y));
+        half lumaMax = max(max(lumaNw.y, lumaSw.y), max(lumaNe.y, lumaSe.y));
+    #endif        
+    rgby2 = (rgby2 + rgby1) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (12)
+    #if (FXAA_GREEN_AS_LUMA == 0)
+        bool twoTapLt = rgby2.w < lumaMin;
+        bool twoTapGt = rgby2.w > lumaMax;
+    #else
+        bool twoTapLt = rgby2.y < lumaMin;
+        bool twoTapGt = rgby2.y > lumaMax;
+    #endif
+/*--------------------------------------------------------------------------*/
+// (13)
+    if(twoTapLt || twoTapGt) rgby2 = rgby1;
+/*--------------------------------------------------------------------------*/
+    return rgby2; }
+/*==========================================================================*/
+#endif
+
+
+
+/*============================================================================
+
+       FXAA3 CONSOLE - OPTIMIZED PS3 PIXEL SHADER (WITH EARLY EXIT)
+
+==============================================================================
+The code mostly matches the assembly.
+I have a feeling that 14 cycles is possible, but was not able to get there.
+Might have to increase register count to get full performance.
+Note this shader does not use perspective interpolation.
+
+Use the following cgc options,
+
+ --fenable-bx2 --fastmath --fastprecision --nofloatbindings
+
+Use of FXAA_GREEN_AS_LUMA currently adds a cycle (16 clks).
+Will look at fixing this for FXAA 3.12.
+------------------------------------------------------------------------------
+                             NVSHADERPERF OUTPUT
+------------------------------------------------------------------------------
+For reference and to aid in debug, output of NVShaderPerf should match this,
+
+Shader to schedule:
+  0: texpkb h0.w(TRUE), v5.zyxx, #0
+  2: addh h2.y(TRUE), h0.w, constant(0.001953, 0.000000, 0.000000, 0.000000).x
+  4: texpkb h1.w(TRUE), v5.xwxx, #0
+  6: addh h0.x(TRUE), h1.w, -h2.y
+  7: texpkb h2.w(TRUE), v5.zwzz, #0
+  9: minh h4.w(TRUE), h2.y, h2
+ 10: maxh h5.x(TRUE), h2.y, h2.w
+ 11: texpkb h0.w(TRUE), v5, #0
+ 13: addh h3.w(TRUE), -h0, h0.x
+ 14: addh h0.x(TRUE), h0.w, h0
+ 15: addh h0.z(TRUE), -h2.w, h0.x
+ 16: addh h0.x(TRUE), h2.w, h3.w
+ 17: minh h5.y(TRUE), h0.w, h1.w
+ 18: nrmh h2.xz(TRUE), h0_n
+ 19: minh_m8 h2.w(TRUE), |h2.x|, |h2.z|
+ 20: divx h4.xy(TRUE), h2_n.xzzw, h2_n.w
+ 21: movr r1.zw(TRUE), v4.xxxy
+ 22: maxh h2.w(TRUE), h0, h1
+ 23: fenct TRUE
+ 24: madr r0.xy(TRUE), -h2.xzzw, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zwzz, r1.zwzz
+ 26: texpkb h0(TRUE), r0, #0
+ 28: maxh h5.x(TRUE), h2.w, h5
+ 29: minh h5.w(TRUE), h5.y, h4
+ 30: madr r1.xy(TRUE), h2.xzzw, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zwzz, r1.zwzz
+ 32: texpkb h2(TRUE), r1, #0
+ 34: addh_d2 h2(TRUE), h0, h2
+ 35: texpkb h1(TRUE), v4, #0
+ 37: maxh h5.y(TRUE), h5.x, h1.w
+ 38: minh h4.w(TRUE), h1, h5
+ 39: madr r0.xy(TRUE), -h4, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz
+ 41: texpkb h0(TRUE), r0, #0
+ 43: addh_m8 h5.z(TRUE), h5.y, -h4.w
+ 44: madr r2.xy(TRUE), h4, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz
+ 46: texpkb h3(TRUE), r2, #0
+ 48: addh_d2 h0(TRUE), h0, h3
+ 49: addh_d2 h3(TRUE), h0, h2
+ 50: movh h0(TRUE), h3
+ 51: slth h3.x(TRUE), h3.w, h5.w
+ 52: sgth h3.w(TRUE), h3, h5.x
+ 53: addx.c0 rc(TRUE), h3.x, h3
+ 54: slth.c0 rc(TRUE), h5.z, h5
+ 55: movh h0(c0.NE.w), h2
+ 56: movh h0(c0.NE.x), h1
+
+IPU0 ------ Simplified schedule: --------
+Pass |  Unit  |  uOp |  PC:  Op
+-----+--------+------+-------------------------
+   1 | SCT0/1 |  mov |   0:  TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0;
+     |    TEX |  txl |   0:  TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0;
+     |   SCB0 |  add |   2:  ADDh h2.y, h0.-w--, const.-x--;
+     |        |      |
+   2 | SCT0/1 |  mov |   4:  TXLr h1.w, g[TEX1].xwxx, const.xxxx, TEX0;
+     |    TEX |  txl |   4:  TXLr h1.w, g[TEX1].xwxx, const.xxxx, TEX0;
+     |   SCB0 |  add |   6:  ADDh h0.x, h1.w---,-h2.y---;
+     |        |      |
+   3 | SCT0/1 |  mov |   7:  TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0;
+     |    TEX |  txl |   7:  TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0;
+     |   SCB0 |  max |  10:  MAXh h5.x, h2.y---, h2.w---;
+     |   SCB1 |  min |   9:  MINh h4.w, h2.---y, h2;
+     |        |      |
+   4 | SCT0/1 |  mov |  11:  TXLr h0.w, g[TEX1], const.xxxx, TEX0;
+     |    TEX |  txl |  11:  TXLr h0.w, g[TEX1], const.xxxx, TEX0;
+     |   SCB0 |  add |  14:  ADDh h0.x, h0.w---, h0;
+     |   SCB1 |  add |  13:  ADDh h3.w,-h0, h0.---x;
+     |        |      |
+   5 |   SCT0 |  mad |  16:  ADDh h0.x, h2.w---, h3.w---;
+     |   SCT1 |  mad |  15:  ADDh h0.z,-h2.--w-, h0.--x-;
+     |   SCB0 |  min |  17:  MINh h5.y, h0.-w--, h1.-w--;
+     |        |      |
+   6 |   SCT1 |  mov |  18:  NRMh h2.xz, h0;
+     |    SRB |  nrm |  18:  NRMh h2.xz, h0;
+     |   SCB1 |  min |  19:  MINh*8 h2.w, |h2.---x|, |h2.---z|;
+     |        |      |
+   7 |   SCT0 |  div |  20:  DIVx h4.xy, h2.xz--, h2.ww--;
+     |   SCT1 |  mov |  21:  MOVr r1.zw, g[TEX0].--xy;
+     |   SCB1 |  max |  22:  MAXh h2.w, h0, h1;
+     |        |      |
+   8 |   SCT0 |  mad |  24:  MADr r0.xy,-h2.xz--, const.zw--, r1.zw--;
+     |   SCT1 |  mov |  26:  TXLr h0, r0, const.xxxx, TEX0;
+     |    TEX |  txl |  26:  TXLr h0, r0, const.xxxx, TEX0;
+     |   SCB0 |  max |  28:  MAXh h5.x, h2.w---, h5;
+     |   SCB1 |  min |  29:  MINh h5.w, h5.---y, h4;
+     |        |      |
+   9 |   SCT0 |  mad |  30:  MADr r1.xy, h2.xz--, const.zw--, r1.zw--;
+     |   SCT1 |  mov |  32:  TXLr h2, r1, const.xxxx, TEX0;
+     |    TEX |  txl |  32:  TXLr h2, r1, const.xxxx, TEX0;
+     | SCB0/1 |  add |  34:  ADDh/2 h2, h0, h2;
+     |        |      |
+  10 | SCT0/1 |  mov |  35:  TXLr h1, g[TEX0], const.xxxx, TEX0;
+     |    TEX |  txl |  35:  TXLr h1, g[TEX0], const.xxxx, TEX0;
+     |   SCB0 |  max |  37:  MAXh h5.y, h5.-x--, h1.-w--;
+     |   SCB1 |  min |  38:  MINh h4.w, h1, h5;
+     |        |      |
+  11 |   SCT0 |  mad |  39:  MADr r0.xy,-h4, const.xy--, r1.zw--;
+     |   SCT1 |  mov |  41:  TXLr h0, r0, const.zzzz, TEX0;
+     |    TEX |  txl |  41:  TXLr h0, r0, const.zzzz, TEX0;
+     |   SCB0 |  mad |  44:  MADr r2.xy, h4, const.xy--, r1.zw--;
+     |   SCB1 |  add |  43:  ADDh*8 h5.z, h5.--y-,-h4.--w-;
+     |        |      |
+  12 | SCT0/1 |  mov |  46:  TXLr h3, r2, const.xxxx, TEX0;
+     |    TEX |  txl |  46:  TXLr h3, r2, const.xxxx, TEX0;
+     | SCB0/1 |  add |  48:  ADDh/2 h0, h0, h3;
+     |        |      |
+  13 | SCT0/1 |  mad |  49:  ADDh/2 h3, h0, h2;
+     | SCB0/1 |  mul |  50:  MOVh h0, h3;
+     |        |      |
+  14 |   SCT0 |  set |  51:  SLTh h3.x, h3.w---, h5.w---;
+     |   SCT1 |  set |  52:  SGTh h3.w, h3, h5.---x;
+     |   SCB0 |  set |  54:  SLThc0 rc, h5.z---, h5;
+     |   SCB1 |  add |  53:  ADDxc0_s rc, h3.---x, h3;
+     |        |      |
+  15 | SCT0/1 |  mul |  55:  MOVh h0(NE0.wwww), h2;
+     | SCB0/1 |  mul |  56:  MOVh h0(NE0.xxxx), h1;
+ 
+Pass   SCT  TEX  SCB
+  1:   0% 100%  25%
+  2:   0% 100%  25%
+  3:   0% 100%  50%
+  4:   0% 100%  50%
+  5:  50%   0%  25%
+  6:   0%   0%  25%
+  7: 100%   0%  25%
+  8:   0% 100%  50%
+  9:   0% 100% 100%
+ 10:   0% 100%  50%
+ 11:   0% 100%  75%
+ 12:   0% 100% 100%
+ 13: 100%   0% 100%
+ 14:  50%   0%  50%
+ 15: 100%   0% 100%
+
+MEAN:  26%  60%  56%
+
+Pass   SCT0  SCT1   TEX  SCB0  SCB1
+  1:    0%    0%  100%  100%    0%
+  2:    0%    0%  100%  100%    0%
+  3:    0%    0%  100%  100%  100%
+  4:    0%    0%  100%  100%  100%
+  5:  100%  100%    0%  100%    0%
+  6:    0%    0%    0%    0%  100%
+  7:  100%  100%    0%    0%  100%
+  8:    0%    0%  100%  100%  100%
+  9:    0%    0%  100%  100%  100%
+ 10:    0%    0%  100%  100%  100%
+ 11:    0%    0%  100%  100%  100%
+ 12:    0%    0%  100%  100%  100%
+ 13:  100%  100%    0%  100%  100%
+ 14:  100%  100%    0%  100%  100%
+ 15:  100%  100%    0%  100%  100%
+
+MEAN:   33%   33%   60%   86%   80%
+Fragment Performance Setup: Driver RSX Compiler, GPU RSX, Flags 0x5
+Results 15 cycles, 3 r regs, 800,000,000 pixels/s
+============================================================================*/
+#if (FXAA_PS3 == 1) && (FXAA_EARLY_EXIT == 1)
+/*--------------------------------------------------------------------------*/
+#pragma regcount 7
+#pragma disablepc all
+#pragma option O2
+#pragma option OutColorPrec=fp16
+#pragma texformat default RGBA8
+/*==========================================================================*/
+half4 FxaaPixelShader(
+    // See FXAA Quality FxaaPixelShader() source for docs on Inputs!
+    FxaaFloat2 pos,
+    FxaaFloat4 fxaaConsolePosPos,
+    FxaaTex tex,
+    FxaaTex fxaaConsole360TexExpBiasNegOne,
+    FxaaTex fxaaConsole360TexExpBiasNegTwo,
+    FxaaFloat2 fxaaQualityRcpFrame,
+    FxaaFloat4 fxaaConsoleRcpFrameOpt,
+    FxaaFloat4 fxaaConsoleRcpFrameOpt2,
+    FxaaFloat4 fxaaConsole360RcpFrameOpt2,
+    FxaaFloat fxaaQualitySubpix,
+    FxaaFloat fxaaQualityEdgeThreshold,
+    FxaaFloat fxaaQualityEdgeThresholdMin,
+    FxaaFloat fxaaConsoleEdgeSharpness,
+    FxaaFloat fxaaConsoleEdgeThreshold,
+    FxaaFloat fxaaConsoleEdgeThresholdMin,
+    FxaaFloat4 fxaaConsole360ConstDir
+) {
+/*--------------------------------------------------------------------------*/
+// (1)
+    half4 rgbyNe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zy, 0, 0));
+    #if (FXAA_GREEN_AS_LUMA == 0)
+        half lumaNe = rgbyNe.w + half(1.0/512.0);
+    #else
+        half lumaNe = rgbyNe.y + half(1.0/512.0);
+    #endif
+/*--------------------------------------------------------------------------*/
+// (2)
+    half4 lumaSw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xw, 0, 0));
+    #if (FXAA_GREEN_AS_LUMA == 0)
+        half lumaSwNegNe = lumaSw.w - lumaNe;
+    #else
+        half lumaSwNegNe = lumaSw.y - lumaNe;
+    #endif
+/*--------------------------------------------------------------------------*/
+// (3)
+    half4 lumaNw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xy, 0, 0));
+    #if (FXAA_GREEN_AS_LUMA == 0)
+        half lumaMaxNwSw = max(lumaNw.w, lumaSw.w);
+        half lumaMinNwSw = min(lumaNw.w, lumaSw.w);
+    #else
+        half lumaMaxNwSw = max(lumaNw.y, lumaSw.y);
+        half lumaMinNwSw = min(lumaNw.y, lumaSw.y);
+    #endif
+/*--------------------------------------------------------------------------*/
+// (4)
+    half4 lumaSe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zw, 0, 0));
+    #if (FXAA_GREEN_AS_LUMA == 0)
+        half dirZ =  lumaNw.w + lumaSwNegNe;
+        half dirX = -lumaNw.w + lumaSwNegNe;
+    #else
+        half dirZ =  lumaNw.y + lumaSwNegNe;
+        half dirX = -lumaNw.y + lumaSwNegNe;
+    #endif
+/*--------------------------------------------------------------------------*/
+// (5)
+    half3 dir;
+    dir.y = 0.0;
+    #if (FXAA_GREEN_AS_LUMA == 0)
+        dir.x =  lumaSe.w + dirX;
+        dir.z = -lumaSe.w + dirZ;
+        half lumaMinNeSe = min(lumaNe, lumaSe.w);
+    #else
+        dir.x =  lumaSe.y + dirX;
+        dir.z = -lumaSe.y + dirZ;
+        half lumaMinNeSe = min(lumaNe, lumaSe.y);
+    #endif
+/*--------------------------------------------------------------------------*/
+// (6)
+    half4 dir1_pos;
+    dir1_pos.xy = normalize(dir).xz;
+    half dirAbsMinTimes8 = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__PS3_EDGE_SHARPNESS);
+/*--------------------------------------------------------------------------*/
+// (7)
+    half4 dir2_pos;
+    dir2_pos.xy = clamp(dir1_pos.xy / dirAbsMinTimes8, half(-2.0), half(2.0));
+    dir1_pos.zw = pos.xy;
+    dir2_pos.zw = pos.xy;
+    #if (FXAA_GREEN_AS_LUMA == 0)
+        half lumaMaxNeSe = max(lumaNe, lumaSe.w);
+    #else
+        half lumaMaxNeSe = max(lumaNe, lumaSe.y);
+    #endif
+/*--------------------------------------------------------------------------*/
+// (8)
+    half4 temp1N;
+    temp1N.xy = dir1_pos.zw - dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw;
+    temp1N = h4tex2Dlod(tex, half4(temp1N.xy, 0.0, 0.0));
+    half lumaMax = max(lumaMaxNwSw, lumaMaxNeSe);
+    half lumaMin = min(lumaMinNwSw, lumaMinNeSe);
+/*--------------------------------------------------------------------------*/
+// (9)
+    half4 rgby1;
+    rgby1.xy = dir1_pos.zw + dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw;
+    rgby1 = h4tex2Dlod(tex, half4(rgby1.xy, 0.0, 0.0));
+    rgby1 = (temp1N + rgby1) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (10)
+    half4 rgbyM = h4tex2Dlod(tex, half4(pos.xy, 0.0, 0.0));
+    #if (FXAA_GREEN_AS_LUMA == 0)
+        half lumaMaxM = max(lumaMax, rgbyM.w);
+        half lumaMinM = min(lumaMin, rgbyM.w);
+    #else
+        half lumaMaxM = max(lumaMax, rgbyM.y);
+        half lumaMinM = min(lumaMin, rgbyM.y);
+    #endif
+/*--------------------------------------------------------------------------*/
+// (11)
+    half4 temp2N;
+    temp2N.xy = dir2_pos.zw - dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw;
+    temp2N = h4tex2Dlod(tex, half4(temp2N.xy, 0.0, 0.0));
+    half4 rgby2;
+    rgby2.xy = dir2_pos.zw + dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw;
+    half lumaRangeM = (lumaMaxM - lumaMinM) / FXAA_CONSOLE__PS3_EDGE_THRESHOLD;
+/*--------------------------------------------------------------------------*/
+// (12)
+    rgby2 = h4tex2Dlod(tex, half4(rgby2.xy, 0.0, 0.0));
+    rgby2 = (temp2N + rgby2) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (13)
+    rgby2 = (rgby2 + rgby1) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (14)
+    #if (FXAA_GREEN_AS_LUMA == 0)
+        bool twoTapLt = rgby2.w < lumaMin;
+        bool twoTapGt = rgby2.w > lumaMax;
+    #else
+        bool twoTapLt = rgby2.y < lumaMin;
+        bool twoTapGt = rgby2.y > lumaMax;
+    #endif
+    bool earlyExit = lumaRangeM < lumaMax;
+    bool twoTap = twoTapLt || twoTapGt;
+/*--------------------------------------------------------------------------*/
+// (15)
+    if(twoTap) rgby2 = rgby1;
+    if(earlyExit) rgby2 = rgbyM;
+/*--------------------------------------------------------------------------*/
+    return rgby2; }
+/*==========================================================================*/
+#endif
+
+uniform sampler2D diffuseMap;
+
+uniform vec2 rcp_screen_res;
+uniform vec4 rcp_frame_opt;
+uniform vec4 rcp_frame_opt2;
+uniform vec2 screen_res;
+VARYING vec2 vary_fragcoord;
+VARYING vec2 vary_tc;
+
+void main() 
+{
+	vec4 diff =			FxaaPixelShader(vary_tc,			//pos
+										vec4(vary_fragcoord.xy, 0, 0), //fxaaConsolePosPos
+										diffuseMap,					//tex
+										diffuseMap,					
+										diffuseMap,
+										rcp_screen_res,				//fxaaQualityRcpFrame
+										vec4(0,0,0,0),				//fxaaConsoleRcpFrameOpt
+										rcp_frame_opt,				//fxaaConsoleRcpFrameOpt2
+										rcp_frame_opt2,				//fxaaConsole360RcpFrameOpt2
+										0.75,						//fxaaQualitySubpix
+										0.07,						//fxaaQualityEdgeThreshold
+										0.03,						//fxaaQualityEdgeThresholdMin
+										8.0,						//fxaaConsoleEdgeSharpness
+										0.125,						//fxaaConsoleEdgeThreshold
+										0.05,						//fxaaConsoleEdgeThresholdMin
+										vec4(0,0,0,0));				//fxaaConsole360ConstDir
+
+
+
+	//diff = texture2D(diffuseMap, vary_tc);
+	
+	frag_color = diff;
+	
+}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/giF.glsl b/indra/newview/app_settings/shaders/class1/deferred/giF.glsl
index bfb7760af827752ac6ef6a9563266f04ab8bdbe1..da1b234240007d2ecce4330ab4173a617f66687f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/giF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/giF.glsl
@@ -23,10 +23,14 @@
  * $/LicenseInfo$
  */
  
-
-
 #extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform sampler2DRect depthMap;
 uniform sampler2DRect normalMap;
 uniform sampler2D noiseMap;
@@ -38,7 +42,7 @@ uniform sampler2D		depthGIMap;
 uniform sampler2D		lightFunc;
 
 // Inputs
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 uniform vec2 screen_res;
 
@@ -182,5 +186,5 @@ void main()
 	vec3 norm = texture2DRect(normalMap, pos_screen).xyz;
 	norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
 	
-	gl_FragData[0].xyz = giAmbient(pos, norm);
+	frag_color.xyz = giAmbient(pos, norm);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
index 7152e13946f45d405b670be78bc50f25d961428c..bc0719cb82de9a8537dc4963fbb4b74175dca768 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
@@ -22,25 +22,32 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_data[3];
+#else
+#define frag_data gl_FragData
+#endif
+
 uniform float minimum_alpha;
-uniform float maximum_alpha;
 
 
 uniform sampler2D diffuseMap;
 uniform sampler2D normalMap;
 uniform sampler2D specularMap;
 
+VARYING vec2 vary_texcoord0;
+
 void main() 
 {
-	vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy);
+	vec4 col = texture2D(diffuseMap, vary_texcoord0.xy);
 
-	if (col.a < minimum_alpha || col.a > maximum_alpha)
+	if (col.a < minimum_alpha)
 	{
 		discard;
 	}
 
-	gl_FragData[0] = vec4(col.rgb, col.a * 0.005);
-	gl_FragData[1] = texture2D(specularMap, gl_TexCoord[0].xy);
-	gl_FragData[2] = vec4(texture2D(normalMap, gl_TexCoord[0].xy).xyz, 0.0);
+	frag_data[0] = vec4(col.rgb, col.a * 0.005);
+	frag_data[1] = texture2D(specularMap, vary_texcoord0.xy);
+	frag_data[2] = vec4(texture2D(normalMap, vary_texcoord0.xy).xyz, 0.0);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl
index 0cf8c6817395e90ff5c7c800dd34e52ebad34718..42266e9378e12dcca9ae0138eacfa267e9ff41e3 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl
@@ -22,14 +22,18 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform(); 
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-	
-	gl_FrontColor = gl_Color;
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); 
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl
index 4ba26fb0c6e38a34618112a26ed9d3e5753b4d51..dcf474824dab414bc5e36506e35f85369265a7d4 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl
@@ -22,14 +22,18 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
-
-
-
+ 
 uniform sampler2DRect diffuseMap;
 
-varying vec2 vary_fragcoord;
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+VARYING vec2 vary_fragcoord;
 
 void main() 
 {
-	gl_FragColor = texture2DRect(diffuseMap, vary_fragcoord.xy);
+	frag_color = texture2DRect(diffuseMap, vary_fragcoord.xy);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl
index 9f22175f8402a546e2c07fe48e685ef982d4edbe..f2dc60aa5d2327ec00442d0bb17f951d06601635 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl
@@ -23,19 +23,23 @@
  * $/LicenseInfo$
  */
 
+uniform mat4 modelview_projection_matrix;
+ 
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
 
-
-
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
+VARYING vec4 vertex_color;
 
 uniform vec2 screen_res;
 
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform(); 
-	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	gl_Position = pos;
+	
 	vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;	
 
-	gl_FrontColor = gl_Color;
+	vertex_color = diffuse_color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
index 42212a978ea4f94f9f1f3fe3f7952fd25207cf54..4d01eeb64e581f09f23b19fa97722643e075d8fd 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
@@ -23,10 +23,14 @@
  * $/LicenseInfo$
  */
 
-
-
 #extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform sampler2DRect depthMap;
 uniform sampler2DRect diffuseRect;
 uniform sampler2DRect specularRect;
@@ -45,7 +49,7 @@ uniform int light_count;
 uniform vec4 light[MAX_LIGHT_COUNT];
 uniform vec4 light_col[MAX_LIGHT_COUNT];
 
-varying vec4 vary_fragcoord;
+VARYING vec4 vary_fragcoord;
 uniform vec2 screen_res;
 
 uniform float far_z;
@@ -124,7 +128,7 @@ void main()
 				
 				if (sa > 0.0)
 				{
-					sa = texture2D(lightFunc,vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0);
+					sa = 6 * texture2D(lightFunc, vec2(sa, spec.a)).r * min(dist_atten*4.0, 1.0);
 					sa *= noise;
 					col += da*sa*light_col[i].rgb*spec.rgb;
 				}
@@ -139,8 +143,6 @@ void main()
 		discard;
 	}
 	
-	gl_FragColor.rgb = out_col;
-	gl_FragColor.a = 0.0;
-	
-	//gl_FragColor = vec4(0.1, 0.025, 0.025/4.0, 0.0);
+	frag_color.rgb = out_col;
+	frag_color.a = 0.0;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl
deleted file mode 100644
index 863bac19cfacc6ae1df4e85293cd792affa85ca9..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl
+++ /dev/null
@@ -1,155 +0,0 @@
-/** 
- * @file multiPointLightF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-uniform sampler2DMS depthMap;
-uniform sampler2DMS diffuseRect;
-uniform sampler2DMS specularRect;
-uniform sampler2DMS normalMap;
-uniform sampler2D noiseMap;
-uniform sampler2D lightFunc;
-
-
-uniform vec3 env_mat[3];
-uniform float sun_wash;
-
-uniform int light_count;
-
-#define MAX_LIGHT_COUNT		16
-uniform vec4 light[MAX_LIGHT_COUNT];
-uniform vec4 light_col[MAX_LIGHT_COUNT];
-
-varying vec4 vary_fragcoord;
-uniform vec2 screen_res;
-
-uniform float far_z;
-
-uniform mat4 inv_proj;
-
-vec4 getPosition(ivec2 pos_screen, int sample)
-{
-	float depth = texelFetch(depthMap, pos_screen, sample).r;
-	vec2 sc = vec2(pos_screen.xy)*2.0;
-	sc /= screen_res;
-	sc -= vec2(1.0,1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
-void main() 
-{
-	vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res;
-	ivec2 itc = ivec2(frag);
-
-	int wght = 0;
-	vec3 fcol = vec3(0,0,0);
-
-	for (int s = 0; s < samples; ++s)
-	{
-		vec3 pos = getPosition(itc, s).xyz;
-		if (pos.z >= far_z)
-		{
-			vec3 norm = texelFetch(normalMap, itc, s).xyz;
-			norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
-			norm = normalize(norm);
-			vec4 spec = texelFetch(specularRect, itc, s);
-			vec3 diff = texelFetch(diffuseRect, itc, s).rgb;
-			float noise = texture2D(noiseMap, frag.xy/128.0).b;
-			vec3 out_col = vec3(0,0,0);
-			vec3 npos = normalize(-pos);
-
-			// As of OSX 10.6.7 ATI Apple's crash when using a variable size loop
-			for (int i = 0; i < MAX_LIGHT_COUNT; ++i)
-			{
-				bool light_contrib = (i < light_count);
-		
-				vec3 lv = light[i].xyz-pos;
-				float dist2 = dot(lv,lv);
-				dist2 /= light[i].w;
-				if (dist2 > 1.0)
-				{
-					light_contrib = false;
-				}
-		
-				float da = dot(norm, lv);
-				if (da < 0.0)
-				{
-					light_contrib = false;
-				}
-		
-				if (light_contrib)
-				{
-					lv = normalize(lv);
-					da = dot(norm, lv);
-					
-					float fa = light_col[i].a+1.0;
-					float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
-					dist_atten *= noise;
-
-					float lit = da * dist_atten;
-			
-					vec3 col = light_col[i].rgb*lit*diff;
-					//vec3 col = vec3(dist2, light_col[i].a, lit);
-			
-					if (spec.a > 0.0)
-					{
-						//vec3 ref = dot(pos+lv, norm);
-				
-						float sa = dot(normalize(lv+npos),norm);
-				
-						if (sa > 0.0)
-						{
-							sa = texture2D(lightFunc,vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0);
-							sa *= noise;
-							col += da*sa*light_col[i].rgb*spec.rgb;
-						}
-					}
-			
-					out_col += col;
-				}
-			}
-	
-			fcol += out_col;
-			++wght;
-		}
-	}
-
-	if (wght <= 0)
-	{
-		discard;
-	}
-
-	gl_FragColor.rgb = fcol/samples;
-	gl_FragColor.a = 0.0;
-
-	
-}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl
index 1362a48daf47df6652151526936ff46bfc59ca6d..eefefa640de101a326a82d83bf5068aa8d41dc2f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl
@@ -23,16 +23,17 @@
  * $/LicenseInfo$
  */
 
+uniform mat4 modelview_projection_matrix;
 
+ATTRIBUTE vec3 position;
 
-varying vec4 vary_fragcoord;
+VARYING vec4 vary_fragcoord;
 
 void main()
 {
 	//transform vertex
-	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
 	vary_fragcoord = pos;
 
 	gl_Position = pos;
-	gl_FrontColor = gl_Color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
index 85b0ce5beb18cb92e3471434903ca6a07a72aeb5..75de47614cfadb6547351436aacab2e917a56609 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
@@ -23,7 +23,11 @@
  * $/LicenseInfo$
  */
 
-
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
 //class 1 -- no shadows
 
@@ -35,7 +39,6 @@ uniform sampler2DRect depthMap;
 uniform sampler2DRect normalMap;
 uniform samplerCube environmentMap;
 uniform sampler2D noiseMap;
-uniform sampler2D lightFunc;
 uniform sampler2D projectionMap;
 
 uniform mat4 proj_mat; //screen space to light space
@@ -55,9 +58,12 @@ uniform float sun_wash;
 uniform int proj_shadow_idx;
 uniform float shadow_fade;
 
-varying vec4 vary_light;
+uniform vec3 center;
+uniform vec3 color;
+uniform float falloff;
+uniform float size;
 
-varying vec4 vary_fragcoord;
+VARYING vec4 vary_fragcoord;
 uniform vec2 screen_res;
 
 uniform mat4 inv_proj;
@@ -110,7 +116,7 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
 
 vec4 getPosition(vec2 pos_screen)
 {
-	float depth = texture2DRect(depthMap, pos_screen.xy).a;
+	float depth = texture2DRect(depthMap, pos_screen.xy).r;
 	vec2 sc = pos_screen.xy*2.0;
 	sc /= screen_res;
 	sc -= vec2(1.0,1.0);
@@ -129,9 +135,9 @@ void main()
 	frag.xy *= screen_res;
 	
 	vec3 pos = getPosition(frag.xy).xyz;
-	vec3 lv = vary_light.xyz-pos.xyz;
+	vec3 lv = center.xyz-pos.xyz;
 	float dist2 = dot(lv,lv);
-	dist2 /= vary_light.w;
+	dist2 /= size;
 	if (dist2 > 1.0)
 	{
 		discard;
@@ -150,7 +156,7 @@ void main()
 	
 	proj_tc.xyz /= proj_tc.w;
 	
-	float fa = gl_Color.a+1.0;
+	float fa = falloff+1.0;
 	float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
 	if (dist_atten <= 0.0)
 	{
@@ -182,7 +188,7 @@ void main()
 			
 			vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod);
 		
-			vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
+			vec3 lcol = color.rgb * plcol.rgb * plcol.a;
 			
 			lit = da * dist_atten * noise;
 			
@@ -199,7 +205,7 @@ void main()
 			
 		amb_da = min(amb_da, 1.0-lit);
 			
-		col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
+		col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
 	}
 	
 	
@@ -232,12 +238,12 @@ void main()
 					stc.y > 0.0)
 				{
 					vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
-					col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb;
+					col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb;
 				}
 			}
 		}
 	}
 	
-	gl_FragColor.rgb = col;	
-	gl_FragColor.a = 0.0;
+	frag_color.rgb = col;	
+	frag_color.a = 0.0;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl
deleted file mode 100644
index 10285817c213c20662f3819c9f64b28c4daef2d1..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl
+++ /dev/null
@@ -1,250 +0,0 @@
-/** 
- * @file multiSpotLightF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-
-
-//class 1 -- no shadows
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-uniform sampler2DMS diffuseRect;
-uniform sampler2DMS specularRect;
-uniform sampler2DMS depthMap;
-uniform sampler2DMS normalMap;
-uniform sampler2D noiseMap;
-uniform sampler2D lightFunc;
-uniform sampler2D projectionMap;
-
-uniform mat4 proj_mat; //screen space to light space
-uniform float proj_near; //near clip for projection
-uniform vec3 proj_p; //plane projection is emitting from (in screen space)
-uniform vec3 proj_n;
-uniform float proj_focus; //distance from plane to begin blurring
-uniform float proj_lod;  //(number of mips in proj map)
-uniform float proj_range; //range between near clip and far clip plane of projection
-uniform float proj_ambient_lod;
-uniform float proj_ambiance;
-uniform float near_clip;
-uniform float far_clip;
-
-uniform vec3 proj_origin; //origin of projection to be used for angular attenuation
-uniform float sun_wash;
-uniform float shadow_fade;
-
-varying vec4 vary_light;
-
-varying vec4 vary_fragcoord;
-uniform vec2 screen_res;
-
-uniform mat4 inv_proj;
-
-vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
-{
-	vec4 ret = texture2DLod(projectionMap, tc, lod);
-	
-	vec2 dist = tc-vec2(0.5);
-	
-	float det = max(1.0-lod/(proj_lod*0.5), 0.0);
-	
-	float d = dot(dist,dist);
-		
-	ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0);
-	
-	return ret;
-}
-
-vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
-{
-	vec4 ret = texture2DLod(projectionMap, tc, lod);
-	
-	vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
-	
-	float det = min(lod/(proj_lod*0.5), 1.0);
-	
-	float d = min(dist.x, dist.y);
-	
-	float edge = 0.25*det;
-		
-	ret *= clamp(d/edge, 0.0, 1.0);
-	
-	return ret;
-}
-
-vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
-{
-	vec4 ret = texture2DLod(projectionMap, tc, lod);
-	
-	vec2 dist = tc-vec2(0.5);
-	
-	float d = dot(dist,dist);
-		
-	ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0);
-	
-	return ret;
-}
-
-
-vec4 getPosition(ivec2 pos_screen, int sample)
-{
-	float depth = texelFetch(depthMap, pos_screen, sample).r;
-	vec2 sc = vec2(pos_screen.xy)*2.0;
-	sc /= screen_res;
-	sc -= vec2(1.0,1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
-void main() 
-{
-	int wght = 0;
-
-	vec3 fcol = vec3(0,0,0);
-
-	vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res;
-	
-	ivec2 itc = ivec2(frag.xy);
-
-	for (int i = 0; i < samples; ++i)
-	{
-		vec3 pos = getPosition(itc, i).xyz;
-		vec3 lv = vary_light.xyz-pos.xyz;
-		float dist2 = dot(lv,lv);
-		dist2 /= vary_light.w;
-		if (dist2 <= 1.0)
-		{
-			vec3 norm = texelFetch(normalMap, itc, i).xyz*2.0-1.0;
-	
-			norm = normalize(norm);
-			float l_dist = -dot(lv, proj_n);
-	
-			vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0));
-			if (proj_tc.z >= 0.0)
-			{
-				proj_tc.xyz /= proj_tc.w;
-	
-				float fa = gl_Color.a+1.0;
-				float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
-				if (dist_atten > 0.0)
-				{
-					lv = proj_origin-pos.xyz;
-					lv = normalize(lv);
-					float da = dot(norm, lv);
-		
-					vec3 col = vec3(0,0,0);
-		
-					vec3 diff_tex = texelFetch(diffuseRect, itc, i).rgb;
-		
-					float noise = texture2D(noiseMap, frag.xy/128.0).b;
-					if (proj_tc.z > 0.0 &&
-						proj_tc.x < 1.0 &&
-						proj_tc.y < 1.0 &&
-						proj_tc.x > 0.0 &&
-						proj_tc.y > 0.0)
-					{
-						float lit = 0.0;
-						float amb_da = proj_ambiance;
-		
-						if (da > 0.0)
-						{
-							float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0);
-							float lod = diff * proj_lod;
-			
-							vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod);
-		
-							vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
-			
-							lit = da * dist_atten * noise;
-			
-							col = lcol*lit*diff_tex;
-							amb_da += (da*0.5)*proj_ambiance;
-						}
-		
-						//float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0);
-						vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod);
-							
-						amb_da += (da*da*0.5+0.5)*proj_ambiance;
-				
-						amb_da *= dist_atten * noise;
-			
-						amb_da = min(amb_da, 1.0-lit);
-			
-						col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
-					}
-	
-	
-					vec4 spec = texelFetch(specularRect, itc, i);
-					if (spec.a > 0.0)
-					{
-						vec3 ref = reflect(normalize(pos), norm);
-		
-						//project from point pos in direction ref to plane proj_p, proj_n
-						vec3 pdelta = proj_p-pos;
-						float ds = dot(ref, proj_n);
-		
-						if (ds < 0.0)
-						{
-							vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds;
-			
-							vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0));
-
-							if (stc.z > 0.0)
-							{
-								stc.xy /= stc.w;
-
-								float fatten = clamp(spec.a*spec.a+spec.a*0.5, 0.25, 1.0);
-				
-								stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
-								
-								if (stc.x < 1.0 &&
-									stc.y < 1.0 &&
-									stc.x > 0.0 &&
-									stc.y > 0.0)
-								{
-									vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
-									col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb;
-								}
-							}
-						}
-					}
-	
-					fcol += col;
-					++wght;
-				}
-			}
-		}
-	}
-
-	if (wght <= 0)
-	{
-		discard;
-	}
-
-	gl_FragColor.rgb = fcol/samples;	
-	gl_FragColor.a = 0.0;
-}
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl
similarity index 53%
rename from indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl
rename to indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl
index c2cc8ed5677a096dc946bb4e76434e1e9eb86195..62cfa5c3167fb9bdd65611d8796e6d76bd7336fa 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl
@@ -1,5 +1,5 @@
 /** 
- * @file glowExtractF.glsl
+ * @file normgenF.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -23,34 +23,36 @@
  * $/LicenseInfo$
  */
  
+#extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
+uniform sampler2D alphaMap;
 
-uniform sampler2DMS diffuseMap;
-uniform float minLuminance;
-uniform float maxExtractAlpha;
-uniform vec3 lumWeights;
-uniform vec3 warmthWeights;
-uniform float warmthAmount;
+VARYING vec2 vary_texcoord0;
+
+uniform float stepX;
+uniform float stepY;
+uniform float norm_scale;
 
 void main()
 {
-	ivec2 itc = ivec2(gl_TexCoord[0].xy);
-	vec4 fcol = vec4(0,0,0,0);
-
-	for (int i = 0; i < samples; i++)
-	{
-		vec4 col = texelFetch(diffuseMap, itc, i);	
+	float alpha = texture2D(alphaMap, vary_texcoord0).a;
 
-		/// CALCULATING LUMINANCE (Using NTSC lum weights)
-		/// http://en.wikipedia.org/wiki/Luma_%28video%29
-		float lum = smoothstep(minLuminance, minLuminance+1.0, dot(col.rgb, lumWeights ) );
-		float warmth = smoothstep(minLuminance, minLuminance+1.0, max(col.r * warmthWeights.r, max(col.g * warmthWeights.g, col.b * warmthWeights.b)) ); 
+	vec3 right = vec3(norm_scale, 0, (texture2D(alphaMap, vary_texcoord0+vec2(stepX, 0)).a-alpha)*255);
+	vec3 left = vec3(-norm_scale, 0, (texture2D(alphaMap, vary_texcoord0-vec2(stepX, 0)).a-alpha)*255);
+	vec3 up = vec3(0, -norm_scale, (texture2D(alphaMap, vary_texcoord0-vec2(0, stepY)).a-alpha)*255);
+	vec3 down = vec3(0, norm_scale, (texture2D(alphaMap, vary_texcoord0+vec2(0, stepY)).a-alpha)*255);
 	
-		fcol += vec4(col.rgb, max(col.a, mix(lum, warmth, warmthAmount) * maxExtractAlpha));
-	}
-
-	gl_FragColor = fcol/samples;
+	vec3 norm = cross(right, down) + cross(down, left) + cross(left,up) + cross(up, right);
+	
+	norm = normalize(norm);
+	norm *= 0.5;
+	norm += 0.5;	
+	
+	frag_color = vec4(norm, alpha);
 }
diff --git a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl b/indra/newview/app_settings/shaders/class1/deferred/normgenV.glsl
similarity index 80%
rename from indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl
rename to indra/newview/app_settings/shaders/class1/deferred/normgenV.glsl
index 6231ee68b75c69b50b1cbd480d448b468fd89833..9bceae05b71d05783930f7264aa3a13cc7093bab 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/normgenV.glsl
@@ -1,5 +1,5 @@
 /** 
- * @file postgiV.glsl
+ * @file normgenV.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -23,15 +23,14 @@
  * $/LicenseInfo$
  */
  
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
 
-
-varying vec2 vary_fragcoord;
-uniform vec2 screen_res;
+VARYING vec2 vary_fragcoord;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
-	//transform vertex
-	gl_Position = ftransform(); 
-	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
-	vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
+	gl_Position = vec4(position.x*2.0-1.0, position.y*2.0-1.0, -1.0, 1.0); 
+	vary_texcoord0 = texcoord0;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
index 0771f9b91a975954a8864f91b33fd67ad7065a8a..19800a8b8e16be7369e3c23376124c79dd45c2b2 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
@@ -23,10 +23,14 @@
  * $/LicenseInfo$
  */
  
- 
-
 #extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform sampler2DRect diffuseRect;
 uniform sampler2DRect specularRect;
 uniform sampler2DRect normalMap;
@@ -38,9 +42,12 @@ uniform sampler2DRect depthMap;
 uniform vec3 env_mat[3];
 uniform float sun_wash;
 
-varying vec4 vary_light;
+uniform vec3 center;
+uniform vec3 color;
+uniform float falloff;
+uniform float size;
 
-varying vec4 vary_fragcoord;
+VARYING vec4 vary_fragcoord;
 uniform vec2 screen_res;
 
 uniform mat4 inv_proj;
@@ -67,9 +74,9 @@ void main()
 	frag.xy *= screen_res;
 	
 	vec3 pos = getPosition(frag.xy).xyz;
-	vec3 lv = vary_light.xyz-pos;
+	vec3 lv = center.xyz-pos;
 	float dist2 = dot(lv,lv);
-	dist2 /= vary_light.w;
+	dist2 /= size;
 	if (dist2 > 1.0)
 	{
 		discard;
@@ -90,11 +97,11 @@ void main()
 	float noise = texture2D(noiseMap, frag.xy/128.0).b;
 	
 	vec3 col = texture2DRect(diffuseRect, frag.xy).rgb;
-	float fa = gl_Color.a+1.0;
+	float fa = falloff+1.0;
 	float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
 	float lit = da * dist_atten * noise;
 	
-	col = gl_Color.rgb*lit*col;
+	col = color.rgb*lit*col;
 
 	vec4 spec = texture2DRect(specularRect, frag.xy);
 	if (spec.a > 0.0)
@@ -102,9 +109,9 @@ void main()
 		float sa = dot(normalize(lv-normalize(pos)),norm);
 		if (sa > 0.0)
 		{
-			sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0);
+			sa = 6 * texture2D(lightFunc, vec2(sa, spec.a)).r * min(dist_atten*4.0, 1.0);
 			sa *= noise;
-			col += da*sa*gl_Color.rgb*spec.rgb;
+			col += da*sa*color.rgb*spec.rgb;
 		}
 	}
 	
@@ -113,6 +120,6 @@ void main()
 		discard;
 	}
 		
-	gl_FragColor.rgb = col;	
-	gl_FragColor.a = 0.0;
+	frag_color.rgb = col;	
+	frag_color.a = 0.0;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl
deleted file mode 100644
index cdce58c84ef540bd35be24fac4a8e8842b3b0334..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl
+++ /dev/null
@@ -1,126 +0,0 @@
-/** 
- * @file pointLightF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
- 
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-uniform sampler2DMS depthMap;
-uniform sampler2DMS diffuseRect;
-uniform sampler2DMS specularRect;
-uniform sampler2DMS normalMap;
-uniform sampler2D noiseMap;
-uniform sampler2D lightFunc;
-
-
-uniform vec3 env_mat[3];
-uniform float sun_wash;
-
-varying vec4 vary_light;
-
-varying vec4 vary_fragcoord;
-uniform vec2 screen_res;
-
-uniform mat4 inv_proj;
-uniform vec4 viewport;
-
-vec4 getPosition(ivec2 pos_screen, int sample)
-{
-	float depth = texelFetch(depthMap, pos_screen, sample).r;
-	vec2 sc = (vec2(pos_screen.xy)-viewport.xy)*2.0;
-	sc /= viewport.zw;
-	sc -= vec2(1.0,1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
-void main() 
-{
-	vec4 frag = vary_fragcoord;
-	frag.xyz /= frag.w;
-	frag.xyz = frag.xyz*0.5+0.5;
-	frag.xy *= screen_res;
-	
-	ivec2 itc = ivec2(frag.xy);
-
-	int wght = 0;
-	vec3 fcol = vec3(0,0,0);
-
-	for (int s = 0; s < samples; ++s)
-	{
-		vec3 pos = getPosition(itc, s).xyz;
-		vec3 lv = vary_light.xyz-pos;
-		float dist2 = dot(lv,lv);
-		dist2 /= vary_light.w;
-		if (dist2 <= 1.0)
-		{
-			vec3 norm = texelFetch(normalMap, itc, s).xyz;
-			norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
-			float da = dot(norm, lv);
-			if (da >= 0.0)
-			{
-				norm = normalize(norm);
-				lv = normalize(lv);
-				da = dot(norm, lv);
-	
-				float noise = texture2D(noiseMap, frag.xy/128.0).b;
-	
-				vec3 col = texelFetch(diffuseRect, itc, s).rgb;
-				float fa = gl_Color.a+1.0;
-				float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
-				float lit = da * dist_atten * noise;
-	
-				col = gl_Color.rgb*lit*col;
-
-				vec4 spec = texelFetch(specularRect, itc, s);
-				if (spec.a > 0.0)
-				{
-					float sa = dot(normalize(lv-normalize(pos)),norm);
-					if (sa > 0.0)
-					{
-						sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0);
-						sa *= noise;
-						col += da*sa*gl_Color.rgb*spec.rgb;
-					}
-				}
-
-				fcol += col;
-				++wght;
-			}
-		}
-	}
-	
-	if (wght <= 0)
-	{
-		discard;
-	}
-		
-	gl_FragColor.rgb = fcol/samples;	
-	gl_FragColor.a = 0.0;
-}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
index db1b9d3feb88f3e16de78253322a00289e4d4a5a..cb14e6d4e8b164235c9c53ecbb72081ea167b1fd 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
@@ -23,23 +23,17 @@
  * $/LicenseInfo$
  */
 
+uniform mat4 modelview_projection_matrix;
 
+ATTRIBUTE vec3 position;
 
-varying vec4 vary_light;
-varying vec4 vary_fragcoord;
+VARYING vec4 vary_fragcoord;
 
 void main()
 {
 	//transform vertex
-	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
 	vary_fragcoord = pos;
 		
-	vec4 tex = gl_MultiTexCoord0;
-	tex.w = 1.0;
-	
-	vary_light = gl_MultiTexCoord0;
-	
 	gl_Position = pos;
-		
-	gl_FrontColor = gl_Color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
index 29f5f899ba20eeb9856ff3d2a77a4c8cf0cdfba0..bf362e21a4d31ce7f7f45d2c7afd8b39417dbbf8 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
@@ -22,82 +22,34 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
-
 
 #extension GL_ARB_texture_rectangle : enable
 
-uniform sampler2DRect diffuseRect;
-uniform sampler2DRect edgeMap;
-uniform sampler2DRect depthMap;
-uniform sampler2DRect normalMap;
-uniform sampler2D bloomMap;
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
-uniform float depth_cutoff;
-uniform float norm_cutoff;
-uniform float focal_distance;
-uniform float blur_constant;
-uniform float tan_pixel_angle;
-uniform float magnification;
+uniform sampler2DRect diffuseRect;
 
 uniform mat4 inv_proj;
 uniform vec2 screen_res;
+uniform float max_cof;
+uniform float res_scale;
 
-varying vec2 vary_fragcoord;
-
-float getDepth(vec2 pos_screen)
-{
-	float z = texture2DRect(depthMap, pos_screen.xy).r;
-	z = z*2.0-1.0;
-	vec4 ndc = vec4(0.0, 0.0, z, 1.0);
-	vec4 p = inv_proj*ndc;
-	return p.z/p.w;
-}
+VARYING vec2 vary_fragcoord;
 
-float calc_cof(float depth)
+void dofSample(inout vec4 diff, inout float w, float min_sc, vec2 tc)
 {
-	float sc = abs(depth-focal_distance)/-depth*blur_constant;
-		
-	sc /= magnification;
-	
-	// tan_pixel_angle = pixel_length/-depth;
-	float pixel_length =  tan_pixel_angle*-focal_distance;
-	
-	sc = sc/pixel_length;
-	sc *= 1.414;
-	
-	return sc;
-}
-
-void dofSampleNear(inout vec4 diff, inout float w, float cur_sc, vec2 tc)
-{
-	float d = getDepth(tc);
-	
-	float sc = calc_cof(d);
-	
-	float wg = 0.25;
-		
 	vec4 s = texture2DRect(diffuseRect, tc);
-	// de-weight dull areas to make highlights 'pop'
-	wg += s.r+s.g+s.b;
-	
-	diff += wg*s;
-	
-	w += wg;
-}
 
-void dofSample(inout vec4 diff, inout float w, float min_sc, float cur_depth, vec2 tc)
-{
-	float d = getDepth(tc);
-	
-	float sc = calc_cof(d);
-	
-	if (sc > min_sc //sampled pixel is more "out of focus" than current sample radius
-	   || d < cur_depth) //sampled pixel is further away than current pixel
+	float sc = abs(s.a*2.0-1.0)*max_cof;
+
+	if (sc > min_sc) //sampled pixel is more "out of focus" than current sample radius
 	{
 		float wg = 0.25;
 		
-		vec4 s = texture2DRect(diffuseRect, tc);
 		// de-weight dull areas to make highlights 'pop'
 		wg += s.r+s.g+s.b;
 	
@@ -107,30 +59,35 @@ void dofSample(inout vec4 diff, inout float w, float min_sc, float cur_depth, ve
 	}
 }
 
+void dofSampleNear(inout vec4 diff, inout float w, float min_sc, vec2 tc)
+{
+	vec4 s = texture2DRect(diffuseRect, tc);
+
+	float wg = 0.25;
+
+	// de-weight dull areas to make highlights 'pop'
+	wg += s.r+s.g+s.b;
+
+	diff += wg*s;
+		
+	w += wg;
+}
 
 void main() 
 {
-	vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz;
-	norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
-		
 	vec2 tc = vary_fragcoord.xy;
 	
-	float depth = getDepth(tc);
-	
 	vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy);
 	
 	{ 
 		float w = 1.0;
 		
-		float sc = calc_cof(depth);
-		sc = min(abs(sc), 10.0);
-		
-		float fd = depth*0.5f;
-		
+		float sc = (diff.a*2.0-1.0)*max_cof;
+			
 		float PI = 3.14159265358979323846264;
 
 		// sample quite uniformly spaced points within a circle, for a circular 'bokeh'		
-		//if (depth < focal_distance)
+		if (sc > 0.5)
 		{
 			while (sc > 0.5)
 			{
@@ -141,15 +98,31 @@ void main()
 					float samp_x = sc*sin(ang);
 					float samp_y = sc*cos(ang);
 					// you could test sample coords against an interesting non-circular aperture shape here, if desired.
-					dofSample(diff, w, sc, depth, vary_fragcoord.xy + vec2(samp_x,samp_y));
+					dofSampleNear(diff, w, sc, vary_fragcoord.xy + vec2(samp_x,samp_y));
 				}
 				sc -= 1.0;
 			}
 		}
-		
+		else if (sc < -0.5)
+		{
+			sc = abs(sc);
+			while (sc > 0.5)
+			{
+				int its = int(max(1.0,(sc*3.7)));
+				for (int i=0; i<its; ++i)
+				{
+					float ang = sc+i*2*PI/its; // sc is added for rotary perturbance
+					float samp_x = sc*sin(ang);
+					float samp_y = sc*cos(ang);
+					// you could test sample coords against an interesting non-circular aperture shape here, if desired.
+					dofSample(diff, w, sc, vary_fragcoord.xy + vec2(samp_x,samp_y));
+				}
+				sc -= 1.0;
+			}
+		}
+
 		diff /= w;
 	}
 		
-	vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res);
-	gl_FragColor = diff + bloom;
+	frag_color = diff;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl
deleted file mode 100644
index 792102a64d7835144c588d4ba8af1d0ed9c6e666..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl
+++ /dev/null
@@ -1,151 +0,0 @@
-/** 
- * @file postDeferredF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-uniform sampler2DMS diffuseRect;
-uniform sampler2DMS edgeMap;
-uniform sampler2DMS depthMap;
-uniform sampler2DMS normalMap;
-uniform sampler2D bloomMap;
-
-uniform float depth_cutoff;
-uniform float norm_cutoff;
-uniform float focal_distance;
-uniform float blur_constant;
-uniform float tan_pixel_angle;
-uniform float magnification;
-
-uniform mat4 inv_proj;
-uniform vec2 screen_res;
-
-varying vec2 vary_fragcoord;
-
-vec4 texture2DMS(sampler2DMS tex, ivec2 tc)
-{
-	vec4 ret = vec4(0,0,0,0);
-	for (int i = 0; i < samples; ++i)
-	{
-		ret += texelFetch(tex, tc, i);
-	}
-
-	return ret/samples;
-}
-
-float getDepth(ivec2 pos_screen)
-{
-	float z = texture2DMS(depthMap, pos_screen.xy).r;
-	z = z*2.0-1.0;
-	vec4 ndc = vec4(0.0, 0.0, z, 1.0);
-	vec4 p = inv_proj*ndc;
-	return p.z/p.w;
-}
-
-float calc_cof(float depth)
-{
-	float sc = abs(depth-focal_distance)/-depth*blur_constant;
-		
-	sc /= magnification;
-	
-	// tan_pixel_angle = pixel_length/-depth;
-	float pixel_length =  tan_pixel_angle*-focal_distance;
-	
-	sc = sc/pixel_length;
-	sc *= 1.414;
-	
-	return sc;
-}
-
-void dofSample(inout vec4 diff, inout float w, float min_sc, float cur_depth, ivec2 tc)
-{
-	float d = getDepth(tc);
-	
-	float sc = calc_cof(d);
-	
-	if (sc > min_sc //sampled pixel is more "out of focus" than current sample radius
-	   || d < cur_depth) //sampled pixel is further away than current pixel
-	{
-		float wg = 0.25;
-		
-		vec4 s = texture2DMS(diffuseRect, tc);
-		// de-weight dull areas to make highlights 'pop'
-		wg += s.r+s.g+s.b;
-	
-		diff += wg*s;
-		
-		w += wg;
-	}
-}
-
-
-void main() 
-{
-	ivec2 itc = ivec2(vary_fragcoord.xy);
-
-	vec3 norm = texture2DMS(normalMap, itc).xyz;
-	norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
-		
-	float depth = getDepth(itc);
-	
-	vec4 diff = texture2DMS(diffuseRect, itc);
-	
-	{ 
-		float w = 1.0;
-		
-		float sc = calc_cof(depth);
-		sc = min(abs(sc), 10.0);
-		
-		float fd = depth*0.5f;
-		
-		float PI = 3.14159265358979323846264;
-
-		int isc = int(sc);
-		
-		// sample quite uniformly spaced points within a circle, for a circular 'bokeh'		
-		//if (depth < focal_distance)
-		{
-			for (int x = -isc; x <= isc; x+=2)
-			{
-				for (int y = -isc; y <= isc; y+=2)
-				{
-					ivec2 cur_samp = ivec2(x,y);
-					float cur_sc = length(vec2(cur_samp));
-					if (cur_sc < sc)
-					{
-						dofSample(diff, w, cur_sc, depth, itc+cur_samp);
-					}
-				}
-			}
-		}
-		
-		diff /= w;
-	}
-		
-	vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res);
-	gl_FragColor = diff + bloom;
-}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
index 34e30a30703d9efd7bb53eedce7b146ab20e8be6..eb5beeef39a6ce3a47753019ddbdaa385e161876 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
@@ -1,5 +1,5 @@
 /** 
- * @file postDeferredF.glsl
+ * @file postDeferredNoDoFF.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -23,20 +23,25 @@
  * $/LicenseInfo$
  */
  
-
-
 #extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform sampler2DRect diffuseRect;
 uniform sampler2D bloomMap;
 
 uniform vec2 screen_res;
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 void main() 
 {
 	vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy);
 	
 	vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res);
-	gl_FragColor = diff + bloom;
+	frag_color = diff + bloom;
 }
+
diff --git a/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoTCV.glsl
similarity index 85%
rename from indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl
rename to indra/newview/app_settings/shaders/class1/deferred/postDeferredNoTCV.glsl
index cb83dda795f87098fd9d5bc508b27c762cc53fff..bd0cb50464601c1507937935810fce6a20133493 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoTCV.glsl
@@ -22,16 +22,19 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+
+VARYING vec2 vary_fragcoord;
 
-varying vec2 vary_fragcoord;
 uniform vec2 screen_res;
 
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform(); 
-	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	gl_Position = pos;	
 	vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl
index cb83dda795f87098fd9d5bc508b27c762cc53fff..8edf5b2723f90450d09bf857126bdcfc18f9501a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl
@@ -22,16 +22,23 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+
+VARYING vec2 vary_fragcoord;
+VARYING vec2 vary_tc;
+
+uniform vec2 tc_scale;
 
-varying vec2 vary_fragcoord;
 uniform vec2 screen_res;
 
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform(); 
-	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	gl_Position = pos;	
+	vary_tc = (pos.xy*0.5+0.5)*tc_scale;
 	vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl
index 99257daca4a8c5b316e67edb5e5869cbaf3d9626..96f962842468fdf01e73fe5737bd3cfe98c40ca5 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl
@@ -22,9 +22,13 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
-
 
+ #ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+ 
 uniform sampler2DRect depthMap;
 uniform sampler2DRect normalMap;
 uniform sampler2DRect giLightMap;
@@ -38,7 +42,7 @@ uniform int kern_length;
 uniform float kern_scale;
 uniform vec3 blur_quad;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 uniform mat4 inv_proj;
 uniform vec2 screen_res;
@@ -94,7 +98,5 @@ void main()
 	
 	col = col*col*blur_quad.x + col*blur_quad.y + blur_quad.z;
 	
-	gl_FragData[0].xyz = col;
-	
-	//gl_FragColor = ccol;
+	frag_color.rgb = col;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl
index 615317febfd24ef4fb9ba842143098fa2658d118..cf8cf8364a4a246186b8041ef2ba0bc51fefa4e8 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl
@@ -22,24 +22,31 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform float minimum_alpha;
-uniform float maximum_alpha;
 
 uniform sampler2D diffuseMap;
 
-varying vec4 post_pos;
+VARYING vec4 post_pos;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main() 
 {
-	float alpha = texture2D(diffuseMap, gl_TexCoord[0].xy).a * gl_Color.a;
+	float alpha = diffuseLookup(vary_texcoord0.xy).a * vertex_color.a;
 
-	if (alpha < minimum_alpha || alpha > maximum_alpha)
+	if (alpha < minimum_alpha)
 	{
 		discard;
 	}
 
-	gl_FragColor = vec4(1,1,1,1);
+	frag_color = vec4(1,1,1,1);
 	
 	gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl
index 4be18a9c5e4970edc957ab4c08f61bc5248a17dd..7d3b06c56e7517c684c978abf34c808256257a14 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl
@@ -22,20 +22,30 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
 
-varying vec4 post_pos;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 post_pos;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
+void passTextureIndex();
 
 void main()
 {
 	//transform vertex
-	vec4 pos = gl_ModelViewProjectionMatrix*gl_Vertex;
-	
+	vec4 pos = modelview_projection_matrix*vec4(position.xyz, 1.0);
 	post_pos = pos;
 	
 	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w);
 	
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-	gl_FrontColor = gl_Color;
+	passTextureIndex();
+
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	vertex_color = diffuse_color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl
index 541f08d5fe71b4bdaef723fbe5936260e6cfe51a..7e55fdc12a4bf5f943c3b6c930298e3647a4ed17 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl
@@ -23,13 +23,17 @@
  * $/LicenseInfo$
  */
  
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
-
-varying vec4 post_pos;
+VARYING vec4 post_pos;
 
 void main() 
 {
-	gl_FragColor = vec4(1,1,1,1);
+	frag_color = vec4(1,1,1,1);
 	
 	gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl
index fc3ff45614876bae6c0e6d19ebaa8f7307ab49df..8b46e81f90c03a12ed5d3b4ade3cf217c920d5db 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl
@@ -22,15 +22,17 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 modelview_projection_matrix;
 
-varying vec4 post_pos;
+ATTRIBUTE vec3 position;
+
+VARYING vec4 post_pos;
 
 void main()
 {
 	//transform vertex
-	vec4 pos = gl_ModelViewProjectionMatrix*gl_Vertex;
+	vec4 pos = modelview_projection_matrix*vec4(position.xyz, 1.0);
 	
 	post_pos = pos;
 	
diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
index 59c0a994cdd79d075696a7edb5af51d3dc5e0ff4..faa54a316e8663b2baa59d5ad8185e5a948fa800 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
@@ -23,13 +23,17 @@
  * $/LicenseInfo$
  */
  
-
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_data[3];
+#else
+#define frag_data gl_FragData
+#endif
 
 /////////////////////////////////////////////////////////////////////////
 // The fragment shader for the sky
 /////////////////////////////////////////////////////////////////////////
 
-varying vec4 vary_HazeColor;
+VARYING vec4 vary_HazeColor;
 
 uniform sampler2D cloud_noise_texture;
 uniform vec4 gamma;
@@ -55,8 +59,8 @@ void main()
 	color *= 2.;
 
 	/// Gamma correct for WL (soft clip effect).
-	gl_FragData[0] = vec4(scaleSoftClip(color.rgb), 1.0);
-	gl_FragData[1] = vec4(0.0,0.0,0.0,0.0);
-	gl_FragData[2] = vec4(0,0,1,0);
+	frag_data[0] = vec4(scaleSoftClip(color.rgb), 1.0);
+	frag_data[1] = vec4(0.0,0.0,0.0,0.0);
+	frag_data[2] = vec4(0,0,1,0);
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
index 3a44bb6d261af16a1a9fc5f87539a66c9edc32ea..7c02d31d436e5446be6648dccae7010f17fcdb5b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
@@ -22,15 +22,17 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
 
 // SKY ////////////////////////////////////////////////////////////////////////
 // The vertex shader for creating the atmospheric sky
 ///////////////////////////////////////////////////////////////////////////////
 
 // Output parameters
-varying vec4 vary_HazeColor;
+VARYING vec4 vary_HazeColor;
 
 // Inputs
 uniform vec3 camPosLocal;
@@ -40,34 +42,31 @@ uniform vec4 sunlight_color;
 uniform vec4 ambient;
 uniform vec4 blue_horizon;
 uniform vec4 blue_density;
-uniform vec4 haze_horizon;
-uniform vec4 haze_density;
+uniform float haze_horizon;
+uniform float haze_density;
 
-uniform vec4 cloud_shadow;
-uniform vec4 density_multiplier;
-uniform vec4 max_y;
+uniform float cloud_shadow;
+uniform float density_multiplier;
+uniform float max_y;
 
 uniform vec4 glow;
 
 uniform vec4 cloud_color;
 
-uniform vec4 cloud_scale;
-
 void main()
 {
 
 	// World / view / projection
-	gl_Position = ftransform();
-	gl_TexCoord[0] = gl_MultiTexCoord0;
-
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	
 	// Get relative position
-	vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0);
-	//vec3 P = gl_Vertex.xyz + vec3(0,50,0);
+	vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
+	//vec3 P = position.xyz + vec3(0,50,0);
 
 	// Set altitude
 	if (P.y > 0.)
 	{
-		P *= (max_y.x / P.y);
+		P *= (max_y / P.y);
 	}
 	else
 	{
@@ -89,12 +88,12 @@ void main()
 
 	// Sunlight attenuation effect (hue and brightness) due to atmosphere
 	// this is used later for sunlight modulation at various altitudes
-	light_atten = (blue_density * 1.0 + haze_density.x * 0.25) * (density_multiplier.x * max_y.x);
+	light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
 
 	// Calculate relative weights
-	temp1 = blue_density + haze_density.x;
+	temp1 = blue_density + haze_density;
 	blue_weight = blue_density / temp1;
-	haze_weight = haze_density.x / temp1;
+	haze_weight = haze_density / temp1;
 
 	// Compute sunlight from P & lightnorm (for long rays like sky)
 	temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y );
@@ -102,7 +101,7 @@ void main()
 	sunlight *= exp( - light_atten * temp2.y);
 
 	// Distance
-	temp2.z = Plen * density_multiplier.x;
+	temp2.z = Plen * density_multiplier;
 
 	// Transparency (-> temp1)
 	// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
@@ -127,20 +126,20 @@ void main()
 
 	// Haze color above cloud
 	vary_HazeColor = (	  blue_horizon * blue_weight * (sunlight + ambient)
-				+ (haze_horizon.r * haze_weight) * (sunlight * temp2.x + ambient)
+				+ (haze_horizon * haze_weight) * (sunlight * temp2.x + ambient)
 			 );	
 
 
 	// Increase ambient when there are more clouds
 	vec4 tmpAmbient = ambient;
-	tmpAmbient += (1. - tmpAmbient) * cloud_shadow.x * 0.5; 
+	tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; 
 
 	// Dim sunlight by cloud shadow percentage
-	sunlight *= (1. - cloud_shadow.x);
+	sunlight *= (1. - cloud_shadow);
 
 	// Haze color below cloud
 	vec4 additiveColorBelowCloud = (	  blue_horizon * blue_weight * (sunlight + tmpAmbient)
-				+ (haze_horizon.r * haze_weight) * (sunlight * temp2.x + tmpAmbient)
+				+ (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient)
 			 );	
 
 	// Final atmosphere additive
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index 855d89ebe605a4b2f921f175131850c59ba95e38..66e3cf6d13f4a152594985e240743358ee1e6217 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -23,17 +23,20 @@
  * $/LicenseInfo$
  */
  
-
-
 #extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform sampler2DRect diffuseRect;
 uniform sampler2DRect specularRect;
 uniform sampler2DRect positionMap;
 uniform sampler2DRect normalMap;
 uniform sampler2DRect lightMap;
 uniform sampler2DRect depthMap;
-uniform sampler2D	  noiseMap;
 uniform samplerCube environmentMap;
 uniform sampler2D	  lightFunc;
 
@@ -50,21 +53,19 @@ uniform vec4 sunlight_color;
 uniform vec4 ambient;
 uniform vec4 blue_horizon;
 uniform vec4 blue_density;
-uniform vec4 haze_horizon;
-uniform vec4 haze_density;
-uniform vec4 cloud_shadow;
-uniform vec4 density_multiplier;
-uniform vec4 distance_multiplier;
-uniform vec4 max_y;
+uniform float haze_horizon;
+uniform float haze_density;
+uniform float cloud_shadow;
+uniform float density_multiplier;
+uniform float distance_multiplier;
+uniform float max_y;
 uniform vec4 glow;
 uniform float scene_light_strength;
-uniform vec3 env_mat[3];
-//uniform mat4 shadow_matrix[3];
-//uniform vec4 shadow_clip;
+uniform mat3 env_mat;
 uniform mat3 ssao_effect_mat;
 
-varying vec4 vary_light;
-varying vec2 vary_fragcoord;
+uniform vec3 sun_dir;
+VARYING vec2 vary_fragcoord;
 
 vec3 vary_PositionEye;
 
@@ -146,10 +147,6 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
 	vec3 P = inPositionEye;
 	setPositionEye(P);
 	
-	//(TERRAIN) limit altitude
-	if (P.y > max_y.x) P *= (max_y.x / P.y);
-	if (P.y < -max_y.x) P *= (-max_y.x / P.y);
-
 	vec3 tmpLightnorm = lightnorm.xyz;
 
 	vec3 Pn = normalize(P);
@@ -164,13 +161,13 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
 
 	//sunlight attenuation effect (hue and brightness) due to atmosphere
 	//this is used later for sunlight modulation at various altitudes
-	light_atten = (blue_density * 1.0 + vec4(haze_density.r) * 0.25) * (density_multiplier.x * max_y.x);
+	light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
 		//I had thought blue_density and haze_density should have equal weighting,
 		//but attenuation due to haze_density tends to seem too strong
 
-	temp1 = blue_density + vec4(haze_density.r);
+	temp1 = blue_density + vec4(haze_density);
 	blue_weight = blue_density / temp1;
-	haze_weight = vec4(haze_density.r) / temp1;
+	haze_weight = vec4(haze_density) / temp1;
 
 	//(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain)
 	temp2.y = max(0.0, tmpLightnorm.y);
@@ -178,12 +175,12 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
 	sunlight *= exp( - light_atten * temp2.y);
 
 	// main atmospheric scattering line integral
-	temp2.z = Plen * density_multiplier.x;
+	temp2.z = Plen * density_multiplier;
 
 	// Transparency (-> temp1)
-	// ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier.x in a variable because the ati
+	// ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier in a variable because the ati
 	// compiler gets confused.
-	temp1 = exp(-temp1 * temp2.z * distance_multiplier.x);
+	temp1 = exp(-temp1 * temp2.z * distance_multiplier);
 
 	//final atmosphere attenuation factor
 	setAtmosAttenuation(temp1.rgb);
@@ -204,7 +201,7 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
 	temp2.x += .25;
 	
 	//increase ambient when there are more clouds
-	vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5;
+	vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow * 0.5;
 	
 	/*  decrease value and saturation (that in HSV, not HSL) for occluded areas
 	 * // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html
@@ -218,8 +215,8 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
 
 	//haze color
 	setAdditiveColor(
-		vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow.x) + tmpAmbient)
-	  + (haze_horizon.r * haze_weight) * (sunlight*(1.-cloud_shadow.x) * temp2.x
+		vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow) + tmpAmbient)
+	  + (haze_horizon * haze_weight) * (sunlight*(1.-cloud_shadow) * temp2.x
 		  + tmpAmbient)));
 
 	//brightness of surface both sunlight and ambient
@@ -281,9 +278,8 @@ void main()
 	vec3 pos = getPosition_d(tc, depth).xyz;
 	vec3 norm = texture2DRect(normalMap, tc).xyz;
 	norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
-	//vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz;
-	
-	float da = max(dot(norm.xyz, vary_light.xyz), 0.0);
+		
+	float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
 	
 	vec4 diffuse = texture2DRect(diffuseRect, tc);
 	vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
@@ -304,13 +300,18 @@ void main()
 			// the old infinite-sky shiny reflection
 			//
 			vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
-			float sa = dot(refnormpersp, vary_light.xyz);
-			vec3 dumbshiny = vary_SunlitColor*texture2D(lightFunc, vec2(sa, spec.a)).a;
+			float sa = dot(refnormpersp, sun_dir.xyz);
+			vec3 dumbshiny = vary_SunlitColor*(6 * texture2D(lightFunc, vec2(sa, spec.a)).r);
 			
 			// add the two types of shiny together
 			vec3 spec_contrib = dumbshiny * spec.rgb;
-			bloom = dot(spec_contrib, spec_contrib);
+			bloom = dot(spec_contrib, spec_contrib) / 4;
 			col += spec_contrib;
+
+			//add environmentmap
+			vec3 env_vec = env_mat * refnormpersp;
+			col = mix(col.rgb, textureCube(environmentMap, env_vec).rgb, 
+				max(spec.a-diffuse.a*2.0, 0.0)); 
 		}
 	
 		col = atmosLighting(col);
@@ -323,6 +324,7 @@ void main()
 		col = diffuse.rgb;
 	}
 
-	gl_FragColor.rgb = col;
-	gl_FragColor.a = bloom;
+	frag_color.rgb = col;
+
+	frag_color.a = bloom;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl
deleted file mode 100644
index f118b0da2a486be459313fdb707d0a1cff4420a2..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl
+++ /dev/null
@@ -1,342 +0,0 @@
-/** 
- * @file softenLightF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-uniform sampler2DMS diffuseRect;
-uniform sampler2DMS specularRect;
-uniform sampler2DMS normalMap;
-uniform sampler2DMS depthMap;
-uniform sampler2D	  noiseMap;
-uniform samplerCube environmentMap;
-uniform sampler2D	  lightFunc;
-
-uniform float blur_size;
-uniform float blur_fidelity;
-
-// Inputs
-uniform vec4 morphFactor;
-uniform vec3 camPosLocal;
-//uniform vec4 camPosWorld;
-uniform vec4 gamma;
-uniform vec4 lightnorm;
-uniform vec4 sunlight_color;
-uniform vec4 ambient;
-uniform vec4 blue_horizon;
-uniform vec4 blue_density;
-uniform vec4 haze_horizon;
-uniform vec4 haze_density;
-uniform vec4 cloud_shadow;
-uniform vec4 density_multiplier;
-uniform vec4 distance_multiplier;
-uniform vec4 max_y;
-uniform vec4 glow;
-uniform float scene_light_strength;
-uniform vec3 env_mat[3];
-//uniform mat4 shadow_matrix[3];
-//uniform vec4 shadow_clip;
-uniform mat3 ssao_effect_mat;
-
-varying vec4 vary_light;
-varying vec2 vary_fragcoord;
-
-vec3 vary_PositionEye;
-
-vec3 vary_SunlitColor;
-vec3 vary_AmblitColor;
-vec3 vary_AdditiveColor;
-vec3 vary_AtmosAttenuation;
-
-uniform mat4 inv_proj;
-uniform vec2 screen_res;
-
-vec4 getPosition_d(vec2 pos_screen, float depth)
-{
-	vec2 sc = pos_screen.xy*2.0;
-	sc /= screen_res;
-	sc -= vec2(1.0,1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
-vec3 getPositionEye()
-{
-	return vary_PositionEye;
-}
-vec3 getSunlitColor()
-{
-	return vary_SunlitColor;
-}
-vec3 getAmblitColor()
-{
-	return vary_AmblitColor;
-}
-vec3 getAdditiveColor()
-{
-	return vary_AdditiveColor;
-}
-vec3 getAtmosAttenuation()
-{
-	return vary_AtmosAttenuation;
-}
-
-
-void setPositionEye(vec3 v)
-{
-	vary_PositionEye = v;
-}
-
-void setSunlitColor(vec3 v)
-{
-	vary_SunlitColor = v;
-}
-
-void setAmblitColor(vec3 v)
-{
-	vary_AmblitColor = v;
-}
-
-void setAdditiveColor(vec3 v)
-{
-	vary_AdditiveColor = v;
-}
-
-void setAtmosAttenuation(vec3 v)
-{
-	vary_AtmosAttenuation = v;
-}
-
-void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
-
-	vec3 P = inPositionEye;
-	setPositionEye(P);
-	
-	//(TERRAIN) limit altitude
-	if (P.y > max_y.x) P *= (max_y.x / P.y);
-	if (P.y < -max_y.x) P *= (-max_y.x / P.y);
-
-	vec3 tmpLightnorm = lightnorm.xyz;
-
-	vec3 Pn = normalize(P);
-	float Plen = length(P);
-
-	vec4 temp1 = vec4(0);
-	vec3 temp2 = vec3(0);
-	vec4 blue_weight;
-	vec4 haze_weight;
-	vec4 sunlight = sunlight_color;
-	vec4 light_atten;
-
-	//sunlight attenuation effect (hue and brightness) due to atmosphere
-	//this is used later for sunlight modulation at various altitudes
-	light_atten = (blue_density * 1.0 + vec4(haze_density.r) * 0.25) * (density_multiplier.x * max_y.x);
-		//I had thought blue_density and haze_density should have equal weighting,
-		//but attenuation due to haze_density tends to seem too strong
-
-	temp1 = blue_density + vec4(haze_density.r);
-	blue_weight = blue_density / temp1;
-	haze_weight = vec4(haze_density.r) / temp1;
-
-	//(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain)
-	temp2.y = max(0.0, tmpLightnorm.y);
-	temp2.y = 1. / temp2.y;
-	sunlight *= exp( - light_atten * temp2.y);
-
-	// main atmospheric scattering line integral
-	temp2.z = Plen * density_multiplier.x;
-
-	// Transparency (-> temp1)
-	// ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier.x in a variable because the ati
-	// compiler gets confused.
-	temp1 = exp(-temp1 * temp2.z * distance_multiplier.x);
-
-	//final atmosphere attenuation factor
-	setAtmosAttenuation(temp1.rgb);
-	
-	//compute haze glow
-	//(can use temp2.x as temp because we haven't used it yet)
-	temp2.x = dot(Pn, tmpLightnorm.xyz);
-	temp2.x = 1. - temp2.x;
-		//temp2.x is 0 at the sun and increases away from sun
-	temp2.x = max(temp2.x, .03);	//was glow.y
-		//set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
-	temp2.x *= glow.x;
-		//higher glow.x gives dimmer glow (because next step is 1 / "angle")
-	temp2.x = pow(temp2.x, glow.z);
-		//glow.z should be negative, so we're doing a sort of (1 / "angle") function
-
-	//add "minimum anti-solar illumination"
-	temp2.x += .25;
-	
-	//increase ambient when there are more clouds
-	vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5;
-	
-	/*  decrease value and saturation (that in HSV, not HSL) for occluded areas
-	 * // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html
-	 * // The following line of code performs the equivalent of:
-	 * float ambAlpha = tmpAmbient.a;
-	 * float ambValue = dot(vec3(tmpAmbient), vec3(0.577)); // projection onto <1/rt(3), 1/rt(3), 1/rt(3)>, the neutral white-black axis
-	 * vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue);
-	 * tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha);
-	 */
-	tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a);
-
-	//haze color
-	setAdditiveColor(
-		vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow.x) + tmpAmbient)
-	  + (haze_horizon.r * haze_weight) * (sunlight*(1.-cloud_shadow.x) * temp2.x
-		  + tmpAmbient)));
-
-	//brightness of surface both sunlight and ambient
-	setSunlitColor(vec3(sunlight * .5));
-	setAmblitColor(vec3(tmpAmbient * .25));
-	setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1));
-}
-
-vec3 atmosLighting(vec3 light)
-{
-	light *= getAtmosAttenuation().r;
-	light += getAdditiveColor();
-	return (2.0 * light);
-}
-
-vec3 atmosTransport(vec3 light) {
-	light *= getAtmosAttenuation().r;
-	light += getAdditiveColor() * 2.0;
-	return light;
-}
-vec3 atmosGetDiffuseSunlightColor()
-{
-	return getSunlitColor();
-}
-
-vec3 scaleDownLight(vec3 light)
-{
-	return (light / scene_light_strength );
-}
-
-vec3 scaleUpLight(vec3 light)
-{
-	return (light * scene_light_strength);
-}
-
-vec3 atmosAmbient(vec3 light)
-{
-	return getAmblitColor() + light / 2.0;
-}
-
-vec3 atmosAffectDirectionalLight(float lightIntensity)
-{
-	return getSunlitColor() * lightIntensity;
-}
-
-vec3 scaleSoftClip(vec3 light)
-{
-	//soft clip effect:
-	light = 1. - clamp(light, vec3(0.), vec3(1.));
-	light = 1. - pow(light, gamma.xxx);
-
-	return light;
-}
-
-vec4 texture2DMS(sampler2DMS tex, ivec2 tc)
-{
-	vec4 ret = vec4(0,0,0,0);
-
-	for (int i = 0; i < samples; ++i)
-	{
-		 ret += texelFetch(tex,tc,i);
-	}
-
-	return ret/samples;
-}
-
-void main() 
-{
-	vec2 tc = vary_fragcoord.xy;
-	ivec2 itc = ivec2(tc);
-
-	vec4 fcol = vec4(0,0,0,0);
-
-	for (int i = 0; i < samples; ++i)
-	{
-		float depth = texelFetch(depthMap, itc, i).r;
-		vec3 pos = getPosition_d(tc, depth).xyz;
-		vec3 norm = texelFetch(normalMap, itc, i).xyz;
-
-		norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
-		//vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz;
-	
-		float da = max(dot(norm.xyz, vary_light.xyz), 0.0);
-	
-		vec4 diffuse = texelFetch(diffuseRect, itc, i);
-		vec3 col;
-		float bloom = 0.0;
-
-		if (diffuse.a < 0.9)
-		{
-			vec4 spec = texelFetch(specularRect, itc, i);
-	
-			calcAtmospherics(pos.xyz, 1.0);
-	
-			col = atmosAmbient(vec3(0));
-			col += atmosAffectDirectionalLight(max(min(da, 1.0), diffuse.a));
-	
-			col *= diffuse.rgb;
-	
-			if (spec.a > 0.0) // specular reflection
-			{
-				// the old infinite-sky shiny reflection
-				//
-				vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
-				float sa = dot(refnormpersp, vary_light.xyz);
-				vec3 dumbshiny = vary_SunlitColor*texture2D(lightFunc, vec2(sa, spec.a)).a;
-
-				// add the two types of shiny together
-				vec3 spec_contrib = dumbshiny * spec.rgb;
-				bloom = dot(spec_contrib, spec_contrib);
-				col += spec_contrib;
-			}
-
-			col = atmosLighting(col);
-			col = scaleSoftClip(col);
-			col = mix(col, diffuse.rgb, diffuse.a);
-		}
-		else
-		{
-			col = diffuse.rgb;
-		}
-
-		fcol += vec4(col, bloom);
-	}
-				
-	gl_FragColor = fcol/samples;
-}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl
index fed238510a0281a7f4b81520f4c81b9a3972fe89..c6031fc45a28a184822ff9d1118a2443e8ec76e6 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl
@@ -23,22 +23,18 @@
  * $/LicenseInfo$
  */
  
+uniform mat4 modelview_projection_matrix;
 
+ATTRIBUTE vec3 position;
 
 uniform vec2 screen_res;
 
-varying vec4 vary_light;
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform(); 
-	
-	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
-	vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
+	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	gl_Position = pos; 
 		
-	vec4 tex = gl_MultiTexCoord0;
-	tex.w = 1.0;
-	
-	vary_light = gl_MultiTexCoord0;
+	vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
index 7363bd671512a03269c14e4da241d02ee81ca1b9..7ed8ed33701ed891d78ca2a7edd16d2e400d1c23 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
@@ -23,17 +23,20 @@
  * $/LicenseInfo$
  */
 
-
-
+ 
 #extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform sampler2DRect diffuseRect;
 uniform sampler2DRect specularRect;
 uniform sampler2DRect depthMap;
 uniform sampler2DRect normalMap;
-uniform samplerCube environmentMap;
 uniform sampler2D noiseMap;
-uniform sampler2D lightFunc;
 uniform sampler2D projectionMap;
 
 uniform mat4 proj_mat; //screen space to light space
@@ -50,9 +53,12 @@ uniform float far_clip;
 uniform vec3 proj_origin; //origin of projection to be used for angular attenuation
 uniform float sun_wash;
 
-varying vec4 vary_light;
+uniform vec3 center;
+uniform vec3 color;
+uniform float falloff;
+uniform float size;
 
-varying vec4 vary_fragcoord;
+VARYING vec4 vary_fragcoord;
 uniform vec2 screen_res;
 
 uniform mat4 inv_proj;
@@ -78,9 +84,9 @@ void main()
 	frag.xy *= screen_res;
 	
 	vec3 pos = getPosition(frag.xy).xyz;
-	vec3 lv = vary_light.xyz-pos.xyz;
+	vec3 lv = center.xyz-pos.xyz;
 	float dist2 = dot(lv,lv);
-	dist2 /= vary_light.w;
+	dist2 /= size;
 	if (dist2 > 1.0)
 	{
 		discard;
@@ -100,7 +106,7 @@ void main()
 	
 	proj_tc.xyz /= proj_tc.w;
 	
-	float fa = gl_Color.a+1.0;
+	float fa = falloff+1.0;
 	float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
 	
 	lv = proj_origin-pos.xyz;
@@ -126,7 +132,7 @@ void main()
 			
 			vec4 plcol = texture2DLod(projectionMap, proj_tc.xy, lod);
 		
-			vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
+			vec3 lcol = color.rgb * plcol.rgb * plcol.a;
 			
 			lit = da * dist_atten * noise;
 			
@@ -145,7 +151,7 @@ void main()
 		
 		amb_da = min(amb_da, 1.0-lit);
 		
-		col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
+		col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
 	}
 	
 	
@@ -174,12 +180,12 @@ void main()
 					stc.y > 0.0)
 				{
 					vec4 scol = texture2DLod(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
-					col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb;
+					col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb;
 				}
 			}
 		}
 	}
 	
-	gl_FragColor.rgb = col;	
-	gl_FragColor.a = 0.0;
+	frag_color.rgb = col;	
+	frag_color.a = 0.0;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl
deleted file mode 100644
index 0c0171881fbb0736eeb414ac417cdbc4835481a3..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl
+++ /dev/null
@@ -1,252 +0,0 @@
-/** 
- * @file multiSpotLightF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-
-
-//class 1 -- no shadows
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-uniform sampler2DMS diffuseRect;
-uniform sampler2DMS specularRect;
-uniform sampler2DMS depthMap;
-uniform sampler2DMS normalMap;
-uniform sampler2D noiseMap;
-uniform sampler2D lightFunc;
-uniform sampler2D projectionMap;
-
-uniform mat4 proj_mat; //screen space to light space
-uniform float proj_near; //near clip for projection
-uniform vec3 proj_p; //plane projection is emitting from (in screen space)
-uniform vec3 proj_n;
-uniform float proj_focus; //distance from plane to begin blurring
-uniform float proj_lod;  //(number of mips in proj map)
-uniform float proj_range; //range between near clip and far clip plane of projection
-uniform float proj_ambient_lod;
-uniform float proj_ambiance;
-uniform float near_clip;
-uniform float far_clip;
-
-uniform vec3 proj_origin; //origin of projection to be used for angular attenuation
-uniform float sun_wash;
-uniform int proj_shadow_idx;
-uniform float shadow_fade;
-
-varying vec4 vary_light;
-
-varying vec4 vary_fragcoord;
-uniform vec2 screen_res;
-
-uniform mat4 inv_proj;
-
-vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
-{
-	vec4 ret = texture2DLod(projectionMap, tc, lod);
-	
-	vec2 dist = tc-vec2(0.5);
-	
-	float det = max(1.0-lod/(proj_lod*0.5), 0.0);
-	
-	float d = dot(dist,dist);
-		
-	ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0);
-	
-	return ret;
-}
-
-vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
-{
-	vec4 ret = texture2DLod(projectionMap, tc, lod);
-	
-	vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
-	
-	float det = min(lod/(proj_lod*0.5), 1.0);
-	
-	float d = min(dist.x, dist.y);
-	
-	float edge = 0.25*det;
-		
-	ret *= clamp(d/edge, 0.0, 1.0);
-	
-	return ret;
-}
-
-vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
-{
-	vec4 ret = texture2DLod(projectionMap, tc, lod);
-	
-	vec2 dist = tc-vec2(0.5);
-	
-	float d = dot(dist,dist);
-		
-	ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0);
-	
-	return ret;
-}
-
-
-vec4 getPosition(ivec2 pos_screen, int sample)
-{
-	float depth = texelFetch(depthMap, pos_screen, sample).r;
-	vec2 sc = vec2(pos_screen.xy)*2.0;
-	sc /= screen_res;
-	sc -= vec2(1.0,1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
-void main() 
-{
-	vec4 frag = vary_fragcoord;
-	frag.xyz /= frag.w;
-	frag.xyz = frag.xyz*0.5+0.5;
-	frag.xy *= screen_res;
-	ivec2 itc = ivec2(frag.xy);
-
-	vec3 fcol = vec3(0,0,0);
-	int wght = 0;
-	
-	for (int i = 0; i < samples; ++i)
-	{
-		vec3 pos = getPosition(itc, i).xyz;
-		vec3 lv = vary_light.xyz-pos.xyz;
-		float dist2 = dot(lv,lv);
-		dist2 /= vary_light.w;
-		if (dist2 <= 1.0)
-		{
-			vec3 norm = texelFetch(normalMap, itc, i).xyz*2.0-1.0;
-	
-			norm = normalize(norm);
-			float l_dist = -dot(lv, proj_n);
-	
-			vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0));
-			if (proj_tc.z >= 0.0)
-			{
-				proj_tc.xyz /= proj_tc.w;
-	
-				float fa = gl_Color.a+1.0;
-				float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
-				if (dist_atten > 0.0)
-				{
-					lv = proj_origin-pos.xyz;
-					lv = normalize(lv);
-					float da = dot(norm, lv);
-		
-					vec3 col = vec3(0,0,0);
-		
-					vec3 diff_tex = texelFetch(diffuseRect, itc, i).rgb;
-		
-					float noise = texture2D(noiseMap, frag.xy/128.0).b;
-					if (proj_tc.z > 0.0 &&
-						proj_tc.x < 1.0 &&
-						proj_tc.y < 1.0 &&
-						proj_tc.x > 0.0 &&
-						proj_tc.y > 0.0)
-					{
-						float lit = 0.0;
-						float amb_da = proj_ambiance;
-		
-						if (da > 0.0)
-						{
-							float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0);
-							float lod = diff * proj_lod;
-			
-							vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod);
-		
-							vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
-			
-							lit = da * dist_atten * noise;
-			
-							col = lcol*lit*diff_tex;
-							amb_da += (da*0.5)*proj_ambiance;
-						}
-		
-						//float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0);
-						vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod);
-							
-						amb_da += (da*da*0.5+0.5)*proj_ambiance;
-				
-						amb_da *= dist_atten * noise;
-			
-						amb_da = min(amb_da, 1.0-lit);
-			
-						col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
-					}
-	
-	
-					vec4 spec = texelFetch(specularRect, itc, i);
-					if (spec.a > 0.0)
-					{
-						vec3 ref = reflect(normalize(pos), norm);
-		
-						//project from point pos in direction ref to plane proj_p, proj_n
-						vec3 pdelta = proj_p-pos;
-						float ds = dot(ref, proj_n);
-		
-						if (ds < 0.0)
-						{
-							vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds;
-			
-							vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0));
-
-							if (stc.z > 0.0)
-							{
-								stc.xy /= stc.w;
-
-								float fatten = clamp(spec.a*spec.a+spec.a*0.5, 0.25, 1.0);
-				
-								stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
-								
-								if (stc.x < 1.0 &&
-									stc.y < 1.0 &&
-									stc.x > 0.0 &&
-									stc.y > 0.0)
-								{
-									vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
-									col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb;
-								}
-							}
-						}
-					}
-	
-					fcol += col;
-					++wght;
-				}
-			}
-		}
-	}
-
-	if (wght <= 0)
-	{
-		discard;
-	}
-
-	gl_FragColor.rgb = fcol/samples;	
-	gl_FragColor.a = 0.0;
-}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl
index 4ab59d4d66ad035398d495859e131304ddd45adb..821058804c9e2ef3ef7bd05f323f8546cc69606f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl
@@ -22,16 +22,23 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_data[3];
+#else
+#define frag_data gl_FragData
+#endif
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 uniform sampler2D diffuseMap;
 
 void main() 
 {
-	vec4 col = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy);
+	vec4 col = vertex_color * texture2D(diffuseMap, vary_texcoord0.xy);
 	
-	gl_FragData[0] = col;
-	gl_FragData[1] = vec4(0,0,0,0);
-	gl_FragData[2] = vec4(0,0,1,0);	
+	frag_data[0] = col;
+	frag_data[1] = vec4(0,0,0,0);
+	frag_data[2] = vec4(0,0,1,0);	
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl
index 84adf6bc41ade89e5445446f9f62b47fc597928e..8bc5b063799a77d7edc481fc0283c1577dc319c0 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl
@@ -22,14 +22,21 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
 
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	//transform vertex
-	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; 
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-	gl_FrontColor = gl_Color;
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); 
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	vertex_color = diffuse_color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl
index 78ea15e87a9b38ae4b76ce00a52fb7541af45222..5ca817aff6ed69420c5d09b77f6a399c1e445c14 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl
@@ -23,13 +23,17 @@
  * $/LicenseInfo$
  */
  
-
-
 //class 1, no shadow, no SSAO, should never be called
 
 #extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 void main() 
 {
-	gl_FragColor = vec4(0,0,0,0);
+	frag_color = vec4(0,0,0,0);
 }
diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightNoFragCoordV.glsl
similarity index 84%
rename from indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl
rename to indra/newview/app_settings/shaders/class1/deferred/sunLightNoFragCoordV.glsl
index 9deff7bb2aed71f6719ccde610bd7ae6f394b2c2..47e9d15fbcf8d7d145fa923df82722229d96267a 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightNoFragCoordV.glsl
@@ -1,5 +1,5 @@
 /** 
- * @file edgeV.glsl
+ * @file sunLightF.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -22,16 +22,16 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 modelview_projection_matrix;
+ 
+ATTRIBUTE vec3 position;
 
-varying vec2 vary_fragcoord;
 uniform vec2 screen_res;
 
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform(); 
-	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
-	vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
+	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	gl_Position = pos; 
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
index 2f880d65dd97ead1a7d37b5985980959ff401bfc..2422d73a3ea2db7d15ef415aac5ca3a084b1bf4f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
@@ -23,9 +23,14 @@
  */
  
 
-
 #extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 //class 1 -- no shadow, SSAO only
 
 uniform sampler2DRect depthMap;
@@ -34,22 +39,16 @@ uniform sampler2D noiseMap;
 
 
 // Inputs
-uniform mat4 shadow_matrix[6];
-uniform vec4 shadow_clip;
 uniform float ssao_radius;
 uniform float ssao_max_radius;
 uniform float ssao_factor;
 uniform float ssao_factor_inv;
 
-varying vec2 vary_fragcoord;
-varying vec4 vary_light;
+VARYING vec2 vary_fragcoord;
 
 uniform mat4 inv_proj;
 uniform vec2 screen_res;
 
-uniform float shadow_bias;
-uniform float shadow_offset;
-
 vec4 getPosition(vec2 pos_screen)
 {
 	float depth = texture2DRect(depthMap, pos_screen.xy).r;
@@ -126,8 +125,8 @@ void main()
 	vec3 norm = texture2DRect(normalMap, pos_screen).xyz;
 	norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
 		
-	gl_FragColor[0] = 1.0;
-	gl_FragColor[1] = calcAmbientOcclusion(pos, norm);
-	gl_FragColor[2] = 1.0; 
-	gl_FragColor[3] = 1.0;
+	frag_color[0] = 1.0;
+	frag_color[1] = calcAmbientOcclusion(pos, norm);
+	frag_color[2] = 1.0; 
+	frag_color[3] = 1.0;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl
deleted file mode 100644
index abb64334ed21dedcf3d2b9e18cfe87441c30b767..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl
+++ /dev/null
@@ -1,140 +0,0 @@
-/** 
- * @file sunLightSSAOF.glsl
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-//class 1 -- no shadow, SSAO only
-
-uniform sampler2DMS depthMap;
-uniform sampler2DMS normalMap;
-uniform sampler2D noiseMap;
-
-
-// Inputs
-uniform mat4 shadow_matrix[6];
-uniform vec4 shadow_clip;
-uniform float ssao_radius;
-uniform float ssao_max_radius;
-uniform float ssao_factor;
-uniform float ssao_factor_inv;
-
-varying vec2 vary_fragcoord;
-varying vec4 vary_light;
-
-uniform mat4 inv_proj;
-uniform vec2 screen_res;
-
-uniform float shadow_bias;
-uniform float shadow_offset;
-
-vec4 getPosition(ivec2 pos_screen, int sample)
-{
-	float depth = texelFetch(depthMap, pos_screen, sample).r;
-	vec2 sc = pos_screen.xy*2.0;
-	sc /= screen_res;
-	sc -= vec2(1.0,1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
-//calculate decreases in ambient lighting when crowded out (SSAO)
-float calcAmbientOcclusion(vec4 pos, vec3 norm, int sample)
-{
-	float ret = 1.0;
-	
-	vec2 kern[8];
-	// exponentially (^2) distant occlusion samples spread around origin
-	kern[0] = vec2(-1.0, 0.0) * 0.125*0.125;
-	kern[1] = vec2(1.0, 0.0) * 0.250*0.250;
-	kern[2] = vec2(0.0, 1.0) * 0.375*0.375;
-	kern[3] = vec2(0.0, -1.0) * 0.500*0.500;
-	kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625;
-	kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750;
-	kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875;
-	kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000;
-
-	vec2 pos_screen = vary_fragcoord.xy;
-	vec3 pos_world = pos.xyz;
-	vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy;
-		
-	float angle_hidden = 0.0;
-	int points = 0;
-		
-	float scale = min(ssao_radius / -pos_world.z, ssao_max_radius);
-		
-	// it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations unrolling?)
-	for (int i = 0; i < 8; i++)
-	{
-		ivec2 samppos_screen = ivec2(pos_screen + scale * reflect(kern[i], noise_reflect));
-		vec3 samppos_world = getPosition(samppos_screen, sample).xyz; 
-			
-		vec3 diff = pos_world - samppos_world;
-		float dist2 = dot(diff, diff);
-			
-		// assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area
-		// --> solid angle shrinking by the square of distance
-		//radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2
-		//(k should vary inversely with # of samples, but this is taken care of later)
-			
-		angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv);
-			
-		// 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion" 
-		points = points + int(diff.z > -1.0);
-	}
-		
-	angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0);
-		
-	ret = (1.0 - (float(points != 0) * angle_hidden));
-	
-	return min(ret, 1.0);
-}
-
-void main() 
-{
-	vec2 pos_screen = vary_fragcoord.xy;
-	ivec2 itc = ivec2(pos_screen);
-		
-	float col = 0;
-
-	for (int i = 0; i < samples; i++)
-	{
-		vec4 pos = getPosition(itc, i);
-		vec3 norm = texelFetch(normalMap, itc, i).xyz;
-		norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
-		col += calcAmbientOcclusion(pos,norm,i);
-	}
-
-	col /= samples;
-
-	gl_FragColor[0] = 1.0;
-	gl_FragColor[1] = col;
-	gl_FragColor[2] = 1.0; 
-	gl_FragColor[3] = 1.0;
-}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl
index e7ab11c6ed2866e939c32c39def4d78d7a430dd6..473d6df8faa82fbfe02a63458993bec2cb6f2be3 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl
@@ -22,24 +22,20 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 modelview_projection_matrix;
+ 
+ATTRIBUTE vec3 position;
 
-varying vec4 vary_light;
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 uniform vec2 screen_res;
 
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform(); 
-	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
-	vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;	
-	vec4 tex = gl_MultiTexCoord0;
-	tex.w = 1.0;
+	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	gl_Position = pos; 
 	
-	vary_light = gl_MultiTexCoord0;
-		
-	gl_FrontColor = gl_Color;
+	vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;	
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl
index c6578ea177c07636ec8d4b8ee523c938e7f9ef46..8a5e482e80a76197773141548ff022ccdbaa6c20 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl
@@ -23,7 +23,11 @@
  * $/LicenseInfo$
  */
  
-
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_data[3];
+#else
+#define frag_data gl_FragData
+#endif
 
 uniform sampler2D detail_0;
 uniform sampler2D detail_1;
@@ -31,25 +35,27 @@ uniform sampler2D detail_2;
 uniform sampler2D detail_3;
 uniform sampler2D alpha_ramp;
 
-varying vec3 vary_normal;
+VARYING vec3 vary_normal;
+VARYING vec4 vary_texcoord0;
+VARYING vec4 vary_texcoord1;
 
 void main()
 {
 	/// Note: This should duplicate the blending functionality currently used for the terrain rendering.
 	
-	vec4 color0 = texture2D(detail_0, gl_TexCoord[0].xy);
-	vec4 color1 = texture2D(detail_1, gl_TexCoord[0].xy);
-	vec4 color2 = texture2D(detail_2, gl_TexCoord[0].xy);
-	vec4 color3 = texture2D(detail_3, gl_TexCoord[0].xy);
+	vec4 color0 = texture2D(detail_0, vary_texcoord0.xy);
+	vec4 color1 = texture2D(detail_1, vary_texcoord0.xy);
+	vec4 color2 = texture2D(detail_2, vary_texcoord0.xy);
+	vec4 color3 = texture2D(detail_3, vary_texcoord0.xy);
 
-	float alpha1 = texture2D(alpha_ramp, gl_TexCoord[0].zw).a;
-	float alpha2 = texture2D(alpha_ramp,gl_TexCoord[1].xy).a;
-	float alphaFinal = texture2D(alpha_ramp, gl_TexCoord[1].zw).a;
+	float alpha1 = texture2D(alpha_ramp, vary_texcoord0.zw).a;
+	float alpha2 = texture2D(alpha_ramp,vary_texcoord1.xy).a;
+	float alphaFinal = texture2D(alpha_ramp, vary_texcoord1.zw).a;
 	vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal );
 	
-	gl_FragData[0] = vec4(outColor.rgb, 0.0);
-	gl_FragData[1] = vec4(outColor.rgb*0.2, 0.2);
+	frag_data[0] = vec4(outColor.rgb, 0.0);
+	frag_data[1] = vec4(0,0,0,0);
 	vec3 nvn = normalize(vary_normal);
-	gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
+	frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
index fc19a7370919e5c6c3da58e1d6df89d30d490f13..5effee4e4eabd76c2940129ebf68afb46f0febda 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
@@ -22,10 +22,24 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
 
-varying vec3 vary_normal;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec2 texcoord1;
+
+VARYING vec3 vary_normal;
+
+VARYING vec4 vary_texcoord0;
+VARYING vec4 vary_texcoord1;
+
+uniform vec4 object_plane_s;
+uniform vec4 object_plane_t;
 
 vec4 texgen_object(vec4  vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)
 {
@@ -44,16 +58,16 @@ vec4 texgen_object(vec4  vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)
 void main()
 {
 	//transform vertex
-	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
 			
-	vary_normal = normalize(gl_NormalMatrix * gl_Normal);
+	vary_normal = normalize(normal_matrix * normal);
 	
 	// Transform and pass tex coords
- 	gl_TexCoord[0].xy = texgen_object(gl_Vertex, gl_MultiTexCoord0, gl_TextureMatrix[0], gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy;
+ 	vary_texcoord0.xy = texgen_object(vec4(position, 1.0), vec4(texcoord0,0,1), texture_matrix0, object_plane_s, object_plane_t).xy;
 	
-	vec4 t = gl_MultiTexCoord1;
+	vec4 t = vec4(texcoord1,0,1);
 	
-	gl_TexCoord[0].zw = t.xy;
-	gl_TexCoord[1].xy = t.xy-vec2(2.0, 0.0);
-	gl_TexCoord[1].zw = t.xy-vec2(1.0, 0.0);
+	vary_texcoord0.zw = t.xy;
+	vary_texcoord1.xy = t.xy-vec2(2.0, 0.0);
+	vary_texcoord1.zw = t.xy-vec2(1.0, 0.0);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
index 56a149523e0c0470013300e2d26ae19564d4ef83..6cf6106b5191f23e5f16b3e97ede0a1bed732fa6 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
@@ -22,18 +22,31 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_data[3];
+#else
+#define frag_data gl_FragData
+#endif
 
 uniform sampler2D diffuseMap;
 
-varying vec3 vary_normal;
+VARYING vec4 vertex_color;
+VARYING vec3 vary_normal;
+VARYING vec2 vary_texcoord0;
+
+uniform float minimum_alpha;
 
 void main() 
 {
-	vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy);
-	gl_FragData[0] = vec4(gl_Color.rgb*col.rgb, col.a <= 0.5 ? 0.0 : 0.005);
-	gl_FragData[1] = vec4(0,0,0,0);
+	vec4 col = texture2D(diffuseMap, vary_texcoord0.xy);
+	if (col.a < minimum_alpha)
+	{
+		discard;
+	}
+
+	frag_data[0] = vec4(vertex_color.rgb*col.rgb, 0.0);
+	frag_data[1] = vec4(0,0,0,0);
 	vec3 nvn = normalize(vary_normal);
-	gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
+	frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
 }
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl
similarity index 61%
rename from indra/newview/app_settings/shaders/class2/lighting/lightF.glsl
rename to indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl
index d12d88f1c5cc9e1a58b0724aa00d8ea9f11a6c06..d4d2f5f5713a8c26c735d146597fbd61c03b0238 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl
@@ -1,9 +1,9 @@
 /** 
- * @file lightF.glsl
+ * @file treeShadowF.glsl
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2005&license=viewerlgpl$
  * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
+ * Copyright (C) 2005, Linden Research, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -22,20 +22,30 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
-vec3 atmosLighting(vec3 light);
-vec3 scaleSoftClip(vec3 light);
+uniform float minimum_alpha;
 
-void default_lighting() 
+uniform sampler2D diffuseMap;
+
+VARYING vec4 post_pos;
+VARYING vec2 vary_texcoord0;
+
+void main() 
 {
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
-	
-	color.rgb = atmosLighting(color.rgb);
+	float alpha = texture2D(diffuseMap, vary_texcoord0.xy).a;
 
-	color.rgb = scaleSoftClip(color.rgb);
+	if (alpha < minimum_alpha)
+	{
+		discard;
+	}
 
-	gl_FragColor = color;
+	frag_color = vec4(1,1,1,1);
+	
+	gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0);
 }
-
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl
similarity index 67%
rename from indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl
rename to indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl
index fed238510a0281a7f4b81520f4c81b9a3972fe89..e472a753045eae3586551c8f8c41990567bd369d 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl
@@ -1,7 +1,7 @@
 /** 
- * @file softenLightF.glsl
+ * @file treeShadowV.glsl
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
  * Copyright (C) 2007, Linden Research, Inc.
  * 
@@ -22,23 +22,24 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+ 
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
 
-uniform vec2 screen_res;
+VARYING vec4 post_pos;
+VARYING vec2 vary_texcoord0;
 
-varying vec4 vary_light;
-varying vec2 vary_fragcoord;
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform(); 
+	vec4 pos = modelview_projection_matrix*vec4(position.xyz, 1.0);
+	
+	post_pos = pos;
 	
-	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
-	vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
-		
-	vec4 tex = gl_MultiTexCoord0;
-	tex.w = 1.0;
+	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w);
 	
-	vary_light = gl_MultiTexCoord0;
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl
index 01401028d643b199462be0422b1e088fe001ed56..3b6571a24a9ded2af5eee0fc1598e54b3a4b8122 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl
@@ -22,18 +22,26 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+uniform mat3 normal_matrix;
 
-varying vec3 vary_normal;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec3 vary_normal;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform(); 
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); 
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
-	vary_normal = normalize(gl_NormalMatrix * gl_Normal);
+	vary_normal = normalize(normal_matrix * normal);
 
-	gl_FrontColor = gl_Color;
+	vertex_color = vec4(1,1,1,1);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
index c3e7371c8e4b4407ea8e53b6bb4876be390a6a4a..42dc7c09807002826a87c1816fedc0ce8d2f1335 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
@@ -23,10 +23,14 @@
  * $/LicenseInfo$
  */
  
-
-
 #extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_data[3];
+#else
+#define frag_data gl_FragData
+#endif
+
 vec3 scaleSoftClip(vec3 inColor);
 vec3 atmosTransport(vec3 inColor);
 
@@ -58,10 +62,10 @@ uniform vec2 screen_res;
 uniform mat4 norm_mat; //region space to screen space
 
 //bigWave is (refCoord.w, view.w);
-varying vec4 refCoord;
-varying vec4 littleWave;
-varying vec4 view;
-varying vec4 vary_position;
+VARYING vec4 refCoord;
+VARYING vec4 littleWave;
+VARYING vec4 view;
+VARYING vec4 vary_position;
 
 void main() 
 {
@@ -155,7 +159,7 @@ void main()
 	//wavef = normalize(wavef);
 	vec3 screenspacewavef = (norm_mat*vec4(wavef, 1.0)).xyz;
 	
-	gl_FragData[0] = vec4(color.rgb, 0.5); // diffuse
-	gl_FragData[1] = vec4(0.5,0.5,0.5, 0.95); // speccolor*spec, spec
-	gl_FragData[2] = vec4(screenspacewavef.xy*0.5+0.5, screenspacewavef.z, screenspacewavef.z*0.5); // normalxyz, displace
+	frag_data[0] = vec4(color.rgb, 0.5); // diffuse
+	frag_data[1] = vec4(0.5,0.5,0.5, 0.95); // speccolor*spec, spec
+	frag_data[2] = vec4(screenspacewavef.xy*0.5+0.5, screenspacewavef.z, screenspacewavef.z*0.5); // normalxyz, displace
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl
index 9d415ade85cf80b45048eca7b9d6ecb3b82499de..9734acf005a372378eff057667cb4bfea6033210 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl
@@ -22,7 +22,11 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
+
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
 
 
 void calcAtmospherics(vec3 inPositionEye);
@@ -33,11 +37,11 @@ uniform float time;
 uniform vec3 eyeVec;
 uniform float waterHeight;
 
-varying vec4 refCoord;
-varying vec4 littleWave;
-varying vec4 view;
+VARYING vec4 refCoord;
+VARYING vec4 littleWave;
+VARYING vec4 view;
 
-varying vec4 vary_position;
+VARYING vec4 vary_position;
 
 float wave(vec2 v, float t, float f, vec2 d, float s) 
 {
@@ -47,43 +51,42 @@ float wave(vec2 v, float t, float f, vec2 d, float s)
 void main()
 {
 	//transform vertex
-	vec4 position = gl_Vertex;
-	mat4 modelViewProj = gl_ModelViewProjectionMatrix;
+	vec4 pos = vec4(position.xyz, 1.0);
+	mat4 modelViewProj = modelview_projection_matrix;
 	
 	vec4 oPosition;
 		    
 	//get view vector
 	vec3 oEyeVec;
-	oEyeVec.xyz = position.xyz-eyeVec;
+	oEyeVec.xyz = pos.xyz-eyeVec;
 		
 	float d = length(oEyeVec.xy);
 	float ld = min(d, 2560.0);
 	
-	position.xy = eyeVec.xy + oEyeVec.xy/d*ld;
+	pos.xy = eyeVec.xy + oEyeVec.xy/d*ld;
 	view.xyz = oEyeVec;
 		
 	d = clamp(ld/1536.0-0.5, 0.0, 1.0);	
 	d *= d;
 		
-	oPosition = position;
+	oPosition = vec4(position, 1.0);
 	oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d);
-	vary_position = gl_ModelViewMatrix * oPosition;
+	vary_position = modelview_matrix * oPosition;
 	oPosition = modelViewProj * oPosition;
 	
 	refCoord.xyz = oPosition.xyz + vec3(0,0,0.2);
 	
 	//get wave position parameter (create sweeping horizontal waves)
-	vec3 v = position.xyz;
+	vec3 v = pos.xyz;
 	v.x += (cos(v.x*0.08/*+time*0.01*/)+sin(v.y*0.02))*6.0;
 	    
 	//push position for further horizon effect.
-	position.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z);
-	position.w = 1.0;
-	position = position*gl_ModelViewMatrix;
-	
-	calcAtmospherics((gl_ModelViewMatrix * gl_Vertex).xyz);
-	
+	pos.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z);
+	pos.w = 1.0;
+	pos = modelview_matrix*pos;
 	
+	calcAtmospherics(pos.xyz);
+		
 	//pass wave parameters to pixel shader
 	vec2 bigWave =  (v.xy) * vec2(0.04,0.04)  + d1 * time * 0.055;
 	//get two normal map (detail map) texture coordinates
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
index e827863436dd96e6733801b700d6f740e003d4ba..0f5eb288fd01ce1dbb6a0caf505d760fd50eb959 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
@@ -23,10 +23,14 @@
  * $/LicenseInfo$
  */
  
-
-
 #extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform sampler2DRect diffuseMap;
 uniform float minLuminance;
 uniform float maxExtractAlpha;
@@ -34,15 +38,17 @@ uniform vec3 lumWeights;
 uniform vec3 warmthWeights;
 uniform float warmthAmount;
 
+VARYING vec2 vary_texcoord0;
+
 void main()
 {
-	vec4 col = texture2DRect(diffuseMap, gl_TexCoord[0].xy);	
-
+	vec4 col = texture2DRect(diffuseMap, vary_texcoord0.xy);	
 	/// CALCULATING LUMINANCE (Using NTSC lum weights)
 	/// http://en.wikipedia.org/wiki/Luma_%28video%29
 	float lum = smoothstep(minLuminance, minLuminance+1.0, dot(col.rgb, lumWeights ) );
 	float warmth = smoothstep(minLuminance, minLuminance+1.0, max(col.r * warmthWeights.r, max(col.g * warmthWeights.g, col.b * warmthWeights.b)) ); 
 	
-	gl_FragColor.rgb = col.rgb; 
-	gl_FragColor.a = max(col.a, mix(lum, warmth, warmthAmount) * maxExtractAlpha);
+	frag_color.rgb = col.rgb; 
+	frag_color.a = max(col.a, mix(lum, warmth, warmthAmount) * maxExtractAlpha);
+	
 }
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
index 8db6d1bf24b490f88404d431491f040036bf74cc..1396dc6973539d03888ebd4c2c9862c16ac5b6f6 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
@@ -23,11 +23,16 @@
  * $/LicenseInfo$
  */
 
+uniform mat4 modelview_projection_matrix;
 
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec2 vary_texcoord0;
 
 void main() 
 {
-	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+	gl_Position = modelview_projection_matrix * vec4(position, 1.0);
 	
-	gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;
+	vary_texcoord0.xy = texcoord0;
 }
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowF.glsl
index 75cff75ea9e9f4367c9afc2388fe2acb4ab333e7..c1f6af9f577127be6addddad531dfb91173f3f2f 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowF.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowF.glsl
@@ -23,11 +23,20 @@
  * $/LicenseInfo$
  */
  
-
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
 uniform sampler2D diffuseMap;
 uniform float glowStrength;
 
+VARYING vec4 vary_texcoord0;
+VARYING vec4 vary_texcoord1;
+VARYING vec4 vary_texcoord2;
+VARYING vec4 vary_texcoord3;
+
 void main()
 {
 
@@ -38,14 +47,14 @@ void main()
 		kern[0] = 0.25; kern[1] = 0.5; kern[2] = 0.8; kern[3] = 1.0;
 		kern[4] = 1.0;  kern[5] = 0.8; kern[6] = 0.5; kern[7] = 0.25;
 	
-	col += kern[0] * texture2D(diffuseMap, gl_TexCoord[0].xy);	
-	col += kern[1] * texture2D(diffuseMap, gl_TexCoord[1].xy);
-	col += kern[2] * texture2D(diffuseMap, gl_TexCoord[2].xy);	
-	col += kern[3] * texture2D(diffuseMap, gl_TexCoord[3].xy);	
-	col += kern[4] * texture2D(diffuseMap, gl_TexCoord[0].zw);	
-	col += kern[5] * texture2D(diffuseMap, gl_TexCoord[1].zw);	
-	col += kern[6] * texture2D(diffuseMap, gl_TexCoord[2].zw);	
-	col += kern[7] * texture2D(diffuseMap, gl_TexCoord[3].zw);	
+	col += kern[0] * texture2D(diffuseMap, vary_texcoord0.xy);	
+	col += kern[1] * texture2D(diffuseMap, vary_texcoord1.xy);
+	col += kern[2] * texture2D(diffuseMap, vary_texcoord2.xy);	
+	col += kern[3] * texture2D(diffuseMap, vary_texcoord3.xy);	
+	col += kern[4] * texture2D(diffuseMap, vary_texcoord0.zw);	
+	col += kern[5] * texture2D(diffuseMap, vary_texcoord1.zw);	
+	col += kern[6] * texture2D(diffuseMap, vary_texcoord2.zw);	
+	col += kern[7] * texture2D(diffuseMap, vary_texcoord3.zw);	
 	
-	gl_FragColor = vec4(col.rgb * glowStrength, col.a);
+	frag_color = vec4(col.rgb * glowStrength, col.a);
 }
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
index a5aacc019659c94a0dc055644970658683fd1ba0..cdb2281578ec8316010b340e7371a36068a0dc80 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
@@ -23,20 +23,28 @@
  * $/LicenseInfo$
  */
  
+uniform mat4 modelview_projection_matrix;
 
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
 
 uniform vec2 glowDelta;
 
+VARYING vec4 vary_texcoord0;
+VARYING vec4 vary_texcoord1;
+VARYING vec4 vary_texcoord2;
+VARYING vec4 vary_texcoord3;
+
 void main() 
 {
-	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+	gl_Position = modelview_projection_matrix * vec4(position, 1.0);
 	
-	gl_TexCoord[0].xy = gl_MultiTexCoord0.xy + glowDelta*(-3.5);
-	gl_TexCoord[1].xy = gl_MultiTexCoord0.xy + glowDelta*(-2.5);
-	gl_TexCoord[2].xy = gl_MultiTexCoord0.xy + glowDelta*(-1.5);
-	gl_TexCoord[3].xy = gl_MultiTexCoord0.xy + glowDelta*(-0.5);
-	gl_TexCoord[0].zw = gl_MultiTexCoord0.xy + glowDelta*(0.5);
-	gl_TexCoord[1].zw = gl_MultiTexCoord0.xy + glowDelta*(1.5);
-	gl_TexCoord[2].zw = gl_MultiTexCoord0.xy + glowDelta*(2.5);
-	gl_TexCoord[3].zw = gl_MultiTexCoord0.xy + glowDelta*(3.5);
+	vary_texcoord0.xy = texcoord0 + glowDelta*(-3.5);
+	vary_texcoord1.xy = texcoord0 + glowDelta*(-2.5);
+	vary_texcoord2.xy = texcoord0 + glowDelta*(-1.5);
+	vary_texcoord3.xy = texcoord0 + glowDelta*(-0.5);
+	vary_texcoord0.zw = texcoord0 + glowDelta*(0.5);
+	vary_texcoord1.zw = texcoord0 + glowDelta*(1.5);
+	vary_texcoord2.zw = texcoord0 + glowDelta*(2.5);
+	vary_texcoord3.zw = texcoord0 + glowDelta*(3.5);
 }
diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl
index c61d5a2a086c79e358bef42fd001aa6a03410d6b..668a710c042dfe375ee912ecf26f31010d3fc9b1 100644
--- a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl
@@ -1,4 +1,4 @@
-/** 
+/**
  * @file terrainF.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
@@ -23,19 +23,44 @@
  * $/LicenseInfo$
  */
  
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
+VARYING vec4 vertex_color;
+VARYING vec4 vary_texcoord0;
+VARYING vec4 vary_texcoord1;
 
-uniform sampler2D detail0;
-uniform sampler2D detail1;
-uniform sampler2D alphaRamp;
+uniform sampler2D detail_0;
+uniform sampler2D detail_1;
+uniform sampler2D detail_2;
+uniform sampler2D detail_3;
+uniform sampler2D alpha_ramp;
 
-void main() 
+vec3 atmosLighting(vec3 light);
+
+vec3 scaleSoftClip(vec3 color);
+
+void main()
 {
-	float a = texture2D(alphaRamp, gl_TexCoord[1].xy).a;
-	vec3 color = mix(texture2D(detail1, gl_TexCoord[2].xy).rgb,
-					 texture2D(detail0, gl_TexCoord[0].xy).rgb,
-					 a);
+	/// Note: This should duplicate the blending functionality currently used for the terrain rendering.
+	
+	/// TODO Confirm tex coords and bind them appropriately in vert shader.
+	vec4 color0 = texture2D(detail_0, vary_texcoord0.xy);
+	vec4 color1 = texture2D(detail_1, vary_texcoord0.xy);
+	vec4 color2 = texture2D(detail_2, vary_texcoord0.xy);
+	vec4 color3 = texture2D(detail_3, vary_texcoord0.xy);
 
-	gl_FragColor.rgb = color;
-	gl_FragColor.a = texture2D(alphaRamp, gl_TexCoord[3].xy).a;
+	float alpha1 = texture2D(alpha_ramp, vary_texcoord0.zw).a;
+	float alpha2 = texture2D(alpha_ramp,vary_texcoord1.xy).a;
+	float alphaFinal = texture2D(alpha_ramp, vary_texcoord1.zw).a;
+	vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal );
+	
+	/// Add WL Components
+	outColor.rgb = atmosLighting(outColor.rgb * vertex_color.rgb);
+	
+	frag_color = vec4(scaleSoftClip(outColor.rgb), 1.0);
 }
+
diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
index 917891c063481d1faa584299b04130a2ec3a1dda..d09c5f9247c174e8d13f7ef2e4721fbefaf31476 100644
--- a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
@@ -1,4 +1,4 @@
-/** 
+/**
  * @file terrainV.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
@@ -22,8 +22,25 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+uniform vec4 object_plane_t;
+uniform vec4 object_plane_s;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec2 texcoord1;
+
+VARYING vec4 vertex_color;
+VARYING vec4 vary_texcoord0;
+VARYING vec4 vary_texcoord1;
+
+void calcAtmospherics(vec3 inPositionEye);
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 
@@ -44,17 +61,27 @@ vec4 texgen_object(vec4  vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)
 void main()
 {
 	//transform vertex
-	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
-			
-	vec4 pos = gl_ModelViewMatrix * gl_Vertex;
-	vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+
+	vec4 pos = modelview_matrix * vec4(position.xyz, 1.0);
+	vec3 norm = normalize(normal_matrix * normal);
+
+	calcAtmospherics(pos.xyz);
+
+	/// Potentially better without it for water.
+	pos /= pos.w;
+
+	vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0));
 	
-	vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), gl_Color);
+	vertex_color = color;
+
+	// Transform and pass tex coords
+ 	vary_texcoord0.xy = texgen_object(vec4(position.xyz, 1.0), vec4(texcoord0,0,1), texture_matrix0, object_plane_s, object_plane_t).xy;
 	
-	gl_FrontColor = color;
+	vec4 t = vec4(texcoord1,0,1);
 	
-	gl_TexCoord[0] = texgen_object(gl_Vertex,gl_MultiTexCoord0,gl_TextureMatrix[0],gl_ObjectPlaneS[0],gl_ObjectPlaneT[0]);
-	gl_TexCoord[1] = gl_TextureMatrix[1]*gl_MultiTexCoord1;
-	gl_TexCoord[2] = texgen_object(gl_Vertex,gl_MultiTexCoord2,gl_TextureMatrix[2],gl_ObjectPlaneS[2],gl_ObjectPlaneT[2]);
-	gl_TexCoord[3] = gl_TextureMatrix[3]*gl_MultiTexCoord3;
+	vary_texcoord0.zw = t.xy;
+	vary_texcoord1.xy = t.xy-vec2(2.0, 0.0);
+	vary_texcoord1.zw = t.xy-vec2(1.0, 0.0);
 }
+
diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl
index 711b42b95ed517f6afe7bae767e613608e372e45..a956562396039548aa5f72c0ef45cab2749be1c8 100644
--- a/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl
@@ -1,4 +1,4 @@
-/** 
+/**
  * @file terrainWaterF.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
@@ -22,22 +22,46 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
-// this class1 shader is just a copy of terrainF
+VARYING vec4 vertex_color;
+VARYING vec4 vary_texcoord0;
+VARYING vec4 vary_texcoord1;
 
-uniform sampler2D detail0;
-uniform sampler2D detail1;
-uniform sampler2D alphaRamp;
+uniform sampler2D detail_0;
+uniform sampler2D detail_1;
+uniform sampler2D detail_2;
+uniform sampler2D detail_3;
+uniform sampler2D alpha_ramp;
 
-void main() 
+vec3 atmosLighting(vec3 light);
+
+vec4 applyWaterFog(vec4 color);
+
+void main()
 {
-	float a = texture2D(alphaRamp, gl_TexCoord[1].xy).a;
-	vec3 color = mix(texture2D(detail1, gl_TexCoord[2].xy).rgb,
-					 texture2D(detail0, gl_TexCoord[0].xy).rgb,
-					 a);
+	/// Note: This should duplicate the blending functionality currently used for the terrain rendering.
+	
+	/// TODO Confirm tex coords and bind them appropriately in vert shader.
+	vec4 color0 = texture2D(detail_0, vary_texcoord0.xy);
+	vec4 color1 = texture2D(detail_1, vary_texcoord0.xy);
+	vec4 color2 = texture2D(detail_2, vary_texcoord0.xy);
+	vec4 color3 = texture2D(detail_3, vary_texcoord0.xy);
 
-	gl_FragColor.rgb = color;
-	gl_FragColor.a = texture2D(alphaRamp, gl_TexCoord[3].xy).a;
+	float alpha1 = texture2D(alpha_ramp, vary_texcoord0.zw).a;
+	float alpha2 = texture2D(alpha_ramp,vary_texcoord1.xy).a;
+	float alphaFinal = texture2D(alpha_ramp, vary_texcoord1.zw).a;
+	vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal );
+	
+	/// Add WL Components
+	outColor.rgb = atmosLighting(outColor.rgb * vertex_color.rgb);
+	
+	outColor = applyWaterFog(outColor);
+	frag_color = outColor;
 }
+
diff --git a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl
index 72e8e739b3905aafa4f84a710f527e5ba434882c..0d8dab0a4191bd347c4ffb559118a2f578330373 100644
--- a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl
@@ -23,36 +23,84 @@
  * $/LicenseInfo$
  */
  
-
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
 uniform sampler2D diffuseMap;
 uniform sampler2D bumpMap;   
 uniform sampler2D screenTex;
+uniform sampler2D refTex;
+uniform sampler2D screenDepth;
 
+uniform vec4 fogCol;
+uniform vec3 lightDir;
+uniform vec3 specular;
+uniform float lightExp;
+uniform vec2 fbScale;
 uniform float refScale;
+uniform float znear;
+uniform float zfar;
+uniform float kd;
+uniform vec4 waterPlane;
+uniform vec3 eyeVec;
 uniform vec4 waterFogColor;
+uniform float waterFogDensity;
+uniform float waterFogKS;
+uniform vec2 screenRes;
 
 //bigWave is (refCoord.w, view.w);
-varying vec4 refCoord;
-varying vec4 littleWave;
-varying vec4 view;
+VARYING vec4 refCoord;
+VARYING vec4 littleWave;
+VARYING vec4 view;
 
-void main() 
+vec4 applyWaterFog(vec4 color, vec3 viewVec)
 {
-	vec4 color;    
+	//normalize view vector
+	vec3 view = normalize(viewVec);
+	float es = -view.z;
+
+	//find intersection point with water plane and eye vector
 	
-	//get bigwave normal
-	vec3 wavef = texture2D(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0;
-    
-	//get detail normals
-	vec3 dcol = texture2D(bumpMap, littleWave.xy).rgb*0.75;
-	dcol += texture2D(bumpMap, littleWave.zw).rgb*1.25;
-	    
-	//interpolate between big waves and little waves (big waves in deep water)
-	wavef = (wavef+dcol)*0.5;
+	//get eye depth
+	float e0 = max(-waterPlane.w, 0.0);
+	
+	//get object depth
+	float depth = length(viewVec);
+		
+	//get "thickness" of water
+	float l = max(depth, 0.1);
 
-	//crunch normal to range [-1,1]
-	wavef -= vec3(1,1,1);
+	float kd = waterFogDensity;
+	float ks = waterFogKS;
+	vec4 kc = waterFogColor;
+	
+	float F = 0.98;
+	
+	float t1 = -kd * pow(F, ks * e0);
+	float t2 = kd + ks * es;
+	float t3 = pow(F, t2*l) - 1.0;
+	
+	float L = min(t1/t2*t3, 1.0);
+	
+	float D = pow(0.98, l*kd);
+	//return vec4(1.0, 0.0, 1.0, 1.0);
+	return color * D + kc * L;
+	//depth /= 10.0;
+	//return vec4(depth,depth,depth,0.0);
+}
+
+void main() 
+{
+	vec4 color;
+	    
+	//get detail normals
+	vec3 wave1 = texture2D(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0;
+	vec3 wave2 = texture2D(bumpMap, littleWave.xy).xyz*2.0-1.0;
+	vec3 wave3 = texture2D(bumpMap, littleWave.zw).xyz*2.0-1.0;    
+	vec3 wavef = normalize(wave1+wave2+wave3);
 	
 	//figure out distortion vector (ripply)   
 	vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5;
@@ -60,6 +108,5 @@ void main()
 		
 	vec4 fb = texture2D(screenTex, distort);
 	
-	gl_FragColor.rgb = mix(waterFogColor.rgb, fb.rgb, waterFogColor.a * 0.001 + 0.999);
-	gl_FragColor.a = fb.a;
+	frag_color = applyWaterFog(fb,view.xyz);
 }
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
index 4d555b566abcc9d33538b02590e266ebe389cfa8..79bffab745cb2e17869a0bcf1cbec60d5704da7d 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
@@ -23,20 +23,21 @@
  * $/LicenseInfo$
  */
  
-
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
 vec3 scaleSoftClip(vec3 inColor);
 vec3 atmosTransport(vec3 inColor);
-vec3 applyWaterFog(vec4 inColor);
 
-uniform sampler2D diffuseMap;
 uniform sampler2D bumpMap;   
 uniform sampler2D screenTex;
 uniform sampler2D refTex;
 
 uniform float sunAngle;
 uniform float sunAngle2;
-uniform float scaledAngle;
 uniform vec3 lightDir;
 uniform vec3 specular;
 uniform float lightExp;
@@ -47,69 +48,94 @@ uniform vec3 normScale;
 uniform float fresnelScale;
 uniform float fresnelOffset;
 uniform float blurMultiplier;
-uniform vec4 fogCol;
+
 
 //bigWave is (refCoord.w, view.w);
-varying vec4 refCoord;
-varying vec4 littleWave;
-varying vec4 view;
+VARYING vec4 refCoord;
+VARYING vec4 littleWave;
+VARYING vec4 view;
 
 void main() 
 {
-	vec3 viewVec = view.xyz;
 	vec4 color;
 	
-	float dist = length(viewVec.xy);
+	float dist = length(view.xy);
 	
 	//normalize view vector
-	viewVec = normalize(viewVec);
+	vec3 viewVec = normalize(view.xyz);
 	
 	//get wave normals
-	vec3 wavef = texture2D(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0;
-
-	//get detail normals
-	vec3 dcol = texture2D(bumpMap, littleWave.xy).rgb*0.75;
-	dcol += texture2D(bumpMap, littleWave.zw).rgb*1.25;
-
-	//interpolate between big waves and little waves (big waves in deep water)
-	wavef = (wavef + dcol) * 0.5;
-	
-	//crunch normal to range [-1,1]
-	wavef -= vec3(1,1,1);
-	wavef = normalize(wavef);
-   
+	vec3 wave1 = texture2D(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0;
+	vec3 wave2 = texture2D(bumpMap, littleWave.xy).xyz*2.0-1.0;
+	vec3 wave3 = texture2D(bumpMap, littleWave.zw).xyz*2.0-1.0;
 	//get base fresnel components	
 	
-	float df = dot(viewVec,wavef) * fresnelScale + fresnelOffset;
+	vec3 df = vec3(
+					dot(viewVec, wave1),
+					dot(viewVec, (wave2 + wave3) * 0.5),
+					dot(viewVec, wave3)
+				 ) * fresnelScale + fresnelOffset;
+	df *= df;
 		    
 	vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5;
 	
 	float dist2 = dist;
 	dist = max(dist, 5.0);
 	
+	float dmod = sqrt(dist);
+	
+	vec2 dmod_scale = vec2(dmod*dmod, dmod);
+	
 	//get reflected color
-	vec2 refdistort = wavef.xy*dot(normScale, vec3(0.333));
-	vec2 refvec = distort+refdistort/dist;
-	vec4 refcol = texture2D(refTex, refvec);
+	vec2 refdistort1 = wave1.xy*normScale.x;
+	vec2 refvec1 = distort+refdistort1/dmod_scale;
+	vec4 refcol1 = texture2D(refTex, refvec1);
+	
+	vec2 refdistort2 = wave2.xy*normScale.y;
+	vec2 refvec2 = distort+refdistort2/dmod_scale;
+	vec4 refcol2 = texture2D(refTex, refvec2);
+	
+	vec2 refdistort3 = wave3.xy*normScale.z;
+	vec2 refvec3 = distort+refdistort3/dmod_scale;
+	vec4 refcol3 = texture2D(refTex, refvec3);
+
+	vec4 refcol = refcol1 + refcol2 + refcol3;
+	float df1 = df.x + df.y + df.z;
+	refcol *= df1 * 0.333;
+	
+	vec3 wavef = (wave1 + wave2 * 0.4 + wave3 * 0.6) * 0.5;
+	
+	wavef.z *= max(-viewVec.z, 0.1);
+	wavef = normalize(wavef);
+	
+	float df2 = dot(viewVec, wavef) * fresnelScale+fresnelOffset;
+	
+	vec2 refdistort4 = wavef.xy*0.125;
+	refdistort4.y -= abs(refdistort4.y);
+	vec2 refvec4 = distort+refdistort4/dmod;
+	float dweight = min(dist2*blurMultiplier, 1.0);
+	vec4 baseCol = texture2D(refTex, refvec4);
+	refcol = mix(baseCol*df2, refcol, dweight);
 
 	//get specular component
 	float spec = clamp(dot(lightDir, (reflect(viewVec,wavef))),0.0,1.0);
-	
+		
 	//harden specular
-	spec = pow(spec, lightExp);
+	spec = pow(spec, 128.0);
 
 	//figure out distortion vector (ripply)   
-	vec2 distort2 = distort+wavef.xy*refScale/max(dist*df, 1.0);
+	vec2 distort2 = distort+wavef.xy*refScale/max(dmod*df1, 1.0);
 		
 	vec4 fb = texture2D(screenTex, distort2);
 	
 	//mix with reflection
-	color.rgb = mix(mix(fogCol.rgb, fb.rgb, fogCol.a), refcol.rgb, df);
+	// Note we actually want to use just df1, but multiplying by 0.999999 gets around and nvidia compiler bug
+	color.rgb = mix(fb.rgb, refcol.rgb, df1 * 0.99999);
 	color.rgb += spec * specular;
 	
-	//color.rgb = applyWaterFog(color);//atmosTransport(color.rgb);
+	color.rgb = atmosTransport(color.rgb);
 	color.rgb = scaleSoftClip(color.rgb);
 	color.a = spec * sunAngle2;
 
-	gl_FragColor = color;
+	frag_color = color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
index d44690d1fb482e89943e127610b49139d1d0cd15..4bdfce9260c77145dcb244b561d87ce1a4230ea7 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
@@ -25,16 +25,50 @@
  
 
 
+uniform vec4 lightnorm;
+uniform vec4 waterPlane;
+uniform vec4 waterFogColor;
+uniform float waterFogDensity;
+uniform float waterFogKS;
+
+vec3 getPositionEye();
+
 vec4 applyWaterFog(vec4 color)
 {
-	// GL_EXP2 Fog
-	//float fog = exp(-gl_Fog.density * gl_Fog.density * gl_FogFragCoord * gl_FogFragCoord);
-	// GL_EXP Fog
-	// float fog = exp(-gl_Fog.density * gl_FogFragCoord);
-	// GL_LINEAR Fog
-	float fog = (gl_Fog.end - gl_FogFragCoord) * gl_Fog.scale;
-	fog = clamp(fog, 0.0, 1.0);
-	color.rgb = mix(gl_Fog.color.rgb, color.rgb, fog);
+	//normalize view vector
+	vec3 view = normalize(getPositionEye());
+	float es = -(dot(view, waterPlane.xyz));
+
+	//find intersection point with water plane and eye vector
+	
+	//get eye depth
+	float e0 = max(-waterPlane.w, 0.0);
+	
+	vec3 int_v = waterPlane.w > 0.0 ? view * waterPlane.w/es : vec3(0.0, 0.0, 0.0);
+	
+	//get object depth
+	float depth = length(getPositionEye() - int_v);
+		
+	//get "thickness" of water
+	float l = max(depth, 0.1);
+
+	float kd = waterFogDensity;
+	float ks = waterFogKS;
+	vec4 kc = waterFogColor;
+	
+	float F = 0.98;
+	
+	float t1 = -kd * pow(F, ks * e0);
+	float t2 = kd + ks * es;
+	float t3 = pow(F, t2*l) - 1.0;
+	
+	float L = min(t1/t2*t3, 1.0);
+	
+	float D = pow(0.98, l*kd);
+	
+	color.rgb = color.rgb * D + kc.rgb * L;
+	color.a = kc.a + color.a;
+	
 	return color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
index 610c06fbbc341c3f69c25876b9dd715a3ca0e0f4..f66ba1d2d9403f0a3f102773b17c363e7ed64e4f 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
@@ -22,8 +22,11 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
 
 void calcAtmospherics(vec3 inPositionEye);
 
@@ -33,9 +36,9 @@ uniform float time;
 uniform vec3 eyeVec;
 uniform float waterHeight;
 
-varying vec4 refCoord;
-varying vec4 littleWave;
-varying vec4 view;
+VARYING vec4 refCoord;
+VARYING vec4 littleWave;
+VARYING vec4 view;
 
 float wave(vec2 v, float t, float f, vec2 d, float s) 
 {
@@ -45,8 +48,7 @@ float wave(vec2 v, float t, float f, vec2 d, float s)
 void main()
 {
 	//transform vertex
-	vec4 position = gl_Vertex;
-	mat4 modelViewProj = gl_ModelViewProjectionMatrix;
+	mat4 modelViewProj = modelview_projection_matrix;
 	
 	vec4 oPosition;
 		    
@@ -57,27 +59,29 @@ void main()
 	float d = length(oEyeVec.xy);
 	float ld = min(d, 2560.0);
 	
-	position.xy = eyeVec.xy + oEyeVec.xy/d*ld;
+	vec3 lpos = position;
+	lpos.xy = eyeVec.xy + oEyeVec.xy/d*ld;
 	view.xyz = oEyeVec;
 		
 	d = clamp(ld/1536.0-0.5, 0.0, 1.0);	
 	d *= d;
 		
-	oPosition = position;
+	oPosition = vec4(lpos, 1.0);
 	oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d);
 	oPosition = modelViewProj * oPosition;
 	refCoord.xyz = oPosition.xyz + vec3(0,0,0.2);
 	
 	//get wave position parameter (create sweeping horizontal waves)
-	vec3 v = position.xyz;
+	vec3 v = lpos;
 	v.x += (cos(v.x*0.08/*+time*0.01*/)+sin(v.y*0.02))*6.0;
 	    
 	//push position for further horizon effect.
-	position.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z);
-	position.w = 1.0;
-	position = position*gl_ModelViewMatrix;
+	vec4 pos;
+	pos.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z);
+	pos.w = 1.0;
+	pos = modelview_matrix*pos;
 	
-	calcAtmospherics((gl_ModelViewMatrix * gl_Vertex).xyz);
+	calcAtmospherics(pos.xyz);
 	
 	
 	//pass wave parameters to pixel shader
diff --git a/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl b/indra/newview/app_settings/shaders/class1/interface/alphamaskF.glsl
similarity index 74%
rename from indra/newview/app_settings/shaders/class3/deferred/treeF.glsl
rename to indra/newview/app_settings/shaders/class1/interface/alphamaskF.glsl
index 56a149523e0c0470013300e2d26ae19564d4ef83..f520f301d9b478d4f8b9c8c3ac476ddf1f6e6600 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/alphamaskF.glsl
@@ -1,5 +1,5 @@
 /** 
- * @file treeF.glsl
+ * @file alphamaskF.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -22,18 +22,27 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
 uniform sampler2D diffuseMap;
 
-varying vec3 vary_normal;
+uniform float minimum_alpha;
+
+VARYING vec2 vary_texcoord0;
+VARYING vec4 vertex_color;
 
 void main() 
 {
-	vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy);
-	gl_FragData[0] = vec4(gl_Color.rgb*col.rgb, col.a <= 0.5 ? 0.0 : 0.005);
-	gl_FragData[1] = vec4(0,0,0,0);
-	vec3 nvn = normalize(vary_normal);
-	gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
+	vec4 col = vertex_color*texture2D(diffuseMap, vary_texcoord0.xy);
+	if (col.a < minimum_alpha)
+	{
+		discard;
+	}
+
+	frag_color = col;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl b/indra/newview/app_settings/shaders/class1/interface/alphamaskV.glsl
similarity index 71%
rename from indra/newview/app_settings/shaders/class1/deferred/giV.glsl
rename to indra/newview/app_settings/shaders/class1/interface/alphamaskV.glsl
index 190e32b6a34102d938e25f11ca0f22962d66b332..3580d1f27b2c247e35ac0704fbb06196fa6a44e5 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/alphamaskV.glsl
@@ -1,5 +1,5 @@
 /** 
- * @file giV.glsl
+ * @file alphamaskV.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -22,21 +22,21 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
 
-varying vec2 vary_fragcoord;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
 
-uniform vec2 screen_res;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
-	//transform vertex
-	gl_Position = ftransform(); 
-	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
-	vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;	
-	vec4 tex = gl_MultiTexCoord0;
-	tex.w = 1.0;
-
-	gl_FrontColor = gl_Color;
+	gl_Position = modelview_projection_matrix * vec4(position, 1);
+	vary_texcoord0 =  (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	vertex_color = diffuse_color;
 }
+
diff --git a/indra/newview/app_settings/shaders/class1/interface/customalphaF.glsl b/indra/newview/app_settings/shaders/class1/interface/customalphaF.glsl
index 27c63fdc8b9c8dea2e496b1b537a9dc73bf25457..a96d04cc39d194f063e78af0fa79bdce330aefcf 100644
--- a/indra/newview/app_settings/shaders/class1/interface/customalphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/customalphaF.glsl
@@ -22,14 +22,23 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform sampler2D diffuseMap;
 
 uniform float custom_alpha;
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void main() 
 {
-	vec4 color = gl_Color*texture2D(diffuseMap, gl_TexCoord[0].xy);
+	vec4 color = vertex_color*texture2D(diffuseMap, vary_texcoord0.xy);
 	color.a *= custom_alpha;
-	gl_FragColor = color;
+	frag_color = color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl b/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl
index c4c896c35c4d75ec39c90d0ebfc973508329000e..890474d6d8c1c8af946c15afab2d8b0030240a37 100644
--- a/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl
@@ -22,13 +22,20 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
-	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
-	gl_TexCoord[0] = gl_MultiTexCoord0;
-	gl_FrontColor = gl_Color;
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	vary_texcoord0 = texcoord0;
+	vertex_color = diffuse_color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/interface/debugF.glsl b/indra/newview/app_settings/shaders/class1/interface/debugF.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..67c6baddbbd1b4278b596430fb6d89a48c05ce5e
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/interface/debugF.glsl
@@ -0,0 +1,37 @@
+/** 
+ * @file debugF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+uniform vec4 color;
+
+void main() 
+{
+	frag_color = color;
+}
diff --git a/indra/newview/app_settings/shaders/class1/interface/debugV.glsl b/indra/newview/app_settings/shaders/class1/interface/debugV.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..f4d704577ad5e6f83bfb83971895255c2258397d
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/interface/debugV.glsl
@@ -0,0 +1,34 @@
+/** 
+ * @file debugV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+
+void main()
+{
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
index b8963e1decb2813a3eb3418749e3d934dc666a81..ed803de277317cb63815cac756652c9dc953d32d 100644
--- a/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
@@ -22,14 +22,23 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 #extension GL_ARB_texture_rectangle : enable
 
 uniform sampler2D glowMap;
 uniform sampler2DRect screenMap;
 
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
+
 void main() 
 {
-	gl_FragColor = texture2D(glowMap, gl_TexCoord[0].xy) +
-					texture2DRect(screenMap, gl_TexCoord[1].xy);
+	frag_color = texture2D(glowMap, vary_texcoord0.xy) +
+					texture2DRect(screenMap, vary_texcoord1.xy);
 }
diff --git a/indra/newview/app_settings/shaders/class3/deferred/giFinalF.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl
similarity index 69%
rename from indra/newview/app_settings/shaders/class3/deferred/giFinalF.glsl
rename to indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl
index 7c55fcc2864075f0d8f3d441721a25ba7898127b..59520bb99f7c4a299c575c02177d338307a1a30d 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/giFinalF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl
@@ -1,9 +1,9 @@
 /** 
- * @file giFinalF.glsl
+ * @file glowcombineFXAAF.glsl
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2005&license=viewerlgpl$
  * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
+ * Copyright (C) 2005, Linden Research, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -23,23 +23,22 @@
  * $/LicenseInfo$
  */
  
-
-
 #extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform sampler2DRect diffuseRect;
-uniform sampler2D	  bloomMap;
-uniform sampler2DRect edgeMap;
 
 uniform vec2 screen_res;
-varying vec2 vary_fragcoord;
-
+VARYING vec2 vary_tc;
 
 void main() 
 {
-	vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res);
-	vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy);
+	vec3 col = texture2DRect(diffuseRect, vary_tc*screen_res).rgb;
 	
-	gl_FragColor = bloom + diff;
-	//gl_FragColor.rgb = vec3(texture2DRect(edgeMap, vary_fragcoord.xy).a);
+	frag_color = vec4(col.rgb, dot(col.rgb, vec3(0.299, 0.587, 0.144)));
 }
diff --git a/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl
similarity index 76%
rename from indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl
rename to indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl
index a6a206502c7ff7fd3dc0553da9bcfa24b60fbddb..058f3b1b820e5d97af8b290685074b71b2e3ae03 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl
@@ -1,7 +1,7 @@
 /** 
- * @file giFinalV.glsl
+ * @file glowcombineFXAAV.glsl
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
  * Copyright (C) 2007, Linden Research, Inc.
  * 
@@ -22,16 +22,18 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 modelview_projection_matrix;
 
-varying vec2 vary_fragcoord;
-uniform vec2 screen_res;
+ATTRIBUTE vec3 position;
+
+VARYING vec2 vary_tc;
 
 void main()
 {
-	//transform vertex
-	gl_Position = ftransform(); 
-	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
-	vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
+	vec4 pos = modelview_projection_matrix*vec4(position.xyz, 1.0);
+	gl_Position = pos;
+
+	vary_tc = pos.xy*0.5+0.5;
 }
+
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl
index 4c6360f71d036cb7622afdb452d2cd2e18d3d4cf..f7970b7f78b36ec21b1225cfdf5cab8f6c653875 100644
--- a/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl
@@ -22,12 +22,20 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
+
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec2 texcoord1;
+
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
 
 void main()
 {
-	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
-	gl_TexCoord[0] = gl_MultiTexCoord0;
-	gl_TexCoord[1] = gl_MultiTexCoord1;
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	vary_texcoord0 = texcoord0;
+	vary_texcoord1 = texcoord1;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl
index a3cb5225ba36035b9485c72000f034affaecfc8c..6cc9bbbea23b16b73d47b564ecaa8c2b8694b8bc 100644
--- a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl
@@ -23,11 +23,18 @@
  * $/LicenseInfo$
  */
  
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
-
+uniform vec4 color;
 uniform sampler2D diffuseMap;
 
+VARYING vec2 vary_texcoord0;
+
 void main() 
 {
-	gl_FragColor = gl_Color*texture2D(diffuseMap, gl_TexCoord[0].xy);
+	frag_color = color*texture2D(diffuseMap, vary_texcoord0.xy);
 }
diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
index da3bea6d065c73a3995ed61db61ba40d64952c01..9bf7b60eb76a709653d9a379a1d3392ca9aa79b0 100644
--- a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
@@ -22,24 +22,19 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform();
-	vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
-	pos = normalize(pos);
-	float d = dot(pos, normalize(gl_NormalMatrix * gl_Normal));
-	d *= d;
-	d = 1.0 - d;
-	d *= d;
-		
-	d = min(d, gl_Color.a*2.0);
-			
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-	gl_FrontColor.rgb = gl_Color.rgb;
-	gl_FrontColor.a = max(d, gl_Color.a);
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/interface/occlusionF.glsl b/indra/newview/app_settings/shaders/class1/interface/occlusionF.glsl
index 57248699cb97f656523b5ecae0ddaaf484dd2454..db130e456ca1e239bb4cbc8585ddcf29f4c61f07 100644
--- a/indra/newview/app_settings/shaders/class1/interface/occlusionF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/occlusionF.glsl
@@ -23,7 +23,13 @@
  * $/LicenseInfo$
  */
  
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 void main() 
 {
-	gl_FragColor = vec4(1,1,1,1);
+	frag_color = vec4(1,1,1,1);
 }
diff --git a/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl b/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl
index 915e452e0f843ae2678e1d95afe92e5a984878dc..c26fa08ddc62e15f9ed80556d197e7ae7d5ef700 100644
--- a/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl
@@ -23,8 +23,12 @@
  * $/LicenseInfo$
  */
 
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+
 void main()
 {
-	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl
similarity index 71%
rename from indra/newview/app_settings/shaders/class2/lighting/lightV.glsl
rename to indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl
index 8045809b82c6cc6e18b4fdfeefa9ec26ed35c706..415181126b21134af50fd8d6d5554f593426af4b 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl
@@ -1,9 +1,9 @@
 /** 
- * @file lightV.glsl
+ * @file onetexturenocolorF.glsl
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2005&license=viewerlgpl$
  * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
+ * Copyright (C) 2005, Linden Research, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -22,15 +22,18 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
-// All lights, no specular highlights
+uniform sampler2D tex0;
 
-vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight);
+VARYING vec2 vary_texcoord0;
 
-vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseLight)
+void main() 
 {
-	return sumLights(pos, norm, color, baseLight);
+	frag_color = texture2D(tex0, vary_texcoord0.xy);
 }
-
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl
similarity index 79%
rename from indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl
rename to indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl
index 6231ee68b75c69b50b1cbd480d448b468fd89833..6b9986c8d7f3d52a5a1d3b57ab357f62024a6fa1 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl
@@ -1,5 +1,5 @@
 /** 
- * @file postgiV.glsl
+ * @file onetexturenocolorV.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -23,15 +23,16 @@
  * $/LicenseInfo$
  */
  
+uniform mat4 modelview_projection_matrix;
 
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
 
-varying vec2 vary_fragcoord;
-uniform vec2 screen_res;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
-	//transform vertex
-	gl_Position = ftransform(); 
-	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
-	vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
+	gl_Position = modelview_projection_matrix * vec4(position, 1);
+	vary_texcoord0 = texcoord0;
 }
+
diff --git a/indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl b/indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl
index b1d2b949acc49eab38b188f15fcbd6029bed318d..67dc5004933fdee792c3bfcc3ffbaafbc7593ec8 100644
--- a/indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl
@@ -22,12 +22,21 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform sampler2D tex0;
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void main() 
 {
-	float alpha = texture2D(tex0, gl_TexCoord[0].xy).a * gl_Color.a;
+	float alpha = texture2D(tex0, vary_texcoord0.xy).a * vertex_color.a;
 
-	gl_FragColor = vec4(gl_Color.rgb, alpha);
+	frag_color = vec4(vertex_color.rgb, alpha);
 }
diff --git a/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl b/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl
index fedf6ae5466ce282650d6772781355e525637a62..c58f9dfdaf84554d27e407035229ae23df175b88 100644
--- a/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl
@@ -22,13 +22,20 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
+
+uniform mat4 modelview_projection_matrix;
  
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
-	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
-	gl_FrontColor = gl_Color;
-	gl_TexCoord[0] = gl_MultiTexCoord0;
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	vertex_color = diffuse_color;
+	vary_texcoord0 = texcoord0;
 }
 
diff --git a/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl
similarity index 74%
rename from indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl
rename to indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl
index 13517a26baca2a7e633391ddd0df7257d6bc03a3..772bb374e820d71a4bd7a24c8b3e541a52a3e6c8 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl
@@ -1,9 +1,9 @@
 /** 
- * @file luminanceF.glsl
+ * @file splattexturerectF.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
+ * Copyright (C) 2011, Linden Research, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -23,17 +23,20 @@
  * $/LicenseInfo$
  */
  
+#extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
-#extension GL_ARB_texture_rectangle : enable
+uniform sampler2DRect screenMap;
 
-uniform sampler2DRect lightMap;
-uniform sampler2DRect diffuseRect;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
-varying vec2 vary_fragcoord;
 void main() 
 {
-	float i = texture2DRect(lightMap, vary_fragcoord.xy).r;
-	gl_FragColor.rgb = vec3(i);
-	gl_FragColor.a = 1.0;
+	frag_color = 	texture2DRect(screenMap, vary_texcoord0.xy) * vertex_color;
 }
diff --git a/indra/newview/app_settings/shaders/class3/deferred/giV.glsl b/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl
similarity index 70%
rename from indra/newview/app_settings/shaders/class3/deferred/giV.glsl
rename to indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl
index 190e32b6a34102d938e25f11ca0f22962d66b332..641d670c2675111ebd23900912e964db7bfd222e 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/giV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl
@@ -1,9 +1,9 @@
 /** 
- * @file giV.glsl
+ * @file splattexturerectV.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
+ * Copyright (C) 2011, Linden Research, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -22,21 +22,20 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 modelview_projection_matrix;
 
-varying vec2 vary_fragcoord;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec4 diffuse_color;
 
-uniform vec2 screen_res;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
-	//transform vertex
-	gl_Position = ftransform(); 
-	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
-	vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;	
-	vec4 tex = gl_MultiTexCoord0;
-	tex.w = 1.0;
-
-	gl_FrontColor = gl_Color;
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	vary_texcoord0 = texcoord0;
+	vertex_color = diffuse_color;
 }
+
diff --git a/indra/newview/app_settings/shaders/class1/interface/twotextureaddF.glsl b/indra/newview/app_settings/shaders/class1/interface/twotextureaddF.glsl
index 3408cc44f8e37afc52bf6b9a006463eee85ce2bf..95679e93e745ad7f878aac2854ab630614bd2f00 100644
--- a/indra/newview/app_settings/shaders/class1/interface/twotextureaddF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/twotextureaddF.glsl
@@ -22,11 +22,20 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform sampler2D tex0;
 uniform sampler2D tex1;
 
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
+
 void main() 
 {
-	gl_FragColor = texture2D(tex0, gl_TexCoord[0].xy)+texture2D(tex1, gl_TexCoord[1].xy);
+	frag_color = texture2D(tex0, vary_texcoord0.xy)+texture2D(tex1, vary_texcoord1.xy);
 }
diff --git a/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl b/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl
index 94aa964be6d53020557dac7c46759df913501bc7..3c2f297f7f555c6a25461ada639762adca41e9a5 100644
--- a/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl
@@ -23,12 +23,19 @@
  * $/LicenseInfo$
  */
  
+uniform mat4 modelview_projection_matrix;
 
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec2 texcoord1;
+
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
 
 void main()
 {
-	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
-	gl_TexCoord[0] = gl_MultiTexCoord0;
-	gl_TexCoord[1] = gl_MultiTexCoord1;
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	vary_texcoord0 = texcoord0;
+	vary_texcoord1 = texcoord1;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/interface/uiF.glsl b/indra/newview/app_settings/shaders/class1/interface/uiF.glsl
index 7694056b08f5801ed4ee0f8ef70cfca6946c98f5..299bfb72aa7209e40ee2ebcf73adc73a46c2e993 100644
--- a/indra/newview/app_settings/shaders/class1/interface/uiF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/uiF.glsl
@@ -22,10 +22,19 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform sampler2D diffuseMap;
 
+VARYING vec2 vary_texcoord0;
+VARYING vec4 vertex_color;
+
 void main() 
 {
-	gl_FragColor = gl_Color*texture2D(diffuseMap, gl_TexCoord[0].xy);
+	frag_color = vertex_color*texture2D(diffuseMap, vary_texcoord0.xy);
 }
diff --git a/indra/newview/app_settings/shaders/class1/interface/uiV.glsl b/indra/newview/app_settings/shaders/class1/interface/uiV.glsl
index b1b90d0b5eced13de9a2818f3a952a298d5adcef..220dafef25d977f8db1cdb5d9a386258060e0c0b 100644
--- a/indra/newview/app_settings/shaders/class1/interface/uiV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/uiV.glsl
@@ -22,13 +22,21 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
-	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
-	gl_TexCoord[0] = gl_MultiTexCoord0;
-	gl_FrontColor = gl_Color;
+	gl_Position = modelview_projection_matrix * vec4(position, 1);
+	vary_texcoord0 =  (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	vertex_color = diffuse_color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskF.glsl
similarity index 82%
rename from indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskF.glsl
rename to indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskF.glsl
index 4c053290655bb54fefb354bb06216f9b05d7cd5f..cf29939cb2353637e33f43c1548d083bfd6bcf64 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskF.glsl
@@ -23,18 +23,25 @@
  * $/LicenseInfo$
  */
  
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
 uniform float minimum_alpha;
-uniform float maximum_alpha;
 
 vec3 atmosLighting(vec3 light);
 vec3 scaleSoftClip(vec3 light);
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void default_lighting() 
 {
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
 	
-	if (color.a < minimum_alpha || color.a > maximum_alpha)
+	if (color.a < minimum_alpha)
 	{
 		discard;
 	}
@@ -43,6 +50,6 @@ void default_lighting()
 
 	color.rgb = scaleSoftClip(color.rgb);
 
-	gl_FragColor = color;
+	frag_color = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskNonIndexedF.glsl
similarity index 82%
rename from indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskNonIndexedF.glsl
rename to indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskNonIndexedF.glsl
index 0de909353e18fd8b611623ea748e4ba2fb1f4af9..4070d41f47860b077e36a96cc56809a64565dd4d 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskNonIndexedF.glsl
@@ -22,22 +22,28 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
-uniform float minimum_alpha;
-uniform float maximum_alpha;
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
+uniform float minimum_alpha;
 
 uniform sampler2D diffuseMap;
 
 vec3 atmosLighting(vec3 light);
 vec3 scaleSoftClip(vec3 light);
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void default_lighting() 
 {
-	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color;
 
-	if (color.a < minimum_alpha || color.a > maximum_alpha)
+	if (color.a < minimum_alpha)
 	{
 		discard;
 	}
@@ -46,6 +52,6 @@ void default_lighting()
 
 	color.rgb = scaleSoftClip(color.rgb);
 
-	gl_FragColor = color;
+	frag_color = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl
index 5cb3eb05a7c283da669cd7b88ba1a27835b93ba0..d6ebfcb82575825214fe6227ef9b48550ca05f84 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl
@@ -22,14 +22,27 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
-uniform sampler2D diffuseMap;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
+vec3 atmosLighting(vec3 light);
+vec3 scaleSoftClip(vec3 light);
 
 void default_lighting() 
 {
-	vec4 color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy);
-	gl_FragColor = color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
+	
+	color.rgb = atmosLighting(color.rgb);
+
+	color.rgb = scaleSoftClip(color.rgb);
+
+	frag_color = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl
similarity index 82%
rename from indra/newview/app_settings/shaders/class2/lighting/lightFullbrightAlphaMaskF.glsl
rename to indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl
index 8c7713c08db6aa6c3717b8ad865ecef2761323b8..6c34643aab0e577d00242b5942908b32e8efe70d 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl
@@ -22,18 +22,26 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform float minimum_alpha;
-uniform float maximum_alpha;
 
 vec3 fullbrightAtmosTransport(vec3 light);
 vec3 fullbrightScaleSoftClip(vec3 light);
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void fullbright_lighting()
 {
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
 	
-	if (color.a < minimum_alpha || color.a > maximum_alpha)
+	if (color.a < minimum_alpha)
 	{
 		discard;
 	}
@@ -42,6 +50,6 @@ void fullbright_lighting()
 	
 	color.rgb = fullbrightScaleSoftClip(color.rgb);
 
-	gl_FragColor = color;
+	frag_color = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl
index f3ba8b73a80d978d7acf716a4efd0fe60e42fe6a..2ff7f795b05e88bcb470a8a2b212813671efeaa2 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl
@@ -22,14 +22,27 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
-uniform sampler2D diffuseMap;
+vec3 fullbrightAtmosTransport(vec3 light);
+vec3 fullbrightScaleSoftClip(vec3 light);
 
 void fullbright_lighting()
 {
-	gl_FragColor = texture2D(diffuseMap, gl_TexCoord[0].xy);
+	vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
+	
+	color.rgb = fullbrightAtmosTransport(color.rgb);
+	
+	color.rgb = fullbrightScaleSoftClip(color.rgb);
+
+	frag_color = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl
similarity index 82%
rename from indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl
rename to indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl
index 89468b9665316da515dd180fe0471bc16c3bce5d..f4477bd29ac021a89cb544b433047c851269912b 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl
@@ -22,20 +22,28 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform float minimum_alpha;
-uniform float maximum_alpha;
 
 vec3 fullbrightAtmosTransport(vec3 light);
 vec3 fullbrightScaleSoftClip(vec3 light);
 
 uniform sampler2D diffuseMap;
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void fullbright_lighting()
 {
-	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color;
 	
-	if (color.a < minimum_alpha || color.a > maximum_alpha)
+	if (color.a < minimum_alpha)
 	{
 		discard;
 	}
@@ -44,6 +52,6 @@ void fullbright_lighting()
 	
 	color.rgb = fullbrightScaleSoftClip(color.rgb);
 
-	gl_FragColor = color;
+	frag_color = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedF.glsl
similarity index 83%
rename from indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl
rename to indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedF.glsl
index a909ff608af520cf77357875093462f005df5946..2738ff89477dd03137952fc2da033fc5920c1e4a 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedF.glsl
@@ -22,8 +22,15 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 vec3 fullbrightAtmosTransport(vec3 light);
 vec3 fullbrightScaleSoftClip(vec3 light);
@@ -32,12 +39,12 @@ uniform sampler2D diffuseMap;
 
 void fullbright_lighting()
 {
-	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color;
 	
 	color.rgb = fullbrightAtmosTransport(color.rgb);
 	
 	color.rgb = fullbrightScaleSoftClip(color.rgb);
 
-	gl_FragColor = color;
+	frag_color = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl
index b4c8a9abcedbde35c6209cdee0839df470b77f9b..777c8b45bb3ffe2653e0a0415949d3c8b579ad52 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl
@@ -22,14 +22,36 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
 
-uniform sampler2D diffuseMap;
 uniform samplerCube environmentMap;
 
-void fullbright_shiny_lighting() 
+vec3 fullbrightShinyAtmosTransport(vec3 light);
+vec3 fullbrightScaleSoftClip(vec3 light);
+
+void fullbright_shiny_lighting()
 {
-	gl_FragColor = texture2D(diffuseMap, gl_TexCoord[0].xy);
+	vec4 color = diffuseLookup(vary_texcoord0.xy);
+	color.rgb *= vertex_color.rgb;
+	
+	vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;	
+	color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
+
+	color.rgb = fullbrightShinyAtmosTransport(color.rgb);
+
+	color.rgb = fullbrightScaleSoftClip(color.rgb);
+
+	color.a = max(color.a, vertex_color.a);
+
+	frag_color = color;
 }
+
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyNonIndexedF.glsl
similarity index 74%
rename from indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl
rename to indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyNonIndexedF.glsl
index af73168c13085ee434bafd166da053802142e0f8..4fa3b1d939cda3cdcfc7e32a60504788db1dff85 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyNonIndexedF.glsl
@@ -22,8 +22,16 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
 
 uniform samplerCube environmentMap;
 uniform sampler2D diffuseMap;
@@ -33,18 +41,18 @@ vec3 fullbrightScaleSoftClip(vec3 light);
 
 void fullbright_shiny_lighting()
 {
-	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy);
-	color.rgb *= gl_Color.rgb;
+	vec4 color = texture2D(diffuseMap, vary_texcoord0.xy);
+	color.rgb *= vertex_color.rgb;
 	
-	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	
-	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a);
+	vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;	
+	color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
 
 	color.rgb = fullbrightShinyAtmosTransport(color.rgb);
 
 	color.rgb = fullbrightScaleSoftClip(color.rgb);
 
-	color.a = max(color.a, gl_Color.a);
+	color.a = max(color.a, vertex_color.a);
 
-	gl_FragColor = color;
+	frag_color = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl
index 925d6fbcfd860471b9181ceb845ee7b6868bc26a..58984a42631e33d3e83795e13b3e66756501a81d 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl
@@ -21,14 +21,35 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
-
  
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
 
-uniform sampler2D diffuseMap;
 uniform samplerCube environmentMap;
 
-void fullbright_shiny_lighting_water() 
+vec3 fullbrightShinyAtmosTransport(vec3 light);
+vec3 fullbrightScaleSoftClip(vec3 light);
+vec4 applyWaterFog(vec4 color);
+
+void fullbright_shiny_lighting_water()
 {
-	gl_FragColor = texture2D(diffuseMap, gl_TexCoord[0].xy);
+	vec4 color = diffuseLookup(vary_texcoord0.xy);
+	color.rgb *= vertex_color.rgb;
+	
+	vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;	
+	color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
+
+	color.rgb = fullbrightShinyAtmosTransport(color.rgb);
+	color.rgb = fullbrightScaleSoftClip(color.rgb);
+	color.a = max(color.a, vertex_color.a);
+
+	frag_color = applyWaterFog(color);
 }
+
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterNonIndexedF.glsl
similarity index 74%
rename from indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl
rename to indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterNonIndexedF.glsl
index e0a7986705adb1a96e06e4b57c12e0b74e5555f8..a39b7205d79b6a3208c4c4a52ef935a0d3a4d62f 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterNonIndexedF.glsl
@@ -22,8 +22,15 @@
  * $/LicenseInfo$
  */
  
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
-
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
 
 uniform samplerCube environmentMap;
 uniform sampler2D diffuseMap;
@@ -34,16 +41,16 @@ vec4 applyWaterFog(vec4 color);
 
 void fullbright_shiny_lighting_water()
 {
-	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy);
-	color.rgb *= gl_Color.rgb;
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy);
+	color.rgb *= vertex_color.rgb;
 	
-	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	
-	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a);
+	vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;	
+	color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
 
 	color.rgb = fullbrightShinyAtmosTransport(color.rgb);
 	color.rgb = fullbrightScaleSoftClip(color.rgb);
-	color.a = max(color.a, gl_Color.a);
+	color.a = max(color.a, vertex_color.a);
 
-	gl_FragColor = applyWaterFog(color);
+	frag_color = applyWaterFog(color);
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl
similarity index 81%
rename from indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterAlphaMaskF.glsl
rename to indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl
index e5998b77a9ca3151290e835c156c1726e4d39c02..99a6fe85fe8178e1f07ba0b550b12e322966b722 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl
@@ -23,25 +23,33 @@
  * $/LicenseInfo$
  */
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform float minimum_alpha;
-uniform float maximum_alpha;
 
 vec4 diffuseLookup(vec2 texcoord);
 
 vec3 fullbrightAtmosTransport(vec3 light);
 vec4 applyWaterFog(vec4 color);
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void fullbright_lighting_water()
 {
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
 
-	if (color.a < minimum_alpha || color.a > maximum_alpha)
+	if (color.a < minimum_alpha)
 	{
 		discard;
 	}
 
 	color.rgb = fullbrightAtmosTransport(color.rgb);
 	
-	gl_FragColor = applyWaterFog(color);
+	frag_color = applyWaterFog(color);
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl
index 71238f7d31609653c2698502a3b2aef2c4157cf4..df182168f3c59baa50aa671339355b2267146a3a 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl
@@ -23,13 +23,26 @@
  * $/LicenseInfo$
  */
 
- 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
-uniform sampler2D diffuseMap;
+vec4 diffuseLookup(vec2 texcoord);
+
+vec3 fullbrightAtmosTransport(vec3 light);
+vec4 applyWaterFog(vec4 color);
 
 void fullbright_lighting_water()
 {
-	gl_FragColor = texture2D(diffuseMap, gl_TexCoord[0].xy);
+	vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
+
+	color.rgb = fullbrightAtmosTransport(color.rgb);
+	
+	frag_color = applyWaterFog(color);
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl
similarity index 81%
rename from indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl
rename to indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl
index 3fdd110f7d76435fa2c6cb9968eafecaa20f0e4e..63f92a88440771fc3fe29025750e3d6d7f86b429 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl
@@ -22,26 +22,34 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform float minimum_alpha;
-uniform float maximum_alpha;
 
 uniform sampler2D diffuseMap;
 
 vec3 fullbrightAtmosTransport(vec3 light);
 vec4 applyWaterFog(vec4 color);
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void fullbright_lighting_water()
 {
-	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = texture2D(diffuseMap, vary_texcoord0.xy) * vertex_color;
 
-	if (color.a < minimum_alpha || color.a > maximum_alpha)
+	if (color.a < minimum_alpha)
 	{
 		discard;
 	}
 
 	color.rgb = fullbrightAtmosTransport(color.rgb);
 	
-	gl_FragColor = applyWaterFog(color);
+	frag_color = applyWaterFog(color);
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedF.glsl
similarity index 82%
rename from indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl
rename to indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedF.glsl
index 01b89019b15bb633e49cf6278e9401d81e46b3ae..0e68091e7cbc76f270e8fd02941f9aafcdfabe38 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedF.glsl
@@ -22,8 +22,15 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 uniform sampler2D diffuseMap;
 
@@ -32,10 +39,10 @@ vec4 applyWaterFog(vec4 color);
 
 void fullbright_lighting_water()
 {
-	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = texture2D(diffuseMap, vary_texcoord0.xy) * vertex_color;
 
 	color.rgb = fullbrightAtmosTransport(color.rgb);
 	
-	gl_FragColor = applyWaterFog(color);
+	frag_color = applyWaterFog(color);
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightNonIndexedF.glsl
similarity index 83%
rename from indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl
rename to indra/newview/app_settings/shaders/class1/lighting/lightNonIndexedF.glsl
index d419c2d116ec1395ec366991b22ad56c919b5275..0aca768021bf6fbb8a7818b6e92bcb5ac51dfcbd 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightNonIndexedF.glsl
@@ -22,8 +22,15 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+ 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 uniform sampler2D diffuseMap;
 
@@ -32,12 +39,12 @@ vec3 scaleSoftClip(vec3 light);
 
 void default_lighting() 
 {
-	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color;
 	
 	color.rgb = atmosLighting(color.rgb);
 
 	color.rgb = scaleSoftClip(color.rgb);
 
-	gl_FragColor = color;
+	frag_color = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl
index 7c9b7c218f96e5dcb77bdea530593e9f6c5e97ba..52e3b2ad026f0df5da4465bb55662fe302f751ea 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl
@@ -22,16 +22,35 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
 
-uniform sampler2D diffuseMap;
 uniform samplerCube environmentMap;
 
-void shiny_lighting() 
+vec3 scaleSoftClip(vec3 light);
+vec3 atmosLighting(vec3 light);
+vec4 applyWaterFog(vec4 color);
+
+void shiny_lighting()
 {
-	vec4 color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy);
-	gl_FragColor = color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy);
+	color.rgb *= vertex_color.rgb;
+	
+	vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;	
+	color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
+
+	color.rgb = atmosLighting(color.rgb);
+
+	color.rgb = scaleSoftClip(color.rgb);
+	color.a = max(color.a, vertex_color.a);
+	frag_color = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyNonIndexedF.glsl
similarity index 73%
rename from indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl
rename to indra/newview/app_settings/shaders/class1/lighting/lightShinyNonIndexedF.glsl
index 3b30ebf6f144e8acc4679738a836e15b136c5cf6..474d5ea4969d4e22f73dec43e343cd009b17cc14 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyNonIndexedF.glsl
@@ -22,9 +22,16 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
-
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+ 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
 
 uniform samplerCube environmentMap;
 uniform sampler2D diffuseMap;
@@ -35,16 +42,16 @@ vec4 applyWaterFog(vec4 color);
 
 void shiny_lighting()
 {
-	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy);
-	color.rgb *= gl_Color.rgb;
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy);
+	color.rgb *= vertex_color.rgb;
 	
-	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	
-	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a);
+	vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;	
+	color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
 
 	color.rgb = atmosLighting(color.rgb);
 
 	color.rgb = scaleSoftClip(color.rgb);
-	color.a = max(color.a, gl_Color.a);
-	gl_FragColor = color;
+	color.a = max(color.a, vertex_color.a);
+	frag_color = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl
index ca1af8fc795b7e15c9f01dc8e473cbb76fd3aaec..d2a4c47aac526b10d2fbe95a04a66e8b3f7d8f2e 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl
@@ -22,16 +22,32 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
 
-uniform sampler2D diffuseMap;
 uniform samplerCube environmentMap;
 
-void shiny_lighting_water() 
+vec3 atmosLighting(vec3 light);
+vec4 applyWaterFog(vec4 color);
+
+void shiny_lighting_water()
 {
-	vec4 color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy);
-	gl_FragColor = color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy);
+	color.rgb *= vertex_color.rgb;
+	
+	vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;	
+	color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
+
+	color.rgb = atmosLighting(color.rgb);
+	color.a = max(color.a, vertex_color.a);
+	frag_color = applyWaterFog(color);
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterNonIndexedF.glsl
similarity index 71%
rename from indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl
rename to indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterNonIndexedF.glsl
index eeb997fb5f77729c1183c19c439bf5eb1af878c6..f3bd66236449ad872a38f78ff44201d5deb8e1cd 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterNonIndexedF.glsl
@@ -22,9 +22,16 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
 
 uniform sampler2D diffuseMap;
 uniform samplerCube environmentMap;
@@ -34,14 +41,14 @@ vec4 applyWaterFog(vec4 color);
 
 void shiny_lighting_water()
 {
-	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy);
-	color.rgb *= gl_Color.rgb;
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy);
+	color.rgb *= vertex_color.rgb;
 	
-	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	
-	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a);
+	vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;	
+	color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
 
 	color.rgb = atmosLighting(color.rgb);
-	color.a = max(color.a, gl_Color.a);
-	gl_FragColor = applyWaterFog(color);
+	color.a = max(color.a, vertex_color.a);
+	frag_color = applyWaterFog(color);
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl
index 4a59b8245dc100419b4451e295ea19e6352003ab..24bf9b3cee5168a8cfc7928b545eddc39e8a9736 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl
@@ -1,5 +1,5 @@
 /** 
- * @file lightV.glsl
+ * @file lightSpecularV.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -25,22 +25,12 @@
  
 
 
-float calcDirectionalLight(vec3 n, vec3 l);
+// All lights, no specular highlights
+
+vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol);
 
-// Same as non-specular lighting in lightV.glsl
 vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol)
 {
-	specularColor.rgb = vec3(0.0, 0.0, 0.0);
-	vec4 col;
-	col.a = color.a;
-
-	col.rgb = gl_LightModel.ambient.rgb + baseCol.rgb;
-
-	col.rgb += gl_LightSource[0].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[0].position.xyz);
-	col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz);
-
-	col.rgb = min(col.rgb*color.rgb, 1.0);
-
-	return col;	
+	return sumLightsSpecular(pos, norm, color, specularColor, baseCol);
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl
index 742cb38d804ba27595b79ab1ece82a9886b8133a..8045809b82c6cc6e18b4fdfeefa9ec26ed35c706 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl
@@ -25,20 +25,12 @@
  
 
 
-float calcDirectionalLight(vec3 n, vec3 l);
+// All lights, no specular highlights
+
+vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight);
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseLight)
 {
-	vec4 col;
-	col.a = color.a;
-	
-	col.rgb = gl_LightModel.ambient.rgb + baseLight.rgb;
-	
-	col.rgb += gl_LightSource[0].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[0].position.xyz);
-	col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz);
-						
-	col.rgb = min(col.rgb*color.rgb, 1.0);
-	
-	return col;	
+	return sumLights(pos, norm, color, baseLight);
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskF.glsl
similarity index 80%
rename from indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskF.glsl
rename to indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskF.glsl
index 072dcaa6b65e327a73642b7dd3ec03fc1038269f..b68240ba0d6e13ebea4c2fdfeb47f38ba2f39cf2 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskF.glsl
@@ -22,24 +22,32 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform float minimum_alpha;
-uniform float maximum_alpha;
 
 vec3 atmosLighting(vec3 light);
 vec4 applyWaterFog(vec4 color);
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void default_lighting_water()
 {
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
 
-	if (color.a < minimum_alpha || color.a > maximum_alpha)
+	if (color.a < minimum_alpha)
 	{
 		discard;
 	}
 
 	color.rgb = atmosLighting(color.rgb);
 
-	gl_FragColor = applyWaterFog(color);
+	frag_color = applyWaterFog(color);
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskNonIndexedF.glsl
similarity index 82%
rename from indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskNonIndexedF.glsl
rename to indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskNonIndexedF.glsl
index 2df34da4b47aa2026ce06fde1ecf8694161221d0..da3b20012d850323fbaad0e5e3affae5d1936a5c 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskNonIndexedF.glsl
@@ -22,20 +22,28 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform float minimum_alpha;
-uniform float maximum_alpha;
 
 uniform sampler2D diffuseMap;
 
 vec3 atmosLighting(vec3 light);
 vec4 applyWaterFog(vec4 color);
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void default_lighting_water()
 {
-	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color;
 
-	if (color.a < minimum_alpha || color.a > maximum_alpha)
+	if (color.a < minimum_alpha)
 	{
 		discard;
 	}
@@ -44,6 +52,6 @@ void default_lighting_water()
 
 	color = applyWaterFog(color);
 	
-	gl_FragColor = color;
+	frag_color = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl
index da76a977b6427228c370a3c7eb50ccb51fb62182..00609e93cd3a9185a261071fd29214caed5d2b51 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl
@@ -22,14 +22,25 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
-uniform sampler2D diffuseMap;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
-void default_lighting_water() 
+vec3 atmosLighting(vec3 light);
+vec4 applyWaterFog(vec4 color);
+
+void default_lighting_water()
 {
-	vec4 color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy);
-	gl_FragColor = color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
+
+	color.rgb = atmosLighting(color.rgb);
+
+	frag_color = applyWaterFog(color);
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightWaterNonIndexedF.glsl
similarity index 81%
rename from indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl
rename to indra/newview/app_settings/shaders/class1/lighting/lightWaterNonIndexedF.glsl
index 5a86dad82785c344bbd012d9f99a129a2b1ff955..13ecb7a6368fa0016e6386c895014cd14deb4d65 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightWaterNonIndexedF.glsl
@@ -22,8 +22,15 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 uniform sampler2D diffuseMap;
 
@@ -32,10 +39,10 @@ vec4 applyWaterFog(vec4 color);
 
 void default_lighting_water()
 {
-	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color;
 
 	color.rgb = atmosLighting(color.rgb);
 
-	gl_FragColor = applyWaterFog(color);
+	frag_color = applyWaterFog(color);
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl
index 3e0815226c698324b3cd87656be97b575e06178a..7059ff31aed4b7fa8ffb0661c2e6fc98ad939f46 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl
@@ -31,21 +31,22 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
 vec3 atmosGetDiffuseSunlightColor();
 vec3 scaleDownLight(vec3 light);
 
+uniform vec4 light_position[8];
+uniform vec3 light_diffuse[8];
+
 vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol)
 {
-	vec4 col;
-	col.a = color.a;
-	
-	
+	vec4 col = vec4(0,0,0, color.a);
+		
 	vec3 view = normalize(pos);
 	
 	/// collect all the specular values from each calcXXXLightSpecular() function
 	vec4 specularSum = vec4(0.0);
 
-	col.rgb = gl_LightSource[1].diffuse.rgb * calcDirectionalLightSpecular(specularColor, view, norm, gl_LightSource[1].position.xyz, gl_LightSource[1].diffuse.rgb, 1.0);
+	col.rgb += light_diffuse[1].rgb * calcDirectionalLightSpecular(specularColor, view, norm, light_position[1].xyz,light_diffuse[1].rgb, 1.0);
 	col.rgb = scaleDownLight(col.rgb);
 	col.rgb += atmosAmbient(baseCol.rgb);
-	col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, gl_LightSource[0].position.xyz,atmosGetDiffuseSunlightColor() * baseCol.a, 1.0));
+	col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, light_position[0].xyz,atmosGetDiffuseSunlightColor()*baseCol.a, 1.0));
 
 	col.rgb = min(col.rgb * color.rgb, 1.0);
 	specularColor.rgb = min(specularColor.rgb * specularSum.rgb, 1.0);
diff --git a/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl
index c271dbcd18920be785ce378c7fbcb453093b16b0..41288c21c19c4be8a7ecc5052b108bb74fd690d3 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl
@@ -23,7 +23,8 @@
  * $/LicenseInfo$
  */
  
-
+uniform vec4 light_position[8];
+uniform vec3 light_diffuse[8];
 
 float calcDirectionalLight(vec3 n, vec3 l);
 
@@ -36,10 +37,10 @@ vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight)
 	vec4 col;
 	col.a = color.a;
 	
-	col.rgb = gl_LightSource[1].diffuse.rgb * calcDirectionalLight(norm, gl_LightSource[1].position.xyz);
+	col.rgb = light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz);
 	col.rgb = scaleDownLight(col.rgb);
 	col.rgb += atmosAmbient(baseLight.rgb);
-	col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, gl_LightSource[0].position.xyz));
+	col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, light_position[0].xyz));
 	
 	col.rgb = min(col.rgb*color.rgb, 1.0);
 	
diff --git a/indra/newview/app_settings/shaders/class1/objects/bumpF.glsl b/indra/newview/app_settings/shaders/class1/objects/bumpF.glsl
index 11031a8829819a074acd4ea55ecaaa0460e38d98..d55f0db530b0db95788ea39ce428124d67ae969d 100644
--- a/indra/newview/app_settings/shaders/class1/objects/bumpF.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/bumpF.glsl
@@ -22,14 +22,23 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform sampler2D texture0;
 uniform sampler2D texture1;
 
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
+
 void main() 
 {
-	float tex0 = texture2D(texture0, gl_TexCoord[0].xy).a;
-	float tex1 = texture2D(texture1, gl_TexCoord[1].xy).a;
+	float tex0 = texture2D(texture0, vary_texcoord0.xy).a;
+	float tex1 = texture2D(texture1, vary_texcoord1.xy).a;
 
-	gl_FragColor = vec4(tex0+(1.0-tex1)-0.5);
+	frag_color = vec4(tex0+(1.0-tex1)-0.5);
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl
index c50ed86315d172dcfa0873533258e9f9241fb082..a7738087dcc940f41229140b89a9fa54502d85fc 100644
--- a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl
@@ -22,13 +22,21 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec2 texcoord1;
+
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
 
 void main()
 {
 	//transform vertex
-	gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex;
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-	gl_TexCoord[1] = gl_TextureMatrix[1] * gl_MultiTexCoord1;
-	gl_FrontColor = gl_Color;
+	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	vary_texcoord1 = (texture_matrix0 * vec4(texcoord1,0,1)).xy;
 }
diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl
similarity index 65%
rename from indra/newview/app_settings/shaders/class2/objects/simpleV.glsl
rename to indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl
index b0114763c144f4c86b1dec01853072012cd85783..8494ffba5289f7f3c06d74387d6cff315417b77e 100644
--- a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl
@@ -1,5 +1,5 @@
 /** 
- * @file simpleV.glsl
+ * @file emissiveSkinnedV.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -22,30 +22,37 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 projection_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
 
-vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
-void calcAtmospherics(vec3 inPositionEye);
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 emissive;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
-varying float vary_texture_index;
+
+void calcAtmospherics(vec3 inPositionEye);
+mat4 getObjectSkinnedTransform();
 
 void main()
 {
 	//transform vertex
-	vec4 vert = vec4(gl_Vertex.xyz,1.0);
-	vary_texture_index = gl_Vertex.w;
-	gl_Position = gl_ModelViewProjectionMatrix*vert;
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
-	vec4 pos = (gl_ModelViewMatrix * vert);
+	mat4 mat = getObjectSkinnedTransform();
+	
+	mat = modelview_matrix * mat;
+	vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
 	
-	vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
-
 	calcAtmospherics(pos.xyz);
 
-	vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
-	gl_FrontColor = color;
-
-	gl_FogFragCoord = pos.z;
+	vertex_color = emissive;
+	
+	gl_Position = projection_matrix*vec4(pos, 1.0);
+		
+	
 }
diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl
similarity index 63%
rename from indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl
rename to indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl
index 819b28e4fd9d4214aaf742eeb2dcb1953d1401c0..e984deb0c89c10a12ce0547ce4596dce9cad820d 100644
--- a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl
@@ -1,7 +1,7 @@
 /**
- * @file fullbrightShinyV.glsl
+ * @file emissiveV.glsl
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
  * Copyright (C) 2007, Linden Research, Inc.
  * 
@@ -22,32 +22,35 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+void passTextureIndex();
+ATTRIBUTE vec4 emissive;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void calcAtmospherics(vec3 inPositionEye);
 
-uniform vec4 origin;
 
-varying float vary_texture_index;
+
 
 void main()
 {
 	//transform vertex
-	vec4 vert = vec4(gl_Vertex.xyz,1.0);
-	vary_texture_index = gl_Vertex.w;
-	gl_Position = gl_ModelViewProjectionMatrix*vert;
+	passTextureIndex();
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
-	vec4 pos = (gl_ModelViewMatrix * vert);
-	vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
-	vec3 ref = reflect(pos.xyz, -norm);
-
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-	gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
-
+	vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
 	calcAtmospherics(pos.xyz);
 
-	gl_FrontColor = gl_Color;
+	vertex_color = emissive;
 
-	gl_FogFragCoord = pos.z;
+	
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl
index 0fab5e5001007ad0bebf5ce122484ea23206a53d..a54c0caf81079e22e56e76a98257b1ea99a231bc 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl
@@ -20,7 +20,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * 
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
+ * $/LicenseInfo$F
  */
  
 
diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl
similarity index 67%
rename from indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl
rename to indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl
index abf6e37b7cbdd964cce13fb97df42cefdd820527..5d6f14230c73b14a9fd36a94a56d9d45054574cc 100644
--- a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl
@@ -1,5 +1,5 @@
 /**
- * @file fullbrightV.glsl
+ * @file fullbrightNoColorV.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -22,26 +22,32 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec3 normal;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
-void calcAtmospherics(vec3 inPositionEye);
 
-varying float vary_texture_index;
+void calcAtmospherics(vec3 inPositionEye);
 
 void main()
 {
 	//transform vertex
-	vec4 vert = vec4(gl_Vertex.xyz,1.0);
-	vary_texture_index = gl_Vertex.w;
-	gl_Position = gl_ModelViewProjectionMatrix*vert;
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-	
-	vec4 pos = (gl_ModelViewMatrix * vert);
+	vec4 vert = vec4(position.xyz,1.0);
+	vec4 pos = (modelview_matrix * vert);
+	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 
 	calcAtmospherics(pos.xyz);
 
-	gl_FrontColor = gl_Color;
+	vertex_color = vec4(1,1,1,1);
 
-	gl_FogFragCoord = pos.z;
+	
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl
index e1a7f263f7aaaddf479be6325a081ea573815a3c..79b552ee1a9656fcb18a5e93d406ab30cd8d2b6c 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl
@@ -22,6 +22,19 @@
  * $/LicenseInfo$
  */
 
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 modelview_matrix;
+uniform mat4 projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
 
 
 void calcAtmospherics(vec3 inPositionEye);
@@ -31,24 +44,24 @@ void main()
 {
 	mat4 mat = getObjectSkinnedTransform();
 	
-	mat = gl_ModelViewMatrix * mat;
-	vec3 pos = (mat*gl_Vertex).xyz;
+	mat = modelview_matrix * mat;
+	vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
 	
-	vec4 norm = gl_Vertex;
-	norm.xyz += gl_Normal.xyz;
+	vec4 norm = vec4(position.xyz, 1.0);
+	norm.xyz += normal.xyz;
 	norm.xyz = (mat*norm).xyz;
 	norm.xyz = normalize(norm.xyz-pos.xyz);
 		
 	vec3 ref = reflect(pos.xyz, -norm.xyz);
 
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-	gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	vary_texcoord1 = (texture_matrix1*vec4(ref,1.0)).xyz;
 
 	calcAtmospherics(pos.xyz);
 
-	gl_FrontColor = gl_Color;
+	vertex_color = diffuse_color;
+	
+	gl_Position = projection_matrix*vec4(pos, 1.0);
 	
-	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
 	
-	gl_FogFragCoord = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl
index 36b00dfbc109a4cb09b8b3f69ebffdd8e5fe788d..34bd8d445a0eb532d77e10ea45897715bc369c65 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl
@@ -22,28 +22,46 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
 
 
 void calcAtmospherics(vec3 inPositionEye);
 
 uniform vec4 origin;
 
+
+
+ATTRIBUTE vec3 position;
+void passTextureIndex();
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
+
+
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform();
+	vec4 vert = vec4(position.xyz,1.0);
+	passTextureIndex();
+	vec4 pos = (modelview_matrix * vert);
+	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
 	
-	vec4 pos = (gl_ModelViewMatrix * gl_Vertex);
-	vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+	vec3 norm = normalize(normal_matrix * normal);
 	vec3 ref = reflect(pos.xyz, -norm);
 
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-	gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	vary_texcoord1 = (texture_matrix1*vec4(ref,1.0)).xyz;
 
 	calcAtmospherics(pos.xyz);
 
-	gl_FrontColor = gl_Color;
-
-	gl_FogFragCoord = pos.z;
+	vertex_color = diffuse_color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl
index b540054c56cee2b99c40a3183594abae477d00f3..eff75435a9459409ffa579611fca663c6c942fbb 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl
@@ -22,31 +22,36 @@
  * $/LicenseInfo$
  */
 
+uniform mat4 projection_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
 
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
 
 void calcAtmospherics(vec3 inPositionEye);
 mat4 getObjectSkinnedTransform();
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
+
 void main()
 {
 	//transform vertex
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	mat4 mat = getObjectSkinnedTransform();
 	
-	mat = gl_ModelViewMatrix * mat;
-	vec3 pos = (mat*gl_Vertex).xyz;
+	mat = modelview_matrix * mat;
+	vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
 	
-	vec4 norm = gl_Vertex;
-	norm.xyz += gl_Normal.xyz;
-	norm.xyz = (mat*norm).xyz;
-	norm.xyz = normalize(norm.xyz-pos.xyz);
-		
 	calcAtmospherics(pos.xyz);
 
-	gl_FrontColor = gl_Color;
+	vertex_color = diffuse_color;
 	
-	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
+	gl_Position = projection_matrix*vec4(pos, 1.0);
 		
-	gl_FogFragCoord = pos.z;
+	
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl
index 22f731ffde021ddd14dbb2d1da8845fe8b151070..fc20d3270e2a349931b972de5e8a1117b9d0597c 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl
@@ -22,22 +22,37 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
  
+ATTRIBUTE vec3 position;
+void passTextureIndex();
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
 
 
 void calcAtmospherics(vec3 inPositionEye);
 
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
+
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform();
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+	vec4 vert = vec4(position.xyz,1.0);
+	passTextureIndex();
+	vec4 pos = (modelview_matrix * vert);
+	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
-	vec4 pos = (gl_ModelViewMatrix * gl_Vertex);
-
 	calcAtmospherics(pos.xyz);
 
-	gl_FrontColor = gl_Color;
+	vertex_color = diffuse_color;
 
-	gl_FogFragCoord = pos.z;
+	
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl
index 92c09ce93715ff8b5db62898baabf5792d6f5d80..add437d144d8d3fd449fe8334b788b755d7cd122 100644
--- a/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl
@@ -22,23 +22,27 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
-uniform float minimum_alpha;
-uniform float maximum_alpha;
 
-vec3 fullbrightAtmosTransport(vec3 light);
-vec3 fullbrightScaleSoftClip(vec3 light);
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+uniform float minimum_alpha;
 
 uniform sampler2D diffuseMap;
 
+VARYING vec2 vary_texcoord0;
+
 void main()
 {
-	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy);
 	
-	if (color.a < minimum_alpha || color.a > maximum_alpha)
+	if (color.a < minimum_alpha)
 	{
 		discard;
 	}
 
-	gl_FragColor = color;
+	frag_color = color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl
index eea51eba45009973c9e53908529faa8b27e53a5f..e90dbb115a4c8ffc0ab2e7ce142c53cafdf3741e 100644
--- a/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl
@@ -22,13 +22,19 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
- 
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec2 vary_texcoord0;
+
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform();
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-	
-	gl_FrontColor = gl_Color;
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl b/indra/newview/app_settings/shaders/class1/objects/indexedTextureF.glsl
similarity index 86%
rename from indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl
rename to indra/newview/app_settings/shaders/class1/objects/indexedTextureF.glsl
index 78ea15e87a9b38ae4b76ce00a52fb7541af45222..254c1d4fc292962a83b592277162ec9ad5127549 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/indexedTextureF.glsl
@@ -1,5 +1,5 @@
 /** 
- * @file sunLightF.glsl
+ * @file fullbrightF.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -23,13 +23,11 @@
  * $/LicenseInfo$
  */
  
+ 
 
 
-//class 1, no shadow, no SSAO, should never be called
-
-#extension GL_ARB_texture_rectangle : enable
-
 void main() 
 {
-	gl_FragColor = vec4(0,0,0,0);
+	fullbright_lighting();
 }
+
diff --git a/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl b/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..7c0699d72f7a55bd2ba01a7e969901cd924e48d5
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl
@@ -0,0 +1,34 @@
+/** 
+ * @file indexedTextureV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+ATTRIBUTE ivec4 texture_index;
+
+VARYING_FLAT ivec4 vary_texture_index;
+
+void passTextureIndex()
+{
+	vary_texture_index = texture_index;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/objects/nonindexedTextureV.glsl b/indra/newview/app_settings/shaders/class1/objects/nonindexedTextureV.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..80ea286ac04781fe0b96d93ec1b406256a43f60f
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/nonindexedTextureV.glsl
@@ -0,0 +1,31 @@
+/** 
+ * @file nonindexedTextureV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+void passTextureIndex()
+{
+
+}
+
+
diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..5dcfa87066fc95e4ec36e254e007c6f93f9655ce
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
@@ -0,0 +1,57 @@
+/** 
+ * @file previewV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
+
+vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
+void calcAtmospherics(vec3 inPositionEye);
+
+void main()
+{
+	//transform vertex
+	vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+		
+	vec3 norm = normalize(normal_matrix * normal);
+
+	calcAtmospherics(pos.xyz);
+
+	vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.));
+	vertex_color = color;
+
+	
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl
index f5fd4ededd1a34a4fe4ee5cdb3dbdbd5b350c8b4..591d6fc5c94853c3e4d833085a1e9209139b9ec9 100644
--- a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl
@@ -22,7 +22,19 @@
  * $/LicenseInfo$
  */
 
+uniform mat4 projection_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 modelview_matrix;
 
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
@@ -32,23 +44,23 @@ void main()
 {
 	mat4 mat = getObjectSkinnedTransform();
 	
-	mat = gl_ModelViewMatrix * mat;
-	vec3 pos = (mat*gl_Vertex).xyz;
+	mat = modelview_matrix * mat;
+	vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
 	
-	vec4 norm = gl_Vertex;
-	norm.xyz += gl_Normal.xyz;
+	vec4 norm = vec4(position.xyz, 1.0);
+	norm.xyz += normal.xyz;
 	norm.xyz = (mat*norm).xyz;
 	norm.xyz = normalize(norm.xyz-pos.xyz);
 		
 	vec3 ref = reflect(pos.xyz, -norm.xyz);
 
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-	gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	vary_texcoord1 = (texture_matrix1*vec4(ref,1.0)).xyz;
 
 	calcAtmospherics(pos.xyz);
 
-	vec4 color = calcLighting(pos.xyz, norm.xyz, gl_Color, vec4(0.));
-	gl_FrontColor = color;
+	vec4 color = calcLighting(pos.xyz, norm.xyz, diffuse_color, vec4(0.));
+	vertex_color = color;
 	
-	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
+	gl_Position = projection_matrix*vec4(pos, 1.0);
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl
index 13a58f0d4a0093289cdab78d06186e788cb319a3..fdb3453cc581dafaee3aaa16dfc32ef01da119a9 100644
--- a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl
@@ -1,4 +1,4 @@
-/** 
+/**
  * @file shinyV.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
@@ -22,8 +22,24 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+void passTextureIndex();
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
+
+vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 
 void calcAtmospherics(vec3 inPositionEye);
 
@@ -32,19 +48,18 @@ uniform vec4 origin;
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform();
-	
-	vec4 pos = (gl_ModelViewMatrix * gl_Vertex);
-	vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+	vec4 vert = vec4(position.xyz,1.0);
+	passTextureIndex();
+	vec4 pos = (modelview_matrix * vert);
+	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+		
+	vec3 norm = normalize(normal_matrix * normal);
+	vec3 ref = reflect(pos.xyz, -norm);
+
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	vary_texcoord1 = (texture_matrix1*vec4(ref,1.0)).xyz;
 
 	calcAtmospherics(pos.xyz);
-	
-	gl_FrontColor = gl_Color;
-	
-	vec3 ref = reflect(pos.xyz, -norm);
-	
-	gl_TexCoord[0] = gl_TextureMatrix[0]*vec4(ref,1.0);
-	
-	gl_FogFragCoord = pos.z;
-}
 
+	vertex_color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.0));	
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..0be52a52af3a91ff13a030c3ee13488476f86e62
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl
@@ -0,0 +1,59 @@
+/** 
+ * @file simpleNoColorV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+uniform vec4 color;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
+
+vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
+void calcAtmospherics(vec3 inPositionEye);
+
+void main()
+{
+	//transform vertex
+	vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+		
+	vec3 norm = normalize(normal_matrix * normal);
+
+	calcAtmospherics(pos.xyz);
+
+	vec4 col = calcLighting(pos.xyz, norm, color, vec4(0.));
+	vertex_color = col;
+
+	
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleNonIndexedV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleNonIndexedV.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..cb80697d154a7dcb3c8eeef3c51f895e71651a9f
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleNonIndexedV.glsl
@@ -0,0 +1,61 @@
+/** 
+ * @file simpleNonIndexedV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
+
+vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
+void calcAtmospherics(vec3 inPositionEye);
+
+void main()
+{
+	//transform vertex
+	vec4 vert = vec4(position.xyz,1.0);
+	
+	gl_Position = modelview_projection_matrix*vert;
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy;
+	
+	vec4 pos = (modelview_matrix * vert);
+	
+	vec3 norm = normalize(normal_matrix * normal);
+
+	calcAtmospherics(pos.xyz);
+
+	vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
+	vertex_color = color;
+
+	
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl
index ad171f7b4318234a4240479954d4cd2440ebff58..1c6e53b1879c1a84e6a8b0bf9e12b4476530ed55 100644
--- a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl
@@ -22,6 +22,17 @@
  * $/LicenseInfo$
  */
 
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
@@ -31,24 +42,24 @@ mat4 getObjectSkinnedTransform();
 void main()
 {
 	//transform vertex
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	mat4 mat = getObjectSkinnedTransform();
 	
-	mat = gl_ModelViewMatrix * mat;
-	vec3 pos = (mat*gl_Vertex).xyz;
+	mat = modelview_matrix * mat;
+	vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
 	
-	vec4 norm = gl_Vertex;
-	norm.xyz += gl_Normal.xyz;
+	vec4 norm = vec4(position.xyz, 1.0);
+	norm.xyz += normal.xyz;
 	norm.xyz = (mat*norm).xyz;
 	norm.xyz = normalize(norm.xyz-pos.xyz);
 		
 	calcAtmospherics(pos.xyz);
 
-	vec4 color = calcLighting(pos.xyz, norm.xyz, gl_Color, vec4(0.));
-	gl_FrontColor = color;
+	vec4 color = calcLighting(pos.xyz, norm.xyz, diffuse_color, vec4(0.));
+	vertex_color = color;
+	
+	gl_Position = projection_matrix*vec4(pos, 1.0);
 	
-	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
 	
-	gl_FogFragCoord = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleTexGenV.glsl
similarity index 60%
rename from indra/newview/app_settings/shaders/class2/environment/terrainV.glsl
rename to indra/newview/app_settings/shaders/class1/objects/simpleTexGenV.glsl
index 36d0c99b63b42539a506548c55024f08dcaace98..d4dee78793eeebd502a4775969d41373f5d1f74e 100644
--- a/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleTexGenV.glsl
@@ -1,5 +1,5 @@
-/**
- * @file terrainV.glsl
+/** 
+ * @file simpleV.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -22,12 +22,26 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
 
-void calcAtmospherics(vec3 inPositionEye);
+ATTRIBUTE vec3 position;
+void passTextureIndex();
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec3 normal;
+
+uniform vec4 color;
+uniform vec4 object_plane_t;
+uniform vec4 object_plane_s;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
+void calcAtmospherics(vec3 inPositionEye);
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 vec4 texgen_object(vec4  vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)
 {
@@ -46,27 +60,18 @@ vec4 texgen_object(vec4  vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform();
-
-	vec4 pos = gl_ModelViewMatrix * gl_Vertex;
-	vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+	vec4 vert = vec4(position.xyz,1.0);
+	passTextureIndex();
+	vec4 pos = (modelview_matrix * vert);
+	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+	vary_texcoord0.xy = texgen_object(vec4(position.xyz, 1.0), vec4(texcoord0,0,1), texture_matrix0, object_plane_s, object_plane_t).xy;
+		
+	vec3 norm = normalize(normal_matrix * normal);
 
-	/// Potentially better without it for water.
-	pos /= pos.w;
+	calcAtmospherics(pos.xyz);
 
-	calcAtmospherics((gl_ModelViewMatrix * gl_Vertex).xyz);
+	vec4 color = calcLighting(pos.xyz, norm, color, vec4(0.));
+	vertex_color = color;
 
-	vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0));
 	
-	gl_FrontColor = color;
-
-	// Transform and pass tex coords
- 	gl_TexCoord[0].xy = texgen_object(gl_Vertex, gl_MultiTexCoord0, gl_TextureMatrix[0], gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy;
-	
-	vec4 t = gl_MultiTexCoord1;
-	
-	gl_TexCoord[0].zw = t.xy;
-	gl_TexCoord[1].xy = t.xy-vec2(2.0, 0.0);
-	gl_TexCoord[1].zw = t.xy-vec2(1.0, 0.0);
 }
-
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl
index dc1794e132ff216b70221940f85bf593d197e06c..37a20383e2c8499eaba3d370b63f7edab9958de9 100644
--- a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl
@@ -22,26 +22,43 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+void passTextureIndex();
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
 
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
+
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform();
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+	vec4 vert = vec4(position.xyz,1.0);
+	passTextureIndex();
+	vec4 pos = (modelview_matrix * vert);
+	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy;
+	
 	
-	vec4 pos = (gl_ModelViewMatrix * gl_Vertex);
 	
-	vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+	vec3 norm = normalize(normal_matrix * normal);
 
 	calcAtmospherics(pos.xyz);
 
-	vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
-	gl_FrontColor = color;
+	vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
+	vertex_color = color;
 
-	gl_FogFragCoord = pos.z;
+	
 }
diff --git a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl
similarity index 64%
rename from indra/newview/app_settings/shaders/class2/objects/shinyV.glsl
rename to indra/newview/app_settings/shaders/class1/objects/treeV.glsl
index 44c711701bf8890b1b23c475c14b4ab2392d31f4..fa01a27ec0aea2fdc9acfb17536a72617661057e 100644
--- a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl
@@ -1,5 +1,5 @@
-/**
- * @file shinyV.glsl
+/** 
+ * @file treeV.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -22,34 +22,39 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
 
-vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec3 normal;
 
+vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
 
-varying float vary_texture_index;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
-uniform vec4 origin;
 
 void main()
 {
 	//transform vertex
-	vec4 vert = vec4(gl_Vertex.xyz,1.0);
-	vary_texture_index = gl_Vertex.w;
-	gl_Position = gl_ModelViewProjectionMatrix*vert;
+	vec4 vert = vec4(position.xyz,1.0);
 	
-	vec4 pos = (gl_ModelViewMatrix * vert);
-	vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
-	vec3 ref = reflect(pos.xyz, -norm);
-
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-	gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
+	gl_Position = modelview_projection_matrix*vert;
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy;
+	
+	vec4 pos = (modelview_matrix * vert);
+	
+	vec3 norm = normalize(normal_matrix * normal);
 
 	calcAtmospherics(pos.xyz);
 
-	gl_FrontColor = calcLighting(pos.xyz, norm, gl_Color, vec4(0.0));
+	vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.));
+	vertex_color = color;
 
-	gl_FogFragCoord = pos.z;
+	
 }
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl
index 15738e37e82bb7faeb47e950c3d8bce4b9a7d8f5..6ff860362c28285ccd8a838160a102227374a26a 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl
@@ -23,21 +23,22 @@
  * $/LicenseInfo$
  */
  
-
+uniform vec4 sunlight_color_copy;
+uniform vec4 light_ambient;
 
 vec3 atmosAmbient(vec3 light)
 {
-	return gl_LightModel.ambient.rgb + light;
+	return light + light_ambient.rgb;
 }
 
 vec3 atmosAffectDirectionalLight(float lightIntensity)
 {
-	return gl_LightSource[0].diffuse.rgb * lightIntensity;
+	return sunlight_color_copy.rgb * lightIntensity;
 }
 
 vec3 atmosGetDiffuseSunlightColor()
 {
-	return gl_LightSource[0].diffuse.rgb;
+	return sunlight_color_copy.rgb;
 }
 
 vec3 scaleDownLight(vec3 light)
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl
index dbacf286371601d862a7341cff2ccf7c4ab1d209..8bdae328bde8a0c6b79abf657384757a5e9ed0dd 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl
@@ -24,10 +24,7 @@
  */
  
 
-
-varying vec3 vary_PositionEye;
-
 vec3 getPositionEye()
 {
-	return vary_PositionEye;
+	return vec3(0,0,0);
 }
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl
index e051ac9851eb4270502bf5a3113723f0831fee79..8ec9ae617caf4d97face8cd387d178424575d288 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl
@@ -25,15 +25,12 @@
  
 
 
-varying vec3 vary_PositionEye;
-
-
 vec3 getPositionEye()
 {
-	return vary_PositionEye;
+	return vec3(0,0,0);
 }
 
 void setPositionEye(vec3 v)
 {
-	vary_PositionEye = v;
+	
 }
diff --git a/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl
similarity index 85%
rename from indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl
rename to indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl
index 25806cd91426810d613f5b3c5391b429975882c7..636d4af006f164fba5d97f7471ef97c9394e4843 100644
--- a/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl
@@ -1,5 +1,5 @@
-/**
- * @file drawQuadV.glsl
+/** 
+ * @file atmosphericVarsWaterF.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -24,11 +24,10 @@
  */
  
 
+VARYING vec3 vary_PositionEye;
 
-void main(void)
+vec3 getPositionEye()
 {
-	//transform vertex
-	gl_Position = ftransform();
-	gl_TexCoord[0] = gl_MultiTexCoord0;
-	gl_TexCoord[1] = gl_MultiTexCoord1;
+	return vary_PositionEye;
 }
+
diff --git a/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl
similarity index 83%
rename from indra/newview/app_settings/shaders/class2/effects/simpleF.glsl
rename to indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl
index abf1be6645c7e53075a97477c71c270204926d7e..8afcc20f6d190f903a0e95863eda7d62f53c2cdd 100644
--- a/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl
@@ -1,5 +1,5 @@
-/**
- * @file simpleF.glsl
+/** 
+ * @file atmosphericVarsWaterV.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -23,12 +23,15 @@
  * $/LicenseInfo$
  */
  
+ 
+VARYING vec3 vary_PositionEye;
 
+vec3 getPositionEye()
+{
+	return vary_PositionEye;
+}
 
-uniform sampler2DRect RenderTexture;
-
-void main(void) 
+void setPositionEye(vec3 v)
 {
-	vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st));
-	gl_FragColor = vec4(1.0 - color, 1.0);
+	vary_PositionEye = v;
 }
diff --git a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl
index f9f376c2b7308d933f32a08feb5f11dba6fc6ab8..5af9f5c902b3ee23e27cf7c1ad63808644fdbfa2 100644
--- a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl
+++ b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl
@@ -22,7 +22,19 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 
 vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol);
@@ -31,20 +43,20 @@ void calcAtmospherics(vec3 inPositionEye);
 void main()
 {
 	//transform vertex
-	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-	
-	vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
-	vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+	vec3 pos = (modelview_matrix * vec4(position.xyz, 1.0)).xyz;
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+		
+	vec3 norm = normalize(normal_matrix * normal);
 
 	calcAtmospherics(pos.xyz);
 	
 	// vec4 specular = specularColor;
 	vec4 specular = vec4(1.0);
-	vec4 color = calcLightingSpecular(pos, norm, gl_Color, specular, vec4(0.0));
+	vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0));
 			
-	gl_FrontColor = color;
-	gl_FogFragCoord = pos.z;
+	vertex_color = color;
+	
 
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index 839606cdcb888aa1bae9d1ea0a9e7b070e64bcf5..08f6ec63fe209cb479b34e6b33e1422ede9f98c8 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -22,11 +22,18 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
-
 
 #extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 uniform sampler2DRectShadow shadowMap0;
 uniform sampler2DRectShadow shadowMap1;
 uniform sampler2DRectShadow shadowMap2;
@@ -41,29 +48,16 @@ uniform vec2 shadow_res;
 vec3 atmosLighting(vec3 light);
 vec3 scaleSoftClip(vec3 light);
 
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_fragcoord;
-varying vec3 vary_position;
-varying vec3 vary_pointlight_col;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_position;
+VARYING vec3 vary_pointlight_col;
 
 uniform float shadow_bias;
 
 uniform mat4 inv_proj;
 
-vec4 getPosition(vec2 pos_screen)
-{
-	float depth = texture2DRect(depthMap, pos_screen.xy).a;
-	vec2 sc = pos_screen.xy*2.0;
-	sc /= screen_res;
-	sc -= vec2(1.0,1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos.xyz /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
 float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl)
 {
 	stc.xyz /= stc.w;
@@ -86,7 +80,7 @@ void main()
 	vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
 	frag *= screen_res;
 	
-	float shadow = 1.0;
+	float shadow = 0.0;
 	vec4 pos = vec4(vary_position, 1.0);
 	
 	vec4 spos = pos;
@@ -95,36 +89,70 @@ void main()
 	{	
 		vec4 lpos;
 		
-		if (spos.z < -shadow_clip.z)
+		vec4 near_split = shadow_clip*-0.75;
+		vec4 far_split = shadow_clip*-1.25;
+		vec4 transition_domain = near_split-far_split;
+		float weight = 0.0;
+
+		if (spos.z < near_split.z)
 		{
 			lpos = shadow_matrix[3]*spos;
 			lpos.xy *= shadow_res;
-			shadow = pcfShadow(shadowMap3, lpos, 1.5);
+
+			float w = 1.0;
+			w -= max(spos.z-far_split.z, 0.0)/transition_domain.z;
+			shadow += pcfShadow(shadowMap3, lpos, 0.25)*w;
+			weight += w;
 			shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
 		}
-		else if (spos.z < -shadow_clip.y)
+
+		if (spos.z < near_split.y && spos.z > far_split.z)
 		{
 			lpos = shadow_matrix[2]*spos;
 			lpos.xy *= shadow_res;
-			shadow = pcfShadow(shadowMap2, lpos, 1.5);
+
+			float w = 1.0;
+			w -= max(spos.z-far_split.y, 0.0)/transition_domain.y;
+			w -= max(near_split.z-spos.z, 0.0)/transition_domain.z;
+			shadow += pcfShadow(shadowMap2, lpos, 0.75)*w;
+			weight += w;
 		}
-		else if (spos.z < -shadow_clip.x)
+
+		if (spos.z < near_split.x && spos.z > far_split.y)
 		{
 			lpos = shadow_matrix[1]*spos;
 			lpos.xy *= shadow_res;
-			shadow = pcfShadow(shadowMap1, lpos, 1.5);
+
+			float w = 1.0;
+			w -= max(spos.z-far_split.x, 0.0)/transition_domain.x;
+			w -= max(near_split.y-spos.z, 0.0)/transition_domain.y;
+			shadow += pcfShadow(shadowMap1, lpos, 0.75)*w;
+			weight += w;
 		}
-		else
+
+		if (spos.z > far_split.x)
 		{
 			lpos = shadow_matrix[0]*spos;
 			lpos.xy *= shadow_res;
-			shadow = pcfShadow(shadowMap0, lpos, 1.5);
+				
+			float w = 1.0;
+			w -= max(near_split.x-spos.z, 0.0)/transition_domain.x;
+				
+			shadow += pcfShadow(shadowMap0, lpos, 1.0)*w;
+			weight += w;
 		}
+		
+
+		shadow /= weight;
+	}
+	else
+	{
+		shadow = 1.0;
 	}
 	
-	vec4 diff = diffuseLookup(gl_TexCoord[0].xy);
+	vec4 diff = diffuseLookup(vary_texcoord0.xy);
 
-	vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, gl_Color.a);
+	vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, vertex_color.a);
 	vec4 color = diff * col;
 	
 	color.rgb = atmosLighting(color.rgb);
@@ -133,10 +161,6 @@ void main()
 
 	color.rgb += diff.rgb * vary_pointlight_col.rgb;
 
-	//gl_FragColor = gl_Color;
-	gl_FragColor = color;
-	//gl_FragColor.r = 0.0;
-	//gl_FragColor = vec4(1,shadow,1,1);
-	
+	frag_color = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl
index 84e49a5f8f1c33a5eca72e424822f7ee2a64d13c..aae6a070e294fd2b45fe953a30f3caa72f9a6df0 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl
@@ -23,10 +23,14 @@
  * $/LicenseInfo$
  */
  
-
-
 #extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform sampler2DRectShadow shadowMap0;
 uniform sampler2DRectShadow shadowMap1;
 uniform sampler2DRectShadow shadowMap2;
@@ -42,11 +46,13 @@ uniform vec2 shadow_res;
 vec3 atmosLighting(vec3 light);
 vec3 scaleSoftClip(vec3 light);
 
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_fragcoord;
-varying vec3 vary_position;
-varying vec3 vary_pointlight_col;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_position;
+VARYING vec3 vary_pointlight_col;
+VARYING vec2 vary_texcoord0;
+VARYING vec4 vertex_color;
 
 uniform float shadow_bias;
 
@@ -87,7 +93,7 @@ void main()
 	vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
 	frag *= screen_res;
 	
-	float shadow = 1.0;
+	float shadow = 0.0;
 	vec4 pos = vec4(vary_position, 1.0);
 	
 	vec4 spos = pos;
@@ -96,36 +102,71 @@ void main()
 	{	
 		vec4 lpos;
 		
-		if (spos.z < -shadow_clip.z)
+		vec4 near_split = shadow_clip*-0.75;
+		vec4 far_split = shadow_clip*-1.25;
+		vec4 transition_domain = near_split-far_split;
+		float weight = 0.0;
+
+		if (spos.z < near_split.z)
 		{
 			lpos = shadow_matrix[3]*spos;
 			lpos.xy *= shadow_res;
-			shadow = pcfShadow(shadowMap3, lpos, 1.5);
+
+			float w = 1.0;
+			w -= max(spos.z-far_split.z, 0.0)/transition_domain.z;
+			shadow += pcfShadow(shadowMap3, lpos, 0.25)*w;
+			weight += w;
 			shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
 		}
-		else if (spos.z < -shadow_clip.y)
+
+		if (spos.z < near_split.y && spos.z > far_split.z)
 		{
 			lpos = shadow_matrix[2]*spos;
 			lpos.xy *= shadow_res;
-			shadow = pcfShadow(shadowMap2, lpos, 1.5);
+
+			float w = 1.0;
+			w -= max(spos.z-far_split.y, 0.0)/transition_domain.y;
+			w -= max(near_split.z-spos.z, 0.0)/transition_domain.z;
+			shadow += pcfShadow(shadowMap2, lpos, 0.75)*w;
+			weight += w;
 		}
-		else if (spos.z < -shadow_clip.x)
+
+		if (spos.z < near_split.x && spos.z > far_split.y)
 		{
 			lpos = shadow_matrix[1]*spos;
 			lpos.xy *= shadow_res;
-			shadow = pcfShadow(shadowMap1, lpos, 1.5);
+
+			float w = 1.0;
+			w -= max(spos.z-far_split.x, 0.0)/transition_domain.x;
+			w -= max(near_split.y-spos.z, 0.0)/transition_domain.y;
+			shadow += pcfShadow(shadowMap1, lpos, 0.75)*w;
+			weight += w;
 		}
-		else
+
+		if (spos.z > far_split.x)
 		{
 			lpos = shadow_matrix[0]*spos;
 			lpos.xy *= shadow_res;
-			shadow = pcfShadow(shadowMap0, lpos, 1.5);
+				
+			float w = 1.0;
+			w -= max(near_split.x-spos.z, 0.0)/transition_domain.x;
+				
+			shadow += pcfShadow(shadowMap0, lpos, 1.0)*w;
+			weight += w;
 		}
+		
+
+		shadow /= weight;
+
+	}
+	else
+	{
+		shadow = 1.0;
 	}
-	
-	vec4 diff = texture2D(diffuseMap,gl_TexCoord[0].xy);
 
-	vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, gl_Color.a);
+	vec4 diff = texture2D(diffuseMap,vary_texcoord0.xy);
+
+	vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, vertex_color.a);
 	vec4 color = diff * col;
 	
 	color.rgb = atmosLighting(color.rgb);
@@ -134,10 +175,6 @@ void main()
 
 	color.rgb += diff.rgb * vary_pointlight_col.rgb;
 
-	//gl_FragColor = gl_Color;
-	gl_FragColor = color;
-	//gl_FragColor.r = 0.0;
-	//gl_FragColor = vec4(1,shadow,1,1);
-	
+	frag_color = color;	
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..931577359e5db39db990804c12684423b29e3487
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl
@@ -0,0 +1,178 @@
+/** 
+ * @file alphaNonIndexedNoColorF.glsl
+ *
+ * $LicenseInfo:firstyear=2005&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2005, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+ 
+#extension GL_ARB_texture_rectangle : enable
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+uniform sampler2DRectShadow shadowMap0;
+uniform sampler2DRectShadow shadowMap1;
+uniform sampler2DRectShadow shadowMap2;
+uniform sampler2DRectShadow shadowMap3;
+uniform sampler2DRect depthMap;
+uniform sampler2D diffuseMap;
+
+uniform mat4 shadow_matrix[6];
+uniform vec4 shadow_clip;
+uniform vec2 screen_res;
+uniform vec2 shadow_res;
+
+vec3 atmosLighting(vec3 light);
+vec3 scaleSoftClip(vec3 light);
+
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_position;
+VARYING vec3 vary_pointlight_col;
+VARYING vec2 vary_texcoord0;
+
+uniform float shadow_bias;
+
+uniform mat4 inv_proj;
+
+vec4 getPosition(vec2 pos_screen)
+{
+	float depth = texture2DRect(depthMap, pos_screen.xy).a;
+	vec2 sc = pos_screen.xy*2.0;
+	sc /= screen_res;
+	sc -= vec2(1.0,1.0);
+	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
+	vec4 pos = inv_proj * ndc;
+	pos.xyz /= pos.w;
+	pos.w = 1.0;
+	return pos;
+}
+
+float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl)
+{
+	stc.xyz /= stc.w;
+	stc.z += shadow_bias;
+	
+	float cs = shadow2DRect(shadowMap, stc.xyz).x;
+	float shadow = cs;
+
+	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(scl, scl, 0.0)).x, cs);
+	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(scl, -scl, 0.0)).x, cs);
+	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-scl, scl, 0.0)).x, cs);
+	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-scl, -scl, 0.0)).x, cs);
+			
+	return shadow/5.0;
+}
+
+
+void main() 
+{
+	vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
+	frag *= screen_res;
+	
+	float shadow = 0.0;
+	vec4 pos = vec4(vary_position, 1.0);
+	
+	vec4 spos = pos;
+		
+	if (spos.z > -shadow_clip.w)
+	{	
+		vec4 lpos;
+		
+		vec4 near_split = shadow_clip*-0.75;
+		vec4 far_split = shadow_clip*-1.25;
+		vec4 transition_domain = near_split-far_split;
+		float weight = 0.0;
+
+		if (spos.z < near_split.z)
+		{
+			lpos = shadow_matrix[3]*spos;
+			lpos.xy *= shadow_res;
+
+			float w = 1.0;
+			w -= max(spos.z-far_split.z, 0.0)/transition_domain.z;
+			shadow += pcfShadow(shadowMap3, lpos, 0.25)*w;
+			weight += w;
+			shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
+		}
+
+		if (spos.z < near_split.y && spos.z > far_split.z)
+		{
+			lpos = shadow_matrix[2]*spos;
+			lpos.xy *= shadow_res;
+
+			float w = 1.0;
+			w -= max(spos.z-far_split.y, 0.0)/transition_domain.y;
+			w -= max(near_split.z-spos.z, 0.0)/transition_domain.z;
+			shadow += pcfShadow(shadowMap2, lpos, 0.75)*w;
+			weight += w;
+		}
+
+		if (spos.z < near_split.x && spos.z > far_split.y)
+		{
+			lpos = shadow_matrix[1]*spos;
+			lpos.xy *= shadow_res;
+
+			float w = 1.0;
+			w -= max(spos.z-far_split.x, 0.0)/transition_domain.x;
+			w -= max(near_split.y-spos.z, 0.0)/transition_domain.y;
+			shadow += pcfShadow(shadowMap1, lpos, 0.75)*w;
+			weight += w;
+		}
+
+		if (spos.z > far_split.x)
+		{
+			lpos = shadow_matrix[0]*spos;
+			lpos.xy *= shadow_res;
+				
+			float w = 1.0;
+			w -= max(near_split.x-spos.z, 0.0)/transition_domain.x;
+				
+			shadow += pcfShadow(shadowMap0, lpos, 1.0)*w;
+			weight += w;
+		}
+		
+
+		shadow /= weight;
+	}
+	else
+	{
+		shadow = 1.0;
+	}
+	
+	vec4 diff = texture2D(diffuseMap,vary_texcoord0.xy);
+
+	vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, 1.0);
+	vec4 color = diff * col;
+	
+	color.rgb = atmosLighting(color.rgb);
+
+	color.rgb = scaleSoftClip(color.rgb);
+
+	color.rgb += diff.rgb * vary_pointlight_col.rgb;
+
+	frag_color = color;
+}
+
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
index 20121da52d2403eed6b850724ee7f02215c7f248..9629cfe824e6f312755be7bd07b8ab7ee567efa4 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
@@ -21,8 +21,16 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 projection_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+ 
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
@@ -34,33 +42,48 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
 vec3 scaleDownLight(vec3 light);
 vec3 scaleUpLight(vec3 light);
 
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_fragcoord;
-varying vec3 vary_position;
-varying vec3 vary_pointlight_col;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_position;
+VARYING vec3 vary_pointlight_col;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 
 uniform float near_clip;
 uniform float shadow_offset;
 uniform float shadow_bias;
 
+uniform vec4 light_position[8];
+uniform vec3 light_direction[8];
+uniform vec3 light_attenuation[8]; 
+uniform vec3 light_diffuse[8];
+
+float calcDirectionalLight(vec3 n, vec3 l)
+{
+        float a = max(dot(n,l),0.0);
+        return a;
+}
+
 float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
 {
-	//get light vector
+//get light vector
 	vec3 lv = lp.xyz-v;
 	
 	//get distance
-	float d = length(lv);
+	float d = dot(lv,lv);
 	
 	float da = 0.0;
 
 	if (d > 0.0 && la > 0.0 && fa > 0.0)
 	{
 		//normalize light vector
-		lv *= 1.0/d;
+		lv = normalize(lv);
 	
 		//distance attenuation
-		float dist2 = d*d/(la*la);
+		float dist2 = d/la;
 		da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
 
 		// spotlight coefficient.
@@ -68,7 +91,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
 		da *= spot*spot; // GL_SPOT_EXPONENT=2
 
 		//angular attenuation
-		da *= calcDirectionalLight(n, lv);
+		da *= max(dot(n, lv), 0.0);		
 	}
 
 	return da;	
@@ -76,56 +99,56 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
 
 void main()
 {
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	mat4 mat = getObjectSkinnedTransform();
 	
-	mat = gl_ModelViewMatrix * mat;
+	mat = modelview_matrix * mat;
 	
-	vec3 pos = (mat*gl_Vertex).xyz;
+	vec3 pos = (mat*vec4(position, 1.0)).xyz;
 	
-	gl_Position = gl_ProjectionMatrix * vec4(pos, 1.0);
+	gl_Position = projection_matrix * vec4(pos, 1.0);
 	
-	vec4 n = gl_Vertex;
-	n.xyz += gl_Normal.xyz;
+	vec4 n = vec4(position, 1.0);
+	n.xyz += normal.xyz;
 	n.xyz = (mat*n).xyz;
 	n.xyz = normalize(n.xyz-pos.xyz);
 	
 	vec3 norm = n.xyz;
 	
-	float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz));
-	vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset;
+	float dp_directional_light = max(0.0, dot(norm, light_position[0].xyz));
+	vary_position = pos.xyz + light_position[0].xyz * (1.0-dp_directional_light)*shadow_offset;
 			
 	calcAtmospherics(pos.xyz);
 
-	//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
-	vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+	//vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
+	vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);
 
 	// Collect normal lights
-	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
-	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a);
-	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a);
-	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a);
-	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
-	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
+	col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].y, light_attenuation[2].z);
+	col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].y, light_attenuation[3].z);
+	col.rgb += light_diffuse[4].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[4], light_direction[4], light_attenuation[4].x, light_attenuation[4].y, light_attenuation[4].z);
+	col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].y, light_attenuation[5].z);
+	col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].y, light_attenuation[6].z);
+	col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].y, light_attenuation[7].z);
 	
-	vary_pointlight_col = col.rgb*gl_Color.rgb;
+	vary_pointlight_col = col.rgb*diffuse_color.rgb;
 
 	col.rgb = vec3(0,0,0);
 
 	// Add windlight lights
 	col.rgb = atmosAmbient(vec3(0.));
 		
-	vary_ambient = col.rgb*gl_Color.rgb;
-	vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+	vary_ambient = col.rgb*diffuse_color.rgb;
+	vary_directional.rgb = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a)));
 	
-	col.rgb = min(col.rgb*gl_Color.rgb, 1.0);
+	col.rgb = min(col.rgb*diffuse_color.rgb, 1.0);
 	
-	gl_FrontColor = col;
+	vertex_color = col;
 
-	gl_FogFragCoord = pos.z;
 	
-	pos.xyz = (gl_ModelViewProjectionMatrix * gl_Vertex).xyz;
+	
+	pos.xyz = (modelview_projection_matrix * vec4(position.xyz, 1.0)).xyz;
 	vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
 	
 }
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
index 307ae300987dac18bb6c0c4f90293d8384c2f5a8..1586aab0f25587cd34ae815f330535af4d8b0f1c 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
@@ -22,8 +22,17 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+void passTextureIndex();
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
@@ -35,34 +44,48 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
 vec3 scaleDownLight(vec3 light);
 vec3 scaleUpLight(vec3 light);
 
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_fragcoord;
-varying vec3 vary_position;
-varying vec3 vary_pointlight_col;
-varying float vary_texture_index;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_position;
+VARYING vec3 vary_pointlight_col;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 
 uniform float near_clip;
 uniform float shadow_offset;
 uniform float shadow_bias;
 
+uniform vec4 light_position[8];
+uniform vec3 light_direction[8];
+uniform vec3 light_attenuation[8]; 
+uniform vec3 light_diffuse[8];
+
+float calcDirectionalLight(vec3 n, vec3 l)
+{
+        float a = max(dot(n,l),0.0);
+        return a;
+}
+
 float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
 {
 	//get light vector
 	vec3 lv = lp.xyz-v;
 	
 	//get distance
-	float d = length(lv);
+	float d = dot(lv,lv);
 	
 	float da = 0.0;
 
 	if (d > 0.0 && la > 0.0 && fa > 0.0)
 	{
 		//normalize light vector
-		lv *= 1.0/d;
+		lv = normalize(lv);
 	
 		//distance attenuation
-		float dist2 = d*d/(la*la);
+		float dist2 = d/la;
 		da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
 
 		// spotlight coefficient.
@@ -70,7 +93,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
 		da *= spot*spot; // GL_SPOT_EXPONENT=2
 
 		//angular attenuation
-		da *= calcDirectionalLight(n, lv);
+		da *= max(dot(n, lv), 0.0);		
 	}
 
 	return da;	
@@ -79,48 +102,49 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
 void main()
 {
 	//transform vertex
-	vec4 vert = vec4(gl_Vertex.xyz, 1.0);
-	vary_texture_index = gl_Vertex.w;
-	gl_Position = gl_ModelViewProjectionMatrix * vert; 
+	vec4 vert = vec4(position.xyz, 1.0);
+	passTextureIndex();
+	vec4 pos = (modelview_matrix * vert);
+	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
 	
-	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-	
-	vec4 pos = (gl_ModelViewMatrix * vert);
-	vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+		
+	vec3 norm = normalize(normal_matrix * normal);
 	
-	float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz));
-	vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset;
+	float dp_directional_light = max(0.0, dot(norm, light_position[0].xyz));
+	vary_position = pos.xyz + light_position[0].xyz * (1.0-dp_directional_light)*shadow_offset;
 		
 	calcAtmospherics(pos.xyz);
 
-	//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
-	vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+	//vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
+	vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);
 
-	// Collect normal lights
-	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
-	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a);
-	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a);
-	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a);
-	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
-	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
 	
-	vary_pointlight_col = col.rgb*gl_Color.rgb;
+	// Collect normal lights
+	col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].y, light_attenuation[2].z);
+	col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].y, light_attenuation[3].z);
+	col.rgb += light_diffuse[4].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[4], light_direction[4], light_attenuation[4].x, light_attenuation[4].y, light_attenuation[4].z);
+	col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].y, light_attenuation[5].z);
+	col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].y, light_attenuation[6].z);
+	col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].y, light_attenuation[7].z);
+
+	vary_pointlight_col = col.rgb*diffuse_color.rgb;
 
 	col.rgb = vec3(0,0,0);
 
 	// Add windlight lights
 	col.rgb = atmosAmbient(vec3(0.));
 	
-	vary_ambient = col.rgb*gl_Color.rgb;
-	vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+	vary_ambient = col.rgb*diffuse_color.rgb;
+	vary_directional.rgb = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a)));
 	
-	col.rgb = col.rgb*gl_Color.rgb;
+	col.rgb = col.rgb*diffuse_color.rgb;
 	
-	gl_FrontColor = col;
+	vertex_color = col;
 
-	gl_FogFragCoord = pos.z;
 	
-	pos = gl_ModelViewProjectionMatrix * vert;
+	
+	pos = modelview_projection_matrix * vert;
 	vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
 	
 }
diff --git a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
index 80f386ecb03a24514c26cbd1f133e6b48b34435d..44aaa98b977e49c6688f7b1ac4cf05db35162463 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
@@ -23,7 +23,11 @@
  * $/LicenseInfo$
  */
  
+uniform mat4 projection_matrix;
 
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 mat4 getSkinnedTransform();
@@ -37,33 +41,48 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
 vec3 scaleDownLight(vec3 light);
 vec3 scaleUpLight(vec3 light);
 
-varying vec3 vary_position;
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_fragcoord;
-varying vec3 vary_pointlight_col;
+VARYING vec3 vary_position;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_pointlight_col;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
+uniform vec4 color;
 
 uniform float near_clip;
 uniform float shadow_offset;
 uniform float shadow_bias;
 
+uniform vec4 light_position[8];
+uniform vec3 light_direction[8];
+uniform vec3 light_attenuation[8]; 
+uniform vec3 light_diffuse[8];
+
+float calcDirectionalLight(vec3 n, vec3 l)
+{
+        float a = max(dot(n,l),0.0);
+        return a;
+}
+
 float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
 {
 	//get light vector
 	vec3 lv = lp.xyz-v;
 	
 	//get distance
-	float d = length(lv);
+	float d = dot(lv,lv);
 	
 	float da = 0.0;
 
 	if (d > 0.0 && la > 0.0 && fa > 0.0)
 	{
 		//normalize light vector
-		lv *= 1.0/d;
+		lv = normalize(lv);
 	
 		//distance attenuation
-		float dist2 = d*d/(la*la);
+		float dist2 = d/la;
 		da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
 
 		// spotlight coefficient.
@@ -71,7 +90,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
 		da *= spot*spot; // GL_SPOT_EXPONENT=2
 
 		//angular attenuation
-		da *= calcDirectionalLight(n, lv);
+		da *= max(dot(n, lv), 0.0);		
 	}
 
 	return da;	
@@ -79,56 +98,55 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
 
 void main()
 {
-	gl_TexCoord[0] = gl_MultiTexCoord0;
+	vary_texcoord0 = texcoord0;
 				
 	vec4 pos;
 	vec3 norm;
 	
 	mat4 trans = getSkinnedTransform();
-	pos.x = dot(trans[0], gl_Vertex);
-	pos.y = dot(trans[1], gl_Vertex);
-	pos.z = dot(trans[2], gl_Vertex);
+	vec4 pos_in = vec4(position.xyz, 1.0);
+	pos.x = dot(trans[0], pos_in);
+	pos.y = dot(trans[1], pos_in);
+	pos.z = dot(trans[2], pos_in);
 	pos.w = 1.0;
 	
-	norm.x = dot(trans[0].xyz, gl_Normal);
-	norm.y = dot(trans[1].xyz, gl_Normal);
-	norm.z = dot(trans[2].xyz, gl_Normal);
+	norm.x = dot(trans[0].xyz, normal);
+	norm.y = dot(trans[1].xyz, normal);
+	norm.z = dot(trans[2].xyz, normal);
 	norm = normalize(norm);
 		
-	gl_Position = gl_ProjectionMatrix * pos;
+	gl_Position = projection_matrix * pos;
 	
-	float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz));
-	vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset;
+	float dp_directional_light = max(0.0, dot(norm, light_position[0].xyz));
+	vary_position = pos.xyz + light_position[0].xyz * (1.0-dp_directional_light)*shadow_offset;
 	
 	calcAtmospherics(pos.xyz);
 
-	//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
-
-	vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+	vec4 col = vec4(0.0, 0.0, 0.0, 1.0);
 
 	// Collect normal lights
-	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
-	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a);
-	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a);
-	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a);
-	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
-	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
+	col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].y, light_attenuation[2].z);
+	col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].y, light_attenuation[3].z);
+	col.rgb += light_diffuse[4].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[4], light_direction[4], light_attenuation[4].x, light_attenuation[4].y, light_attenuation[4].z);
+	col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].y, light_attenuation[5].z);
+	col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].y, light_attenuation[6].z);
+	col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].y, light_attenuation[7].z);
 	
-	vary_pointlight_col = col.rgb*gl_Color.rgb;
+	vary_pointlight_col = col.rgb*color.rgb;
 
 	col.rgb = vec3(0,0,0);
 
 	// Add windlight lights
 	col.rgb = atmosAmbient(vec3(0.));
 	
-	vary_ambient = col.rgb*gl_Color.rgb;
-	vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+	vary_ambient = col.rgb*color.rgb;
+	vary_directional = atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), 0.0));
 	
-	col.rgb = min(col.rgb*gl_Color.rgb, 1.0);
+	col.rgb = col.rgb*color.rgb;
 	
-	gl_FrontColor = col;
+	vertex_color = col;
 
-	gl_FogFragCoord = pos.z;
+	
 	vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl
deleted file mode 100644
index a84fdd5dc139acfc158558c0fc7ba8e19e829ac9..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl
+++ /dev/null
@@ -1,92 +0,0 @@
-/** 
- * @file edgeF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-uniform sampler2DMS depthMap;
-uniform sampler2DMS normalMap;
-
-varying vec2 vary_fragcoord;
-
-uniform float depth_cutoff;
-uniform float norm_cutoff;
-
-uniform mat4 inv_proj;
-uniform vec2 screen_res;
-
-float getDepth(ivec2 pos_screen, int sample)
-{
-	float z = texelFetch(depthMap, pos_screen, sample).r;
-	z = z*2.0-1.0;
-	vec4 ndc = vec4(0.0, 0.0, z, 1.0);
-	vec4 p = inv_proj*ndc;
-	return p.z/p.w;
-}
-
-void main() 
-{
-	float e = 0;
-	
-	ivec2 itc = ivec2(vary_fragcoord.xy);
-
-	for (int i = 0; i < samples; i++)
-	{	
-		vec3 norm = texelFetch(normalMap, itc, i).xyz;
-		norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
-		float depth = getDepth(itc, i);
-	
-		vec2 tc = vary_fragcoord.xy;
-	
-		int sc = 1;
-	
-		vec2 de;
-		de.x = (depth-getDepth(itc+ivec2(sc, sc),i)) + (depth-getDepth(itc+ivec2(-sc, -sc), i));
-		de.y = (depth-getDepth(itc+ivec2(-sc, sc),i)) + (depth-getDepth(itc+ivec2(sc, -sc), i));
-		de /= depth;
-		de *= de;
-		de = step(depth_cutoff, de);
-	
-		vec2 ne;
-		vec3 nexnorm = texelFetch(normalMap, itc+ivec2(-sc,-sc), i).rgb;
-		nexnorm = vec3((nexnorm.xy-0.5)*2.0,nexnorm.z); // unpack norm
-		ne.x = dot(nexnorm, norm);
-		vec3 neynorm = texelFetch(normalMap, itc+ivec2(sc,sc), i).rgb;
-		neynorm = vec3((neynorm.xy-0.5)*2.0,neynorm.z); // unpack norm
-		ne.y = dot(neynorm, norm);
-	
-		ne = 1.0-ne;
-	
-		ne = step(norm_cutoff, ne);
-
-		e += dot(de,de)+dot(ne,ne);
-	}
-
-	e /= samples;
-	
-	gl_FragColor.a = e;
-}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
index 0b31cbefd18282b5b63800f66292913f3eb74c8a..f7f1f649ced54a71ab5d56f6e2f466fe86a524ac 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
@@ -22,11 +22,15 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
-
-
-
+ 
 #extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform sampler2DRect diffuseRect;
 uniform sampler2DRect specularRect;
 uniform sampler2DRect depthMap;
@@ -34,7 +38,6 @@ uniform sampler2DRect normalMap;
 uniform samplerCube environmentMap;
 uniform sampler2DRect lightMap;
 uniform sampler2D noiseMap;
-uniform sampler2D lightFunc;
 uniform sampler2D projectionMap;
 
 uniform mat4 proj_mat; //screen space to light space
@@ -54,9 +57,12 @@ uniform float sun_wash;
 uniform int proj_shadow_idx;
 uniform float shadow_fade;
 
-varying vec4 vary_light;
+uniform vec3 center;
+uniform float size;
+uniform vec3 color;
+uniform float falloff;
 
-varying vec4 vary_fragcoord;
+VARYING vec4 vary_fragcoord;
 uniform vec2 screen_res;
 
 uniform mat4 inv_proj;
@@ -128,9 +134,9 @@ void main()
 	frag.xy *= screen_res;
 	
 	vec3 pos = getPosition(frag.xy).xyz;
-	vec3 lv = vary_light.xyz-pos.xyz;
+	vec3 lv = center.xyz-pos.xyz;
 	float dist2 = dot(lv,lv);
-	dist2 /= vary_light.w;
+	dist2 /= size;
 	if (dist2 > 1.0)
 	{
 		discard;
@@ -161,7 +167,7 @@ void main()
 	
 	proj_tc.xyz /= proj_tc.w;
 	
-	float fa = gl_Color.a+1.0;
+	float fa = falloff+1.0;
 	float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
 	if (dist_atten <= 0.0)
 	{
@@ -193,7 +199,7 @@ void main()
 			
 			vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod);
 		
-			vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
+			vec3 lcol = color.rgb * plcol.rgb * plcol.a;
 			
 			lit = da * dist_atten * noise;
 			
@@ -210,7 +216,7 @@ void main()
 			
 		amb_da = min(amb_da, 1.0-lit);
 			
-		col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
+		col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
 	}
 	
 	
@@ -243,12 +249,12 @@ void main()
 					stc.y > 0.0)
 				{
 					vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
-					col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow;
+					col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb*shadow;
 				}
 			}
 		}
 	}
 	
-	gl_FragColor.rgb = col;	
-	gl_FragColor.a = 0.0;
+	frag_color.rgb = col;	
+	frag_color.a = 0.0;
 }
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl
deleted file mode 100644
index 1afa9a9fb40c3cce6972f81e3ec8faaec417eab3..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl
+++ /dev/null
@@ -1,262 +0,0 @@
-/** 
- * @file multiSpotLightF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-uniform sampler2DMS diffuseRect;
-uniform sampler2DMS specularRect;
-uniform sampler2DMS depthMap;
-uniform sampler2DMS normalMap;
-uniform sampler2DRect lightMap;
-uniform sampler2D noiseMap;
-uniform sampler2D lightFunc;
-uniform sampler2D projectionMap;
-
-uniform mat4 proj_mat; //screen space to light space
-uniform float proj_near; //near clip for projection
-uniform vec3 proj_p; //plane projection is emitting from (in screen space)
-uniform vec3 proj_n;
-uniform float proj_focus; //distance from plane to begin blurring
-uniform float proj_lod;  //(number of mips in proj map)
-uniform float proj_range; //range between near clip and far clip plane of projection
-uniform float proj_ambient_lod;
-uniform float proj_ambiance;
-uniform float near_clip;
-uniform float far_clip;
-
-uniform vec3 proj_origin; //origin of projection to be used for angular attenuation
-uniform float sun_wash;
-uniform int proj_shadow_idx;
-uniform float shadow_fade;
-
-varying vec4 vary_light;
-
-varying vec4 vary_fragcoord;
-uniform vec2 screen_res;
-
-uniform mat4 inv_proj;
-
-vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
-{
-	vec4 ret = texture2DLod(projectionMap, tc, lod);
-	
-	vec2 dist = tc-vec2(0.5);
-	
-	float det = max(1.0-lod/(proj_lod*0.5), 0.0);
-	
-	float d = dot(dist,dist);
-		
-	ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0);
-	
-	return ret;
-}
-
-vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
-{
-	vec4 ret = texture2DLod(projectionMap, tc, lod);
-	
-	vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
-	
-	float det = min(lod/(proj_lod*0.5), 1.0);
-	
-	float d = min(dist.x, dist.y);
-	
-	float edge = 0.25*det;
-		
-	ret *= clamp(d/edge, 0.0, 1.0);
-	
-	return ret;
-}
-
-vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
-{
-	vec4 ret = texture2DLod(projectionMap, tc, lod);
-	
-	vec2 dist = tc-vec2(0.5);
-	
-	float d = dot(dist,dist);
-		
-	ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0);
-	
-	return ret;
-}
-
-
-vec4 getPosition(ivec2 pos_screen, int sample)
-{
-	float depth = texelFetch(depthMap, pos_screen, sample).r;
-	vec2 sc = vec2(pos_screen.xy)*2.0;
-	sc /= screen_res;
-	sc -= vec2(1.0,1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
-void main() 
-{
-	int wght = 0;
-
-	vec3 fcol = vec3(0,0,0);
-
-	vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res;
-	
-	ivec2 itc = ivec2(frag.xy);
-
-	float shadow = 1.0;
-
-	if (proj_shadow_idx >= 0)
-	{
-		vec4 shd = texture2DRect(lightMap, frag);
-		float sh[2];
-		sh[0] = shd.b;
-		sh[1] = shd.a;
-		shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0);
-	}
-		
-	for (int i = 0; i < samples; i++)
-	{
-		vec3 pos = getPosition(itc, i).xyz;
-		vec3 lv = vary_light.xyz-pos.xyz;
-		float dist2 = dot(lv,lv);
-		dist2 /= vary_light.w;
-		if (dist2 <= 1.0)
-		{
-			vec3 norm = texelFetch(normalMap, itc, i).xyz;
-			norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
-	
-			norm = normalize(norm);
-			float l_dist = -dot(lv, proj_n);
-	
-			vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0));
-			if (proj_tc.z >= 0.0)
-			{
-				proj_tc.xyz /= proj_tc.w;
-	
-				float fa = gl_Color.a+1.0;
-				float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
-				if (dist_atten > 0.0)
-				{
-					lv = proj_origin-pos.xyz;
-					lv = normalize(lv);
-					float da = dot(norm, lv);
-		
-					vec3 col = vec3(0,0,0);
-		
-					vec3 diff_tex = texelFetch(diffuseRect, itc, i).rgb;
-		
-					float noise = texture2D(noiseMap, frag.xy/128.0).b;
-					if (proj_tc.z > 0.0 &&
-						proj_tc.x < 1.0 &&
-						proj_tc.y < 1.0 &&
-						proj_tc.x > 0.0 &&
-						proj_tc.y > 0.0)
-					{
-						float lit = 0.0;
-						float amb_da = proj_ambiance;
-		
-						if (da > 0.0)
-						{
-							float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0);
-							float lod = diff * proj_lod;
-			
-							vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod);
-		
-							vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
-			
-							lit = da * dist_atten * noise;
-			
-							col = lcol*lit*diff_tex*shadow;
-							amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance;
-						}
-		
-						//float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0);
-						vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod);
-							
-						amb_da += (da*da*0.5+0.5)*proj_ambiance;
-				
-						amb_da *= dist_atten * noise;
-			
-						amb_da = min(amb_da, 1.0-lit);
-			
-						col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
-					}
-	
-	
-					vec4 spec = texelFetch(specularRect, itc, i);
-					if (spec.a > 0.0)
-					{
-						vec3 ref = reflect(normalize(pos), norm);
-		
-						//project from point pos in direction ref to plane proj_p, proj_n
-						vec3 pdelta = proj_p-pos;
-						float ds = dot(ref, proj_n);
-		
-						if (ds < 0.0)
-						{
-							vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds;
-			
-							vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0));
-
-							if (stc.z > 0.0)
-							{
-								stc.xy /= stc.w;
-
-								float fatten = clamp(spec.a*spec.a+spec.a*0.5, 0.25, 1.0);
-				
-								stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
-								
-								if (stc.x < 1.0 &&
-									stc.y < 1.0 &&
-									stc.x > 0.0 &&
-									stc.y > 0.0)
-								{
-									vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
-									col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow;
-								}
-							}
-						}
-					}
-
-					fcol += col;
-					wght++;
-				}
-			}
-		}
-	}
-	
-	if (wght <= 0)
-	{
-		discard;
-	}
-
-	gl_FragColor.rgb = fcol/samples;	
-	gl_FragColor.a = 0.0;
-}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index d7407332e53f0ebba5b2831be2a65a2c7d09aa11..a137bea30f1dc0202cf182c04e3003909fd1221e 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -23,16 +23,19 @@
  * $/LicenseInfo$
  */
  
-
-
 #extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 uniform sampler2DRect diffuseRect;
 uniform sampler2DRect specularRect;
 uniform sampler2DRect normalMap;
 uniform sampler2DRect lightMap;
 uniform sampler2DRect depthMap;
-uniform sampler2D	  noiseMap;
 uniform samplerCube environmentMap;
 uniform sampler2D	  lightFunc;
 uniform vec3 gi_quad;
@@ -50,23 +53,24 @@ uniform vec4 sunlight_color;
 uniform vec4 ambient;
 uniform vec4 blue_horizon;
 uniform vec4 blue_density;
-uniform vec4 haze_horizon;
-uniform vec4 haze_density;
-uniform vec4 cloud_shadow;
-uniform vec4 density_multiplier;
-uniform vec4 distance_multiplier;
-uniform vec4 max_y;
+uniform float haze_horizon;
+uniform float haze_density;
+uniform float cloud_shadow;
+uniform float density_multiplier;
+uniform float distance_multiplier;
+uniform float max_y;
 uniform vec4 glow;
 uniform float scene_light_strength;
-uniform vec3 env_mat[3];
+uniform mat3 env_mat;
 uniform vec4 shadow_clip;
 uniform mat3 ssao_effect_mat;
 
 uniform mat4 inv_proj;
 uniform vec2 screen_res;
 
-varying vec4 vary_light;
-varying vec2 vary_fragcoord;
+uniform vec3 sun_dir;
+
+VARYING vec2 vary_fragcoord;
 
 vec3 vary_PositionEye;
 
@@ -145,10 +149,6 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
 	vec3 P = inPositionEye;
 	setPositionEye(P);
 	
-	//(TERRAIN) limit altitude
-	if (P.y > max_y.x) P *= (max_y.x / P.y);
-	if (P.y < -max_y.x) P *= (-max_y.x / P.y);
-
 	vec3 tmpLightnorm = lightnorm.xyz;
 
 	vec3 Pn = normalize(P);
@@ -163,13 +163,13 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
 
 	//sunlight attenuation effect (hue and brightness) due to atmosphere
 	//this is used later for sunlight modulation at various altitudes
-	light_atten = (blue_density * 1.0 + vec4(haze_density.r) * 0.25) * (density_multiplier.x * max_y.x);
+	light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
 		//I had thought blue_density and haze_density should have equal weighting,
 		//but attenuation due to haze_density tends to seem too strong
 
-	temp1 = blue_density + vec4(haze_density.r);
+	temp1 = blue_density + vec4(haze_density);
 	blue_weight = blue_density / temp1;
-	haze_weight = vec4(haze_density.r) / temp1;
+	haze_weight = vec4(haze_density) / temp1;
 
 	//(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain)
 	temp2.y = max(0.0, tmpLightnorm.y);
@@ -177,12 +177,12 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
 	sunlight *= exp( - light_atten * temp2.y);
 
 	// main atmospheric scattering line integral
-	temp2.z = Plen * density_multiplier.x;
+	temp2.z = Plen * density_multiplier;
 
 	// Transparency (-> temp1)
-	// ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier.x in a variable because the ati
+	// ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier in a variable because the ati
 	// compiler gets confused.
-	temp1 = exp(-temp1 * temp2.z * distance_multiplier.x);
+	temp1 = exp(-temp1 * temp2.z * distance_multiplier);
 
 	//final atmosphere attenuation factor
 	setAtmosAttenuation(temp1.rgb);
@@ -203,7 +203,7 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
 	temp2.x += .25;
 	
 	//increase ambient when there are more clouds
-	vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5;
+	vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow * 0.5;
 	
 	/*  decrease value and saturation (that in HSV, not HSL) for occluded areas
 	 * // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html
@@ -217,8 +217,8 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
 
 	//haze color
 	setAdditiveColor(
-		vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow.x) + tmpAmbient)
-	  + (haze_horizon.r * haze_weight) * (sunlight*(1.-cloud_shadow.x) * temp2.x
+		vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow) + tmpAmbient)
+	  + (haze_horizon * haze_weight) * (sunlight*(1.-cloud_shadow) * temp2.x
 		  + tmpAmbient)));
 
 	//brightness of surface both sunlight and ambient
@@ -280,9 +280,8 @@ void main()
 	vec3 pos = getPosition_d(tc, depth).xyz;
 	vec3 norm = texture2DRect(normalMap, tc).xyz;
 	norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
-	//vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz;
-	
-	float da = max(dot(norm.xyz, vary_light.xyz), 0.0);
+		
+	float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
 	
 	vec4 diffuse = texture2DRect(diffuseRect, tc);
 
@@ -309,13 +308,18 @@ void main()
 			// the old infinite-sky shiny reflection
 			//
 			vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
-			float sa = dot(refnormpersp, vary_light.xyz);
-			vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a;
+			float sa = dot(refnormpersp, sun_dir.xyz);
+			vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*(6 * texture2D(lightFunc, vec2(sa, spec.a)).r);
 
 			// add the two types of shiny together
 			vec3 spec_contrib = dumbshiny * spec.rgb;
-			bloom = dot(spec_contrib, spec_contrib);
+			bloom = dot(spec_contrib, spec_contrib) / 4;
 			col += spec_contrib;
+
+			//add environmentmap
+			vec3 env_vec = env_mat * refnormpersp;
+			col = mix(col.rgb, textureCube(environmentMap, env_vec).rgb, 
+				max(spec.a-diffuse.a*2.0, 0.0)); 
 		}
 			
 		col = atmosLighting(col);
@@ -328,6 +332,6 @@ void main()
 		col = diffuse.rgb;
 	}
 		
-	gl_FragColor.rgb = col;
-	gl_FragColor.a = bloom;
+	frag_color.rgb = col;
+	frag_color.a = bloom;
 }
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl
deleted file mode 100644
index 12442944514de15c44def731f4a069c21a2661a7..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl
+++ /dev/null
@@ -1,337 +0,0 @@
-/** 
- * @file softenLightMSF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-uniform sampler2DMS diffuseRect;
-uniform sampler2DMS specularRect;
-uniform sampler2DMS normalMap;
-uniform sampler2DRect lightMap;
-uniform sampler2DMS depthMap;
-uniform sampler2D	  noiseMap;
-uniform samplerCube environmentMap;
-uniform sampler2D	  lightFunc;
-uniform vec3 gi_quad;
-
-uniform float blur_size;
-uniform float blur_fidelity;
-
-// Inputs
-uniform vec4 morphFactor;
-uniform vec3 camPosLocal;
-//uniform vec4 camPosWorld;
-uniform vec4 gamma;
-uniform vec4 lightnorm;
-uniform vec4 sunlight_color;
-uniform vec4 ambient;
-uniform vec4 blue_horizon;
-uniform vec4 blue_density;
-uniform vec4 haze_horizon;
-uniform vec4 haze_density;
-uniform vec4 cloud_shadow;
-uniform vec4 density_multiplier;
-uniform vec4 distance_multiplier;
-uniform vec4 max_y;
-uniform vec4 glow;
-uniform float scene_light_strength;
-uniform vec3 env_mat[3];
-uniform vec4 shadow_clip;
-uniform mat3 ssao_effect_mat;
-
-uniform mat4 inv_proj;
-uniform vec2 screen_res;
-
-varying vec4 vary_light;
-varying vec2 vary_fragcoord;
-
-vec3 vary_PositionEye;
-
-vec3 vary_SunlitColor;
-vec3 vary_AmblitColor;
-vec3 vary_AdditiveColor;
-vec3 vary_AtmosAttenuation;
-
-vec4 getPosition_d(vec2 pos_screen, float depth)
-{
-	vec2 sc = pos_screen.xy*2.0;
-	sc /= screen_res;
-	sc -= vec2(1.0,1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
-vec3 getPositionEye()
-{
-	return vary_PositionEye;
-}
-vec3 getSunlitColor()
-{
-	return vary_SunlitColor;
-}
-vec3 getAmblitColor()
-{
-	return vary_AmblitColor;
-}
-vec3 getAdditiveColor()
-{
-	return vary_AdditiveColor;
-}
-vec3 getAtmosAttenuation()
-{
-	return vary_AtmosAttenuation;
-}
-
-
-void setPositionEye(vec3 v)
-{
-	vary_PositionEye = v;
-}
-
-void setSunlitColor(vec3 v)
-{
-	vary_SunlitColor = v;
-}
-
-void setAmblitColor(vec3 v)
-{
-	vary_AmblitColor = v;
-}
-
-void setAdditiveColor(vec3 v)
-{
-	vary_AdditiveColor = v;
-}
-
-void setAtmosAttenuation(vec3 v)
-{
-	vary_AtmosAttenuation = v;
-}
-
-void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
-
-	vec3 P = inPositionEye;
-	setPositionEye(P);
-	
-	//(TERRAIN) limit altitude
-	if (P.y > max_y.x) P *= (max_y.x / P.y);
-	if (P.y < -max_y.x) P *= (-max_y.x / P.y);
-
-	vec3 tmpLightnorm = lightnorm.xyz;
-
-	vec3 Pn = normalize(P);
-	float Plen = length(P);
-
-	vec4 temp1 = vec4(0);
-	vec3 temp2 = vec3(0);
-	vec4 blue_weight;
-	vec4 haze_weight;
-	vec4 sunlight = sunlight_color;
-	vec4 light_atten;
-
-	//sunlight attenuation effect (hue and brightness) due to atmosphere
-	//this is used later for sunlight modulation at various altitudes
-	light_atten = (blue_density * 1.0 + vec4(haze_density.r) * 0.25) * (density_multiplier.x * max_y.x);
-		//I had thought blue_density and haze_density should have equal weighting,
-		//but attenuation due to haze_density tends to seem too strong
-
-	temp1 = blue_density + vec4(haze_density.r);
-	blue_weight = blue_density / temp1;
-	haze_weight = vec4(haze_density.r) / temp1;
-
-	//(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain)
-	temp2.y = max(0.0, tmpLightnorm.y);
-	temp2.y = 1. / temp2.y;
-	sunlight *= exp( - light_atten * temp2.y);
-
-	// main atmospheric scattering line integral
-	temp2.z = Plen * density_multiplier.x;
-
-	// Transparency (-> temp1)
-	// ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier.x in a variable because the ati
-	// compiler gets confused.
-	temp1 = exp(-temp1 * temp2.z * distance_multiplier.x);
-
-	//final atmosphere attenuation factor
-	setAtmosAttenuation(temp1.rgb);
-	
-	//compute haze glow
-	//(can use temp2.x as temp because we haven't used it yet)
-	temp2.x = dot(Pn, tmpLightnorm.xyz);
-	temp2.x = 1. - temp2.x;
-		//temp2.x is 0 at the sun and increases away from sun
-	temp2.x = max(temp2.x, .03);	//was glow.y
-		//set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
-	temp2.x *= glow.x;
-		//higher glow.x gives dimmer glow (because next step is 1 / "angle")
-	temp2.x = pow(temp2.x, glow.z);
-		//glow.z should be negative, so we're doing a sort of (1 / "angle") function
-
-	//add "minimum anti-solar illumination"
-	temp2.x += .25;
-	
-	//increase ambient when there are more clouds
-	vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5;
-	
-	/*  decrease value and saturation (that in HSV, not HSL) for occluded areas
-	 * // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html
-	 * // The following line of code performs the equivalent of:
-	 * float ambAlpha = tmpAmbient.a;
-	 * float ambValue = dot(vec3(tmpAmbient), vec3(0.577)); // projection onto <1/rt(3), 1/rt(3), 1/rt(3)>, the neutral white-black axis
-	 * vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue);
-	 * tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha);
-	 */
-	tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a);
-
-	//haze color
-	setAdditiveColor(
-		vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow.x) + tmpAmbient)
-	  + (haze_horizon.r * haze_weight) * (sunlight*(1.-cloud_shadow.x) * temp2.x
-		  + tmpAmbient)));
-
-	//brightness of surface both sunlight and ambient
-	setSunlitColor(vec3(sunlight * .5));
-	setAmblitColor(vec3(tmpAmbient * .25));
-	setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1));
-}
-
-vec3 atmosLighting(vec3 light)
-{
-	light *= getAtmosAttenuation().r;
-	light += getAdditiveColor();
-	return (2.0 * light);
-}
-
-vec3 atmosTransport(vec3 light) {
-	light *= getAtmosAttenuation().r;
-	light += getAdditiveColor() * 2.0;
-	return light;
-}
-vec3 atmosGetDiffuseSunlightColor()
-{
-	return getSunlitColor();
-}
-
-vec3 scaleDownLight(vec3 light)
-{
-	return (light / scene_light_strength );
-}
-
-vec3 scaleUpLight(vec3 light)
-{
-	return (light * scene_light_strength);
-}
-
-vec3 atmosAmbient(vec3 light)
-{
-	return getAmblitColor() + light / 2.0;
-}
-
-vec3 atmosAffectDirectionalLight(float lightIntensity)
-{
-	return getSunlitColor() * lightIntensity;
-}
-
-vec3 scaleSoftClip(vec3 light)
-{
-	//soft clip effect:
-	light = 1. - clamp(light, vec3(0.), vec3(1.));
-	light = 1. - pow(light, gamma.xxx);
-
-	return light;
-}
-
-void main() 
-{
-	vec2 tc = vary_fragcoord.xy;
-	ivec2 itc = ivec2(tc);
-
-	vec4 fcol = vec4(0,0,0,0);
-
-	vec2 scol_ambocc = texture2DRect(lightMap, tc).rg;
-	float ambocc = scol_ambocc.g;
-
-	for (int i = 0; i < samples; ++i)
-	{
-		float depth = texelFetch(depthMap, itc.xy, i).r;
-		vec3 pos = getPosition_d(tc, depth).xyz;
-		vec3 norm = texelFetch(normalMap, itc, i).xyz;
-		norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
-			
-		float da = max(dot(norm.xyz, vary_light.xyz), 0.0);
-	
-		vec4 diffuse = texelFetch(diffuseRect, itc, i);
-		vec3 col;
-		float bloom = 0.0;
-		if (diffuse.a < 0.9)
-		{
-			vec4 spec = texelFetch(specularRect, itc, i);
-	
-			float amb = 0;
-
-			float scol = max(scol_ambocc.r, diffuse.a); 
-			amb += ambocc;
-
-			calcAtmospherics(pos.xyz, ambocc);
-	
-			col = atmosAmbient(vec3(0));
-			col += atmosAffectDirectionalLight(max(min(da, scol), diffuse.a));
-	
-			col *= diffuse.rgb;
-	
-			if (spec.a > 0.0) // specular reflection
-			{
-				// the old infinite-sky shiny reflection
-				//
-				vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
-				float sa = dot(refnormpersp, vary_light.xyz);
-				vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a;
-
-				// add the two types of shiny together
-				vec3 spec_contrib = dumbshiny * spec.rgb;
-				bloom = dot(spec_contrib, spec_contrib);
-				col += spec_contrib;
-			}
-	
-			col = atmosLighting(col);
-			col = scaleSoftClip(col);
-
-			col = mix(col, diffuse.rgb, diffuse.a);
-		}
-		else
-		{
-			col = diffuse.rgb;
-		}
-
-		fcol += vec4(col, bloom);
-	}
-		
-	gl_FragColor = fcol/samples; 
-}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
index fed238510a0281a7f4b81520f4c81b9a3972fe89..c840d727843a95a9f2049dcf827eccb93d6519f3 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
@@ -22,23 +22,21 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
 
 uniform vec2 screen_res;
 
-varying vec4 vary_light;
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
+
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform(); 
+	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	gl_Position = pos; 
 	
-	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
-	vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
-		
-	vec4 tex = gl_MultiTexCoord0;
-	tex.w = 1.0;
 	
-	vary_light = gl_MultiTexCoord0;
+	vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
 }
diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
index 25270f49392c809a438f506d08bb6eeb2360c827..99a277fbfcced0456bafad4b1af369a961c4eb11 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
@@ -23,9 +23,15 @@
  * $/LicenseInfo$
  */
  
+#extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
-#extension GL_ARB_texture_rectangle : enable
+VARYING vec4 vertex_color;
 
 uniform sampler2DRect diffuseRect;
 uniform sampler2DRect specularRect;
@@ -34,7 +40,6 @@ uniform sampler2DRect normalMap;
 uniform samplerCube environmentMap;
 uniform sampler2DRect lightMap;
 uniform sampler2D noiseMap;
-uniform sampler2D lightFunc;
 uniform sampler2D projectionMap;
 
 uniform mat4 proj_mat; //screen space to light space
@@ -53,9 +58,9 @@ uniform float sun_wash;
 uniform int proj_shadow_idx;
 uniform float shadow_fade;
 
-varying vec4 vary_light;
+VARYING vec4 vary_light;
 
-varying vec4 vary_fragcoord;
+VARYING vec4 vary_fragcoord;
 uniform vec2 screen_res;
 
 uniform mat4 inv_proj;
@@ -114,7 +119,7 @@ void main()
 	
 	proj_tc.xyz /= proj_tc.w;
 	
-	float fa = gl_Color.a+1.0;
+	float fa = vertex_color.a+1.0;
 	float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
 	
 	lv = proj_origin-pos.xyz;
@@ -140,7 +145,7 @@ void main()
 			
 			vec4 plcol = texture2DLod(projectionMap, proj_tc.xy, lod);
 		
-			vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
+			vec3 lcol = vertex_color.rgb * plcol.rgb * plcol.a;
 			
 			lit = da * dist_atten * noise;
 			
@@ -163,7 +168,7 @@ void main()
 		
 		amb_da = min(amb_da, 1.0-lit);
 		
-		col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
+		col += amb_da*vertex_color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
 	}
 	
 	
@@ -192,12 +197,12 @@ void main()
 					stc.y > 0.0)
 				{
 					vec4 scol = texture2DLod(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
-					col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow;
+					col += dist_atten*scol.rgb*vertex_color.rgb*scol.a*spec.rgb*shadow;
 				}
 			}
 		}
 	}
 	
-	gl_FragColor.rgb = col;	
-	gl_FragColor.a = 0.0;
+	frag_color.rgb = col;	
+	frag_color.a = 0.0;
 }
diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl
deleted file mode 100644
index 4962e73e390c3cc6e3b5e2fec2fb550a2da1a350..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl
+++ /dev/null
@@ -1,263 +0,0 @@
-/** 
- * @file multiSpotLightF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-uniform sampler2DMS diffuseRect;
-uniform sampler2DMS specularRect;
-uniform sampler2DMS depthMap;
-uniform sampler2DMS normalMap;
-uniform sampler2DRect lightMap;
-uniform sampler2D noiseMap;
-uniform sampler2D lightFunc;
-uniform sampler2D projectionMap;
-
-uniform mat4 proj_mat; //screen space to light space
-uniform float proj_near; //near clip for projection
-uniform vec3 proj_p; //plane projection is emitting from (in screen space)
-uniform vec3 proj_n;
-uniform float proj_focus; //distance from plane to begin blurring
-uniform float proj_lod;  //(number of mips in proj map)
-uniform float proj_range; //range between near clip and far clip plane of projection
-uniform float proj_ambient_lod;
-uniform float proj_ambiance;
-uniform float near_clip;
-uniform float far_clip;
-
-uniform vec3 proj_origin; //origin of projection to be used for angular attenuation
-uniform float sun_wash;
-uniform int proj_shadow_idx;
-uniform float shadow_fade;
-
-varying vec4 vary_light;
-
-varying vec4 vary_fragcoord;
-uniform vec2 screen_res;
-
-uniform mat4 inv_proj;
-
-vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
-{
-	vec4 ret = texture2DLod(projectionMap, tc, lod);
-	
-	vec2 dist = tc-vec2(0.5);
-	
-	float det = max(1.0-lod/(proj_lod*0.5), 0.0);
-	
-	float d = dot(dist,dist);
-		
-	ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0);
-	
-	return ret;
-}
-
-vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
-{
-	vec4 ret = texture2DLod(projectionMap, tc, lod);
-	
-	vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
-	
-	float det = min(lod/(proj_lod*0.5), 1.0);
-	
-	float d = min(dist.x, dist.y);
-	
-	float edge = 0.25*det;
-		
-	ret *= clamp(d/edge, 0.0, 1.0);
-	
-	return ret;
-}
-
-vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
-{
-	vec4 ret = texture2DLod(projectionMap, tc, lod);
-	
-	vec2 dist = tc-vec2(0.5);
-	
-	float d = dot(dist,dist);
-		
-	ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0);
-	
-	return ret;
-}
-
-
-vec4 getPosition(ivec2 pos_screen, int sample)
-{
-	float depth = texelFetch(depthMap, pos_screen, sample).r;
-	vec2 sc = vec2(pos_screen.xy)*2.0;
-	sc /= screen_res;
-	sc -= vec2(1.0,1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
-void main() 
-{
-	vec4 frag = vary_fragcoord;
-	frag.xyz /= frag.w;
-	frag.xyz = frag.xyz*0.5+0.5;
-	frag.xy *= screen_res;
-	ivec2 itc = ivec2(frag.xy);
-	
-	vec3 fcol = vec3(0,0,0);
-	int wght = 0;
-
-	float shadow = 1.0;
-	
-	if (proj_shadow_idx >= 0)
-	{
-		vec4 shd = texture2DRect(lightMap, frag.xy);
-		float sh[2];
-		sh[0] = shd.b;
-		sh[1] = shd.a;
-		shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0);
-	}
-	
-	for (int i = 0; i < samples; i++)
-	{
-		vec3 pos = getPosition(itc, i).xyz;
-		vec3 lv = vary_light.xyz-pos.xyz;
-		float dist2 = dot(lv,lv);
-		dist2 /= vary_light.w;
-		if (dist2 <= 1.0)
-		{
-			vec3 norm = texelFetch(normalMap, itc, i).xyz;
-			norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
-	
-			norm = normalize(norm);
-			float l_dist = -dot(lv, proj_n);
-	
-			vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0));
-			if (proj_tc.z >= 0.0)
-			{
-				proj_tc.xyz /= proj_tc.w;
-	
-				float fa = gl_Color.a+1.0;
-				float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
-				if (dist_atten > 0.0)
-				{
-					lv = proj_origin-pos.xyz;
-					lv = normalize(lv);
-					float da = dot(norm, lv);
-		
-					vec3 col = vec3(0,0,0);
-		
-					vec3 diff_tex = texelFetch(diffuseRect, itc, i).rgb;
-		
-					float noise = texture2D(noiseMap, frag.xy/128.0).b;
-					if (proj_tc.z > 0.0 &&
-						proj_tc.x < 1.0 &&
-						proj_tc.y < 1.0 &&
-						proj_tc.x > 0.0 &&
-						proj_tc.y > 0.0)
-					{
-						float lit = 0.0;
-						float amb_da = proj_ambiance;
-		
-						if (da > 0.0)
-						{
-							float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0);
-							float lod = diff * proj_lod;
-			
-							vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod);
-		
-							vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
-			
-							lit = da * dist_atten * noise;
-			
-							col = lcol*lit*diff_tex*shadow;
-							amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance;
-						}
-		
-						//float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0);
-						vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod);
-							
-						amb_da += (da*da*0.5+0.5)*proj_ambiance;
-				
-						amb_da *= dist_atten * noise;
-			
-						amb_da = min(amb_da, 1.0-lit);
-			
-						col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
-					}
-	
-	
-					vec4 spec = texelFetch(specularRect, itc, i);
-					if (spec.a > 0.0)
-					{
-						vec3 ref = reflect(normalize(pos), norm);
-		
-						//project from point pos in direction ref to plane proj_p, proj_n
-						vec3 pdelta = proj_p-pos;
-						float ds = dot(ref, proj_n);
-		
-						if (ds < 0.0)
-						{
-							vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds;
-			
-							vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0));
-
-							if (stc.z > 0.0)
-							{
-								stc.xy /= stc.w;
-
-								float fatten = clamp(spec.a*spec.a+spec.a*0.5, 0.25, 1.0);
-				
-								stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
-								
-								if (stc.x < 1.0 &&
-									stc.y < 1.0 &&
-									stc.x > 0.0 &&
-									stc.y > 0.0)
-								{
-									vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
-									col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow;
-								}
-							}
-						}
-					}
-
-					fcol += col;
-					wght++;
-				}
-			}
-		}
-	}
-	
-	if (wght <= 0)
-	{
-		discard;
-	}
-
-	gl_FragColor.rgb = fcol/wght;	
-	gl_FragColor.a = 0.0;
-}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
index 1809cff1e5d32c79a5e492e51e838124dbe46a1b..8c4ccf9cb37265a2e938854a82539c005da73c4a 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
@@ -22,11 +22,15 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
-
 
 #extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 //class 2, shadows, no SSAO
 
 uniform sampler2DRect depthMap;
@@ -47,13 +51,13 @@ uniform float ssao_max_radius;
 uniform float ssao_factor;
 uniform float ssao_factor_inv;
 
-varying vec2 vary_fragcoord;
-varying vec4 vary_light;
+VARYING vec2 vary_fragcoord;
 
 uniform mat4 inv_proj;
 uniform vec2 screen_res;
 uniform vec2 shadow_res;
 uniform vec2 proj_shadow_res;
+uniform vec3 sun_dir;
 
 uniform float shadow_bias;
 uniform float shadow_offset;
@@ -127,15 +131,15 @@ void main()
 	
 	/*if (pos.z == 0.0) // do nothing for sky *FIX: REMOVE THIS IF/WHEN THE POSITION MAP IS BEING USED AS A STENCIL
 	{
-		gl_FragColor = vec4(0.0); // doesn't matter
+		frag_color = vec4(0.0); // doesn't matter
 		return;
 	}*/
 	
-	float shadow = 1.0;
-	float dp_directional_light = max(0.0, dot(norm, vary_light.xyz));
+	float shadow = 0.0;
+	float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz));
 
 	vec3 shadow_pos = pos.xyz + displace*norm;
-	vec3 offset = vary_light.xyz * (1.0-dp_directional_light);
+	vec3 offset = sun_dir.xyz * (1.0-dp_directional_light);
 	
 	vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0);
 	
@@ -150,32 +154,62 @@ void main()
 		{
 			vec4 lpos;
 			
-			if (spos.z < -shadow_clip.z)
+			vec4 near_split = shadow_clip*-0.75;
+			vec4 far_split = shadow_clip*-1.25;
+			vec4 transition_domain = near_split-far_split;
+			float weight = 0.0;
+
+			if (spos.z < near_split.z)
 			{
 				lpos = shadow_matrix[3]*spos;
 				lpos.xy *= shadow_res;
-				shadow = pcfShadow(shadowMap3, lpos, 0.25);
+
+				float w = 1.0;
+				w -= max(spos.z-far_split.z, 0.0)/transition_domain.z;
+				shadow += pcfShadow(shadowMap3, lpos, 0.25)*w;
+				weight += w;
 				shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
 			}
-			else if (spos.z < -shadow_clip.y)
+
+			if (spos.z < near_split.y && spos.z > far_split.z)
 			{
 				lpos = shadow_matrix[2]*spos;
 				lpos.xy *= shadow_res;
-				shadow = pcfShadow(shadowMap2, lpos, 0.5);
+
+				float w = 1.0;
+				w -= max(spos.z-far_split.y, 0.0)/transition_domain.y;
+				w -= max(near_split.z-spos.z, 0.0)/transition_domain.z;
+				shadow += pcfShadow(shadowMap2, lpos, 0.75)*w;
+				weight += w;
 			}
-			else if (spos.z < -shadow_clip.x)
+
+			if (spos.z < near_split.x && spos.z > far_split.y)
 			{
 				lpos = shadow_matrix[1]*spos;
 				lpos.xy *= shadow_res;
-				shadow = pcfShadow(shadowMap1, lpos, 0.75);
+
+				float w = 1.0;
+				w -= max(spos.z-far_split.x, 0.0)/transition_domain.x;
+				w -= max(near_split.y-spos.z, 0.0)/transition_domain.y;
+				shadow += pcfShadow(shadowMap1, lpos, 0.75)*w;
+				weight += w;
 			}
-			else
+
+			if (spos.z > far_split.x)
 			{
 				lpos = shadow_matrix[0]*spos;
 				lpos.xy *= shadow_res;
-				shadow = pcfShadow(shadowMap0, lpos, 1.0);
+				
+				float w = 1.0;
+				w -= max(near_split.x-spos.z, 0.0)/transition_domain.x;
+				
+				shadow += pcfShadow(shadowMap0, lpos, 1.0)*w;
+				weight += w;
 			}
 		
+
+			shadow /= weight;
+
 			// take the most-shadowed value out of these two:
 			//  * the blurred sun shadow in the light (shadow) map
 			//  * an unblurred dot product between the sun and this norm
@@ -196,19 +230,19 @@ void main()
 		shadow = 1.0;
 	}
 	
-	gl_FragColor[0] = shadow;
-	gl_FragColor[1] = 1.0;
+	frag_color[0] = shadow;
+	frag_color[1] = 1.0;
 	
 	spos = vec4(shadow_pos+norm*spot_shadow_offset, 1.0);
 	
 	//spotlight shadow 1
 	vec4 lpos = shadow_matrix[4]*spos;
-	gl_FragColor[2] = pcfShadow(shadowMap4, lpos, 0.8); 
+	frag_color[2] = pcfShadow(shadowMap4, lpos, 0.8); 
 	
 	//spotlight shadow 2
 	lpos = shadow_matrix[5]*spos;
-	gl_FragColor[3] = pcfShadow(shadowMap5, lpos, 0.8); 
+	frag_color[3] = pcfShadow(shadowMap5, lpos, 0.8); 
 
-	//gl_FragColor.rgb = pos.xyz;
-	//gl_FragColor.b = shadow;
+	//frag_color.rgb = pos.xyz;
+	//frag_color.b = shadow;
 }
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl
deleted file mode 100644
index ac4fe52655993877f94c10244a78f300f4ec41c1..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl
+++ /dev/null
@@ -1,220 +0,0 @@
-/** 
- * @file sunLightMSF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-//class 2, shadows, no SSAO
-
-uniform sampler2DMS depthMap;
-uniform sampler2DMS normalMap;
-uniform sampler2DRectShadow shadowMap0;
-uniform sampler2DRectShadow shadowMap1;
-uniform sampler2DRectShadow shadowMap2;
-uniform sampler2DRectShadow shadowMap3;
-uniform sampler2DShadow shadowMap4;
-uniform sampler2DShadow shadowMap5;
-
-
-// Inputs
-uniform mat4 shadow_matrix[6];
-uniform vec4 shadow_clip;
-uniform float ssao_radius;
-uniform float ssao_max_radius;
-uniform float ssao_factor;
-uniform float ssao_factor_inv;
-
-varying vec2 vary_fragcoord;
-varying vec4 vary_light;
-
-uniform mat4 inv_proj;
-uniform vec2 screen_res;
-uniform vec2 shadow_res;
-uniform vec2 proj_shadow_res;
-
-uniform float shadow_bias;
-uniform float shadow_offset;
-
-uniform float spot_shadow_bias;
-uniform float spot_shadow_offset;
-
-vec4 getPosition(ivec2 pos_screen, int sample)
-{
-	float depth = texelFetch(depthMap, pos_screen.xy, sample).r;
-	vec2 sc = vec2(pos_screen.xy)*2.0;
-	sc /= screen_res;
-	sc -= vec2(1.0,1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
-float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl)
-{
-	stc.xyz /= stc.w;
-	stc.z += shadow_bias*scl;
-	
-	float cs = shadow2DRect(shadowMap, stc.xyz).x;
-	float shadow = cs;
-
-	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(1.5, 1.5, 0.0)).x, cs);
-	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(1.5, -1.5, 0.0)).x, cs);
-	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-1.5, 1.5, 0.0)).x, cs);
-	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-1.5, -1.5, 0.0)).x, cs);
-			
-	return shadow/5.0;
-	
-	//return shadow;
-}
-
-float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl)
-{
-	stc.xyz /= stc.w;
-	stc.z += spot_shadow_bias*scl;
-	
-	float cs = shadow2D(shadowMap, stc.xyz).x;
-	float shadow = cs;
-
-	vec2 off = 1.5/proj_shadow_res;
-	
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)).x, cs);
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x, cs);
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x, cs);
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x, cs);
-				
-	return shadow/5.0;
-	
-	//return shadow;
-}
-
-void main() 
-{
-	vec2 pos_screen = vary_fragcoord.xy;
-	ivec2 itc = ivec2(pos_screen);
-
-	//try doing an unproject here
-	
-	vec4 fcol = vec4(0,0,0,0);
-
-	for (int i = 0; i < samples; i++)
-	{
-		vec4 pos = getPosition(itc, i);
-	
-		vec4 nmap4 = texelFetch(normalMap, itc, i);
-		nmap4 = vec4((nmap4.xy-0.5)*2.0,nmap4.z,nmap4.w); // unpack norm
-		float displace = nmap4.w;
-		vec3 norm = nmap4.xyz;
-	
-		/*if (pos.z == 0.0) // do nothing for sky *FIX: REMOVE THIS IF/WHEN THE POSITION MAP IS BEING USED AS A STENCIL
-		{
-			gl_FragColor = vec4(0.0); // doesn't matter
-			return;
-		}*/
-	
-		float shadow = 1.0;
-		float dp_directional_light = max(0.0, dot(norm, vary_light.xyz));
-
-		vec3 shadow_pos = pos.xyz + displace*norm;
-		vec3 offset = vary_light.xyz * (1.0-dp_directional_light);
-	
-		vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0);
-	
-		if (spos.z > -shadow_clip.w)
-		{	
-			if (dp_directional_light == 0.0)
-			{
-				// if we know this point is facing away from the sun then we know it's in shadow without having to do a squirrelly shadow-map lookup
-				shadow = 0.0;
-			}
-			else
-			{
-				vec4 lpos;
-			
-				if (spos.z < -shadow_clip.z)
-				{
-					lpos = shadow_matrix[3]*spos;
-					lpos.xy *= shadow_res;
-					shadow = pcfShadow(shadowMap3, lpos, 0.25);
-					shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
-				}
-				else if (spos.z < -shadow_clip.y)
-				{
-					lpos = shadow_matrix[2]*spos;
-					lpos.xy *= shadow_res;
-					shadow = pcfShadow(shadowMap2, lpos, 0.5);
-				}
-				else if (spos.z < -shadow_clip.x)
-				{
-					lpos = shadow_matrix[1]*spos;
-					lpos.xy *= shadow_res;
-					shadow = pcfShadow(shadowMap1, lpos, 0.75);
-				}
-				else
-				{
-					lpos = shadow_matrix[0]*spos;
-					lpos.xy *= shadow_res;
-					shadow = pcfShadow(shadowMap0, lpos, 1.0);
-				}
-		
-				// take the most-shadowed value out of these two:
-				//  * the blurred sun shadow in the light (shadow) map
-				//  * an unblurred dot product between the sun and this norm
-				// the goal is to err on the side of most-shadow to fill-in shadow holes and reduce artifacting
-				shadow = min(shadow, dp_directional_light);
-			
-				//lpos.xy /= lpos.w*32.0;
-				//if (fract(lpos.x) < 0.1 || fract(lpos.y) < 0.1)
-				//{
-				//	shadow = 0.0;
-				//}
-			
-			}
-		}
-		else
-		{
-			// more distant than the shadow map covers
-			shadow = 1.0;
-		}
-	
-		fcol[0] += shadow;
-		fcol[1] += 1.0;
-
-		spos = vec4(shadow_pos+norm*spot_shadow_offset, 1.0);
-	
-		//spotlight shadow 1
-		vec4 lpos = shadow_matrix[4]*spos;
-		fcol[2] += pcfShadow(shadowMap4, lpos, 0.8); 
-	
-		//spotlight shadow 2
-		lpos = shadow_matrix[5]*spos;
-		fcol[3] += pcfShadow(shadowMap5, lpos, 0.8); 
-	}
-
-	gl_FragColor = fcol/samples;
-}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
index 681186d6b2320999f8de1b12943ebbe7d4ebc4a4..02075a7687760f52e4a56f13d714516c4e4cb08a 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
@@ -22,10 +22,14 @@
  * $/LicenseInfo$
  */
  
-
-
 #extension GL_ARB_texture_rectangle : enable
 
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
 //class 2 -- shadows and SSAO
 
 uniform sampler2DRect depthMap;
@@ -38,6 +42,7 @@ uniform sampler2DShadow shadowMap4;
 uniform sampler2DShadow shadowMap5;
 uniform sampler2D noiseMap;
 
+
 // Inputs
 uniform mat4 shadow_matrix[6];
 uniform vec4 shadow_clip;
@@ -46,13 +51,13 @@ uniform float ssao_max_radius;
 uniform float ssao_factor;
 uniform float ssao_factor_inv;
 
-varying vec2 vary_fragcoord;
-varying vec4 vary_light;
+VARYING vec2 vary_fragcoord;
 
 uniform mat4 inv_proj;
 uniform vec2 screen_res;
 uniform vec2 shadow_res;
 uniform vec2 proj_shadow_res;
+uniform vec3 sun_dir;
 
 uniform float shadow_bias;
 uniform float shadow_offset;
@@ -73,11 +78,8 @@ vec4 getPosition(vec2 pos_screen)
 	return pos;
 }
 
-//calculate decreases in ambient lighting when crowded out (SSAO)
-float calcAmbientOcclusion(vec4 pos, vec3 norm)
+vec2 getKern(int i)
 {
-	float ret = 1.0;
-
 	vec2 kern[8];
 	// exponentially (^2) distant occlusion samples spread around origin
 	kern[0] = vec2(-1.0, 0.0) * 0.125*0.125;
@@ -88,22 +90,30 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm)
 	kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750;
 	kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875;
 	kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000;
+	
+	return kern[i];
+}
+
+//calculate decreases in ambient lighting when crowded out (SSAO)
+float calcAmbientOcclusion(vec4 pos, vec3 norm)
+{
+	float ret = 1.0;
 
 	vec2 pos_screen = vary_fragcoord.xy;
 	vec3 pos_world = pos.xyz;
 	vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy;
 		
 	float angle_hidden = 0.0;
-	int points = 0;
+	float points = 0;
 		
 	float scale = min(ssao_radius / -pos_world.z, ssao_max_radius);
-		
+	
 	// it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?)
 	for (int i = 0; i < 8; i++)
 	{
-		vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect);
+		vec2 samppos_screen = pos_screen + scale * reflect(getKern(i), noise_reflect);
 		vec3 samppos_world = getPosition(samppos_screen).xyz; 
-			
+		
 		vec3 diff = pos_world - samppos_world;
 		float dist2 = dot(diff, diff);
 			
@@ -111,17 +121,21 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm)
 		// --> solid angle shrinking by the square of distance
 		//radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2
 		//(k should vary inversely with # of samples, but this is taken care of later)
-			
-		angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv);
+		
+		float funky_val = (dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) ? 1.0 : 0.0;
+		angle_hidden = angle_hidden + funky_val * min(1.0/dist2, ssao_factor_inv);
 			
 		// 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion" 
-		points = points + int(diff.z > -1.0);
+		float diffz_val = (diff.z > -1.0) ? 1.0 : 0.0;
+		points = points + diffz_val;
 	}
 		
-	angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0);
-		
-	ret = (1.0 - (float(points != 0) * angle_hidden));
+	angle_hidden = min(ssao_factor*angle_hidden/points, 1.0);
 	
+	float points_val = (points > 0.0) ? 1.0 : 0.0;
+	ret = (1.0 - (points_val * angle_hidden));
+
+	ret = max(ret, 0.0);
 	return min(ret, 1.0);
 }
 
@@ -158,7 +172,6 @@ float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl)
 	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x, cs);
 	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x, cs);
 	
-			
 	return shadow/5.0;
 	
 	//return shadow;
@@ -179,15 +192,15 @@ void main()
 	
 	/*if (pos.z == 0.0) // do nothing for sky *FIX: REMOVE THIS IF/WHEN THE POSITION MAP IS BEING USED AS A STENCIL
 	{
-		gl_FragColor = vec4(0.0); // doesn't matter
+		frag_color = vec4(0.0); // doesn't matter
 		return;
 	}*/
 	
-	float shadow = 1.0;
-	float dp_directional_light = max(0.0, dot(norm, vary_light.xyz));
+	float shadow = 0.0;
+	float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz));
 
 	vec3 shadow_pos = pos.xyz + displace*norm;
-	vec3 offset = vary_light.xyz * (1.0-dp_directional_light);
+	vec3 offset = sun_dir.xyz * (1.0-dp_directional_light);
 	
 	vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0);
 	
@@ -201,33 +214,63 @@ void main()
 		else
 		{
 			vec4 lpos;
-			
-			if (spos.z < -shadow_clip.z)
+
+			vec4 near_split = shadow_clip*-0.75;
+			vec4 far_split = shadow_clip*-1.25;
+			vec4 transition_domain = near_split-far_split;
+			float weight = 0.0;
+
+			if (spos.z < near_split.z)
 			{
 				lpos = shadow_matrix[3]*spos;
 				lpos.xy *= shadow_res;
-				shadow = pcfShadow(shadowMap3, lpos, 0.25);
+
+				float w = 1.0;
+				w -= max(spos.z-far_split.z, 0.0)/transition_domain.z;
+				shadow += pcfShadow(shadowMap3, lpos, 0.25)*w;
+				weight += w;
 				shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
 			}
-			else if (spos.z < -shadow_clip.y)
+
+			if (spos.z < near_split.y && spos.z > far_split.z)
 			{
 				lpos = shadow_matrix[2]*spos;
 				lpos.xy *= shadow_res;
-				shadow = pcfShadow(shadowMap2, lpos, 0.5);
+
+				float w = 1.0;
+				w -= max(spos.z-far_split.y, 0.0)/transition_domain.y;
+				w -= max(near_split.z-spos.z, 0.0)/transition_domain.z;
+				shadow += pcfShadow(shadowMap2, lpos, 0.75)*w;
+				weight += w;
 			}
-			else if (spos.z < -shadow_clip.x)
+
+			if (spos.z < near_split.x && spos.z > far_split.y)
 			{
 				lpos = shadow_matrix[1]*spos;
 				lpos.xy *= shadow_res;
-				shadow = pcfShadow(shadowMap1, lpos, 0.75);
+
+				float w = 1.0;
+				w -= max(spos.z-far_split.x, 0.0)/transition_domain.x;
+				w -= max(near_split.y-spos.z, 0.0)/transition_domain.y;
+				shadow += pcfShadow(shadowMap1, lpos, 0.75)*w;
+				weight += w;
 			}
-			else
+
+			if (spos.z > far_split.x)
 			{
 				lpos = shadow_matrix[0]*spos;
 				lpos.xy *= shadow_res;
-				shadow = pcfShadow(shadowMap0, lpos, 1.0);
+				
+				float w = 1.0;
+				w -= max(near_split.x-spos.z, 0.0)/transition_domain.x;
+				
+				shadow += pcfShadow(shadowMap0, lpos, 1.0)*w;
+				weight += w;
 			}
 		
+
+			shadow /= weight;
+
 			// take the most-shadowed value out of these two:
 			//  * the blurred sun shadow in the light (shadow) map
 			//  * an unblurred dot product between the sun and this norm
@@ -248,19 +291,19 @@ void main()
 		shadow = 1.0;
 	}
 	
-	gl_FragColor[0] = shadow;
-	gl_FragColor[1] = calcAmbientOcclusion(pos, norm);
+	frag_color[0] = shadow;
+	frag_color[1] = calcAmbientOcclusion(pos, norm);
 	
-	spos.xyz = shadow_pos+norm*spot_shadow_offset;
+	spos = vec4(shadow_pos+norm*spot_shadow_offset, 1.0);
 	
 	//spotlight shadow 1
 	vec4 lpos = shadow_matrix[4]*spos;
-	gl_FragColor[2] = pcfShadow(shadowMap4, lpos, 0.8); 
+	frag_color[2] = pcfShadow(shadowMap4, lpos, 0.8); 
 	
 	//spotlight shadow 2
 	lpos = shadow_matrix[5]*spos;
-	gl_FragColor[3] = pcfShadow(shadowMap5, lpos, 0.8); 
+	frag_color[3] = pcfShadow(shadowMap5, lpos, 0.8); 
 
-	//gl_FragColor.rgb = pos.xyz;
-	//gl_FragColor.b = shadow;
+	//frag_color.rgb = pos.xyz;
+	//frag_color.b = shadow;
 }
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl
deleted file mode 100644
index 0fd7b7525dc996f0690252ed88ad24c5a89f544b..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl
+++ /dev/null
@@ -1,258 +0,0 @@
-/** 
- * @file sunLightSSAOF.glsl
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-//class 2 -- shadows and SSAO
-
-uniform sampler2DMS depthMap;
-uniform sampler2DMS normalMap;
-uniform sampler2DRectShadow shadowMap0;
-uniform sampler2DRectShadow shadowMap1;
-uniform sampler2DRectShadow shadowMap2;
-uniform sampler2DRectShadow shadowMap3;
-uniform sampler2DShadow shadowMap4;
-uniform sampler2DShadow shadowMap5;
-uniform sampler2D noiseMap;
-
-// Inputs
-uniform mat4 shadow_matrix[6];
-uniform vec4 shadow_clip;
-uniform float ssao_radius;
-uniform float ssao_max_radius;
-uniform float ssao_factor;
-uniform float ssao_factor_inv;
-
-varying vec2 vary_fragcoord;
-varying vec4 vary_light;
-
-uniform mat4 inv_proj;
-uniform vec2 screen_res;
-uniform vec2 shadow_res;
-uniform vec2 proj_shadow_res;
-
-uniform float shadow_bias;
-uniform float shadow_offset;
-
-uniform float spot_shadow_bias;
-uniform float spot_shadow_offset;
-
-vec4 getPosition(ivec2 pos_screen, int sample)
-{
-	float depth = texelFetch(depthMap, pos_screen, sample).r;
-	vec2 sc = vec2(pos_screen.xy)*2.0;
-	sc /= screen_res;
-	sc -= vec2(1.0,1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
-//calculate decreases in ambient lighting when crowded out (SSAO)
-float calcAmbientOcclusion(vec4 pos, vec3 norm, int sample)
-{
-	float ret = 1.0;
-
-	vec2 kern[8];
-	// exponentially (^2) distant occlusion samples spread around origin
-	kern[0] = vec2(-1.0, 0.0) * 0.125*0.125;
-	kern[1] = vec2(1.0, 0.0) * 0.250*0.250;
-	kern[2] = vec2(0.0, 1.0) * 0.375*0.375;
-	kern[3] = vec2(0.0, -1.0) * 0.500*0.500;
-	kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625;
-	kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750;
-	kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875;
-	kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000;
-
-	vec2 pos_screen = vary_fragcoord.xy;
-	vec3 pos_world = pos.xyz;
-	vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy;
-		
-	float angle_hidden = 0.0;
-	int points = 0;
-		
-	float scale = min(ssao_radius / -pos_world.z, ssao_max_radius);
-		
-	// it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?)
-	for (int i = 0; i < 8; i++)
-	{
-		ivec2 samppos_screen = ivec2(pos_screen + scale * reflect(kern[i], noise_reflect));
-		vec3 samppos_world = getPosition(samppos_screen, sample).xyz; 
-			
-		vec3 diff = pos_world - samppos_world;
-		float dist2 = dot(diff, diff);
-			
-		// assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area
-		// --> solid angle shrinking by the square of distance
-		//radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2
-		//(k should vary inversely with # of samples, but this is taken care of later)
-			
-		angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv);
-			
-		// 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion" 
-		points = points + int(diff.z > -1.0);
-	}
-		
-	angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0);
-		
-	ret = (1.0 - (float(points != 0) * angle_hidden));
-	
-	return min(ret, 1.0);
-}
-
-float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl)
-{
-	stc.xyz /= stc.w;
-	stc.z += shadow_bias*scl;
-	
-	float cs = shadow2DRect(shadowMap, stc.xyz).x;
-	float shadow = cs;
-
-	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(1.5, 1.5, 0.0)).x, cs);
-	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(1.5, -1.5, 0.0)).x, cs);
-	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-1.5, 1.5, 0.0)).x, cs);
-	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-1.5, -1.5, 0.0)).x, cs);
-			
-	return shadow/5.0;
-	
-	//return shadow;
-}
-
-float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl)
-{
-	stc.xyz /= stc.w;
-	stc.z += spot_shadow_bias*scl;
-	
-	float cs = shadow2D(shadowMap, stc.xyz).x;
-	float shadow = cs;
-
-	vec2 off = 1.5/proj_shadow_res;
-	
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)).x, cs);
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x, cs);
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x, cs);
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x, cs);
-	
-			
-	return shadow/5.0;
-	
-	//return shadow;
-}
-
-void main() 
-{
-	vec2 pos_screen = vary_fragcoord.xy;
-	ivec2 itc = ivec2(pos_screen);
-	vec4 fcol = vec4(0,0,0,0);
-
-	for (int i = 0; i < samples; i++)
-	{
-		vec4 pos = getPosition(itc, i);
-	
-		vec4 nmap4 = texelFetch(normalMap, itc, i);
-		nmap4 = vec4((nmap4.xy-0.5)*2.0,nmap4.z,nmap4.w); // unpack norm
-		float displace = nmap4.w;
-		vec3 norm = nmap4.xyz;
-	
-		float shadow = 1.0;
-		float dp_directional_light = max(0.0, dot(norm, vary_light.xyz));
-
-		vec3 shadow_pos = pos.xyz + displace*norm;
-		vec3 offset = vary_light.xyz * (1.0-dp_directional_light);
-	
-		vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0);
-	
-		if (spos.z > -shadow_clip.w)
-		{	
-			if (dp_directional_light == 0.0)
-			{
-				// if we know this point is facing away from the sun then we know it's in shadow without having to do a squirrelly shadow-map lookup
-				shadow = 0.0;
-			}
-			else
-			{
-				vec4 lpos;
-			
-				if (spos.z < -shadow_clip.z)
-				{
-					lpos = shadow_matrix[3]*spos;
-					lpos.xy *= shadow_res;
-					shadow = pcfShadow(shadowMap3, lpos, 0.25);
-					shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
-				}
-				else if (spos.z < -shadow_clip.y)
-				{
-					lpos = shadow_matrix[2]*spos;
-					lpos.xy *= shadow_res;
-					shadow = pcfShadow(shadowMap2, lpos, 0.5);
-				}
-				else if (spos.z < -shadow_clip.x)
-				{
-					lpos = shadow_matrix[1]*spos;
-					lpos.xy *= shadow_res;
-					shadow = pcfShadow(shadowMap1, lpos, 0.75);
-				}
-				else
-				{
-					lpos = shadow_matrix[0]*spos;
-					lpos.xy *= shadow_res;
-					shadow = pcfShadow(shadowMap0, lpos, 1.0);
-				}
-		
-				// take the most-shadowed value out of these two:
-				//  * the blurred sun shadow in the light (shadow) map
-				//  * an unblurred dot product between the sun and this norm
-				// the goal is to err on the side of most-shadow to fill-in shadow holes and reduce artifacting
-				shadow = min(shadow, dp_directional_light);
-			
-			}
-		}
-		else
-		{
-			// more distant than the shadow map covers
-			shadow = 1.0;
-		}
-	
-		
-		fcol[0] += shadow;
-		fcol[1] += calcAmbientOcclusion(pos, norm, i);
-
-		spos.xyz = shadow_pos+offset*spot_shadow_offset;
-	
-		//spotlight shadow 1
-		vec4 lpos = shadow_matrix[4]*spos;
-		fcol[2] += pcfShadow(shadowMap4, lpos, 0.8); 
-	
-		//spotlight shadow 2
-		lpos = shadow_matrix[5]*spos;
-		fcol[3] += pcfShadow(shadowMap5, lpos, 0.8); 
-	}
-		
-	gl_FragColor = fcol / samples;
-}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
index e7ab11c6ed2866e939c32c39def4d78d7a430dd6..bc5eb5181d0317864c5982fc27b17366760462e6 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
@@ -1,5 +1,5 @@
 /** 
- * @file sunLightF.glsl
+ * @file sunLightV.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -22,24 +22,20 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 modelview_projection_matrix;
 
-varying vec4 vary_light;
-varying vec2 vary_fragcoord;
+ATTRIBUTE vec3 position;
+
+VARYING vec2 vary_fragcoord;
 
 uniform vec2 screen_res;
 
 void main()
 {
 	//transform vertex
-	gl_Position = ftransform(); 
-	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
-	vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;	
-	vec4 tex = gl_MultiTexCoord0;
-	tex.w = 1.0;
+	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+	gl_Position = pos; 
 	
-	vary_light = gl_MultiTexCoord0;
-		
-	gl_FrontColor = gl_Color;
+	vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;	
 }
diff --git a/indra/newview/app_settings/shaders/class2/effects/blurF.glsl b/indra/newview/app_settings/shaders/class2/effects/blurF.glsl
deleted file mode 100644
index 35411db04b3579202ac5d6d9b1514411beef6126..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/effects/blurF.glsl
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * @file blurf.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-uniform sampler2DRect RenderTexture;
-uniform float bloomStrength;
-
-varying vec4 gl_TexCoord[gl_MaxTextureCoords];
-void main(void) 
-{
-	float blurWeights[7];
-	blurWeights[0] = 0.05;
-	blurWeights[1] = 0.1;
-	blurWeights[2] = 0.2;
-	blurWeights[3] = 0.3;
-	blurWeights[4] = 0.2;
-	blurWeights[5] = 0.1;
-	blurWeights[6] = 0.05;
-	
-	vec3 color = vec3(0,0,0);
-	for (int i = 0; i < 7; i++){
-		color += vec3(texture2DRect(RenderTexture, gl_TexCoord[i].st)) * blurWeights[i];
-	}
-
-	color *= bloomStrength;
-
-	gl_FragColor = vec4(color, 1.0);
-}
diff --git a/indra/newview/app_settings/shaders/class2/effects/blurV.glsl b/indra/newview/app_settings/shaders/class2/effects/blurV.glsl
deleted file mode 100644
index 3e47ed15fe44bc68f2d92ec583c896ee040ab712..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/effects/blurV.glsl
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * @file blurV.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-uniform vec2 texelSize;
-uniform vec2 blurDirection;
-uniform float blurWidth;
-
-void main(void)
-{
-	// Transform vertex
-	gl_Position = ftransform();
-	
-	vec2 blurDelta = texelSize * blurDirection * vec2(blurWidth, blurWidth);
-	vec2 s = gl_MultiTexCoord0.st - (blurDelta * 3.0);
-	
-	// for (int i = 0; i < 7; i++) {
-		// gl_TexCoord[i].st = s + (i * blurDelta);
-	// }
-
-	// MANUALLY UNROLL
-	gl_TexCoord[0].st = s;
-	gl_TexCoord[1].st = s + blurDelta;
-	gl_TexCoord[2].st = s + (2. * blurDelta);
-	gl_TexCoord[3].st = s + (3. * blurDelta);
-	gl_TexCoord[4].st = s + (4. * blurDelta);
-	gl_TexCoord[5].st = s + (5. * blurDelta);
-	gl_TexCoord[6].st = s + (6. * blurDelta);
-
-	// gl_TexCoord[0].st = s;
-	// gl_TexCoord[1].st = blurDelta;
-}
diff --git a/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl b/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl
deleted file mode 100644
index 42ab8d40e88529da650c0638566f360a4c27c234..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * @file colorFilterF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-uniform sampler2DRect RenderTexture;
-uniform float brightness;
-uniform float contrast;
-uniform vec3  contrastBase;
-uniform float saturation;
-uniform vec3  lumWeights;
-
-const float gamma = 2.0;
-
-void main(void) 
-{
-	vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st));
-
-	/// Modulate brightness
-	color *= brightness;
-
-	/// Modulate contrast
-	color = mix(contrastBase, color, contrast);
-
-	/// Modulate saturation
-	color = mix(vec3(dot(color, lumWeights)), color, saturation);
-
-	gl_FragColor = vec4(color, 1.0);
-}
diff --git a/indra/newview/app_settings/shaders/class2/effects/extractF.glsl b/indra/newview/app_settings/shaders/class2/effects/extractF.glsl
deleted file mode 100644
index 9187c8ec313aff5f6c033ed1e5b31191263b8896..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/effects/extractF.glsl
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * @file extractF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-uniform sampler2DRect RenderTexture;
-uniform float extractLow;
-uniform float extractHigh;
-uniform vec3 lumWeights;
-
-void main(void) 
-{
-	/// Get scene color
-	vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st));
-	
-	/// Extract luminance and scale up by night vision brightness
-	float lum = smoothstep(extractLow, extractHigh, dot(color, lumWeights));
-
-	gl_FragColor = vec4(vec3(lum), 1.0);
-}
diff --git a/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl b/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl
deleted file mode 100644
index 76b675a9bdfe044f97f9256e1e598111270981cf..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * @file nightVisionF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-uniform sampler2DRect RenderTexture;
-uniform sampler2D NoiseTexture;
-uniform float brightMult;
-uniform float noiseStrength;
-
-float luminance(vec3 color)
-{
-	/// CALCULATING LUMINANCE (Using NTSC lum weights)
-	/// http://en.wikipedia.org/wiki/Luma_%28video%29
-	return dot(color, vec3(0.299, 0.587, 0.114));
-}
-
-void main(void) 
-{
-	/// Get scene color
-	vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st));
-	
-	/// Extract luminance and scale up by night vision brightness
-	float lum = luminance(color) * brightMult;
-
-	/// Convert into night vision color space
-	/// Newer NVG colors (crisper and more saturated)
-	vec3 outColor = (lum * vec3(0.91, 1.21, 0.9)) + vec3(-0.07, 0.1, -0.12); 
-
-	/// Add noise
-	float noiseValue = texture2D(NoiseTexture, gl_TexCoord[1].st).r;
-	noiseValue = (noiseValue - 0.5) * noiseStrength;
-
-	/// Older NVG colors (more muted)
-	// vec3 outColor = (lum * vec3(0.82, 0.75, 0.83)) + vec3(0.05, 0.32, -0.11); 
-	
-	outColor += noiseValue;
-
-	gl_FragColor = vec4(outColor, 1.0);
-}
diff --git a/indra/newview/app_settings/shaders/class2/environment/terrainF.glsl b/indra/newview/app_settings/shaders/class2/environment/terrainF.glsl
deleted file mode 100644
index df08fce0daa5237571c7352a10c6cbf37b4d8ca3..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/environment/terrainF.glsl
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * @file terrainF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-uniform sampler2D detail_0;
-uniform sampler2D detail_1;
-uniform sampler2D detail_2;
-uniform sampler2D detail_3;
-uniform sampler2D alpha_ramp;
-
-vec3 atmosLighting(vec3 light);
-
-vec3 scaleSoftClip(vec3 color);
-
-void main()
-{
-	/// Note: This should duplicate the blending functionality currently used for the terrain rendering.
-	
-	/// TODO Confirm tex coords and bind them appropriately in vert shader.
-	vec4 color0 = texture2D(detail_0, gl_TexCoord[0].xy);
-	vec4 color1 = texture2D(detail_1, gl_TexCoord[0].xy);
-	vec4 color2 = texture2D(detail_2, gl_TexCoord[0].xy);
-	vec4 color3 = texture2D(detail_3, gl_TexCoord[0].xy);
-
-	float alpha1 = texture2D(alpha_ramp, gl_TexCoord[0].zw).a;
-	float alpha2 = texture2D(alpha_ramp,gl_TexCoord[1].xy).a;
-	float alphaFinal = texture2D(alpha_ramp, gl_TexCoord[1].zw).a;
-	vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal );
-	
-	/// Add WL Components
-	outColor.rgb = atmosLighting(outColor.rgb * gl_Color.rgb);
-	
-	gl_FragColor = vec4(scaleSoftClip(outColor.rgb), 1.0);
-}
-
diff --git a/indra/newview/app_settings/shaders/class2/environment/terrainWaterF.glsl b/indra/newview/app_settings/shaders/class2/environment/terrainWaterF.glsl
deleted file mode 100644
index 90468b45a227c2f5e09cc23c2b8c7cecabae695f..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/environment/terrainWaterF.glsl
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * @file terrainWaterF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-uniform sampler2D detail_0;
-uniform sampler2D detail_1;
-uniform sampler2D detail_2;
-uniform sampler2D detail_3;
-uniform sampler2D alpha_ramp;
-
-vec3 atmosLighting(vec3 light);
-
-vec4 applyWaterFog(vec4 color);
-
-void main()
-{
-	/// Note: This should duplicate the blending functionality currently used for the terrain rendering.
-	
-	/// TODO Confirm tex coords and bind them appropriately in vert shader.
-	vec4 color0 = texture2D(detail_0, gl_TexCoord[0].xy);
-	vec4 color1 = texture2D(detail_1, gl_TexCoord[0].xy);
-	vec4 color2 = texture2D(detail_2, gl_TexCoord[0].xy);
-	vec4 color3 = texture2D(detail_3, gl_TexCoord[0].xy);
-
-	float alpha1 = texture2D(alpha_ramp, gl_TexCoord[0].zw).a;
-	float alpha2 = texture2D(alpha_ramp,gl_TexCoord[1].xy).a;
-	float alphaFinal = texture2D(alpha_ramp, gl_TexCoord[1].zw).a;
-	vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal );
-	
-	/// Add WL Components
-	outColor.rgb = atmosLighting(outColor.rgb * gl_Color.rgb);
-	
-	outColor = applyWaterFog(outColor);
-	gl_FragColor = outColor;
-}
-
diff --git a/indra/newview/app_settings/shaders/class2/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class2/environment/underWaterF.glsl
deleted file mode 100644
index f947aa4be10120774213c6db507607f377158ca0..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/environment/underWaterF.glsl
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * @file underWaterF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-uniform sampler2D diffuseMap;
-uniform sampler2D bumpMap;   
-uniform sampler2D screenTex;
-uniform sampler2D refTex;
-uniform sampler2D screenDepth;
-
-uniform vec4 fogCol;
-uniform vec3 lightDir;
-uniform vec3 specular;
-uniform float lightExp;
-uniform vec2 fbScale;
-uniform float refScale;
-uniform float znear;
-uniform float zfar;
-uniform float kd;
-uniform vec4 waterPlane;
-uniform vec3 eyeVec;
-uniform vec4 waterFogColor;
-uniform float waterFogDensity;
-uniform float waterFogKS;
-uniform vec2 screenRes;
-
-//bigWave is (refCoord.w, view.w);
-varying vec4 refCoord;
-varying vec4 littleWave;
-varying vec4 view;
-
-vec4 applyWaterFog(vec4 color, vec3 viewVec)
-{
-	//normalize view vector
-	vec3 view = normalize(viewVec);
-	float es = -view.z;
-
-	//find intersection point with water plane and eye vector
-	
-	//get eye depth
-	float e0 = max(-waterPlane.w, 0.0);
-	
-	//get object depth
-	float depth = length(viewVec);
-		
-	//get "thickness" of water
-	float l = max(depth, 0.1);
-
-	float kd = waterFogDensity;
-	float ks = waterFogKS;
-	vec4 kc = waterFogColor;
-	
-	float F = 0.98;
-	
-	float t1 = -kd * pow(F, ks * e0);
-	float t2 = kd + ks * es;
-	float t3 = pow(F, t2*l) - 1.0;
-	
-	float L = min(t1/t2*t3, 1.0);
-	
-	float D = pow(0.98, l*kd);
-	//return vec4(1.0, 0.0, 1.0, 1.0);
-	return color * D + kc * L;
-	//depth /= 10.0;
-	//return vec4(depth,depth,depth,0.0);
-}
-
-void main() 
-{
-	vec4 color;
-	    
-	//get detail normals
-	vec3 wave1 = texture2D(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0;
-	vec3 wave2 = texture2D(bumpMap, littleWave.xy).xyz*2.0-1.0;
-	vec3 wave3 = texture2D(bumpMap, littleWave.zw).xyz*2.0-1.0;    
-	vec3 wavef = normalize(wave1+wave2+wave3);
-	
-	//figure out distortion vector (ripply)   
-	vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5;
-	distort = distort+wavef.xy*refScale;
-		
-	vec4 fb = texture2D(screenTex, distort);
-	
-	gl_FragColor = applyWaterFog(fb,view.xyz);
-}
diff --git a/indra/newview/app_settings/shaders/class2/environment/waterF.glsl b/indra/newview/app_settings/shaders/class2/environment/waterF.glsl
deleted file mode 100644
index dc543b2231a13ddc95b02c357916ed4ef2b5d0ea..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/environment/waterF.glsl
+++ /dev/null
@@ -1,137 +0,0 @@
-/** 
- * @file waterF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-vec3 scaleSoftClip(vec3 inColor);
-vec3 atmosTransport(vec3 inColor);
-
-uniform sampler2D bumpMap;   
-uniform sampler2D screenTex;
-uniform sampler2D refTex;
-
-uniform float sunAngle;
-uniform float sunAngle2;
-uniform vec3 lightDir;
-uniform vec3 specular;
-uniform float lightExp;
-uniform float refScale;
-uniform float kd;
-uniform vec2 screenRes;
-uniform vec3 normScale;
-uniform float fresnelScale;
-uniform float fresnelOffset;
-uniform float blurMultiplier;
-
-
-//bigWave is (refCoord.w, view.w);
-varying vec4 refCoord;
-varying vec4 littleWave;
-varying vec4 view;
-
-void main() 
-{
-	vec4 color;
-	
-	float dist = length(view.xy);
-	
-	//normalize view vector
-	vec3 viewVec = normalize(view.xyz);
-	
-	//get wave normals
-	vec3 wave1 = texture2D(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0;
-	vec3 wave2 = texture2D(bumpMap, littleWave.xy).xyz*2.0-1.0;
-	vec3 wave3 = texture2D(bumpMap, littleWave.zw).xyz*2.0-1.0;
-	//get base fresnel components	
-	
-	vec3 df = vec3(
-					dot(viewVec, wave1),
-					dot(viewVec, (wave2 + wave3) * 0.5),
-					dot(viewVec, wave3)
-				 ) * fresnelScale + fresnelOffset;
-	df *= df;
-		    
-	vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5;
-	
-	float dist2 = dist;
-	dist = max(dist, 5.0);
-	
-	float dmod = sqrt(dist);
-	
-	vec2 dmod_scale = vec2(dmod*dmod, dmod);
-	
-	//get reflected color
-	vec2 refdistort1 = wave1.xy*normScale.x;
-	vec2 refvec1 = distort+refdistort1/dmod_scale;
-	vec4 refcol1 = texture2D(refTex, refvec1);
-	
-	vec2 refdistort2 = wave2.xy*normScale.y;
-	vec2 refvec2 = distort+refdistort2/dmod_scale;
-	vec4 refcol2 = texture2D(refTex, refvec2);
-	
-	vec2 refdistort3 = wave3.xy*normScale.z;
-	vec2 refvec3 = distort+refdistort3/dmod_scale;
-	vec4 refcol3 = texture2D(refTex, refvec3);
-
-	vec4 refcol = refcol1 + refcol2 + refcol3;
-	float df1 = df.x + df.y + df.z;
-	refcol *= df1 * 0.333;
-	
-	vec3 wavef = (wave1 + wave2 * 0.4 + wave3 * 0.6) * 0.5;
-	
-	wavef.z *= max(-viewVec.z, 0.1);
-	wavef = normalize(wavef);
-	
-	float df2 = dot(viewVec, wavef) * fresnelScale+fresnelOffset;
-	
-	vec2 refdistort4 = wavef.xy*0.125;
-	refdistort4.y -= abs(refdistort4.y);
-	vec2 refvec4 = distort+refdistort4/dmod;
-	float dweight = min(dist2*blurMultiplier, 1.0);
-	vec4 baseCol = texture2D(refTex, refvec4);
-	refcol = mix(baseCol*df2, refcol, dweight);
-
-	//get specular component
-	float spec = clamp(dot(lightDir, (reflect(viewVec,wavef))),0.0,1.0);
-		
-	//harden specular
-	spec = pow(spec, 128.0);
-
-	//figure out distortion vector (ripply)   
-	vec2 distort2 = distort+wavef.xy*refScale/max(dmod*df1, 1.0);
-		
-	vec4 fb = texture2D(screenTex, distort2);
-	
-	//mix with reflection
-	// Note we actually want to use just df1, but multiplying by 0.999999 gets around and nvidia compiler bug
-	color.rgb = mix(fb.rgb, refcol.rgb, df1 * 0.99999);
-	color.rgb += spec * specular;
-	
-	color.rgb = atmosTransport(color.rgb);
-	color.rgb = scaleSoftClip(color.rgb);
-	color.a = spec * sunAngle2;
-
-	gl_FragColor = color;
-}
diff --git a/indra/newview/app_settings/shaders/class2/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class2/environment/waterFogF.glsl
deleted file mode 100644
index 4bdfce9260c77145dcb244b561d87ce1a4230ea7..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/environment/waterFogF.glsl
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * @file waterFogF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-uniform vec4 lightnorm;
-uniform vec4 waterPlane;
-uniform vec4 waterFogColor;
-uniform float waterFogDensity;
-uniform float waterFogKS;
-
-vec3 getPositionEye();
-
-vec4 applyWaterFog(vec4 color)
-{
-	//normalize view vector
-	vec3 view = normalize(getPositionEye());
-	float es = -(dot(view, waterPlane.xyz));
-
-	//find intersection point with water plane and eye vector
-	
-	//get eye depth
-	float e0 = max(-waterPlane.w, 0.0);
-	
-	vec3 int_v = waterPlane.w > 0.0 ? view * waterPlane.w/es : vec3(0.0, 0.0, 0.0);
-	
-	//get object depth
-	float depth = length(getPositionEye() - int_v);
-		
-	//get "thickness" of water
-	float l = max(depth, 0.1);
-
-	float kd = waterFogDensity;
-	float ks = waterFogKS;
-	vec4 kc = waterFogColor;
-	
-	float F = 0.98;
-	
-	float t1 = -kd * pow(F, ks * e0);
-	float t2 = kd + ks * es;
-	float t3 = pow(F, t2*l) - 1.0;
-	
-	float L = min(t1/t2*t3, 1.0);
-	
-	float D = pow(0.98, l*kd);
-	
-	color.rgb = color.rgb * D + kc.rgb * L;
-	color.a = kc.a + color.a;
-	
-	return color;
-}
-
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl
deleted file mode 100644
index d2bc912edb2ae3887e3b8ab2cc0095d73305a8a6..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl
+++ /dev/null
@@ -1,49 +0,0 @@
-/** 
- * @file lightFullbrightShinyF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-uniform samplerCube environmentMap;
-
-vec3 fullbrightShinyAtmosTransport(vec3 light);
-vec3 fullbrightScaleSoftClip(vec3 light);
-
-void fullbright_shiny_lighting()
-{
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy);
-	color.rgb *= gl_Color.rgb;
-	
-	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	
-	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a);
-
-	color.rgb = fullbrightShinyAtmosTransport(color.rgb);
-
-	color.rgb = fullbrightScaleSoftClip(color.rgb);
-
-	color.a = max(color.a, gl_Color.a);
-
-	gl_FragColor = color;
-}
-
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl
deleted file mode 100644
index e9dab85095886b93d820be8b98cdc220e462f879..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl
+++ /dev/null
@@ -1,48 +0,0 @@
-/** 
- * @file lightFullbrightShinyWaterF.glsl
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-
-uniform samplerCube environmentMap;
-
-vec3 fullbrightShinyAtmosTransport(vec3 light);
-vec3 fullbrightScaleSoftClip(vec3 light);
-vec4 applyWaterFog(vec4 color);
-
-void fullbright_shiny_lighting_water()
-{
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy);
-	color.rgb *= gl_Color.rgb;
-	
-	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	
-	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a);
-
-	color.rgb = fullbrightShinyAtmosTransport(color.rgb);
-	color.rgb = fullbrightScaleSoftClip(color.rgb);
-	color.a = max(color.a, gl_Color.a);
-
-	gl_FragColor = applyWaterFog(color);
-}
-
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl
deleted file mode 100644
index 20ff3712af52e86c29023eb303ee16e794d1722a..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl
+++ /dev/null
@@ -1,41 +0,0 @@
-/** 
- * @file lightFullbrightWaterF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-vec4 diffuseLookup(vec2 texcoord);
-
-vec3 fullbrightAtmosTransport(vec3 light);
-vec4 applyWaterFog(vec4 color);
-
-void fullbright_lighting_water()
-{
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
-
-	color.rgb = fullbrightAtmosTransport(color.rgb);
-	
-	gl_FragColor = applyWaterFog(color);
-}
-
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl
deleted file mode 100644
index ba4cd949d6ab0d7c59e438c9248161de57fc4b69..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl
+++ /dev/null
@@ -1,49 +0,0 @@
-/** 
- * @file lightShinyF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-
-uniform samplerCube environmentMap;
-
-vec3 scaleSoftClip(vec3 light);
-vec3 atmosLighting(vec3 light);
-vec4 applyWaterFog(vec4 color);
-
-void shiny_lighting()
-{
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy);
-	color.rgb *= gl_Color.rgb;
-	
-	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	
-	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a);
-
-	color.rgb = atmosLighting(color.rgb);
-
-	color.rgb = scaleSoftClip(color.rgb);
-	color.a = max(color.a, gl_Color.a);
-	gl_FragColor = color;
-}
-
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl
deleted file mode 100644
index c451e68763c7c2191519de27714fb45566063ccc..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl
+++ /dev/null
@@ -1,46 +0,0 @@
-/** 
- * @file lightShinyWaterF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-
-uniform samplerCube environmentMap;
-
-vec3 atmosLighting(vec3 light);
-vec4 applyWaterFog(vec4 color);
-
-void shiny_lighting_water()
-{
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy);
-	color.rgb *= gl_Color.rgb;
-	
-	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	
-	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a);
-
-	color.rgb = atmosLighting(color.rgb);
-	color.a = max(color.a, gl_Color.a);
-	gl_FragColor = applyWaterFog(color);
-}
-
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightSpecularV.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightSpecularV.glsl
deleted file mode 100644
index 24bf9b3cee5168a8cfc7928b545eddc39e8a9736..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/lighting/lightSpecularV.glsl
+++ /dev/null
@@ -1,36 +0,0 @@
-/** 
- * @file lightSpecularV.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-// All lights, no specular highlights
-
-vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol);
-
-vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol)
-{
-	return sumLightsSpecular(pos, norm, color, specularColor, baseCol);
-}
-
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl
deleted file mode 100644
index ae7be4d231d6a1823e24f04b67c1d61be99bdb23..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl
+++ /dev/null
@@ -1,39 +0,0 @@
-/** 
- * @file lightWaterF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-vec3 atmosLighting(vec3 light);
-vec4 applyWaterFog(vec4 color);
-
-void default_lighting_water()
-{
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
-
-	color.rgb = atmosLighting(color.rgb);
-
-	gl_FragColor = applyWaterFog(color);
-}
-
diff --git a/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl
index d0a12479db3343b85ace9ab7d6a58b4946682a34..3acf9fe883fa0644defbe7c297c0e44304faef11 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl
@@ -33,6 +33,10 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
 vec3 atmosGetDiffuseSunlightColor();
 vec3 scaleDownLight(vec3 light);
 
+uniform vec4 light_position[8];
+uniform vec3 light_attenuation[8]; 
+uniform vec3 light_diffuse[8];
+
 vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol)
 {
 	vec4 col = vec4(0.0, 0.0, 0.0, color.a);
@@ -43,15 +47,14 @@ vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor
 	vec4 specularSum = vec4(0.0);
 	
 	// Collect normal lights (need to be divided by two, as we later multiply by 2)
-	col.rgb += gl_LightSource[1].diffuse.rgb * calcDirectionalLightSpecular(specularColor, view, norm, gl_LightSource[1].position.xyz, gl_LightSource[1].diffuse.rgb, 1.0);
-	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, gl_LightSource[2].position.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].diffuse.rgb);
-	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, gl_LightSource[3].position.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation, gl_LightSource[3].diffuse.rgb);
-	//col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, gl_LightSource[4].position.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].diffuse.rgb);
+	col.rgb += light_diffuse[1].rgb * calcDirectionalLightSpecular(specularColor, view, norm, light_position[1].xyz,light_diffuse[1].rgb, 1.0);
+	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[2].xyz, light_attenuation[2].x, light_attenuation[2].y, light_diffuse[2].rgb); 
+	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[3].xyz, light_attenuation[3].x, light_attenuation[3].y, light_diffuse[3].rgb); 
 	col.rgb = scaleDownLight(col.rgb);
 						
 	// Add windlight lights
 	col.rgb += atmosAmbient(baseCol.rgb);
-	col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, gl_LightSource[0].position.xyz, atmosGetDiffuseSunlightColor()*baseCol.a, 1.0));
+	col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, light_position[0].xyz,atmosGetDiffuseSunlightColor()*baseCol.a, 1.0));
 
 	col.rgb = min(col.rgb*color.rgb, 1.0);
 	specularColor.rgb = min(specularColor.rgb*specularSum.rgb, 1.0);
diff --git a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl
index ad045a305805a167564caea00f536cffaaa33ef2..c9987ef3b946e5f317ec5cc5a42bab1e28410f1f 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl
@@ -23,8 +23,6 @@
  * $/LicenseInfo$
  */
  
-
-
 float calcDirectionalLight(vec3 n, vec3 l);
 float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
 
@@ -32,21 +30,26 @@ vec3 atmosAmbient(vec3 light);
 vec3 atmosAffectDirectionalLight(float lightIntensity);
 vec3 scaleDownLight(vec3 light);
 
+uniform vec4 light_position[8];
+uniform vec3 light_direction[8];
+uniform vec3 light_attenuation[8]; 
+uniform vec3 light_diffuse[8];
+
 vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight)
 {
 	vec4 col = vec4(0.0, 0.0, 0.0, color.a);
 	
 	// Collect normal lights (need to be divided by two, as we later multiply by 2)
-	col.rgb += gl_LightSource[1].diffuse.rgb * calcDirectionalLight(norm, gl_LightSource[1].position.xyz);
+	col.rgb += light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz);
+
+	col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].z);
+	col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].z);
 
-	col.rgb += gl_LightSource[2].diffuse.rgb * calcPointLightOrSpotLight(pos, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a);
-	col.rgb += gl_LightSource[3].diffuse.rgb * calcPointLightOrSpotLight(pos, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].specular.a);
-	//col.rgb += gl_LightSource[4].diffuse.rgb * calcPointLightOrSpotLight(pos, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].specular.a);
 	col.rgb = scaleDownLight(col.rgb);
 
 	// Add windlight lights
 	col.rgb += atmosAmbient(baseLight.rgb);
-	col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, gl_LightSource[0].position.xyz));
+	col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, light_position[0].xyz));
 				
 	col.rgb = min(col.rgb*color.rgb, 1.0);
 	
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
index be990c17579b617e8d2916eefff19590775e46f2..da3d922017db3ed7844e544e647ba19260ddb758 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
@@ -25,7 +25,7 @@
  
 
 
-// varying param funcs
+// VARYING param funcs
 void setSunlitColor(vec3 v);
 void setAmblitColor(vec3 v);
 void setAdditiveColor(vec3 v);
@@ -34,8 +34,8 @@ void setPositionEye(vec3 v);
 
 vec3 getAdditiveColor();
 
-//varying vec4 vary_CloudUVs;
-//varying float vary_CloudDensity;
+//VARYING vec4 vary_CloudUVs;
+//VARYING float vary_CloudDensity;
 
 // Inputs
 uniform vec4 morphFactor;
@@ -47,12 +47,12 @@ uniform vec4 sunlight_color;
 uniform vec4 ambient;
 uniform vec4 blue_horizon;
 uniform vec4 blue_density;
-uniform vec4 haze_horizon;
-uniform vec4 haze_density;
-uniform vec4 cloud_shadow;
-uniform vec4 density_multiplier;
-uniform vec4 distance_multiplier;
-uniform vec4 max_y;
+uniform float haze_horizon;
+uniform float haze_density;
+uniform float cloud_shadow;
+uniform float density_multiplier;
+uniform float distance_multiplier;
+uniform float max_y;
 uniform vec4 glow;
 
 void calcAtmospherics(vec3 inPositionEye) {
@@ -61,8 +61,8 @@ void calcAtmospherics(vec3 inPositionEye) {
 	setPositionEye(P);
 	
 	//(TERRAIN) limit altitude
-	if (P.y > max_y.x) P *= (max_y.x / P.y);
-	if (P.y < -max_y.x) P *= (-max_y.x / P.y);
+	if (P.y > max_y) P *= (max_y / P.y);
+	if (P.y < -max_y) P *= (-max_y / P.y);
 
 	vec3 tmpLightnorm = lightnorm.xyz;
 
@@ -78,13 +78,13 @@ void calcAtmospherics(vec3 inPositionEye) {
 
 	//sunlight attenuation effect (hue and brightness) due to atmosphere
 	//this is used later for sunlight modulation at various altitudes
-	light_atten = (blue_density * 1.0 + vec4(haze_density.r) * 0.25) * (density_multiplier.x * max_y.x);
+	light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
 		//I had thought blue_density and haze_density should have equal weighting,
 		//but attenuation due to haze_density tends to seem too strong
 
-	temp1 = blue_density + vec4(haze_density.r);
+	temp1 = blue_density + vec4(haze_density);
 	blue_weight = blue_density / temp1;
-	haze_weight = vec4(haze_density.r) / temp1;
+	haze_weight = vec4(haze_density) / temp1;
 
 	//(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain)
 	temp2.y = max(0.0, tmpLightnorm.y);
@@ -92,12 +92,12 @@ void calcAtmospherics(vec3 inPositionEye) {
 	sunlight *= exp( - light_atten * temp2.y);
 
 	// main atmospheric scattering line integral
-	temp2.z = Plen * density_multiplier.x;
+	temp2.z = Plen * density_multiplier;
 
 	// Transparency (-> temp1)
-	// ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier.x in a variable because the ati
+	// ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier in a variable because the ati
 	// compiler gets confused.
-	temp1 = exp(-temp1 * temp2.z * distance_multiplier.x);
+	temp1 = exp(-temp1 * temp2.z * distance_multiplier);
 
 	//final atmosphere attenuation factor
 	setAtmosAttenuation(temp1.rgb);
@@ -122,12 +122,12 @@ void calcAtmospherics(vec3 inPositionEye) {
 
 
 	//increase ambient when there are more clouds
-	vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5;
+	vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow * 0.5;
 
 	//haze color
 	setAdditiveColor(
-		vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow.x) + tmpAmbient)
-	  + (haze_horizon.r * haze_weight) * (sunlight*(1.-cloud_shadow.x) * temp2.x
+		vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow) + tmpAmbient)
+	  + (haze_horizon * haze_weight) * (sunlight*(1.-cloud_shadow) * temp2.x
 		  + tmpAmbient)));
 
 	//brightness of surface both sunlight and ambient
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl
index a98c04b25932a8137fe0dd59c4bbad55234679d3..765b0927c3acc27cf0f87f8fc558b0ec5bddd5a8 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl
@@ -24,25 +24,17 @@
  */
  
 
+VARYING vec3 vary_SunlitColor;
+VARYING vec3 vary_AdditiveColor;
+VARYING vec3 vary_AtmosAttenuation;
 
-varying vec3 vary_PositionEye;
-
-varying vec3 vary_SunlitColor;
-varying vec3 vary_AmblitColor;
-varying vec3 vary_AdditiveColor;
-varying vec3 vary_AtmosAttenuation;
-
-vec3 getPositionEye()
-{
-	return vary_PositionEye;
-}
 vec3 getSunlitColor()
 {
-	return vary_SunlitColor;
+	return vec3(0,0,0);
 }
 vec3 getAmblitColor()
 {
-	return vary_AmblitColor;
+	return vec3(0,0,0);
 }
 vec3 getAdditiveColor()
 {
@@ -50,5 +42,5 @@ vec3 getAdditiveColor()
 }
 vec3 getAtmosAttenuation()
 {
-	return vary_AtmosAttenuation;
+	return vec3(vary_AtmosAttenuation);
 }
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl
index 7c3cb88b3ce73900075b3fa93cea44e7ef34da33..99dbee15eed4006818f8f5a730990e86f68a3990 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl
@@ -24,57 +24,61 @@
  */
  
 
+VARYING vec3 vary_AdditiveColor;
+VARYING vec3 vary_AtmosAttenuation;
 
-varying vec3 vary_PositionEye;
+vec3 additive_color;
+vec3 atmos_attenuation;
+vec3 sunlit_color;
+vec3 amblit_color;
+vec3 position_eye;
 
-varying vec3 vary_SunlitColor;
-varying vec3 vary_AmblitColor;
-varying vec3 vary_AdditiveColor;
-varying vec3 vary_AtmosAttenuation;
-
-vec3 getPositionEye()
-{
-	return vary_PositionEye;
-}
 vec3 getSunlitColor()
 {
-	return vary_SunlitColor;
+	return sunlit_color;
 }
 vec3 getAmblitColor()
 {
-	return vary_AmblitColor;
+	return amblit_color;
 }
+
 vec3 getAdditiveColor()
 {
-	return vary_AdditiveColor;
+	return additive_color;
 }
 vec3 getAtmosAttenuation()
 {
-	return vary_AtmosAttenuation;
+	return atmos_attenuation;
 }
 
+vec3 getPositionEye()
+{
+	return position_eye;
+}
 
 void setPositionEye(vec3 v)
 {
-	vary_PositionEye = v;
+	position_eye = v;
 }
 
 void setSunlitColor(vec3 v)
 {
-	vary_SunlitColor = v;
+	sunlit_color  = v;
 }
 
 void setAmblitColor(vec3 v)
 {
-	vary_AmblitColor = v;
+	amblit_color = v;
 }
 
 void setAdditiveColor(vec3 v)
 {
+	additive_color = v;
 	vary_AdditiveColor = v;
 }
 
 void setAtmosAttenuation(vec3 v)
 {
+	atmos_attenuation = v;
 	vary_AtmosAttenuation = v;
 }
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterF.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..163ef26444615a51a7ce25e698adaefe57b0e1ae
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterF.glsl
@@ -0,0 +1,50 @@
+/** 
+ * @file atmosphericVarsWaterF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+ 
+VARYING vec3 vary_PositionEye;
+VARYING vec3 vary_AdditiveColor;
+VARYING vec3 vary_AtmosAttenuation;
+
+vec3 getSunlitColor()
+{
+	return vec3(0,0,0);
+}
+vec3 getAmblitColor()
+{
+	return vec3(0,0,0);
+}
+vec3 getAdditiveColor()
+{
+	return vary_AdditiveColor;
+}
+vec3 getAtmosAttenuation()
+{
+	return vary_AtmosAttenuation;
+}
+vec3 getPositionEye()
+{
+	return vary_PositionEye;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterV.glsl
similarity index 56%
rename from indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl
rename to indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterV.glsl
index 41849858e7d9ec2f447b619a6c9923faec1b6c6e..553f6752e631ed1af2b6f4b2f482a956a3edbbc7 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterV.glsl
@@ -1,5 +1,5 @@
 /** 
- * @file postDeferredF.glsl
+ * @file atmosphericVarsWaterV.glsl
  *
  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -23,33 +23,59 @@
  * $/LicenseInfo$
  */
  
+VARYING vec3 vary_PositionEye;
+VARYING vec3 vary_AdditiveColor;
+VARYING vec3 vary_AtmosAttenuation;
 
+vec3 atmos_attenuation;
+vec3 sunlit_color;
+vec3 amblit_color;
 
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
+vec3 getSunlitColor()
+{
+	return sunlit_color;
+}
+vec3 getAmblitColor()
+{
+	return amblit_color;
+}
 
-uniform sampler2DMS diffuseRect;
-uniform sampler2D bloomMap;
+vec3 getAdditiveColor()
+{
+	return vary_AdditiveColor;
+}
+vec3 getAtmosAttenuation()
+{
+	return atmos_attenuation;
+}
 
-uniform vec2 screen_res;
-varying vec2 vary_fragcoord;
+vec3 getPositionEye()
+{
+	return vary_PositionEye;
+}
 
-vec4 texture2DMS(sampler2DMS tex, ivec2 tc)
+void setPositionEye(vec3 v)
 {
-	vec4 ret = vec4(0,0,0,0);
+	vary_PositionEye = v;
+}
 
-	for (int i = 0; i < samples; ++i)
-	{
-		 ret += texelFetch(tex,tc,i);
-	}
+void setSunlitColor(vec3 v)
+{
+	sunlit_color  = v;
+}
 
-	return ret/samples;
+void setAmblitColor(vec3 v)
+{
+	amblit_color = v;
 }
 
-void main() 
+void setAdditiveColor(vec3 v)
 {
-	vec4 diff = texture2DMS(diffuseRect, ivec2(vary_fragcoord.xy));
+	vary_AdditiveColor = v;
+}
 
-	vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res);
-	gl_FragColor = diff + bloom;
+void setAtmosAttenuation(vec3 v)
+{
+	atmos_attenuation = v;
+	vary_AtmosAttenuation = v;
 }
diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl
index b90cec119b73f72f108efd8cc62efbf958c4522c..96c70651b1135523aa44e7dcbf0c66914fe9b7bf 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl
@@ -23,15 +23,23 @@
  * $/LicenseInfo$
  */
  
-
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
 /////////////////////////////////////////////////////////////////////////
 // The fragment shader for the sky
 /////////////////////////////////////////////////////////////////////////
 
-varying vec4 vary_CloudColorSun;
-varying vec4 vary_CloudColorAmbient;
-varying float vary_CloudDensity;
+VARYING vec4 vary_CloudColorSun;
+VARYING vec4 vary_CloudColorAmbient;
+VARYING float vary_CloudDensity;
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
+VARYING vec2 vary_texcoord2;
+VARYING vec2 vary_texcoord3;
 
 uniform sampler2D cloud_noise_texture;
 uniform vec4 cloud_pos_density1;
@@ -50,14 +58,14 @@ vec3 scaleSoftClip(vec3 light) {
 void main()
 {
 	// Set variables
-	vec2 uv1 = gl_TexCoord[0].xy;
-	vec2 uv2 = gl_TexCoord[1].xy;
+	vec2 uv1 = vary_texcoord0.xy;
+	vec2 uv2 = vary_texcoord1.xy;
 
 	vec4 cloudColorSun = vary_CloudColorSun;
 	vec4 cloudColorAmbient = vary_CloudColorAmbient;
 	float cloudDensity = vary_CloudDensity;
-	vec2 uv3 = gl_TexCoord[2].xy;
-	vec2 uv4 = gl_TexCoord[3].xy;
+	vec2 uv3 = vary_texcoord2.xy;
+	vec2 uv4 = vary_texcoord3.xy;
 
 	// Offset texture coords
 	uv1 += cloud_pos_density1.xy;	//large texture, visible density
@@ -90,7 +98,7 @@ void main()
 	color *= 2.;
 
 	/// Gamma correct for WL (soft clip effect).
-	gl_FragColor.rgb = scaleSoftClip(color.rgb);
-	gl_FragColor.a = alpha1;
+	frag_color.rgb = scaleSoftClip(color.rgb);
+	frag_color.a = alpha1;
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
index c175a834c23386c0e5c866fdf0aaf57efd74b078..c1dd45cd6729e9fbb3b9c7b6e849222cecf9a215 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
@@ -22,17 +22,24 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
 
 //////////////////////////////////////////////////////////////////////////
 // The vertex shader for creating the atmospheric sky
 ///////////////////////////////////////////////////////////////////////////////
 
 // Output parameters
-varying vec4 vary_CloudColorSun;
-varying vec4 vary_CloudColorAmbient;
-varying float vary_CloudDensity;
+VARYING vec4 vary_CloudColorSun;
+VARYING vec4 vary_CloudColorAmbient;
+VARYING float vary_CloudDensity;
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
+VARYING vec2 vary_texcoord2;
+VARYING vec2 vary_texcoord3;
 
 // Inputs
 uniform vec3 camPosLocal;
@@ -42,34 +49,34 @@ uniform vec4 sunlight_color;
 uniform vec4 ambient;
 uniform vec4 blue_horizon;
 uniform vec4 blue_density;
-uniform vec4 haze_horizon;
-uniform vec4 haze_density;
+uniform float haze_horizon;
+uniform float haze_density;
 
-uniform vec4 cloud_shadow;
-uniform vec4 density_multiplier;
-uniform vec4 max_y;
+uniform float cloud_shadow;
+uniform float density_multiplier;
+uniform float max_y;
 
 uniform vec4 glow;
 
 uniform vec4 cloud_color;
 
-uniform vec4 cloud_scale;
+uniform float cloud_scale;
 
 void main()
 {
 
 	// World / view / projection
-	gl_Position = ftransform();
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
 
-	gl_TexCoord[0] = gl_MultiTexCoord0;
+	vary_texcoord0 = texcoord0;
 
 	// Get relative position
-	vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0);
+	vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
 
 	// Set altitude
 	if (P.y > 0.)
 	{
-		P *= (max_y.x / P.y);
+		P *= (max_y / P.y);
 	}
 	else
 	{
@@ -91,12 +98,12 @@ void main()
 
 	// Sunlight attenuation effect (hue and brightness) due to atmosphere
 	// this is used later for sunlight modulation at various altitudes
-	light_atten = (blue_density * 1.0 + haze_density.x * 0.25) * (density_multiplier.x * max_y.x);
+	light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
 
 	// Calculate relative weights
-	temp1 = blue_density + haze_density.x;
+	temp1 = blue_density + haze_density;
 	blue_weight = blue_density / temp1;
-	haze_weight = haze_density.x / temp1;
+	haze_weight = haze_density / temp1;
 
 	// Compute sunlight from P & lightnorm (for long rays like sky)
 	temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y );
@@ -104,7 +111,7 @@ void main()
 	sunlight *= exp( - light_atten * temp2.y);
 
 	// Distance
-	temp2.z = Plen * density_multiplier.x;
+	temp2.z = Plen * density_multiplier;
 
 	// Transparency (-> temp1)
 	// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
@@ -128,14 +135,14 @@ void main()
 
 	// Increase ambient when there are more clouds
 	vec4 tmpAmbient = ambient;
-	tmpAmbient += (1. - tmpAmbient) * cloud_shadow.x * 0.5; 
+	tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; 
 
 	// Dim sunlight by cloud shadow percentage
-	sunlight *= (1. - cloud_shadow.x);
+	sunlight *= (1. - cloud_shadow);
 
 	// Haze color below cloud
 	vec4 additiveColorBelowCloud = (	  blue_horizon * blue_weight * (sunlight + tmpAmbient)
-				+ (haze_horizon.r * haze_weight) * (sunlight * temp2.x + tmpAmbient)
+				+ (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient)
 			 );	
 
 	// CLOUDS
@@ -156,21 +163,21 @@ void main()
 	vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - temp1);
 
 	// Make a nice cloud density based on the cloud_shadow value that was passed in.
-	vary_CloudDensity = 2. * (cloud_shadow.x - 0.25);
+	vary_CloudDensity = 2. * (cloud_shadow - 0.25);
 
 
 	// Texture coords
-	gl_TexCoord[0] = gl_MultiTexCoord0;
-	gl_TexCoord[0].xy -= 0.5;
-	gl_TexCoord[0].xy /= cloud_scale.x;
-	gl_TexCoord[0].xy += 0.5;
+	vary_texcoord0 = texcoord0;
+	vary_texcoord0.xy -= 0.5;
+	vary_texcoord0.xy /= cloud_scale;
+	vary_texcoord0.xy += 0.5;
 
-	gl_TexCoord[1] = gl_TexCoord[0];
-	gl_TexCoord[1].x += lightnorm.x * 0.0125;
-	gl_TexCoord[1].y += lightnorm.z * 0.0125;
+	vary_texcoord1 = vary_texcoord0;
+	vary_texcoord1.x += lightnorm.x * 0.0125;
+	vary_texcoord1.y += lightnorm.z * 0.0125;
 
-	gl_TexCoord[2] = gl_TexCoord[0] * 16.;
-	gl_TexCoord[3] = gl_TexCoord[1] * 16.;
+	vary_texcoord2 = vary_texcoord0 * 16.;
+	vary_texcoord3 = vary_texcoord1 * 16.;
 
 	// Combine these to minimize register use
 	vary_CloudColorAmbient += oHazeColorBelowCloud;
diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl
index ac569e8257864da5b0bef882a73329c8deacb08a..e2a2367626a339a5ca71e9801ddd375b03c48b7d 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl
@@ -23,13 +23,17 @@
  * $/LicenseInfo$
  */
  
-
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
 
 /////////////////////////////////////////////////////////////////////////
 // The fragment shader for the sky
 /////////////////////////////////////////////////////////////////////////
 
-varying vec4 vary_HazeColor;
+VARYING vec4 vary_HazeColor;
 
 uniform sampler2D cloud_noise_texture;
 uniform vec4 gamma;
@@ -55,7 +59,7 @@ void main()
 	color *= 2.;
 
 	/// Gamma correct for WL (soft clip effect).
-	gl_FragColor.rgb = scaleSoftClip(color.rgb);
-	gl_FragColor.a = 1.0;
+	frag_color.rgb = scaleSoftClip(color.rgb);
+	frag_color.a = 1.0;
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
index 3a44bb6d261af16a1a9fc5f87539a66c9edc32ea..3788ddaf2d4f37b53817790468b01d718fc82d32 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
@@ -23,14 +23,16 @@
  * $/LicenseInfo$
  */
  
+uniform mat4 modelview_projection_matrix;
 
+ATTRIBUTE vec3 position;
 
 // SKY ////////////////////////////////////////////////////////////////////////
 // The vertex shader for creating the atmospheric sky
 ///////////////////////////////////////////////////////////////////////////////
 
 // Output parameters
-varying vec4 vary_HazeColor;
+VARYING vec4 vary_HazeColor;
 
 // Inputs
 uniform vec3 camPosLocal;
@@ -40,34 +42,31 @@ uniform vec4 sunlight_color;
 uniform vec4 ambient;
 uniform vec4 blue_horizon;
 uniform vec4 blue_density;
-uniform vec4 haze_horizon;
-uniform vec4 haze_density;
+uniform float haze_horizon;
+uniform float haze_density;
 
-uniform vec4 cloud_shadow;
-uniform vec4 density_multiplier;
-uniform vec4 max_y;
+uniform float cloud_shadow;
+uniform float density_multiplier;
+uniform float max_y;
 
 uniform vec4 glow;
 
 uniform vec4 cloud_color;
 
-uniform vec4 cloud_scale;
-
 void main()
 {
 
 	// World / view / projection
-	gl_Position = ftransform();
-	gl_TexCoord[0] = gl_MultiTexCoord0;
+	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
 
 	// Get relative position
-	vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0);
-	//vec3 P = gl_Vertex.xyz + vec3(0,50,0);
+	vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
+	//vec3 P = position.xyz + vec3(0,50,0);
 
 	// Set altitude
 	if (P.y > 0.)
 	{
-		P *= (max_y.x / P.y);
+		P *= (max_y / P.y);
 	}
 	else
 	{
@@ -86,15 +85,14 @@ void main()
 	vec4 sunlight = sunlight_color;
 	vec4 light_atten;
 
-
 	// Sunlight attenuation effect (hue and brightness) due to atmosphere
 	// this is used later for sunlight modulation at various altitudes
-	light_atten = (blue_density * 1.0 + haze_density.x * 0.25) * (density_multiplier.x * max_y.x);
+	light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
 
 	// Calculate relative weights
-	temp1 = blue_density + haze_density.x;
+	temp1 = blue_density + haze_density;
 	blue_weight = blue_density / temp1;
-	haze_weight = haze_density.x / temp1;
+	haze_weight = haze_density / temp1;
 
 	// Compute sunlight from P & lightnorm (for long rays like sky)
 	temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y );
@@ -102,7 +100,7 @@ void main()
 	sunlight *= exp( - light_atten * temp2.y);
 
 	// Distance
-	temp2.z = Plen * density_multiplier.x;
+	temp2.z = Plen * density_multiplier;
 
 	// Transparency (-> temp1)
 	// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
@@ -127,20 +125,20 @@ void main()
 
 	// Haze color above cloud
 	vary_HazeColor = (	  blue_horizon * blue_weight * (sunlight + ambient)
-				+ (haze_horizon.r * haze_weight) * (sunlight * temp2.x + ambient)
+				+ (haze_horizon * haze_weight) * (sunlight * temp2.x + ambient)
 			 );	
 
 
 	// Increase ambient when there are more clouds
 	vec4 tmpAmbient = ambient;
-	tmpAmbient += (1. - tmpAmbient) * cloud_shadow.x * 0.5; 
+	tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; 
 
 	// Dim sunlight by cloud shadow percentage
-	sunlight *= (1. - cloud_shadow.x);
+	sunlight *= (1. - cloud_shadow);
 
 	// Haze color below cloud
 	vec4 additiveColorBelowCloud = (	  blue_horizon * blue_weight * (sunlight + tmpAmbient)
-				+ (haze_horizon.r * haze_weight) * (sunlight * temp2.x + tmpAmbient)
+				+ (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient)
 			 );	
 
 	// Final atmosphere additive
diff --git a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl
index 151602dbc089d06f0dfdaf048033aac3460dd023..721054b5adb20ca41550baa1f2dcdddc214a6c2e 100644
--- a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl
+++ b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl
@@ -22,39 +22,47 @@
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
- 
 
+uniform mat4 projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec4 clothing; 
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 mat4 getSkinnedTransform();
 void calcAtmospherics(vec3 inPositionEye);
 
-attribute vec4 clothing; //4
+uniform vec4 color;
 
-attribute vec4 gWindDir;		//7
-attribute vec4 gSinWaveParams; //3
-attribute vec4 gGravity;		//5
+uniform vec4 gWindDir;		
+uniform vec4 gSinWaveParams; 
+uniform vec4 gGravity;		
 
 const vec4 gMinMaxConstants = vec4(1.0, 0.166666, 0.0083143, .00018542);	 // #minimax-generated coefficients
 const vec4 gPiConstants	= vec4(0.159154943, 6.28318530, 3.141592653, 1.5707963); //	# {1/2PI, 2PI, PI, PI/2}
 
 void main()
 {
-	gl_TexCoord[0] = gl_MultiTexCoord0;
+	vary_texcoord0 = texcoord0;
 		
 	vec4 pos;
 	mat4 trans = getSkinnedTransform();
 		
 	vec3 norm;
-	norm.x = dot(trans[0].xyz, gl_Normal);
-	norm.y = dot(trans[1].xyz, gl_Normal);
-	norm.z = dot(trans[2].xyz, gl_Normal);
+	norm.x = dot(trans[0].xyz, normal);
+	norm.y = dot(trans[1].xyz, normal);
+	norm.z = dot(trans[2].xyz, normal);
 	norm = normalize(norm);
 		
 	//wind
 	vec4 windEffect;
 	windEffect = vec4(dot(norm, gWindDir.xyz));	
-	pos.x = dot(trans[2].xyz, gl_Vertex.xyz);
+	pos.x = dot(trans[2].xyz, position.xyz);
 	windEffect.xyz = pos.x * vec3(0.015, 0.015, 0.015)
 						+ windEffect.xyz;
 	windEffect.w = windEffect.w * 2.0 + 1.0;				// move wind offset value to [-1, 3]
@@ -101,7 +109,7 @@ void main()
 	sinWave.xyz = max(sinWave.xyz, vec3(-1.0, -1.0, -1.0));	// clamp to underlying body shape
 	offsetPos = clothing * sinWave.x;						// multiply wind effect times clothing displacement
 	temp2 = gWindDir*sinWave.z + vec4(norm,0);				// calculate normal offset due to wind oscillation
-	offsetPos = vec4(1.0,1.0,1.0,0.0)*offsetPos+gl_Vertex;	// add to offset vertex position, and zero out effect from w
+	offsetPos = vec4(1.0,1.0,1.0,0.0)*offsetPos+vec4(position.xyz, 1.0);	// add to offset vertex position, and zero out effect from w
 	norm += temp2.xyz*2.0;									// add sin wave effect on normals (exaggerated)
 	
 	//add "backlighting" effect
@@ -119,12 +127,8 @@ void main()
 
 	calcAtmospherics(pos.xyz);
 	
-	vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.0));			
-	gl_FrontColor = color; 
+	vec4 col = calcLighting(pos.xyz, norm, color, vec4(0.0));			
+	vertex_color = col; 
 					
-	gl_Position = gl_ProjectionMatrix * pos;
-	
-	
-	gl_TexCoord[2] = vec4(pos.xyz, 1.0);
-
+	gl_Position = projection_matrix * pos;
 }
diff --git a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl
deleted file mode 100644
index 616ea5fe9e7fd06d0ada66c17a511223be2cd049..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl
+++ /dev/null
@@ -1,106 +0,0 @@
-/** 
- * @file giDownsampleF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-uniform sampler2DRect giLightMap;
-
-uniform vec2 kern[32];
-uniform float dist_factor;
-uniform float blur_size;
-uniform vec2 delta;
-uniform int kern_length;
-uniform float kern_scale;
-uniform vec3 blur_quad;
-
-varying vec2 vary_fragcoord;
-
-uniform mat4 inv_proj;
-uniform vec2 screen_res;
-
-vec4 getPosition(vec2 pos_screen)
-{
-	float depth = texture2DRect(depthMap, pos_screen.xy).a;
-	vec2 sc = pos_screen.xy*2.0;
-	sc /= screen_res;
-	sc -= vec2(1.0,1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
-float getDepth(vec2 pos_screen)
-{
-	float z = texture2DRect(depthMap, pos_screen.xy).a;
-	z = z*2.0-1.0;
-	vec4 ndc = vec4(0.0, 0.0, z, 1.0);
-	vec4 p = inv_proj*ndc;
-	return p.z/p.w;
-}
-
-void main() 
-{
-	vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz;
-	norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
-	float depth = getDepth(vary_fragcoord.xy);
-		
-	vec3 ccol = texture2DRect(giLightMap, vary_fragcoord.xy).rgb;
-	vec2 dlt = kern_scale * delta/(vec2(1.0,1.0)+norm.xy*norm.xy);
-	dlt /= clamp(-depth*blur_quad.x, 1.0, 3.0);
-	float defined_weight = kern[0].x;
-	vec3 col = ccol*kern[0].x;
-	
-	for (int i = 0; i < kern_length; i++)
-	{
-		vec2 tc = vary_fragcoord.xy + kern[i].y*dlt;
-		vec3 sampNorm = texture2DRect(normalMap, tc.xy).xyz;
-		sampNorm = vec3((sampNorm.xy-0.5)*2.0,sampNorm.z); // unpack norm
-		
-		float d = dot(norm.xyz, sampNorm);
-		
-		if (d > 0.5)
-		{
-			float sampdepth = getDepth(tc.xy);
-			sampdepth -= depth;
-			if (sampdepth*sampdepth < blur_quad.z)
-			{
-	    		col += texture2DRect(giLightMap, tc).rgb*kern[i].x;
-				defined_weight += kern[i].x;
-			}
-		}
-	}
-
-	col /= defined_weight;
-	
-	//col = ccol;
-	
-	col = col*blur_quad.y;
-	
-	gl_FragData[0].xyz = col;
-	
-	//gl_FragColor = ccol;
-}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/giF.glsl b/indra/newview/app_settings/shaders/class3/deferred/giF.glsl
deleted file mode 100644
index 95913a502c4a852e3fc9ee7d1e3a18dad108cfd0..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class3/deferred/giF.glsl
+++ /dev/null
@@ -1,211 +0,0 @@
-/** 
- * @file giF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-#extension GL_ARB_texture_rectangle : enable
-
-uniform sampler2DRect depthMap;
-uniform sampler2DRect normalMap;
-uniform sampler2DRect lightMap;
-uniform sampler2DRect specularRect;
-
-uniform sampler2D noiseMap;
-
-uniform sampler2D		diffuseGIMap;
-uniform sampler2D		specularGIMap;
-uniform sampler2D		normalGIMap;
-uniform sampler2D		depthGIMap;
-
-uniform sampler2D		lightFunc;
-
-// Inputs
-varying vec2 vary_fragcoord;
-
-uniform vec2 screen_res;
-
-uniform vec4 sunlight_color;
-
-uniform mat4 inv_proj;
-uniform mat4 gi_mat;  //gPipeline.mGIMatrix - eye space to sun space
-uniform mat4 gi_mat_proj; //gPipeline.mGIMatrixProj - eye space to projected sun space
-uniform mat4 gi_norm_mat; //gPipeline.mGINormalMatrix - eye space normal to sun space normal matrix
-uniform mat4 gi_inv_proj; //gPipeline.mGIInvProj - projected sun space to sun space
-uniform float gi_sample_width;
-uniform float gi_noise;
-uniform float gi_attenuation;
-uniform float gi_range;
-
-vec4 getPosition(vec2 pos_screen)
-{
-	float depth = texture2DRect(depthMap, pos_screen.xy).a;
-	vec2 sc = pos_screen.xy*2.0;
-	sc /= screen_res;
-	sc -= vec2(1.0,1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
-vec4 getGIPosition(vec2 gi_tc)
-{
-	float depth = texture2D(depthGIMap, gi_tc).a;
-	vec2 sc = gi_tc*2.0;
-	sc -= vec2(1.0, 1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
-	vec4 pos = gi_inv_proj*ndc;
-	pos.xyz /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
-vec3 giAmbient(vec3 pos, vec3 norm)
-{
-	vec4 gi_c = gi_mat_proj * vec4(pos, 1.0);
-	gi_c.xyz /= gi_c.w;
-
-	vec4 gi_pos = gi_mat*vec4(pos,1.0);
-	vec3 gi_norm = (gi_norm_mat*vec4(norm,1.0)).xyz;
-	gi_norm = normalize(gi_norm);
-	
-	vec4 c_spec = texture2DRect(specularRect, vary_fragcoord.xy);
-	vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).rgb;
-	gi_pos.xyz += nz.x*gi_noise*gi_norm.xyz;
-	vec2 tcx = gi_norm.xy;
-	vec2 tcy = gi_norm.yx;
-	
-	vec4 eye_pos = gi_mat*vec4(0,0,0,1.0);
-	
-	vec3 eye_dir = normalize(gi_pos.xyz-eye_pos.xyz);
-	vec3 eye_ref = reflect(eye_dir, gi_norm);
-	
-	float da = 0.0; //texture2DRect(lightMap, vary_fragcoord.xy).r*0.5;
-	vec3 fdiff = vec3(da);
-	float fda = da;
-	
-	vec3 rcol = vec3(0,0,0);
-	
-	float fsa = 0.0;
-	
-
-	for (int i = -1; i <= 1; i += 2 )
-	{
-		for (int j = -1; j <= 1; j+= 2)
-		{
-			vec2 tc = vec2(i, j)*0.75+gi_norm.xy*nz.z;
-			tc += nz.xy*2.0;
-			tc *= gi_sample_width*0.25;
-			tc += gi_c.xy;
-			
-			vec3 lnorm = -(texture2D(normalGIMap, tc.xy).xyz*2.0-1.0);
-			vec3 lpos = getGIPosition(tc.xy).xyz;
-							
-			vec3 at = lpos-gi_pos.xyz;
-			float dist = length(at);
-			float dist_atten = clamp(1.0/(gi_attenuation*dist), 0.0, 1.0);
-			
-						
-			if (dist_atten > 0.01)
-			{ //possible contribution of indirect light to this surface
-				vec3 ldir = at;
-				
-				float ld = -dot(ldir, lnorm);
-				
-				if (ld < 0.0)
-				{  					
-					float ang_atten = dot(ldir, gi_norm);
-				
-					if (ang_atten > 0.0)
-					{  
-						vec4 spec = texture2D(specularGIMap, tc.xy);
-						at = normalize(at);
-						vec3 diff;		
-						
-						float da = 0.0;
-												
-						//contribution from indirect source to visible pixel
-						vec3 ha = at;
-						ha.z -= 1.0;
-						ha = normalize(ha);
-						if (spec.a > 0.0)
-						{
-							float sa = dot(ha,lnorm);
-							da = texture2D(lightFunc, vec2(sa, spec.a)).a;
-						}
-						else
-						{
-							da = -lnorm.z;
-						}
-						
-						diff = texture2D(diffuseGIMap, tc.xy).rgb+spec.rgb*spec.a*2.0;
-												
-						if (da > 0.0)
-						{ //contribution from visible pixel to eye
-							vec3 ha = normalize(at-eye_dir);
-							if (c_spec.a > 0.0)
-							{
-								float sa = dot(ha, gi_norm);
-								da = dist_atten*texture2D(lightFunc, vec2(sa, c_spec.a)).a;
-							}
-							else
-							{
-								da = dist_atten*dot(gi_norm, normalize(ldir));
-							}
-							fda += da;
-							fdiff += da*(c_spec.rgb*c_spec.a*2.0+vec3(1,1,1))*diff.rgb;
-						}
-					}
-				}
-			}
-		}
-	}
-
-	fdiff *= sunlight_color.rgb;
-	
-	vec3 ret = fda*fdiff;
-	
-	return clamp(ret,vec3(0.0), vec3(1.0));
-}
-
-void main() 
-{
-	vec2 pos_screen = vary_fragcoord.xy;
-	vec4 pos = getPosition(pos_screen);
-	
-	float rad = gi_range*0.5;
-	
-	vec3 norm = texture2DRect(normalMap, pos_screen).xyz;
-	norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
-	float dist = max(length(pos.xyz)-rad, 0.0);
-	
-	float da = clamp(1.0-dist/rad, 0.0, 1.0);
-	
-	vec3 ambient = da > 0.0 ? giAmbient(pos.xyz, norm) : vec3(0);
-	
-		
-	gl_FragData[0].xyz = mix(vec3(0), ambient, da);
-}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl
deleted file mode 100644
index 0364da62584166af21506f656fa85caf28cdc9e1..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl
+++ /dev/null
@@ -1,100 +0,0 @@
-/** 
- * @file postDeferredF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-  
-
-
-#extension GL_ARB_texture_rectangle : enable
-
-uniform sampler2DRect diffuseRect;
-uniform sampler2DRect specularRect;
-
-uniform sampler2DRect localLightMap;
-uniform sampler2DRect sunLightMap;
-uniform sampler2DRect giLightMap;
-uniform sampler2DRect edgeMap;
-
-uniform sampler2D	  luminanceMap;
-
-uniform sampler2DRect lightMap;
-
-uniform sampler2D	  lightFunc;
-uniform sampler2D	  noiseMap;
-
-uniform float sun_lum_scale;
-uniform float sun_lum_offset;
-uniform float lum_scale;
-uniform float lum_lod;
-uniform vec4 ambient;
-uniform float gi_brightness;
-uniform float gi_luminance;
-
-uniform vec4 sunlight_color;
-
-uniform vec2 screen_res;
-varying vec2 vary_fragcoord;
-
-void main() 
-{
-	vec2 tc = vary_fragcoord.xy;
-	vec4 lcol = texture2DLod(luminanceMap, vec2(0.5, 0.5), lum_lod);
-	
-	vec3 gi_col = texture2DRect(giLightMap, vary_fragcoord.xy).rgb;
-	vec4 sun_col =	texture2DRect(sunLightMap, vary_fragcoord.xy);
-	vec3 local_col = texture2DRect(localLightMap, vary_fragcoord.xy).rgb;
-	
-	float scol = texture2DRect(lightMap, vary_fragcoord.xy).r;
-			
-	vec3 diff = texture2DRect(diffuseRect, vary_fragcoord.xy).rgb;
-	vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
-	
-	gi_col = gi_col*(diff.rgb+spec.rgb*spec.a);
-
-	float lum = 1.0-clamp(pow(lcol.r, gi_brightness)+sun_lum_offset, 0.0, 1.0);
-	
-	lum *= sun_lum_scale;
-	
-	sun_col *= 1.0+(lum*lum_scale*scol);
-					  
-	vec4 col;
-	col.rgb = gi_col+sun_col.rgb+local_col;
-	
-	col.a = sun_col.a;
-	
-	vec3 bcol = vec3(0,0,0);
-	float tweight = 0.0;
-	for (int i = 0; i < 16; i++)
-	{
-		float weight = (float(i)+1.0)/2.0;
-		bcol += texture2DLod(luminanceMap, vary_fragcoord.xy/screen_res, weight).rgb*weight*weight*weight;
-		tweight += weight*weight;
-	}
-	
-	bcol /= tweight;
-	bcol *= gi_luminance;
-	col.rgb += bcol*lum;
-	
-	gl_FragColor = col;
-	//gl_FragColor.rgb = texture2DRect(giLightMap, vary_fragcoord.xy).rgb;
-}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl b/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl
deleted file mode 100644
index 009b5cc7439f76c8f7b49334f13aaf00ac68b755..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl
+++ /dev/null
@@ -1,89 +0,0 @@
-/** 
- * @file postgiF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-#extension GL_ARB_texture_rectangle : enable
-
-uniform sampler2DRect depthMap;
-uniform sampler2DRect normalMap;
-uniform sampler2DRect giLightMap;
-uniform sampler2D	noiseMap;
-uniform sampler2D	giMip;
-uniform sampler2DRect edgeMap;
-
-
-uniform vec2 delta;
-uniform float kern_scale;
-uniform float gi_edge_weight;
-uniform float gi_blur_brightness;
-
-varying vec2 vary_fragcoord;
-
-void main() 
-{
-	vec2 dlt = kern_scale*delta;
-	float defined_weight = 0.0; 
-	vec3 col = vec3(0.0); 
-	
-	float e = 1.0;
-	
-	for (int i = 1; i < 8; i++)
-	{
-		vec2 tc = vary_fragcoord.xy + float(i) * dlt;
-		
-		e = max(e, 0.0);
-		float wght = e;
-		
-	   	col += texture2DRect(giLightMap, tc).rgb*wght;
-		defined_weight += wght;
-				
-		e *= e;
-		e -=(texture2DRect(edgeMap, tc.xy-dlt*0.25).a+
-			texture2DRect(edgeMap, tc.xy+dlt*0.25).a)*gi_edge_weight;
-	}
-
-	e = 1.0;
-	
-	for (int i = 1; i < 8; i++)
-	{
-		vec2 tc = vary_fragcoord.xy - float(i) * dlt;
-		
-		e = max(e,0.0);
-		float wght = e;
-		
-	   	col += texture2DRect(giLightMap, tc).rgb*wght;
-		defined_weight += wght;
-	
-		e *= e;
-		e -= (texture2DRect(edgeMap, tc.xy-dlt*0.25).a+
-			texture2DRect(edgeMap, tc.xy+dlt*0.25).a)*gi_edge_weight;
-		
-	}
-	
-	col /= max(defined_weight, 0.01);
-
-	gl_FragColor.rgb = col * gi_blur_brightness;
-}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl b/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl
deleted file mode 100644
index 6231ee68b75c69b50b1cbd480d448b468fd89833..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl
+++ /dev/null
@@ -1,37 +0,0 @@
-/** 
- * @file postgiV.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-varying vec2 vary_fragcoord;
-uniform vec2 screen_res;
-
-void main()
-{
-	//transform vertex
-	gl_Position = ftransform(); 
-	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
-	vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
-}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
deleted file mode 100644
index 1c02adea89bb3e8f90cd1d379a25f2db71e130e3..0000000000000000000000000000000000000000
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ /dev/null
@@ -1,335 +0,0 @@
-/** 
- * @file softenLightF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
- 
-
-
-#extension GL_ARB_texture_rectangle : enable
-
-uniform sampler2DRect diffuseRect;
-uniform sampler2DRect specularRect;
-uniform sampler2DRect normalMap;
-uniform sampler2DRect lightMap;
-uniform sampler2D	  noiseMap;
-uniform samplerCube environmentMap;
-uniform sampler2D	  lightFunc;
-uniform vec3 gi_quad;
-
-uniform float blur_size;
-uniform float blur_fidelity;
-
-// Inputs
-uniform vec4 morphFactor;
-uniform vec3 camPosLocal;
-//uniform vec4 camPosWorld;
-uniform vec4 gamma;
-uniform vec4 lightnorm;
-uniform vec4 sunlight_color;
-uniform vec4 ambient;
-uniform vec4 blue_horizon;
-uniform vec4 blue_density;
-uniform vec4 haze_horizon;
-uniform vec4 haze_density;
-uniform vec4 cloud_shadow;
-uniform vec4 density_multiplier;
-uniform vec4 distance_multiplier;
-uniform vec4 max_y;
-uniform vec4 glow;
-uniform float scene_light_strength;
-uniform vec3 env_mat[3];
-uniform vec4 shadow_clip;
-uniform mat3 ssao_effect_mat;
-
-uniform sampler2DRect depthMap;
-uniform mat4 inv_proj;
-uniform vec2 screen_res;
-
-varying vec4 vary_light;
-varying vec2 vary_fragcoord;
-
-vec3 vary_PositionEye;
-
-vec3 vary_SunlitColor;
-vec3 vary_AmblitColor;
-vec3 vary_AdditiveColor;
-vec3 vary_AtmosAttenuation;
-uniform float gi_ambiance;
-
-vec4 getPosition_d(vec2 pos_screen, float depth)
-{
-	vec2 sc = pos_screen.xy*2.0;
-	sc /= screen_res;
-	sc -= vec2(1.0,1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
-vec4 getPosition(vec2 pos_screen)
-{ //get position in screen space (world units) given window coordinate and depth map
-	float depth = texture2DRect(depthMap, pos_screen.xy).a;
-	return getPosition_d(pos_screen, depth);
-}
-
-vec3 getPositionEye()
-{
-	return vary_PositionEye;
-}
-vec3 getSunlitColor()
-{
-	return vary_SunlitColor;
-}
-vec3 getAmblitColor()
-{
-	return vary_AmblitColor;
-}
-vec3 getAdditiveColor()
-{
-	return vary_AdditiveColor;
-}
-vec3 getAtmosAttenuation()
-{
-	return vary_AtmosAttenuation;
-}
-
-
-void setPositionEye(vec3 v)
-{
-	vary_PositionEye = v;
-}
-
-void setSunlitColor(vec3 v)
-{
-	vary_SunlitColor = v;
-}
-
-void setAmblitColor(vec3 v)
-{
-	vary_AmblitColor = v;
-}
-
-void setAdditiveColor(vec3 v)
-{
-	vary_AdditiveColor = v;
-}
-
-void setAtmosAttenuation(vec3 v)
-{
-	vary_AtmosAttenuation = v;
-}
-
-void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
-
-	vec3 P = inPositionEye;
-	setPositionEye(P);
-	
-	//(TERRAIN) limit altitude
-	if (P.y > max_y.x) P *= (max_y.x / P.y);
-	if (P.y < -max_y.x) P *= (-max_y.x / P.y);
-
-	vec3 tmpLightnorm = lightnorm.xyz;
-
-	vec3 Pn = normalize(P);
-	float Plen = length(P);
-
-	vec4 temp1 = vec4(0);
-	vec3 temp2 = vec3(0);
-	vec4 blue_weight;
-	vec4 haze_weight;
-	vec4 sunlight = sunlight_color;
-	vec4 light_atten;
-
-	//sunlight attenuation effect (hue and brightness) due to atmosphere
-	//this is used later for sunlight modulation at various altitudes
-	light_atten = (blue_density * 1.0 + vec4(haze_density.r) * 0.25) * (density_multiplier.x * max_y.x);
-		//I had thought blue_density and haze_density should have equal weighting,
-		//but attenuation due to haze_density tends to seem too strong
-
-	temp1 = blue_density + vec4(haze_density.r);
-	blue_weight = blue_density / temp1;
-	haze_weight = vec4(haze_density.r) / temp1;
-
-	//(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain)
-	temp2.y = max(0.0, tmpLightnorm.y);
-	temp2.y = 1. / temp2.y;
-	sunlight *= exp( - light_atten * temp2.y);
-
-	// main atmospheric scattering line integral
-	temp2.z = Plen * density_multiplier.x;
-
-	// Transparency (-> temp1)
-	// ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier.x in a variable because the ati
-	// compiler gets confused.
-	temp1 = exp(-temp1 * temp2.z * distance_multiplier.x);
-
-	//final atmosphere attenuation factor
-	setAtmosAttenuation(temp1.rgb);
-	
-	//compute haze glow
-	//(can use temp2.x as temp because we haven't used it yet)
-	temp2.x = dot(Pn, tmpLightnorm.xyz);
-	temp2.x = 1. - temp2.x;
-		//temp2.x is 0 at the sun and increases away from sun
-	temp2.x = max(temp2.x, .03);	//was glow.y
-		//set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
-	temp2.x *= glow.x;
-		//higher glow.x gives dimmer glow (because next step is 1 / "angle")
-	temp2.x = pow(temp2.x, glow.z);
-		//glow.z should be negative, so we're doing a sort of (1 / "angle") function
-
-	//add "minimum anti-solar illumination"
-	temp2.x += .25;
-	
-	//increase ambient when there are more clouds
-	vec4 tmpAmbient = ambient*gi_ambiance + (vec4(1.) - ambient*gi_ambiance) * cloud_shadow.x * 0.5;
-	
-	/*  decrease value and saturation (that in HSV, not HSL) for occluded areas
-	 * // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html
-	 * // The following line of code performs the equivalent of:
-	 * float ambAlpha = tmpAmbient.a;
-	 * float ambValue = dot(vec3(tmpAmbient), vec3(0.577)); // projection onto <1/rt(3), 1/rt(3), 1/rt(3)>, the neutral white-black axis
-	 * vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue);
-	 * tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha);
-	 */
-	tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a);
-
-	//haze color
-	setAdditiveColor(
-		vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow.x) + tmpAmbient)
-	  + (haze_horizon.r * haze_weight) * (sunlight*(1.-cloud_shadow.x) * temp2.x
-		  + tmpAmbient)));
-
-	//brightness of surface both sunlight and ambient
-	setSunlitColor(vec3(sunlight * .5));
-	setAmblitColor(vec3(tmpAmbient * .25));
-	setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1));
-}
-
-vec3 atmosLighting(vec3 light)
-{
-	light *= getAtmosAttenuation().r;
-	light += getAdditiveColor();
-	return (2.0 * light);
-}
-
-vec3 atmosTransport(vec3 light) {
-	light *= getAtmosAttenuation().r;
-	light += getAdditiveColor() * 2.0;
-	return light;
-}
-vec3 atmosGetDiffuseSunlightColor()
-{
-	return getSunlitColor();
-}
-
-vec3 scaleDownLight(vec3 light)
-{
-	return (light / scene_light_strength );
-}
-
-vec3 scaleUpLight(vec3 light)
-{
-	return (light * scene_light_strength);
-}
-
-vec3 atmosAmbient(vec3 light)
-{
-	return getAmblitColor() + light / 2.0;
-}
-
-vec3 atmosAffectDirectionalLight(float lightIntensity)
-{
-	return getSunlitColor() * lightIntensity;
-}
-
-vec3 scaleSoftClip(vec3 light)
-{
-	//soft clip effect:
-	light = 1. - clamp(light, vec3(0.), vec3(1.));
-	light = 1. - pow(light, gamma.xxx);
-
-	return light;
-}
-
-void main() 
-{
-	vec2 tc = vary_fragcoord.xy;
-	float depth = texture2DRect(depthMap, tc.xy).a;
-	vec3 pos = getPosition_d(tc, depth).xyz;
-	vec3 norm = texture2DRect(normalMap, tc).xyz;
-	norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
-	//vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz;
-	
-	float da = max(dot(norm.xyz, vary_light.xyz), 0.0);
-	
-	vec4 diffuse = texture2DRect(diffuseRect, tc);
-	vec3 col;
-	float bloom = 0.0;
-
-	if (diffuse.a < 0.9)
-	{
-		vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
-	
-		da = texture2D(lightFunc, vec2(da, 0.0)).a;
-		
-		vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
-		float scol = max(scol_ambocc.r, diffuse.a); 
-		float ambocc = scol_ambocc.g;
-	
-		calcAtmospherics(pos.xyz, ambocc);
-	
-		col = atmosAmbient(vec3(0));
-		col += atmosAffectDirectionalLight(max(min(da, scol), diffuse.a));
-	
-		col *= diffuse.rgb;
-	
-		if (spec.a > 0.0) // specular reflection
-		{
-			// the old infinite-sky shiny reflection
-			//
-			vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
-			float sa = dot(refnormpersp, vary_light.xyz);
-			vec3 dumbshiny = vary_SunlitColor*scol*texture2D(lightFunc, vec2(sa, spec.a)).a;
-		
-			// add the two types of shiny together
-			vec3 spec_contrib = dumbshiny * spec.rgb;
-			bloom = dot(spec_contrib, spec_contrib);
-			col += spec_contrib;		
-		}
-	
-		col = atmosLighting(col);
-		col = scaleSoftClip(col);
-
-		col = mix(col, diffuse.rgb, diffuse.a);
-	}
-	else
-	{
-		col = diffuse.rgb;
-	}
-		
-	gl_FragColor.rgb = col;
-	gl_FragColor.a = bloom;
-}
diff --git a/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl
index 79bd017efc05500122fd48fa780d8165dbdeb2b9..e043ac873ebbbcf0fd1bb81ab33b310ec3cee997 100644
--- a/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl
+++ b/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl
@@ -23,8 +23,6 @@
  * $/LicenseInfo$
  */
  
-
-
 float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, vec3 n, vec3 l, vec3 lightCol, float da);
 vec3 calcPointLightSpecular(inout vec4 specular, vec3 view, vec3 v, vec3 n, vec3 l, float r, float pw, vec3 lightCol);
 
@@ -33,6 +31,10 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
 vec3 atmosGetDiffuseSunlightColor();
 vec3 scaleDownLight(vec3 light);
 
+uniform vec4 light_position[8];
+uniform vec3 light_attenuation[8]; 
+uniform vec3 light_diffuse[8];
+
 vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol)
 {
 	vec4 col = vec4(0.0, 0.0, 0.0, color.a);
@@ -43,18 +45,18 @@ vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor
 	vec4 specularSum = vec4(0.0);
 	
 	// Collect normal lights (need to be divided by two, as we later multiply by 2)
-	col.rgb += gl_LightSource[1].diffuse.rgb * calcDirectionalLightSpecular(specularColor, view, norm, gl_LightSource[1].position.xyz,gl_LightSource[1].diffuse.rgb, 1.0);
-	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, gl_LightSource[2].position.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation,gl_LightSource[2].diffuse.rgb);
-	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, gl_LightSource[3].position.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation,gl_LightSource[3].diffuse.rgb);
-	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, gl_LightSource[4].position.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation,gl_LightSource[4].diffuse.rgb);
-	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, gl_LightSource[5].position.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation,gl_LightSource[5].diffuse.rgb);
-	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, gl_LightSource[6].position.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation,gl_LightSource[6].diffuse.rgb);
-	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, gl_LightSource[7].position.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation,gl_LightSource[7].diffuse.rgb);
+	col.rgb += light_diffuse[1].rgb * calcDirectionalLightSpecular(specularColor, view, norm, light_position[1].xyz,light_diffuse[1].rgb, 1.0);
+	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[2].xyz, light_attenuation[2].x, light_attenuation[2].y, light_diffuse[2].rgb); 
+	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[3].xyz, light_attenuation[3].x, light_attenuation[3].y, light_diffuse[3].rgb); 
+	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[4].xyz, light_attenuation[4].x, light_attenuation[4].y, light_diffuse[4].rgb); 
+	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[5].xyz, light_attenuation[5].x, light_attenuation[5].y, light_diffuse[5].rgb); 
+	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[6].xyz, light_attenuation[6].x, light_attenuation[6].y, light_diffuse[6].rgb); 
+	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[7].xyz, light_attenuation[7].x, light_attenuation[7].y, light_diffuse[7].rgb); 
 	col.rgb = scaleDownLight(col.rgb);
 						
 	// Add windlight lights
 	col.rgb += atmosAmbient(baseCol.rgb);
-	col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, gl_LightSource[0].position.xyz,atmosGetDiffuseSunlightColor()*baseCol.a, 1.0));
+	col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, light_position[0].xyz,atmosGetDiffuseSunlightColor()*baseCol.a, 1.0));
 
 	col.rgb = min(col.rgb*color.rgb, 1.0);
 	specularColor.rgb = min(specularColor.rgb*specularSum.rgb, 1.0);
diff --git a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl
index dcdc72ac024c2dd55969ba9fd0061f8a8756ebe2..dadff40933a1dc067f024741e0c41ceed4d3a24d 100644
--- a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl
+++ b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl
@@ -24,7 +24,6 @@
  */
  
 
-
 float calcDirectionalLight(vec3 n, vec3 l);
 float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
 
@@ -33,22 +32,29 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
 vec3 scaleDownLight(vec3 light);
 vec3 scaleUpLight(vec3 light);
 
+uniform vec4 light_position[8];
+uniform vec3 light_direction[8];
+uniform vec3 light_attenuation[8]; 
+uniform vec3 light_diffuse[8];
+
 vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight)
 {
 	vec4 col = vec4(0.0, 0.0, 0.0, color.a);
 	
 	// Collect normal lights (need to be divided by two, as we later multiply by 2)
-	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a);
-	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].specular.a);
-	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].specular.a);
-	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].specular.a);
-	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].specular.a);
-	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].specular.a);
-	col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz);
+	
+	// Collect normal lights
+	col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].z);
+	col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].z);
+	col.rgb += light_diffuse[4].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[4], light_direction[4], light_attenuation[4].x, light_attenuation[4].z);
+	col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].z);
+	col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].z);
+	col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].z);
+	col.rgb += light_diffuse[1].rgb*calcDirectionalLight(norm, light_position[1].xyz);
 	col.rgb = scaleDownLight(col.rgb);
 
 	// Add windlight lights
-	col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, gl_LightSource[0].position.xyz));
+	col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, light_position[0].xyz));
 	col.rgb += atmosAmbient(baseLight.rgb);
 
 	col.rgb = min(col.rgb*color.rgb, 1.0);
diff --git a/indra/newview/app_settings/toolbars.xml b/indra/newview/app_settings/toolbars.xml
index f2192a75ad4b8d6db5d60f24a08e13c388d3235d..29c019719dea0a42cb9bf1c41491345c877a48cc 100644
--- a/indra/newview/app_settings/toolbars.xml
+++ b/indra/newview/app_settings/toolbars.xml
@@ -7,8 +7,8 @@
     <command name="destinations"/>
     <command name="people"/>
     <command name="profile"/>
-    <command name="view"/>
     <command name="move"/>
+    <command name="view"/>
     <command name="howto"/>
   </bottom_toolbar>
   <left_toolbar
@@ -20,5 +20,6 @@
     <command name="places"/>
     <command name="voice"/>
     <command name="minimap"/>
+    <command name="snapshot"/>
   </left_toolbar>
 </toolbars>
diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml
index 6641c80b94b524e13c8a6efcab159673cf44b338..99dbfcae51e8d94d201fee72ae01434df3e35bb4 100644
--- a/indra/newview/character/avatar_lad.xml
+++ b/indra/newview/character/avatar_lad.xml
@@ -395,7 +395,7 @@
        
     <attachment_point
        id="39"
-       group="9"
+       group="6"
        pie_slice="1"
        name="Neck"
        joint="mNeck"
@@ -405,7 +405,7 @@
   	
   	<attachment_point
        id="40"
-       group="9"
+       group="6"
        pie_slice="2"
        name="Avatar Center"
        joint="mRoot"
diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt
old mode 100755
new mode 100644
index 9ad313a9a7508cb0f55af4a6636df7268360a35a..76bb2b09761ee2a5ff696d651bfebebfd807eb79
--- a/indra/newview/featuretable.txt
+++ b/indra/newview/featuretable.txt
@@ -42,7 +42,6 @@ RenderGamma					1	0
 RenderGlowResolutionPow		1	9
 RenderGround				1	1
 RenderMaxPartCount			1	8192
-RenderNightBrightness		1	1.0
 RenderObjectBump			1	1
 RenderLocalLights			1	1
 RenderReflectionDetail		1	4
@@ -69,6 +68,8 @@ RenderShadowDetail			1	2
 WatchdogDisabled				1	1
 RenderUseStreamVBO			1	1
 RenderFSAASamples			1	16
+RenderMaxTextureIndex		1	16
+
 
 //
 // Low Graphics Settings
@@ -159,7 +160,7 @@ WLSkyDetail					1	48
 RenderDeferred				1	0
 RenderDeferredSSAO			1	0
 RenderShadowDetail			1	0
-RenderFSAASamples			1	4
+RenderFSAASamples			1	2
 
 //
 // Ultra graphics (REALLY PURTY!)
@@ -188,7 +189,7 @@ WLSkyDetail					1	128
 RenderDeferred				1	1
 RenderDeferredSSAO			1	1
 RenderShadowDetail			1	2
-RenderFSAASamples			1	8
+RenderFSAASamples			1	2
 
 
 //
@@ -296,6 +297,7 @@ RenderVBOEnable				1	0
 
 list OpenGLPre30
 RenderDeferred				0	0
+RenderMaxTextureIndex		1	1
 
 list Intel
 RenderAnisotropic			1	0
diff --git a/indra/newview/featuretable_linux.txt b/indra/newview/featuretable_linux.txt
index 2dbdf3a76edb8f82005eecd2de607f2a4c61f196..5e217e000a647e9919b8038d594ac27a17bc1992 100644
--- a/indra/newview/featuretable_linux.txt
+++ b/indra/newview/featuretable_linux.txt
@@ -43,7 +43,6 @@ RenderGlowResolutionPow		1	9
 RenderGround				1	1
 RenderLocalLights			1	1
 RenderMaxPartCount			1	8192
-RenderNightBrightness		1	1.0
 RenderObjectBump			1	1
 RenderReflectionDetail		1	4
 RenderTerrainDetail			1	1
@@ -67,6 +66,7 @@ RenderDeferred				1	1
 RenderDeferredSSAO			1	1
 RenderShadowDetail			1	2
 RenderFSAASamples			1	16
+RenderMaxTextureIndex		1	16
 
 //
 // Low Graphics Settings
@@ -157,7 +157,7 @@ WLSkyDetail					1	48
 RenderDeferred				1	0
 RenderDeferredSSAO			1	0
 RenderShadowDetail			1	0
-RenderFSAASamples			1	4
+RenderFSAASamples			1	2
 
 //
 // Ultra graphics (REALLY PURTY!)
@@ -187,7 +187,7 @@ WLSkyDetail					1	128
 RenderDeferred				1	1
 RenderDeferredSSAO			1	1
 RenderShadowDetail			1	2
-RenderFSAASamples			1	8
+RenderFSAASamples			1	2
 
 //
 // Class Unknown Hardware (unknown)
diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt
index 996e57435025730f702feb1f1191ae56aa20d6a2..915a012a39cdf83e5a662027afca742bcf942dff 100644
--- a/indra/newview/featuretable_mac.txt
+++ b/indra/newview/featuretable_mac.txt
@@ -1,4 +1,4 @@
-version 30
+version 32
 // The version number above should be implemented IF AND ONLY IF some
 // change has been made that is sufficiently important to justify
 // resetting the graphics preferences of all users to the recommended
@@ -43,7 +43,6 @@ RenderGlowResolutionPow			1	9
 RenderGround					1	1
 RenderLocalLights				1	1
 RenderMaxPartCount				1	8192
-RenderNightBrightness			1	1.0
 RenderObjectBump				1	1
 RenderReflectionDetail			1	4
 RenderTerrainDetail				1	1
@@ -51,10 +50,10 @@ RenderTerrainLODFactor			1	2.0
 RenderTransparentWater			1	1
 RenderTreeLODFactor				1	1.0
 RenderUseImpostors				1	1
-RenderVBOEnable					1	0
-RenderVBOMappingDisable		1	0
+RenderVBOEnable					1	1
+RenderVBOMappingDisable			1	1
 RenderVolumeLODFactor			1	2.0
-UseStartScreen				1	1
+UseStartScreen					1	1
 UseOcclusion					1	1
 VertexShaderEnable				1	1
 WindLightUseAtmosShaders		1	1
@@ -67,8 +66,9 @@ RenderDeferred				1	1
 RenderDeferredSSAO			1	1
 RenderShadowDetail			1	2
 WatchdogDisabled				1	1
-RenderUseStreamVBO			1	0
+RenderUseStreamVBO			1	1
 RenderFSAASamples			1	16
+RenderMaxTextureIndex		1	16
 
 //
 // Low Graphics Settings
@@ -159,7 +159,7 @@ WLSkyDetail					1	48
 RenderDeferred				1	0
 RenderDeferredSSAO			1	0
 RenderShadowDetail			1	2
-RenderFSAASamples			1	4
+RenderFSAASamples			1	2
 
 //
 // Ultra graphics (REALLY PURTY!)
@@ -189,7 +189,7 @@ WLSkyDetail					1	128
 RenderDeferred				1	0
 RenderDeferredSSAO			1	0
 RenderShadowDetail			1	2
-RenderFSAASamples			1	8
+RenderFSAASamples			1	2
 
 //
 // Class Unknown Hardware (unknown)
@@ -290,7 +290,7 @@ list TexUnit8orLess
 RenderDeferredSSAO			0	0
 
 list ATI
-RenderDeferredSSAO			0	0
+RenderDeferredSSAO			1	0
 
 list Intel
 RenderAnisotropic			1	0
diff --git a/indra/newview/featuretable_xp.txt b/indra/newview/featuretable_xp.txt
index a53be10be138a0794d94cd4c6c4a7777ca95a981..ae2cf910f275b43336840f1d29baedcf91bc23d2 100644
--- a/indra/newview/featuretable_xp.txt
+++ b/indra/newview/featuretable_xp.txt
@@ -43,7 +43,6 @@ RenderGlowResolutionPow		1	9
 RenderGround				1	1
 RenderLocalLights			1	1
 RenderMaxPartCount			1	8192
-RenderNightBrightness		1	1.0
 RenderObjectBump			1	1
 RenderReflectionDetail		1	4
 RenderTerrainDetail			1	1
@@ -69,6 +68,7 @@ RenderShadowDetail			1	0
 WatchdogDisabled				1	1
 RenderUseStreamVBO			1	1
 RenderFSAASamples			1	16
+RenderMaxTextureIndex		1	16
 
 //
 // Low Graphics Settings
@@ -159,7 +159,7 @@ WLSkyDetail					1	48
 RenderDeferred				1	0
 RenderDeferredSSAO			1	0
 RenderShadowDetail			1	2
-RenderFSAASamples			1	4
+RenderFSAASamples			1	2
 
 //
 // Ultra graphics (REALLY PURTY!)
@@ -189,7 +189,7 @@ WLSkyDetail					1	128
 RenderDeferred				1	0
 RenderDeferredSSAO			1	0
 RenderShadowDetail			1	2
-RenderFSAASamples			1	8
+RenderFSAASamples			1	2
 
 //
 // Class Unknown Hardware (unknown)
@@ -294,6 +294,7 @@ RenderVBOEnable				1	0
 
 list OpenGLPre30
 RenderDeferred				0	0
+RenderMaxTextureIndex		1	1
 
 list Intel
 RenderAnisotropic			1	0
diff --git a/indra/newview/gpu_table.txt b/indra/newview/gpu_table.txt
index b7d951e01859a98dc9ccb185b9ea1da25c2ad44e..198e7024593af28e5b0fcf1ec7623cfdcb371eaf 100644
--- a/indra/newview/gpu_table.txt
+++ b/indra/newview/gpu_table.txt
@@ -112,8 +112,8 @@ ATI Mobility Radeon HD 545v		.*ATI.*Mobility.*HD *545v.*					2		1
 ATI Mobility Radeon HD 550v		.*ATI.*Mobility.*HD *550v.*					2		1
 ATI Mobility Radeon HD 560v		.*ATI.*Mobility.*HD *560v.*					2		1
 ATI Mobility Radeon HD 565v		.*ATI.*Mobility.*HD *565v.*					2		1
-ATI Mobility Radeon HD 2300		.*ATI.*Mobility.*HD *23.*					1		1
-ATI Mobility Radeon HD 2400		.*ATI.*Mobility.*HD *24.*					1		1
+ATI Mobility Radeon HD 2300		.*ATI.*Mobility.*HD *23.*					2		1
+ATI Mobility Radeon HD 2400		.*ATI.*Mobility.*HD *24.*					2		1
 ATI Mobility Radeon HD 2600		.*ATI.*Mobility.*HD *26.*					3		1
 ATI Mobility Radeon HD 2700		.*ATI.*Mobility.*HD *27.*					3		1
 ATI Mobility Radeon HD 3100		.*ATI.*Mobility.*HD *31.*					0		1
@@ -140,23 +140,23 @@ ATI Mobility Radeon HD 6600M	.*ATI.*Mobility.*HD *66.*					3		1
 ATI Mobility Radeon HD 6700M	.*ATI.*Mobility.*HD *67.*					3		1
 ATI Mobility Radeon HD 6800M	.*ATI.*Mobility.*HD *68.*					3		1
 ATI Mobility Radeon HD 6900M	.*ATI.*Mobility.*HD *69.*					3		1
-ATI Radeon HD 2300				.*ATI.*Radeon HD *23..						0		1
-ATI Radeon HD 2400				.*ATI.*Radeon HD *24..						1		1
+ATI Radeon HD 2300				.*ATI.*Radeon HD *23..						2		1
+ATI Radeon HD 2400				.*ATI.*Radeon HD *24..						2		1
 ATI Radeon HD 2600				.*ATI.*Radeon HD *26..						2		1
 ATI Radeon HD 2900				.*ATI.*Radeon HD *29..						3		1
 ATI Radeon HD 3000				.*ATI.*Radeon HD *30..						0		1
 ATI Radeon HD 3100				.*ATI.*Radeon HD *31..						1		1
 ATI Radeon HD 3200				.*ATI.*Radeon HD *32..						1		1
-ATI Radeon HD 3300				.*ATI.*Radeon HD *33..						1		1
-ATI Radeon HD 3400				.*ATI.*Radeon HD *34..						1		1
-ATI Radeon HD 3500				.*ATI.*Radeon HD *35..						1		1
+ATI Radeon HD 3300				.*ATI.*Radeon HD *33..						2		1
+ATI Radeon HD 3400				.*ATI.*Radeon HD *34..						2		1
+ATI Radeon HD 3500				.*ATI.*Radeon HD *35..						2		1
 ATI Radeon HD 3600				.*ATI.*Radeon HD *36..						3		1
 ATI Radeon HD 3700				.*ATI.*Radeon HD *37..						3		1
 ATI Radeon HD 3800				.*ATI.*Radeon HD *38..						3		1
 ATI Radeon HD 4100				.*ATI.*Radeon HD *41..						1		1
 ATI Radeon HD 4200				.*ATI.*Radeon HD *42..						1		1
-ATI Radeon HD 4300				.*ATI.*Radeon HD *43..						1		1
-ATI Radeon HD 4400				.*ATI.*Radeon HD *44..						1		1
+ATI Radeon HD 4300				.*ATI.*Radeon HD *43..						2		1
+ATI Radeon HD 4400				.*ATI.*Radeon HD *44..						2		1
 ATI Radeon HD 4500				.*ATI.*Radeon HD *45..						3		1
 ATI Radeon HD 4600				.*ATI.*Radeon HD *46..						3		1
 ATI Radeon HD 4700				.*ATI.*Radeon HD *47..						3		1
@@ -401,11 +401,11 @@ NVIDIA GeForce 7900				.*NVIDIA .*GeForce 79.*						2		1
 NVIDIA GeForce 8100				.*NVIDIA .*GeForce 81.*						1		1
 NVIDIA GeForce 8200M			.*NVIDIA .*GeForce 8200M.*					1		1
 NVIDIA GeForce 8200				.*NVIDIA .*GeForce 82.*						1		1
-NVIDIA GeForce 8300				.*NVIDIA .*GeForce 83.*						1		1
-NVIDIA GeForce 8400M			.*NVIDIA .*GeForce 8400M.*					1		1
-NVIDIA GeForce 8400				.*NVIDIA .*GeForce 84.*						1		1
+NVIDIA GeForce 8300				.*NVIDIA .*GeForce 83.*						2		1
+NVIDIA GeForce 8400M			.*NVIDIA .*GeForce 8400M.*					2		1
+NVIDIA GeForce 8400				.*NVIDIA .*GeForce 84.*						2		1
 NVIDIA GeForce 8500				.*NVIDIA .*GeForce 85.*						3		1
-NVIDIA GeForce 8600M			.*NVIDIA .*GeForce 8600M.*					1		1
+NVIDIA GeForce 8600M			.*NVIDIA .*GeForce 8600M.*					2		1
 NVIDIA GeForce 8600				.*NVIDIA .*GeForce 86.*						3		1
 NVIDIA GeForce 8700M			.*NVIDIA .*GeForce 8700M.*					3		1
 NVIDIA GeForce 8700				.*NVIDIA .*GeForce 87.*						3		1
@@ -415,10 +415,10 @@ NVIDIA GeForce 9100M			.*NVIDIA .*GeForce 9100M.*					0		1
 NVIDIA GeForce 9100				.*NVIDIA .*GeForce 91.*						0		1
 NVIDIA GeForce 9200M			.*NVIDIA .*GeForce 9200M.*					1		1
 NVIDIA GeForce 9200				.*NVIDIA .*GeForce 92.*						1		1
-NVIDIA GeForce 9300M			.*NVIDIA .*GeForce 9300M.*					1		1
-NVIDIA GeForce 9300				.*NVIDIA .*GeForce 93.*						1		1
-NVIDIA GeForce 9400M			.*NVIDIA .*GeForce 9400M.*					1		1
-NVIDIA GeForce 9400				.*NVIDIA .*GeForce 94.*						1		1
+NVIDIA GeForce 9300M			.*NVIDIA .*GeForce 9300M.*					2		1
+NVIDIA GeForce 9300				.*NVIDIA .*GeForce 93.*						2		1
+NVIDIA GeForce 9400M			.*NVIDIA .*GeForce 9400M.*					2		1
+NVIDIA GeForce 9400				.*NVIDIA .*GeForce 94.*						2		1
 NVIDIA GeForce 9500M			.*NVIDIA .*GeForce 9500M.*					2		1
 NVIDIA GeForce 9500				.*NVIDIA .*GeForce 95.*						2		1
 NVIDIA GeForce 9600M			.*NVIDIA .*GeForce 9600M.*					3		1
diff --git a/indra/newview/installers/darwin/fix_application_icon_position.sh b/indra/newview/installers/darwin/fix_application_icon_position.sh
old mode 100755
new mode 100644
diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi
old mode 100755
new mode 100644
index 02ca7cbb3a54f29b728d159fe55b08aa2bcee9d6..8a6114f0d5736c8c0bcf3e0eac16246d00cb0145
--- a/indra/newview/installers/windows/installer_template.nsi
+++ b/indra/newview/installers/windows/installer_template.nsi
@@ -115,6 +115,7 @@ Var COMMANDLINE         ; command line passed to this installer, set in .onInit
 Var SHORTCUT_LANG_PARAM ; "--set InstallLanguage de", passes language to viewer
 Var SKIP_DIALOGS        ; set from command line in  .onInit. autoinstall 
                         ; GUI and the defaults.
+Var DO_UNINSTALL_V2     ; If non-null, path to a previous Viewer 2 installation that will be uninstalled.
 
 ;;; Function definitions should go before file includes, because calls to
 ;;; DLLs like LangDLL trigger an implicit file include, so if that call is at
@@ -310,6 +311,29 @@ Function CheckNetworkConnection
 FunctionEnd
 
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Function CheckWillUninstallV2               
+;
+; If we are being called through auto-update, we need to uninstall any
+; existing V2 installation. Otherwise, we wind up with
+; SecondLifeViewer2 and SecondLifeViewer installations existing side
+; by side no indication which to use.
+; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+Function CheckWillUninstallV2
+
+  StrCpy $DO_UNINSTALL_V2 ""
+
+  StrCmp $SKIP_DIALOGS "true" 0 CHECKV2_DONE
+  StrCmp $INSTDIR "$PROGRAMFILES\SecondLifeViewer2" CHECKV2_DONE ; don't uninstall our own install dir.
+  IfFileExists "$PROGRAMFILES\SecondLifeViewer2\uninst.exe" CHECKV2_FOUND CHECKV2_DONE
+
+CHECKV2_FOUND:
+  StrCpy $DO_UNINSTALL_V2 "true"
+
+CHECKV2_DONE:
+
+FunctionEnd
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ; Save user files to temp location
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -334,7 +358,7 @@ Push $2
     ExpandEnvStrings $2 $2
 
     CreateDirectory "$TEMP\SecondLifeSettingsBackup\$0"
-    CopyFiles  "$2\Application Data\SecondLife\*" "$TEMP\SecondLifeSettingsBackup\$0"
+    CopyFiles /SILENT "$2\Application Data\SecondLife\*" "$TEMP\SecondLifeSettingsBackup\$0"
 
   CONTINUE:
     IntOp $0 $0 + 1
@@ -350,7 +374,7 @@ Push $0
     ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData"
     StrCmp $0 "" +2
     CreateDirectory "$TEMP\SecondLifeSettingsBackup\AllUsers\"
-    CopyFiles "$2\Application Data\SecondLife\*" "$TEMP\SecondLifeSettingsBackup\AllUsers\"
+    CopyFiles /SILENT "$2\Application Data\SecondLife\*" "$TEMP\SecondLifeSettingsBackup\AllUsers\"
 Pop $0
 
 FunctionEnd
@@ -377,7 +401,7 @@ Push $2
     ExpandEnvStrings $2 $2
 
     CreateDirectory "$2\Application Data\SecondLife\"
-    CopyFiles "$TEMP\SecondLifeSettingsBackup\$0\*" "$2\Application Data\SecondLife\" 
+    CopyFiles /SILENT "$TEMP\SecondLifeSettingsBackup\$0\*" "$2\Application Data\SecondLife\" 
 
   CONTINUE:
     IntOp $0 $0 + 1
@@ -393,11 +417,53 @@ Push $0
     ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData"
     StrCmp $0 "" +2
     CreateDirectory "$2\Application Data\SecondLife\"
-    CopyFiles "$TEMP\SecondLifeSettingsBackup\AllUsers\*" "$2\Application Data\SecondLife\" 
+    CopyFiles /SILENT "$TEMP\SecondLifeSettingsBackup\AllUsers\*" "$2\Application Data\SecondLife\" 
+Pop $0
+
+FunctionEnd
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Remove temp dirs
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+Function RemoveTempUserFiles
+
+Push $0
+Push $1
+Push $2
+
+    StrCpy $0 0 ; Index number used to iterate via EnumRegKey
+
+  LOOP:
+    EnumRegKey $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0
+    StrCmp $1 "" DONE               ; no more users
+
+    ReadRegStr $2 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath" 
+    StrCmp $2 "" CONTINUE 0         ; "ProfileImagePath" value is missing
+
+    ; Required since ProfileImagePath is of type REG_EXPAND_SZ
+    ExpandEnvStrings $2 $2
+
+    RMDir /r "$TEMP\SecondLifeSettingsBackup\$0\*"
+
+  CONTINUE:
+    IntOp $0 $0 + 1
+    Goto LOOP
+  DONE:
+
+Pop $2
+Pop $1
+Pop $0
+
+; Copy files in Documents and Settings\All Users\SecondLife
+Push $0
+    ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData"
+    StrCmp $0 "" +2
+    RMDir /r "$TEMP\SecondLifeSettingsBackup\AllUsers\*"
 Pop $0
 
 FunctionEnd
 
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ; Clobber user files - TEST ONLY
 ; This is here for testing, generally not desirable to call it.
@@ -864,9 +930,12 @@ Call CheckIfAdministrator		; Make sure the user can install/uninstall
 Call CheckIfAlreadyCurrent		; Make sure that we haven't already installed this version
 Call CloseSecondLife			; Make sure we're not running
 Call CheckNetworkConnection		; ping secondlife.com
+Call CheckWillUninstallV2               ; See if a V2 install exists and will be removed.
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-Call PreserveUserFiles
+StrCmp $DO_UNINSTALL_V2 "" PRESERVE_DONE
+  Call PreserveUserFiles
+PRESERVE_DONE:
 
 ;;; Don't remove cache files during a regular install, removing the inventory cache on upgrades results in lots of damage to the servers.
 ;Call RemoveCacheFiles			; Installing over removes potentially corrupted
@@ -951,17 +1020,15 @@ WriteRegExpandStr HKEY_CLASSES_ROOT "x-grid-location-info\shell\open\command" ""
 ; write out uninstaller
 WriteUninstaller "$INSTDIR\uninst.exe"
 
-; Remove existing "Second Life Viewer 2" install if any.
-StrCmp $INSTDIR "$PROGRAMFILES\SecondLifeViewer2" SLV2_DONE ; unless that's the install directory
-IfFileExists "$PROGRAMFILES\SecondLifeViewer2\uninst.exe" SLV2_FOUND SLV2_DONE
-
-SLV2_FOUND:
-ExecWait '"$PROGRAMFILES\SecondLifeViewer2\uninst.exe" /S _?=$PROGRAMFILES\SecondLifeViewer2'
-Delete "$PROGRAMFILES\SecondLifeViewer2\uninst.exe" ; with _? option above, uninst.exe will be left behind.
-RMDir "$PROGRAMFILES\SecondLifeViewer2" ; will remove only if empty.
+; Uninstall existing "Second Life Viewer 2" install if needed.
+StrCmp $DO_UNINSTALL_V2 "" REMOVE_SLV2_DONE
+  ExecWait '"$PROGRAMFILES\SecondLifeViewer2\uninst.exe" /S _?=$PROGRAMFILES\SecondLifeViewer2'
+  Delete "$PROGRAMFILES\SecondLifeViewer2\uninst.exe" ; with _? option above, uninst.exe will be left behind.
+  RMDir "$PROGRAMFILES\SecondLifeViewer2" ; will remove only if empty.
 
-SLV2_DONE:
-Call RestoreUserFiles
+  Call RestoreUserFiles
+  Call RemoveTempUserFiles
+REMOVE_SLV2_DONE:
 
 ; end of default section
 SectionEnd
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index f8b204eca0eb6ceb3870114ee2124295d1e7118b..3870a3be2ecc71d3d5e122e1b5f21ff6c196bbd1 100755
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -169,11 +169,7 @@ bool LLAgent::isActionAllowed(const LLSD& sdname)
 
 	const std::string& param = sdname.asString();
 
-	if (param == "build")
-	{
-		retval = gAgent.canEditParcel();
-	}
-	else if (param == "speak")
+	if (param == "speak")
 	{
 		if ( gAgent.isVoiceConnected() && 
 			LLViewerParcelMgr::getInstance()->allowAgentVoice() &&
@@ -204,6 +200,12 @@ void LLAgent::releaseMicrophone(const LLSD& name)
 	LLVoiceClient::getInstance()->inputUserControlState(false);
 }
 
+// static
+void LLAgent::toggleMicrophone(const LLSD& name)
+{
+	LLVoiceClient::getInstance()->toggleUserPTTState();
+}
+
 // static
 bool LLAgent::isMicrophoneOn(const LLSD& sdname)
 {
@@ -331,12 +333,6 @@ void LLAgent::init()
 
 	LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(boost::bind(&LLAgent::parcelChangedCallback));
 
-	LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Agent.IsActionAllowed", boost::bind(&LLAgent::isActionAllowed, _2));
-	LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Agent.PressMicrophone", boost::bind(&LLAgent::pressMicrophone, _2));
-	LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Agent.ReleaseMicrophone", boost::bind(&LLAgent::releaseMicrophone, _2));
-	LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Agent.IsMicrophoneOn", boost::bind(&LLAgent::isMicrophoneOn, _2));
-
-	
 	mInitialized = TRUE;
 }
 
@@ -1101,20 +1097,11 @@ F32 LLAgent::clampPitchToLimits(F32 angle)
 
 	LLVector3 skyward = getReferenceUpVector();
 
-	F32			look_down_limit;
-	F32			look_up_limit = 10.f * DEG_TO_RAD;
+	const F32 look_down_limit = 179.f * DEG_TO_RAD;;
+	const F32 look_up_limit   =   1.f * DEG_TO_RAD;
 
 	F32 angle_from_skyward = acos( mFrameAgent.getAtAxis() * skyward );
 
-	if (isAgentAvatarValid() && gAgentAvatarp->isSitting())
-	{
-		look_down_limit = 130.f * DEG_TO_RAD;
-	}
-	else
-	{
-		look_down_limit = 170.f * DEG_TO_RAD;
-	}
-
 	// clamp pitch to limits
 	if ((angle >= 0.f) && (angle_from_skyward + angle > look_down_limit))
 	{
@@ -3323,6 +3310,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
 	}
 
 	llinfos << "Received cached texture response for " << num_results << " textures." << llendl;
+	gAgentAvatarp->outputRezTiming("Fetched agent wearables textures from cache. Will now load them");
 
 	gAgentAvatarp->updateMeshTextures();
 
@@ -4004,14 +3992,14 @@ void LLAgent::renderAutoPilotTarget()
 		F32 height_meters;
 		LLVector3d target_global;
 
-		glMatrixMode(GL_MODELVIEW);
+		gGL.matrixMode(LLRender::MM_MODELVIEW);
 		gGL.pushMatrix();
 
 		// not textured
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 
 		// lovely green
-		glColor4f(0.f, 1.f, 1.f, 1.f);
+		gGL.color4f(0.f, 1.f, 1.f, 1.f);
 
 		target_global = mAutoPilotTargetGlobal;
 
@@ -4019,9 +4007,9 @@ void LLAgent::renderAutoPilotTarget()
 
 		height_meters = 1.f;
 
-		glScalef(height_meters, height_meters, height_meters);
+		gGL.scalef(height_meters, height_meters, height_meters);
 
-		gSphere.render(1500.f);
+		gSphere.render();
 
 		gGL.popMatrix();
 	}
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 0f7ed9ce6812463e36f135931a2557882eeb0578..740770bbdf26b0cbea117d436f8e38726b16d66f 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -292,7 +292,9 @@ class LLAgent : public LLOldEvents::LLObservable
 
 	static void		pressMicrophone(const LLSD& name);
 	static void		releaseMicrophone(const LLSD& name);
+	static void		toggleMicrophone(const LLSD& name);
 	static bool		isMicrophoneOn(const LLSD& sdname);
+	static bool		isActionAllowed(const LLSD& sdname);
 
 private:
 	bool			mVoiceConnected;
@@ -595,7 +597,6 @@ class LLAgent : public LLOldEvents::LLObservable
 private:
 	bool			mCanEditParcel;
 
-	static bool isActionAllowed(const LLSD& sdname);
 	static void parcelChangedCallback();
 
 /********************************************************************************
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 13b62cb019d451d17acb3c1446759a658d8f310a..dd02a74a381f764d8ba787c04b2ae311186b3b7c 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -185,6 +185,7 @@ void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar)
 { 
 	if (avatar)
 	{
+		avatar->outputRezTiming("Sending wearables request");
 		sendAgentWearablesRequest();
 	}
 }
@@ -816,7 +817,10 @@ void LLAgentWearables::popWearable(const LLWearableType::EType type, U32 index)
 	if (wearable)
 	{
 		mWearableDatas[type].erase(mWearableDatas[type].begin() + index);
+		if (isAgentAvatarValid())
+		{
 		gAgentAvatarp->wearableUpdated(wearable->getType(), TRUE);
+		}
 		wearable->setLabelUpdated();
 	}
 }
@@ -949,6 +953,11 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
 	if (mInitialWearablesUpdateReceived)
 		return;
 
+	if (isAgentAvatarValid())
+	{
+		gAgentAvatarp->outputRezTiming("Received initial wearables update");
+	}
+
 	// notify subscribers that wearables started loading. See EXT-7777
 	// *TODO: find more proper place to not be called from deprecated method.
 	// Seems such place is found: LLInitialWearablesFetch::processContents()
@@ -1619,6 +1628,11 @@ void LLAgentWearables::queryWearableCache()
 	//VWR-22113: gAgent.getRegion() can return null if invalid, seen here on logout
 	if(gAgent.getRegion())
 	{
+		if (isAgentAvatarValid())
+		{
+			gAgentAvatarp->outputRezTiming("Fetching textures from cache");
+		}
+
 		llinfos << "Requesting texture cache entry for " << num_queries << " baked textures" << llendl;
 		gMessageSystem->sendReliable(gAgent.getRegion()->getHost());
 		gAgentQueryManager.mNumPendingQueries++;
diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp
index 1edc96e1652200861bc4e909d2888b19d2a3cd9b..8cba54347e3141f744f8dc32970b407e53dc50ca 100644
--- a/indra/newview/llagentwearablesfetch.cpp
+++ b/indra/newview/llagentwearablesfetch.cpp
@@ -87,6 +87,10 @@ class LLOrderMyOutfitsOnDestroy: public LLInventoryCallback
 LLInitialWearablesFetch::LLInitialWearablesFetch(const LLUUID& cof_id) :
 	LLInventoryFetchDescendentsObserver(cof_id)
 {
+	if (isAgentAvatarValid())
+	{
+		gAgentAvatarp->outputRezTiming("Initial wearables fetch started");
+	}
 }
 
 LLInitialWearablesFetch::~LLInitialWearablesFetch()
@@ -101,6 +105,10 @@ void LLInitialWearablesFetch::done()
 	// idle tick instead.
 	gInventory.removeObserver(this);
 	doOnIdleOneTime(boost::bind(&LLInitialWearablesFetch::processContents,this));
+	if (isAgentAvatarValid())
+	{
+		gAgentAvatarp->outputRezTiming("Initial wearables fetch done");
+	}
 }
 
 void LLInitialWearablesFetch::add(InitialWearableData &data)
@@ -111,6 +119,12 @@ void LLInitialWearablesFetch::add(InitialWearableData &data)
 
 void LLInitialWearablesFetch::processContents()
 {
+	if(!gAgentAvatarp) //no need to process wearables if the agent avatar is deleted.
+	{
+		delete this;
+		return ;
+	}
+
 	// Fetch the wearable items from the Current Outfit Folder
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t wearable_array;
diff --git a/indra/newview/llagentwearablesfetch.h b/indra/newview/llagentwearablesfetch.h
index 7dafab4a3359f702702553e2e4bf733991135149..bedc445c0ebe76eaa480e40d7dd4afc39e3f18e5 100644
--- a/indra/newview/llagentwearablesfetch.h
+++ b/indra/newview/llagentwearablesfetch.h
@@ -40,6 +40,8 @@
 //--------------------------------------------------------------------
 class LLInitialWearablesFetch : public LLInventoryFetchDescendentsObserver
 {
+	LOG_CLASS(LLInitialWearablesFetch);
+
 public:
 	LLInitialWearablesFetch(const LLUUID& cof_id);
 	~LLInitialWearablesFetch();
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 663257042eec1b5358c262875c33b5373da5fdb6..33f5373d7e80627cc3e3ad9581040968b2a89dc0 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -268,6 +268,8 @@ struct LLFoundData
 	
 class LLWearableHoldingPattern
 {
+	LOG_CLASS(LLWearableHoldingPattern);
+
 public:
 	LLWearableHoldingPattern();
 	~LLWearableHoldingPattern();
@@ -436,6 +438,11 @@ void LLWearableHoldingPattern::checkMissingWearables()
 
 void LLWearableHoldingPattern::onAllComplete()
 {
+	if (isAgentAvatarValid())
+	{
+		gAgentAvatarp->outputRezTiming("Agent wearables fetch complete");
+	}
+
 	if (!isMostRecent())
 	{
 		llwarns << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl;
@@ -2363,6 +2370,8 @@ void LLAppearanceMgr::autopopulateOutfits()
 // Handler for anything that's deferred until avatar de-clouds.
 void LLAppearanceMgr::onFirstFullyVisible()
 {
+	gAgentAvatarp->outputRezTiming("Avatar fully loaded");
+	gAgentAvatarp->reportAvatarRezTime();
 	gAgentAvatarp->debugAvatarVisible();
 
 	// The auto-populate is failing at the point of generating outfits
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
old mode 100755
new mode 100644
index 8bf4d9405971c3e9404b038e1e48d461b8b6afea..1174d108d2b971b9d43ec40cc20fc3463d8a205c
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -45,6 +45,8 @@
 #include "llwindow.h"
 #include "llviewerstats.h"
 #include "llviewerstatsrecorder.h"
+#include "llmarketplacefunctions.h"
+#include "llmarketplacenotifications.h"
 #include "llmd5.h"
 #include "llmeshrepository.h"
 #include "llpumpio.h"
@@ -75,6 +77,7 @@
 //#include "llfirstuse.h"
 #include "llrender.h"
 #include "llteleporthistory.h"
+#include "lltoast.h"
 #include "lllocationhistory.h"
 #include "llfasttimerview.h"
 #include "llvector4a.h"
@@ -522,6 +525,8 @@ static void settings_to_globals()
 
 	LLSurface::setTextureSize(gSavedSettings.getU32("RegionTextureSize"));
 	
+	LLRender::sGLCoreProfile = gSavedSettings.getBOOL("RenderGLCoreProfile");
+
 	LLImageGL::sGlobalUseAnisotropic	= gSavedSettings.getBOOL("RenderAnisotropic");
 	LLVOVolume::sLODFactor				= gSavedSettings.getF32("RenderVolumeLODFactor");
 	LLVOVolume::sDistanceFactor			= 1.f-LLVOVolume::sLODFactor * 0.1f;
@@ -556,42 +561,6 @@ static void settings_modify()
 	gDebugGL = gSavedSettings.getBOOL("RenderDebugGL") || gDebugSession;
 	gDebugPipeline = gSavedSettings.getBOOL("RenderDebugPipeline");
 	gAuditTexture = gSavedSettings.getBOOL("AuditTexture");
-#if LL_VECTORIZE
-	if (gSysCPU.hasAltivec())
-	{
-		gSavedSettings.setBOOL("VectorizeEnable", TRUE );
-		gSavedSettings.setU32("VectorizeProcessor", 0 );
-	}
-	else
-	if (gSysCPU.hasSSE2())
-	{
-		gSavedSettings.setBOOL("VectorizeEnable", TRUE );
-		gSavedSettings.setU32("VectorizeProcessor", 2 );
-	}
-	else
-	if (gSysCPU.hasSSE())
-	{
-		gSavedSettings.setBOOL("VectorizeEnable", TRUE );
-		gSavedSettings.setU32("VectorizeProcessor", 1 );
-	}
-	else
-	{
-		// Don't bother testing or running if CPU doesn't support it. JC
-		gSavedSettings.setBOOL("VectorizePerfTest", FALSE );
-		gSavedSettings.setBOOL("VectorizeEnable", FALSE );
-		gSavedSettings.setU32("VectorizeProcessor", 0 );
-		gSavedSettings.setBOOL("VectorizeSkin", FALSE);
-	}
-#else
-	// This build target doesn't support SSE, don't test/run.
-	gSavedSettings.setBOOL("VectorizePerfTest", FALSE );
-	gSavedSettings.setBOOL("VectorizeEnable", FALSE );
-	gSavedSettings.setU32("VectorizeProcessor", 0 );
-	gSavedSettings.setBOOL("VectorizeSkin", FALSE);
-
-	// disable fullscreen mode, unsupported
-	gSavedSettings.setBOOL("WindowFullScreen", FALSE);
-#endif
 }
 
 class LLFastTimerLogThread : public LLThread
@@ -753,7 +722,9 @@ bool LLAppViewer::init()
 
     // *NOTE:Mani - LLCurl::initClass is not thread safe. 
     // Called before threads are created.
-    LLCurl::initClass(gSavedSettings.getBOOL("CurlUseMultipleThreads"));
+    LLCurl::initClass(gSavedSettings.getF32("CurlRequestTimeOut"), 
+						gSavedSettings.getS32("CurlMaximumNumberOfHandles"), 
+						gSavedSettings.getBOOL("CurlUseMultipleThreads"));
 	LL_INFOS("InitInfo") << "LLCurl initialized." << LL_ENDL ;
 
     LLMachineID::init();
@@ -773,7 +744,7 @@ bool LLAppViewer::init()
 		LLViewerAssetStatsFF::init();
 	}
 
-    initThreads();
+	initThreads();
 	LL_INFOS("InitInfo") << "Threads initialized." << LL_ENDL ;
 
 	// Initialize settings early so that the defaults for ignorable dialogs are
@@ -875,8 +846,6 @@ bool LLAppViewer::init()
 
 	LLAgent::parseTeleportMessages("teleport_strings.xml");
 
-	LLViewerJointMesh::updateVectorize();
-
 	// load MIME type -> media impl mappings
 	std::string mime_types_name;
 #if LL_DARWIN
@@ -1381,17 +1350,19 @@ bool LLAppViewer::mainLoop()
 				{
 					S32 work_pending = 0;
 					S32 io_pending = 0;
+					F32 max_time = llmin(gFrameIntervalSeconds*10.f, 1.f);
+
 					{
 						LLFastTimer ftm(FTM_TEXTURE_CACHE);
- 						work_pending += LLAppViewer::getTextureCache()->update(1); // unpauses the texture cache thread
+ 						work_pending += LLAppViewer::getTextureCache()->update(max_time); // unpauses the texture cache thread
 					}
 					{
 						LLFastTimer ftm(FTM_DECODE);
-	 					work_pending += LLAppViewer::getImageDecodeThread()->update(1); // unpauses the image thread
+	 					work_pending += LLAppViewer::getImageDecodeThread()->update(max_time); // unpauses the image thread
 					}
 					{
 						LLFastTimer ftm(FTM_DECODE);
-	 					work_pending += LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread
+	 					work_pending += LLAppViewer::getTextureFetch()->update(max_time); // unpauses the texture fetch thread
 					}
 
 					{
@@ -1417,6 +1388,11 @@ bool LLAppViewer::mainLoop()
 					}
 				}
 				gMeshRepo.update() ;
+				
+				if(!LLCurl::getCurlThread()->update(1))
+				{
+					LLCurl::getCurlThread()->pause() ; //nothing in the curl thread.
+				}
 
 				if(!total_work_pending) //pause texture fetching threads if nothing to process.
 				{
@@ -1511,6 +1487,9 @@ void LLAppViewer::flushVFSIO()
 
 bool LLAppViewer::cleanup()
 {
+	//ditch LLVOAvatarSelf instance
+	gAgentAvatarp = NULL;
+
 	// workaround for DEV-35406 crash on shutdown
 	LLEventPumps::instance().reset();
 
@@ -1812,6 +1791,7 @@ bool LLAppViewer::cleanup()
 		pending += LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread
 		pending += LLVFSThread::updateClass(0);
 		pending += LLLFSThread::updateClass(0);
+		pending += LLCurl::getCurlThread()->update(1) ;
 		F64 idle_time = idleTimer.getElapsedTimeF64();
 		if(!pending)
 		{
@@ -1823,6 +1803,7 @@ bool LLAppViewer::cleanup()
 			break;
 		}
 	}
+	LLCurl::getCurlThread()->pause() ;
 
 	// Delete workers first
 	// shotdown all worker threads before deleting them in case of co-dependencies
@@ -2860,11 +2841,21 @@ bool LLAppViewer::initWindow()
 
 	// always start windowed
 	BOOL ignorePixelDepth = gSavedSettings.getBOOL("IgnorePixelDepth");
-	gViewerWindow = new LLViewerWindow(gWindowTitle, 
-		VIEWER_WINDOW_CLASSNAME,
-		gSavedSettings.getS32("WindowX"), gSavedSettings.getS32("WindowY"),
-		gSavedSettings.getS32("WindowWidth"), gSavedSettings.getS32("WindowHeight"),
-		gSavedSettings.getBOOL("WindowFullScreen"), ignorePixelDepth);
+
+	LLViewerWindow::Params window_params;
+	window_params
+		.title(gWindowTitle)
+		.name(VIEWER_WINDOW_CLASSNAME)
+		.x(gSavedSettings.getS32("WindowX"))
+		.y(gSavedSettings.getS32("WindowY"))
+		.width(gSavedSettings.getU32("WindowWidth"))
+		.height(gSavedSettings.getU32("WindowHeight"))
+		.min_width(gSavedSettings.getU32("MinWindowWidth"))
+		.min_height(gSavedSettings.getU32("MinWindowHeight"))
+		.fullscreen(gSavedSettings.getBOOL("FullScreen"))
+		.ignore_pixel_depth(ignorePixelDepth);
+
+	gViewerWindow = new LLViewerWindow(window_params);
 
 	LL_INFOS("AppInit") << "gViewerwindow created." << LL_ENDL;
 
@@ -4070,6 +4061,7 @@ void LLAppViewer::idle()
 	LLFrameTimer::updateFrameTime();
 	LLFrameTimer::updateFrameCount();
 	LLEventTimer::updateClass();
+	LLNotificationsUI::LLToast::updateClass();
 	LLCriticalDamp::updateInterpolants();
 	LLMortician::updateClass();
 	LLFilePickerThread::clearDead();  //calls LLFilePickerThread::notify()
@@ -4419,6 +4411,10 @@ void LLAppViewer::idle()
 
 	// update media focus
 	LLViewerMediaFocus::getInstance()->update();
+	
+	// Update marketplace
+	LLMarketplaceInventoryImporter::update();
+	LLMarketplaceInventoryNotifications::update();
 
 	// objects and camera should be in sync, do LOD calculations now
 	{
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index 647ace7ee32281bc20912f31800b04ce41f9429c..bad60a9757af3e116170e330d8d1891f136b4d80 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -26,11 +26,16 @@
 
 #include "llviewerprecompiledheaders.h"
 
+#ifdef INCLUDE_VLD
+#include "vld.h"
+#endif
+
 #include "llappviewerwin32.h"
 
 #include "llmemtype.h"
 
-#include "llwindowwin32.cpp" // *FIX: for setting gIconResource.
+#include "llwindowwin32.h" // *FIX: for setting gIconResource.
+#include "llgl.h"
 #include "res/resource.h" // *FIX: for setting gIconResource.
 
 #include <fcntl.h>		//_O_APPEND
@@ -104,6 +109,14 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
                      LPSTR     lpCmdLine,
                      int       nCmdShow)
 {
+#ifdef INCLUDE_VLD
+	// only works for debug builds (hard coded into vld.h)
+	#ifdef _DEBUG
+		// start with Visual Leak Detector turned off
+		VLDGlobalDisable();
+	#endif // _DEBUG
+#endif // INCLUDE_VLD
+
 	LLMemType mt1(LLMemType::MTYPE_STARTUP);
 
 	const S32 MAX_HEAPS = 255;
diff --git a/indra/newview/llassetuploadqueue.cpp b/indra/newview/llassetuploadqueue.cpp
index 7e50098a173d847e51284c4129b88a63b8daf41b..f943759bb89c66fe1e27d633b60ea195ad307637 100644
--- a/indra/newview/llassetuploadqueue.cpp
+++ b/indra/newview/llassetuploadqueue.cpp
@@ -123,7 +123,9 @@ class LLAssetUploadChainResponder : public LLUpdateTaskInventoryResponder
 			for(LLSD::array_const_iterator line	= compile_errors.beginArray();
 				line < compile_errors.endArray(); line++)
 			{
-				mSupplier->log(line->asString());
+				std::string str = line->asString();
+				str.erase(std::remove(str.begin(), str.end(), '\n'), str.end());
+				mSupplier->log(str);
 				llinfos << content["errors"] << llendl;
 			}
 		}
diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp
index 40a4d665f8e6fff60cab8d4ba618f541eb14463b..65bfc990d1eab087d5adb102024eccc089b52454 100644
--- a/indra/newview/llassetuploadresponders.cpp
+++ b/indra/newview/llassetuploadresponders.cpp
@@ -295,6 +295,11 @@ void LLAssetUploadResponder::uploadFailure(const LLSD& content)
 {
 	// remove the "Uploading..." message
 	LLUploadDialog::modalUploadFinished();
+	LLFloater* floater_snapshot = LLFloaterReg::findInstance("snapshot");
+	if (floater_snapshot)
+	{
+		floater_snapshot->notify(LLSD().with("set-finished", LLSD().with("ok", false).with("msg", "inventory")));
+	}
 	
 	std::string reason = content["state"];
 	// deal with L$ errors
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index 10fd6b739e6a9602713162169e2fbc1171ff7083..f618af953674af2eba56b6552bd2c5ac6517aa25 100755
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -302,6 +302,12 @@ void LLAvatarActions::startConference(const uuid_vec_t& ids)
 	make_ui_sound("UISndStartIM");
 }
 
+static const char* get_profile_floater_name(const LLUUID& avatar_id)
+{
+	// Use different floater XML for our profile to be able to save its rect.
+	return avatar_id == gAgentID ? "my_profile" : "profile";
+}
+
 static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarName& av_name)
 {
 	std::string username = av_name.mUsername;
@@ -314,15 +320,10 @@ static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarNa
 	std::string url = getProfileURL(username);
 
 	// PROFILES: open in webkit window
-	const bool show_chrome = false;
-	static LLCachedControl<LLRect> profile_rect(gSavedSettings, "WebProfileRect");
 	LLFloaterWebContent::Params p;
 	p.url(url).
-		id(agent_id.asString()).
-		show_chrome(show_chrome).
-		window_class("profile").
-		preferred_media_size(profile_rect);
-	LLFloaterReg::showInstance("profile", p);
+		id(agent_id.asString());
+	LLFloaterReg::showInstance(get_profile_floater_name(agent_id), p);
 }
 
 // static
@@ -339,14 +340,15 @@ bool LLAvatarActions::profileVisible(const LLUUID& id)
 {
 	LLSD sd;
 	sd["id"] = id;
-	LLFloaterWebContent *browser = dynamic_cast<LLFloaterWebContent*> (LLFloaterReg::findInstance("profile", sd));
+	LLFloater* browser = getProfileFloater(id);
 	return browser && browser->isShown();
 }
 
 //static
 LLFloater* LLAvatarActions::getProfileFloater(const LLUUID& id)
 {
-	LLFloaterWebContent *browser = dynamic_cast<LLFloaterWebContent*> (LLFloaterReg::findInstance("profile", LLSD().with("id", id)));
+	LLFloaterWebContent *browser = dynamic_cast<LLFloaterWebContent*>
+		(LLFloaterReg::findInstance(get_profile_floater_name(id), LLSD().with("id", id)));
 	return browser;
 }
 
@@ -355,7 +357,7 @@ void LLAvatarActions::hideProfile(const LLUUID& id)
 {
 	LLSD sd;
 	sd["id"] = id;
-	LLFloaterWebContent *browser = dynamic_cast<LLFloaterWebContent*> (LLFloaterReg::findInstance("profile", sd));
+	LLFloater* browser = getProfileFloater(id);
 	if (browser)
 	{
 		browser->closeFloater();
@@ -678,12 +680,29 @@ namespace action_give_inventory
 		std::string items;
 		build_items_string(inventory_selected_uuids, items);
 
+		int folders_count = 0;
+		std::set<LLUUID>::const_iterator it = inventory_selected_uuids.begin();
+
+		//traverse through selected inventory items and count folders among them
+		for ( ; it != inventory_selected_uuids.end() && folders_count <=1 ; ++it)
+		{
+			LLViewerInventoryCategory* inv_cat = gInventory.getCategory(*it);
+			if (NULL != inv_cat)
+			{
+				folders_count++;
+			}
+		}
+
+		// EXP-1599
+		// In case of sharing multiple folders, make the confirmation
+		// dialog contain a warning that only one folder can be shared at a time.
+		std::string notification = (folders_count > 1) ? "ShareFolderConfirmation" : "ShareItemsConfirmation";
 		LLSD substitutions;
 		substitutions["RESIDENTS"] = residents;
 		substitutions["ITEMS"] = items;
 		LLShareInfo::instance().mAvatarNames = avatar_names;
 		LLShareInfo::instance().mAvatarUuids = avatar_uuids;
-		LLNotificationsUtil::add("ShareItemsConfirmation", substitutions, LLSD(), &give_inventory_cb);
+		LLNotificationsUtil::add(notification, substitutions, LLSD(), &give_inventory_cb);
 	}
 }
 
@@ -705,7 +724,7 @@ std::set<LLUUID> LLAvatarActions::getInventorySelectedUUIDs()
 		LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
 		if (sidepanel_inventory)
 		{
-			inventory_selected_uuids = sidepanel_inventory->getInboxOrOutboxSelectionList();
+			inventory_selected_uuids = sidepanel_inventory->getInboxSelectionList();
 		}
 	}
 
@@ -719,6 +738,11 @@ void LLAvatarActions::shareWithAvatars()
 
 	LLFloaterAvatarPicker* picker =
 		LLFloaterAvatarPicker::show(boost::bind(give_inventory, _1, _2), TRUE, FALSE);
+	if (!picker)
+	{
+		return;
+	}
+
 	picker->setOkBtnEnableCb(boost::bind(is_give_inventory_acceptable));
 	picker->openFriendsTab();
 	LLNotificationsUtil::add("ShareNotification");
diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp
old mode 100644
new mode 100755
index 42e7decec188e4cbf76e94d4ef6771ebd11fc045..b539ac38ed82eedf7dc83e2cd98af50e86a4d317
--- a/indra/newview/llavatariconctrl.cpp
+++ b/indra/newview/llavatariconctrl.cpp
@@ -75,6 +75,9 @@ void LLAvatarIconIDCache::load	()
 		LLUUID icon_id;
 		LLDate date;
 
+		if (line.length()<=uuid_len*2)
+			continue; // short line, bail out to prevent substr calls throwing exception.
+
 		std::string avatar_id_str = line.substr(0,uuid_len);
 		std::string icon_id_str = line.substr(uuid_len,uuid_len);
 		
diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp
index e3217668c540eda7e0895051f03f533cdb5e8bae..f2375bfa4f7630c34faedf88a62bb1eb55014fd3 100644
--- a/indra/newview/llcallfloater.cpp
+++ b/indra/newview/llcallfloater.cpp
@@ -188,7 +188,7 @@ void LLCallFloater::draw()
 
 	// Need to resort the participant list if it's in sort by recent speaker order.
 	if (mParticipants)
-		mParticipants->updateRecentSpeakersOrder();
+		mParticipants->update();
 
 	LLFloater::draw();
 }
@@ -333,6 +333,7 @@ void LLCallFloater::refreshParticipantList()
 
 	if (!non_avatar_caller)
 	{
+		llassert(mParticipants == NULL); // check for possible memory leak
 		mParticipants = new LLParticipantList(mSpeakerManager, mAvatarList, true, mVoiceType != VC_GROUP_CHAT && mVoiceType != VC_AD_HOC_CHAT, false);
 		mParticipants->setValidateSpeakerCallback(boost::bind(&LLCallFloater::validateSpeaker, this, _1));
 		const U32 speaker_sort_order = gSavedSettings.getU32("SpeakerParticipantDefaultOrder");
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 42de47e777716645a04ccc12931582dcb12ef74a..f530d10ddc525aec066d78a1550f9824035d2940 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -621,7 +621,6 @@ void LLChatHistory::initFromParams(const LLChatHistory::Params& p)
 	panel_p.has_border = false;
 	panel_p.mouse_opaque = false;
 	panel_p.min_dim = 30;
-	panel_p.max_dim = S32_MAX;
 	panel_p.auto_resize = true;
 	panel_p.user_resize = false;
 
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp
index a0763749032d64ece9629dd31fead3d5194ca6e9..a661808d1ff4b0ad10c8f8310a81d390716ebbbd 100644
--- a/indra/newview/llchiclet.cpp
+++ b/indra/newview/llchiclet.cpp
@@ -250,6 +250,12 @@ LLIMWellChiclet::LLIMWellChiclet(const Params& p)
 
 LLIMWellChiclet::~LLIMWellChiclet()
 {
+	LLIMWellWindow* im_well_window = LLIMWellWindow::findInstance();
+	if (im_well_window)
+	{
+		im_well_window->setSysWellChiclet(NULL);
+	}
+
 	LLIMMgr::getInstance()->removeSessionObserver(this);
 }
 
@@ -296,6 +302,13 @@ void LLIMWellChiclet::createMenu()
 
 void LLIMWellChiclet::messageCountChanged(const LLSD& session_data)
 {
+	// The singleton class LLChicletBar instance might be already deleted
+	// so don't create a new one.
+	if (!LLChicletBar::instanceExists())
+	{
+		return;
+	}
+
 	const LLUUID& session_id = session_data["session_id"];
 	const S32 counter = LLChicletBar::getInstance()->getTotalUnreadIMCount();
 	const bool im_not_visible = !LLFloaterReg::instanceVisible("im_container")
@@ -1100,8 +1113,8 @@ LLChicletPanel::~LLChicletPanel()
 	}
 }
 
-void im_chiclet_callback(LLChicletPanel* panel, const LLSD& data){
-	
+void LLChicletPanel::onMessageCountChanged(const LLSD& data)
+{
 	LLUUID session_id = data["session_id"].asUUID();
 	S32 unread = data["participant_unread"].asInteger();
 
@@ -1126,7 +1139,7 @@ void im_chiclet_callback(LLChicletPanel* panel, const LLSD& data){
 	}
 }
 
-void object_chiclet_callback(const LLSD& data)
+void LLChicletPanel::objectChicletCallback(const LLSD& data)
 {
 	LLUUID notification_id = data["notification_id"];
 	bool new_message = data["new_message"];
@@ -1150,10 +1163,10 @@ void object_chiclet_callback(const LLSD& data)
 BOOL LLChicletPanel::postBuild()
 {
 	LLPanel::postBuild();
-	LLIMModel::instance().addNewMsgCallback(boost::bind(im_chiclet_callback, this, _1));
-	LLIMModel::instance().addNoUnreadMsgsCallback(boost::bind(im_chiclet_callback, this, _1));
-	LLScriptFloaterManager::getInstance()->addNewObjectCallback(boost::bind(object_chiclet_callback, _1));
-	LLScriptFloaterManager::getInstance()->addToggleObjectFloaterCallback(boost::bind(object_chiclet_callback, _1));
+	LLIMModel::instance().addNewMsgCallback(boost::bind(&LLChicletPanel::onMessageCountChanged, this, _1));
+	LLIMModel::instance().addNoUnreadMsgsCallback(boost::bind(&LLChicletPanel::onMessageCountChanged, this, _1));
+	LLScriptFloaterManager::getInstance()->addNewObjectCallback(boost::bind(&LLChicletPanel::objectChicletCallback, this, _1));
+	LLScriptFloaterManager::getInstance()->addToggleObjectFloaterCallback(boost::bind(&LLChicletPanel::objectChicletCallback, this, _1));
 	LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLChicletPanel::findChiclet<LLChiclet>, this, _1));
 	LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&LLChicletPanel::onCurrentVoiceChannelChanged, this, _1));
 
diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h
index 1f1069dcb492a7d81dcfcf56b6fc875aca37229f..19683492c230e72968294a94ea56b989f2dd31b7 100644
--- a/indra/newview/llchiclet.h
+++ b/indra/newview/llchiclet.h
@@ -1158,6 +1158,10 @@ class LLChicletPanel : public LLPanel
 	 */
 	void onChicletSizeChanged(LLChiclet* ctrl, const LLSD& param);
 
+	void onMessageCountChanged(const LLSD& data);
+
+	void objectChicletCallback(const LLSD& data);
+
 	typedef std::vector<LLChiclet*> chiclet_list_t;
 
 	/**
diff --git a/indra/newview/llchicletbar.cpp b/indra/newview/llchicletbar.cpp
index a17e1d13f57ede0132061742e29a1f90462a13cf..f1bc51fbe757a060b656dd36b94d8630da3bf65f 100644
--- a/indra/newview/llchicletbar.cpp
+++ b/indra/newview/llchicletbar.cpp
@@ -35,34 +35,13 @@
 // newview includes
 #include "llchiclet.h"
 #include "llimfloater.h" // for LLIMFloater
+#include "llpaneltopinfobar.h"
 #include "llsyswellwindow.h"
 
 namespace
 {
 	const std::string& PANEL_CHICLET_NAME	= "chiclet_list_panel";
 
-	S32 get_panel_min_width(LLLayoutStack* stack, LLView* panel)
-	{
-		S32 minimal_width = 0;
-		llassert(stack);
-		if ( stack && panel && panel->getVisible() )
-		{
-			stack->getPanelMinSize(panel->getName(), &minimal_width);
-		}
-		return minimal_width;
-	}
-
-	S32 get_panel_max_width(LLLayoutStack* stack, LLPanel* panel)
-	{
-		S32 max_width = 0;
-		llassert(stack);
-		if ( stack && panel && panel->getVisible() )
-		{
-			stack->getPanelMaxSize(panel->getName(), &max_width);
-		}
-		return max_width;
-	}
-
 	S32 get_curr_width(LLUICtrl* ctrl)
 	{
 		S32 cur_width = 0;
@@ -181,6 +160,9 @@ BOOL LLChicletBar::postBuild()
 	showWellButton("im_well", !LLIMWellWindow::getInstance()->isWindowEmpty());
 	showWellButton("notification_well", !LLNotificationWellWindow::getInstance()->isWindowEmpty());
 
+	LLPanelTopInfoBar::instance().setResizeCallback(boost::bind(&LLChicletBar::fitWithTopInfoBar, this));
+	LLPanelTopInfoBar::instance().setVisibleCallback(boost::bind(&LLChicletBar::fitWithTopInfoBar, this));
+
 	return TRUE;
 }
 
@@ -230,15 +212,8 @@ void LLChicletBar::reshape(S32 width, S32 height, BOOL called_from_parent)
 	{
 		// Firstly, update layout stack to ensure we deal with correct panel sizes.
 		{
-			BOOL saved_anim = mToolbarStack->getAnimate();
-			// Set chiclet panel to be autoresized by default.
-			mToolbarStack->updatePanelAutoResize(PANEL_CHICLET_NAME, TRUE);
-			// Disable animation to prevent layout updating in several frames.
-			mToolbarStack->setAnimate(FALSE);
 			// Force the updating of layout to reset panels collapse factor.
 			mToolbarStack->updateLayout();
-			// Restore animate state.
-			mToolbarStack->setAnimate(saved_anim);
 		}
 
 		// chiclet bar is narrowed
@@ -338,3 +313,33 @@ S32 LLChicletBar::getChicletPanelShrinkHeadroom() const
 	llassert(shrink_headroom >= 0); // the panel cannot get narrower than the minimum
 	return shrink_headroom;
 }
+
+void LLChicletBar::fitWithTopInfoBar()
+{
+	LLPanelTopInfoBar& top_info_bar = LLPanelTopInfoBar::instance();
+
+	LLRect rect = getRect();
+	S32 width = rect.getWidth();
+
+	if (top_info_bar.getVisible())
+	{
+		S32 delta = top_info_bar.calcScreenRect().mRight - calcScreenRect().mLeft;
+		if (delta < 0 && rect.mLeft < llabs(delta))
+			delta = -rect.mLeft;
+		rect.setLeftTopAndSize(rect.mLeft + delta, rect.mTop, rect.getWidth(), rect.getHeight());
+		width = rect.getWidth() - delta;
+	}
+	else
+	{
+		LLView* parent = getParent();
+		if (parent)
+		{
+			LLRect parent_rect = parent->getRect();
+			rect.setLeftTopAndSize(0, rect.mTop, rect.getWidth(), rect.getHeight());
+			width = parent_rect.getWidth();
+		}
+	}
+
+	setRect(rect);
+	LLPanel::reshape(width, rect.getHeight(), false);
+}
diff --git a/indra/newview/llchicletbar.h b/indra/newview/llchicletbar.h
index 224dfbb64704b6f3ccce0c60e9a18b3490465339..1427bf95e0f725f6ac2c68fe508c8cd64365219e 100644
--- a/indra/newview/llchicletbar.h
+++ b/indra/newview/llchicletbar.h
@@ -89,6 +89,12 @@ class LLChicletBar
 	 */
 	S32 getChicletPanelShrinkHeadroom() const;
 
+	/**
+	 * function adjusts Chiclet bar width to prevent overlapping with Mini-Location bar
+	 * EXP-1463
+	 */
+	void fitWithTopInfoBar();
+
 protected:
 	LLChicletBar(const LLSD& key = LLSD());
 
diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp
index 54598f90c8318dc9eef4b7b4e2477e6009b94899..e9c7a3fa0394691089d183e97a3663c4f41de137 100644
--- a/indra/newview/llcofwearables.cpp
+++ b/indra/newview/llcofwearables.cpp
@@ -328,6 +328,19 @@ BOOL LLCOFWearables::postBuild()
 	return LLPanel::postBuild();
 }
 
+void LLCOFWearables::setAttachmentsTitle()
+{
+	if (mAttachmentsTab)
+	{
+		U32 free_slots = MAX_AGENT_ATTACHMENTS - mAttachments->size();
+
+		LLStringUtil::format_map_t args_attachments;
+		args_attachments["[COUNT]"] = llformat ("%d", free_slots);
+		std::string attachments_title = LLTrans::getString("Attachments remain", args_attachments);
+		mAttachmentsTab->setTitle(attachments_title);
+	}
+}
+
 void LLCOFWearables::onSelectionChange(LLFlatListView* selected_list)
 {
 	if (!selected_list) return;
@@ -490,6 +503,7 @@ void LLCOFWearables::populateAttachmentsAndBodypartsLists(const LLInventoryModel
 	{
 		mAttachments->sort();
 		mAttachments->notify(REARRANGE); //notifying the parent about the list's size change (cause items were added with rearrange=false)
+		setAttachmentsTitle();
 	}
 	else
 	{
diff --git a/indra/newview/llcofwearables.h b/indra/newview/llcofwearables.h
index 1f8d6d0c94efacd7a3dbd351a12e2496477c1198..9957d6a64e18f1e61fbed1d83ccd20105255678f 100644
--- a/indra/newview/llcofwearables.h
+++ b/indra/newview/llcofwearables.h
@@ -91,6 +91,8 @@ class LLCOFWearables : public LLPanel
 	 */
 	void selectClothing(LLWearableType::EType clothing_type);
 
+	void setAttachmentsTitle();
+
 protected:
 
 	void populateAttachmentsAndBodypartsLists(const LLInventoryModel::item_array_t& cof_items);
diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp
index a42677845ecc0b7c00254bcb580aba3bc531fdc4..4f5f9e22b69ddfe6ef1256d37bd945ec07b6789b 100644
--- a/indra/newview/llcompilequeue.cpp
+++ b/indra/newview/llcompilequeue.cpp
@@ -100,6 +100,7 @@ BOOL LLFloaterScriptQueue::postBuild()
 {
 	childSetAction("close",onCloseBtn,this);
 	getChildView("close")->setEnabled(FALSE);
+	setVisible(true);
 	return TRUE;
 }
 
@@ -158,7 +159,6 @@ void LLFloaterScriptQueue::addObject(const LLUUID& id)
 
 BOOL LLFloaterScriptQueue::start()
 {
-	//llinfos << "LLFloaterCompileQueue::start()" << llendl;
 	std::string buffer;
 
 	LLSelectMgr *mgr = LLSelectMgr::getInstance();
@@ -178,7 +178,7 @@ BOOL LLFloaterScriptQueue::start()
 	args["[COUNT]"] = llformat ("%d", mObjectIDs.count());
 	buffer = getString ("Starting", args);
 	
-	getChild<LLScrollListCtrl>("queue output")->setCommentText(buffer);
+	getChild<LLScrollListCtrl>("queue output")->addSimpleElement(buffer, ADD_BOTTOM);
 
 	return nextObject();
 }
@@ -211,7 +211,7 @@ BOOL LLFloaterScriptQueue::nextObject()
 	if(isDone() && !mDone)
 	{
 		mDone = true;
-		getChild<LLScrollListCtrl>("queue output")->setCommentText(getString("Done"));
+		getChild<LLScrollListCtrl>("queue output")->addSimpleElement(getString("Done"), ADD_BOTTOM);
 		getChildView("close")->setEnabled(TRUE);
 	}
 	return successful_start;
@@ -277,7 +277,7 @@ class LLCompileFloaterUploadQueueSupplier : public LLAssetUploadQueueSupplier
 			return;
 		}
 
-		queue->getChild<LLScrollListCtrl>("queue output")->setCommentText(message);
+		queue->getChild<LLScrollListCtrl>("queue output")->addSimpleElement(message, ADD_BOTTOM);
 	}
 		
 private:
@@ -464,7 +464,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id,
 	}
 	if(queue && (buffer.size() > 0)) 
 	{
-		queue->getChild<LLScrollListCtrl>("queue output")->setCommentText(buffer);
+		queue->getChild<LLScrollListCtrl>("queue output")->addSimpleElement(buffer, ADD_BOTTOM);
 	}
 	delete data;
 }
@@ -637,7 +637,7 @@ void LLFloaterResetQueue::handleInventory(LLViewerObject* viewer_obj,
 				LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it));
 				std::string buffer;
 				buffer = getString("Resetting") + (": ") + item->getName();
-				getChild<LLScrollListCtrl>("queue output")->setCommentText(buffer);
+				getChild<LLScrollListCtrl>("queue output")->addSimpleElement(buffer, ADD_BOTTOM);
 				LLMessageSystem* msg = gMessageSystem;
 				msg->newMessageFast(_PREHASH_ScriptReset);
 				msg->nextBlockFast(_PREHASH_AgentData);
@@ -690,7 +690,7 @@ void LLFloaterRunQueue::handleInventory(LLViewerObject* viewer_obj,
 				LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output");
 				std::string buffer;
 				buffer = getString("Running") + (": ") + item->getName();
-				list->setCommentText(buffer);
+				list->addSimpleElement(buffer, ADD_BOTTOM);
 
 				LLMessageSystem* msg = gMessageSystem;
 				msg->newMessageFast(_PREHASH_SetScriptRunning);
@@ -745,7 +745,7 @@ void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj,
 				LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output");
 				std::string buffer;
 				buffer = getString("NotRunning") + (": ") +item->getName();
-				list->setCommentText(buffer);
+				list->addSimpleElement(buffer, ADD_BOTTOM);
 	
 				LLMessageSystem* msg = gMessageSystem;
 				msg->newMessageFast(_PREHASH_SetScriptRunning);
diff --git a/indra/newview/llcylinder.cpp b/indra/newview/llcylinder.cpp
index 4901e29691689c91b7451369c34c2469763b48a4..f353851a251f3ddbac17a2ca39fa7cb2e1695955 100644
--- a/indra/newview/llcylinder.cpp
+++ b/indra/newview/llcylinder.cpp
@@ -37,261 +37,39 @@
 #include "llgl.h"
 #include "llglheaders.h"
 
-LLCylinder	gCylinder;
 LLCone		gCone;
 
-GLUquadricObj* gQuadObj = NULL;
-
-static const GLint SLICES[] = { 30, 20, 12, 6 };		// same as sphere slices
-static const GLint STACKS = 2;
-static const GLfloat RADIUS = 0.5f;
-	
-// draws a cylinder or cone
-// returns approximate number of triangles required
-U32 draw_cylinder_side(GLint slices, GLint stacks, GLfloat base_radius, GLfloat top_radius)
-{
-	U32 triangles = 0;
-	GLfloat height = 1.0f;
-
-	if (!gQuadObj)
-	{
-		gQuadObj = gluNewQuadric();
-		if (!gQuadObj) llerror("draw_cylindrical_body couldn't allocated quadric", 0);
-	}
-
-	gluQuadricDrawStyle(gQuadObj, GLU_FILL);
-	gluQuadricNormals(gQuadObj, GLU_SMOOTH);
-	gluQuadricOrientation(gQuadObj, GLU_OUTSIDE);
-	gluQuadricTexture(gQuadObj, GL_TRUE);
-	gluCylinder(gQuadObj, base_radius, top_radius, height, slices, stacks);
-	triangles += stacks * (slices * 2);
-	
-
-	return triangles;
-}
-
-
-// Returns number of triangles required to draw
-// Need to know if top or not to set lighting normals
-const BOOL TOP = TRUE;
-const BOOL BOTTOM = FALSE;
-U32 draw_cylinder_cap(GLint slices, GLfloat base_radius, BOOL is_top)
-{
-	U32 triangles = 0;
-
-	if (!gQuadObj)
-	{
-		gQuadObj = gluNewQuadric();
-		if (!gQuadObj) llerror("draw_cylinder_base couldn't allocated quadric", 0);
-	}
-
-	gluQuadricDrawStyle(gQuadObj, GLU_FILL);
-	gluQuadricNormals(gQuadObj, GLU_SMOOTH);
-	gluQuadricOrientation(gQuadObj, GLU_OUTSIDE);
-	gluQuadricTexture(gQuadObj, GL_TRUE);
-
-	// no hole in the middle of the disk, and just one ring
-	GLdouble inner_radius = 0.0;
-	GLint rings = 1;
-
-	// normals point in +z for top, -z for base
-	if (is_top)
-	{
-		gluQuadricOrientation(gQuadObj, GLU_OUTSIDE);
-	}
-	else
-	{
-		gluQuadricOrientation(gQuadObj, GLU_INSIDE);
-	}
-	gluDisk(gQuadObj, inner_radius, base_radius, slices, rings);
-	triangles += slices;
-
-	return triangles;
-}
-
-void LLCylinder::drawSide(S32 detail)
-{
-	draw_cylinder_side(SLICES[detail], STACKS, RADIUS, RADIUS);
-}
-
-void LLCylinder::drawTop(S32 detail)
-{
-	draw_cylinder_cap(SLICES[detail], RADIUS, TOP);
-}
-
-void LLCylinder::drawBottom(S32 detail)
-{
-	draw_cylinder_cap(SLICES[detail], RADIUS, BOTTOM);
-}
-
-void LLCylinder::prerender()
-{
-}
-
-void LLCylinder::cleanupGL()
-{
-	if (gQuadObj)
-	{
-		gluDeleteQuadric(gQuadObj);
-		gQuadObj = NULL;
-	}
-}
-
-void LLCylinder::render(F32 pixel_area)
-{
-	renderface(pixel_area, 0);
-	renderface(pixel_area, 1);
-	renderface(pixel_area, 2);
-}
-
-
-void LLCylinder::renderface(F32 pixel_area, S32 face)
-{
-	if (face < 0 || face > 2)
-	{
-		llerror("LLCylinder::renderface() invalid face number", face);
-		return;
-	}
-
-	glMatrixMode(GL_MODELVIEW);
-	glPushMatrix();
-
-	S32 level_of_detail;
-
-	if (pixel_area > 20000.f)
-	{
-		level_of_detail = 0;
-	}
-	else if (pixel_area > 1600.f)
-	{
-		level_of_detail = 1;
-	}
-	else if (pixel_area > 200.f)
-	{
-		level_of_detail = 2;
-	}
-	else
-	{
-		level_of_detail = 3;
-	}
-
-	if (level_of_detail < 0 || CYLINDER_LEVELS_OF_DETAIL <= level_of_detail)
-	{
-		llerror("LLCylinder::renderface() invalid level of detail", level_of_detail);
-		return;
-	}
-
-	LLVertexBuffer::unbind();
-	
-	switch(face)
-	{
-	case 0:
-		glTranslatef(0.f, 0.f, -0.5f);
-		drawSide(level_of_detail);
-		break;
-	case 1:
-		glTranslatef(0.0f, 0.f, 0.5f);
-		drawTop(level_of_detail);
-		break;
-	case 2:
-		glTranslatef(0.0f, 0.f, -0.5f);
-		drawBottom(level_of_detail);
-		break;
-	default:
-		llerror("LLCylinder::renderface() fell out of switch", 0);
-		break;
-	}
-
-	glMatrixMode(GL_MODELVIEW);
-	glPopMatrix();
-}
-
-
 //
 // Cones
 //
 
-void LLCone::prerender()
+void LLCone::render(S32 sides)
 {
-}
+	gGL.begin(LLRender::TRIANGLE_FAN);
+	gGL.vertex3f(0,0,0);
 
-void LLCone::cleanupGL()
-{
-	if (gQuadObj)
+	for (U32 i = 0; i < sides; i++)
 	{
-		gluDeleteQuadric(gQuadObj);
-		gQuadObj = NULL;
+		F32 a = (F32) i/sides * F_PI*2.f;
+		F32 x = cosf(a)*0.5f;
+		F32 y = sinf(a)*0.5f;
+		gGL.vertex3f(x,y,-.5f);
 	}
-}
+	gGL.vertex3f(cosf(0.f)*0.5f, sinf(0.f)*0.5f, -0.5f);
 
-void LLCone::drawSide(S32 detail)
-{
-	draw_cylinder_side( SLICES[detail], STACKS, RADIUS, 0.f );	
-}
-
-void LLCone::drawBottom(S32 detail)
-{
-	draw_cylinder_cap( SLICES[detail], RADIUS, BOTTOM );
-}
-
-void LLCone::render(S32 level_of_detail)
-{
-	GLfloat height = 1.0f;
+	gGL.end();
 
-	if (level_of_detail < 0 || CONE_LEVELS_OF_DETAIL <= level_of_detail)
+	gGL.begin(LLRender::TRIANGLE_FAN);
+	gGL.vertex3f(0.f, 0.f, 0.5f);
+	for (U32 i = 0; i < sides; i++)
 	{
-		llerror("LLCone::render() invalid level of detail", level_of_detail);
-		return;
+		F32 a = (F32) i/sides * F_PI*2.f;
+		F32 x = cosf(a)*0.5f;
+		F32 y = sinf(a)*0.5f;
+		gGL.vertex3f(x,y,-0.5f);
 	}
+	gGL.vertex3f(cosf(0.f)*0.5f, sinf(0.f)*0.5f, -0.5f);
 
-	glMatrixMode(GL_MODELVIEW);
-	glPushMatrix();
-
-	// center object at 0
-	glTranslatef(0.f, 0.f, - height / 2.0f);
-
-	drawSide(level_of_detail);
-	drawBottom(level_of_detail);
-
-	glMatrixMode(GL_MODELVIEW);
-	glPopMatrix();
+	gGL.end();
 }
 
-
-void LLCone::renderface(S32 level_of_detail, S32 face)
-{
-	if (face < 0 || face > 1)
-	{
-		llerror("LLCone::renderface() invalid face number", face);
-		return;
-	}
-
-	if (level_of_detail < 0 || CONE_LEVELS_OF_DETAIL <= level_of_detail)
-	{
-		llerror("LLCone::renderface() invalid level of detail", level_of_detail);
-		return;
-	}
-
-	glMatrixMode(GL_MODELVIEW);
-	glPushMatrix();
-
-	LLVertexBuffer::unbind();
-	
-	switch(face)
-	{
-	case 0:
-		glTranslatef(0.f, 0.f, -0.5f);
-		drawSide(level_of_detail);
-		break;
-	case 1:
-		glTranslatef(0.f, 0.f, -0.5f);
-		drawBottom(level_of_detail);
-		break;
-	default:
-		llerror("LLCylinder::renderface() fell out of switch", 0);
-		break;
-	}
-
-	glMatrixMode(GL_MODELVIEW);
-	glPopMatrix();
-}
diff --git a/indra/newview/llcylinder.h b/indra/newview/llcylinder.h
index 40a669ceb6d82294deb56a464925f6e843bb851b..4369f06659d048ad3ba72c4edb89c59147f22fcd 100644
--- a/indra/newview/llcylinder.h
+++ b/indra/newview/llcylinder.h
@@ -30,45 +30,18 @@
 //#include "stdtypes.h"
 //#include "llgl.h"
 
-//
-// Cylinders
-//
-const S32 CYLINDER_LEVELS_OF_DETAIL = 4;
-const S32 CYLINDER_FACES = 3;
-
-class LLCylinder
-{
-public:
-	void prerender();
-	void drawTop(S32 detail);
-	void drawSide(S32 detail);
-	void drawBottom(S32 detail);
-	void cleanupGL();
-
-	void render(F32 pixel_area);
-	void renderface(F32 pixel_area, S32 face);
-};
-
+#include "llvertexbuffer.h"
 
 //
 // Cones
 //
 
-const S32 CONE_LOD_HIGHEST = 0;
-const S32 CONE_LEVELS_OF_DETAIL = 4;
-const S32 CONE_FACES = 2;
-
 class LLCone
 {	
 public:
-	void prerender();
-	void cleanupGL();
-	void drawSide(S32 detail);
-	void drawBottom(S32 detail);
-	void render(S32 level_of_detail);
-	void renderface(S32 level_of_detail, S32 face);
+	void render(S32 sides = 12);
 };
 
-extern LLCylinder gCylinder;
+
 extern LLCone gCone;
 #endif
diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp
index ba511a36931f9cf85b62285b90c456a2297ca5c8..7d3170cb76504149753aa9243920a28980fa0230 100644
--- a/indra/newview/lldebugview.cpp
+++ b/indra/newview/lldebugview.cpp
@@ -55,9 +55,23 @@ LLDebugView* gDebugView = NULL;
 static LLDefaultChildRegistry::Register<LLDebugView> r("debug_view");
 
 LLDebugView::LLDebugView(const LLDebugView::Params& p)
-:	LLView(p)
+:	LLView(p),
+	mFastTimerView(NULL),
+	mMemoryView(NULL),
+	mDebugConsolep(NULL),
+	mFloaterSnapRegion(NULL)
 {}
 
+LLDebugView::~LLDebugView()
+{
+	// These have already been deleted.  Fix the globals appropriately.
+	gDebugView = NULL;
+	gTextureView = NULL;
+	gSceneView = NULL;
+	gTextureSizeView = NULL;
+	gTextureCategoryView = NULL;
+}
+
 void LLDebugView::init()
 {
 	LLRect r;
@@ -109,8 +123,6 @@ void LLDebugView::init()
 	addChild(gTextureView);
 	//gTextureView->reshape(r.getWidth(), r.getHeight(), TRUE);
 
-	
-
 
 	if(gAuditTexture)
 	{
@@ -136,22 +148,15 @@ void LLDebugView::init()
 	}
 }
 
-
-LLDebugView::~LLDebugView()
-{
-	// These have already been deleted.  Fix the globals appropriately.
-	gDebugView = NULL;
-	gTextureView = NULL;
-	gSceneView = NULL;
-	gTextureSizeView = NULL;
-	gTextureCategoryView = NULL;
-}
-
 void LLDebugView::draw()
 {
-	LLView* floater_snap_region = getRootView()->getChildView("floater_snap_region");
+	if (mFloaterSnapRegion == NULL)
+	{
+		mFloaterSnapRegion = getRootView()->getChildView("floater_snap_region");
+	}
+
 	LLRect debug_rect;
-	floater_snap_region->localRectToOtherView(floater_snap_region->getLocalRect(), &debug_rect, getParent());
+	mFloaterSnapRegion->localRectToOtherView(mFloaterSnapRegion->getLocalRect(), &debug_rect, getParent());
 
 	setShape(debug_rect);
 	LLView::draw();
diff --git a/indra/newview/lldebugview.h b/indra/newview/lldebugview.h
index 907a42c981eae3f7b28682de8e0bffac42195745..5aec77ad6275fdff32f8406bf60b393b5ea9c159 100644
--- a/indra/newview/lldebugview.h
+++ b/indra/newview/lldebugview.h
@@ -51,17 +51,19 @@ class LLDebugView : public LLView
 			changeDefault(mouse_opaque, false);
 		}
 	};
+	
 	LLDebugView(const Params&);
 	~LLDebugView();
 
 	void init();
 	void draw();
-
+	
 	void setStatsVisible(BOOL visible);
 	
 	LLFastTimerView* mFastTimerView;
 	LLMemoryView*	 mMemoryView;
 	LLConsole*		 mDebugConsolep;
+	LLView*			 mFloaterSnapRegion;
 };
 
 extern LLDebugView* gDebugView;
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index debac9dcbfd9dd4ebf10bb30f3deda6c1f2e0ad5..21b21c152a6b981f929e21784da6c36b0db839a3 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -1077,6 +1077,7 @@ BOOL LLDrawable::isVisible() const
 LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask)
 : LLSpatialPartition(data_mask, render_by_group, GL_STREAM_DRAW_ARB)
 {
+	mBridge = this;
 	mDrawable = root;
 	root->setSpatialBridge(this);
 	
@@ -1105,6 +1106,15 @@ LLSpatialBridge::~LLSpatialBridge()
 	{
 		group->mSpatialPartition->remove(this, group);
 	}
+
+	//delete octree here so listeners will still be able to access bridge specific state
+	destroyTree();
+}
+
+void LLSpatialBridge::destroyTree()
+{
+	delete mOctree;
+	mOctree = NULL;
 }
 
 void LLSpatialBridge::updateSpatialExtents()
diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp
index 286284f828e13af883bce36d6ce5dba52da5fd27..35f8a8579671ef3ac9ccaed54c22323a7d6dc032 100644
--- a/indra/newview/lldrawpool.cpp
+++ b/indra/newview/lldrawpool.cpp
@@ -384,7 +384,7 @@ BOOL LLFacePool::LLOverrideFaceColor::sOverrideFaceColor = FALSE;
 
 void LLFacePool::LLOverrideFaceColor::setColor(const LLColor4& color)
 {
-	glColor4fv(color.mV);
+	gGL.diffuseColor4fv(color.mV);
 }
 
 void LLFacePool::LLOverrideFaceColor::setColor(const LLColor4U& color)
@@ -394,7 +394,7 @@ void LLFacePool::LLOverrideFaceColor::setColor(const LLColor4U& color)
 
 void LLFacePool::LLOverrideFaceColor::setColor(F32 r, F32 g, F32 b, F32 a)
 {
-	glColor4f(r,g,b,a);
+	gGL.diffuseColor4f(r,g,b,a);
 }
 
 
@@ -457,10 +457,10 @@ void LLRenderPass::applyModelMatrix(LLDrawInfo& params)
 	if (params.mModelMatrix != gGLLastMatrix)
 	{
 		gGLLastMatrix = params.mModelMatrix;
-		glLoadMatrixd(gGLModelView);
+		gGL.loadMatrix(gGLModelView);
 		if (params.mModelMatrix)
 		{
-			glMultMatrixf((GLfloat*) params.mModelMatrix->mMatrix);
+			gGL.multMatrix((GLfloat*) params.mModelMatrix->mMatrix);
 		}
 		gPipeline.mMatrixOpCount++;
 	}
@@ -494,8 +494,8 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL ba
 				{
 					tex_setup = true;
 					gGL.getTexUnit(0)->activate();
-					glMatrixMode(GL_TEXTURE);
-					glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
+					gGL.matrixMode(LLRender::MM_TEXTURE);
+					gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix);
 					gPipeline.mTextureMatrixOps++;
 				}
 			}
@@ -519,8 +519,8 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL ba
 
 	if (tex_setup)
 	{
-		glLoadIdentity();
-		glMatrixMode(GL_MODELVIEW);
+		gGL.loadIdentity();
+		gGL.matrixMode(LLRender::MM_MODELVIEW);
 	}
 }
 
diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h
index c7acbb42c62da2c8aa5a471e7c8f5a5aaddfd536..64774d06df78ca0a2f86dcafa30d7c8a1ba5c295 100644
--- a/indra/newview/lldrawpool.h
+++ b/indra/newview/lldrawpool.h
@@ -133,7 +133,7 @@ class LLRenderPass : public LLDrawPool
 		PASS_ALPHA,
 		PASS_ALPHA_MASK,
 		PASS_FULLBRIGHT_ALPHA_MASK,
-		PASS_ALPHA_SHADOW,
+		PASS_ALPHA_INVISIBLE,
 		NUM_RENDER_TYPES,
 	};
 
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index 9719140a37a52f26214fad5e6145cea7be7f68aa..5b62dbc560c197bc558585544f54bda5a00343be 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -54,7 +54,7 @@ static BOOL deferred_render = FALSE;
 
 LLDrawPoolAlpha::LLDrawPoolAlpha(U32 type) :
 		LLRenderPass(type), current_shader(NULL), target_shader(NULL),
-		simple_shader(NULL), fullbright_shader(NULL),
+		simple_shader(NULL), fullbright_shader(NULL), emissive_shader(NULL),
 		mColorSFactor(LLRender::BF_UNDEF), mColorDFactor(LLRender::BF_UNDEF),
 		mAlphaSFactor(LLRender::BF_UNDEF), mAlphaDFactor(LLRender::BF_UNDEF)
 {
@@ -90,7 +90,7 @@ void LLDrawPoolAlpha::renderDeferred(S32 pass)
 {
 	LLFastTimer t(FTM_RENDER_GRASS);
 	gDeferredDiffuseAlphaMaskProgram.bind();
-	gDeferredDiffuseAlphaMaskProgram.setAlphaRange(0.33f, 1.f);
+	gDeferredDiffuseAlphaMaskProgram.setMinimumAlpha(0.33f);
 
 	//render alpha masked objects
 	LLRenderPass::pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
@@ -136,7 +136,7 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass)
 		simple_shader = NULL;
 		fullbright_shader = NULL;
 		gObjectFullbrightAlphaMaskProgram.bind();
-		gObjectFullbrightAlphaMaskProgram.setAlphaRange(0.33f, 1.f);
+		gObjectFullbrightAlphaMaskProgram.setMinimumAlpha(0.33f);
 	}
 
 	deferred_render = TRUE;
@@ -175,11 +175,13 @@ void LLDrawPoolAlpha::beginRenderPass(S32 pass)
 	{
 		simple_shader = &gObjectSimpleWaterAlphaMaskProgram;
 		fullbright_shader = &gObjectFullbrightWaterAlphaMaskProgram;
+		emissive_shader = &gObjectEmissiveWaterProgram;
 	}
 	else
 	{
 		simple_shader = &gObjectSimpleAlphaMaskProgram;
 		fullbright_shader = &gObjectFullbrightAlphaMaskProgram;
+		emissive_shader = &gObjectEmissiveProgram;
 	}
 
 	if (mVertexShaderLevel > 0)
@@ -230,14 +232,14 @@ void LLDrawPoolAlpha::render(S32 pass)
 			if (!LLPipeline::sRenderDeferred || !deferred_render)
 			{
 				simple_shader->bind();
-				simple_shader->setAlphaRange(0.33f, 1.f);
+				simple_shader->setMinimumAlpha(0.33f);
 
 				pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
 			}
 			if (fullbright_shader)
 			{
 				fullbright_shader->bind();
-				fullbright_shader->setAlphaRange(0.33f, 1.f);
+				fullbright_shader->setMinimumAlpha(0.33f);
 			}
 			pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
 			//LLGLSLShader::bindNoShader();
@@ -273,16 +275,16 @@ void LLDrawPoolAlpha::render(S32 pass)
 			if (LLPipeline::sImpostorRender)
 			{
 				fullbright_shader->bind();
-				fullbright_shader->setAlphaRange(0.5f, 1.f);
+				fullbright_shader->setMinimumAlpha(0.5f);
 				simple_shader->bind();
-				simple_shader->setAlphaRange(0.5f, 1.f);
+				simple_shader->setMinimumAlpha(0.5f);
 			}				
 			else
 			{
 				fullbright_shader->bind();
-				fullbright_shader->setAlphaRange(0.f, 1.f);
+				fullbright_shader->setMinimumAlpha(0.f);
 				simple_shader->bind();
-				simple_shader->setAlphaRange(0.f, 1.f);
+				simple_shader->setMinimumAlpha(0.f);
 			}
 		}
 		else
@@ -319,20 +321,27 @@ void LLDrawPoolAlpha::render(S32 pass)
 		BOOL shaders = gPipeline.canUseVertexShaders();
 		if(shaders) 
 		{
-			gObjectFullbrightNonIndexedProgram.bind();
+			gHighlightProgram.bind();
 		}
 		else
 		{
 			gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
 		}
-		glColor4f(1,0,0,1);
+
+		gGL.diffuseColor4f(1,0,0,1);
+				
 		LLViewerFetchedTexture::sSmokeImagep->addTextureStats(1024.f*1024.f);
 		gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sSmokeImagep, TRUE) ;
 		renderAlphaHighlight(LLVertexBuffer::MAP_VERTEX |
 							LLVertexBuffer::MAP_TEXCOORD0);
+
+		pushBatches(LLRenderPass::PASS_ALPHA_MASK, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, FALSE);
+		pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, FALSE);
+		pushBatches(LLRenderPass::PASS_ALPHA_INVISIBLE, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, FALSE);
+
 		if(shaders) 
 		{
-			gObjectFullbrightNonIndexedProgram.unbind();
+			gHighlightProgram.unbind();
 		}
 	}
 }
@@ -472,8 +481,8 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
 						{
 							tex_setup = true;
 							gGL.getTexUnit(0)->activate();
-							glMatrixMode(GL_TEXTURE);
-							glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
+							gGL.matrixMode(LLRender::MM_TEXTURE);
+							gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix);
 							gPipeline.mTextureMatrixOps++;
 						}
 					}
@@ -488,30 +497,34 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
 				gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode);
 				
 				// If this alpha mesh has glow, then draw it a second time to add the destination-alpha (=glow).  Interleaving these state-changing calls could be expensive, but glow must be drawn Z-sorted with alpha.
-				if (draw_glow_for_this_partition &&
-				    params.mGlowColor.mV[3] > 0)
+				if (current_shader && 
+					draw_glow_for_this_partition &&
+					params.mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE))
 				{
 					// install glow-accumulating blend mode
 					gGL.blendFunc(LLRender::BF_ZERO, LLRender::BF_ONE, // don't touch color
 						      LLRender::BF_ONE, LLRender::BF_ONE); // add to alpha (glow)
 
+					emissive_shader->bind();
+					
 					// glow doesn't use vertex colors from the mesh data
-					params.mVertexBuffer->setBuffer(mask & ~LLVertexBuffer::MAP_COLOR);
-					glColor4ubv(params.mGlowColor.mV);
-
+					params.mVertexBuffer->setBuffer((mask & ~LLVertexBuffer::MAP_COLOR) | LLVertexBuffer::MAP_EMISSIVE);
+					
 					// do the actual drawing, again
 					params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset);
 					gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode);
 
 					// restore our alpha blend mode
 					gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor);
+
+					current_shader->bind();
 				}
 			
 				if (tex_setup)
 				{
 					gGL.getTexUnit(0)->activate();
-					glLoadIdentity();
-					glMatrixMode(GL_MODELVIEW);
+					gGL.loadIdentity();
+					gGL.matrixMode(LLRender::MM_MODELVIEW);
 				}
 			}
 		}
diff --git a/indra/newview/lldrawpoolalpha.h b/indra/newview/lldrawpoolalpha.h
index 12a7ae92b12f9dbd60fd7dee206acf55776c8ae7..a4245e561d85cf3e70a377b59c73405b8f219805 100644
--- a/indra/newview/lldrawpoolalpha.h
+++ b/indra/newview/lldrawpoolalpha.h
@@ -78,6 +78,7 @@ class LLDrawPoolAlpha: public LLRenderPass
 	LLGLSLShader* target_shader;
 	LLGLSLShader* simple_shader;
 	LLGLSLShader* fullbright_shader;	
+	LLGLSLShader* emissive_shader;
 
 	// our 'normal' alpha blend function for this pass
 	LLRender::eBlendFactor mColorSFactor;
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index 37ee81aeb545afdbde39a9e5c2bfeb4626bb540b..0103373fd21a0432dd4e518a0c48a6ebdbbe3f81 100644
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -263,7 +263,6 @@ void LLDrawPoolAvatar::beginPostDeferredAlpha()
 	gPipeline.bindDeferredShader(*sVertexProgram);
 	
 	sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
-	enable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
 }
 
 void LLDrawPoolAvatar::beginDeferredRiggedAlpha()
@@ -271,7 +270,6 @@ void LLDrawPoolAvatar::beginDeferredRiggedAlpha()
 	sVertexProgram = &gDeferredSkinnedAlphaProgram;
 	gPipeline.bindDeferredShader(*sVertexProgram);
 	sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
-	LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
 	gPipeline.enableLightsDynamic();
 }
 
@@ -280,7 +278,6 @@ void LLDrawPoolAvatar::endDeferredRiggedAlpha()
 	LLVertexBuffer::unbind();
 	gPipeline.unbindDeferredShader(*sVertexProgram);
 	sDiffuseChannel = 0;
-	LLVertexBuffer::sWeight4Loc = -1;
 	sVertexProgram = NULL;
 }
 
@@ -314,8 +311,7 @@ void LLDrawPoolAvatar::endPostDeferredAlpha()
 	// if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done
 	sRenderingSkinned = FALSE;
 	sSkipOpaque = FALSE;
-	disable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
-	
+		
 	gPipeline.unbindDeferredShader(*sVertexProgram);
 	sDiffuseChannel = 0;
 	sShaderLevel = mVertexShaderLevel;
@@ -356,27 +352,22 @@ void LLDrawPoolAvatar::beginShadowPass(S32 pass)
 	if (pass == 0)
 	{
 		sVertexProgram = &gDeferredAvatarShadowProgram;
-		if (sShaderLevel > 0)
-		{
-			gAvatarMatrixParam = sVertexProgram->mUniform[LLViewerShaderMgr::AVATAR_MATRIX];
-		}
-		//gGL.setAlphaRejectSettings(LLRender::CF_GREATER_EQUAL, 0.2f);
 		
-		glColor4f(1,1,1,1);
+		//gGL.setAlphaRejectSettings(LLRender::CF_GREATER_EQUAL, 0.2f);		
 
 		if ((sShaderLevel > 0))  // for hardware blending
 		{
 			sRenderingSkinned = TRUE;
 			sVertexProgram->bind();
-			enable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
 		}
+
+		gGL.diffuseColor4f(1,1,1,1);
 	}
 	else
 	{
 		sVertexProgram = &gDeferredAttachmentShadowProgram;
 		sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
 		sVertexProgram->bind();
-		LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
 	}
 }
 
@@ -389,14 +380,12 @@ void LLDrawPoolAvatar::endShadowPass(S32 pass)
 		{
 			sRenderingSkinned = FALSE;
 			sVertexProgram->unbind();
-			disable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
 		}
 	}
 	else
 	{
 		LLVertexBuffer::unbind();
 		sVertexProgram->unbind();
-		LLVertexBuffer::sWeight4Loc = -1;
 		sVertexProgram = NULL;
 	}
 }
@@ -430,11 +419,6 @@ void LLDrawPoolAvatar::renderShadow(S32 pass)
 	
 	if (pass == 0)
 	{
-		if (sShaderLevel > 0)
-		{
-			gAvatarMatrixParam = sVertexProgram->mUniform[LLViewerShaderMgr::AVATAR_MATRIX];
-		}
-
 		avatarp->renderSkinned(AVATAR_RENDER_PASS_SINGLE);
 	}
 	else
@@ -492,11 +476,6 @@ void LLDrawPoolAvatar::beginRenderPass(S32 pass)
 	//reset vertex buffer mappings
 	LLVertexBuffer::unbind();
 
-	if (pass == 0)
-	{ //make sure no stale colors are left over from a previous render
-		glColor4f(1,1,1,1);
-	}
-
 	if (LLPipeline::sImpostorRender)
 	{ //impostor render does not have impostors or rigid rendering
 		pass += 2;
@@ -535,6 +514,11 @@ void LLDrawPoolAvatar::beginRenderPass(S32 pass)
 		beginRiggedGlow();
 		break;
 	}
+
+	if (pass == 0)
+	{ //make sure no stale colors are left over from a previous render
+		gGL.diffuseColor4f(1,1,1,1);
+	}
 }
 
 void LLDrawPoolAvatar::endRenderPass(S32 pass)
@@ -592,7 +576,7 @@ void LLDrawPoolAvatar::beginImpostor()
 	if (LLGLSLShader::sNoFixedFunction)
 	{
 		gImpostorProgram.bind();
-		gImpostorProgram.setAlphaRange(0.01f, 1.f);
+		gImpostorProgram.setMinimumAlpha(0.01f);
 	}
 
 	gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
@@ -614,17 +598,17 @@ void LLDrawPoolAvatar::beginRigid()
 	{
 		if (LLPipeline::sUnderWaterRender)
 		{
-			sVertexProgram = &gObjectAlphaMaskNonIndexedWaterProgram;
+			sVertexProgram = &gObjectAlphaMaskNoColorWaterProgram;
 		}
 		else
 		{
-			sVertexProgram = &gObjectAlphaMaskNonIndexedProgram;
+			sVertexProgram = &gObjectAlphaMaskNoColorProgram;
 		}
 		
 		if (sVertexProgram != NULL)
 		{	//eyeballs render with the specular shader
 			sVertexProgram->bind();
-			sVertexProgram->setAlphaRange(0.2f, 1.f);
+			sVertexProgram->setMinimumAlpha(0.2f);
 		}
 	}
 	else
@@ -657,7 +641,7 @@ void LLDrawPoolAvatar::beginDeferredImpostor()
 	sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
 
 	sVertexProgram->bind();
-	sVertexProgram->setAlphaRange(0.01f, 1.f);
+	sVertexProgram->setMinimumAlpha(0.01f);
 }
 
 void LLDrawPoolAvatar::endDeferredImpostor()
@@ -672,14 +656,16 @@ void LLDrawPoolAvatar::endDeferredImpostor()
 
 void LLDrawPoolAvatar::beginDeferredRigid()
 {
-	sVertexProgram = &gDeferredNonIndexedDiffuseProgram;
-				
+	sVertexProgram = &gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram;
+	sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
 	sVertexProgram->bind();
+	sVertexProgram->setMinimumAlpha(0.2f);
 }
 
 void LLDrawPoolAvatar::endDeferredRigid()
 {
 	sShaderLevel = mVertexShaderLevel;
+	sVertexProgram->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
 	sVertexProgram->unbind();
 	gGL.getTexUnit(0)->activate();
 }
@@ -703,11 +689,11 @@ void LLDrawPoolAvatar::beginSkinned()
 	{
 		if (LLPipeline::sUnderWaterRender)
 		{
-			sVertexProgram = &gObjectAlphaMaskNonIndexedWaterProgram;
+			sVertexProgram = &gObjectAlphaMaskNoColorWaterProgram;
 		}
 		else
 		{
-			sVertexProgram = &gObjectAlphaMaskNonIndexedProgram;
+			sVertexProgram = &gObjectAlphaMaskNoColorProgram;
 		}
 	}
 	
@@ -716,17 +702,6 @@ void LLDrawPoolAvatar::beginSkinned()
 		sRenderingSkinned = TRUE;
 
 		sVertexProgram->bind();
-		if (sShaderLevel >= SHADER_LEVEL_CLOTH)
-		{
-			enable_cloth_weights(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_CLOTHING]);
-		}
-		enable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
-
-		if (sShaderLevel >= SHADER_LEVEL_BUMP)
-		{
-			enable_binormals(sVertexProgram->mAttribute[LLViewerShaderMgr::BINORMAL]);
-		}
-		
 		sVertexProgram->enableTexture(LLViewerShaderMgr::BUMP_MAP);
 		gGL.getTexUnit(0)->activate();
 	}
@@ -742,7 +717,7 @@ void LLDrawPoolAvatar::beginSkinned()
 
 	if (LLGLSLShader::sNoFixedFunction)
 	{
-		sVertexProgram->setAlphaRange(0.2f, 1.f);
+		sVertexProgram->setMinimumAlpha(0.2f);
 	}
 }
 
@@ -754,16 +729,6 @@ void LLDrawPoolAvatar::endSkinned()
 		sRenderingSkinned = FALSE;
 		sVertexProgram->disableTexture(LLViewerShaderMgr::BUMP_MAP);
 		gGL.getTexUnit(0)->activate();
-		disable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
-		if (sShaderLevel >= SHADER_LEVEL_BUMP)
-		{
-			disable_binormals(sVertexProgram->mAttribute[LLViewerShaderMgr::BINORMAL]);
-		}
-		if ((sShaderLevel >= SHADER_LEVEL_CLOTH))
-		{
-			disable_cloth_weights(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_CLOTHING]);
-		}
-
 		sVertexProgram->unbind();
 		sShaderLevel = mVertexShaderLevel;
 	}
@@ -809,7 +774,6 @@ void LLDrawPoolAvatar::beginRiggedSimple()
 	{
 		sDiffuseChannel = 0;
 		sVertexProgram->bind();
-		LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
 	}
 }
 
@@ -820,7 +784,6 @@ void LLDrawPoolAvatar::endRiggedSimple()
 	{
 		sVertexProgram->unbind();
 		sVertexProgram = NULL;
-		LLVertexBuffer::sWeight4Loc = -1;
 	}
 }
 
@@ -847,7 +810,34 @@ void LLDrawPoolAvatar::endRiggedFullbrightAlpha()
 
 void LLDrawPoolAvatar::beginRiggedGlow()
 {
-	beginRiggedFullbright();
+	if (sShaderLevel > 0)
+	{
+		if (LLPipeline::sUnderWaterRender)
+		{
+			sVertexProgram = &gSkinnedObjectEmissiveWaterProgram;
+		}
+		else
+		{
+			sVertexProgram = &gSkinnedObjectEmissiveProgram;
+		}
+	}
+	else
+	{
+		if (LLPipeline::sUnderWaterRender)
+		{
+			sVertexProgram = &gObjectEmissiveNonIndexedWaterProgram;
+		}
+		else
+		{
+			sVertexProgram = &gObjectEmissiveNonIndexedProgram;
+		}
+	}
+
+	if (sShaderLevel > 0 || gPipeline.canUseVertexShaders())
+	{
+		sDiffuseChannel = 0;
+		sVertexProgram->bind();
+	}
 }
 
 void LLDrawPoolAvatar::endRiggedGlow()
@@ -884,7 +874,6 @@ void LLDrawPoolAvatar::beginRiggedFullbright()
 	{
 		sDiffuseChannel = 0;
 		sVertexProgram->bind();
-		LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
 	}
 }
 
@@ -895,7 +884,6 @@ void LLDrawPoolAvatar::endRiggedFullbright()
 	{
 		sVertexProgram->unbind();
 		sVertexProgram = NULL;
-		LLVertexBuffer::sWeight4Loc = -1;
 	}
 }
 
@@ -928,7 +916,6 @@ void LLDrawPoolAvatar::beginRiggedShinySimple()
 	{
 		sVertexProgram->bind();
 		LLDrawPoolBump::bindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false);
-		LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
 	}
 }
 
@@ -940,7 +927,6 @@ void LLDrawPoolAvatar::endRiggedShinySimple()
 		LLDrawPoolBump::unbindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false);
 		sVertexProgram->unbind();
 		sVertexProgram = NULL;
-		LLVertexBuffer::sWeight4Loc = -1;
 	}
 }
 
@@ -974,7 +960,6 @@ void LLDrawPoolAvatar::beginRiggedFullbrightShiny()
 	{
 		sVertexProgram->bind();
 		LLDrawPoolBump::bindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false);
-		LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
 	}
 }
 
@@ -986,7 +971,6 @@ void LLDrawPoolAvatar::endRiggedFullbrightShiny()
 		LLDrawPoolBump::unbindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false);
 		sVertexProgram->unbind();
 		sVertexProgram = NULL;
-		LLVertexBuffer::sWeight4Loc = -1;
 	}
 }
 
@@ -996,14 +980,12 @@ void LLDrawPoolAvatar::beginDeferredRiggedSimple()
 	sVertexProgram = &gDeferredSkinnedDiffuseProgram;
 	sDiffuseChannel = 0;
 	sVertexProgram->bind();
-	LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
 }
 
 void LLDrawPoolAvatar::endDeferredRiggedSimple()
 {
 	LLVertexBuffer::unbind();
 	sVertexProgram->unbind();
-	LLVertexBuffer::sWeight4Loc = -1;
 	sVertexProgram = NULL;
 }
 
@@ -1013,7 +995,6 @@ void LLDrawPoolAvatar::beginDeferredRiggedBump()
 	sVertexProgram->bind();
 	normal_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::BUMP_MAP);
 	sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
-	LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
 }
 
 void LLDrawPoolAvatar::endDeferredRiggedBump()
@@ -1022,7 +1003,6 @@ void LLDrawPoolAvatar::endDeferredRiggedBump()
 	sVertexProgram->disableTexture(LLViewerShaderMgr::BUMP_MAP);
 	sVertexProgram->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
 	sVertexProgram->unbind();
-	LLVertexBuffer::sWeight4Loc = -1;
 	normal_channel = -1;
 	sDiffuseChannel = 0;
 	sVertexProgram = NULL;
@@ -1032,14 +1012,12 @@ void LLDrawPoolAvatar::beginDeferredSkinned()
 {
 	sShaderLevel = mVertexShaderLevel;
 	sVertexProgram = &gDeferredAvatarProgram;
-
 	sRenderingSkinned = TRUE;
 
 	sVertexProgram->bind();
+	sVertexProgram->setMinimumAlpha(0.2f);
 	
 	sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
-	enable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
-
 	gGL.getTexUnit(0)->activate();
 }
 
@@ -1047,7 +1025,6 @@ void LLDrawPoolAvatar::endDeferredSkinned()
 {
 	// if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done
 	sRenderingSkinned = FALSE;
-	disable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
 	sVertexProgram->unbind();
 
 	sVertexProgram->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
@@ -1161,10 +1138,12 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
 		return;
 	}
 
-	if (single_avatar && avatarp->mSpecialRenderMode >= 1) // 1=anim preview, 2=image preview,  3=morph view
+	llassert(LLPipeline::sImpostorRender || !avatarp->isVisuallyMuted());
+
+	/*if (single_avatar && avatarp->mSpecialRenderMode >= 1) // 1=anim preview, 2=image preview,  3=morph view
 	{
 		gPipeline.enableLightsAvatarEdit(LLColor4(.5f, .5f, .5f, 1.f));
-	}
+	}*/
 	
 	if (pass == 1)
 	{
@@ -1255,11 +1234,6 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
 		return;
 	}
 	
-	if (sShaderLevel > 0)
-	{
-		gAvatarMatrixParam = sVertexProgram->mUniform[LLViewerShaderMgr::AVATAR_MATRIX];
-	}
-    
 	if ((sShaderLevel >= SHADER_LEVEL_CLOTH))
 	{
 		LLMatrix4 rot_mat;
@@ -1273,16 +1247,16 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
 		wind = wind * rot_mat;
 		wind.mV[VW] = avatarp->mWindVec.mV[VW];
 
-		sVertexProgram->vertexAttrib4fv(LLViewerShaderMgr::AVATAR_WIND, wind.mV);
+		sVertexProgram->uniform4fv(LLViewerShaderMgr::AVATAR_WIND, 1, wind.mV);
 		F32 phase = -1.f * (avatarp->mRipplePhase);
 
 		F32 freq = 7.f + (noise1(avatarp->mRipplePhase) * 2.f);
 		LLVector4 sin_params(freq, freq, freq, phase);
-		sVertexProgram->vertexAttrib4fv(LLViewerShaderMgr::AVATAR_SINWAVE, sin_params.mV);
+		sVertexProgram->uniform4fv(LLViewerShaderMgr::AVATAR_SINWAVE, 1, sin_params.mV);
 
 		LLVector4 gravity(0.f, 0.f, -CLOTHING_GRAVITY_EFFECT, 0.f);
 		gravity = gravity * rot_mat;
-		sVertexProgram->vertexAttrib4fv(LLViewerShaderMgr::AVATAR_GRAVITY, gravity.mV);
+		sVertexProgram->uniform4fv(LLViewerShaderMgr::AVATAR_GRAVITY, 1, gravity.mV);
 	}
 
 	if( !single_avatar || (avatarp == single_avatar) )
@@ -1306,14 +1280,14 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace*
 	
 	if (buffer.isNull() || 
 		buffer->getTypeMask() != data_mask ||
-		buffer->getRequestedVerts() != vol_face.mNumVertices ||
-		buffer->getRequestedIndices() != vol_face.mNumIndices ||
+		buffer->getNumVerts() != vol_face.mNumVertices ||
+		buffer->getNumIndices() != vol_face.mNumIndices ||
 		(drawable && drawable->isState(LLDrawable::REBUILD_ALL)))
 	{
 		face->setGeomIndex(0);
 		face->setIndicesIndex(0);
 		
-		if (buffer.isNull() || buffer->getTypeMask() != data_mask)
+		if (buffer.isNull() || buffer->getTypeMask() != data_mask || !buffer->isWriteable())
 		{ //make a new buffer
 			if (sShaderLevel > 0)
 			{
@@ -1346,7 +1320,21 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace*
 
 		LLMatrix3 mat_normal(mat3);				
 
+		//let getGeometryVolume know if alpha should override shiny
+		U32 type = gPipeline.getPoolTypeFromTE(face->getTextureEntry(), face->getTexture());
+
+		if (type == LLDrawPool::POOL_ALPHA)
+		{
+			face->setPoolType(LLDrawPool::POOL_ALPHA);
+		}
+		else
+		{
+			face->setPoolType(LLDrawPool::POOL_AVATAR);
+		}
+
 		face->getGeometryVolume(*volume, face->getTEOffset(), mat_vert, mat_normal, offset, true);
+
+		buffer->flush();
 	}
 
 	if (sShaderLevel <= 0 && face->mLastSkinTime < avatar->getLastSkinTime())
@@ -1383,7 +1371,7 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace*
 		LLMatrix4a bind_shape_matrix;
 		bind_shape_matrix.loadu(skin->mBindShapeMatrix);
 
-		for (U32 j = 0; j < buffer->getRequestedVerts(); ++j)
+		for (U32 j = 0; j < buffer->getNumVerts(); ++j)
 		{
 			LLMatrix4a final_mat;
 			final_mat.clear();
@@ -1483,12 +1471,12 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
 			continue;
 		}
 
-		stop_glerror();
+		//stop_glerror();
 
-		const LLVolumeFace& vol_face = volume->getVolumeFace(te);
-		updateRiggedFaceVertexBuffer(avatar, face, skin, volume, vol_face);
+		//const LLVolumeFace& vol_face = volume->getVolumeFace(te);
+		//updateRiggedFaceVertexBuffer(avatar, face, skin, volume, vol_face);
 		
-		stop_glerror();
+		//stop_glerror();
 
 		U32 data_mask = LLFace::getRiggedDataMask(type);
 
@@ -1524,17 +1512,15 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
 				data_mask &= ~LLVertexBuffer::MAP_WEIGHT4;
 			}
 
-			buff->setBuffer(data_mask);
-
 			U16 start = face->getGeomStart();
 			U16 end = start + face->getGeomCount()-1;
 			S32 offset = face->getIndicesStart();
 			U32 count = face->getIndicesCount();
 
-			if (glow)
+			/*if (glow)
 			{
-				glColor4f(0,0,0,face->getTextureEntry()->getGlow());
-			}
+				gGL.diffuseColor4f(0,0,0,face->getTextureEntry()->getGlow());
+			}*/
 
 			gGL.getTexUnit(sDiffuseChannel)->bind(face->getTexture());
 			if (normal_channel > -1)
@@ -1544,14 +1530,16 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
 
 			if (face->mTextureMatrix)
 			{
-				glMatrixMode(GL_TEXTURE);
-				glLoadMatrixf((F32*) face->mTextureMatrix->mMatrix);
+				gGL.matrixMode(LLRender::MM_TEXTURE);
+				gGL.loadMatrix((F32*) face->mTextureMatrix->mMatrix);
+				buff->setBuffer(data_mask);
 				buff->drawRange(LLRender::TRIANGLES, start, end, count, offset);
-				glLoadIdentity();
-				glMatrixMode(GL_MODELVIEW);
+				gGL.loadIdentity();
+				gGL.matrixMode(LLRender::MM_MODELVIEW);
 			}
 			else
 			{
+				buff->setBuffer(data_mask);
 				buff->drawRange(LLRender::TRIANGLES, start, end, count, offset);		
 			}
 		}
@@ -1560,6 +1548,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
 
 void LLDrawPoolAvatar::renderDeferredRiggedSimple(LLVOAvatar* avatar)
 {
+	updateRiggedVertexBuffers(avatar);
 	renderRigged(avatar, RIGGED_DEFERRED_SIMPLE);
 }
 
@@ -1568,8 +1557,58 @@ void LLDrawPoolAvatar::renderDeferredRiggedBump(LLVOAvatar* avatar)
 	renderRigged(avatar, RIGGED_DEFERRED_BUMP);
 }
 
+void LLDrawPoolAvatar::updateRiggedVertexBuffers(LLVOAvatar* avatar)
+{
+	//update rigged vertex buffers
+	for (U32 type = 0; type < NUM_RIGGED_PASSES; ++type)
+	{
+		for (U32 i = 0; i < mRiggedFace[type].size(); ++i)
+		{
+			LLFace* face = mRiggedFace[type][i];
+			LLDrawable* drawable = face->getDrawable();
+			if (!drawable)
+			{
+				continue;
+			}
+
+			LLVOVolume* vobj = drawable->getVOVolume();
+
+			if (!vobj)
+			{
+				continue;
+			}
+
+			LLVolume* volume = vobj->getVolume();
+			S32 te = face->getTEOffset();
+
+			if (!volume || volume->getNumVolumeFaces() <= te)
+			{
+				continue;
+			}
+
+			LLUUID mesh_id = volume->getParams().getSculptID();
+			if (mesh_id.isNull())
+			{
+				continue;
+			}
+
+			const LLMeshSkinInfo* skin = gMeshRepo.getSkinInfo(mesh_id, vobj);
+			if (!skin)
+			{
+				continue;
+			}
+
+			stop_glerror();
+
+			const LLVolumeFace& vol_face = volume->getVolumeFace(te);
+			updateRiggedFaceVertexBuffer(avatar, face, skin, volume, vol_face);
+		}
+	}
+}
+
 void LLDrawPoolAvatar::renderRiggedSimple(LLVOAvatar* avatar)
 {
+	updateRiggedVertexBuffers(avatar);
 	renderRigged(avatar, RIGGED_SIMPLE);
 }
 
@@ -1684,34 +1723,3 @@ LLVertexBufferAvatar::LLVertexBufferAvatar()
 }
 
 
-void LLVertexBufferAvatar::setupVertexBuffer(U32 data_mask) const
-{
-	if (sRenderingSkinned)
-	{
-		U8* base = useVBOs() ? (U8*) mAlignedOffset : mMappedData;
-
-		glVertexPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_VERTEX], (void*)(base + 0));
-		glNormalPointer(GL_FLOAT, LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_NORMAL], (void*)(base + mOffsets[TYPE_NORMAL]));
-		glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_TEXCOORD0], (void*)(base + mOffsets[TYPE_TEXCOORD0]));
-		
-		set_vertex_weights(LLDrawPoolAvatar::sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT], 
-						LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_WEIGHT], (F32*)(base + mOffsets[TYPE_WEIGHT]));
-
-		if (sShaderLevel >= LLDrawPoolAvatar::SHADER_LEVEL_BUMP)
-		{
-			set_binormals(LLDrawPoolAvatar::sVertexProgram->mAttribute[LLViewerShaderMgr::BINORMAL],
-				LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_BINORMAL], (LLVector3*)(base + mOffsets[TYPE_BINORMAL]));
-		}
-	
-		if (sShaderLevel >= LLDrawPoolAvatar::SHADER_LEVEL_CLOTH)
-		{
-			set_vertex_clothing_weights(LLDrawPoolAvatar::sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_CLOTHING], 
-				LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_CLOTHWEIGHT], (LLVector4*)(base + mOffsets[TYPE_CLOTHWEIGHT]));
-		}
-	}
-	else
-	{
-		LLVertexBuffer::setupVertexBuffer(data_mask);
-	}
-}
-
diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h
index fcd8294af544e27d8b4a10150590ef7c3c49b5ce..69e306885893797c00e5b222c59d338d59a43739 100644
--- a/indra/newview/lldrawpoolavatar.h
+++ b/indra/newview/lldrawpoolavatar.h
@@ -134,6 +134,7 @@ class LLDrawPoolAvatar : public LLFacePool
 									  const LLMeshSkinInfo* skin, 
 									  LLVolume* volume,
 									  const LLVolumeFace& vol_face);
+	void updateRiggedVertexBuffers(LLVOAvatar* avatar);
 
 	void renderRigged(LLVOAvatar* avatar, U32 type, bool glow = false);
 	void renderRiggedSimple(LLVOAvatar* avatar);
@@ -176,6 +177,7 @@ class LLDrawPoolAvatar : public LLFacePool
 		RIGGED_FULLBRIGHT_SHINY_MASK = RIGGED_SIMPLE_MASK,							 
 		RIGGED_GLOW_MASK = LLVertexBuffer::MAP_VERTEX | 
 							 LLVertexBuffer::MAP_TEXCOORD0 |
+							 LLVertexBuffer::MAP_EMISSIVE |
 							 LLVertexBuffer::MAP_WEIGHT4,
 		RIGGED_ALPHA_MASK = RIGGED_SIMPLE_MASK,
 		RIGGED_FULLBRIGHT_ALPHA_MASK = RIGGED_FULLBRIGHT_MASK,
@@ -214,7 +216,6 @@ class LLVertexBufferAvatar : public LLVertexBuffer
 {
 public:
 	LLVertexBufferAvatar();
-	virtual void setupVertexBuffer(U32 data_mask) const;
 };
 
 extern S32 AVATAR_OFFSET_POS;
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index 0742250b0b995b973cf0a5debad9eba4e139e9e4..b58efe62ab6dc4f2af0b4740391ebc73ca6cf5dd 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -763,7 +763,7 @@ void LLDrawPoolBump::renderBump(U32 pass)
 	LLGLDisable fog(GL_FOG);
 	LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_LEQUAL);
 	LLGLEnable blend(GL_BLEND);
-	glColor4f(1,1,1,1);
+	gGL.diffuseColor4f(1,1,1,1);
 	/// Get rid of z-fighting with non-bump pass.
 	LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
 	glPolygonOffset(-1.0f, -1.0f);
@@ -786,7 +786,7 @@ void LLDrawPoolBump::endBump(U32 pass)
 	{
 		// Disable texture blending on unit 1
 		gGL.getTexUnit(1)->activate();
-		//gGL.getTexUnit(1)->disable();
+		gGL.getTexUnit(1)->disable();
 		gGL.getTexUnit(1)->setTextureBlendType(LLTexUnit::TB_MULT);
 
 		// Disable texture blending on unit 0
@@ -1036,51 +1036,48 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText
 	llassert( (bump_code == BE_BRIGHTNESS) || (bump_code == BE_DARKNESS) );
 
 	LLViewerTexture* bump = NULL;
-	const F32 BRIGHTNESS_DARKNESS_PIXEL_AREA_THRESHOLD = 1000;
-	if( src_image->getMaxVirtualSize() > BRIGHTNESS_DARKNESS_PIXEL_AREA_THRESHOLD )
-	{
-		bump_image_map_t* entries_list = NULL;
-		void (*callback_func)( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) = NULL;
+	
+	bump_image_map_t* entries_list = NULL;
+	void (*callback_func)( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) = NULL;
 
-		switch( bump_code )
-		{
-		case BE_BRIGHTNESS:
-			entries_list = &mBrightnessEntries;
-			callback_func = LLBumpImageList::onSourceBrightnessLoaded;
-			break;
-		case BE_DARKNESS:
-			entries_list = &mDarknessEntries;
-			callback_func = LLBumpImageList::onSourceDarknessLoaded;
-			break;
-		default:
-			llassert(0);
-			return NULL;
-		}
+	switch( bump_code )
+	{
+	case BE_BRIGHTNESS:
+		entries_list = &mBrightnessEntries;
+		callback_func = LLBumpImageList::onSourceBrightnessLoaded;
+		break;
+	case BE_DARKNESS:
+		entries_list = &mDarknessEntries;
+		callback_func = LLBumpImageList::onSourceDarknessLoaded;
+		break;
+	default:
+		llassert(0);
+		return NULL;
+	}
 
-		bump_image_map_t::iterator iter = entries_list->find(src_image->getID());
-		if (iter != entries_list->end() && iter->second.notNull())
-		{
-			bump = iter->second;
-		}
-		else
-		{
-			LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,1);
-			raw->clear(0x77, 0x77, 0xFF, 0xFF);
+	bump_image_map_t::iterator iter = entries_list->find(src_image->getID());
+	if (iter != entries_list->end() && iter->second.notNull())
+	{
+		bump = iter->second;
+	}
+	else
+	{
+		LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,1);
+		raw->clear(0x77, 0x77, 0xFF, 0xFF);
 
-			(*entries_list)[src_image->getID()] = LLViewerTextureManager::getLocalTexture( raw.get(), TRUE);
-			bump = (*entries_list)[src_image->getID()]; // In case callback was called immediately and replaced the image
-		}
+		(*entries_list)[src_image->getID()] = LLViewerTextureManager::getLocalTexture( raw.get(), TRUE);
+		bump = (*entries_list)[src_image->getID()]; // In case callback was called immediately and replaced the image
+	}
 
-		if (!src_image->hasCallbacks())
-		{ //if image has no callbacks but resolutions don't match, trigger raw image loaded callback again
-			if (src_image->getWidth() != bump->getWidth() ||
-				src_image->getHeight() != bump->getHeight())// ||
-				//(LLPipeline::sRenderDeferred && bump->getComponents() != 4))
-			{
-				src_image->setBoostLevel(LLViewerTexture::BOOST_BUMP) ;
-				src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL );
-				src_image->forceToSaveRawImage(0) ;
-			}
+	if (!src_image->hasCallbacks())
+	{ //if image has no callbacks but resolutions don't match, trigger raw image loaded callback again
+		if (src_image->getWidth() != bump->getWidth() ||
+			src_image->getHeight() != bump->getHeight())// ||
+			//(LLPipeline::sRenderDeferred && bump->getComponents() != 4))
+		{
+			src_image->setBoostLevel(LLViewerTexture::BOOST_BUMP) ;
+			src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL );
+			src_image->forceToSaveRawImage(0) ;
 		}
 	}
 
@@ -1088,6 +1085,8 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText
 }
 
 
+static LLFastTimer::DeclareTimer FTM_BUMP_SOURCE_STANDARD_LOADED("Bump Standard Callback");
+
 // static
 void LLBumpImageList::onSourceBrightnessLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata )
 {
@@ -1110,14 +1109,24 @@ void LLBumpImageList::onSourceDarknessLoaded( BOOL success, LLViewerFetchedTextu
 	}
 }
 
+static LLFastTimer::DeclareTimer FTM_BUMP_GEN_NORMAL("Generate Normal Map");
+static LLFastTimer::DeclareTimer FTM_BUMP_CREATE_TEXTURE("Create GL Normal Map");
+
 void LLBumpImageList::onSourceStandardLoaded( BOOL success, LLViewerFetchedTexture* src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata)
 {
 	if (success && LLPipeline::sRenderDeferred)
 	{
+		LLFastTimer t(FTM_BUMP_SOURCE_STANDARD_LOADED);
 		LLPointer<LLImageRaw> nrm_image = new LLImageRaw(src->getWidth(), src->getHeight(), 4);
-		generateNormalMapFromAlpha(src, nrm_image);
+		{
+			LLFastTimer t(FTM_BUMP_GEN_NORMAL);
+			generateNormalMapFromAlpha(src, nrm_image);
+		}
 		src_vi->setExplicitFormat(GL_RGBA, GL_RGBA);
-		src_vi->createGLTexture(src_vi->getDiscardLevel(), nrm_image);
+		{
+			LLFastTimer t(FTM_BUMP_CREATE_TEXTURE);
+			src_vi->createGLTexture(src_vi->getDiscardLevel(), nrm_image);
+		}
 	}
 }
 
@@ -1176,24 +1185,39 @@ void LLBumpImageList::generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nr
 	}
 }
 
+
+static LLFastTimer::DeclareTimer FTM_BUMP_SOURCE_LOADED("Bump Source Loaded");
+static LLFastTimer::DeclareTimer FTM_BUMP_SOURCE_ENTRIES_UPDATE("Entries Update");
+static LLFastTimer::DeclareTimer FTM_BUMP_SOURCE_MIN_MAX("Min/Max");
+static LLFastTimer::DeclareTimer FTM_BUMP_SOURCE_RGB2LUM("RGB to Luminance");
+static LLFastTimer::DeclareTimer FTM_BUMP_SOURCE_RESCALE("Rescale");
+static LLFastTimer::DeclareTimer FTM_BUMP_SOURCE_GEN_NORMAL("Generate Normal");
+static LLFastTimer::DeclareTimer FTM_BUMP_SOURCE_CREATE("Create");
+
 // static
 void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLImageRaw* src, LLUUID& source_asset_id, EBumpEffect bump_code )
 {
 	if( success )
 	{
+		LLFastTimer t(FTM_BUMP_SOURCE_LOADED);
+
+
 		bump_image_map_t& entries_list(bump_code == BE_BRIGHTNESS ? gBumpImageList.mBrightnessEntries : gBumpImageList.mDarknessEntries );
 		bump_image_map_t::iterator iter = entries_list.find(source_asset_id);
 
-		if (iter == entries_list.end() ||
-			iter->second.isNull() ||
-                        iter->second->getWidth() != src->getWidth() ||
-                        iter->second->getHeight() != src->getHeight()) // bump not cached yet or has changed resolution
-		{ //make sure an entry exists for this image
-			LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,1);
-			raw->clear(0x77, 0x77, 0xFF, 0xFF);
-
-			entries_list[src_vi->getID()] = LLViewerTextureManager::getLocalTexture( raw.get(), TRUE);
-			iter = entries_list.find(src_vi->getID());
+		{
+			LLFastTimer t(FTM_BUMP_SOURCE_ENTRIES_UPDATE);
+			if (iter == entries_list.end() ||
+				iter->second.isNull() ||
+							iter->second->getWidth() != src->getWidth() ||
+							iter->second->getHeight() != src->getHeight()) // bump not cached yet or has changed resolution
+			{ //make sure an entry exists for this image
+				LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,1);
+				raw->clear(0x77, 0x77, 0xFF, 0xFF);
+
+				entries_list[src_vi->getID()] = LLViewerTextureManager::getLocalTexture( raw.get(), TRUE);
+				iter = entries_list.find(src_vi->getID());
+			}
 		}
 
 		//if (iter->second->getWidth() != src->getWidth() ||
@@ -1224,50 +1248,56 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
 			{
 			case 1:
 			case 2:
-				if( src_data_size == dst_data_size * src_components )
 				{
-					for( S32 i = 0, j=0; i < dst_data_size; i++, j+= src_components )
+					LLFastTimer t(FTM_BUMP_SOURCE_MIN_MAX);
+					if( src_data_size == dst_data_size * src_components )
 					{
-						dst_data[i] = src_data[j];
-						if( dst_data[i] < minimum )
-						{
-							minimum = dst_data[i];
-						}
-						if( dst_data[i] > maximum )
+						for( S32 i = 0, j=0; i < dst_data_size; i++, j+= src_components )
 						{
-							maximum = dst_data[i];
+							dst_data[i] = src_data[j];
+							if( dst_data[i] < minimum )
+							{
+								minimum = dst_data[i];
+							}
+							if( dst_data[i] > maximum )
+							{
+								maximum = dst_data[i];
+							}
 						}
 					}
-				}
-				else
-				{
-					llassert(0);
-					dst_image->clear();
+					else
+					{
+						llassert(0);
+						dst_image->clear();
+					}
 				}
 				break;
 			case 3:
 			case 4:
-				if( src_data_size == dst_data_size * src_components )
 				{
-					for( S32 i = 0, j=0; i < dst_data_size; i++, j+= src_components )
+					LLFastTimer t(FTM_BUMP_SOURCE_RGB2LUM);
+					if( src_data_size == dst_data_size * src_components )
 					{
-						// RGB to luminance
-						dst_data[i] = (R_WEIGHT * src_data[j] + G_WEIGHT * src_data[j+1] + B_WEIGHT * src_data[j+2]) >> FIXED_PT;
-						//llassert( dst_data[i] <= 255 );true because it's 8bit
-						if( dst_data[i] < minimum )
+						for( S32 i = 0, j=0; i < dst_data_size; i++, j+= src_components )
 						{
-							minimum = dst_data[i];
-						}
-						if( dst_data[i] > maximum )
-						{
-							maximum = dst_data[i];
+							// RGB to luminance
+							dst_data[i] = (R_WEIGHT * src_data[j] + G_WEIGHT * src_data[j+1] + B_WEIGHT * src_data[j+2]) >> FIXED_PT;
+							//llassert( dst_data[i] <= 255 );true because it's 8bit
+							if( dst_data[i] < minimum )
+							{
+								minimum = dst_data[i];
+							}
+							if( dst_data[i] > maximum )
+							{
+								maximum = dst_data[i];
+							}
 						}
 					}
-				}
-				else
-				{
-					llassert(0);
-					dst_image->clear();
+					else
+					{
+						llassert(0);
+						dst_image->clear();
+					}
 				}
 				break;
 			default:
@@ -1278,6 +1308,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
 
 			if( maximum > minimum )
 			{
+				LLFastTimer t(FTM_BUMP_SOURCE_RESCALE);
 				U8 bias_and_scale_lut[256];
 				F32 twice_one_over_range = 2.f / (maximum - minimum);
 				S32 i;
@@ -1311,17 +1342,99 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
 			// accidentally releases it.
 			LLPointer<LLViewerTexture> bump = LLViewerTextureManager::getLocalTexture( TRUE );
 			
+			
 			if (!LLPipeline::sRenderDeferred)
 			{
+				LLFastTimer t(FTM_BUMP_SOURCE_CREATE);
 				bump->setExplicitFormat(GL_ALPHA8, GL_ALPHA);
 				bump->createGLTexture(0, dst_image);
 			}
-			else
-			{
-				LLPointer<LLImageRaw> nrm_image = new LLImageRaw(dst_image->getWidth(), dst_image->getHeight(), 4);
-				generateNormalMapFromAlpha(dst_image, nrm_image);
-				bump->setExplicitFormat(GL_RGBA, GL_RGBA);
-				bump->createGLTexture(0, nrm_image);
+			else 
+			{ //convert to normal map
+				{
+					LLFastTimer t(FTM_BUMP_SOURCE_CREATE);
+					bump->setExplicitFormat(GL_RGBA8, GL_ALPHA);
+					bump->createGLTexture(0, dst_image);
+				}
+
+				{
+					LLFastTimer t(FTM_BUMP_SOURCE_GEN_NORMAL);
+					gPipeline.mScreen.bindTarget();
+					
+					LLGLDepthTest depth(GL_FALSE);
+					LLGLDisable cull(GL_CULL_FACE);
+					LLGLDisable blend(GL_BLEND);
+					gGL.setColorMask(TRUE, TRUE);
+					gNormalMapGenProgram.bind();
+					gNormalMapGenProgram.uniform1f("norm_scale", gSavedSettings.getF32("RenderNormalMapScale"));
+					gNormalMapGenProgram.uniform1f("stepX", 1.f/bump->getWidth());
+					gNormalMapGenProgram.uniform1f("stepY", 1.f/bump->getHeight());
+
+					LLVector2 v((F32) bump->getWidth()/gPipeline.mScreen.getWidth(),
+								(F32) bump->getHeight()/gPipeline.mScreen.getHeight());
+
+					gGL.getTexUnit(0)->bind(bump);
+					
+					S32 width = bump->getWidth();
+					S32 height = bump->getHeight();
+
+					S32 screen_width = gPipeline.mScreen.getWidth();
+					S32 screen_height = gPipeline.mScreen.getHeight();
+
+					glViewport(0, 0, screen_width, screen_height);
+
+					for (S32 left = 0; left < width; left += screen_width)
+					{
+						S32 right = left + screen_width;
+						right = llmin(right, width);
+						
+						F32 left_tc = (F32) left/ width;
+						F32 right_tc = (F32) right/width;
+
+						for (S32 bottom = 0; bottom < height; bottom += screen_height)
+						{
+							S32 top = bottom+screen_height;
+							top = llmin(top, height);
+
+							F32 bottom_tc = (F32) bottom/height;
+							F32 top_tc = (F32)(bottom+screen_height)/height;
+							top_tc = llmin(top_tc, 1.f);
+
+							F32 screen_right = (F32) (right-left)/screen_width;
+							F32 screen_top = (F32) (top-bottom)/screen_height;
+
+							gGL.begin(LLRender::TRIANGLE_STRIP);
+							gGL.texCoord2f(left_tc, bottom_tc);
+							gGL.vertex2f(0, 0);
+
+							gGL.texCoord2f(left_tc, top_tc);
+							gGL.vertex2f(0, screen_top);
+
+							gGL.texCoord2f(right_tc, bottom_tc);
+							gGL.vertex2f(screen_right, 0);
+
+							gGL.texCoord2f(right_tc, top_tc);
+							gGL.vertex2f(screen_right, screen_top);
+
+							gGL.end();
+
+							gGL.flush();
+
+							S32 w = right-left;
+							S32 h = top-bottom;
+
+							glCopyTexSubImage2D(GL_TEXTURE_2D, 0, left, bottom, 0, 0, w, h);
+						}
+					}
+
+					glGenerateMipmap(GL_TEXTURE_2D);
+
+					gPipeline.mScreen.flush();
+
+					gNormalMapGenProgram.unbind();
+										
+					//generateNormalMapFromAlpha(dst_image, nrm_image);
+				}
 			}
 		
 			iter->second = bump; // derefs (and deletes) old image
@@ -1369,18 +1482,24 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL
 			if (mShiny)
 			{
 				gGL.getTexUnit(0)->activate();
-				glMatrixMode(GL_TEXTURE);
+				gGL.matrixMode(LLRender::MM_TEXTURE);
 			}
 			else
 			{
-				gGL.getTexUnit(1)->activate();
-				glMatrixMode(GL_TEXTURE);
-				glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
-				gPipeline.mTextureMatrixOps++;
+				if (!LLGLSLShader::sNoFixedFunction)
+				{
+					gGL.getTexUnit(1)->activate();
+					gGL.matrixMode(LLRender::MM_TEXTURE);
+					gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix);
+				}
+
 				gGL.getTexUnit(0)->activate();
+				gGL.matrixMode(LLRender::MM_TEXTURE);
+				gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix);
+				gPipeline.mTextureMatrixOps++;
 			}
 
-			glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
+			gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix);
 			gPipeline.mTextureMatrixOps++;
 
 			tex_setup = true;
@@ -1390,7 +1509,7 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL
 		{
 			if (params.mTexture.notNull())
 			{
-				gGL.getTexUnit(diffuse_channel)->bind(params.mTexture) ;
+				gGL.getTexUnit(diffuse_channel)->bind(params.mTexture);
 				params.mTexture->addTextureStats(params.mVSize);		
 			}
 			else
@@ -1415,12 +1534,17 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL
 		}
 		else
 		{
-			gGL.getTexUnit(1)->activate();
-			glLoadIdentity();
+			if (!LLGLSLShader::sNoFixedFunction)
+			{
+				gGL.getTexUnit(1)->activate();
+				gGL.matrixMode(LLRender::MM_TEXTURE);
+				gGL.loadIdentity();
+			}
 			gGL.getTexUnit(0)->activate();
+			gGL.matrixMode(LLRender::MM_TEXTURE);
 		}
-		glLoadIdentity();
-		glMatrixMode(GL_MODELVIEW);
+		gGL.loadIdentity();
+		gGL.matrixMode(LLRender::MM_MODELVIEW);
 	}
 }
 
@@ -1465,6 +1589,7 @@ void LLDrawPoolInvisible::endDeferredPass( S32 pass )
 
 void LLDrawPoolInvisible::renderDeferred( S32 pass )
 { //render invisiprims; this doesn't work becaue it also blocks all the post-deferred stuff
+#if 0 
 	LLFastTimer t(FTM_RENDER_INVISIBLE);
   
 	U32 invisi_mask = LLVertexBuffer::MAP_VERTEX;
@@ -1482,4 +1607,5 @@ void LLDrawPoolInvisible::renderDeferred( S32 pass )
 		renderShiny(true);
 		endShiny(true);
 	}
+#endif
 }
diff --git a/indra/newview/lldrawpoolground.cpp b/indra/newview/lldrawpoolground.cpp
index ce07e62122de7d44ed340cd50344c9c485b84c09..59c3fbf7a125bf6ab727770e59ffc606d4bfeedc 100644
--- a/indra/newview/lldrawpoolground.cpp
+++ b/indra/newview/lldrawpoolground.cpp
@@ -71,9 +71,9 @@ void LLDrawPoolGround::render(S32 pass)
 	LLGLSquashToFarClip far_clip(glh_get_current_projection());
 
 	F32 water_height = gAgent.getRegion()->getWaterHeight();
-	glPushMatrix();
+	gGL.pushMatrix();
 	LLVector3 origin = LLViewerCamera::getInstance()->getOrigin();
-	glTranslatef(origin.mV[0], origin.mV[1], llmax(origin.mV[2], water_height));
+	gGL.translatef(origin.mV[0], origin.mV[1], llmax(origin.mV[2], water_height));
 
 	LLFace *facep = mDrawFace[0];
 
@@ -82,6 +82,6 @@ void LLDrawPoolGround::render(S32 pass)
 	LLOverrideFaceColor col(this, gSky.mVOSkyp->getGLFogColor());
 	facep->renderIndexed();
 	
-	glPopMatrix();
+	gGL.popMatrix();
 }
 
diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp
index eec4ee6bac99c75456d0c951b7914003f62096e7..6e0ea78af2b2d326dbb639a943852d51cf688ec9 100644
--- a/indra/newview/lldrawpoolsimple.cpp
+++ b/indra/newview/lldrawpoolsimple.cpp
@@ -46,7 +46,7 @@ static LLFastTimer::DeclareTimer FTM_RENDER_GRASS_DEFERRED("Deferred Grass");
 
 void LLDrawPoolGlow::beginPostDeferredPass(S32 pass)
 {
-	gDeferredFullbrightProgram.bind();
+	gDeferredEmissiveProgram.bind();
 }
 
 static LLFastTimer::DeclareTimer FTM_RENDER_GLOW_PUSH("Glow Push");
@@ -76,10 +76,22 @@ void LLDrawPoolGlow::renderPostDeferred(S32 pass)
 
 void LLDrawPoolGlow::endPostDeferredPass(S32 pass)
 {
-	gDeferredFullbrightProgram.unbind();
+	gDeferredEmissiveProgram.unbind();
 	LLRenderPass::endRenderPass(pass);
 }
 
+S32 LLDrawPoolGlow::getNumPasses()
+{
+	if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 0)
+	{
+		return 1;
+	}
+	else
+	{
+		return 0;
+	}
+}
+
 void LLDrawPoolGlow::render(S32 pass)
 {
 	LLFastTimer t(FTM_RENDER_GLOW);
@@ -93,39 +105,29 @@ void LLDrawPoolGlow::render(S32 pass)
 	
 	U32 shader_level = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT);
 
-	if (shader_level > 0 && fullbright_shader)
-	{
-		fullbright_shader->bind();
-	}
-	else
-	{
-		gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
-	}
+	//should never get here without basic shaders enabled
+	llassert(shader_level > 0);
+	
+	LLGLSLShader* shader = LLPipeline::sUnderWaterRender ? &gObjectEmissiveWaterProgram : &gObjectEmissiveProgram;
+	shader->bind();
 
 	LLGLDepthTest depth(GL_TRUE, GL_FALSE);
 	gGL.setColorMask(false, true);
 
-	if (shader_level > 1)
-	{
-		pushBatches(LLRenderPass::PASS_GLOW, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
-	}
-	else
-	{
-		renderTexture(LLRenderPass::PASS_GLOW, getVertexDataMask());
-	}
+	pushBatches(LLRenderPass::PASS_GLOW, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
 	
 	gGL.setColorMask(true, false);
 	gGL.setSceneBlendType(LLRender::BT_ALPHA);
 	
 	if (shader_level > 0 && fullbright_shader)
 	{
-		fullbright_shader->unbind();
+		shader->unbind();
 	}
 }
 
 void LLDrawPoolGlow::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures)
 {
-	glColor4ubv(params.mGlowColor.mV);
+	//gGL.diffuseColor4ubv(params.mGlowColor.mV);
 	LLRenderPass::pushBatch(params, mask, texture, batch_textures);
 }
 
@@ -253,6 +255,7 @@ void LLDrawPoolGrass::prerender()
 void LLDrawPoolGrass::beginRenderPass(S32 pass)
 {
 	LLFastTimer t(FTM_RENDER_GRASS);
+	stop_glerror();
 
 	if (LLPipeline::sUnderWaterRender)
 	{
@@ -266,7 +269,7 @@ void LLDrawPoolGrass::beginRenderPass(S32 pass)
 	if (mVertexShaderLevel > 0)
 	{
 		simple_shader->bind();
-		simple_shader->setAlphaRange(0.5f, 1.f);
+		simple_shader->setMinimumAlpha(0.5f);
 	}
 	else 
 	{
@@ -322,7 +325,7 @@ void LLDrawPoolGrass::renderDeferred(S32 pass)
 	{
 		LLFastTimer t(FTM_RENDER_GRASS_DEFERRED);
 		gDeferredNonIndexedDiffuseAlphaMaskProgram.bind();
-		gDeferredNonIndexedDiffuseAlphaMaskProgram.setAlphaRange(0.5f, 1.f);
+		gDeferredNonIndexedDiffuseAlphaMaskProgram.setMinimumAlpha(0.5f);
 		//render grass
 		LLRenderPass::renderTexture(LLRenderPass::PASS_GRASS, getVertexDataMask());
 	}			
diff --git a/indra/newview/lldrawpoolsimple.h b/indra/newview/lldrawpoolsimple.h
index 3811b3d398f872193cb6861e63c053f6f926e263..bd62bc75025fc7179ea257df5760c32b8ed1cf05 100644
--- a/indra/newview/lldrawpoolsimple.h
+++ b/indra/newview/lldrawpoolsimple.h
@@ -118,7 +118,8 @@ class LLDrawPoolGlow : public LLRenderPass
 	enum
 	{
 		VERTEX_DATA_MASK =	LLVertexBuffer::MAP_VERTEX |
-							LLVertexBuffer::MAP_TEXCOORD0
+							LLVertexBuffer::MAP_TEXCOORD0 |
+							LLVertexBuffer::MAP_EMISSIVE
 	};
 
 	virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; }
@@ -130,6 +131,8 @@ class LLDrawPoolGlow : public LLRenderPass
 	/*virtual*/ void endPostDeferredPass(S32 pass);
 	/*virtual*/ void renderPostDeferred(S32 pass);
 
+	/*virtual*/ S32 getNumPasses();
+
 	void render(S32 pass = 0);
 	void pushBatch(LLDrawInfo& params, U32 mask, BOOL texture = TRUE, BOOL batch_textures = FALSE);
 
diff --git a/indra/newview/lldrawpoolsky.cpp b/indra/newview/lldrawpoolsky.cpp
index efffb2df9e705ab96682a8c6c7c8ea3f8abe4288..7f7d9f65c60c048a26d02438e278dd21893f190f 100644
--- a/indra/newview/lldrawpoolsky.cpp
+++ b/indra/newview/lldrawpoolsky.cpp
@@ -76,15 +76,16 @@ void LLDrawPoolSky::render(S32 pass)
 		return;
 	}
 	
-	// use a shader only underwater
+	// don't render sky under water (background just gets cleared to fog color)
 	if(mVertexShaderLevel > 0 && LLPipeline::sUnderWaterRender)
 	{
-		mShader = &gObjectFullbrightWaterProgram;
-		mShader->bind();
+		return;
 	}
-	else if (LLGLSLShader::sNoFixedFunction)
+
+
+	if (LLGLSLShader::sNoFixedFunction)
 	{ //just use the UI shader (generic single texture no lighting)
-		gUIProgram.bind();
+		gOneTextureNoColorProgram.bind();
 	}
 	else
 	{
@@ -111,21 +112,21 @@ void LLDrawPoolSky::render(S32 pass)
 	
 	LLGLDisable clip(GL_CLIP_PLANE0);
 
-	glPushMatrix();
+	gGL.pushMatrix();
 	LLVector3 origin = LLViewerCamera::getInstance()->getOrigin();
-	glTranslatef(origin.mV[0], origin.mV[1], origin.mV[2]);
+	gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]);
 
 	S32 face_count = (S32)mDrawFace.size();
 
 	LLVertexBuffer::unbind();
-	glColor4f(1,1,1,1);
+	gGL.diffuseColor4f(1,1,1,1);
 
 	for (S32 i = 0; i < llmin(6, face_count); ++i)
 	{
 		renderSkyCubeFace(i);
 	}
 
-	glPopMatrix();
+	gGL.popMatrix();
 }
 
 void LLDrawPoolSky::renderSkyCubeFace(U8 side)
@@ -146,7 +147,7 @@ void LLDrawPoolSky::renderSkyCubeFace(U8 side)
 		
 		LLGLEnable blend(GL_BLEND);
 		mSkyTex[side].bindTexture(FALSE);
-		glColor4f(1, 1, 1, LLSkyTex::getInterpVal()); // lighting is disabled
+		gGL.diffuseColor4f(1, 1, 1, LLSkyTex::getInterpVal()); // lighting is disabled
 		face.renderIndexed();
 	}
 }
diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp
index 3daa0f8261f808ad247960da29ce766f83a3f5d2..b95d8296fa0b3057fb3edc37e99074deb8ead479 100644
--- a/indra/newview/lldrawpoolterrain.cpp
+++ b/indra/newview/lldrawpoolterrain.cpp
@@ -62,13 +62,16 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) :
 	LLFacePool(POOL_TERRAIN),
 	mTexturep(texturep)
 {
+	U32 format = GL_ALPHA8;
+	U32 int_format = GL_ALPHA;
+
 	// Hack!
 	sDetailScale = 1.f/gSavedSettings.getF32("RenderTerrainScale");
 	sDetailMode = gSavedSettings.getS32("RenderTerrainDetail");
 	mAlphaRampImagep = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient.tga", 
 													TRUE, LLViewerTexture::BOOST_UI, 
 													LLViewerTexture::FETCHED_TEXTURE,
-													GL_ALPHA8, GL_ALPHA,
+													format, int_format,
 													LLUUID("e97cf410-8e61-7005-ec06-629eba4cd1fb"));
 
 	//gGL.getTexUnit(0)->bind(mAlphaRampImagep.get());
@@ -77,7 +80,7 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) :
 	m2DAlphaRampImagep = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient_2d.j2c", 
 													TRUE, LLViewerTexture::BOOST_UI, 
 													LLViewerTexture::FETCHED_TEXTURE,
-													GL_ALPHA8, GL_ALPHA,
+													format, int_format,
 													LLUUID("38b86f85-2575-52a9-a531-23108d8da837"));
 
 	//gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get());
@@ -106,6 +109,10 @@ U32 LLDrawPoolTerrain::getVertexDataMask()
 	{
 		return LLVertexBuffer::MAP_VERTEX;
 	}
+	else if (LLGLSLShader::sCurBoundShaderPtr)
+	{
+		return VERTEX_DATA_MASK & ~(LLVertexBuffer::MAP_TEXCOORD2 | LLVertexBuffer::MAP_TEXCOORD3);
+	}
 	else
 	{
 		return VERTEX_DATA_MASK; 
@@ -115,14 +122,7 @@ U32 LLDrawPoolTerrain::getVertexDataMask()
 void LLDrawPoolTerrain::prerender()
 {
 	mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT);
-	if (mVertexShaderLevel > 0)
-	{
-		sDetailMode = 1;
-	}
-	else
-	{
-		sDetailMode = gSavedSettings.getS32("RenderTerrainDetail");
-	}
+	sDetailMode = gSavedSettings.getS32("RenderTerrainDetail");
 }
 
 void LLDrawPoolTerrain::beginRenderPass( S32 pass )
@@ -132,7 +132,7 @@ void LLDrawPoolTerrain::beginRenderPass( S32 pass )
 
 	sShader = LLPipeline::sUnderWaterRender ? 
 					&gTerrainWaterProgram :
-					&gTerrainProgram;
+					&gTerrainProgram;	
 
 	if (mVertexShaderLevel > 1 && sShader->mShaderLevel > 0)
 	{
@@ -174,6 +174,8 @@ void LLDrawPoolTerrain::render(S32 pass)
 		compp->mDetailTextures[i]->addTextureStats(1024.f*1024.f); // assume large pixel area
 	}
 
+	LLOverrideFaceColor override(this, 1.f, 1.f, 1.f, 1.f);
+
 	if (!gGLManager.mHasMultitexture)
 	{
 		// No multitexture, render simple land.
@@ -188,22 +190,27 @@ void LLDrawPoolTerrain::render(S32 pass)
 	}
 
 	LLGLSPipeline gls;
-	LLOverrideFaceColor override(this, 1.f, 1.f, 1.f, 1.f);
-
+	
 	if (mVertexShaderLevel > 1 && sShader->mShaderLevel > 0)
 	{
 		gPipeline.enableLightsDynamic();
+
 		renderFullShader();
 	}
 	else
 	{
 		gPipeline.enableLightsStatic();
 
-		if (sDetailMode == 0){
+		if (sDetailMode == 0)
+		{
 			renderSimple();
-		} else if (gGLManager.mNumTextureUnits < 4){
+		} 
+		else if (gGLManager.mNumTextureUnits < 4)
+		{
 			renderFull2TU();
-		} else {
+		} 
+		else 
+		{
 			renderFull4TU();
 		}
 	}
@@ -215,8 +222,9 @@ void LLDrawPoolTerrain::render(S32 pass)
 		{ //use fullbright shader for highlighting
 			LLGLSLShader* old_shader = sShader;
 			sShader->unbind();
-			sShader = &gObjectFullbrightNonIndexedProgram;
+			sShader = &gHighlightProgram;
 			sShader->bind();
+			gGL.diffuseColor4f(1,1,1,1);
 			LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
 			glPolygonOffset(-1.0f, -1.0f);
 			renderOwnership();
@@ -312,16 +320,15 @@ void LLDrawPoolTerrain::renderFullShader()
 	gGL.getTexUnit(detail0)->bind(detail_texture0p);
 	gGL.getTexUnit(0)->activate();
 
-	glEnable(GL_TEXTURE_GEN_S);
-	glEnable(GL_TEXTURE_GEN_T);
-	glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
-	glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+	LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+	llassert(shader);
+		
+	shader->uniform4fv("object_plane_s", 1, tp0.mV);
+	shader->uniform4fv("object_plane_t", 1, tp1.mV);
 
-	glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
-	glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.loadIdentity();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 
 	//
 	// detail texture 1
@@ -331,9 +338,9 @@ void LLDrawPoolTerrain::renderFullShader()
 	
 	/// ALPHA TEXTURE COORDS 0:
 	gGL.getTexUnit(1)->activate();
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.loadIdentity();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	
 	// detail texture 2
 	//
@@ -343,10 +350,10 @@ void LLDrawPoolTerrain::renderFullShader()
 	gGL.getTexUnit(2)->activate();
 	
 	/// ALPHA TEXTURE COORDS 1:
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glTranslatef(-2.f, 0.f, 0.f);
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.loadIdentity();
+	gGL.translatef(-2.f, 0.f, 0.f);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 
 	//
 	// detail texture 3
@@ -356,10 +363,10 @@ void LLDrawPoolTerrain::renderFullShader()
 	
 	/// ALPHA TEXTURE COORDS 2:
 	gGL.getTexUnit(3)->activate();
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glTranslatef(-1.f, 0.f, 0.f);
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.loadIdentity();
+	gGL.translatef(-1.f, 0.f, 0.f);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 
 	//
 	// Alpha Ramp 
@@ -380,38 +387,30 @@ void LLDrawPoolTerrain::renderFullShader()
 	gGL.getTexUnit(alpha_ramp)->unbind(LLTexUnit::TT_TEXTURE);
 	gGL.getTexUnit(4)->disable();
 	gGL.getTexUnit(4)->activate();
-	glDisable(GL_TEXTURE_GEN_S);
-	glDisable(GL_TEXTURE_GEN_T);
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glMatrixMode(GL_MODELVIEW);
-
+	
 	gGL.getTexUnit(detail3)->unbind(LLTexUnit::TT_TEXTURE);
 	gGL.getTexUnit(3)->disable();
 	gGL.getTexUnit(3)->activate();
-	glDisable(GL_TEXTURE_GEN_S);
-	glDisable(GL_TEXTURE_GEN_T);
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glMatrixMode(GL_MODELVIEW);
+	
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.loadIdentity();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 
 	gGL.getTexUnit(detail2)->unbind(LLTexUnit::TT_TEXTURE);
 	gGL.getTexUnit(2)->disable();
 	gGL.getTexUnit(2)->activate();
-	glDisable(GL_TEXTURE_GEN_S);
-	glDisable(GL_TEXTURE_GEN_T);
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glMatrixMode(GL_MODELVIEW);
+	
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.loadIdentity();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 
 	gGL.getTexUnit(detail1)->unbind(LLTexUnit::TT_TEXTURE);
 	gGL.getTexUnit(1)->disable();
 	gGL.getTexUnit(1)->activate();
-	glDisable(GL_TEXTURE_GEN_S);
-	glDisable(GL_TEXTURE_GEN_T);
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glMatrixMode(GL_MODELVIEW);
+	
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.loadIdentity();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	
 	//----------------------------------------------------------------------------
 	// Restore Texture Unit 0 defaults
@@ -419,11 +418,9 @@ void LLDrawPoolTerrain::renderFullShader()
 	gGL.getTexUnit(detail0)->unbind(LLTexUnit::TT_TEXTURE);
 	gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
 	gGL.getTexUnit(0)->activate();
-	glDisable(GL_TEXTURE_GEN_S);
-	glDisable(GL_TEXTURE_GEN_T);
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.loadIdentity();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 }
 
 void LLDrawPoolTerrain::renderFull4TU()
@@ -534,9 +531,9 @@ void LLDrawPoolTerrain::renderFull4TU()
 	gGL.getTexUnit(1)->activate();
 
 	// Set the texture matrix
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glTranslatef(-2.f, 0.f, 0.f);
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.loadIdentity();
+	gGL.translatef(-2.f, 0.f, 0.f);
 
 	// Care about alpha only
 	gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
@@ -566,9 +563,9 @@ void LLDrawPoolTerrain::renderFull4TU()
 	gGL.getTexUnit(3)->activate();
 
 	// Set the texture matrix
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glTranslatef(-1.f, 0.f, 0.f);
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.loadIdentity();
+	gGL.translatef(-1.f, 0.f, 0.f);
   
 	// Set alpha texture and do lighting modulation
 	gGL.getTexUnit(3)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_VERT_COLOR);
@@ -586,9 +583,9 @@ void LLDrawPoolTerrain::renderFull4TU()
 	gGL.getTexUnit(3)->disable();
 	gGL.getTexUnit(3)->activate();
 	
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.loadIdentity();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 
 	gGL.getTexUnit(2)->unbind(LLTexUnit::TT_TEXTURE);
 	gGL.getTexUnit(2)->disable();
@@ -596,17 +593,17 @@ void LLDrawPoolTerrain::renderFull4TU()
 	
 	glDisable(GL_TEXTURE_GEN_S);
 	glDisable(GL_TEXTURE_GEN_T);
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.loadIdentity();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 
 	gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);	
 	gGL.getTexUnit(1)->disable();
 	gGL.getTexUnit(1)->activate();
  	
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.loadIdentity();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 
 	// Restore blend state
 	gGL.setSceneBlendType(LLRender::BT_ALPHA);
@@ -620,9 +617,9 @@ void LLDrawPoolTerrain::renderFull4TU()
 	
 	glDisable(GL_TEXTURE_GEN_S);
 	glDisable(GL_TEXTURE_GEN_T);
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.loadIdentity();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 
 	gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
 }
@@ -714,9 +711,9 @@ void LLDrawPoolTerrain::renderFull2TU()
 	gGL.getTexUnit(0)->bind(m2DAlphaRampImagep);
 
 	// Set the texture matrix
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glTranslatef(-1.f, 0.f, 0.f);
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.loadIdentity();
+	gGL.translatef(-1.f, 0.f, 0.f);
 
 	// Care about alpha only
 	gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
@@ -753,9 +750,9 @@ void LLDrawPoolTerrain::renderFull2TU()
 	gGL.getTexUnit(0)->activate();
 	gGL.getTexUnit(0)->bind(m2DAlphaRampImagep);
 	// Set the texture matrix
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glTranslatef(-2.f, 0.f, 0.f);
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.loadIdentity();
+	gGL.translatef(-2.f, 0.f, 0.f);
 
 	// Care about alpha only
 	gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
@@ -793,9 +790,9 @@ void LLDrawPoolTerrain::renderFull2TU()
 
 	glDisable(GL_TEXTURE_GEN_S);
 	glDisable(GL_TEXTURE_GEN_T);
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.loadIdentity();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 
 	//----------------------------------------------------------------------------
 	// Restore Texture Unit 0 defaults
@@ -805,9 +802,9 @@ void LLDrawPoolTerrain::renderFull2TU()
 
 	glDisable(GL_TEXTURE_GEN_S);
 	glDisable(GL_TEXTURE_GEN_T);
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.loadIdentity();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
 }
 
@@ -831,13 +828,21 @@ void LLDrawPoolTerrain::renderSimple()
 	tp0.setVec(tscale, 0.f, 0.0f, -1.f*(origin_agent.mV[0]/256.f));
 	tp1.setVec(0.f, tscale, 0.0f, -1.f*(origin_agent.mV[1]/256.f));
 	
-	glEnable(GL_TEXTURE_GEN_S);
-	glEnable(GL_TEXTURE_GEN_T);
-	glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
-	glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
-	glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
-	glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
-	
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		sShader->uniform4fv("object_plane_s", 1, tp0.mV);
+		sShader->uniform4fv("object_plane_t", 1, tp1.mV);
+	}
+	else
+	{
+		glEnable(GL_TEXTURE_GEN_S);
+		glEnable(GL_TEXTURE_GEN_T);
+		glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+		glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+		glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
+		glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
+	}
+
 	gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR);
 
 	drawLoop();
@@ -847,11 +852,14 @@ void LLDrawPoolTerrain::renderSimple()
 	
 	gGL.getTexUnit(0)->activate();
 	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-	glDisable(GL_TEXTURE_GEN_S);
-	glDisable(GL_TEXTURE_GEN_T);
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glMatrixMode(GL_MODELVIEW);
+	if (!LLGLSLShader::sNoFixedFunction)
+	{
+		glDisable(GL_TEXTURE_GEN_S);
+		glDisable(GL_TEXTURE_GEN_T);
+	}
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.loadIdentity();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
 }
 
@@ -882,11 +890,11 @@ void LLDrawPoolTerrain::renderOwnership()
 	// texture coordinates for pixel 256x256 is not 1,1. This makes the
 	// ownership map not line up with the selection. We address this with
 	// a texture matrix multiply.
-	glMatrixMode(GL_TEXTURE);
-	glPushMatrix();
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.pushMatrix();
 
 	const F32 TEXTURE_FUDGE = 257.f / 256.f;
-	glScalef( TEXTURE_FUDGE, TEXTURE_FUDGE, 1.f );
+	gGL.scalef( TEXTURE_FUDGE, TEXTURE_FUDGE, 1.f );
 	for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
 		 iter != mDrawFace.end(); iter++)
 	{
@@ -895,9 +903,9 @@ void LLDrawPoolTerrain::renderOwnership()
 							LLVertexBuffer::MAP_TEXCOORD0);
 	}
 
-	glMatrixMode(GL_TEXTURE);
-	glPopMatrix();
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.popMatrix();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 }
 
 
diff --git a/indra/newview/lldrawpoolterrain.h b/indra/newview/lldrawpoolterrain.h
index 3056da44d574bdbe08a5a920733a53286d1aadfd..283ed87f1ad6b2785d1f424cae442c0546f19d8d 100644
--- a/indra/newview/lldrawpoolterrain.h
+++ b/indra/newview/lldrawpoolterrain.h
@@ -40,8 +40,7 @@ class LLDrawPoolTerrain : public LLFacePool
 							LLVertexBuffer::MAP_TEXCOORD0 |
 							LLVertexBuffer::MAP_TEXCOORD1 |
 							LLVertexBuffer::MAP_TEXCOORD2 |
-							LLVertexBuffer::MAP_TEXCOORD3 |
-							LLVertexBuffer::MAP_COLOR
+							LLVertexBuffer::MAP_TEXCOORD3
 	};
 
 	virtual U32 getVertexDataMask();
diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp
index a6e01511147ad195682099d091ddd481cdd6cd46..3165a3516c004669d7cc3b946266b33a604faeee 100644
--- a/indra/newview/lldrawpooltree.cpp
+++ b/indra/newview/lldrawpooltree.cpp
@@ -65,17 +65,18 @@ void LLDrawPoolTree::beginRenderPass(S32 pass)
 		
 	if (LLPipeline::sUnderWaterRender)
 	{
-		shader = &gObjectAlphaMaskNonIndexedWaterProgram;
+		shader = &gTreeWaterProgram;
 	}
 	else
 	{
-		shader = &gObjectAlphaMaskNonIndexedProgram;
+		shader = &gTreeProgram;
 	}
 
 	if (gPipeline.canUseVertexShaders())
 	{
 		shader->bind();
-		shader->setAlphaRange(0.5f, 1.f);
+		shader->setMinimumAlpha(0.5f);
+		gGL.diffuseColor4f(1,1,1,1);
 	}
 	else
 	{
@@ -96,25 +97,18 @@ void LLDrawPoolTree::render(S32 pass)
 	LLGLState test(GL_ALPHA_TEST, LLGLSLShader::sNoFixedFunction ? 0 : 1);
 	LLOverrideFaceColor color(this, 1.f, 1.f, 1.f, 1.f);
 
-	if (gSavedSettings.getBOOL("RenderAnimateTrees"))
-	{
-		renderTree();
-	}
-	else
+	gGL.getTexUnit(sDiffTex)->bind(mTexturep);
+				
+	for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
+		 iter != mDrawFace.end(); iter++)
 	{
-		gGL.getTexUnit(sDiffTex)->bind(mTexturep);
-					
-		for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
-			 iter != mDrawFace.end(); iter++)
+		LLFace *face = *iter;
+		LLVertexBuffer* buff = face->getVertexBuffer();
+		if(buff)
 		{
-			LLFace *face = *iter;
-			LLVertexBuffer* buff = face->getVertexBuffer();
-			if(buff)
-			{
-				buff->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK);
-				buff->drawRange(LLRender::TRIANGLES, 0, buff->getRequestedVerts()-1, buff->getRequestedIndices(), 0); 
-				gPipeline.addTrianglesDrawn(buff->getRequestedIndices());
-			}
+			buff->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK);
+			buff->drawRange(LLRender::TRIANGLES, 0, buff->getNumVerts()-1, buff->getNumIndices(), 0); 
+			gPipeline.addTrianglesDrawn(buff->getNumIndices());
 		}
 	}
 }
@@ -141,9 +135,9 @@ void LLDrawPoolTree::beginDeferredPass(S32 pass)
 {
 	LLFastTimer t(FTM_RENDER_TREES);
 		
-	shader = &gDeferredNonIndexedDiffuseAlphaMaskProgram;
+	shader = &gDeferredTreeProgram;
 	shader->bind();
-	shader->setAlphaRange(0.5f, 1.f);
+	shader->setMinimumAlpha(0.5f);
 }
 
 void LLDrawPoolTree::renderDeferred(S32 pass)
@@ -168,8 +162,8 @@ void LLDrawPoolTree::beginShadowPass(S32 pass)
 	glPolygonOffset(gSavedSettings.getF32("RenderDeferredTreeShadowOffset"),
 					gSavedSettings.getF32("RenderDeferredTreeShadowBias"));
 
-	gDeferredShadowAlphaMaskProgram.bind();
-	gDeferredShadowAlphaMaskProgram.setAlphaRange(0.5f, 1.f);
+	gDeferredTreeShadowProgram.bind();
+	gDeferredTreeShadowProgram.setMinimumAlpha(0.5f);
 }
 
 void LLDrawPoolTree::renderShadow(S32 pass)
@@ -183,133 +177,7 @@ void LLDrawPoolTree::endShadowPass(S32 pass)
 	
 	glPolygonOffset(gSavedSettings.getF32("RenderDeferredSpotShadowOffset"),
 						gSavedSettings.getF32("RenderDeferredSpotShadowBias"));
-}
-
-
-void LLDrawPoolTree::renderTree(BOOL selecting)
-{
-	LLGLState normalize(GL_NORMALIZE, TRUE);
-	
-	// Bind the texture for this tree.
-	gGL.getTexUnit(sDiffTex)->bind(mTexturep.get(), TRUE);
-		
-	U32 indices_drawn = 0;
-
-	glMatrixMode(GL_MODELVIEW);
-	
-	for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
-		 iter != mDrawFace.end(); iter++)
-	{
-		LLFace *face = *iter;
-		LLDrawable *drawablep = face->getDrawable();
-
-		if (drawablep->isDead() || !face->getVertexBuffer())
-		{
-			continue;
-		}
-
-		face->getVertexBuffer()->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK);
-		U16* indicesp = (U16*) face->getVertexBuffer()->getIndicesPointer();
-
-		// Render each of the trees
-		LLVOTree *treep = (LLVOTree *)drawablep->getVObj().get();
-
-		LLColor4U color(255,255,255,255);
-
-		if (!selecting || treep->mGLName != 0)
-		{
-			if (selecting)
-			{
-				S32 name = treep->mGLName;
-				
-				color = LLColor4U((U8)(name >> 16), (U8)(name >> 8), (U8)name, 255);
-			}
-			
-			gGLLastMatrix = NULL;
-			glLoadMatrixd(gGLModelView);
-			//glPushMatrix();
-			F32 mat[16];
-			for (U32 i = 0; i < 16; i++)
-				mat[i] = (F32) gGLModelView[i];
-
-			LLMatrix4 matrix(mat);
-			
-			// Translate to tree base  HACK - adjustment in Z plants tree underground
-			const LLVector3 &pos_agent = treep->getPositionAgent();
-			//glTranslatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f);
-			LLMatrix4 trans_mat;
-			trans_mat.setTranslation(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f);
-			trans_mat *= matrix;
-			
-			// Rotate to tree position and bend for current trunk/wind
-			// Note that trunk stiffness controls the amount of bend at the trunk as 
-			// opposed to the crown of the tree
-			// 
-			const F32 TRUNK_STIFF = 22.f;
-			
-			LLQuaternion rot = 
-				LLQuaternion(treep->mTrunkBend.magVec()*TRUNK_STIFF*DEG_TO_RAD, LLVector4(treep->mTrunkBend.mV[VX], treep->mTrunkBend.mV[VY], 0)) *
-				LLQuaternion(90.f*DEG_TO_RAD, LLVector4(0,0,1)) *
-				treep->getRotation();
-
-			LLMatrix4 rot_mat(rot);
-			rot_mat *= trans_mat;
-
-			F32 radius = treep->getScale().magVec()*0.05f;
-			LLMatrix4 scale_mat;
-			scale_mat.mMatrix[0][0] = 
-				scale_mat.mMatrix[1][1] =
-				scale_mat.mMatrix[2][2] = radius;
-
-			scale_mat *= rot_mat;
-
-			const F32 THRESH_ANGLE_FOR_BILLBOARD = 15.f;
-			const F32 BLEND_RANGE_FOR_BILLBOARD = 3.f;
-
-			F32 droop = treep->mDroop + 25.f*(1.f - treep->mTrunkBend.magVec());
-			
-			S32 stop_depth = 0;
-			F32 app_angle = treep->getAppAngle()*LLVOTree::sTreeFactor;
-			F32 alpha = 1.0;
-			S32 trunk_LOD = LLVOTree::sMAX_NUM_TREE_LOD_LEVELS;
-
-			for (S32 j = 0; j < 4; j++)
-			{
-
-				if (app_angle > LLVOTree::sLODAngles[j])
-				{
-					trunk_LOD = j;
-					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))
-			{
-				//
-				//  Draw only the billboard 
-				//
-				//  Only the billboard, can use closer to normal alpha func.
-				stop_depth = -1;
-				LLFacePool::LLOverrideFaceColor clr(this, color); 
-				indices_drawn += treep->drawBranchPipeline(scale_mat, indicesp, trunk_LOD, stop_depth, treep->mDepth, treep->mTrunkDepth, 1.0, treep->mTwist, droop, treep->mBranches, alpha);
-			}
-			else // if (app_angle > (THRESH_ANGLE_FOR_BILLBOARD + BLEND_RANGE_FOR_BILLBOARD))
-			{
-				//
-				//  Draw only the full geometry tree
-				//
-				//stop_depth = (app_angle < THRESH_ANGLE_FOR_RECURSION_REDUCTION);
-				LLFacePool::LLOverrideFaceColor clr(this, color); 
-				indices_drawn += treep->drawBranchPipeline(scale_mat, indicesp, trunk_LOD, stop_depth, treep->mDepth, treep->mTrunkDepth, 1.0, treep->mTwist, droop, treep->mBranches, alpha);
-			}
-			
-			//glPopMatrix();
-		}
-	}
+	gDeferredTreeShadowProgram.unbind();
 }
 
 BOOL LLDrawPoolTree::verify() const
diff --git a/indra/newview/lldrawpooltree.h b/indra/newview/lldrawpooltree.h
index ddb259bb821a2297e2e9fc4fbcdc4b27d4dc4ef5..e7e25453cffffaa7d7adcd0c3d408b40eff6c9d7 100644
--- a/indra/newview/lldrawpooltree.h
+++ b/indra/newview/lldrawpooltree.h
@@ -68,9 +68,6 @@ class LLDrawPoolTree : public LLFacePool
 	/*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display
 
 	static S32 sDiffTex;
-
-private:
-	void renderTree(BOOL selecting = FALSE);
 };
 
 #endif // LL_LLDRAWPOOLTREE_H
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp
index 31c14361b5f1ecc93e8deb6b1eff517d2ba1bd56..4f6eaa5a5b778b099e53e65cf599ff26d088be7a 100644
--- a/indra/newview/lldrawpoolwater.cpp
+++ b/indra/newview/lldrawpoolwater.cpp
@@ -59,6 +59,8 @@ BOOL LLDrawPoolWater::sSkipScreenCopy = FALSE;
 BOOL LLDrawPoolWater::sNeedsReflectionUpdate = TRUE;
 BOOL LLDrawPoolWater::sNeedsDistortionUpdate = TRUE;
 LLColor4 LLDrawPoolWater::sWaterFogColor = LLColor4(0.2f, 0.5f, 0.5f, 0.f);
+F32 LLDrawPoolWater::sWaterFogEnd = 0.f;
+
 LLVector3 LLDrawPoolWater::sLightDir;
 
 LLDrawPoolWater::LLDrawPoolWater() :
@@ -219,7 +221,7 @@ void LLDrawPoolWater::render(S32 pass)
 		water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot));
 	}
 
-	glColor4fv(water_color.mV);
+	gGL.diffuseColor4fv(water_color.mV);
 
 	// Automatically generate texture coords for detail map
 	glEnable(GL_TEXTURE_GEN_S); //texture unit 1
@@ -275,15 +277,15 @@ void LLDrawPoolWater::render(S32 pass)
 		gSky.mVOSkyp->getCubeMap()->enable(0);
 		gSky.mVOSkyp->getCubeMap()->bind();
 
-		glMatrixMode(GL_TEXTURE);
-		glLoadIdentity();
+		gGL.matrixMode(LLRender::MM_TEXTURE);
+		gGL.loadIdentity();
 		LLMatrix4 camera_mat = LLViewerCamera::getInstance()->getModelview();
 		LLMatrix4 camera_rot(camera_mat.getMat3());
 		camera_rot.invert();
 
-		glLoadMatrixf((F32 *)camera_rot.mMatrix);
+		gGL.loadMatrix((F32 *)camera_rot.mMatrix);
 
-		glMatrixMode(GL_MODELVIEW);
+		gGL.matrixMode(LLRender::MM_MODELVIEW);
 		LLOverrideFaceColor overrid(this, 1.f, 1.f, 1.f,  0.5f*up_dot);
 
 		gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
@@ -310,9 +312,9 @@ void LLDrawPoolWater::render(S32 pass)
 		
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 		gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
-		glMatrixMode(GL_TEXTURE);
-		glLoadIdentity();
-		glMatrixMode(GL_MODELVIEW);
+		gGL.matrixMode(LLRender::MM_TEXTURE);
+		gGL.loadIdentity();
+		gGL.matrixMode(LLRender::MM_MODELVIEW);
 		
 	}
 
@@ -332,6 +334,21 @@ void LLDrawPoolWater::renderOpaqueLegacyWater()
 {
 	LLVOSky *voskyp = gSky.mVOSkyp;
 
+	LLGLSLShader* shader = NULL;
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		if (LLPipeline::sUnderWaterRender)
+		{
+			shader = &gObjectSimpleNonIndexedTexGenWaterProgram;
+		}
+		else
+		{
+			shader = &gObjectSimpleNonIndexedTexGenProgram;
+		}
+
+		shader->bind();
+	}
+
 	stop_glerror();
 
 	// Depth sorting and write to depth buffer
@@ -354,10 +371,13 @@ void LLDrawPoolWater::renderOpaqueLegacyWater()
 	gGL.getTexUnit(0)->bind(mOpaqueWaterImagep);
 
 	// Automatically generate texture coords for water texture
-	glEnable(GL_TEXTURE_GEN_S); //texture unit 0
-	glEnable(GL_TEXTURE_GEN_T); //texture unit 0
-	glTexGenf(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
-	glTexGenf(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+	if (!shader)
+	{
+		glEnable(GL_TEXTURE_GEN_S); //texture unit 0
+		glEnable(GL_TEXTURE_GEN_T); //texture unit 0
+		glTexGenf(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+		glTexGenf(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+	}
 
 	// Use the fact that we know all water faces are the same size
 	// to save some computation
@@ -380,10 +400,18 @@ void LLDrawPoolWater::renderOpaqueLegacyWater()
 	F32 tp0[4] = { 16.f / 256.f, 0.0f, 0.0f, offset };
 	F32 tp1[4] = { 0.0f, 16.f / 256.f, 0.0f, offset };
 
-	glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0);
-	glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1);
+	if (!shader)
+	{
+		glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0);
+		glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1);
+	}
+	else
+	{
+		shader->uniform4fv("object_plane_s", 1, tp0);
+		shader->uniform4fv("object_plane_t", 1, tp1);
+	}
 
-	glColor3f(1.f, 1.f, 1.f);
+	gGL.diffuseColor3f(1.f, 1.f, 1.f);
 
 	for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
 		 iter != mDrawFace.end(); iter++)
@@ -399,9 +427,12 @@ void LLDrawPoolWater::renderOpaqueLegacyWater()
 
 	stop_glerror();
 
-	// Reset the settings back to expected values
-	glDisable(GL_TEXTURE_GEN_S); //texture unit 0
-	glDisable(GL_TEXTURE_GEN_T); //texture unit 0
+	if (!shader)
+	{
+		// Reset the settings back to expected values
+		glDisable(GL_TEXTURE_GEN_S); //texture unit 0
+		glDisable(GL_TEXTURE_GEN_T); //texture unit 0
+	}
 
 	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 	gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
@@ -623,8 +654,6 @@ void LLDrawPoolWater::shade()
 		water_color.mV[3] = 0.9f;
 	}
 
-	glColor4fv(water_color.mV);
-
 	{
 		LLGLEnable depth_clamp(gGLManager.mHasDepthClamp ? GL_DEPTH_CLAMP : 0);
 		LLGLDisable cullface(GL_CULL_FACE);
diff --git a/indra/newview/lldrawpoolwater.h b/indra/newview/lldrawpoolwater.h
index 99b541ca5a384d1de939c9795e96b908f0265abd..aeeba179d6ca134c240ea7cf70ec4768a95cea20 100644
--- a/indra/newview/lldrawpoolwater.h
+++ b/indra/newview/lldrawpoolwater.h
@@ -49,6 +49,7 @@ class LLDrawPoolWater: public LLFacePool
 	static LLVector3 sLightDir;
 
 	static LLColor4 sWaterFogColor;
+	static F32 sWaterFogEnd;
 
 	enum
 	{
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index 79a835fd14ef1e8f6950766ea8f23d8d03ced896..caf15fe1cbb0616719f98e98b7989980ad2c9f38 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -100,12 +100,12 @@ void LLDrawPoolWLSky::beginRenderPass( S32 pass )
 {
 	sky_shader =
 		LLPipeline::sUnderWaterRender ?
-			&gObjectSimpleWaterProgram :
+			&gObjectFullbrightNoColorWaterProgram :
 			&gWLSkyProgram;
 
 	cloud_shader =
 			LLPipeline::sUnderWaterRender ?
-				&gObjectSimpleWaterProgram :
+				&gObjectFullbrightNoColorWaterProgram :
 				&gWLCloudProgram;
 }
 
@@ -130,33 +130,33 @@ void LLDrawPoolWLSky::renderDome(F32 camHeightLocal, LLGLSLShader * shader) cons
 
 	llassert_always(NULL != shader);
 
-	glPushMatrix();
+	gGL.pushMatrix();
 
 	//chop off translation
 	if (LLPipeline::sReflectionRender && origin.mV[2] > 256.f)
 	{
-		glTranslatef(origin.mV[0], origin.mV[1], 256.f-origin.mV[2]*0.5f);
+		gGL.translatef(origin.mV[0], origin.mV[1], 256.f-origin.mV[2]*0.5f);
 	}
 	else
 	{
-		glTranslatef(origin.mV[0], origin.mV[1], origin.mV[2]);
+		gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]);
 	}
 		
 
 	// the windlight sky dome works most conveniently in a coordinate system
 	// where Y is up, so permute our basis vectors accordingly.
-	glRotatef(120.f, 1.f / F_SQRT3, 1.f / F_SQRT3, 1.f / F_SQRT3);
+	gGL.rotatef(120.f, 1.f / F_SQRT3, 1.f / F_SQRT3, 1.f / F_SQRT3);
 
-	glScalef(0.333f, 0.333f, 0.333f);
+	gGL.scalef(0.333f, 0.333f, 0.333f);
 
-	glTranslatef(0.f,-camHeightLocal, 0.f);
+	gGL.translatef(0.f,-camHeightLocal, 0.f);
 	
 	// Draw WL Sky	
 	shader->uniform3f("camPosLocal", 0.f, camHeightLocal, 0.f);
 
 	gSky.mVOWLSkyp->drawDome();
 
-	glPopMatrix();
+	gGL.popMatrix();
 }
 
 void LLDrawPoolWLSky::renderSkyHaze(F32 camHeightLocal) const
@@ -197,7 +197,7 @@ void LLDrawPoolWLSky::renderStars(void) const
 	gGL.getTexUnit(0)->bind(gSky.mVOSkyp->getBloomTex());
 
 	gGL.pushMatrix();
-	glRotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f);
+	gGL.rotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f);
 	// gl_FragColor.rgb = gl_Color.rgb;
 	// gl_FragColor.a = gl_Color.a * star_alpha.a;
 	if (LLGLSLShader::sNoFixedFunction)
@@ -267,10 +267,6 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
 
 	if (gSky.mVOSkyp->getMoon().getDraw() && face->getGeomCount())
 	{
-		if (gPipeline.canUseVertexShaders())
-		{
-			gUIProgram.bind();
-		}
 		// *NOTE: even though we already bound this texture above for the
 		// stars register combiners, we bind again here for defensive reasons,
 		// since LLImageGL::bind detects that it's a noop, and optimizes it out.
@@ -284,12 +280,18 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
 			
 		color.mV[3] = llclamp(a, 0.f, 1.f);
 		
+		if (gPipeline.canUseVertexShaders())
+		{
+			gHighlightProgram.bind();
+		}
+
 		LLFacePool::LLOverrideFaceColor color_override(this, color);
+		
 		face->renderIndexed();
 
 		if (gPipeline.canUseVertexShaders())
 		{
-			gUIProgram.unbind();
+			gHighlightProgram.unbind();
 		}
 	}
 }
@@ -315,10 +317,10 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass)
 	renderSkyHaze(camHeightLocal);
 
 	LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin();
-	glPushMatrix();
+	gGL.pushMatrix();
 
 		
-		glTranslatef(origin.mV[0], origin.mV[1], origin.mV[2]);
+		gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]);
 
 		gDeferredStarProgram.bind();
 		// *NOTE: have to bind a texture here since register combiners blending in
@@ -332,7 +334,7 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass)
 		
 		gDeferredStarProgram.unbind();
 
-	glPopMatrix();
+	gGL.popMatrix();
 
 	renderSkyClouds(camHeightLocal);
 
@@ -360,9 +362,9 @@ void LLDrawPoolWLSky::render(S32 pass)
 	renderSkyHaze(camHeightLocal);
 
 	LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin();
-	glPushMatrix();
+	gGL.pushMatrix();
 
-		glTranslatef(origin.mV[0], origin.mV[1], origin.mV[2]);
+		gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]);
 
 		// *NOTE: have to bind a texture here since register combiners blending in
 		// renderStars() requires something to be bound and we might as well only
@@ -374,7 +376,7 @@ void LLDrawPoolWLSky::render(S32 pass)
 		renderStars();
 		
 
-	glPopMatrix();
+	gGL.popMatrix();
 
 	renderSkyClouds(camHeightLocal);
 
diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp
index 8f47d3c5e5ff53c1ee2d210fd0b44dbbe69529a1..64eb11fc9b2e90becc78c29777f0c57fe771180c 100644
--- a/indra/newview/lldriverparam.cpp
+++ b/indra/newview/lldriverparam.cpp
@@ -139,7 +139,7 @@ void LLDriverParamInfo::toStream(std::ostream &out)
 			}
 			else
 			{
-				llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << gAgentAvatarp << " for driver parameter " << getID() << llendl;
+				llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << gAgentAvatarp.get() << " for driver parameter " << getID() << llendl;
 			}
 			out << std::endl;
 		}
diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp
index fb9958ee9dd52affbea8ee0538be67a76037105e..a93b2b71de394c7198ebff27f33b26c7fb281787 100644
--- a/indra/newview/lldynamictexture.cpp
+++ b/indra/newview/lldynamictexture.cpp
@@ -41,6 +41,7 @@
 #include "llviewerdisplay.h"
 #include "llrender.h"
 #include "pipeline.h"
+#include "llglslshader.h"
 
 // static
 LLViewerDynamicTexture::instance_list_t LLViewerDynamicTexture::sInstances[ LLViewerDynamicTexture::ORDER_COUNT ];
@@ -124,8 +125,16 @@ BOOL LLViewerDynamicTexture::render()
 //-----------------------------------------------------------------------------
 void LLViewerDynamicTexture::preRender(BOOL clear_depth)
 {
-	{
-		// force rendering to on-screen portion of frame buffer
+	//only images up to 512x512 are supported
+	llassert(mFullHeight <= 512);
+	llassert(mFullWidth <= 512);
+
+	if (gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete())
+	{ //using offscreen render target, just use the bottom left corner
+		mOrigin.set(0, 0);
+	}
+	else
+	{ // force rendering to on-screen portion of frame buffer
 		LLCoordScreen window_pos;
 		gViewerWindow->getWindow()->getPosition( &window_pos );
 		mOrigin.set(0, gViewerWindow->getWindowHeightRaw() - mFullHeight);  // top left corner
@@ -139,9 +148,9 @@ void LLViewerDynamicTexture::preRender(BOOL clear_depth)
 			mOrigin.mY += window_pos.mY;
 			mOrigin.mY = llmax(mOrigin.mY, 0) ;
 		}
-
-		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 	}
+
+	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 	// Set up camera
 	LLViewerCamera* camera = LLViewerCamera::getInstance();
 	mCamera.setOrigin(*camera);
@@ -207,6 +216,16 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
 		return TRUE;
 	}
 
+	bool use_fbo = gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete();
+
+	if (use_fbo)
+	{
+		gPipeline.mWaterDis.bindTarget();
+	}
+
+	LLGLSLShader::bindNoShader();
+	LLVertexBuffer::unbind();
+	
 	BOOL result = FALSE;
 	BOOL ret = FALSE ;
 	for( S32 order = 0; order < ORDER_COUNT; order++ )
@@ -237,6 +256,11 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
 		}
 	}
 
+	if (use_fbo)
+	{
+		gPipeline.mWaterDis.flush();
+	}
+
 	return ret;
 }
 
diff --git a/indra/newview/llexpandabletextbox.cpp b/indra/newview/llexpandabletextbox.cpp
index 2abfbf37ca9c3e347cfdd792b52902ac33d6c403..935dcb74b0f8370c8df57fb3c0db77862f5ddb76 100644
--- a/indra/newview/llexpandabletextbox.cpp
+++ b/indra/newview/llexpandabletextbox.cpp
@@ -55,7 +55,7 @@ class LLExpanderSegment : public LLTextSegment
 		else
 		{
 			width = mEditor.getDocumentView()->getRect().getWidth() - mEditor.getHPad(); 
-			height = llceil(mStyle->getFont()->getLineHeight());
+			height = mStyle->getFont()->getLineHeight();
 		}
 		return true;
 	}
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index 432e61f6d8479c593e6b3025529d155a56308a84..4108d69e820de82ad5b674ca935f9884883f7a27 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -496,14 +496,14 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color)
 		gGL.pushMatrix();
 		if (mDrawablep->isActive())
 		{
-			glMultMatrixf((GLfloat*)mDrawablep->getRenderMatrix().mMatrix);
+			gGL.multMatrix((GLfloat*)mDrawablep->getRenderMatrix().mMatrix);
 		}
 		else
 		{
-			glMultMatrixf((GLfloat*)mDrawablep->getRegion()->mRenderMatrix.mMatrix);
+			gGL.multMatrix((GLfloat*)mDrawablep->getRegion()->mRenderMatrix.mMatrix);
 		}
 
-		glColor4fv(color.mV);
+		gGL.diffuseColor4fv(color.mV);
 	
 		if (mDrawablep->isState(LLDrawable::RIGGED))
 		{
@@ -515,7 +515,7 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color)
 				{
 					LLGLEnable offset(GL_POLYGON_OFFSET_FILL);
 					glPolygonOffset(-1.f, -1.f);
-					glMultMatrixf((F32*) volume->getRelativeXform().mMatrix);
+					gGL.multMatrix((F32*) volume->getRelativeXform().mMatrix);
 					const LLVolumeFace& vol_face = rigged->getVolumeFace(getTEOffset());
 					LLVertexBuffer::unbind();
 					glVertexPointer(3, GL_FLOAT, 16, vol_face.mPositions);
@@ -524,6 +524,7 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color)
 						glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 						glTexCoordPointer(2, GL_FLOAT, 8, vol_face.mTexCoords);
 					}
+					gGL.syncMatrices();
 					glDrawElements(GL_TRIANGLES, vol_face.mNumIndices, GL_UNSIGNED_SHORT, vol_face.mIndices);
 					glDisableClientState(GL_TEXTURE_COORD_ARRAY);
 				}
@@ -557,17 +558,17 @@ void LLFace::renderSelectedUV()
 
 	// add green dither pattern on top of red/blue gradient
 	gGL.blendFunc(LLRender::BF_ONE, LLRender::BF_ONE);
-	glMatrixMode(GL_TEXTURE);
-	glPushMatrix();
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.pushMatrix();
 	// make green pattern repeat once per texel in red/blue texture
-	glScalef(256.f, 256.f, 1.f);
-	glMatrixMode(GL_MODELVIEW);
+	gGL.scalef(256.f, 256.f, 1.f);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 
 	renderSelected(green_imagep, LLColor4::white);
 
-	glMatrixMode(GL_TEXTURE);
-	glPopMatrix();
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.popMatrix();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, LLRender::BF_ONE_MINUS_SOURCE_ALPHA);
 }
 */
@@ -692,6 +693,49 @@ static void xform(LLVector2 &tex_coord, F32 cosAng, F32 sinAng, F32 offS, F32 of
 	tex_coord.mV[1] = t;
 }
 
+// Transform the texture coordinates for this face.
+static void xform4a(LLVector4a &tex_coord, const LLVector4a& trans, const LLVector4Logical& mask, const LLVector4a& rot0, const LLVector4a& rot1, const LLVector4a& offset, const LLVector4a& scale) 
+{
+	//tex coord is two coords, <s0, t0, s1, t1>
+	LLVector4a st;
+
+	// Texture transforms are done about the center of the face.
+	st.setAdd(tex_coord, trans);
+	
+	// Handle rotation
+	LLVector4a rot_st;
+		
+	// <s0 * cosAng, s0*-sinAng, s1*cosAng, s1*-sinAng>
+	LLVector4a s0;
+	s0.splat(st, 0);
+	LLVector4a s1;
+	s1.splat(st, 2);
+	LLVector4a ss;
+	ss.setSelectWithMask(mask, s1, s0);
+
+	LLVector4a a; 
+	a.setMul(rot0, ss);
+	
+	// <t0*sinAng, t0*cosAng, t1*sinAng, t1*cosAng>
+	LLVector4a t0;
+	t0.splat(st, 1);
+	LLVector4a t1;
+	t1.splat(st, 3);
+	LLVector4a tt;
+	tt.setSelectWithMask(mask, t1, t0);
+
+	LLVector4a b;
+	b.setMul(rot1, tt);
+		
+	st.setAdd(a,b);
+
+	// Then scale
+	st.mul(scale);
+
+	// Then offset
+	tex_coord.setAdd(st, offset);
+}
+
 
 bool less_than_max_mag(const LLVector4a& vec)
 {
@@ -1055,9 +1099,20 @@ static LLFastTimer::DeclareTimer FTM_FACE_GEOM_POSITION("Position");
 static LLFastTimer::DeclareTimer FTM_FACE_GEOM_NORMAL("Normal");
 static LLFastTimer::DeclareTimer FTM_FACE_GEOM_TEXTURE("Texture");
 static LLFastTimer::DeclareTimer FTM_FACE_GEOM_COLOR("Color");
+static LLFastTimer::DeclareTimer FTM_FACE_GEOM_EMISSIVE("Emissive");
 static LLFastTimer::DeclareTimer FTM_FACE_GEOM_WEIGHTS("Weights");
 static LLFastTimer::DeclareTimer FTM_FACE_GEOM_BINORMAL("Binormal");
 static LLFastTimer::DeclareTimer FTM_FACE_GEOM_INDEX("Index");
+static LLFastTimer::DeclareTimer FTM_FACE_GEOM_INDEX_TAIL("Tail");
+static LLFastTimer::DeclareTimer FTM_FACE_POSITION_STORE("Pos");
+static LLFastTimer::DeclareTimer FTM_FACE_TEXTURE_INDEX_STORE("TexIdx");
+static LLFastTimer::DeclareTimer FTM_FACE_POSITION_PAD("Pad");
+static LLFastTimer::DeclareTimer FTM_FACE_TEX_DEFAULT("Default");
+static LLFastTimer::DeclareTimer FTM_FACE_TEX_QUICK("Quick");
+static LLFastTimer::DeclareTimer FTM_FACE_TEX_QUICK_NO_XFORM("No Xform");
+static LLFastTimer::DeclareTimer FTM_FACE_TEX_QUICK_XFORM("Xform");
+
+static LLFastTimer::DeclareTimer FTM_FACE_TEX_QUICK_PLANAR("Quick Planar");
 
 BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 							   const S32 &f,
@@ -1071,7 +1126,14 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 	S32 num_vertices = (S32)vf.mNumVertices;
 	S32 num_indices = (S32) vf.mNumIndices;
 	
-	bool map_range = gGLManager.mHasMapBufferRange || gGLManager.mHasFlushBufferRange;
+	if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCTREE))
+	{
+		updateRebuildFlags();
+	}
+
+
+	//don't use map range (generates many redundant unmap calls)
+	bool map_range = false; //gGLManager.mHasMapBufferRange || gGLManager.mHasFlushBufferRange;
 
 	if (mVertexBuffer.notNull())
 	{
@@ -1097,16 +1159,12 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 	}
 
 	LLStrider<LLVector3> vert;
-	LLVector4a* vertices = NULL;
 	LLStrider<LLVector2> tex_coords;
 	LLStrider<LLVector2> tex_coords2;
-	LLVector4a* normals = NULL;
 	LLStrider<LLVector3> norm;
 	LLStrider<LLColor4U> colors;
-	LLVector4a* binormals = NULL;
 	LLStrider<LLVector3> binorm;
 	LLStrider<U16> indicesp;
-	LLVector4a* weights = NULL;
 	LLStrider<LLVector4> wght;
 
 	BOOL full_rebuild = force_rebuild || mDrawablep->isState(LLDrawable::REBUILD_VOLUME);
@@ -1124,6 +1182,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 	
 	bool rebuild_pos = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_POSITION);
 	bool rebuild_color = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_COLOR);
+	bool rebuild_emissive = rebuild_color && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE);
 	bool rebuild_tcoord = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_TCOORD);
 	bool rebuild_normal = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_NORMAL);
 	bool rebuild_binormal = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_BINORMAL);
@@ -1194,7 +1253,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 		LLFastTimer t(FTM_FACE_GEOM_INDEX);
 		mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex, mIndicesCount, map_range);
 
-		__m128i* dst = (__m128i*) indicesp.get();
+		volatile __m128i* dst = (__m128i*) indicesp.get();
 		__m128i* src = (__m128i*) vf.mIndices;
 		__m128i offset = _mm_set1_epi16(index_offset);
 
@@ -1203,17 +1262,22 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 		for (S32 i = 0; i < end; i++)
 		{
 			__m128i res = _mm_add_epi16(src[i], offset);
-			_mm_storeu_si128(dst+i, res);
+			_mm_storeu_si128((__m128i*) dst++, res);
 		}
 
-		for (S32 i = end*8; i < num_indices; ++i)
 		{
-			indicesp[i] = vf.mIndices[i]+index_offset;
+			LLFastTimer t(FTM_FACE_GEOM_INDEX_TAIL);
+			U16* idx = (U16*) dst;
+
+			for (S32 i = end*8; i < num_indices; ++i)
+			{
+				*idx++ = vf.mIndices[i]+index_offset;
+			}
 		}
 
 		if (map_range)
 		{
-			mVertexBuffer->setBuffer(0);
+			mVertexBuffer->flush();
 		}
 	}
 	
@@ -1365,19 +1429,48 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 
 			if (texgen != LLTextureEntry::TEX_GEN_PLANAR)
 			{
+				LLFastTimer t(FTM_FACE_TEX_QUICK);
 				if (!do_tex_mat)
 				{
 					if (!do_xform)
 					{
+						LLFastTimer t(FTM_FACE_TEX_QUICK_NO_XFORM);
 						LLVector4a::memcpyNonAliased16((F32*) tex_coords.get(), (F32*) vf.mTexCoords, num_vertices*2*sizeof(F32));
 					}
 					else
 					{
-						for (S32 i = 0; i < num_vertices; i++)
+						LLFastTimer t(FTM_FACE_TEX_QUICK_XFORM);
+						F32* dst = (F32*) tex_coords.get();
+						LLVector4a* src = (LLVector4a*) vf.mTexCoords;
+
+						LLVector4a trans;
+						trans.splat(-0.5f);
+
+						LLVector4a rot0;
+						rot0.set(cos_ang, -sin_ang, cos_ang, -sin_ang);
+
+						LLVector4a rot1;
+						rot1.set(sin_ang, cos_ang, sin_ang, cos_ang);
+
+						LLVector4a scale;
+						scale.set(ms, mt, ms, mt);
+
+						LLVector4a offset;
+						offset.set(os+0.5f, ot+0.5f, os+0.5f, ot+0.5f);
+
+						LLVector4Logical mask;
+						mask.clear();
+						mask.setElement<2>();
+						mask.setElement<3>();
+
+						U32 count = num_vertices/2 + num_vertices%2;
+
+						for (S32 i = 0; i < count; i++)
 						{	
-							LLVector2 tc(vf.mTexCoords[i]);
-							xform(tc, cos_ang, sin_ang, os, ot, ms, mt);
-							*tex_coords++ = tc;	
+							LLVector4a res = *src++;
+							xform4a(res, trans, mask, rot0, rot1, offset, scale);
+							res.store4a(dst);
+							dst += 4;
 						}
 					}
 				}
@@ -1399,6 +1492,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 			}
 			else
 			{ //no bump, no atlas, tex gen planar
+				LLFastTimer t(FTM_FACE_TEX_QUICK_PLANAR);
 				if (do_tex_mat)
 				{
 					for (S32 i = 0; i < num_vertices; i++)
@@ -1438,11 +1532,12 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 
 			if (map_range)
 			{
-				mVertexBuffer->setBuffer(0);
+				mVertexBuffer->flush();
 			}
 		}
 		else
 		{ //either bump mapped or in atlas, just do the whole expensive loop
+			LLFastTimer t(FTM_FACE_TEX_DEFAULT);
 			mVertexBuffer->getTexCoord0Strider(tex_coords, mGeomIndex, mGeomCount, map_range);
 
 			std::vector<LLVector2> bump_tc;
@@ -1585,7 +1680,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 
 			if (map_range)
 			{
-				mVertexBuffer->setBuffer(0);
+				mVertexBuffer->flush();
 			}
 
 			if (do_bump)
@@ -1622,7 +1717,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 
 				if (map_range)
 				{
-					mVertexBuffer->setBuffer(0);
+					mVertexBuffer->flush();
 				}
 			}
 		}
@@ -1634,45 +1729,66 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 		llassert(num_vertices > 0);
 		
 		mVertexBuffer->getVertexStrider(vert, mGeomIndex, mGeomCount, map_range);
-		vertices = (LLVector4a*) vert.get();
-	
+			
+
 		LLMatrix4a mat_vert;
 		mat_vert.loadu(mat_vert_in);
 
 		LLVector4a* src = vf.mPositions;
-		LLVector4a* dst = vertices;
+		volatile F32* dst = (volatile F32*) vert.get();
 
-		LLVector4a* end = dst+num_vertices;
-		do
-		{	
-			mat_vert.affineTransform(*src++, *dst++);
-		}
-		while(dst < end);
+		volatile F32* end = dst+num_vertices*4;
+		LLVector4a res;
+
+		LLVector4a texIdx;
+
+		U8 index = mTextureIndex < 255 ? mTextureIndex : 0;
+
+		F32 val = 0.f;
+		U8* vp = (U8*) &val;
+		vp[0] = index;
+		vp[1] = 0;
+		vp[2] = 0;
+		vp[3] = 0;
+
+		llassert(index <= LLGLSLShader::sIndexedTextureChannels-1);
 
-		F32 index = (F32) (mTextureIndex < 255 ? mTextureIndex : 0);
-		F32 *index_dst = (F32*) vertices;
-		F32 *index_end = (F32*) end;
+		LLVector4Logical mask;
+		mask.clear();
+		mask.setElement<3>();
+		
+		texIdx.set(0,0,0,val);
 
-		index_dst += 3;
-		index_end += 3;
-		do
 		{
-			*index_dst = index;
-			index_dst += 4;
+			LLFastTimer t(FTM_FACE_POSITION_STORE);
+			LLVector4a tmp;
+
+			do
+			{	
+				mat_vert.affineTransform(*src++, res);
+				tmp.setSelectWithMask(mask, texIdx, res);
+				tmp.store4a((F32*) dst);
+				dst += 4;
+			}
+			while(dst < end);
 		}
-		while (index_dst < index_end);
-		
-		S32 aligned_pad_vertices = mGeomCount - num_vertices;
-		LLVector4a* last_vec = end - 1;
-		while (aligned_pad_vertices > 0)
+
 		{
-			--aligned_pad_vertices;
-			*dst++ = *last_vec;
+			LLFastTimer t(FTM_FACE_POSITION_PAD);
+			S32 aligned_pad_vertices = mGeomCount - num_vertices;
+			res.set(res[0], res[1], res[2], 0.f);
+
+			while (aligned_pad_vertices > 0)
+			{
+				--aligned_pad_vertices;
+				res.store4a((F32*) dst);
+				dst += 4;
+			}
 		}
-		
+
 		if (map_range)
 		{
-			mVertexBuffer->setBuffer(0);
+			mVertexBuffer->flush();
 		}
 	}
 		
@@ -1680,19 +1796,20 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 	{
 		LLFastTimer t(FTM_FACE_GEOM_NORMAL);
 		mVertexBuffer->getNormalStrider(norm, mGeomIndex, mGeomCount, map_range);
-		normals = (LLVector4a*) norm.get();
+		F32* normals = (F32*) norm.get();
 	
 		for (S32 i = 0; i < num_vertices; i++)
 		{	
 			LLVector4a normal;
 			mat_normal.rotate(vf.mNormals[i], normal);
 			normal.normalize3fast();
-			normals[i] = normal;
+			normal.store4a(normals);
+			normals += 4;
 		}
 
 		if (map_range)
 		{
-			mVertexBuffer->setBuffer(0);
+			mVertexBuffer->flush();
 		}
 	}
 		
@@ -1700,19 +1817,20 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 	{
 		LLFastTimer t(FTM_FACE_GEOM_BINORMAL);
 		mVertexBuffer->getBinormalStrider(binorm, mGeomIndex, mGeomCount, map_range);
-		binormals = (LLVector4a*) binorm.get();
+		F32* binormals = (F32*) binorm.get();
 		
 		for (S32 i = 0; i < num_vertices; i++)
 		{	
 			LLVector4a binormal;
 			mat_normal.rotate(vf.mBinormals[i], binormal);
 			binormal.normalize3fast();
-			binormals[i] = binormal;
+			binormal.store4a(binormals);
+			binormals += 4;
 		}
 
 		if (map_range)
 		{
-			mVertexBuffer->setBuffer(0);
+			mVertexBuffer->flush();
 		}
 	}
 	
@@ -1720,15 +1838,15 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 	{
 		LLFastTimer t(FTM_FACE_GEOM_WEIGHTS);
 		mVertexBuffer->getWeight4Strider(wght, mGeomIndex, mGeomCount, map_range);
-		weights = (LLVector4a*) wght.get();
-		LLVector4a::memcpyNonAliased16((F32*) weights, (F32*) vf.mWeights, num_vertices*4*sizeof(F32));
+		F32* weights = (F32*) wght.get();
+		LLVector4a::memcpyNonAliased16(weights, (F32*) vf.mWeights, num_vertices*4*sizeof(F32));
 		if (map_range)
 		{
-			mVertexBuffer->setBuffer(0);
+			mVertexBuffer->flush();
 		}
 	}
 
-	if (rebuild_color)
+	if (rebuild_color && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_COLOR) )
 	{
 		LLFastTimer t(FTM_FACE_GEOM_COLOR);
 		mVertexBuffer->getColorStrider(colors, mGeomIndex, mGeomCount, map_range);
@@ -1740,7 +1858,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 		
 		src.loadua((F32*) vec);
 
-		LLVector4a* dst = (LLVector4a*) colors.get();
+		F32* dst = (F32*) colors.get();
 		S32 num_vecs = num_vertices/4;
 		if (num_vertices%4 > 0)
 		{
@@ -1749,15 +1867,55 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 
 		for (S32 i = 0; i < num_vecs; i++)
 		{	
-			dst[i] = src;
+			src.store4a(dst);
+			dst += 4;
 		}
 
 		if (map_range)
 		{
-			mVertexBuffer->setBuffer(0);
+			mVertexBuffer->flush();
 		}
 	}
 
+	if (rebuild_emissive)
+	{
+		LLFastTimer t(FTM_FACE_GEOM_EMISSIVE);
+		LLStrider<LLColor4U> emissive;
+		mVertexBuffer->getEmissiveStrider(emissive, mGeomIndex, mGeomCount, map_range);
+
+		U8 glow = (U8) llclamp((S32) (getTextureEntry()->getGlow()*255), 0, 255);
+
+		LLVector4a src;
+
+		
+		U32 glow32 = glow |
+					 (glow << 8) |
+					 (glow << 16) |
+					 (glow << 24);
+
+		U32 vec[4];
+		vec[0] = vec[1] = vec[2] = vec[3] = glow32;
+		
+		src.loadua((F32*) vec);
+
+		F32* dst = (F32*) emissive.get();
+		S32 num_vecs = num_vertices/4;
+		if (num_vertices%4 > 0)
+		{
+			++num_vecs;
+		}
+
+		for (S32 i = 0; i < num_vecs; i++)
+		{	
+			src.store4a(dst);
+			dst += 4;
+		}
+
+		if (map_range)
+		{
+			mVertexBuffer->flush();
+		}
+	}
 	if (rebuild_tcoord)
 	{
 		mTexExtents[0].setVec(0,0);
@@ -1773,6 +1931,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 		mTexExtents[1][1] *= et ;
 	}
 
+
 	mLastVertexBuffer = mVertexBuffer;
 	mLastGeomCount = mGeomCount;
 	mLastGeomIndex = mGeomIndex;
@@ -2014,7 +2173,7 @@ BOOL LLFace::verify(const U32* indices_array) const
 	}
 	
 	// First, check whether the face data fits within the pool's range.
-	if ((mGeomIndex + mGeomCount) > mVertexBuffer->getRequestedVerts())
+	if ((mGeomIndex + mGeomCount) > mVertexBuffer->getNumVerts())
 	{
 		ok = FALSE;
 		llinfos << "Face references invalid vertices!" << llendl;
@@ -2033,7 +2192,7 @@ BOOL LLFace::verify(const U32* indices_array) const
 		llinfos << "Face has bogus indices count" << llendl;
 	}
 	
-	if (mIndicesIndex + mIndicesCount > mVertexBuffer->getRequestedIndices())
+	if (mIndicesIndex + mIndicesCount > mVertexBuffer->getNumIndices())
 	{
 		ok = FALSE;
 		llinfos << "Face references invalid indices!" << llendl;
@@ -2095,7 +2254,7 @@ void LLFace::renderSetColor() const
 	{
 		const LLColor4* color = &(getRenderColor());
 		
-		glColor4fv(color->mV);
+		gGL.diffuseColor4fv(color->mV);
 	}
 }
 
@@ -2130,10 +2289,10 @@ S32 LLFace::renderElements(const U16 *index_array) const
 	}
 	else
 	{
-		glPushMatrix();
-		glMultMatrixf((float*)getRenderMatrix().mMatrix);
+		gGL.pushMatrix();
+		gGL.multMatrix((float*)getRenderMatrix().mMatrix);
 		ret = pushVertices(index_array);
-		glPopMatrix();
+		gGL.popMatrix();
 	}
 	
 	return ret;
diff --git a/indra/newview/llface.h b/indra/newview/llface.h
index b5eaeecd60ea18c533f441e7c9b04c51386ef85f..82e4ab61b7d9d5695afbe08f0c929327eca019e6 100644
--- a/indra/newview/llface.h
+++ b/indra/newview/llface.h
@@ -329,13 +329,9 @@ class LLFace
 			{
 				return lhs->getTexture() < rhs->getTexture();
 			}
-			else if (lte->getBumpShinyFullbright() != rte->getBumpShinyFullbright())
-			{
-				return lte->getBumpShinyFullbright() < rte->getBumpShinyFullbright();
-			}
 			else 
 			{
-				return lte->getGlow() < rte->getGlow();
+				return lte->getBumpShinyFullbright() < rte->getBumpShinyFullbright();
 			}
 		}
 	};
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index a161428c2b99b2366a0775b3447ecbf08f8bb182..9664aa7dbe2e5026cf17a6ff171fe1452397445e 100644
--- a/indra/newview/llfasttimerview.cpp
+++ b/indra/newview/llfasttimerview.cpp
@@ -105,6 +105,7 @@ void LLFastTimerView::onPause()
 	if (!LLFastTimer::sPauseHistory)
 	{
 		mScrollIndex = 0;
+		LLFastTimer::sResetHistory = true;
 		getChild<LLButton>("pause_btn")->setLabel(getString("pause"));
 	}
 	else
@@ -148,7 +149,7 @@ BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask)
 
 LLFastTimer::NamedTimer* LLFastTimerView::getLegendID(S32 y)
 {
-	S32 idx = (getRect().getHeight() - y) / ((S32) LLFontGL::getFontMonospace()->getLineHeight()+2) - 5;
+	S32 idx = (getRect().getHeight() - y) / (LLFontGL::getFontMonospace()->getLineHeight()+2) - 5;
 
 	if (idx >= 0 && idx < (S32)ft_display_idx.size())
 	{
@@ -551,7 +552,7 @@ void LLFastTimerView::draw()
 	// update rectangle that includes timer bars
 	mBarRect.mLeft = xleft;
 	mBarRect.mRight = getRect().getWidth();
-	mBarRect.mTop = ytop - ((S32)LLFontGL::getFontMonospace()->getLineHeight() + 4);
+	mBarRect.mTop = ytop - (LLFontGL::getFontMonospace()->getLineHeight() + 4);
 	mBarRect.mBottom = margin + LINE_GRAPH_HEIGHT;
 
 	y = ytop;
@@ -591,6 +592,7 @@ void LLFastTimerView::draw()
 			{
 				mAvgCountTotal = ticks;
 				mMaxCountTotal = ticks;
+				LLFastTimer::sResetHistory = false;
 			}
 		}
 
@@ -844,7 +846,7 @@ void LLFastTimerView::draw()
 				tdesc = llformat("%4.2f ms", ms);
 							
 			x = mGraphRect.mRight - LLFontGL::getFontMonospace()->getWidth(tdesc)-5;
-			y = mGraphRect.mTop - ((S32)LLFontGL::getFontMonospace()->getLineHeight());
+			y = mGraphRect.mTop - LLFontGL::getFontMonospace()->getLineHeight();
  
 			LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white,
 										 LLFontGL::LEFT, LLFontGL::TOP);
@@ -1125,10 +1127,10 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t
 	LLPointer<LLImageRaw> scratch = new LLImageRaw(1024, 512, 3);
 
 	gGL.pushMatrix();
-	glLoadIdentity();
-	glMatrixMode(GL_PROJECTION);
-	glLoadIdentity();
-	glOrtho(-0.05, 1.05, -0.05, 1.05, -1.0, 1.0);
+	gGL.loadIdentity();
+	gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.loadIdentity();
+	gGL.ortho(-0.05f, 1.05f, -0.05f, 1.05f, -1.0f, 1.0f);
 
 	//render charts
 	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -1367,7 +1369,7 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t
 	buffer.flush();
 
 	gGL.popMatrix();
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.popMatrix();
 }
 
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index 4f2fd474880fc885b6789bd298e3f99907354b08..575b613ccfcce44e41e09484073f2a19f2ffce0f 100644
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -39,7 +39,7 @@
 
 #include "llagent.h"
 #include "llclipboard.h"
-#include "llinventoryclipboard.h"
+#include "llclipboard.h"
 #include "llinventorybridge.h"
 #include "llinventoryfunctions.h"
 #include "llfloatersidepanelcontainer.h"
@@ -405,8 +405,8 @@ LLFavoritesBarCtrl::~LLFavoritesBarCtrl()
 {
 	gInventory.removeObserver(this);
 
-	delete mOverflowMenuHandle.get();
-	delete mContextMenuHandle.get();
+	if (mOverflowMenuHandle.get()) mOverflowMenuHandle.get()->die();
+	if (mContextMenuHandle.get()) mContextMenuHandle.get()->die();
 }
 
 BOOL LLFavoritesBarCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
@@ -1118,7 +1118,7 @@ BOOL LLFavoritesBarCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
 }
 void copy_slurl_to_clipboard_cb(std::string& slurl)
 {
-	gClipboard.copyFromString(utf8str_to_wstring(slurl));
+	LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl),0,slurl.size());
 
 	LLSD args;
 	args["SLURL"] = slurl;
@@ -1187,7 +1187,7 @@ void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata)
 	}
 	else if (action == "copy")
 	{
-		LLInventoryClipboard::instance().store(mSelectedItemID);
+		LLClipboard::instance().copyToClipboard(mSelectedItemID, LLAssetType::AT_LANDMARK);
 	}
 	else if (action == "paste")
 	{
@@ -1211,13 +1211,13 @@ void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata)
 
 BOOL LLFavoritesBarCtrl::isClipboardPasteable() const
 {
-	if (!LLInventoryClipboard::instance().hasContents())
+	if (!LLClipboard::instance().hasContents())
 	{
 		return FALSE;
 	}
 
 	LLDynamicArray<LLUUID> objects;
-	LLInventoryClipboard::instance().retrieve(objects);
+	LLClipboard::instance().pasteFromClipboard(objects);
 	S32 count = objects.count();
 	for(S32 i = 0; i < count; i++)
 	{
@@ -1246,7 +1246,7 @@ void LLFavoritesBarCtrl::pastFromClipboard() const
 	{
 		LLInventoryItem* item = NULL;
 		LLDynamicArray<LLUUID> objects;
-		LLInventoryClipboard::instance().retrieve(objects);
+		LLClipboard::instance().pasteFromClipboard(objects);
 		S32 count = objects.count();
 		LLUUID parent_id(mFavoriteFolderId);
 		for(S32 i = 0; i < count; i++)
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp
index db9a0424c0d66182c25ec07e5b99ac3ed6c6e5a0..08f9d267054cffb2662bd7a810e06bd2b59157b9 100644
--- a/indra/newview/llfeaturemanager.cpp
+++ b/indra/newview/llfeaturemanager.cpp
@@ -51,6 +51,7 @@
 #include "llcontrol.h"
 #include "llboost.h"
 #include "llweb.h"
+#include "llviewershadermgr.h"
 
 #if LL_WINDOWS
 #include "lldxhardware.h"
@@ -662,8 +663,10 @@ void LLFeatureManager::applyFeatures(bool skipFeatures)
 
 void LLFeatureManager::setGraphicsLevel(S32 level, bool skipFeatures)
 {
-	applyBaseMasks();
+	LLViewerShaderMgr::sSkipReload = true;
 
+	applyBaseMasks();
+	
 	switch (level)
 	{
 		case 0:
@@ -684,6 +687,9 @@ void LLFeatureManager::setGraphicsLevel(S32 level, bool skipFeatures)
 	}
 
 	applyFeatures(skipFeatures);
+
+	LLViewerShaderMgr::sSkipReload = false;
+	LLViewerShaderMgr::instance()->setShaders();
 }
 
 void LLFeatureManager::applyBaseMasks()
@@ -725,7 +731,7 @@ void LLFeatureManager::applyBaseMasks()
 	{
 		maskFeatures("NoPixelShaders");
 	}
-	if (!gGLManager.mHasVertexShader)
+	if (!gGLManager.mHasVertexShader || !mGPUSupported)
 	{
 		maskFeatures("NoVertexShaders");
 	}
diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp
index 4897cf18859602201274e9f328231f2bb4d40bd0..8986a694f9902585e6c443b62ddd2f84f538b198 100644
--- a/indra/newview/llfilepicker.cpp
+++ b/indra/newview/llfilepicker.cpp
@@ -49,7 +49,7 @@ LLFilePicker LLFilePicker::sInstance;
 #if LL_WINDOWS
 #define SOUND_FILTER L"Sounds (*.wav)\0*.wav\0"
 #define IMAGE_FILTER L"Images (*.tga; *.bmp; *.jpg; *.jpeg; *.png)\0*.tga;*.bmp;*.jpg;*.jpeg;*.png\0"
-#define ANIM_FILTER L"Animations (*.bvh)\0*.bvh\0"
+#define ANIM_FILTER L"Animations (*.bvh; *.anim)\0*.bvh;*.anim\0"
 #define COLLADA_FILTER L"Scene (*.dae)\0*.dae\0"
 #ifdef _CORY_TESTING
 #define GEOMETRY_FILTER L"SL Geometry (*.slg)\0*.slg\0"
@@ -58,6 +58,7 @@ LLFilePicker LLFilePicker::sInstance;
 #define SLOBJECT_FILTER L"Objects (*.slobject)\0*.slobject\0"
 #define RAW_FILTER L"RAW files (*.raw)\0*.raw\0"
 #define MODEL_FILTER L"Model files (*.dae)\0*.dae\0"
+#define SCRIPT_FILTER L"Script files (*.lsl)\0*.lsl\0"
 #endif
 
 //
@@ -213,6 +214,10 @@ BOOL LLFilePicker::setupFilter(ELoadFilter filter)
 		mOFN.lpstrFilter = MODEL_FILTER \
 			L"\0";
 		break;
+	case FFLOAD_SCRIPT:
+		mOFN.lpstrFilter = SCRIPT_FILTER \
+			L"\0";
+		break;
 	default:
 		res = FALSE;
 		break;
@@ -497,6 +502,14 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename)
 			L"Compressed Images (*.j2c)\0*.j2c\0" \
 			L"\0";
 		break;
+	case FFSAVE_SCRIPT:
+		if (filename.empty())
+		{
+			wcsncpy( mFilesW,L"untitled.lsl", FILENAME_BUFFER_SIZE);
+		}
+		mOFN.lpstrDefExt = L"txt";
+		mOFN.lpstrFilter = L"LSL Files (*.lsl)\0*.lsl\0" L"\0";
+		break;
 	default:
 		return FALSE;
 	}
@@ -580,8 +593,10 @@ Boolean LLFilePicker::navOpenFilterProc(AEDesc *theItem, void *info, void *callB
 						}
 						else if (filter == FFLOAD_ANIM)
 						{
-							if (fileInfo.filetype != 'BVH ' && 
-								(fileInfo.extension && (CFStringCompare(fileInfo.extension, CFSTR("bvh"), kCFCompareCaseInsensitive) != kCFCompareEqualTo))
+							if (fileInfo.filetype != 'BVH ' &&
+								fileInfo.filetype != 'ANIM' &&
+								(fileInfo.extension && (CFStringCompare(fileInfo.extension, CFSTR("bvh"), kCFCompareCaseInsensitive) != kCFCompareEqualTo) &&
+								fileInfo.extension && (CFStringCompare(fileInfo.extension, CFSTR("anim"), kCFCompareCaseInsensitive) != kCFCompareEqualTo))
 							)
 							{
 								result = false;
@@ -620,6 +635,14 @@ Boolean LLFilePicker::navOpenFilterProc(AEDesc *theItem, void *info, void *callB
 								result = false;
 							}
 						}
+						else if (filter == FFLOAD_SCRIPT)
+						{
+							if (fileInfo.filetype != 'LSL ' &&
+								(fileInfo.extension && (CFStringCompare(fileInfo.extension, CFSTR("lsl"), kCFCompareCaseInsensitive) != kCFCompareEqualTo)) )
+							{
+								result = false;
+							}
+						}
 						
 						if (fileInfo.extension)
 						{
@@ -766,6 +789,12 @@ OSStatus	LLFilePicker::doNavSaveDialog(ESaveFilter filter, const std::string& fi
 			extension = CFSTR(".j2c");
 			break;
 		
+		case FFSAVE_SCRIPT:
+			type = 'LSL ';
+			creator = '\?\?\?\?';
+			extension = CFSTR(".lsl");
+			break;
+		
 		case FFSAVE_ALL:
 		default:
 			type = '\?\?\?\?';
@@ -1046,8 +1075,11 @@ void LLFilePicker::chooser_responder(GtkWidget *widget, gint response, gpointer
 	}
 
 	// set the default path for this usage context.
-	picker->mContextToPathMap[picker->mCurContextName] =
-		gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(widget));
+	const char* cur_folder = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(widget));
+	if (cur_folder != NULL)
+	{
+		picker->mContextToPathMap[picker->mCurContextName] = cur_folder;
+	}
 
 	gtk_widget_destroy(widget);
 	gtk_main_quit();
@@ -1169,10 +1201,14 @@ static std::string add_wav_filter_to_gtkchooser(GtkWindow *picker)
 						    LLTrans::getString("sound_files") + " (*.wav)");
 }
 
-static std::string add_bvh_filter_to_gtkchooser(GtkWindow *picker)
+static std::string add_anim_filter_to_gtkchooser(GtkWindow *picker)
 {
-	return add_simple_pattern_filter_to_gtkchooser(picker,  "*.bvh",
-						       LLTrans::getString("animation_files") + " (*.bvh)");
+	GtkFileFilter *gfilter = gtk_file_filter_new();
+	gtk_file_filter_add_pattern(gfilter, "*.bvh");
+	gtk_file_filter_add_pattern(gfilter, "*.anim");
+	std::string filtername = LLTrans::getString("animation_files") + " (*.bvh; *.anim)";
+	add_common_filters_to_gtkchooser(gfilter, picker, filtername);
+	return filtername;
 }
 
 static std::string add_collada_filter_to_gtkchooser(GtkWindow *picker)
@@ -1192,7 +1228,12 @@ static std::string add_imageload_filter_to_gtkchooser(GtkWindow *picker)
 	add_common_filters_to_gtkchooser(gfilter, picker, filtername);
 	return filtername;
 }
-
+ 
+static std::string add_script_filter_to_gtkchooser(GtkWindow *picker)
+{
+	return add_simple_mime_filter_to_gtkchooser(picker,  "text/plain",
+							LLTrans::getString("script_files") + " (*.lsl)");
+}
 
 BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename )
 {
@@ -1258,6 +1299,10 @@ BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename
 				 LLTrans::getString("compressed_image_files") + " (*.j2c)");
 			suggest_ext = ".j2c";
 			break;
+		case FFSAVE_SCRIPT:
+			caption += add_script_filter_to_gtkchooser(picker);
+			suggest_ext = ".lsl";
+			break;
 		default:;
 			break;
 		}
@@ -1315,7 +1360,7 @@ BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking )
 			filtername = add_wav_filter_to_gtkchooser(picker);
 			break;
 		case FFLOAD_ANIM:
-			filtername = add_bvh_filter_to_gtkchooser(picker);
+			filtername = add_anim_filter_to_gtkchooser(picker);
 			break;
 		case FFLOAD_COLLADA:
 			filtername = add_collada_filter_to_gtkchooser(picker);
@@ -1323,6 +1368,9 @@ BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking )
 		case FFLOAD_IMAGE:
 			filtername = add_imageload_filter_to_gtkchooser(picker);
 			break;
+		case FFLOAD_SCRIPT:
+			filtername = add_script_filter_to_gtkchooser(picker);
+			break;
 		default:;
 			break;
 		}
diff --git a/indra/newview/llfilepicker.h b/indra/newview/llfilepicker.h
index cd843a8f33f322e5cf3a50f44c4eea49fdf22f79..a4d5d68ff58f51ddb93b15266de9856e5eaf492e 100644
--- a/indra/newview/llfilepicker.h
+++ b/indra/newview/llfilepicker.h
@@ -84,6 +84,7 @@ class LLFilePicker
 		FFLOAD_RAW = 8,
 		FFLOAD_MODEL = 9,
 		FFLOAD_COLLADA = 10,
+		FFLOAD_SCRIPT = 11,
 	};
 
 	enum ESaveFilter
@@ -103,6 +104,7 @@ class LLFilePicker
 		FFSAVE_J2C = 12,
 		FFSAVE_PNG = 13,
 		FFSAVE_JPEG = 14,
+		FFSAVE_SCRIPT = 15,
 	};
 
 	// open the dialog. This is a modal operation
diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp
index aa66fcf9b8d0edaa9c893d65159f677c2a40bd3d..0290e7cdf080b6e5b9df5c1203f03f9b1d49f71d 100644
--- a/indra/newview/llfloateravatarpicker.cpp
+++ b/indra/newview/llfloateravatarpicker.cpp
@@ -63,6 +63,11 @@ LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(select_callback_t callback,
 	// *TODO: Use a key to allow this not to be an effective singleton
 	LLFloaterAvatarPicker* floater = 
 		LLFloaterReg::showTypedInstance<LLFloaterAvatarPicker>("avatar_picker");
+	if (!floater)
+	{
+		llwarns << "Cannot instantiate avatar picker" << llendl;
+		return NULL;
+	}
 	
 	floater->mSelectionCallback = callback;
 	floater->setAllowMultiple(allow_multiple);
diff --git a/indra/newview/llfloaterbuildoptions.cpp b/indra/newview/llfloaterbuildoptions.cpp
index 86c1bf0534ed1b4eabe37a0c5cc8accf95a81d9d..1b65d8d68384956703570225742e62a38a955437 100644
--- a/indra/newview/llfloaterbuildoptions.cpp
+++ b/indra/newview/llfloaterbuildoptions.cpp
@@ -41,13 +41,9 @@
 // Methods
 //
 
-void commit_grid_mode(LLUICtrl *);
-
 LLFloaterBuildOptions::LLFloaterBuildOptions(const LLSD& key)
-  : LLFloater(key),
-    mComboGridMode(NULL)
+  : LLFloater(key)
 {
-	mCommitCallbackRegistrar.add("GridOptions.gridMode", boost::bind(&commit_grid_mode,_1));
 }
 
 LLFloaterBuildOptions::~LLFloaterBuildOptions()
@@ -55,45 +51,9 @@ LLFloaterBuildOptions::~LLFloaterBuildOptions()
 
 BOOL LLFloaterBuildOptions::postBuild()
 {
-	mComboGridMode = getChild<LLComboBox>("combobox grid mode");
-
 	return TRUE;
 }
 
-void LLFloaterBuildOptions::setGridMode(EGridMode mode)
-{
-	mComboGridMode->setCurrentByIndex((S32)mode);
-}
-
-void LLFloaterBuildOptions::updateGridMode()
-{
-	if (mComboGridMode)
-	{
-		S32 index = mComboGridMode->getCurrentIndex();
-		mComboGridMode->removeall();
-
-		switch (mObjectSelection->getSelectType())
-		{
-		case SELECT_TYPE_HUD:
-		  mComboGridMode->add(getString("grid_screen_text"));
-		  mComboGridMode->add(getString("grid_local_text"));
-		  break;
-		case SELECT_TYPE_WORLD:
-		  mComboGridMode->add(getString("grid_world_text"));
-		  mComboGridMode->add(getString("grid_local_text"));
-		  mComboGridMode->add(getString("grid_reference_text"));
-		  break;
-		case SELECT_TYPE_ATTACHMENT:
-		  mComboGridMode->add(getString("grid_attachment_text"));
-		  mComboGridMode->add(getString("grid_local_text"));
-		  mComboGridMode->add(getString("grid_reference_text"));
-		  break;
-		}
-
-		mComboGridMode->setCurrentByIndex(index);
-	}
-}
-
 // virtual
 void LLFloaterBuildOptions::onOpen(const LLSD& key)
 {
@@ -105,10 +65,3 @@ void LLFloaterBuildOptions::onClose(bool app_quitting)
 {
 	mObjectSelection = NULL;
 }
-
-void commit_grid_mode(LLUICtrl *ctrl)
-{
-	LLComboBox* combo = (LLComboBox*)ctrl;
-
-	LLSelectMgr::getInstance()->setGridMode((EGridMode)combo->getCurrentIndex());
-}
diff --git a/indra/newview/llfloaterbuildoptions.h b/indra/newview/llfloaterbuildoptions.h
index 7f3811bf1cba1f8fe9948fb189a6f37993a7c69b..02c56cb6a9253a9006350b74bdeec89b80620049 100644
--- a/indra/newview/llfloaterbuildoptions.h
+++ b/indra/newview/llfloaterbuildoptions.h
@@ -35,7 +35,6 @@
 #include "llfloater.h"
 #include "llselectmgr.h"
 
-class LLComboBox;
 class LLObjectSelection;
 
 typedef LLSafeHandle<LLObjectSelection> LLObjectSelectionHandle;
@@ -44,23 +43,17 @@ class LLFloaterBuildOptions
 	:	public LLFloater
 {
 public:
-
 	virtual BOOL postBuild();
 
 	/*virtual*/ void onOpen(const LLSD& key);
 	/*virtual*/	void onClose(bool app_quitting);
 
-	void setGridMode(EGridMode mode);
-	void updateGridMode();
-
 private:
-
 	friend class LLFloaterReg;
 
 	LLFloaterBuildOptions(const LLSD& key);
 	~LLFloaterBuildOptions();
 
-	LLComboBox*	mComboGridMode;
 	LLObjectSelectionHandle	mObjectSelection;
 };
 #endif
diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp
index ee8487b1605c128404772946b4f3b8d3bee4f389..087b0007e19a3a7dd2204c4b53f1ed7c0c315dd1 100644
--- a/indra/newview/llfloaterbuy.cpp
+++ b/indra/newview/llfloaterbuy.cpp
@@ -239,8 +239,9 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj,
 
 		// Compute icon for this item
 		BOOL item_is_multi = FALSE;
-		if ( inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED 
+		if (( inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED
 			|| inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS)
+			&& !(inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK))
 		{
 			item_is_multi = TRUE;
 		}
diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp
index a7388d21a37d2277440f25b2f331b76d9984e24f..bca4b5e447188a64526b73266771923ac3e2b194 100644
--- a/indra/newview/llfloaterbuycontents.cpp
+++ b/indra/newview/llfloaterbuycontents.cpp
@@ -210,7 +210,9 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
 		LLSD row;
 
 		BOOL item_is_multi = FALSE;
-		if ( inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED )
+		if ((inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED
+			|| inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS)
+			&& !(inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK))
 		{
 			item_is_multi = TRUE;
 		}
diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp
similarity index 91%
rename from indra/newview/llfloateranimpreview.cpp
rename to indra/newview/llfloaterbvhpreview.cpp
index 1f334815d6a1e42c56232e051d6f6169cf4758a2..b050a638dcccb3b93a0e26b6c5c0ff2e472bdd30 100644
--- a/indra/newview/llfloateranimpreview.cpp
+++ b/indra/newview/llfloaterbvhpreview.cpp
@@ -1,6 +1,6 @@
 /** 
- * @file llfloateranimpreview.cpp
- * @brief LLFloaterAnimPreview class implementation
+ * @file llfloaterbvhpreview.cpp
+ * @brief LLFloaterBvhPreview class implementation
  *
  * $LicenseInfo:firstyear=2004&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -26,7 +26,7 @@
 
 #include "llviewerprecompiledheaders.h"
 
-#include "llfloateranimpreview.h"
+#include "llfloaterbvhpreview.h"
 
 #include "llbvhloader.h"
 #include "lldatapacker.h"
@@ -115,9 +115,9 @@ std::string STATUS[] =
 };
 
 //-----------------------------------------------------------------------------
-// LLFloaterAnimPreview()
+// LLFloaterBvhPreview()
 //-----------------------------------------------------------------------------
-LLFloaterAnimPreview::LLFloaterAnimPreview(const std::string& filename) : 
+LLFloaterBvhPreview::LLFloaterBvhPreview(const std::string& filename) : 
 	LLFloaterNameDesc(filename)
 {
 	mLastMouseX = 0;
@@ -153,35 +153,35 @@ LLFloaterAnimPreview::LLFloaterAnimPreview(const std::string& filename) :
 //-----------------------------------------------------------------------------
 // setAnimCallbacks()
 //-----------------------------------------------------------------------------
-void LLFloaterAnimPreview::setAnimCallbacks()
+void LLFloaterBvhPreview::setAnimCallbacks()
 {
-	getChild<LLUICtrl>("playback_slider")->setCommitCallback(boost::bind(&LLFloaterAnimPreview::onSliderMove, this));
+	getChild<LLUICtrl>("playback_slider")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onSliderMove, this));
 	
-	getChild<LLUICtrl>("preview_base_anim")->setCommitCallback(boost::bind(&LLFloaterAnimPreview::onCommitBaseAnim, this));
+	getChild<LLUICtrl>("preview_base_anim")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitBaseAnim, this));
 	getChild<LLUICtrl>("preview_base_anim")->setValue("Standing");
 
-	getChild<LLUICtrl>("priority")->setCommitCallback(boost::bind(&LLFloaterAnimPreview::onCommitPriority, this));
-	getChild<LLUICtrl>("loop_check")->setCommitCallback(boost::bind(&LLFloaterAnimPreview::onCommitLoop, this));
-	getChild<LLUICtrl>("loop_in_point")->setCommitCallback(boost::bind(&LLFloaterAnimPreview::onCommitLoopIn, this));
-	getChild<LLUICtrl>("loop_in_point")->setValidateBeforeCommit( boost::bind(&LLFloaterAnimPreview::validateLoopIn, this, _1));
-	getChild<LLUICtrl>("loop_out_point")->setCommitCallback(boost::bind(&LLFloaterAnimPreview::onCommitLoopOut, this));
-	getChild<LLUICtrl>("loop_out_point")->setValidateBeforeCommit( boost::bind(&LLFloaterAnimPreview::validateLoopOut, this, _1));
+	getChild<LLUICtrl>("priority")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitPriority, this));
+	getChild<LLUICtrl>("loop_check")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitLoop, this));
+	getChild<LLUICtrl>("loop_in_point")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitLoopIn, this));
+	getChild<LLUICtrl>("loop_in_point")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateLoopIn, this, _1));
+	getChild<LLUICtrl>("loop_out_point")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitLoopOut, this));
+	getChild<LLUICtrl>("loop_out_point")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateLoopOut, this, _1));
 
-	getChild<LLUICtrl>("hand_pose_combo")->setCommitCallback(boost::bind(&LLFloaterAnimPreview::onCommitHandPose, this));
+	getChild<LLUICtrl>("hand_pose_combo")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitHandPose, this));
 	
-	getChild<LLUICtrl>("emote_combo")->setCommitCallback(boost::bind(&LLFloaterAnimPreview::onCommitEmote, this));
+	getChild<LLUICtrl>("emote_combo")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitEmote, this));
 	getChild<LLUICtrl>("emote_combo")->setValue("[None]");
 
-	getChild<LLUICtrl>("ease_in_time")->setCommitCallback(boost::bind(&LLFloaterAnimPreview::onCommitEaseIn, this));
-	getChild<LLUICtrl>("ease_in_time")->setValidateBeforeCommit( boost::bind(&LLFloaterAnimPreview::validateEaseIn, this, _1));
-	getChild<LLUICtrl>("ease_out_time")->setCommitCallback(boost::bind(&LLFloaterAnimPreview::onCommitEaseOut, this));
-	getChild<LLUICtrl>("ease_out_time")->setValidateBeforeCommit( boost::bind(&LLFloaterAnimPreview::validateEaseOut, this, _1));
+	getChild<LLUICtrl>("ease_in_time")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitEaseIn, this));
+	getChild<LLUICtrl>("ease_in_time")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateEaseIn, this, _1));
+	getChild<LLUICtrl>("ease_out_time")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitEaseOut, this));
+	getChild<LLUICtrl>("ease_out_time")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateEaseOut, this, _1));
 }
 
 //-----------------------------------------------------------------------------
 // postBuild()
 //-----------------------------------------------------------------------------
-BOOL LLFloaterAnimPreview::postBuild()
+BOOL LLFloaterBvhPreview::postBuild()
 {
 	LLKeyframeMotion* motionp = NULL;
 	LLBVHLoader* loaderp = NULL;
@@ -191,7 +191,7 @@ BOOL LLFloaterAnimPreview::postBuild()
 		return FALSE;
 	}
 
-	getChild<LLUICtrl>("name_form")->setCommitCallback(boost::bind(&LLFloaterAnimPreview::onCommitName, this));
+	getChild<LLUICtrl>("name_form")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitName, this));
 
 	childSetAction("ok_btn", onBtnOK, this);
 	setDefaultBtn();
@@ -203,15 +203,15 @@ BOOL LLFloaterAnimPreview::postBuild()
 	mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f);
 
 	mPlayButton = getChild<LLButton>( "play_btn");
-	mPlayButton->setClickedCallback(boost::bind(&LLFloaterAnimPreview::onBtnPlay, this));
+	mPlayButton->setClickedCallback(boost::bind(&LLFloaterBvhPreview::onBtnPlay, this));
 	mPlayButton->setVisible(true);
 
 	mPauseButton = getChild<LLButton>( "pause_btn");
-	mPauseButton->setClickedCallback(boost::bind(&LLFloaterAnimPreview::onBtnPause, this));
+	mPauseButton->setClickedCallback(boost::bind(&LLFloaterBvhPreview::onBtnPause, this));
 	mPauseButton->setVisible(false);
 	
 	mStopButton = getChild<LLButton>( "stop_btn");
-	mStopButton->setClickedCallback(boost::bind(&LLFloaterAnimPreview::onBtnStop, this));
+	mStopButton->setClickedCallback(boost::bind(&LLFloaterBvhPreview::onBtnStop, this));
 
 	getChildView("bad_animation_text")->setVisible(FALSE);
 
@@ -363,9 +363,9 @@ BOOL LLFloaterAnimPreview::postBuild()
 }
 
 //-----------------------------------------------------------------------------
-// LLFloaterAnimPreview()
+// LLFloaterBvhPreview()
 //-----------------------------------------------------------------------------
-LLFloaterAnimPreview::~LLFloaterAnimPreview()
+LLFloaterBvhPreview::~LLFloaterBvhPreview()
 {
 	mAnimPreview = NULL;
 
@@ -375,7 +375,7 @@ LLFloaterAnimPreview::~LLFloaterAnimPreview()
 //-----------------------------------------------------------------------------
 // draw()
 //-----------------------------------------------------------------------------
-void LLFloaterAnimPreview::draw()
+void LLFloaterBvhPreview::draw()
 {
 	LLFloater::draw();
 	LLRect r = getRect();
@@ -414,7 +414,7 @@ void LLFloaterAnimPreview::draw()
 //-----------------------------------------------------------------------------
 // resetMotion()
 //-----------------------------------------------------------------------------
-void LLFloaterAnimPreview::resetMotion()
+void LLFloaterBvhPreview::resetMotion()
 {
 	LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
 	BOOL paused = avatarp->areAnimationsPaused();
@@ -450,7 +450,7 @@ void LLFloaterAnimPreview::resetMotion()
 //-----------------------------------------------------------------------------
 // handleMouseDown()
 //-----------------------------------------------------------------------------
-BOOL LLFloaterAnimPreview::handleMouseDown(S32 x, S32 y, MASK mask)
+BOOL LLFloaterBvhPreview::handleMouseDown(S32 x, S32 y, MASK mask)
 {
 	if (mPreviewRect.pointInRect(x, y))
 	{
@@ -468,7 +468,7 @@ BOOL LLFloaterAnimPreview::handleMouseDown(S32 x, S32 y, MASK mask)
 //-----------------------------------------------------------------------------
 // handleMouseUp()
 //-----------------------------------------------------------------------------
-BOOL LLFloaterAnimPreview::handleMouseUp(S32 x, S32 y, MASK mask)
+BOOL LLFloaterBvhPreview::handleMouseUp(S32 x, S32 y, MASK mask)
 {
 	gFocusMgr.setMouseCapture(FALSE);
 	gViewerWindow->showCursor();
@@ -478,7 +478,7 @@ BOOL LLFloaterAnimPreview::handleMouseUp(S32 x, S32 y, MASK mask)
 //-----------------------------------------------------------------------------
 // handleHover()
 //-----------------------------------------------------------------------------
-BOOL LLFloaterAnimPreview::handleHover(S32 x, S32 y, MASK mask)
+BOOL LLFloaterBvhPreview::handleHover(S32 x, S32 y, MASK mask)
 {
 	MASK local_mask = mask & ~MASK_ALT;
 
@@ -533,7 +533,7 @@ BOOL LLFloaterAnimPreview::handleHover(S32 x, S32 y, MASK mask)
 //-----------------------------------------------------------------------------
 // handleScrollWheel()
 //-----------------------------------------------------------------------------
-BOOL LLFloaterAnimPreview::handleScrollWheel(S32 x, S32 y, S32 clicks)
+BOOL LLFloaterBvhPreview::handleScrollWheel(S32 x, S32 y, S32 clicks)
 {
 	mAnimPreview->zoom((F32)clicks * -0.2f);
 	mAnimPreview->requestUpdate();
@@ -544,7 +544,7 @@ BOOL LLFloaterAnimPreview::handleScrollWheel(S32 x, S32 y, S32 clicks)
 //-----------------------------------------------------------------------------
 // onMouseCaptureLost()
 //-----------------------------------------------------------------------------
-void LLFloaterAnimPreview::onMouseCaptureLost()
+void LLFloaterBvhPreview::onMouseCaptureLost()
 {
 	gViewerWindow->showCursor();
 }
@@ -552,7 +552,7 @@ void LLFloaterAnimPreview::onMouseCaptureLost()
 //-----------------------------------------------------------------------------
 // onBtnPlay()
 //-----------------------------------------------------------------------------
-void LLFloaterAnimPreview::onBtnPlay()
+void LLFloaterBvhPreview::onBtnPlay()
 {
 	if (!getEnabled())
 		return;
@@ -576,7 +576,7 @@ void LLFloaterAnimPreview::onBtnPlay()
 //-----------------------------------------------------------------------------
 // onBtnPause()
 //-----------------------------------------------------------------------------
-void LLFloaterAnimPreview::onBtnPause()
+void LLFloaterBvhPreview::onBtnPause()
 {
 	if (!getEnabled())
 		return;
@@ -598,7 +598,7 @@ void LLFloaterAnimPreview::onBtnPause()
 //-----------------------------------------------------------------------------
 // onBtnStop()
 //-----------------------------------------------------------------------------
-void LLFloaterAnimPreview::onBtnStop()
+void LLFloaterBvhPreview::onBtnStop()
 {
 	if (!getEnabled())
 		return;
@@ -614,7 +614,7 @@ void LLFloaterAnimPreview::onBtnStop()
 //-----------------------------------------------------------------------------
 // onSliderMove()
 //-----------------------------------------------------------------------------
-void LLFloaterAnimPreview::onSliderMove()
+void LLFloaterBvhPreview::onSliderMove()
 {
 	if (!getEnabled())
 		return;
@@ -639,7 +639,7 @@ void LLFloaterAnimPreview::onSliderMove()
 //-----------------------------------------------------------------------------
 // onCommitBaseAnim()
 //-----------------------------------------------------------------------------
-void LLFloaterAnimPreview::onCommitBaseAnim()
+void LLFloaterBvhPreview::onCommitBaseAnim()
 {
 	if (!getEnabled())
 		return;
@@ -668,7 +668,7 @@ void LLFloaterAnimPreview::onCommitBaseAnim()
 //-----------------------------------------------------------------------------
 // onCommitLoop()
 //-----------------------------------------------------------------------------
-void LLFloaterAnimPreview::onCommitLoop()
+void LLFloaterBvhPreview::onCommitLoop()
 {
 	if (!getEnabled())
 		return;
@@ -687,7 +687,7 @@ void LLFloaterAnimPreview::onCommitLoop()
 //-----------------------------------------------------------------------------
 // onCommitLoopIn()
 //-----------------------------------------------------------------------------
-void LLFloaterAnimPreview::onCommitLoopIn()
+void LLFloaterBvhPreview::onCommitLoopIn()
 {
 	if (!getEnabled())
 		return;
@@ -707,7 +707,7 @@ void LLFloaterAnimPreview::onCommitLoopIn()
 //-----------------------------------------------------------------------------
 // onCommitLoopOut()
 //-----------------------------------------------------------------------------
-void LLFloaterAnimPreview::onCommitLoopOut()
+void LLFloaterBvhPreview::onCommitLoopOut()
 {
 	if (!getEnabled())
 		return;
@@ -727,7 +727,7 @@ void LLFloaterAnimPreview::onCommitLoopOut()
 //-----------------------------------------------------------------------------
 // onCommitName()
 //-----------------------------------------------------------------------------
-void LLFloaterAnimPreview::onCommitName()
+void LLFloaterBvhPreview::onCommitName()
 {
 	if (!getEnabled())
 		return;
@@ -746,7 +746,7 @@ void LLFloaterAnimPreview::onCommitName()
 //-----------------------------------------------------------------------------
 // onCommitHandPose()
 //-----------------------------------------------------------------------------
-void LLFloaterAnimPreview::onCommitHandPose()
+void LLFloaterBvhPreview::onCommitHandPose()
 {
 	if (!getEnabled())
 		return;
@@ -757,7 +757,7 @@ void LLFloaterAnimPreview::onCommitHandPose()
 //-----------------------------------------------------------------------------
 // onCommitEmote()
 //-----------------------------------------------------------------------------
-void LLFloaterAnimPreview::onCommitEmote()
+void LLFloaterBvhPreview::onCommitEmote()
 {
 	if (!getEnabled())
 		return;
@@ -768,7 +768,7 @@ void LLFloaterAnimPreview::onCommitEmote()
 //-----------------------------------------------------------------------------
 // onCommitPriority()
 //-----------------------------------------------------------------------------
-void LLFloaterAnimPreview::onCommitPriority()
+void LLFloaterBvhPreview::onCommitPriority()
 {
 	if (!getEnabled())
 		return;
@@ -782,7 +782,7 @@ void LLFloaterAnimPreview::onCommitPriority()
 //-----------------------------------------------------------------------------
 // onCommitEaseIn()
 //-----------------------------------------------------------------------------
-void LLFloaterAnimPreview::onCommitEaseIn()
+void LLFloaterBvhPreview::onCommitEaseIn()
 {
 	if (!getEnabled())
 		return;
@@ -797,7 +797,7 @@ void LLFloaterAnimPreview::onCommitEaseIn()
 //-----------------------------------------------------------------------------
 // onCommitEaseOut()
 //-----------------------------------------------------------------------------
-void LLFloaterAnimPreview::onCommitEaseOut()
+void LLFloaterBvhPreview::onCommitEaseOut()
 {
 	if (!getEnabled())
 		return;
@@ -812,7 +812,7 @@ void LLFloaterAnimPreview::onCommitEaseOut()
 //-----------------------------------------------------------------------------
 // validateEaseIn()
 //-----------------------------------------------------------------------------
-bool LLFloaterAnimPreview::validateEaseIn(const LLSD& data)
+bool LLFloaterBvhPreview::validateEaseIn(const LLSD& data)
 {
 	if (!getEnabled())
 		return false;
@@ -832,7 +832,7 @@ bool LLFloaterAnimPreview::validateEaseIn(const LLSD& data)
 //-----------------------------------------------------------------------------
 // validateEaseOut()
 //-----------------------------------------------------------------------------
-bool LLFloaterAnimPreview::validateEaseOut(const LLSD& data)
+bool LLFloaterBvhPreview::validateEaseOut(const LLSD& data)
 {
 	if (!getEnabled())
 		return false;
@@ -852,7 +852,7 @@ bool LLFloaterAnimPreview::validateEaseOut(const LLSD& data)
 //-----------------------------------------------------------------------------
 // validateLoopIn()
 //-----------------------------------------------------------------------------
-bool LLFloaterAnimPreview::validateLoopIn(const LLSD& data)
+bool LLFloaterBvhPreview::validateLoopIn(const LLSD& data)
 {
 	if (!getEnabled())
 		return false;
@@ -880,7 +880,7 @@ bool LLFloaterAnimPreview::validateLoopIn(const LLSD& data)
 //-----------------------------------------------------------------------------
 // validateLoopOut()
 //-----------------------------------------------------------------------------
-bool LLFloaterAnimPreview::validateLoopOut(const LLSD& data)
+bool LLFloaterBvhPreview::validateLoopOut(const LLSD& data)
 {
 	if (!getEnabled())
 		return false;
@@ -909,7 +909,7 @@ bool LLFloaterAnimPreview::validateLoopOut(const LLSD& data)
 //-----------------------------------------------------------------------------
 // refresh()
 //-----------------------------------------------------------------------------
-void LLFloaterAnimPreview::refresh()
+void LLFloaterBvhPreview::refresh()
 {
 	// Are we showing the play button (default) or the pause button?
 	bool show_play = true;
@@ -958,9 +958,9 @@ void LLFloaterAnimPreview::refresh()
 //-----------------------------------------------------------------------------
 // onBtnOK()
 //-----------------------------------------------------------------------------
-void LLFloaterAnimPreview::onBtnOK(void* userdata)
+void LLFloaterBvhPreview::onBtnOK(void* userdata)
 {
-	LLFloaterAnimPreview* floaterp = (LLFloaterAnimPreview*)userdata;
+	LLFloaterBvhPreview* floaterp = (LLFloaterBvhPreview*)userdata;
 	if (!floaterp->getEnabled()) return;
 
 	if (floaterp->mAnimPreview)
@@ -1063,14 +1063,19 @@ BOOL	LLPreviewAnimation::render()
 	mNeedsUpdate = FALSE;
 	LLVOAvatar* avatarp = mDummyAvatar;
 	
-	glMatrixMode(GL_PROJECTION);
+	gGL.matrixMode(LLRender::MM_PROJECTION);
 	gGL.pushMatrix();
-	glLoadIdentity();
-	glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
+	gGL.loadIdentity();
+	gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
 
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.pushMatrix();
-	glLoadIdentity();
+	gGL.loadIdentity();
+
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		gUIProgram.bind();
+	}
 
 	LLGLSUIDefault def;
 	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -1078,10 +1083,10 @@ BOOL	LLPreviewAnimation::render()
 
 	gl_rect_2d_simple( mFullWidth, mFullHeight );
 
-	glMatrixMode(GL_PROJECTION);
+	gGL.matrixMode(LLRender::MM_PROJECTION);
 	gGL.popMatrix();
 
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.popMatrix();
 
 	gGL.flush();
diff --git a/indra/newview/llfloateranimpreview.h b/indra/newview/llfloaterbvhpreview.h
similarity index 90%
rename from indra/newview/llfloateranimpreview.h
rename to indra/newview/llfloaterbvhpreview.h
index f1ffb6547f2aabd3e1bf610013a1eaaa7c5b4a51..b81cc6e3a51649cbdadeeeef78ad9db0e8bcef88 100644
--- a/indra/newview/llfloateranimpreview.h
+++ b/indra/newview/llfloaterbvhpreview.h
@@ -1,6 +1,6 @@
 /** 
- * @file llfloateranimpreview.h
- * @brief LLFloaterAnimPreview class definition
+ * @file llfloaterbvhpreview.h
+ * @brief LLFloaterBvhPreview class definition
  *
  * $LicenseInfo:firstyear=2004&license=viewerlgpl$
  * Second Life Viewer Source Code
@@ -24,14 +24,15 @@
  * $/LicenseInfo$
  */
 
-#ifndef LL_LLFLOATERANIMPREVIEW_H
-#define LL_LLFLOATERANIMPREVIEW_H
+#ifndef LL_LLFLOATERBVHPREVIEW_H
+#define LL_LLFLOATERBVHPREVIEW_H
 
 #include "llassettype.h"
 #include "llfloaternamedesc.h"
 #include "lldynamictexture.h"
 #include "llcharacter.h"
 #include "llquaternion.h"
+#include "llextendedstatus.h"
 
 class LLVOAvatar;
 class LLViewerJointMesh;
@@ -67,11 +68,11 @@ class LLPreviewAnimation : public LLViewerDynamicTexture
 	LLPointer<LLVOAvatar>			mDummyAvatar;
 };
 
-class LLFloaterAnimPreview : public LLFloaterNameDesc
+class LLFloaterBvhPreview : public LLFloaterNameDesc
 {
 public:
-	LLFloaterAnimPreview(const std::string& filename);
-	virtual ~LLFloaterAnimPreview();
+	LLFloaterBvhPreview(const std::string& filename);
+	virtual ~LLFloaterBvhPreview();
 	
 	BOOL postBuild();
 
@@ -128,4 +129,4 @@ class LLFloaterAnimPreview : public LLFloaterNameDesc
 	std::map<std::string, LLUUID>	mIDList;
 };
 
-#endif  // LL_LLFLOATERANIMPREVIEW_H
+#endif  // LL_LLFLOATERBVHPREVIEW_H
diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp
index b33dea4890fabbe6bfb219b15781f341539c3944..21b58d3e3dcf2f0c7115a57f9a48da6bbbf3f000 100644
--- a/indra/newview/llfloatercamera.cpp
+++ b/indra/newview/llfloatercamera.cpp
@@ -346,7 +346,7 @@ LLFloaterCamera::LLFloaterCamera(const LLSD& val)
 	mCurrMode(CAMERA_CTRL_MODE_PAN),
 	mPrevMode(CAMERA_CTRL_MODE_PAN)
 {
-	LLHints::registerHintTarget("view_popup", LLView::getHandle());
+	LLHints::registerHintTarget("view_popup", getHandle());
 	mCommitCallbackRegistrar.add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraItem, _2));
 }
 
@@ -433,26 +433,6 @@ void LLFloaterCamera::setMode(ECameraControlMode mode)
 	updateState();
 }
 
-void LLFloaterCamera::setModeTitle(const ECameraControlMode mode)
-{
-	std::string title; 
-	switch(mode)
-	{
-	case CAMERA_CTRL_MODE_MODES:
-		title = getString("camera_modes_title");
-		break;
-	case CAMERA_CTRL_MODE_PAN:
-		title = getString("pan_mode_title");
-		break;
-	case CAMERA_CTRL_MODE_PRESETS:
-		title = getString("presets_mode_title");
-		break;
-	default:
-		break;
-	}
-	setTitle(title);
-}
-
 void LLFloaterCamera::switchMode(ECameraControlMode mode)
 {
 	setMode(mode);
@@ -532,7 +512,6 @@ void LLFloaterCamera::updateState()
 	{
 		iter->second->setToggleState(iter->first == mCurrMode);
 	}
-	setModeTitle(mCurrMode);
 }
 
 void LLFloaterCamera::updateItemsSelection()
diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h
index 4572932853c86ac7c5e6773b123500cc36e13c5d..4d6d03f22d9078e150720bf44b6ee3fdba7753c1 100644
--- a/indra/newview/llfloatercamera.h
+++ b/indra/newview/llfloatercamera.h
@@ -102,9 +102,6 @@ class LLFloaterCamera : public LLFloater
 	/* sets a new mode preserving previous one and updates ui*/
 	void setMode(ECameraControlMode mode);
 
-	/** set title appropriate to passed mode */
-	void setModeTitle(const ECameraControlMode mode);
-
 	/* updates the state (UI) according to the current mode */
 	void updateState();
 
diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp
deleted file mode 100644
index 2679dbb78bac04165b7b9564f9b6f7ef9aa77308..0000000000000000000000000000000000000000
--- a/indra/newview/llfloaterchat.cpp
+++ /dev/null
@@ -1,485 +0,0 @@
-/** 
- * @file llfloaterchat.cpp
- * @brief LLFloaterChat class implementation
- *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-/**
- * Actually the "Chat History" floater.
- * Should be llfloaterchathistory, not llfloaterchat.
- */
-
-#include "llviewerprecompiledheaders.h"
-
-// project include
-#include "llagent.h"
-#include "llappviewer.h"
-#include "llbutton.h"
-#include "llcheckboxctrl.h"
-#include "llcombobox.h"
-#include "llconsole.h"
-#include "llfloateractivespeakers.h"
-#include "llfloaterchatterbox.h"
-#include "llfloaterreg.h"
-#include "llfloaterscriptdebug.h"
-#include "llkeyboard.h"
-//#include "lllineeditor.h"
-#include "llmutelist.h"
-//#include "llresizehandle.h"
-#include "llchatbar.h"
-#include "llrecentpeople.h"
-#include "llpanelblockedlist.h"
-#include "llslurl.h"
-#include "llstatusbar.h"
-#include "llviewertexteditor.h"
-#include "llviewergesture.h"			// for triggering gestures
-#include "llviewermessage.h"
-#include "llviewerwindow.h"
-#include "llviewercontrol.h"
-#include "lluictrlfactory.h"
-#include "lllogchat.h"
-#include "lltexteditor.h"
-#include "lltextparser.h"
-#include "llweb.h"
-#include "llstylemap.h"
-
-// linden library includes
-#include "llaudioengine.h"
-#include "llchat.h"
-#include "llfontgl.h"
-#include "llrect.h"
-#include "llerror.h"
-#include "llstring.h"
-#include "llwindow.h"
-#include "message.h"
-
-//
-// Constants
-//
-const F32 INSTANT_MSG_SIZE = 8.0f;
-const F32 CHAT_MSG_SIZE = 8.0f;
-
-
-//
-// Global statics
-//
-LLColor4 get_text_color(const LLChat& chat);
-
-//
-// Member Functions
-//
-LLFloaterChat::LLFloaterChat(const LLSD& seed)
-	: LLFloater(seed),
-	  mPanel(NULL)
-{
-	mFactoryMap["chat_panel"] = LLCallbackMap(createChatPanel, NULL);
-	mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, NULL);
-	//Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this,"floater_chat_history.xml");
-
-}
-
-LLFloaterChat::~LLFloaterChat()
-{
-	// Children all cleaned up by default view destructor.
-}
-
-void LLFloaterChat::draw()
-{
-	// enable say and shout only when text available
-		
-	childSetValue("toggle_active_speakers_btn", childIsVisible("active_speakers_panel"));
-
-	LLChatBar* chat_barp = findChild<LLChatBar>("chat_panel", TRUE);
-	if (chat_barp)
-	{
-		chat_barp->refresh();
-	}
-
-	mPanel->refreshSpeakers();
-	LLFloater::draw();
-}
-
-BOOL LLFloaterChat::postBuild()
-{
-	// Hide the chat overlay when our history is visible.
-	setVisibleCallback(boost::bind(&LLFloaterChat::updateConsoleVisibility, this));
-	
-	mPanel = (LLPanelActiveSpeakers*)getChild<LLPanel>("active_speakers_panel");
-
-	childSetCommitCallback("show mutes",onClickToggleShowMute,this); //show mutes
-	childSetVisible("Chat History Editor with mute",FALSE);
-	childSetAction("toggle_active_speakers_btn", onClickToggleActiveSpeakers, this);
-
-	return TRUE;
-}
-
-void LLFloaterChat::updateConsoleVisibility()
-{
-	if(gDisconnected)
-	{
-		return;
-	}
-	// determine whether we should show console due to not being visible
-	gConsole->setVisible( !isInVisibleChain()								// are we not in part of UI being drawn?
-							|| isMinimized()								// are we minimized?
-							|| (getHost() && getHost()->isMinimized() ));	// are we hosted in a minimized floater?
-}
-
-void add_timestamped_line(LLViewerTextEditor* edit, LLChat chat, const LLColor4& color)
-{
-	std::string line = chat.mText;
-	bool prepend_newline = true;
-	if (gSavedSettings.getBOOL("ChatShowTimestamps"))
-	{
-		edit->appendTime(prepend_newline);
-		prepend_newline = false;
-	}
-
-	// If the msg is from an agent (not yourself though),
-	// extract out the sender name and replace it with the hotlinked name.
-	if (chat.mSourceType == CHAT_SOURCE_AGENT &&
-		chat.mFromID != LLUUID::null)
-	{
-		chat.mURL = LLSLURL("agent", chat.mFromID, "inspect").getSLURLString();
-	}
-
-	// If the chat line has an associated url, link it up to the name.
-	if (!chat.mURL.empty()
-		&& (line.length() > chat.mFromName.length() && line.find(chat.mFromName,0) == 0))
-	{
-		std::string start_line = line.substr(0, chat.mFromName.length() + 1);
-		line = line.substr(chat.mFromName.length() + 1);
-		edit->appendText(start_line, prepend_newline, LLStyleMap::instance().lookup(chat.mFromID,chat.mURL));
-		edit->blockUndo();
-		prepend_newline = false;
-	}
-	edit->appendText(line, prepend_newline, LLStyle::Params().color(color));
-	edit->blockUndo();
-}
-
-// static
-void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file)
-{	
-	if (log_to_file && (gSavedPerAccountSettings.getBOOL("LogChat"))) 
-	{
-		if (chat.mChatType != CHAT_TYPE_WHISPER && chat.mChatType != CHAT_TYPE_SHOUT)
-		{
-			LLLogChat::saveHistory("chat", chat.mFromName, chat.mFromID, chat.mText);
-		}
-		else
-		{
-			LLLogChat::saveHistory("chat", "", chat.mFromID, chat.mFromName + " " + chat.mText);
-		}
-	}
-	
-	LLColor4 color = get_text_color(chat);
-	
-	if (!log_to_file) color = LLColor4::grey;	//Recap from log file.
-
-	if (chat.mChatType == CHAT_TYPE_DEBUG_MSG)
-	{
-		if(gSavedSettings.getBOOL("ShowScriptErrors") == FALSE)
-			return;
-		if (gSavedSettings.getS32("ShowScriptErrorsLocation") == 1)
-		{
-			LLFloaterScriptDebug::addScriptLine(chat.mText,
-												chat.mFromName, 
-												color, 
-												chat.mFromID);
-			return;
-		}
-	}
-	
-	// could flash the chat button in the status bar here. JC
-	LLFloaterChat* chat_floater = LLFloaterChat::getInstance();
-	LLViewerTextEditor*	history_editor = chat_floater->getChild<LLViewerTextEditor>("Chat History Editor");
-	LLViewerTextEditor*	history_editor_with_mute = chat_floater->getChild<LLViewerTextEditor>("Chat History Editor with mute");
-
-	if (!chat.mMuted)
-	{
-		add_timestamped_line(history_editor, chat, color);
-		add_timestamped_line(history_editor_with_mute, chat, color);
-	}
-	else
-	{
-		// desaturate muted chat
-		LLColor4 muted_color = lerp(color, LLColor4::grey, 0.5f);
-		add_timestamped_line(history_editor_with_mute, chat, color);
-	}
-	
-	// add objects as transient speakers that can be muted
-	if (chat.mSourceType == CHAT_SOURCE_OBJECT)
-	{
-		chat_floater->mPanel->setSpeaker(chat.mFromID, chat.mFromName, LLSpeaker::STATUS_NOT_IN_CHANNEL, LLSpeaker::SPEAKER_OBJECT);
-	}
-
-	// start tab flashing on incoming text from other users (ignoring system text, etc)
-	if (!chat_floater->isInVisibleChain() && chat.mSourceType == CHAT_SOURCE_AGENT)
-	{
-		LLFloaterChatterBox::getInstance()->setFloaterFlashing(chat_floater, TRUE);
-	}
-}
-
-// static
-void LLFloaterChat::setHistoryCursorAndScrollToEnd()
-{
-	LLViewerTextEditor*	history_editor = LLFloaterChat::getInstance()->getChild<LLViewerTextEditor>("Chat History Editor");
-	LLViewerTextEditor*	history_editor_with_mute = LLFloaterChat::getInstance()->getChild<LLViewerTextEditor>("Chat History Editor with mute");
-	
-	if (history_editor) 
-	{
-		history_editor->setCursorAndScrollToEnd();
-	}
-	if (history_editor_with_mute)
-	{
-		 history_editor_with_mute->setCursorAndScrollToEnd();
-	}
-}
-
-
-//static 
-void LLFloaterChat::onClickMute(void *data)
-{
-	LLFloaterChat* self = (LLFloaterChat*)data;
-
-	LLComboBox*	chatter_combo = self->getChild<LLComboBox>("chatter combobox");
-
-	const std::string& name = chatter_combo->getSimple();
-	LLUUID id = chatter_combo->getCurrentID();
-
-	if (name.empty()) return;
-
-	LLMute mute(id);
-	mute.setFromDisplayName(name);
-	LLMuteList::getInstance()->add(mute);
-	LLPanelBlockedList::showPanelAndSelect(mute.mID);
-}
-
-//static
-void LLFloaterChat::onClickToggleShowMute(LLUICtrl* caller, void *data)
-{
-	LLFloaterChat* floater = (LLFloaterChat*)data;
-
-
-	//LLCheckBoxCtrl*	
-	BOOL show_mute = floater->getChild<LLCheckBoxCtrl>("show mutes")->get();
-	LLViewerTextEditor*	history_editor = floater->getChild<LLViewerTextEditor>("Chat History Editor");
-	LLViewerTextEditor*	history_editor_with_mute = floater->getChild<LLViewerTextEditor>("Chat History Editor with mute");
-
-	if (!history_editor || !history_editor_with_mute)
-		return;
-
-	//BOOL show_mute = floater->mShowMuteCheckBox->get();
-	if (show_mute)
-	{
-		history_editor->setVisible(FALSE);
-		history_editor_with_mute->setVisible(TRUE);
-		history_editor_with_mute->setCursorAndScrollToEnd();
-	}
-	else
-	{
-		history_editor->setVisible(TRUE);
-		history_editor_with_mute->setVisible(FALSE);
-		history_editor->setCursorAndScrollToEnd();
-	}
-}
-
-// Put a line of chat in all the right places
-void LLFloaterChat::addChat(const LLChat& chat, BOOL local_agent)
-{
-	triggerAlerts(chat.mText);
-
-	// Add the sender to the list of people with which we've recently interacted.
-	// this is not the best place to add _all_ messages to recent list
-	// comment this for now, may remove later on code cleanup
-	//if(chat.mSourceType == CHAT_SOURCE_AGENT && chat.mFromID.notNull())
-	//	LLRecentPeople::instance().add(chat.mFromID);
-	
-	addChatHistory(chat, true);
-}
-
-// Moved from lltextparser.cpp to break llui/llaudio library dependency.
-//static
-void LLFloaterChat::triggerAlerts(const std::string& text)
-{
-	LLTextParser* parser = LLTextParser::getInstance();
-//    bool spoken=FALSE;
-	for (S32 i=0;i<parser->mHighlights.size();i++)
-	{
-		LLSD& highlight = parser->mHighlights[i];
-		if (parser->findPattern(text,highlight) >= 0 )
-		{
-			if(gAudiop)
-			{
-				if ((std::string)highlight["sound_lluuid"] != LLUUID::null.asString())
-				{
-					gAudiop->triggerSound(highlight["sound_lluuid"].asUUID(), 
-						gAgent.getID(),
-						1.f,
-						LLAudioEngine::AUDIO_TYPE_UI,
-						gAgent.getPositionGlobal() );
-				}
-/*				
-				if (!spoken) 
-				{
-					LLTextToSpeech* text_to_speech = NULL;
-					text_to_speech = LLTextToSpeech::getInstance();
-					spoken = text_to_speech->speak((LLString)highlight["voice"],text); 
-				}
- */
-			}
-			if (highlight["flash"])
-			{
-				LLWindow* viewer_window = gViewerWindow->getWindow();
-				if (viewer_window && viewer_window->getMinimized())
-				{
-					viewer_window->flashIcon(5.f);
-				}
-			}
-		}
-	}
-}
-
-LLColor4 get_text_color(const LLChat& chat)
-{
-	LLColor4 text_color;
-
-	if(chat.mMuted)
-	{
-		text_color.setVec(0.8f, 0.8f, 0.8f, 1.f);
-	}
-	else
-	{
-		switch(chat.mSourceType)
-		{
-		case CHAT_SOURCE_SYSTEM:
-			text_color = LLUIColorTable::instance().getColor("SystemChatColor");
-			break;
-		case CHAT_SOURCE_AGENT:
-		    if (chat.mFromID.isNull())
-			{
-				text_color = LLUIColorTable::instance().getColor("SystemChatColor");
-			}
-			else
-			{
-				if(gAgent.getID() == chat.mFromID)
-				{
-					text_color = LLUIColorTable::instance().getColor("UserChatColor");
-				}
-				else
-				{
-					text_color = LLUIColorTable::instance().getColor("AgentChatColor");
-				}
-			}
-			break;
-		case CHAT_SOURCE_OBJECT:
-			if (chat.mChatType == CHAT_TYPE_DEBUG_MSG)
-			{
-				text_color = LLUIColorTable::instance().getColor("ScriptErrorColor");
-			}
-			else if ( chat.mChatType == CHAT_TYPE_OWNER )
-			{
-				text_color = LLUIColorTable::instance().getColor("llOwnerSayChatColor");
-			}
-			else
-			{
-				text_color = LLUIColorTable::instance().getColor("ObjectChatColor");
-			}
-			break;
-		default:
-			text_color.setToWhite();
-		}
-
-		if (!chat.mPosAgent.isExactlyZero())
-		{
-			LLVector3 pos_agent = gAgent.getPositionAgent();
-			F32 distance_squared = dist_vec_squared(pos_agent, chat.mPosAgent);
-			F32 dist_near_chat = gAgent.getNearChatRadius();
-			if (distance_squared > dist_near_chat * dist_near_chat)
-			{
-				// diminish far-off chat
-				text_color.mV[VALPHA] = 0.8f;
-			}
-		}
-	}
-
-	return text_color;
-}
-
-//static
-void LLFloaterChat::loadHistory()
-{
-	LLLogChat::loadHistory(std::string("chat"), &chatFromLogFile, (void *)LLFloaterChat::getInstance()); 
-}
-
-//static
-void LLFloaterChat::chatFromLogFile(LLLogChat::ELogLineType type , const LLSD& line, void* userdata)
-{
-	switch (type)
-	{
-	case LLLogChat::LOG_EMPTY:
-	case LLLogChat::LOG_END:
-		// *TODO: nice message from XML file here
-		break;
-	case LLLogChat::LOG_LINE:
-	case LLLogChat::LOG_LLSD:
-		{
-			LLChat chat;					
-			chat.mText = line["message"].asString();
-			get_text_color(chat);
-			addChatHistory(chat,  FALSE);
-		}
-		break;
-	default:
-		// nothing
-		break;
-	}
-}
-
-//static
-void* LLFloaterChat::createSpeakersPanel(void* data)
-{
-	return new LLPanelActiveSpeakers(LLLocalSpeakerMgr::getInstance(), TRUE);
-}
-
-//static
-void* LLFloaterChat::createChatPanel(void* data)
-{
-	LLChatBar* chatp = new LLChatBar();
-	return chatp;
-}
-
-// static
-void LLFloaterChat::onClickToggleActiveSpeakers(void* userdata)
-{
-	LLFloaterChat* self = (LLFloaterChat*)userdata;
-
-	self->childSetVisible("active_speakers_panel", !self->childIsVisible("active_speakers_panel"));
-}
-
-//static
- LLFloaterChat* LLFloaterChat::getInstance()
- {
-	 return LLFloaterReg::getTypedInstance<LLFloaterChat>("chat", LLSD()) ;
-	 
- }
diff --git a/indra/newview/llfloaterchat.h b/indra/newview/llfloaterchat.h
deleted file mode 100644
index fb2aabbfdf7f6be441472fec19937478c7d6d41a..0000000000000000000000000000000000000000
--- a/indra/newview/llfloaterchat.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/** 
- * @file llfloaterchat.h
- * @brief LLFloaterChat class definition
- *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-/*
- * Actually the "Chat History" floater.
- * Should be llfloaterchathistory, not llfloaterchat.
- */
-
-#ifndef LL_LLFLOATERCHAT_H
-#define LL_LLFLOATERCHAT_H
-
-#include "llfloater.h"
-#include "lllogchat.h"
-
-class LLChat;
-class LLPanelActiveSpeakers;
-class LLLogChat;
-
-class LLFloaterChat : public LLFloater
-{
-public:
-	LLFloaterChat(const LLSD& seed);
-	~LLFloaterChat();
-
-	virtual void draw();
-	virtual BOOL postBuild();
-
-	void updateConsoleVisibility();
-
-	static void setHistoryCursorAndScrollToEnd();
-
-	//  *TODO:Skinning - move these to LLChat (or LLViewerChat?)
-	// Add chat to console and history list.
-	// Color based on source, type, distance.
-	static void addChat(const LLChat& chat, BOOL local_agent = FALSE);
-	// Add chat to history alone.
-	static void addChatHistory(const LLChat& chat, bool log_to_file = true);
-	
-	static void triggerAlerts(const std::string& text);
-
-	static void onClickMute(void *data);
-	static void onClickToggleShowMute(LLUICtrl* caller, void *data);
-	static void onClickToggleActiveSpeakers(void* userdata);
-	static void chatFromLogFile(LLLogChat::ELogLineType type, const LLSD& line, void* userdata);
-	static void loadHistory();
-	static void* createSpeakersPanel(void* data);
-	static void* createChatPanel(void* data);
-	
-	static LLFloaterChat* getInstance(); // *TODO:Skinning Deprecate
-	
-	LLPanelActiveSpeakers* mPanel;
-	BOOL mScrolledToEnd;
-};
-
-#endif
diff --git a/indra/newview/llfloaterchatterbox.cpp b/indra/newview/llfloaterchatterbox.cpp
deleted file mode 100644
index dc33e45dd46e2e76673b079b348ae91e07b3b3f2..0000000000000000000000000000000000000000
--- a/indra/newview/llfloaterchatterbox.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-/** 
- * @file llfloaterchatterbox.cpp
- * @author Richard
- * @date 2007-05-08
- * @brief Implementation of the chatterbox integrated conversation ui
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-
-#include "llviewerprecompiledheaders.h"
-
-#include "llfloaterreg.h"
-#include "llfloaterchatterbox.h"
-#include "lluictrlfactory.h"
-#include "llfloaterfriends.h"
-#include "llfloatergroups.h"
-#include "llviewercontrol.h"
-#include "llvoicechannel.h"
-#include "llimpanel.h"
-#include "llimview.h"
-
-//
-// LLFloaterMyFriends
-//
-
-LLFloaterMyFriends::LLFloaterMyFriends(const LLSD& seed)
-	: LLFloater(seed)
-{
-	mFactoryMap["friends_panel"] = LLCallbackMap(LLFloaterMyFriends::createFriendsPanel, NULL);
-	mFactoryMap["groups_panel"] = LLCallbackMap(LLFloaterMyFriends::createGroupsPanel, NULL);
-	//Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_my_friends.xml");
-}
-
-LLFloaterMyFriends::~LLFloaterMyFriends()
-{
-}
-
-BOOL LLFloaterMyFriends::postBuild()
-{
-	return TRUE;
-}
-
-void LLFloaterMyFriends::onOpen(const LLSD& key)
-{
-	if (key.asString() == "friends")
-	{
-		childShowTab("friends_and_groups", "friends_panel");
-	}
-	else if (key.asString() == "groups")
-	{
-		childShowTab("friends_and_groups", "groups_panel");
-	}
-}
-
-//static
-void* LLFloaterMyFriends::createFriendsPanel(void* data)
-{
-	return new LLPanelFriends();
-}
-
-//static
-void* LLFloaterMyFriends::createGroupsPanel(void* data)
-{
-	return new LLPanelGroups();
-}
-
-//static
-LLFloaterMyFriends* LLFloaterMyFriends::getInstance()
-{
-	return LLFloaterReg::getTypedInstance<LLFloaterMyFriends>("contacts", "friends") ;
-}
-
-//
-// LLFloaterChatterBox
-//
-LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed)
-:	LLMultiFloater(seed),
-	mActiveVoiceFloater(NULL)
-{
-	mAutoResize = FALSE;
-
-	//Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_chatterbox.xml", FALSE);
-}
-
-LLFloaterChatterBox::~LLFloaterChatterBox()
-{
-}
-
-BOOL LLFloaterChatterBox::postBuild()
-{
-	setVisibleCallback(boost::bind(&LLFloaterChatterBox::onVisibilityChange, this, _2));
-	
-	if (gSavedSettings.getBOOL("ContactsTornOff"))
-	{
-		LLFloaterMyFriends* floater_contacts = LLFloaterMyFriends::getInstance();
-		if(floater_contacts)
-		{
-			// add then remove to set up relationship for re-attach
-			addFloater(floater_contacts, FALSE);
-			removeFloater(floater_contacts);
-			// reparent to floater view
-			gFloaterView->addChild(floater_contacts);
-		}
-	}
-	else
-	{
-		addFloater(LLFloaterMyFriends::getInstance(), TRUE);
-	}
-
-	mTabContainer->lockTabs();
-	return TRUE;
-}
-
-BOOL LLFloaterChatterBox::handleKeyHere(KEY key, MASK mask)
-{
-	if (key == 'W' && mask == MASK_CONTROL)
-	{
-		LLFloater* floater = getActiveFloater();
-		// is user closeable and is system closeable
-		if (floater && floater->canClose())
-		{
-			if (floater->isCloseable())
-			{
-				floater->closeFloater();
-			}
-			else
-			{
-				// close chatterbox window if frontmost tab is reserved, non-closeable tab
-				// such as contacts or near me
-				closeFloater();
-			}
-		}
-		return TRUE;
-	}
-
-	return LLMultiFloater::handleKeyHere(key, mask);
-}
-
-void LLFloaterChatterBox::draw()
-{
-	// clear new im notifications when chatterbox is visible
-	if (!isMinimized()) 
-	{
-		gIMMgr->clearNewIMNotification();
-	}
-	LLFloater* current_active_floater = getCurrentVoiceFloater();
-	// set icon on tab for floater currently associated with active voice channel
-	if(mActiveVoiceFloater != current_active_floater)
-	{
-		// remove image from old floater's tab
-		if (mActiveVoiceFloater)
-		{
-			mTabContainer->setTabImage(mActiveVoiceFloater, "");
-		}
-	}
-
-	// update image on current active tab
-	if (current_active_floater)
-	{
-		LLColor4 icon_color = LLColor4::white;
-		LLVoiceChannel* channelp = LLVoiceChannel::getCurrentVoiceChannel();
-		if (channelp)
-		{
-			if (channelp->isActive())
-			{
-				icon_color = LLColor4::green;
-			}
-			else if (channelp->getState() == LLVoiceChannel::STATE_ERROR)
-			{
-				icon_color = LLColor4::red;
-			}
-			else // active, but not connected
-			{
-				icon_color = LLColor4::yellow;
-			}
-		}
-		mTabContainer->setTabImage(current_active_floater, "active_voice_tab.tga", icon_color);
-	}
-
-	mActiveVoiceFloater = current_active_floater;
-
-	LLMultiFloater::draw();
-}
-
-void LLFloaterChatterBox::onOpen(const LLSD& key)
-{
-	//*TODO:Skinning show the session id associated with key
-	if (key.asString() == "local")
-	{
-	}
-	else if (key.isDefined())
-	{
-		/*LLFloaterIMPanel* impanel = gIMMgr->findFloaterBySession(key.asUUID());
-		if (impanel)
-		{
-			impanel->openFloater();
-		}*/
-	}
-}
-
-void LLFloaterChatterBox::onVisibilityChange ( const LLSD& new_visibility )
-{
-}
-
-void LLFloaterChatterBox::removeFloater(LLFloater* floaterp)
-{
-	if(!floaterp) return;
-		
-	if (floaterp->getName() == "chat floater")
-	{
-		// only my friends floater now locked
-		mTabContainer->lockTabs(mTabContainer->getNumLockedTabs() - 1);
-		gSavedSettings.setBOOL("ChatHistoryTornOff", TRUE);
-		floaterp->setCanClose(TRUE);
-	}
-	else if (floaterp->getName() == "floater_my_friends")
-	{
-		// only chat floater now locked
-		mTabContainer->lockTabs(mTabContainer->getNumLockedTabs() - 1);
-		gSavedSettings.setBOOL("ContactsTornOff", TRUE);
-		floaterp->setCanClose(TRUE);
-	}
-	LLMultiFloater::removeFloater(floaterp);
-}
-
-void LLFloaterChatterBox::addFloater(LLFloater* floaterp, 
-									BOOL select_added_floater, 
-									LLTabContainer::eInsertionPoint insertion_point)
-{
-	if(!floaterp) return;
-	
-	S32 num_locked_tabs = mTabContainer->getNumLockedTabs();
-
-	// already here
-	if (floaterp->getHost() == this)
-	{
-		openFloater(floaterp->getKey());
-		return;
-	}
-
-	// make sure my friends and chat history both locked when re-attaching chat history
-	if (floaterp->getName() == "chat floater")
-	{
-		mTabContainer->unlockTabs();
-		// add chat history as second tab if contact window is present, first tab otherwise
-		if (getChildView("floater_my_friends"))
-		{
-			// assuming contacts window is first tab, select it
-			mTabContainer->selectFirstTab();
-			// and add ourselves after
-			LLMultiFloater::addFloater(floaterp, select_added_floater, LLTabContainer::RIGHT_OF_CURRENT);
-		}
-		else
-		{
-			LLMultiFloater::addFloater(floaterp, select_added_floater, LLTabContainer::START);
-		}
-		
-		// make sure first two tabs are now locked
-		mTabContainer->lockTabs(num_locked_tabs + 1);
-		gSavedSettings.setBOOL("ChatHistoryTornOff", FALSE);
-		floaterp->setCanClose(FALSE);
-	}
-	else if (floaterp->getName() == "floater_my_friends")
-	{
-		mTabContainer->unlockTabs();
-		// add contacts window as first tab
-		LLMultiFloater::addFloater(floaterp, select_added_floater, LLTabContainer::START);
-		// make sure first two tabs are now locked
-		mTabContainer->lockTabs(num_locked_tabs + 1);
-		gSavedSettings.setBOOL("ContactsTornOff", FALSE);
-		floaterp->setCanClose(FALSE);
-	}
-	else
-	{
-		LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point);
-		// openFloater(floaterp->getKey());
-	}
-
-	// make sure active voice icon shows up for new tab
-	if (floaterp == mActiveVoiceFloater)
-	{
-		mTabContainer->setTabImage(floaterp, "active_voice_tab.tga");	
-	}
-}
-
-//static
-LLFloaterChatterBox* LLFloaterChatterBox::getInstance()
-{
-	return LLFloaterReg::getTypedInstance<LLFloaterChatterBox>("communicate", LLSD()) ; 
-}
-
-//static 
-LLFloater* LLFloaterChatterBox::getCurrentVoiceFloater()
-{
-	if (!LLVoiceClient::getInstance()->voiceEnabled())
-	{
-		return NULL;
-	}
-	if (LLVoiceChannelProximal::getInstance() == LLVoiceChannel::getCurrentVoiceChannel())
-	{
-		return NULL;
-	}
-	else
-	{
-		LLFloaterChatterBox* floater = LLFloaterChatterBox::getInstance();
-		if(!floater) return NULL;
-		// iterator over all IM tabs (skip friends and near me)
-		for (S32 i = 0; i < floater->getFloaterCount(); i++)
-		{
-			LLPanel* panelp = floater->mTabContainer->getPanelByIndex(i);
-			if (panelp->getName() == "im_floater")
-			{
-				// only LLFloaterIMPanels are called "im_floater"
-				LLFloaterIMPanel* im_floaterp = (LLFloaterIMPanel*)panelp;
-				LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(im_floaterp->getSessionID());
-				if (voice_channel  == LLVoiceChannel::getCurrentVoiceChannel())
-				{
-					return im_floaterp;
-				}
-			}
-		}
-	}
-	return NULL;
-}
diff --git a/indra/newview/llfloaterchatterbox.h b/indra/newview/llfloaterchatterbox.h
deleted file mode 100644
index 3a8bfe2fa4dd7b9683ba0d6b65b84df382ac4042..0000000000000000000000000000000000000000
--- a/indra/newview/llfloaterchatterbox.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/** 
- * @file llfloaterchatterbox.h
- * @author Richard
- * @date 2007-05-04
- * @brief Integrated friends and group management/communication tool
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLFLOATERCHATTERBOX_H
-#define LL_LLFLOATERCHATTERBOX_H
-
-#include "llfloater.h"
-#include "llmultifloater.h"
-#include "llstring.h"
-#include "llimpanel.h"
-
-class LLTabContainer;
-
-class LLFloaterChatterBox : public LLMultiFloater
-{
-public:
-	LLFloaterChatterBox(const LLSD& seed);
-	virtual ~LLFloaterChatterBox();
-	
-	/*virtual*/ BOOL postBuild();
-	/*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
-	/*virtual*/ void draw();
-	/*virtual*/ void onOpen(const LLSD& key);
-
-	/*virtual*/ void removeFloater(LLFloater* floaterp);
-	/*virtual*/ void addFloater(LLFloater* floaterp, 
-								BOOL select_added_floater, 
-								LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END);
-
-	static LLFloaterChatterBox* getInstance(); // *TODO:Skinning Deprecate
-	static LLFloater* getCurrentVoiceFloater();
-	
-protected:
-	void onVisibilityChange ( const LLSD& new_visibility );
-	
-	LLFloater* mActiveVoiceFloater;
-};
-
-
-class LLFloaterMyFriends : public LLFloater
-{
-public:
-	LLFloaterMyFriends(const LLSD& seed);
-	virtual ~LLFloaterMyFriends();
-
-	/*virtual*/ BOOL postBuild();
-	/*virtual*/ void onOpen(const LLSD& key);
-
-	static LLFloaterMyFriends* getInstance(); // *TODO:Skinning Deprecate
-	
-	static void* createFriendsPanel(void* data);
-	static void* createGroupsPanel(void* data);
-};
-
-#endif // LL_LLFLOATERCHATTERBOX_H
diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp
index 659e52271afc44402f361f31c08d7cb644936a4c..05d73c24167195fa80ad649160ee6df01bec7e9c 100644
--- a/indra/newview/llfloatercolorpicker.cpp
+++ b/indra/newview/llfloatercolorpicker.cpp
@@ -271,7 +271,7 @@ void LLFloaterColorPicker::destroyUI ()
 	if ( mSwatchView )
 	{
 		this->removeChild ( mSwatchView );
-		delete mSwatchView;
+		mSwatchView->die();;
 		mSwatchView = NULL;
 	}
 }
diff --git a/indra/newview/llfloatereditsky.cpp b/indra/newview/llfloatereditsky.cpp
index abee7b5dc9e07f6db392603f3c44336464957f86..352361ce9e8af319722a51ed5cb8493ffc1b602d 100644
--- a/indra/newview/llfloatereditsky.cpp
+++ b/indra/newview/llfloatereditsky.cpp
@@ -151,8 +151,8 @@ void LLFloaterEditSky::initCallbacks(void)
 	getChild<LLUICtrl>("WLBlueHorizon")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &param_mgr.mBlueHorizon));
 
 	// haze density, horizon, mult, and altitude
-	getChild<LLUICtrl>("WLHazeDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &param_mgr.mHazeDensity));
-	getChild<LLUICtrl>("WLHazeHorizon")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &param_mgr.mHazeHorizon));
+	getChild<LLUICtrl>("WLHazeDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &param_mgr.mHazeDensity));
+	getChild<LLUICtrl>("WLHazeHorizon")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &param_mgr.mHazeHorizon));
 	getChild<LLUICtrl>("WLDensityMult")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &param_mgr.mDensityMult));
 	getChild<LLUICtrl>("WLMaxAltitude")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &param_mgr.mMaxAlt));
 
@@ -220,15 +220,14 @@ void LLFloaterEditSky::syncControls()
 	setColorSwatch("WLBlueHorizon", param_mgr->mBlueHorizon, WL_BLUE_HORIZON_DENSITY_SCALE);
 
 	// haze density, horizon, mult, and altitude
-	param_mgr->mHazeDensity = cur_params.getVector(param_mgr->mHazeDensity.mName, err);
-	childSetValue("WLHazeDensity", param_mgr->mHazeDensity.r);
-	param_mgr->mHazeHorizon = cur_params.getVector(param_mgr->mHazeHorizon.mName, err);
-	childSetValue("WLHazeHorizon", param_mgr->mHazeHorizon.r);
-	param_mgr->mDensityMult = cur_params.getVector(param_mgr->mDensityMult.mName, err);
-	childSetValue("WLDensityMult", param_mgr->mDensityMult.x *
-		param_mgr->mDensityMult.mult);
-	param_mgr->mMaxAlt = cur_params.getVector(param_mgr->mMaxAlt.mName, err);
-	childSetValue("WLMaxAltitude", param_mgr->mMaxAlt.x);
+	param_mgr->mHazeDensity = cur_params.getFloat(param_mgr->mHazeDensity.mName, err);
+	childSetValue("WLHazeDensity", (F32) param_mgr->mHazeDensity);
+	param_mgr->mHazeHorizon = cur_params.getFloat(param_mgr->mHazeHorizon.mName, err);
+	childSetValue("WLHazeHorizon", (F32) param_mgr->mHazeHorizon);
+	param_mgr->mDensityMult = cur_params.getFloat(param_mgr->mDensityMult.mName, err);
+	childSetValue("WLDensityMult", ((F32) param_mgr->mDensityMult) * param_mgr->mDensityMult.mult);
+	param_mgr->mMaxAlt = cur_params.getFloat(param_mgr->mMaxAlt.mName, err);
+	childSetValue("WLMaxAltitude", (F32) param_mgr->mMaxAlt);
 
 	// blue density
 	param_mgr->mBlueDensity = cur_params.getVector(param_mgr->mBlueDensity.mName, err);
@@ -273,10 +272,10 @@ void LLFloaterEditSky::syncControls()
 	childSetValue("WLCloudDetailDensity", param_mgr->mCloudDetail.b);
 
 	// Cloud extras
-	param_mgr->mCloudCoverage = cur_params.getVector(param_mgr->mCloudCoverage.mName, err);
-	param_mgr->mCloudScale = cur_params.getVector(param_mgr->mCloudScale.mName, err);
-	childSetValue("WLCloudCoverage", param_mgr->mCloudCoverage.x);
-	childSetValue("WLCloudScale", param_mgr->mCloudScale.x);
+	param_mgr->mCloudCoverage = cur_params.getFloat(param_mgr->mCloudCoverage.mName, err);
+	param_mgr->mCloudScale = cur_params.getFloat(param_mgr->mCloudScale.mName, err);
+	childSetValue("WLCloudCoverage", (F32) param_mgr->mCloudCoverage);
+	childSetValue("WLCloudScale", (F32) param_mgr->mCloudScale);
 
 	// cloud scrolling
 	bool lockX = !param_mgr->mCurParams.getEnableCloudScrollX();
@@ -306,13 +305,13 @@ void LLFloaterEditSky::syncControls()
 	childSetValue("WLCloudScrollX", param_mgr->mCurParams.getCloudScrollX() - 10.0f);
 	childSetValue("WLCloudScrollY", param_mgr->mCurParams.getCloudScrollY() - 10.0f);
 
-	param_mgr->mDistanceMult = cur_params.getVector(param_mgr->mDistanceMult.mName, err);
-	childSetValue("WLDistanceMult", param_mgr->mDistanceMult.x);
+	param_mgr->mDistanceMult = cur_params.getFloat(param_mgr->mDistanceMult.mName, err);
+	childSetValue("WLDistanceMult", (F32) param_mgr->mDistanceMult);
 
 	// Tweak extras
 
-	param_mgr->mWLGamma = cur_params.getVector(param_mgr->mWLGamma.mName, err);
-	childSetValue("WLGamma", param_mgr->mWLGamma.x);
+	param_mgr->mWLGamma = cur_params.getFloat(param_mgr->mWLGamma.mName, err);
+	childSetValue("WLGamma", (F32) param_mgr->mWLGamma);
 
 	childSetValue("WLStarAlpha", param_mgr->mCurParams.getStarBrightness());
 }
diff --git a/indra/newview/llfloaterfriends.cpp b/indra/newview/llfloaterfriends.cpp
deleted file mode 100644
index f93568d617b97e8248be6d2e4692d84799c7cffd..0000000000000000000000000000000000000000
--- a/indra/newview/llfloaterfriends.cpp
+++ /dev/null
@@ -1,807 +0,0 @@
-/** 
- * @file llfloaterfriends.cpp
- * @author Phoenix
- * @date 2005-01-13
- * @brief Implementation of the friends floater
- *
- * $LicenseInfo:firstyear=2005&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-
-#include "llviewerprecompiledheaders.h"
-
-#include "llfloaterfriends.h"
-
-#include <sstream>
-
-#include "lldir.h"
-
-#include "llagent.h"
-#include "llappviewer.h"	// for gLastVersionChannel
-#include "llfloateravatarpicker.h"
-#include "llviewerwindow.h"
-#include "llbutton.h"
-#include "llavataractions.h"
-#include "llinventorymodel.h"
-#include "llnamelistctrl.h"
-#include "llnotificationsutil.h"
-#include "llresmgr.h"
-#include "llscrolllistctrl.h"
-#include "llscrolllistitem.h"
-#include "llscrolllistcell.h"
-#include "lluictrlfactory.h"
-#include "llmenucommands.h"
-#include "llviewercontrol.h"
-#include "llviewermessage.h"
-#include "lleventtimer.h"
-#include "lltextbox.h"
-#include "llvoiceclient.h"
-
-// *TODO: Move more common stuff to LLAvatarActions?
-
-//Maximum number of people you can select to do an operation on at once.
-#define MAX_FRIEND_SELECT 20
-#define DEFAULT_PERIOD 5.0
-#define RIGHTS_CHANGE_TIMEOUT 5.0
-#define OBSERVER_TIMEOUT 0.5
-
-#define ONLINE_SIP_ICON_NAME "slim_icon_16_viewer.tga"
-
-// simple class to observe the calling cards.
-class LLLocalFriendsObserver : public LLFriendObserver, public LLEventTimer
-{
-public: 
-	LLLocalFriendsObserver(LLPanelFriends* floater) : mFloater(floater), LLEventTimer(OBSERVER_TIMEOUT)
-	{
-		mEventTimer.stop();
-	}
-	virtual ~LLLocalFriendsObserver()
-	{
-		mFloater = NULL;
-	}
-	virtual void changed(U32 mask)
-	{
-		// events can arrive quickly in bulk - we need not process EVERY one of them -
-		// so we wait a short while to let others pile-in, and process them in aggregate.
-		mEventTimer.start();
-
-		// save-up all the mask-bits which have come-in
-		mMask |= mask;
-	}
-	virtual BOOL tick()
-	{
-		mFloater->updateFriends(mMask);
-
-		mEventTimer.stop();
-		mMask = 0;
-
-		return FALSE;
-	}
-	
-protected:
-	LLPanelFriends* mFloater;
-	U32 mMask;
-};
-
-LLPanelFriends::LLPanelFriends() :
-	LLPanel(),
-	LLEventTimer(DEFAULT_PERIOD),
-	mObserver(NULL),
-	mShowMaxSelectWarning(TRUE),
-	mAllowRightsChange(TRUE),
-	mNumRightsChanged(0)
-{
-	mEventTimer.stop();
-	mObserver = new LLLocalFriendsObserver(this);
-	LLAvatarTracker::instance().addObserver(mObserver);
-	// For notification when SIP online status changes.
-	LLVoiceClient::getInstance()->addObserver(mObserver);
-}
-
-LLPanelFriends::~LLPanelFriends()
-{
-	// For notification when SIP online status changes.
-	LLVoiceClient::getInstance()->removeObserver(mObserver);
-	LLAvatarTracker::instance().removeObserver(mObserver);
-	delete mObserver;
-}
-
-BOOL LLPanelFriends::tick()
-{
-	mEventTimer.stop();
-	mPeriod = DEFAULT_PERIOD;
-	mAllowRightsChange = TRUE;
-	updateFriends(LLFriendObserver::ADD);
-	return FALSE;
-}
-
-void LLPanelFriends::updateFriends(U32 changed_mask)
-{
-	LLUUID selected_id;
-	LLCtrlListInterface *friends_list = childGetListInterface("friend_list");
-	if (!friends_list) return;
-	LLCtrlScrollInterface *friends_scroll = childGetScrollInterface("friend_list");
-	if (!friends_scroll) return;
-	
-	// We kill the selection warning, otherwise we'll spam with warning popups
-	// if the maximum amount of friends are selected
-	mShowMaxSelectWarning = false;
-
-	std::vector<LLUUID> selected_friends = getSelectedIDs();
-	if(changed_mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE))
-	{
-		refreshNames(changed_mask);
-	}
-	else if(changed_mask & LLFriendObserver::POWERS)
-	{
-		--mNumRightsChanged;
-		if(mNumRightsChanged > 0)
-		{
-			mPeriod = RIGHTS_CHANGE_TIMEOUT;	
-			mEventTimer.start();
-			mAllowRightsChange = FALSE;
-		}
-		else
-		{
-			tick();
-		}
-	}
-	if(selected_friends.size() > 0)
-	{
-		// only non-null if friends was already found. This may fail,
-		// but we don't really care here, because refreshUI() will
-		// clean up the interface.
-		friends_list->setCurrentByID(selected_id);
-		for(std::vector<LLUUID>::iterator itr = selected_friends.begin(); itr != selected_friends.end(); ++itr)
-		{
-			friends_list->setSelectedByValue(*itr, true);
-		}
-	}
-
-	refreshUI();
-	mShowMaxSelectWarning = true;
-}
-
-// virtual
-BOOL LLPanelFriends::postBuild()
-{
-	mFriendsList = getChild<LLScrollListCtrl>("friend_list");
-	mFriendsList->setMaxSelectable(MAX_FRIEND_SELECT);
-	mFriendsList->setMaximumSelectCallback(boost::bind(&LLPanelFriends::onMaximumSelect));
-	mFriendsList->setCommitOnSelectionChange(TRUE);
-	mFriendsList->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
-	childSetCommitCallback("friend_list", onSelectName, this);
-	getChild<LLScrollListCtrl>("friend_list")->setDoubleClickCallback(onClickIM, this);
-
-	U32 changed_mask = LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE;
-	refreshNames(changed_mask);
-
-	childSetAction("im_btn", onClickIM, this);
-	childSetAction("profile_btn", onClickProfile, this);
-	childSetAction("offer_teleport_btn", onClickOfferTeleport, this);
-	childSetAction("pay_btn", onClickPay, this);
-	childSetAction("add_btn", onClickAddFriend, this);
-	childSetAction("remove_btn", onClickRemove, this);
-
-	setDefaultBtn("im_btn");
-
-	updateFriends(LLFriendObserver::ADD);
-	refreshUI();
-
-	// primary sort = online status, secondary sort = name
-	mFriendsList->sortByColumn(std::string("friend_name"), TRUE);
-	mFriendsList->sortByColumn(std::string("icon_online_status"), FALSE);
-
-	return TRUE;
-}
-
-BOOL LLPanelFriends::addFriend(const LLUUID& agent_id)
-{
-	LLAvatarTracker& at = LLAvatarTracker::instance();
-	const LLRelationship* relationInfo = at.getBuddyInfo(agent_id);
-	if(!relationInfo) return FALSE;
-
-	bool isOnlineSIP = LLVoiceClient::getInstance()->isOnlineSIP(agent_id);
-	bool isOnline = relationInfo->isOnline();
-
-	std::string fullname;
-	BOOL have_name = gCacheName->getFullName(agent_id, fullname);
-	
-	LLSD element;
-	element["id"] = agent_id;
-	LLSD& friend_column = element["columns"][LIST_FRIEND_NAME];
-	friend_column["column"] = "friend_name";
-	friend_column["value"] = fullname;
-	friend_column["font"]["name"] = "SANSSERIF";
-	friend_column["font"]["style"] = "NORMAL";	
-
-	LLSD& online_status_column = element["columns"][LIST_ONLINE_STATUS];
-	online_status_column["column"] = "icon_online_status";
-	online_status_column["type"] = "icon";
-	
-	if (isOnline)
-	{
-		friend_column["font"]["style"] = "BOLD";	
-		online_status_column["value"] = "icon_avatar_online.tga";
-	}
-	else if(isOnlineSIP)
-	{
-		friend_column["font"]["style"] = "BOLD";	
-		online_status_column["value"] = ONLINE_SIP_ICON_NAME;
-	}
-
-	LLSD& online_column = element["columns"][LIST_VISIBLE_ONLINE];
-	online_column["column"] = "icon_visible_online";
-	online_column["type"] = "checkbox";
-	online_column["value"] = relationInfo->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS);
-
-	LLSD& visible_map_column = element["columns"][LIST_VISIBLE_MAP];
-	visible_map_column["column"] = "icon_visible_map";
-	visible_map_column["type"] = "checkbox";
-	visible_map_column["value"] = relationInfo->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION);
-
-	LLSD& edit_my_object_column = element["columns"][LIST_EDIT_MINE];
-	edit_my_object_column["column"] = "icon_edit_mine";
-	edit_my_object_column["type"] = "checkbox";
-	edit_my_object_column["value"] = relationInfo->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS);
-
-	LLSD& edit_their_object_column = element["columns"][LIST_EDIT_THEIRS];
-	edit_their_object_column["column"] = "icon_edit_theirs";
-	edit_their_object_column["type"] = "checkbox";
-	edit_their_object_column["enabled"] = "";
-	edit_their_object_column["value"] = relationInfo->isRightGrantedFrom(LLRelationship::GRANT_MODIFY_OBJECTS);
-
-	LLSD& update_gen_column = element["columns"][LIST_FRIEND_UPDATE_GEN];
-	update_gen_column["column"] = "friend_last_update_generation";
-	update_gen_column["value"] = have_name ? relationInfo->getChangeSerialNum() : -1;
-
-	mFriendsList->addElement(element, ADD_BOTTOM);
-	return have_name;
-}
-
-// propagate actual relationship to UI.
-// Does not resort the UI list because it can be called frequently. JC
-BOOL LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationship* info)
-{
-	if (!info) return FALSE;
-	LLScrollListItem* itemp = mFriendsList->getItem(agent_id);
-	if (!itemp) return FALSE;
-	
-	bool isOnlineSIP = LLVoiceClient::getInstance()->isOnlineSIP(itemp->getUUID());
-	bool isOnline = info->isOnline();
-
-	std::string fullname;
-	BOOL have_name = gCacheName->getFullName(agent_id, fullname);
-	
-	// Name of the status icon to use
-	std::string statusIcon;
-	
-	if(isOnline)
-	{
-		statusIcon = "icon_avatar_online.tga";
-	}
-	else if(isOnlineSIP)
-	{
-		statusIcon = ONLINE_SIP_ICON_NAME;
-	}
-
-	itemp->getColumn(LIST_ONLINE_STATUS)->setValue(statusIcon);
-	
-	itemp->getColumn(LIST_FRIEND_NAME)->setValue(fullname);
-	// render name of online friends in bold text
-	((LLScrollListText*)itemp->getColumn(LIST_FRIEND_NAME))->setFontStyle((isOnline || isOnlineSIP) ? LLFontGL::BOLD : LLFontGL::NORMAL);	
-	itemp->getColumn(LIST_VISIBLE_ONLINE)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS));
-	itemp->getColumn(LIST_VISIBLE_MAP)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION));
-	itemp->getColumn(LIST_EDIT_MINE)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS));
-	S32 change_generation = have_name ? info->getChangeSerialNum() : -1;
-	itemp->getColumn(LIST_FRIEND_UPDATE_GEN)->setValue(change_generation);
-
-	// enable this item, in case it was disabled after user input
-	itemp->setEnabled(TRUE);
-
-	// Do not resort, this function can be called frequently.
-	return have_name;
-}
-
-void LLPanelFriends::refreshRightsChangeList()
-{
-	std::vector<LLUUID> friends = getSelectedIDs();
-	S32 num_selected = friends.size();
-
-	bool can_offer_teleport = num_selected >= 1;
-	bool selected_friends_online = true;
-
-	const LLRelationship* friend_status = NULL;
-	for(std::vector<LLUUID>::iterator itr = friends.begin(); itr != friends.end(); ++itr)
-	{
-		friend_status = LLAvatarTracker::instance().getBuddyInfo(*itr);
-		if (friend_status)
-		{
-			if(!friend_status->isOnline())
-			{
-				can_offer_teleport = false;
-				selected_friends_online = false;
-			}
-		}
-		else // missing buddy info, don't allow any operations
-		{
-			can_offer_teleport = false;
-		}
-	}
-	
-	if (num_selected == 0)  // nothing selected
-	{
-		childSetEnabled("im_btn", FALSE);
-		childSetEnabled("offer_teleport_btn", FALSE);
-	}
-	else // we have at least one friend selected...
-	{
-		// only allow IMs to groups when everyone in the group is online
-		// to be consistent with context menus in inventory and because otherwise
-		// offline friends would be silently dropped from the session
-		childSetEnabled("im_btn", selected_friends_online || num_selected == 1);
-		childSetEnabled("offer_teleport_btn", can_offer_teleport);
-	}
-}
-
-struct SortFriendsByID
-{
-	bool operator() (const LLScrollListItem* const a, const LLScrollListItem* const b) const
-	{
-		return a->getValue().asUUID() < b->getValue().asUUID();
-	}
-};
-
-void LLPanelFriends::refreshNames(U32 changed_mask)
-{
-	std::vector<LLUUID> selected_ids = getSelectedIDs();	
-	S32 pos = mFriendsList->getScrollPos();	
-	
-	// get all buddies we know about
-	LLAvatarTracker::buddy_map_t all_buddies;
-	LLAvatarTracker::instance().copyBuddyList(all_buddies);
-
-	BOOL have_names = TRUE;
-
-	if(changed_mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE))
-	{
-		have_names &= refreshNamesSync(all_buddies);
-	}
-
-	if(changed_mask & LLFriendObserver::ONLINE)
-	{
-		have_names &= refreshNamesPresence(all_buddies);
-	}
-
-	if (!have_names)
-	{
-		mEventTimer.start();
-	}
-	// Changed item in place, need to request sort and update columns
-	// because we might have changed data in a column on which the user
-	// has already sorted. JC
-	mFriendsList->updateSort();
-
-	// re-select items
-	mFriendsList->selectMultiple(selected_ids);
-	mFriendsList->setScrollPos(pos);
-}
-
-BOOL LLPanelFriends::refreshNamesSync(const LLAvatarTracker::buddy_map_t & all_buddies)
-{
-	mFriendsList->deleteAllItems();
-
-	BOOL have_names = TRUE;
-	LLAvatarTracker::buddy_map_t::const_iterator buddy_it = all_buddies.begin();
-
-	for(; buddy_it != all_buddies.end(); ++buddy_it)
-	{
-		have_names &= addFriend(buddy_it->first);
-	}
-
-	return have_names;
-}
-
-BOOL LLPanelFriends::refreshNamesPresence(const LLAvatarTracker::buddy_map_t & all_buddies)
-{
-	std::vector<LLScrollListItem*> items = mFriendsList->getAllData();
-	std::sort(items.begin(), items.end(), SortFriendsByID());
-
-	LLAvatarTracker::buddy_map_t::const_iterator buddy_it  = all_buddies.begin();
-	std::vector<LLScrollListItem*>::const_iterator item_it = items.begin();
-	BOOL have_names = TRUE;
-
-	while(true)
-	{
-		if(item_it == items.end() || buddy_it == all_buddies.end())
-		{
-			break;
-		}
-
-		const LLUUID & buddy_uuid = buddy_it->first;
-		const LLUUID & item_uuid  = (*item_it)->getValue().asUUID();
-		if(item_uuid == buddy_uuid)
-		{
-			const LLRelationship* info = buddy_it->second;
-			if (!info) 
-			{	
-				++item_it;
-				continue;
-			}
-			
-			S32 last_change_generation = (*item_it)->getColumn(LIST_FRIEND_UPDATE_GEN)->getValue().asInteger();
-			if (last_change_generation < info->getChangeSerialNum())
-			{
-				// update existing item in UI
-				have_names &= updateFriendItem(buddy_it->first, info);
-			}
-
-			++buddy_it;
-			++item_it;
-		}
-		else if(item_uuid < buddy_uuid)
-		{
-			++item_it;
-		}
-		else //if(item_uuid > buddy_uuid)
-		{
-			++buddy_it;
-		}
-	}
-
-	return have_names;
-}
-
-void LLPanelFriends::refreshUI()
-{	
-	BOOL single_selected = FALSE;
-	BOOL multiple_selected = FALSE;
-	int num_selected = mFriendsList->getAllSelected().size();
-	if(num_selected > 0)
-	{
-		single_selected = TRUE;
-		if(num_selected > 1)
-		{
-			multiple_selected = TRUE;		
-		}
-	}
-
-
-	//Options that can only be performed with one friend selected
-	childSetEnabled("profile_btn", single_selected && !multiple_selected);
-	childSetEnabled("pay_btn", single_selected && !multiple_selected);
-
-	//Options that can be performed with up to MAX_FRIEND_SELECT friends selected
-	//(single_selected will always be true in this situations)
-	childSetEnabled("remove_btn", single_selected);
-	childSetEnabled("im_btn", single_selected);
-//	childSetEnabled("friend_rights", single_selected);
-
-	refreshRightsChangeList();
-}
-
-std::vector<LLUUID> LLPanelFriends::getSelectedIDs()
-{
-	LLUUID selected_id;
-	std::vector<LLUUID> friend_ids;
-	std::vector<LLScrollListItem*> selected = mFriendsList->getAllSelected();
-	for(std::vector<LLScrollListItem*>::iterator itr = selected.begin(); itr != selected.end(); ++itr)
-	{
-		friend_ids.push_back((*itr)->getUUID());
-	}
-	return friend_ids;
-}
-
-// static
-void LLPanelFriends::onSelectName(LLUICtrl* ctrl, void* user_data)
-{
-	LLPanelFriends* panelp = (LLPanelFriends*)user_data;
-
-	if(panelp)
-	{
-		panelp->refreshUI();
-		// check to see if rights have changed
-		panelp->applyRightsToFriends();
-	}
-}
-
-//static
-void LLPanelFriends::onMaximumSelect()
-{
-	LLSD args;
-	args["MAX_SELECT"] = llformat("%d", MAX_FRIEND_SELECT);
-	LLNotificationsUtil::add("MaxListSelectMessage", args);
-};
-
-// static
-void LLPanelFriends::onClickProfile(void* user_data)
-{
-	LLPanelFriends* panelp = (LLPanelFriends*)user_data;
-
-	std::vector<LLUUID> ids = panelp->getSelectedIDs();
-	if(ids.size() > 0)
-	{
-		LLUUID agent_id = ids[0];
-		LLAvatarActions::showProfile(agent_id);
-	}
-}
-
-// static
-void LLPanelFriends::onClickIM(void* user_data)
-{
-	LLPanelFriends* panelp = (LLPanelFriends*)user_data;
-
-	std::vector<LLUUID> ids = panelp->getSelectedIDs();
-	if(ids.size() > 0)
-	{
-		if(ids.size() == 1)
-		{
-			LLAvatarActions::startIM(ids[0]);
-		}
-		else
-		{
-			LLAvatarActions::startConference(ids);
-		}
-	}
-}
-
-// static
-void LLPanelFriends::onPickAvatar(const std::vector<std::string>& names,
-									const std::vector<LLUUID>& ids)
-{
-	if (names.empty()) return;
-	if (ids.empty()) return;
-	LLAvatarActions::requestFriendshipDialog(ids[0], names[0]);
-}
-
-// static
-void LLPanelFriends::onClickAddFriend(void* user_data)
-{
-	LLPanelFriends* panelp = (LLPanelFriends*)user_data;
-	LLFloater* root_floater = gFloaterView->getParentFloater(panelp);
-	LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelFriends::onPickAvatar, _1,_2), FALSE, TRUE);
-	if (root_floater)
-	{
-		root_floater->addDependentFloater(picker);
-	}
-}
-
-// static
-void LLPanelFriends::onClickRemove(void* user_data)
-{
-	LLPanelFriends* panelp = (LLPanelFriends*)user_data;
-	LLAvatarActions::removeFriendsDialog(panelp->getSelectedIDs());
-}
-
-// static
-void LLPanelFriends::onClickOfferTeleport(void* user_data)
-{
-	LLPanelFriends* panelp = (LLPanelFriends*)user_data;
-	LLAvatarActions::offerTeleport(panelp->getSelectedIDs());
-}
-
-// static
-void LLPanelFriends::onClickPay(void* user_data)
-{
-	LLPanelFriends* panelp = (LLPanelFriends*)user_data;
-
-	std::vector<LLUUID> ids = panelp->getSelectedIDs();
-	if(ids.size() == 1)
-	{	
-		LLAvatarActions::pay(ids[0]);
-	}
-}
-
-void LLPanelFriends::confirmModifyRights(rights_map_t& ids, EGrantRevoke command)
-{
-	if (ids.empty()) return;
-	
-	LLSD args;
-	if(ids.size() > 0)
-	{
-		rights_map_t* rights = new rights_map_t(ids);
-
-		// for single friend, show their name
-		if(ids.size() == 1)
-		{
-			LLUUID agent_id = ids.begin()->first;
-			std::string first, last;
-			if(gCacheName->getName(agent_id, first, last))
-			{
-				args["FIRST_NAME"] = first;
-				args["LAST_NAME"] = last;	
-			}
-			if (command == GRANT)
-			{
-				LLNotificationsUtil::add("GrantModifyRights", 
-					args, 
-					LLSD(), 
-					boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights));
-			}
-			else
-			{
-				LLNotificationsUtil::add("RevokeModifyRights", 
-					args, 
-					LLSD(), 
-					boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights));
-			}
-		}
-		else
-		{
-			if (command == GRANT)
-			{
-				LLNotificationsUtil::add("GrantModifyRightsMultiple", 
-					args, 
-					LLSD(), 
-					boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights));
-			}
-			else
-			{
-				LLNotificationsUtil::add("RevokeModifyRightsMultiple", 
-					args, 
-					LLSD(), 
-					boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights));
-			}
-		}
-	}
-}
-
-bool LLPanelFriends::modifyRightsConfirmation(const LLSD& notification, const LLSD& response, rights_map_t* rights)
-{
-	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-	if(0 == option)
-	{
-		sendRightsGrant(*rights);
-	}
-	else
-	{
-		// need to resync view with model, since user cancelled operation
-		rights_map_t::iterator rights_it;
-		for (rights_it = rights->begin(); rights_it != rights->end(); ++rights_it)
-		{
-			const LLRelationship* info = LLAvatarTracker::instance().getBuddyInfo(rights_it->first);
-			updateFriendItem(rights_it->first, info);
-		}
-	}
-	refreshUI();
-
-	delete rights;
-	return false;
-}
-
-void LLPanelFriends::applyRightsToFriends()
-{
-	BOOL rights_changed = FALSE;
-
-	// store modify rights separately for confirmation
-	rights_map_t rights_updates;
-
-	BOOL need_confirmation = FALSE;
-	EGrantRevoke confirmation_type = GRANT;
-
-	// this assumes that changes only happened to selected items
-	std::vector<LLScrollListItem*> selected = mFriendsList->getAllSelected();
-	for(std::vector<LLScrollListItem*>::iterator itr = selected.begin(); itr != selected.end(); ++itr)
-	{
-		LLUUID id = (*itr)->getValue();
-		const LLRelationship* buddy_relationship = LLAvatarTracker::instance().getBuddyInfo(id);
-		if (buddy_relationship == NULL) continue;
-
-		bool show_online_staus = (*itr)->getColumn(LIST_VISIBLE_ONLINE)->getValue().asBoolean();
-		bool show_map_location = (*itr)->getColumn(LIST_VISIBLE_MAP)->getValue().asBoolean();
-		bool allow_modify_objects = (*itr)->getColumn(LIST_EDIT_MINE)->getValue().asBoolean();
-
-		S32 rights = buddy_relationship->getRightsGrantedTo();
-		if(buddy_relationship->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS) != show_online_staus)
-		{
-			rights_changed = TRUE;
-			if(show_online_staus) 
-			{
-				rights |= LLRelationship::GRANT_ONLINE_STATUS;
-			}
-			else 
-			{
-				// ONLINE_STATUS necessary for MAP_LOCATION
-				rights &= ~LLRelationship::GRANT_ONLINE_STATUS;
-				rights &= ~LLRelationship::GRANT_MAP_LOCATION;
-				// propagate rights constraint to UI
-				(*itr)->getColumn(LIST_VISIBLE_MAP)->setValue(FALSE);
-			}
-		}
-		if(buddy_relationship->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION) != show_map_location)
-		{
-			rights_changed = TRUE;
-			if(show_map_location) 
-			{
-				// ONLINE_STATUS necessary for MAP_LOCATION
-				rights |= LLRelationship::GRANT_MAP_LOCATION;
-				rights |= LLRelationship::GRANT_ONLINE_STATUS;
-				(*itr)->getColumn(LIST_VISIBLE_ONLINE)->setValue(TRUE);
-			}
-			else 
-			{
-				rights &= ~LLRelationship::GRANT_MAP_LOCATION;
-			}
-		}
-		
-		// now check for change in modify object rights, which requires confirmation
-		if(buddy_relationship->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS) != allow_modify_objects)
-		{
-			rights_changed = TRUE;
-			need_confirmation = TRUE;
-
-			if(allow_modify_objects)
-			{
-				rights |= LLRelationship::GRANT_MODIFY_OBJECTS;
-				confirmation_type = GRANT;
-			}
-			else
-			{
-				rights &= ~LLRelationship::GRANT_MODIFY_OBJECTS;
-				confirmation_type = REVOKE;
-			}
-		}
-
-		if (rights_changed)
-		{
-			rights_updates.insert(std::make_pair(id, rights));
-			// disable these ui elements until response from server
-			// to avoid race conditions
-			(*itr)->setEnabled(FALSE);
-		}
-	}
-
-	// separately confirm grant and revoke of modify rights
-	if (need_confirmation)
-	{
-		confirmModifyRights(rights_updates, confirmation_type);
-	}
-	else
-	{
-		sendRightsGrant(rights_updates);
-	}
-}
-
-void LLPanelFriends::sendRightsGrant(rights_map_t& ids)
-{
-	if (ids.empty()) return;
-
-	LLMessageSystem* msg = gMessageSystem;
-
-	// setup message header
-	msg->newMessageFast(_PREHASH_GrantUserRights);
-	msg->nextBlockFast(_PREHASH_AgentData);
-	msg->addUUID(_PREHASH_AgentID, gAgent.getID());
-	msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
-
-	rights_map_t::iterator id_it;
-	rights_map_t::iterator end_it = ids.end();
-	for(id_it = ids.begin(); id_it != end_it; ++id_it)
-	{
-		msg->nextBlockFast(_PREHASH_Rights);
-		msg->addUUID(_PREHASH_AgentRelated, id_it->first);
-		msg->addS32(_PREHASH_RelatedRights, id_it->second);
-	}
-
-	mNumRightsChanged = ids.size();
-	gAgent.sendReliableMessage();
-}
diff --git a/indra/newview/llfloaterfriends.h b/indra/newview/llfloaterfriends.h
deleted file mode 100644
index a303477c95a744e10cf71646a71fb070b535b3db..0000000000000000000000000000000000000000
--- a/indra/newview/llfloaterfriends.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/** 
- * @file llfloaterfriends.h
- * @author Phoenix
- * @date 2005-01-13
- * @brief Declaration of class for displaying the local agent's friends.
- *
- * $LicenseInfo:firstyear=2005&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLFLOATERFRIENDS_H
-#define LL_LLFLOATERFRIENDS_H
-
-#include "llpanel.h"
-#include "llstring.h"
-#include "lluuid.h"
-#include "lltimer.h"
-#include "llcallingcard.h"
-
-class LLFriendObserver;
-class LLRelationship;
-class LLScrollListItem;
-class LLScrollListCtrl;
-
-/** 
- * @class LLPanelFriends
- * @brief An instance of this class is used for displaying your friends
- * and gives you quick access to all agents which a user relationship.
- *
- * @sa LLFloater
- */
-class LLPanelFriends : public LLPanel, public LLEventTimer
-{
-public:
-	LLPanelFriends();
-	virtual ~LLPanelFriends();
-
-	/** 
-	 * @brief This method either creates or brings to the front the
-	 * current instantiation of this floater. There is only once since
-	 * you can currently only look at your local friends.
-	 */
-	virtual BOOL tick();
-
-	/** 
-	 * @brief This method is called in response to the LLAvatarTracker
-	 * sending out a changed() message.
-	 */
-	void updateFriends(U32 changed_mask);
-
-	virtual BOOL postBuild();
-
-	// *HACK Made public to remove friends from LLAvatarIconCtrl context menu
-	static bool handleRemove(const LLSD& notification, const LLSD& response);
-
-private:
-
-	enum FRIENDS_COLUMN_ORDER
-	{
-		LIST_ONLINE_STATUS,
-		LIST_FRIEND_NAME,
-		LIST_VISIBLE_ONLINE,
-		LIST_VISIBLE_MAP,
-		LIST_EDIT_MINE,
-		LIST_EDIT_THEIRS,
-		LIST_FRIEND_UPDATE_GEN
-	};
-
-	// protected members
-	typedef std::map<LLUUID, S32> rights_map_t;
-	void refreshNames(U32 changed_mask);
-	BOOL refreshNamesSync(const LLAvatarTracker::buddy_map_t & all_buddies);
-	BOOL refreshNamesPresence(const LLAvatarTracker::buddy_map_t & all_buddies);
-	void refreshUI();
-	void refreshRightsChangeList();
-	void applyRightsToFriends();
-	BOOL addFriend(const LLUUID& agent_id);	
-	BOOL updateFriendItem(const LLUUID& agent_id, const LLRelationship* relationship);
-
-	typedef enum 
-	{
-		GRANT,
-		REVOKE
-	} EGrantRevoke;
-	void confirmModifyRights(rights_map_t& ids, EGrantRevoke command);
-	void sendRightsGrant(rights_map_t& ids);
-
-	// return empty vector if nothing is selected
-	std::vector<LLUUID> getSelectedIDs();
-
-	// callback methods
-	static void onSelectName(LLUICtrl* ctrl, void* user_data);
-	static bool callbackAddFriend(const LLSD& notification, const LLSD& response);
-	static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response);
-	static void onPickAvatar(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
-	static void onMaximumSelect();
-
-	static void onClickIM(void* user_data);
-	static void onClickProfile(void* user_data);
-	static void onClickAddFriend(void* user_data);
-	static void onClickRemove(void* user_data);
-
-	static void onClickOfferTeleport(void* user_data);
-	static void onClickPay(void* user_data);
-
-	static void onClickModifyStatus(LLUICtrl* ctrl, void* user_data);
-
-	bool modifyRightsConfirmation(const LLSD& notification, const LLSD& response, rights_map_t* rights);
-
-private:
-	// member data
-	LLFriendObserver* mObserver;
-	LLUUID mAddFriendID;
-	std::string mAddFriendName;
-	LLScrollListCtrl* mFriendsList;
-	BOOL mShowMaxSelectWarning;
-	BOOL mAllowRightsChange;
-	S32 mNumRightsChanged;
-};
-
-
-#endif // LL_LLFLOATERFRIENDS_H
diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp
index d495f20a9a861a3a843b19b9a6c58e4fdadcd152..56051ff68458f5cbd589ae833028116bbad3be41 100644
--- a/indra/newview/llfloatergesture.cpp
+++ b/indra/newview/llfloatergesture.cpp
@@ -32,7 +32,7 @@
 #include "llinventorybridge.h"
 #include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
-#include "llinventoryclipboard.h"
+#include "llclipboard.h"
 
 #include "llagent.h"
 #include "llappearancemgr.h"
@@ -90,6 +90,12 @@ class GestureCopiedCallback : public LLInventoryCallback
 		if(mFloater)
 		{
 			mFloater->addGesture(inv_item,NULL,mFloater->getChild<LLScrollListCtrl>("gesture_list"));
+
+			// EXP-1909 (Pasted gesture displayed twice)
+			// The problem is that addGesture is called here for the second time for the same item (which is copied)
+			// First time addGesture is called from LLFloaterGestureObserver::changed(), which is a callback for inventory
+			// change. So we need to refresh the gesture list to avoid duplicates.
+			mFloater->refreshAll();
 		}
 	}
 };
@@ -391,11 +397,11 @@ bool LLFloaterGesture::isActionEnabled(const LLSD& command)
 	std::string command_name = command.asString();
 	if("paste" == command_name)
 	{
-		if(!LLInventoryClipboard::instance().hasContents())
+		if(!LLClipboard::instance().hasContents())
 			return false;
 
 		LLDynamicArray<LLUUID> ids;
-		LLInventoryClipboard::instance().retrieve(ids);
+		LLClipboard::instance().pasteFromClipboard(ids);
 		for(LLDynamicArray<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++)
 		{
 			LLInventoryItem* item = gInventory.getItem(*it);
@@ -490,27 +496,26 @@ void LLFloaterGesture::onActivateBtnClick()
 void LLFloaterGesture::onCopyPasteAction(const LLSD& command)
 {
 	std::string command_name  = command.asString();
-	// since we select this comman inventory item had  already arrived .
+	// Since we select this command, the inventory items must have already arrived
 	if("copy_gesture" == command_name)
 	{
 		uuid_vec_t ids;
 		getSelectedIds(ids);
-		// make sure that clopboard is empty
-		LLInventoryClipboard::instance().reset();
+		// Make sure the clipboard is empty
+		LLClipboard::instance().reset();
 		for(uuid_vec_t::iterator it = ids.begin(); it != ids.end(); it++)
 		{
 			LLInventoryItem* item = gInventory.getItem(*it);
 			if(item  && item->getInventoryType() == LLInventoryType::IT_GESTURE)
 			{
-				LLInventoryClipboard::instance().add(item->getUUID());
+				LLClipboard::instance().addToClipboard(item->getUUID(),LLAssetType::AT_GESTURE);
 			}
 		}
 	}
 	else if ("paste" == command_name)
 	{
-		LLInventoryClipboard& clipbord = LLInventoryClipboard::instance();
 		LLDynamicArray<LLUUID> ids;
-		clipbord.retrieve(ids);
+		LLClipboard::instance().pasteFromClipboard(ids);
 		if(ids.empty() || !gInventory.isCategoryComplete(mGestureFolderID))
 			return;
 		LLInventoryCategory* gesture_dir = gInventory.getCategory(mGestureFolderID);
@@ -530,11 +535,11 @@ void LLFloaterGesture::onCopyPasteAction(const LLSD& command)
 						gesture_dir->getUUID(), getString("copy_name", string_args), cb);
 			}
 		}
-		clipbord.reset();
+		LLClipboard::instance().reset();
 	}
 	else if ("copy_uuid" == command_name)
 	{
-		gClipboard.copyFromString(utf8str_to_wstring(mGestureList->getCurrentID().asString()), mGestureList->getCurrentID());
+		LLClipboard::instance().copyToClipboard(mGestureList->getCurrentID(),LLAssetType::AT_GESTURE);
 	}
 }
 
diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp
index a34e0353ec5d9cd9593a20a858a5c54894b7050c..fb905eae116cc672db3507463f7e2b651c3c5a30 100644
--- a/indra/newview/llfloatergodtools.cpp
+++ b/indra/newview/llfloatergodtools.cpp
@@ -1123,8 +1123,12 @@ bool LLPanelObjectTools::callbackSimWideDeletes( const LLSD& notification, const
 
 void LLPanelObjectTools::onClickSet()
 {
+	LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelObjectTools::callbackAvatarID, this, _1,_2));
 	// grandparent is a floater, which can have a dependent
-	gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLPanelObjectTools::callbackAvatarID, this, _1,_2)));
+	if (picker)
+	{
+		gFloaterView->getParentFloater(this)->addDependentFloater(picker);
+	}
 }
 
 void LLPanelObjectTools::onClickSetBySelection(void* data)
diff --git a/indra/newview/llfloaterhardwaresettings.cpp b/indra/newview/llfloaterhardwaresettings.cpp
index 42ec7d765b4a6313b5fc69abbdbd4a818327394c..f9a403cf9ff407a145614e515afab2f189c96c17 100644
--- a/indra/newview/llfloaterhardwaresettings.cpp
+++ b/indra/newview/llfloaterhardwaresettings.cpp
@@ -34,7 +34,9 @@
 #include "llviewercontrol.h"
 #include "llviewertexturelist.h"
 #include "llfeaturemanager.h"
+#include "llspinctrl.h"
 #include "llstartup.h"
+#include "lltextbox.h"
 #include "pipeline.h"
 
 // Linden library includes
@@ -98,18 +100,40 @@ void LLFloaterHardwareSettings::refreshEnabledState()
 	}
 
 	// if no windlight shaders, turn off nighttime brightness, gamma, and fog distance
-	getChildView("gamma")->setEnabled(!gPipeline.canUseWindLightShaders());
+	LLSpinCtrl* gamma_ctrl = getChild<LLSpinCtrl>("gamma");
+	gamma_ctrl->setEnabled(!gPipeline.canUseWindLightShaders());
 	getChildView("(brightness, lower is brighter)")->setEnabled(!gPipeline.canUseWindLightShaders());
 	getChildView("fog")->setEnabled(!gPipeline.canUseWindLightShaders());
-	getChildView("fsaa")->setEnabled(gPipeline.canUseAntiAliasing());
-	getChildView("antialiasing restart")->setVisible(!gSavedSettings.getBOOL("RenderDeferred"));
 
-	/* Enable to reset fsaa value to disabled when feature is not available.
-	if (!gPipeline.canUseAntiAliasing())
+	// anti-aliasing
 	{
-		getChild<LLUICtrl>("fsaa")->setValue((LLSD::Integer) 0);
+		LLUICtrl* fsaa_ctrl = getChild<LLUICtrl>("fsaa");
+		LLTextBox* fsaa_text = getChild<LLTextBox>("antialiasing label");
+		LLView* fsaa_restart = getChildView("antialiasing restart");
+		
+		// Enable or disable the control, the "Antialiasing:" label and the restart warning
+		// based on code support for the feature on the current hardware.
+
+		if (gPipeline.canUseAntiAliasing())
+		{
+			fsaa_ctrl->setEnabled(TRUE);
+			
+			// borrow the text color from the gamma control for consistency
+			fsaa_text->setColor(gamma_ctrl->getEnabledTextColor());
+
+			fsaa_restart->setVisible(!gSavedSettings.getBOOL("RenderDeferred"));
+		}
+		else
+		{
+			fsaa_ctrl->setEnabled(FALSE);
+			fsaa_ctrl->setValue((LLSD::Integer) 0);
+			
+			// borrow the text color from the gamma control for consistency
+			fsaa_text->setColor(gamma_ctrl->getDisabledTextColor());
+			
+			fsaa_restart->setVisible(FALSE);
+		}
 	}
-	*/
 }
 
 //============================================================================
diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp
index e4d8e3513d72f79ed481a5a5f27703da8c5e0128..92ee8ddac6a54dc94d8519b1d787fd481c9bead9 100644
--- a/indra/newview/llfloaterimagepreview.cpp
+++ b/indra/newview/llfloaterimagepreview.cpp
@@ -50,6 +50,7 @@
 #include "llvoavatar.h"
 #include "pipeline.h"
 #include "lluictrlfactory.h"
+#include "llviewershadermgr.h"
 #include "llviewertexturelist.h"
 #include "llstring.h"
 
@@ -62,6 +63,7 @@
 const S32 PREVIEW_BORDER_WIDTH = 2;
 const S32 PREVIEW_RESIZE_HANDLE_SIZE = S32(RESIZE_HANDLE_WIDTH * OO_SQRT2) + PREVIEW_BORDER_WIDTH;
 const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE;
+const S32 PREVIEW_VPAD = -24;	// yuk, hard coded
 const S32 PREF_BUTTON_HEIGHT = 16 + 7 + 16;
 const S32 PREVIEW_TEXTURE_HEIGHT = 320;
 
@@ -98,7 +100,7 @@ BOOL LLFloaterImagePreview::postBuild()
 	childSetCommitCallback("clothing_type_combo", onPreviewTypeCommit, this);
 
 	mPreviewRect.set(PREVIEW_HPAD, 
-		PREVIEW_TEXTURE_HEIGHT,
+		PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD,
 		getRect().getWidth() - PREVIEW_HPAD, 
 		PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
 	mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f);
@@ -270,13 +272,13 @@ void LLFloaterImagePreview::draw()
 			gGL.begin( LLRender::QUADS );
 			{
 				gGL.texCoord2f(mPreviewImageRect.mLeft, mPreviewImageRect.mTop);
-				gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT);
+				gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
 				gGL.texCoord2f(mPreviewImageRect.mLeft, mPreviewImageRect.mBottom);
 				gGL.vertex2i(PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
 				gGL.texCoord2f(mPreviewImageRect.mRight, mPreviewImageRect.mBottom);
 				gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
 				gGL.texCoord2f(mPreviewImageRect.mRight, mPreviewImageRect.mTop);
-				gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT);
+				gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
 			}
 			gGL.end();
 
@@ -302,13 +304,13 @@ void LLFloaterImagePreview::draw()
 				gGL.begin( LLRender::QUADS );
 				{
 					gGL.texCoord2f(0.f, 1.f);
-					gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT);
+					gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
 					gGL.texCoord2f(0.f, 0.f);
 					gGL.vertex2i(PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
 					gGL.texCoord2f(1.f, 0.f);
 					gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
 					gGL.texCoord2f(1.f, 1.f);
-					gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT);
+					gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
 				}
 				gGL.end();
 
@@ -649,25 +651,30 @@ BOOL LLImagePreviewAvatar::render()
 	gGL.pushUIMatrix();
 	gGL.loadUIIdentity();
 
-	glMatrixMode(GL_PROJECTION);
+	gGL.matrixMode(LLRender::MM_PROJECTION);
 	gGL.pushMatrix();
-	glLoadIdentity();
-	glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
+	gGL.loadIdentity();
+	gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
 
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.pushMatrix();
-	glLoadIdentity();
+	gGL.loadIdentity();
 	
 
 	LLGLSUIDefault def;
 	gGL.color4f(0.15f, 0.2f, 0.3f, 1.f);
 
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		gUIProgram.bind();
+	}
+
 	gl_rect_2d_simple( mFullWidth, mFullHeight );
 
-	glMatrixMode(GL_PROJECTION);
+	gGL.matrixMode(LLRender::MM_PROJECTION);
 	gGL.popMatrix();
 
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.popMatrix();
 
 	gGL.flush();
@@ -690,8 +697,7 @@ BOOL LLImagePreviewAvatar::render()
 
 	LLVertexBuffer::unbind();
 	avatarp->updateLOD();
-	
-
+		
 	if (avatarp->mDrawable.notNull())
 	{
 		LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE);
@@ -699,7 +705,7 @@ BOOL LLImagePreviewAvatar::render()
 		LLGLDisable no_blend(GL_BLEND);
 
 		LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)avatarp->mDrawable->getFace(0)->getPool();
-		
+		gPipeline.enableLightsPreview();
 		avatarPoolp->renderAvatars(avatarp);  // renders only one avatar
 	}
 
@@ -790,15 +796,17 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance)
 	U32 num_indices = vf.mNumIndices;
 	U32 num_vertices = vf.mNumVertices;
 
-	mVertexBuffer = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL, 0);
+	mVertexBuffer = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0, 0);
 	mVertexBuffer->allocateBuffer(num_vertices, num_indices, TRUE);
 
 	LLStrider<LLVector3> vertex_strider;
 	LLStrider<LLVector3> normal_strider;
+	LLStrider<LLVector2> tc_strider;
 	LLStrider<U16> index_strider;
 
 	mVertexBuffer->getVertexStrider(vertex_strider);
 	mVertexBuffer->getNormalStrider(normal_strider);
+	mVertexBuffer->getTexCoord0Strider(tc_strider);
 	mVertexBuffer->getIndexStrider(index_strider);
 
 	// build vertices and normals
@@ -806,7 +814,8 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance)
 	pos = (LLVector3*) vf.mPositions; pos.setStride(16);
 	LLStrider<LLVector3> norm;
 	norm = (LLVector3*) vf.mNormals; norm.setStride(16);
-		
+	LLStrider<LLVector2> tc;
+	tc = (LLVector2*) vf.mTexCoords; tc.setStride(8);
 
 	for (U32 i = 0; i < num_vertices; i++)
 	{
@@ -814,6 +823,7 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance)
 		LLVector3 normal = *norm++;
 		normal.normalize();
 		*(normal_strider++) = normal;
+		*(tc_strider++) = *tc++;
 	}
 
 	// build indices
@@ -835,23 +845,28 @@ BOOL LLImagePreviewSculpted::render()
 	LLGLEnable cull(GL_CULL_FACE);
 	LLGLDepthTest depth(GL_TRUE);
 
-	glMatrixMode(GL_PROJECTION);
+	gGL.matrixMode(LLRender::MM_PROJECTION);
 	gGL.pushMatrix();
-	glLoadIdentity();
-	glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
+	gGL.loadIdentity();
+	gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
 
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.pushMatrix();
-	glLoadIdentity();
+	gGL.loadIdentity();
 		
 	gGL.color4f(0.15f, 0.2f, 0.3f, 1.f);
 
-	gl_rect_2d_simple( mFullWidth, mFullHeight );
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		gUIProgram.bind();
+	}
 
-	glMatrixMode(GL_PROJECTION);
+	gl_rect_2d_simple( mFullWidth, mFullHeight );
+	
+	gGL.matrixMode(LLRender::MM_PROJECTION);
 	gGL.popMatrix();
 
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.popMatrix();
 
 	glClear(GL_DEPTH_BUFFER_BIT);
@@ -876,17 +891,28 @@ BOOL LLImagePreviewSculpted::render()
 	const LLVolumeFace &vf = mVolume->getVolumeFace(0);
 	U32 num_indices = vf.mNumIndices;
 	
-	mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL);
-
 	gPipeline.enableLightsAvatar();
+
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		gObjectPreviewProgram.bind();
+	}
 	gGL.pushMatrix();
 	const F32 SCALE = 1.25f;
 	gGL.scalef(SCALE, SCALE, SCALE);
 	const F32 BRIGHTNESS = 0.9f;
 	gGL.color3f(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS);
+
+	mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0);
 	mVertexBuffer->draw(LLRender::TRIANGLES, num_indices, 0);
 
 	gGL.popMatrix();
+
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		gObjectPreviewProgram.unbind();
+	}
+
 	return TRUE;
 }
 
diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp
index a09b9ea235d78d18fdaebca609211fd649191742..cece8d299cc8ed2ea715828d7732a1edea325cb3 100644
--- a/indra/newview/llfloaterinspect.cpp
+++ b/indra/newview/llfloaterinspect.cpp
@@ -37,6 +37,7 @@
 #include "llselectmgr.h"
 #include "lltoolcomp.h"
 #include "lltoolmgr.h"
+#include "lltrans.h"
 #include "llviewercontrol.h"
 #include "llviewerobject.h"
 #include "lluictrlfactory.h"
@@ -166,6 +167,15 @@ LLUUID LLFloaterInspect::getSelectedUUID()
 	return LLUUID::null;
 }
 
+void LLFloaterInspect::onGetAvNameCallback(const LLUUID& idCreator, const LLAvatarName& av_name, void* FloaterPtr)
+{
+	if (FloaterPtr)
+	{
+		LLFloaterInspect* floater = (LLFloaterInspect*)FloaterPtr;
+		floater->dirty();
+	}
+}
+
 void LLFloaterInspect::refresh()
 {
 	LLUUID creator_id;
@@ -205,11 +215,32 @@ void LLFloaterInspect::refresh()
 		substitution["datetime"] = (S32) timestamp;
 		LLStringUtil::format (timeStr, substitution);
 
+		const LLUUID& idOwner = obj->mPermissions->getOwner();
+		const LLUUID& idCreator = obj->mPermissions->getCreator();
 		LLAvatarName av_name;
-		LLAvatarNameCache::get(obj->mPermissions->getOwner(), &av_name);
-		owner_name = av_name.getCompleteName();
-		LLAvatarNameCache::get(obj->mPermissions->getCreator(), &av_name);
-		creator_name = av_name.getCompleteName();
+
+		// Only work with the names if we actually get a result
+		// from the name cache. If not, defer setting the
+		// actual name and set a placeholder.
+		if (LLAvatarNameCache::get(idOwner, &av_name))
+		{
+			owner_name = av_name.getCompleteName();
+		}
+		else
+		{
+			owner_name = LLTrans::getString("RetrievingData");
+			LLAvatarNameCache::get(idOwner, boost::bind(&LLFloaterInspect::onGetAvNameCallback, _1, _2, this));
+		}
+
+		if (LLAvatarNameCache::get(idCreator, &av_name))
+		{
+			creator_name = av_name.getCompleteName();
+		}
+		else
+		{
+			creator_name = LLTrans::getString("RetrievingData");
+			LLAvatarNameCache::get(idCreator, boost::bind(&LLFloaterInspect::onGetAvNameCallback, _1, _2, this));
+		}
 		
 		row["id"] = obj->getObject()->getID();
 		row["columns"][0]["column"] = "object_name";
diff --git a/indra/newview/llfloaterinspect.h b/indra/newview/llfloaterinspect.h
index d9ffdf114b49273d000ac4fcc9e7f2deb466b901..7ee83ccdb47060e3c6837928a06601872da27782 100644
--- a/indra/newview/llfloaterinspect.h
+++ b/indra/newview/llfloaterinspect.h
@@ -29,6 +29,7 @@
 #ifndef LL_LLFLOATERINSPECT_H
 #define LL_LLFLOATERINSPECT_H
 
+#include "llavatarname.h"
 #include "llfloater.h"
 
 //class LLTool;
@@ -53,6 +54,9 @@ class LLFloaterInspect : public LLFloater
 	void onClickCreatorProfile();
 	void onClickOwnerProfile();
 	void onSelectObject();
+
+	static void onGetAvNameCallback(const LLUUID& idCreator, const LLAvatarName& av_name, void* FloaterPtr);
+
 	LLScrollListCtrl* mObjectList;
 protected:
 	// protected members
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 2bb1075ec4474010f536b2d20e42c766f9f4fe53..ee18c95b34745f00afbb1bda96268608aa953f58 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -1806,7 +1806,6 @@ LLPanelLandOptions::LLPanelLandOptions(LLParcelSelectionHandle& parcel)
 	mCheckEditGroupObjects(NULL),
 	mCheckAllObjectEntry(NULL),
 	mCheckGroupObjectEntry(NULL),
-	mCheckEditLand(NULL),
 	mCheckSafe(NULL),
 	mCheckFly(NULL),
 	mCheckGroupScripts(NULL),
@@ -1840,10 +1839,6 @@ BOOL LLPanelLandOptions::postBuild()
 	mCheckGroupObjectEntry = getChild<LLCheckBoxCtrl>( "group object entry check");
 	childSetCommitCallback("group object entry check", onCommitAny, this);
 	
-	mCheckEditLand = getChild<LLCheckBoxCtrl>( "edit land check");
-	childSetCommitCallback("edit land check", onCommitAny, this);
-
-	
 	mCheckGroupScripts = getChild<LLCheckBoxCtrl>( "check group scripts");
 	childSetCommitCallback("check group scripts", onCommitAny, this);
 
@@ -1956,9 +1951,6 @@ void LLPanelLandOptions::refresh()
 		mCheckGroupObjectEntry	->set(FALSE);
 		mCheckGroupObjectEntry	->setEnabled(FALSE);
 
-		mCheckEditLand		->set(FALSE);
-		mCheckEditLand		->setEnabled(FALSE);
-		
 		mCheckSafe			->set(FALSE);
 		mCheckSafe			->setEnabled(FALSE);
 
@@ -2006,10 +1998,6 @@ void LLPanelLandOptions::refresh()
 
 		mCheckGroupObjectEntry	->set( parcel->getAllowGroupObjectEntry() ||  parcel->getAllowAllObjectEntry());
 		mCheckGroupObjectEntry	->setEnabled( can_change_options && !parcel->getAllowAllObjectEntry() );
-
-		BOOL can_change_terraform = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_EDIT);
-		mCheckEditLand		->set( parcel->getAllowTerraform() );
-		mCheckEditLand		->setEnabled( can_change_terraform );
 		
 		mCheckSafe			->set( !parcel->getAllowDamage() );
 		mCheckSafe			->setEnabled( can_change_options );
@@ -2037,7 +2025,6 @@ void LLPanelLandOptions::refresh()
 		}
 
 		mSeeAvatarsCtrl->set(parcel->getSeeAVs());
-		mSeeAvatarsCtrl->setLabel(getString("see_avs_text"));
 		mSeeAvatarsCtrl->setEnabled(can_change_options && parcel->getHaveNewParcelLimitData());
 
 		BOOL can_change_landing_point = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, 
@@ -2235,7 +2222,7 @@ void LLPanelLandOptions::onCommitAny(LLUICtrl *ctrl, void *userdata)
 	BOOL create_group_objects	= self->mCheckEditGroupObjects->get() || self->mCheckEditObjects->get();
 	BOOL all_object_entry		= self->mCheckAllObjectEntry->get();
 	BOOL group_object_entry	= self->mCheckGroupObjectEntry->get() || self->mCheckAllObjectEntry->get();
-	BOOL allow_terraform	= self->mCheckEditLand->get();
+	BOOL allow_terraform	= false; // removed from UI so always off now - self->mCheckEditLand->get();
 	BOOL allow_damage		= !self->mCheckSafe->get();
 	BOOL allow_fly			= self->mCheckFly->get();
 	BOOL allow_landmark		= TRUE; // cannot restrict landmark creation
@@ -2487,27 +2474,6 @@ void LLPanelLandAccess::refresh()
 				mListBanned->addNameItem(entry.mID, ADD_DEFAULT, TRUE, suffix);
 			}
 		}
-		
-		LLCheckBoxWithTBAcess* maturity_checkbox = (LLCheckBoxWithTBAcess*) getChild<LLCheckBoxCtrl>( "public_access");
-		LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
-		if(region)
-		{
-			LLTextBox* maturity_textbox = maturity_checkbox->getTextBox();
-			insert_maturity_into_textbox(maturity_textbox, gFloaterView->getParentFloater(this), getString("allow_public_access"));
-			maturity_checkbox->reshape(maturity_checkbox->getRect().getWidth(), maturity_checkbox->getRect().getHeight(), FALSE);
-		}
-		else
-		{
-			std::string maturity_string = getString("allow_public_access");
-			size_t maturity_pos = maturity_string.find(MATURITY);
-
-			if (maturity_pos != std::string::npos)
-			{
-				maturity_string.replace(maturity_pos, MATURITY.length(), std::string(""));
-			}
-
-			maturity_checkbox->setLabel(maturity_string);
-		}
 
 		if(parcel->getRegionDenyAnonymousOverride())
 		{
@@ -2773,7 +2739,12 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata)
 
 void LLPanelLandAccess::onClickAddAccess()
 {
-	gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1)) );
+	LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(
+		boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1));
+	if (picker)
+	{
+		gFloaterView->getParentFloater(this)->addDependentFloater(picker);
+	}
 }
 
 void LLPanelLandAccess::callbackAvatarCBAccess(const uuid_vec_t& ids)
@@ -2817,7 +2788,12 @@ void LLPanelLandAccess::onClickRemoveAccess(void* data)
 // static
 void LLPanelLandAccess::onClickAddBanned()
 {
-	gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1)));
+	LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(
+		boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1));
+	if (picker)
+	{
+		gFloaterView->getParentFloater(this)->addDependentFloater(picker);
+	}
 }
 
 // static
diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h
index 6fceca1acddb5d7d6d1347f46e50dc03701d13f1..4f1c10274a044c53692f5c1eb982261d1136dced 100644
--- a/indra/newview/llfloaterland.h
+++ b/indra/newview/llfloaterland.h
@@ -330,7 +330,6 @@ class LLPanelLandOptions
 	LLCheckBoxCtrl*	mCheckEditGroupObjects;
 	LLCheckBoxCtrl*	mCheckAllObjectEntry;
 	LLCheckBoxCtrl*	mCheckGroupObjectEntry;
-	LLCheckBoxCtrl*	mCheckEditLand;
 	LLCheckBoxCtrl*	mCheckSafe;
 	LLCheckBoxCtrl*	mCheckFly;
 	LLCheckBoxCtrl*	mCheckGroupScripts;
diff --git a/indra/newview/llfloatermediasettings.cpp b/indra/newview/llfloatermediasettings.cpp
index b5f1b967df7e71b826f260958977a5c3ec23b3dc..4f2a6ec1b7058da7107d94c9400e6c771228e4ec 100644
--- a/indra/newview/llfloatermediasettings.cpp
+++ b/indra/newview/llfloatermediasettings.cpp
@@ -212,10 +212,13 @@ void LLFloaterMediaSettings::commitFields()
 //static 
 void LLFloaterMediaSettings::clearValues( bool editable)
 {
-	// clean up all panels before updating
-	sInstance->mPanelMediaSettingsGeneral	 ->clearValues(sInstance->mPanelMediaSettingsGeneral,  editable);
-	sInstance->mPanelMediaSettingsSecurity	 ->clearValues(sInstance->mPanelMediaSettingsSecurity,	editable);
-	sInstance->mPanelMediaSettingsPermissions->clearValues(sInstance->mPanelMediaSettingsPermissions,  editable);	
+	if (sInstance)
+	{
+		// clean up all panels before updating
+		sInstance->mPanelMediaSettingsGeneral	 ->clearValues(sInstance->mPanelMediaSettingsGeneral,  editable);
+		sInstance->mPanelMediaSettingsSecurity	 ->clearValues(sInstance->mPanelMediaSettingsSecurity,	editable);
+		sInstance->mPanelMediaSettingsPermissions->clearValues(sInstance->mPanelMediaSettingsPermissions,  editable);
+	}
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -309,3 +312,9 @@ bool LLFloaterMediaSettings::haveValuesChanged() const
 	return values_changed;
 }
 
+bool LLFloaterMediaSettings::instanceExists()
+{
+	return LLFloaterReg::findTypedInstance<LLFloaterMediaSettings>("media_settings");
+}
+
+
diff --git a/indra/newview/llfloatermediasettings.h b/indra/newview/llfloatermediasettings.h
index ecc55d2cbc9975fd477fcaf920675d5c5c4deb9a..1d25530986d09f7f0ffe182d23cc82c0c0a1a64d 100644
--- a/indra/newview/llfloatermediasettings.h
+++ b/indra/newview/llfloatermediasettings.h
@@ -45,6 +45,7 @@ class LLFloaterMediaSettings :
 	/*virtual*/ void onClose(bool app_quitting);
 
 	static LLFloaterMediaSettings* getInstance();
+	static bool instanceExists();
 	static void apply();
 	static void initValues( const LLSD& media_settings , bool editable);
 	static void clearValues( bool editable);
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
old mode 100644
new mode 100755
index 881f087d7b72d9e6216e1f7d086cb6636ccf3ca8..7448f2bb2a9fc5ade568d00f43c4ba45de0a393f
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -26,6 +26,10 @@
 
 #include "llviewerprecompiledheaders.h"
 
+#if LL_MSVC
+#pragma warning (disable : 4263)
+#pragma warning (disable : 4264)
+#endif
 #include "dae.h"
 //#include "dom.h"
 #include "dom/domAsset.h"
@@ -47,6 +51,10 @@
 #include "dom/domScale.h"
 #include "dom/domTranslate.h"
 #include "dom/domVisual_scene.h"
+#if LL_MSVC
+#pragma warning (default : 4263)
+#pragma warning (default : 4264)
+#endif
 
 #include "llfloatermodelpreview.h"
 
@@ -103,6 +111,7 @@
 #include "llviewerobjectlist.h"
 #include "llanimationstates.h"
 #include "llviewernetwork.h"
+#include "llviewershadermgr.h"
 #include "glod/glod.h"
 #include <boost/algorithm/string.hpp>
 
@@ -496,6 +505,11 @@ BOOL LLFloaterModelPreview::postBuild()
 	{
 		validate_url = "http://secondlife.com/my/account/mesh.php";
 	}
+	else if (current_grid == "damballah")
+	{
+		// Staging grid has its own naming scheme.
+		validate_url = "http://secondlife-staging.com/my/account/mesh.php";
+	}
 	else
 	{
 		validate_url = llformat("http://secondlife.%s.lindenlab.com/my/account/mesh.php",current_grid.c_str());
@@ -744,6 +758,11 @@ void LLFloaterModelPreview::draw()
 
 	if (!mModelPreview->mLoading)
 	{
+		if ( mModelPreview->getLoadState() == LLModelLoader::ERROR_MATERIALS )
+		{
+			childSetTextArg("status", "[STATUS]", getString("status_material_mismatch"));
+		}
+		else
 		if ( mModelPreview->getLoadState() > LLModelLoader::ERROR_PARSING )
 		{		
 			childSetTextArg("status", "[STATUS]", getString(LLModel::getStatusString(mModelPreview->getLoadState() - LLModelLoader::ERROR_PARSING)));
@@ -995,38 +1014,38 @@ void LLFloaterModelPreview::onPhysicsBrowse(LLUICtrl* ctrl, void* userdata)
 //static
 void LLFloaterModelPreview::onPhysicsUseLOD(LLUICtrl* ctrl, void* userdata)
 {
-	S32 num_modes = 4;
-	S32 which_mode = 3;
-	static S32 previous_mode = which_mode;
+	S32 num_lods = 4;
+	S32 which_mode;
 
 	LLCtrlSelectionInterface* iface = sInstance->childGetSelectionInterface("physics_lod_combo");
 	if (iface)
 	{
 		which_mode = iface->getFirstSelectedIndex();
 	}
+	else
+	{
+		llwarns << "no iface" << llendl;
+		return;
+	}
 
-	S32 file_mode = iface->getItemCount() - 1;
-	bool file_browse = which_mode == file_mode;
-	bool lod_to_file = file_browse && (previous_mode != file_mode);
-	bool file_to_lod = !file_browse && (previous_mode == file_mode);
-
-	if (!lod_to_file)
+	if (which_mode <= 0)
 	{
-		which_mode = num_modes - which_mode;
-		sInstance->mModelPreview->setPhysicsFromLOD(which_mode);
+		llwarns << "which_mode out of range, " << which_mode << llendl;
 	}
 
-	if (lod_to_file || file_to_lod)
+	S32 file_mode = iface->getItemCount() - 1;
+	if (which_mode < file_mode)
 	{
-		LLModelPreview *model_preview = sInstance->mModelPreview;
-		if (model_preview)
-		{
-			model_preview->refresh();
-			model_preview->updateStatusMessages();
-		}
+		S32 which_lod = num_lods - which_mode;
+		sInstance->mModelPreview->setPhysicsFromLOD(which_lod);
 	}
 
-	previous_mode = which_mode;
+	LLModelPreview *model_preview = sInstance->mModelPreview;
+	if (model_preview)
+	{
+		model_preview->refresh();
+		model_preview->updateStatusMessages();
+	}
 }
 
 //static 
@@ -3304,7 +3323,7 @@ void LLModelPreview::rebuildUploadData()
 	F32 max_scale = 0.f;
 
 	//reorder materials to match mBaseModel
-	for (U32 i = 0; i < LLModel::NUM_LODS; i++)
+	for (U32 i = 0; i < LLModel::NUM_LODS-1; i++)
 	{
 		if (mBaseModel.size() == mModel[i].size())
 		{
@@ -3316,6 +3335,7 @@ void LLModelPreview::rebuildUploadData()
 				
 				if ( !mModel[i][j]->matchMaterialOrder(mBaseModel[j], refFaceCnt, modelFaceCnt ) )
 				{
+					setLoadState( LLModelLoader::ERROR_MATERIALS );
 					mFMP->childDisable( "calculate_btn" );
 				}
 			}
@@ -3840,6 +3860,15 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
 
 	LLVertexBuffer::unbind();
 
+	bool no_ff = LLGLSLShader::sNoFixedFunction;
+	LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+	LLGLSLShader::sNoFixedFunction = false;
+
+	if (shader)
+	{
+		shader->unbind();
+	}
+	
 	stop_gloderror();
 	static U32 cur_name = 1;
 
@@ -3940,7 +3969,7 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
 				U32 num_indices = mVertexBuffer[5][mdl][i]->getNumIndices();
 				if (num_indices > 2)
 				{
-					glodInsertElements(mObject[mdl], i, GL_TRIANGLES, num_indices, GL_UNSIGNED_SHORT, mVertexBuffer[5][mdl][i]->getIndicesPointer(), 0, 0.f);
+					glodInsertElements(mObject[mdl], i, GL_TRIANGLES, num_indices, GL_UNSIGNED_SHORT, (U8*) mVertexBuffer[5][mdl][i]->getIndicesPointer(), 0, 0.f);
 				}
 				tri_count += num_indices/3;
 				stop_gloderror();
@@ -4054,14 +4083,14 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
 				{
 					buff->allocateBuffer(sizes[i*2+1], sizes[i*2], true);
 					buff->setBuffer(type_mask);
-					glodFillElements(mObject[base], names[i], GL_UNSIGNED_SHORT, buff->getIndicesPointer());
+					glodFillElements(mObject[base], names[i], GL_UNSIGNED_SHORT, (U8*) buff->getIndicesPointer());
 					stop_gloderror();
 				}
 				else
 				{ //this face was eliminated, create a dummy triangle (one vertex, 3 indices, all 0)
 					buff->allocateBuffer(1, 3, true);
-					memset(buff->getMappedData(), 0, buff->getSize());
-					memset(buff->getIndicesPointer(), 0, buff->getIndicesSize());
+					memset((U8*) buff->getMappedData(), 0, buff->getSize());
+					memset((U8*) buff->getIndicesPointer(), 0, buff->getIndicesSize());
 				}
 
 				buff->validateRange(0, buff->getNumVerts()-1, buff->getNumIndices(), 0);
@@ -4138,6 +4167,13 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
 
 	mResourceCost = calcResourceCost();
 
+	LLVertexBuffer::unbind();
+	LLGLSLShader::sNoFixedFunction = no_ff;
+	if (shader)
+	{
+		shader->bind();
+	}
+
 	/*if (which_lod == -1 && mScene[LLModel::LOD_PHYSICS].empty())
 	 { //build physics scene
 	 mScene[LLModel::LOD_PHYSICS] = mScene[LLModel::LOD_LOW];
@@ -4351,11 +4387,6 @@ void LLModelPreview::updateStatusMessages()
 		{
 			skinAndRigOk = false;
 		}	
-		else
-		if ( !isLegacyRigValid() )
-		{
-			mFMP->childDisable("calculate_btn");
-		}
 	}
 	
 	if(upload_ok && mModelLoader)
@@ -4494,7 +4525,17 @@ void LLModelPreview::updateStatusMessages()
 		}
 	}
 
-	if (mFMP->childGetValue("physics_lod_combo").asString() == "From file")
+	
+	LLCtrlSelectionInterface* iface = fmp->childGetSelectionInterface("physics_lod_combo");
+	S32 which_mode = 0; 
+	S32 file_mode = 1;
+	if (iface)
+	{
+		which_mode = iface->getFirstSelectedIndex();
+		file_mode = iface->getItemCount() - 1;
+	}
+
+	if (which_mode == file_mode)
 	{
 		mFMP->childEnable("physics_file");
 		mFMP->childEnable("physics_browse");
@@ -4849,8 +4890,8 @@ void LLModelPreview::addEmptyFace( LLModel* pTarget )
 	LLPointer<LLVertexBuffer> buff = new LLVertexBuffer(type_mask, 0);
 	
 	buff->allocateBuffer(1, 3, true);
-	memset( buff->getMappedData(), 0, buff->getSize() );
-	memset( buff->getIndicesPointer(), 0, buff->getIndicesSize() );
+	memset( (U8*) buff->getMappedData(), 0, buff->getSize() );
+	memset( (U8*) buff->getIndicesPointer(), 0, buff->getIndicesSize() );
 		
 	buff->validateRange( 0, buff->getNumVerts()-1, buff->getNumIndices(), 0 );
 		
@@ -4888,6 +4929,8 @@ BOOL LLModelPreview::render()
 	LLMutexLock lock(this);
 	mNeedsUpdate = FALSE;
 
+	bool use_shaders = LLGLSLShader::sNoFixedFunction;
+
 	bool edges = mViewOption["show_edges"];
 	bool joint_positions = mViewOption["show_joint_positions"];
 	bool skin_weight = mViewOption["show_skin_weight"];
@@ -4904,25 +4947,33 @@ BOOL LLModelPreview::render()
 	LLGLDisable fog(GL_FOG);
 
 	{
+		if (use_shaders)
+		{
+			gUIProgram.bind();
+		}
 		//clear background to blue
-		glMatrixMode(GL_PROJECTION);
+		gGL.matrixMode(LLRender::MM_PROJECTION);
 		gGL.pushMatrix();
-		glLoadIdentity();
-		glOrtho(0.0f, width, 0.0f, height, -1.0f, 1.0f);
+		gGL.loadIdentity();
+		gGL.ortho(0.0f, width, 0.0f, height, -1.0f, 1.0f);
 
-		glMatrixMode(GL_MODELVIEW);
+		gGL.matrixMode(LLRender::MM_MODELVIEW);
 		gGL.pushMatrix();
-		glLoadIdentity();
+		gGL.loadIdentity();
 
 		gGL.color4f(0.169f, 0.169f, 0.169f, 1.f);
 
 		gl_rect_2d_simple( width, height );
 
-		glMatrixMode(GL_PROJECTION);
+		gGL.matrixMode(LLRender::MM_PROJECTION);
 		gGL.popMatrix();
 
-		glMatrixMode(GL_MODELVIEW);
+		gGL.matrixMode(LLRender::MM_MODELVIEW);
 		gGL.popMatrix();
+		if (use_shaders)
+		{
+			gUIProgram.unbind();
+		}
 	}
 
 	LLFloaterModelPreview* fmp = LLFloaterModelPreview::sInstance;
@@ -5035,7 +5086,7 @@ BOOL LLModelPreview::render()
 		refresh();
 	}
 
-	glLoadIdentity();
+	gGL.loadIdentity();
 	gPipeline.enableLightsPreview();
 
 	LLQuaternion camera_rot = LLQuaternion(mCameraPitch, LLVector3::y_axis) *
@@ -5060,6 +5111,11 @@ BOOL LLModelPreview::render()
 
 	const U32 type_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0;
 
+	if (use_shaders)
+	{
+		gObjectPreviewProgram.bind();
+	}
+
 	LLGLEnable normalize(GL_NORMALIZE);
 
 	if (!mBaseModel.empty() && mVertexBuffer[5].empty())
@@ -5071,6 +5127,8 @@ BOOL LLModelPreview::render()
 
 	if (!mModel[mPreviewLOD].empty())
 	{
+		mFMP->childEnable("reset_btn");
+
 		bool regen = mVertexBuffer[mPreviewLOD].empty();
 		if (!regen)
 		{
@@ -5083,7 +5141,7 @@ BOOL LLModelPreview::render()
 		}
 
 		//make sure material lists all match
-		for (U32 i = 0; i < LLModel::NUM_LODS; i++)
+		for (U32 i = 0; i < LLModel::NUM_LODS-1; i++)
 		{
 			if (mBaseModel.size() == mModel[i].size())
 			{
@@ -5121,7 +5179,7 @@ BOOL LLModelPreview::render()
 				gGL.pushMatrix();
 				LLMatrix4 mat = instance.mTransform;
 
-				glMultMatrixf((GLfloat*) mat.mMatrix);
+				gGL.multMatrix((GLfloat*) mat.mMatrix);
 
 				for (U32 i = 0; i < mVertexBuffer[mPreviewLOD][model].size(); ++i)
 				{
@@ -5137,7 +5195,8 @@ BOOL LLModelPreview::render()
 							const std::string& binding = instance.mModel->mMaterialList[i];						
 							const LLImportMaterial& material = instance.mMaterial[binding];
 
-							glColor4fv(material.mDiffuseColor.mV);
+							gGL.diffuseColor4fv(material.mDiffuseColor.mV);
+
 							if (material.mDiffuseMap.notNull())
 							{
 								if (material.mDiffuseMap->getDiscardLevel() > -1)
@@ -5150,12 +5209,12 @@ BOOL LLModelPreview::render()
 					}
 					else
 					{
-						glColor4f(1,1,1,1);
+						gGL.diffuseColor4f(1,1,1,1);
 					}
 
 					buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
 					gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-					glColor3f(0.4f, 0.4f, 0.4f);
+					gGL.diffuseColor3f(0.4f, 0.4f, 0.4f);
 
 					if (edges)
 					{
@@ -5203,7 +5262,7 @@ BOOL LLModelPreview::render()
 						gGL.pushMatrix();
 						LLMatrix4 mat = instance.mTransform;
 
-						glMultMatrixf((GLfloat*) mat.mMatrix);
+						gGL.multMatrix((GLfloat*) mat.mMatrix);
 
 
 						bool render_mesh = true;
@@ -5268,12 +5327,12 @@ BOOL LLModelPreview::render()
 								LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][i];
 
 								gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-								glColor4f(0.4f, 0.4f, 0.0f, 0.4f);
+								gGL.diffuseColor4f(0.4f, 0.4f, 0.0f, 0.4f);
 
 								buffer->setBuffer(type_mask & buffer->getTypeMask());
 								buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
 
-								glColor3f(1.f, 1.f, 0.f);
+								gGL.diffuseColor3f(1.f, 1.f, 0.f);
 
 								glLineWidth(2.f);
 								glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
@@ -5293,7 +5352,7 @@ BOOL LLModelPreview::render()
 					//show degenerate triangles
 					LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
 					LLGLDisable cull(GL_CULL_FACE);
-					glColor4f(1.f,0.f,0.f,1.f);
+					gGL.diffuseColor4f(1.f,0.f,0.f,1.f);
 					const LLVector4a scale(0.5f);
 
 					for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter)
@@ -5310,7 +5369,7 @@ BOOL LLModelPreview::render()
 						gGL.pushMatrix();
 						LLMatrix4 mat = instance.mTransform;
 
-						glMultMatrixf((GLfloat*) mat.mMatrix);
+						gGL.multMatrix((GLfloat*) mat.mMatrix);
 
 
 						LLPhysicsDecomp* decomp = gMeshRepo.mDecompThread;
@@ -5376,7 +5435,16 @@ BOOL LLModelPreview::render()
 
 			if (joint_positions)
 			{
+				LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+				if (shader)
+				{
+					gDebugProgram.bind();
+				}
 				getPreviewAvatar()->renderCollisionVolumes();
+				if (shader)
+				{
+					shader->bind();
+				}
 			}
 
 			for (LLModelLoader::scene::iterator iter = mScene[mPreviewLOD].begin(); iter != mScene[mPreviewLOD].end(); ++iter)
@@ -5415,7 +5483,7 @@ BOOL LLModelPreview::render()
 								}
 							}
 
-							for (U32 j = 0; j < buffer->getRequestedVerts(); ++j)
+							for (U32 j = 0; j < buffer->getNumVerts(); ++j)
 							{
 								LLMatrix4 final_mat;
 								final_mat.mMatrix[0][0] = final_mat.mMatrix[1][1] = final_mat.mMatrix[2][2] = final_mat.mMatrix[3][3] = 0.f;
@@ -5459,11 +5527,12 @@ BOOL LLModelPreview::render()
 
 							const std::string& binding = instance.mModel->mMaterialList[i];
 							const LLImportMaterial& material = instance.mMaterial[binding];
+
 							buffer->setBuffer(type_mask & buffer->getTypeMask());
-							glColor4fv(material.mDiffuseColor.mV);
+							gGL.diffuseColor4fv(material.mDiffuseColor.mV);
 							gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 							buffer->draw(LLRender::TRIANGLES, buffer->getNumIndices(), 0);
-							glColor3f(0.4f, 0.4f, 0.4f);
+							gGL.diffuseColor3f(0.4f, 0.4f, 0.4f);
 
 							if (edges)
 							{
@@ -5480,6 +5549,11 @@ BOOL LLModelPreview::render()
 		}
 	}
 
+	if (use_shaders)
+	{
+		gObjectPreviewProgram.unbind();
+	}
+
 	gGL.popMatrix();
 
 	return TRUE;
@@ -5568,6 +5642,7 @@ void LLFloaterModelPreview::onReset(void* user_data)
 	assert_main_thread();
 
 	LLFloaterModelPreview* fmp = (LLFloaterModelPreview*) user_data;
+	fmp->childDisable("reset_btn");
 	LLModelPreview* mp = fmp->mModelPreview;
 	std::string filename = mp->mLODFile[3]; 
 
diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h
index 47de99ce25d939aa6f8231294297b19bd114a6a6..64324854a55e82415ce91c0f8afb1d8498cc5f21 100644
--- a/indra/newview/llfloatermodelpreview.h
+++ b/indra/newview/llfloatermodelpreview.h
@@ -70,7 +70,8 @@ class LLModelLoader : public LLThread
 		GENERATING_VERTEX_BUFFERS,
 		GENERATING_LOD,
 		DONE,
-		ERROR_PARSING //basically loading failed
+		ERROR_PARSING, //basically loading failed
+		ERROR_MATERIALS,
 	} eLoadState;
 
 	U32 mState;
diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp
index ae95d4392accfcd2641fd5c23d3a216ab416bc90..27b1c3b9cd6e1546d67ccd7dcd5fb12b81251fd1 100644
--- a/indra/newview/llfloaternamedesc.cpp
+++ b/indra/newview/llfloaternamedesc.cpp
@@ -204,3 +204,43 @@ BOOL LLFloaterSoundPreview::postBuild()
 	getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
 	return TRUE;
 }
+
+
+//-----------------------------------------------------------------------------
+// LLFloaterAnimPreview()
+//-----------------------------------------------------------------------------
+
+LLFloaterAnimPreview::LLFloaterAnimPreview(const LLSD& filename )
+	: LLFloaterNameDesc(filename)
+{
+}
+
+BOOL LLFloaterAnimPreview::postBuild()
+{
+	if (!LLFloaterNameDesc::postBuild())
+	{
+		return FALSE;
+	}
+	getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
+	return TRUE;
+}
+
+//-----------------------------------------------------------------------------
+// LLFloaterScriptPreview()
+//-----------------------------------------------------------------------------
+
+LLFloaterScriptPreview::LLFloaterScriptPreview(const LLSD& filename )
+	: LLFloaterNameDesc(filename)
+{
+	mIsText = TRUE;
+}
+
+BOOL LLFloaterScriptPreview::postBuild()
+{
+	if (!LLFloaterNameDesc::postBuild())
+	{
+		return FALSE;
+	}
+	getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
+	return TRUE;
+}
diff --git a/indra/newview/llfloaternamedesc.h b/indra/newview/llfloaternamedesc.h
index 7381a6334a993867bdd1eade9f3b2dcb7edb141c..41643681ac0fb81cca7699365f75d3d6410571c0 100644
--- a/indra/newview/llfloaternamedesc.h
+++ b/indra/newview/llfloaternamedesc.h
@@ -51,6 +51,7 @@ class LLFloaterNameDesc : public LLFloater
 
 protected:
 	BOOL        mIsAudio;
+	bool		mIsText;
 
 	std::string		mFilenameAndPath;
 	std::string		mFilename;
@@ -62,5 +63,19 @@ class LLFloaterSoundPreview : public LLFloaterNameDesc
 	LLFloaterSoundPreview(const LLSD& filename );
 	virtual BOOL postBuild();
 };
-	
+
+class LLFloaterAnimPreview : public LLFloaterNameDesc
+{
+public:
+	LLFloaterAnimPreview(const LLSD& filename );
+	virtual BOOL postBuild();
+};
+
+class LLFloaterScriptPreview : public LLFloaterNameDesc
+{
+public:
+	LLFloaterScriptPreview(const LLSD& filename );
+	virtual BOOL postBuild();
+};
+
 #endif  // LL_LLFLOATERNAMEDESC_H
diff --git a/indra/newview/llfloaternotificationsconsole.cpp b/indra/newview/llfloaternotificationsconsole.cpp
index 29af81d64c0e40e5266f74f482c5ec82e8e19e91..2681d4b34d2964de520e8f0d8e73a8cbccc01bfa 100644
--- a/indra/newview/llfloaternotificationsconsole.cpp
+++ b/indra/newview/llfloaternotificationsconsole.cpp
@@ -220,7 +220,7 @@ void LLFloaterNotificationConsole::addChannel(const std::string& name, bool open
 void LLFloaterNotificationConsole::removeChannel(const std::string& name)
 {
 	LLPanel* panelp = getChild<LLPanel>(name);
-	getChildRef<LLLayoutStack>("notification_channels").removePanel(panelp);
+	getChildRef<LLView>("notification_channels").removeChild(panelp);
 	delete panelp;
 
 	updateResizeLimits();
diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp
index 8b6619def2f1db6eb3bdc3e86975eb1fe34f398d..4bfef8b45fae6ff58b26e57f116ade9b25dc6785 100644
--- a/indra/newview/llfloateropenobject.cpp
+++ b/indra/newview/llfloateropenobject.cpp
@@ -162,26 +162,66 @@ void LLFloaterOpenObject::moveToInventory(bool wear)
 	{
 		parent_category_id = gInventory.getRootFolderID();
 	}
+	
+	LLCategoryCreate* cat_data = new LLCategoryCreate(object_id, wear);
+	
 	LLUUID category_id = gInventory.createNewCategory(parent_category_id, 
-		LLFolderType::FT_NONE, 
-		name);
+													  LLFolderType::FT_NONE, 
+													  name,
+													  callbackCreateInventoryCategory,
+													  (void*)cat_data);
+
+	//If we get a null category ID, we are using a capability in createNewCategory and we will
+	//handle the following in the callbackCreateInventoryCategory routine.
+	if ( category_id.notNull() )
+	{
+		delete cat_data;
+		
+		LLCatAndWear* data = new LLCatAndWear;
+		data->mCatID = category_id;
+		data->mWear = wear;
+		data->mFolderResponded = false;
+
+		// Copy and/or move the items into the newly created folder.
+		// Ignore any "you're going to break this item" messages.
+		BOOL success = move_inv_category_world_to_agent(object_id, category_id, TRUE,
+														callbackMoveInventory, 
+														(void*)data);
+		if (!success)
+		{
+			delete data;
+			data = NULL;
 
-	LLCatAndWear* data = new LLCatAndWear;
-	data->mCatID = category_id;
-	data->mWear = wear;
+			LLNotificationsUtil::add("OpenObjectCannotCopy");
+		}
+	}
+}
 
+// static
+void LLFloaterOpenObject::callbackCreateInventoryCategory(const LLSD& result, void* data)
+{
+	LLCategoryCreate* cat_data = (LLCategoryCreate*)data;
+	
+	LLUUID category_id = result["folder_id"].asUUID();
+	LLCatAndWear* wear_data = new LLCatAndWear;
+
+	wear_data->mCatID = category_id;
+	wear_data->mWear = cat_data->mWear;
+	wear_data->mFolderResponded = true;
+	
 	// Copy and/or move the items into the newly created folder.
 	// Ignore any "you're going to break this item" messages.
-	BOOL success = move_inv_category_world_to_agent(object_id, category_id, TRUE,
+	BOOL success = move_inv_category_world_to_agent(cat_data->mObjectID, category_id, TRUE,
 													callbackMoveInventory, 
-													(void*)data);
+													(void*)wear_data);
 	if (!success)
 	{
-		delete data;
-		data = NULL;
-
+		delete wear_data;
+		wear_data = NULL;
+		
 		LLNotificationsUtil::add("OpenObjectCannotCopy");
 	}
+	delete cat_data;	
 }
 
 // static
diff --git a/indra/newview/llfloateropenobject.h b/indra/newview/llfloateropenobject.h
index 0706e99f16493544e84ab5fe4e79aec7fd080eb5..bf7fe69c656fbad1bb9e4b9d7f9a926a34aed5a3 100644
--- a/indra/newview/llfloateropenobject.h
+++ b/indra/newview/llfloateropenobject.h
@@ -45,10 +45,20 @@ class LLFloaterOpenObject
 	
 	void dirty();
 	
+	class LLCategoryCreate
+	{
+		public:
+			LLCategoryCreate(LLUUID object_id, bool wear) : mObjectID(object_id), mWear(wear) {}
+		public:
+			LLUUID mObjectID;
+			bool mWear;
+	};
+	
 	struct LLCatAndWear
 	{
 		LLUUID mCatID;
 		bool mWear;
+		bool mFolderResponded;
 	};
 
 protected:
@@ -62,6 +72,7 @@ class LLFloaterOpenObject
 
 	void onClickMoveToInventory();
 	void onClickMoveAndWear();
+	static void callbackCreateInventoryCategory(const LLSD& result, void* data);
 	static void callbackMoveInventory(S32 result, void* data);
 
 private:
diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..540f977305f08c1d9023c8304602009ce117bbca
--- /dev/null
+++ b/indra/newview/llfloateroutbox.cpp
@@ -0,0 +1,567 @@
+/** 
+ * @file llfloateroutbox.cpp
+ * @brief Implementation of the merchant outbox window
+ *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llfloateroutbox.h"
+
+#include "llfloaterreg.h"
+#include "llfolderview.h"
+#include "llinventorybridge.h"
+#include "llinventorymodelbackgroundfetch.h"
+#include "llinventoryobserver.h"
+#include "llinventorypanel.h"
+#include "llmarketplacefunctions.h"
+#include "llnotificationhandler.h"
+#include "llnotificationmanager.h"
+#include "llnotificationsutil.h"
+#include "lltextbox.h"
+#include "lltransientfloatermgr.h"
+#include "lltrans.h"
+#include "llviewernetwork.h"
+#include "llwindowshade.h"
+
+#define USE_WINDOWSHADE_DIALOGS	0
+
+
+///----------------------------------------------------------------------------
+/// LLOutboxNotification class
+///----------------------------------------------------------------------------
+
+bool LLNotificationsUI::LLOutboxNotification::processNotification(const LLSD& notify)
+{
+	LLFloaterOutbox* outbox_floater = LLFloaterReg::getTypedInstance<LLFloaterOutbox>("outbox");
+	
+	outbox_floater->showNotification(notify);
+
+	return false;
+}
+
+
+///----------------------------------------------------------------------------
+/// LLOutboxAddedObserver helper class
+///----------------------------------------------------------------------------
+
+class LLOutboxAddedObserver : public LLInventoryCategoryAddedObserver
+{
+public:
+	LLOutboxAddedObserver(LLFloaterOutbox * outboxFloater)
+		: LLInventoryCategoryAddedObserver()
+		, mOutboxFloater(outboxFloater)
+	{
+	}
+	
+	void done()
+	{
+		for (cat_vec_t::iterator it = mAddedCategories.begin(); it != mAddedCategories.end(); ++it)
+		{
+			LLViewerInventoryCategory* added_category = *it;
+			
+			LLFolderType::EType added_category_type = added_category->getPreferredType();
+			
+			if (added_category_type == LLFolderType::FT_OUTBOX)
+			{
+				mOutboxFloater->setupOutbox(added_category->getUUID());
+			}
+		}
+	}
+	
+private:
+	LLFloaterOutbox *	mOutboxFloater;
+};
+
+///----------------------------------------------------------------------------
+/// LLFloaterOutbox
+///----------------------------------------------------------------------------
+
+LLFloaterOutbox::LLFloaterOutbox(const LLSD& key)
+	: LLFloater(key)
+	, mCategoriesObserver(NULL)
+	, mCategoryAddedObserver(NULL)
+	, mImportBusy(false)
+	, mImportButton(NULL)
+	, mInventoryFolderCountText(NULL)
+	, mInventoryImportInProgress(NULL)
+	, mInventoryPlaceholder(NULL)
+	, mInventoryText(NULL)
+	, mInventoryTitle(NULL)
+	, mOutboxId(LLUUID::null)
+	, mOutboxInventoryPanel(NULL)
+	, mOutboxItemCount(0)
+	, mOutboxTopLevelDropZone(NULL)
+	, mWindowShade(NULL)
+{
+}
+
+LLFloaterOutbox::~LLFloaterOutbox()
+{
+	if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver))
+	{
+		gInventory.removeObserver(mCategoriesObserver);
+	}
+	delete mCategoriesObserver;
+	
+	if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver))
+	{
+		gInventory.removeObserver(mCategoryAddedObserver);
+	}
+	delete mCategoryAddedObserver;
+}
+
+BOOL LLFloaterOutbox::postBuild()
+{
+	mInventoryFolderCountText = getChild<LLTextBox>("outbox_folder_count");
+	mInventoryImportInProgress = getChild<LLView>("import_progress_indicator");
+	mInventoryPlaceholder = getChild<LLView>("outbox_inventory_placeholder_panel");
+	mInventoryText = mInventoryPlaceholder->getChild<LLTextBox>("outbox_inventory_placeholder_text");
+	mInventoryTitle = mInventoryPlaceholder->getChild<LLTextBox>("outbox_inventory_placeholder_title");
+	
+	mImportButton = getChild<LLButton>("outbox_import_btn");
+	mImportButton->setCommitCallback(boost::bind(&LLFloaterOutbox::onImportButtonClicked, this));
+
+	mOutboxTopLevelDropZone = getChild<LLPanel>("outbox_generic_drag_target");
+
+	LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLFloaterOutbox::onFocusReceived, this));
+
+	return TRUE;
+}
+
+void LLFloaterOutbox::onClose(bool app_quitting)
+{
+	if (mWindowShade)
+	{
+		delete mWindowShade;
+
+		mWindowShade = NULL;
+	}
+}
+
+void LLFloaterOutbox::onOpen(const LLSD& key)
+{
+	//
+	// Look for an outbox and set up the inventory API
+	//
+	
+	if (mOutboxId.isNull())
+	{
+		const bool do_not_create_folder = false;
+		const bool do_not_find_in_library = false;
+		
+		const LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, do_not_create_folder, do_not_find_in_library);
+		
+		if (outbox_id.isNull())
+		{
+			// Observe category creation to catch outbox creation
+			mCategoryAddedObserver = new LLOutboxAddedObserver(this);
+			gInventory.addObserver(mCategoryAddedObserver);
+		}
+		else
+		{
+			setupOutbox(outbox_id);
+		}
+	}
+	
+	updateView();
+	
+	//
+	// Trigger fetch of outbox contents
+	//
+	
+	fetchOutboxContents();
+}
+
+void LLFloaterOutbox::onFocusReceived()
+{
+	fetchOutboxContents();
+}
+
+void LLFloaterOutbox::fetchOutboxContents()
+{
+	if (mOutboxId.notNull())
+	{
+		LLInventoryModelBackgroundFetch::instance().start(mOutboxId);
+	}
+}
+
+void LLFloaterOutbox::setupOutbox(const LLUUID& outboxId)
+{
+	llassert(outboxId.notNull());
+	llassert(mOutboxId.isNull());
+	llassert(mCategoriesObserver == NULL);
+	
+	mOutboxId = outboxId;
+	
+	// No longer need to observe new category creation
+	if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver))
+	{
+		gInventory.removeObserver(mCategoryAddedObserver);
+		delete mCategoryAddedObserver;
+		mCategoryAddedObserver = NULL;
+	}
+	
+	// Create observer for outbox modifications
+	mCategoriesObserver = new LLInventoryCategoriesObserver();
+	gInventory.addObserver(mCategoriesObserver);
+	
+	mCategoriesObserver->addCategory(mOutboxId, boost::bind(&LLFloaterOutbox::onOutboxChanged, this));
+	
+	//
+	// Set up the outbox inventory view
+	//
+	
+	mOutboxInventoryPanel = 
+		LLUICtrlFactory::createFromFile<LLInventoryPanel>("panel_outbox_inventory.xml",
+														  mInventoryPlaceholder->getParent(),
+														  LLInventoryPanel::child_registry_t::instance());
+	
+	llassert(mOutboxInventoryPanel);
+	
+	// Reshape the inventory to the proper size
+	LLRect inventory_placeholder_rect = mInventoryPlaceholder->getRect();
+	mOutboxInventoryPanel->setShape(inventory_placeholder_rect);
+	
+	// Set the sort order newest to oldest
+	mOutboxInventoryPanel->setSortOrder(LLInventoryFilter::SO_FOLDERS_BY_NAME);	
+	mOutboxInventoryPanel->getFilter()->markDefault();
+	
+	fetchOutboxContents();
+	
+	//
+	// Initialize the marketplace import API
+	//
+	
+	LLMarketplaceInventoryImporter& importer = LLMarketplaceInventoryImporter::instance();
+	
+	importer.setInitializationErrorCallback(boost::bind(&LLFloaterOutbox::initializationReportError, this, _1, _2));
+	importer.setStatusChangedCallback(boost::bind(&LLFloaterOutbox::importStatusChanged, this, _1));
+	importer.setStatusReportCallback(boost::bind(&LLFloaterOutbox::importReportResults, this, _1, _2));
+	importer.initialize();
+}
+
+void LLFloaterOutbox::setStatusString(const std::string& statusString)
+{
+	llassert(mInventoryFolderCountText != NULL);
+
+	mInventoryFolderCountText->setText(statusString);
+}
+
+void LLFloaterOutbox::updateFolderCount()
+{
+	S32 item_count = 0;
+
+	if (mOutboxId.notNull())
+	{
+		LLInventoryModel::cat_array_t * cats;
+		LLInventoryModel::item_array_t * items;
+		gInventory.getDirectDescendentsOf(mOutboxId, cats, items);
+
+		item_count = cats->count() + items->count();
+	}
+	
+	mOutboxItemCount = item_count;
+
+	if (!mImportBusy)
+	{
+		updateFolderCountStatus();
+	}
+}
+
+void LLFloaterOutbox::updateFolderCountStatus()
+{
+	if (mOutboxInventoryPanel)
+	{
+		switch (mOutboxItemCount)
+		{
+			case 0:	setStatusString(getString("OutboxFolderCount0"));	break;
+			case 1:	setStatusString(getString("OutboxFolderCount1"));	break;
+			default:
+			{
+				std::string item_count_str = llformat("%d", mOutboxItemCount);
+				
+				LLStringUtil::format_map_t args;
+				args["[NUM]"] = item_count_str;
+				
+				setStatusString(getString("OutboxFolderCountN", args));
+				break;
+			}
+		}
+	}
+
+	mImportButton->setEnabled(mOutboxItemCount > 0);
+}
+
+void LLFloaterOutbox::updateView()
+{
+	updateFolderCount();
+
+	if (mOutboxItemCount > 0)
+	{
+		mOutboxInventoryPanel->setVisible(TRUE);
+		mInventoryPlaceholder->setVisible(FALSE);
+	}
+	else
+	{
+		if (mOutboxInventoryPanel)
+		{
+			mOutboxInventoryPanel->setVisible(FALSE);
+		}
+
+		mInventoryPlaceholder->setVisible(TRUE);
+
+		std::string outbox_text;
+		std::string outbox_title;
+		std::string outbox_tooltip;
+		
+		const LLSD& subs = getMarketplaceStringSubstitutions();
+		
+		if (mOutboxId.notNull())
+		{
+			outbox_text = LLTrans::getString("InventoryOutboxNoItems", subs);
+			outbox_title = LLTrans::getString("InventoryOutboxNoItemsTitle");
+			outbox_tooltip = LLTrans::getString("InventoryOutboxNoItemsTooltip");
+		}
+		else
+		{
+			outbox_text = LLTrans::getString("InventoryOutboxNotMerchant", subs);
+			outbox_title = LLTrans::getString("InventoryOutboxNotMerchantTitle");
+			outbox_tooltip = LLTrans::getString("InventoryOutboxNotMerchantTooltip");
+		}
+		
+		mInventoryText->setValue(outbox_text);
+		mInventoryTitle->setValue(outbox_title);
+		mInventoryPlaceholder->getParent()->setToolTip(outbox_tooltip);
+	}
+}
+
+bool isAccepted(EAcceptance accept)
+{
+	return (accept >= ACCEPT_YES_COPY_SINGLE);
+}
+
+BOOL LLFloaterOutbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+										EDragAndDropType cargo_type,
+										void* cargo_data,
+										EAcceptance* accept,
+										std::string& tooltip_msg)
+{
+	if ((mOutboxInventoryPanel == NULL) ||
+		(mWindowShade && mWindowShade->isShown()) ||
+		LLMarketplaceInventoryImporter::getInstance()->isImportInProgress())
+	{
+		return FALSE;
+	}
+	
+	LLView * handled_view = childrenHandleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
+	BOOL handled = (handled_view != NULL);
+
+	// Determine if the mouse is inside the inventory panel itself or just within the floater
+	bool pointInInventoryPanel = false;
+	bool pointInInventoryPanelChild = false;
+	LLFolderView * root_folder = mOutboxInventoryPanel->getRootFolder();
+	if (mOutboxInventoryPanel->getVisible())
+	{
+		S32 inv_x, inv_y;
+		localPointToOtherView(x, y, &inv_x, &inv_y, mOutboxInventoryPanel);
+
+		pointInInventoryPanel = mOutboxInventoryPanel->getRect().pointInRect(inv_x, inv_y);
+
+		LLView * inventory_panel_child_at_point = mOutboxInventoryPanel->childFromPoint(inv_x, inv_y, true);
+		pointInInventoryPanelChild = (inventory_panel_child_at_point != root_folder);
+	}
+	
+	// Pass all drag and drop for this floater to the outbox inventory control
+	if (!handled || !isAccepted(*accept))
+	{
+		// Handle the drag and drop directly to the root of the outbox if we're not in the inventory panel
+		// (otherwise the inventory panel itself will handle the drag and drop operation, without any override)
+		if (!pointInInventoryPanel)
+		{
+			handled = root_folder->handleDragAndDropToThisFolder(mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
+		}
+
+		mOutboxTopLevelDropZone->setBackgroundVisible(handled && !drop && isAccepted(*accept));
+	}
+	else
+	{
+		mOutboxTopLevelDropZone->setBackgroundVisible(!pointInInventoryPanelChild);
+	}
+	
+	return handled;
+}
+
+BOOL LLFloaterOutbox::handleHover(S32 x, S32 y, MASK mask)
+{
+	mOutboxTopLevelDropZone->setBackgroundVisible(FALSE);
+
+	return LLFloater::handleHover(x, y, mask);
+}
+
+void LLFloaterOutbox::onMouseLeave(S32 x, S32 y, MASK mask)
+{
+	mOutboxTopLevelDropZone->setBackgroundVisible(FALSE);
+
+	LLFloater::onMouseLeave(x, y, mask);
+}
+
+void LLFloaterOutbox::onImportButtonClicked()
+{
+	mOutboxInventoryPanel->clearSelection();
+
+	mImportBusy = LLMarketplaceInventoryImporter::instance().triggerImport();
+}
+
+void LLFloaterOutbox::onOutboxChanged()
+{
+	llassert(!mOutboxId.isNull());
+	
+	if (mOutboxInventoryPanel)
+	{
+		mOutboxInventoryPanel->requestSort();
+	}
+
+	fetchOutboxContents();
+
+	updateView();
+}
+
+void LLFloaterOutbox::importReportResults(U32 status, const LLSD& content)
+{
+	if (status == MarketplaceErrorCodes::IMPORT_DONE)
+	{
+		LLNotificationsUtil::add("OutboxImportComplete");
+	}
+	else if (status == MarketplaceErrorCodes::IMPORT_DONE_WITH_ERRORS)
+	{
+		const LLSD& subs = getMarketplaceStringSubstitutions();
+
+		LLNotificationsUtil::add("OutboxImportHadErrors", subs);
+	}
+	else
+	{
+		char status_string[16];
+		sprintf(status_string, "%d", status);
+		
+		LLSD subs;
+		subs["[ERROR_CODE]"] = status_string;
+		
+		LLNotificationsUtil::add("OutboxImportFailed", subs);
+	}
+	
+	updateView();
+}
+
+void LLFloaterOutbox::importStatusChanged(bool inProgress)
+{
+	if (inProgress)
+	{
+		if (mImportBusy)
+		{
+			setStatusString(getString("OutboxImporting"));
+		}
+		else
+		{
+			setStatusString(getString("OutboxInitializing"));
+		}
+		
+		mImportBusy = true;
+		mImportButton->setEnabled(false);
+		mInventoryImportInProgress->setVisible(true);
+	}
+	else
+	{
+		mImportBusy = false;
+		mImportButton->setEnabled(mOutboxItemCount > 0);
+		mInventoryImportInProgress->setVisible(false);
+	}
+	
+	updateView();
+}
+
+void LLFloaterOutbox::initializationReportError(U32 status, const LLSD& content)
+{
+	if (status != MarketplaceErrorCodes::IMPORT_DONE)
+	{
+		char status_string[16];
+		sprintf(status_string, "%d", status);
+		
+		LLSD subs;
+		subs["[ERROR_CODE]"] = status_string;
+		
+		LLNotificationsUtil::add("OutboxInitFailed", subs);
+	}
+	
+	updateView();
+}
+
+void LLFloaterOutbox::showNotification(const LLSD& notify)
+{
+	LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
+	
+	if (!notification)
+	{
+		llerrs << "Unable to find outbox notification!" << notify.asString() << llendl;
+		
+		return;
+	}
+
+#if USE_WINDOWSHADE_DIALOGS
+
+	if (mWindowShade)
+	{
+		delete mWindowShade;
+	}
+	
+	LLRect floater_rect = getLocalRect();
+	floater_rect.mTop -= getHeaderHeight();
+	floater_rect.stretch(-5, 0);
+	
+	LLWindowShade::Params params;
+	params.name = "notification_shade";
+	params.rect = floater_rect;
+	params.follows.flags = FOLLOWS_ALL;
+	params.modal = true;
+	params.can_close = false;
+	params.shade_color = LLColor4::white % 0.25f;
+	params.text_color = LLColor4::white;
+	
+	mWindowShade = LLUICtrlFactory::create<LLWindowShade>(params);
+	
+	addChild(mWindowShade);
+	mWindowShade->show(notification);
+	
+#else
+	
+	LLNotificationsUI::LLEventHandler * handler =
+		LLNotificationsUI::LLNotificationManager::instance().getHandlerForNotification("alertmodal");
+	
+	LLNotificationsUI::LLSysHandler * sys_handler = dynamic_cast<LLNotificationsUI::LLSysHandler *>(handler);
+	llassert(sys_handler);
+	
+	sys_handler->processNotification(notify);
+	
+#endif
+}
+
diff --git a/indra/newview/llfloateroutbox.h b/indra/newview/llfloateroutbox.h
new file mode 100644
index 0000000000000000000000000000000000000000..18baccf1c95e75ae3c74dacdf3675fcb8cba4734
--- /dev/null
+++ b/indra/newview/llfloateroutbox.h
@@ -0,0 +1,114 @@
+/** 
+ * @file llfloateroutbox.h
+ * @brief LLFloaterOutbox
+ * class definition
+ *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * ABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLFLOATEROUTBOX_H
+#define LL_LLFLOATEROUTBOX_H
+
+#include "llfloater.h"
+#include "llfoldertype.h"
+#include "llnotificationptr.h"
+
+
+class LLButton;
+class LLInventoryCategoriesObserver;
+class LLInventoryCategoryAddedObserver;
+class LLInventoryPanel;
+class LLLoadingIndicator;
+class LLNotification;
+class LLTextBox;
+class LLView;
+class LLWindowShade;
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLFloaterOutbox
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+class LLFloaterOutbox : public LLFloater
+{
+public:
+	LLFloaterOutbox(const LLSD& key);
+	~LLFloaterOutbox();
+	
+	void setupOutbox(const LLUUID& outboxId);
+
+	// virtuals
+	BOOL postBuild();
+	BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+						   EDragAndDropType cargo_type,
+						   void* cargo_data,
+						   EAcceptance* accept,
+						   std::string& tooltip_msg);
+	
+	void showNotification(const LLSD& notify);
+
+	BOOL handleHover(S32 x, S32 y, MASK mask);
+	void onMouseLeave(S32 x, S32 y, MASK mask);
+
+protected:
+	void fetchOutboxContents();
+
+	void importReportResults(U32 status, const LLSD& content);
+	void importStatusChanged(bool inProgress);
+	void initializationReportError(U32 status, const LLSD& content);
+	
+	void onClose(bool app_quitting);
+	void onOpen(const LLSD& key);
+
+	void onFocusReceived();
+
+	void onImportButtonClicked();
+	void onOutboxChanged();
+	
+	void setStatusString(const std::string& statusString);
+	
+	void updateFolderCount();
+	void updateFolderCountStatus();
+	void updateView();
+
+private:
+	LLInventoryCategoriesObserver *		mCategoriesObserver;
+	LLInventoryCategoryAddedObserver *	mCategoryAddedObserver;
+	
+	bool			mImportBusy;
+	LLButton *		mImportButton;
+	
+	LLTextBox *		mInventoryFolderCountText;
+	LLView *		mInventoryImportInProgress;
+	LLView *		mInventoryPlaceholder;
+	LLTextBox *		mInventoryText;
+	LLTextBox *		mInventoryTitle;
+	
+	LLUUID				mOutboxId;
+	LLInventoryPanel *	mOutboxInventoryPanel;
+	U32					mOutboxItemCount;
+	LLPanel *			mOutboxTopLevelDropZone;
+	
+	LLWindowShade *	mWindowShade;
+};
+
+#endif // LL_LLFLOATEROUTBOX_H
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index a333989e7e5951319f38aa05027acc803965821e..173b0e538cab14114b54b4116b0cf97fb2e9fd87 100755
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -741,7 +741,8 @@ void LLFloaterPreference::onClose(bool app_quitting)
 
 void LLFloaterPreference::onOpenHardwareSettings()
 {
-	LLFloaterReg::showInstance("prefs_hardware_settings");
+	LLFloater* floater = LLFloaterReg::showInstance("prefs_hardware_settings");
+	addDependentFloater(floater, FALSE);
 }
 // static 
 void LLFloaterPreference::onBtnOK()
@@ -1800,7 +1801,46 @@ void LLPanelPreference::updateMediaAutoPlayCheckbox(LLUICtrl* ctrl)
 	}
 }
 
+class LLPanelPreferencePrivacy : public LLPanelPreference
+{
+public:
+	LLPanelPreferencePrivacy()
+	{
+		mAccountIndependentSettings.push_back("VoiceCallsFriendsOnly");
+		mAccountIndependentSettings.push_back("AutoDisengageMic");
+	}
+
+	/*virtual*/ void saveSettings()
+	{
+		LLPanelPreference::saveSettings();
+
+		// Don't save (=erase from the saved values map) per-account privacy settings
+		// if we're not logged in, otherwise they will be reset to defaults on log off.
+		if (LLStartUp::getStartupState() != STATE_STARTED)
+		{
+			// Erase only common settings, assuming there are no color settings on Privacy page.
+			for (control_values_map_t::iterator it = mSavedValues.begin(); it != mSavedValues.end(); )
+			{
+				const std::string setting = it->first->getName();
+				if (std::find(mAccountIndependentSettings.begin(),
+					mAccountIndependentSettings.end(), setting) == mAccountIndependentSettings.end())
+				{
+					mSavedValues.erase(it++);
+				}
+				else
+				{
+					++it;
+				}
+			}
+		}
+	}
+
+private:
+	std::list<std::string> mAccountIndependentSettings;
+};
+
 static LLRegisterPanelClassWrapper<LLPanelPreferenceGraphics> t_pref_graph("panel_preference_graphics");
+static LLRegisterPanelClassWrapper<LLPanelPreferencePrivacy> t_pref_privacy("panel_preference_privacy");
 
 BOOL LLPanelPreferenceGraphics::postBuild()
 {
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index 7ee3294478b9e6e2da634590c7a0ba76fca6eba8..ec5994e91754afa5a071a478179dac2843b8e565 100644
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -198,15 +198,17 @@ class LLPanelPreference : public LLPanel
 	virtual void saveSettings();
 	
 	class Updater;
+
+protected:
+	typedef std::map<LLControlVariable*, LLSD> control_values_map_t;
+	control_values_map_t mSavedValues;
+
 private:
 	//for "Only friends and groups can call or IM me"
 	static void showFriendsOnlyWarning(LLUICtrl*, const LLSD&);
 	//for "Show my Favorite Landmarks at Login"
 	static void showFavoritesOnLoginWarning(LLUICtrl* checkbox, const LLSD& value);
 
-	typedef std::map<LLControlVariable*, LLSD> control_values_map_t;
-	control_values_map_t mSavedValues;
-
 	typedef std::map<std::string, LLColor4> string_color_map_t;
 	string_color_map_t mSavedColors;
 
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 676059779c74df64dedfc690d02b8d4cf5a2fd95..17850ff35d382fc8550fc6dc67792bf1a87c58ee 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -650,7 +650,10 @@ void LLPanelRegionGeneralInfo::onClickKick()
 	// in order to set up floater dependency
 	LLFloater* parent_floater = gFloaterView->getParentFloater(this);
 	LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionGeneralInfo::onKickCommit, this, _1), FALSE, TRUE);
-	parent_floater->addDependentFloater(child_floater);
+	if (child_floater)
+	{
+		parent_floater->addDependentFloater(child_floater);
+	}
 }
 
 void LLPanelRegionGeneralInfo::onKickCommit(const uuid_vec_t& ids)
@@ -1470,7 +1473,10 @@ void LLPanelEstateInfo::onClickKickUser()
 	// in order to set up floater dependency
 	LLFloater* parent_floater = gFloaterView->getParentFloater(this);
 	LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateInfo::onKickUserCommit, this, _1), FALSE, TRUE);
-	parent_floater->addDependentFloater(child_floater);
+	if (child_floater)
+	{
+		parent_floater->addDependentFloater(child_floater);
+	}
 }
 
 void LLPanelEstateInfo::onKickUserCommit(const uuid_vec_t& ids)
@@ -1891,6 +1897,26 @@ void LLPanelEstateInfo::sendEstateAccessDelta(U32 flags, const LLUUID& agent_or_
 	gAgent.sendReliableMessage();
 }
 
+// static
+void LLPanelEstateInfo::updateEstateOwnerName(const std::string& name)
+{
+	LLPanelEstateInfo* panelp = LLFloaterRegionInfo::getPanelEstate();
+	if (panelp)
+	{
+		panelp->setOwnerName(name);
+	}
+}
+
+// static
+void LLPanelEstateInfo::updateEstateName(const std::string& name)
+{
+	LLPanelEstateInfo* panelp = LLFloaterRegionInfo::getPanelEstate();
+	if (panelp)
+	{
+		panelp->getChildRef<LLTextBox>("estate_name").setText(name);
+	}
+}
+
 void LLPanelEstateInfo::updateControls(LLViewerRegion* region)
 {
 	BOOL god = gAgent.isGodlike();
diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h
index c402de66e86443ed6be7be5427c47fb7b0e8c787..e36ef4604b23d950e8b1b303eef68d586a647e5d 100644
--- a/indra/newview/llfloaterregioninfo.h
+++ b/indra/newview/llfloaterregioninfo.h
@@ -33,6 +33,7 @@
 #include "llfloater.h"
 #include "llhost.h"
 #include "llpanel.h"
+#include "llextendedstatus.h"
 
 #include "llenvmanager.h" // for LLEnvironmentSettings
 
@@ -293,6 +294,9 @@ class LLPanelEstateInfo : public LLPanelRegionInfo
 	
 	void updateControls(LLViewerRegion* region);
 	
+	static void updateEstateName(const std::string& name);
+	static void updateEstateOwnerName(const std::string& name);
+
 	virtual bool refreshFromRegion(LLViewerRegion* region);
 	virtual bool estateUpdate(LLMessageSystem* msg);
 	
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index c08848b1ea4f1fc59c652c5446692c2d4a5e2404..3ec1e372eb1bd2eae68d599bdc52f9a08763f36e 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -285,7 +285,11 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id)
 
 void LLFloaterReporter::onClickSelectAbuser()
 {
-	gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLFloaterReporter::callbackAvatarID, this, _1, _2), FALSE, TRUE ));
+	LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterReporter::callbackAvatarID, this, _1, _2), FALSE, TRUE );
+	if (picker)
+	{
+		gFloaterView->getParentFloater(this)->addDependentFloater(picker);
+	}
 }
 
 void LLFloaterReporter::callbackAvatarID(const uuid_vec_t& ids, const std::vector<LLAvatarName> names)
diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h
index cd98f7be57312b4b2b1de51e5e46424a10e64098..7d684317103d4e747e17ee02fde1fdc8dc868085 100644
--- a/indra/newview/llfloaterreporter.h
+++ b/indra/newview/llfloaterreporter.h
@@ -31,6 +31,7 @@
 #include "llfloater.h"
 #include "lluuid.h"
 #include "v3math.h"
+#include "llextendedstatus.h"
 
 class LLAvatarName;
 class LLMessageSystem;
diff --git a/indra/newview/llfloaterscriptdebug.cpp b/indra/newview/llfloaterscriptdebug.cpp
index a0d1a32e1295659579bbd4ce48ea1f71879e41c9..b691db1049f04756867a7a3cf3b1791207a3ee15 100644
--- a/indra/newview/llfloaterscriptdebug.cpp
+++ b/indra/newview/llfloaterscriptdebug.cpp
@@ -106,7 +106,11 @@ void LLFloaterScriptDebug::addScriptLine(const std::string &utf8mesg, const std:
 	if (objectp)
 	{
 		objectp->setIcon(LLViewerTextureManager::getFetchedTextureFromFile("script_error.j2c", TRUE, LLViewerTexture::BOOST_UI));
-		floater_label = llformat("%s(%.2f, %.2f)", user_name.c_str(), objectp->getPositionRegion().mV[VX], objectp->getPositionRegion().mV[VY]);
+		floater_label = llformat("%s(%.0f, %.0f, %.0f)",
+						user_name.c_str(),
+						objectp->getPositionRegion().mV[VX],
+						objectp->getPositionRegion().mV[VY],
+						objectp->getPositionRegion().mV[VZ]);
 	}
 	else
 	{
diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp
index 3434841d09b52d3d3e288079b86b9cc715b94b08..64c0dfa0236b7ed1fe48bc4bc01e173fb1aaa42d 100644
--- a/indra/newview/llfloatersellland.cpp
+++ b/indra/newview/llfloatersellland.cpp
@@ -392,8 +392,12 @@ void LLFloaterSellLandUI::onChangeValue(LLUICtrl *ctrl, void *userdata)
 
 void LLFloaterSellLandUI::doSelectAgent()
 {
+	LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterSellLandUI::callbackAvatarPick, this, _1, _2), FALSE, TRUE);
 	// grandparent is a floater, in order to set up dependency
-	addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLFloaterSellLandUI::callbackAvatarPick, this, _1, _2), FALSE, TRUE));
+	if (picker)
+	{
+		addDependentFloater(picker);
+	}
 }
 
 void LLFloaterSellLandUI::callbackAvatarPick(const uuid_vec_t& ids, const std::vector<LLAvatarName> names)
diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp
index be7a53491d81a8c7f86ed94d71a647efe11ce3c7..5385977d95d23071be0d24e440fe7a0abae19ba9 100644
--- a/indra/newview/llfloatersidepanelcontainer.cpp
+++ b/indra/newview/llfloatersidepanelcontainer.cpp
@@ -59,7 +59,10 @@ LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_na
 	LLView* view = findChildView(panel_name, true);
 	if (!view) return NULL;
 
-	openFloater();
+	if (!getVisible())
+	{
+		openFloater();
+	}
 
 	LLPanel* panel = NULL;
 
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index 48e6cca6236f88fe62bee74d4af030e64c0efea7..d8d62e5bbbee6d422889cce9408079e61b0638eb 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -100,9 +100,6 @@ S32 BORDER_WIDTH = 6;
 const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte
 const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512
 
-static std::string lastSnapshotWidthName(S32 shot_type);
-static std::string lastSnapshotHeightName(S32 shot_type);
-
 static LLDefaultChildRegistry::Register<LLSnapshotFloaterView> r("snapshot_floater_view");
 
 ///----------------------------------------------------------------------------
@@ -138,7 +135,11 @@ class LLSnapshotLivePreview : public LLView
 	/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent);
 	
 	void setSize(S32 w, S32 h);
+	void setWidth(S32 w) { mWidth[mCurImageIndex] = w; }
+	void setHeight(S32 h) { mHeight[mCurImageIndex] = h; }
 	void getSize(S32& w, S32& h) const;
+	S32 getWidth() const { return mWidth[mCurImageIndex]; }
+	S32 getHeight() const { return mHeight[mCurImageIndex]; }
 	S32 getDataSize() const { return mDataSize; }
 	void setMaxImageSize(S32 size) ;
 	S32  getMaxImageSize() {return mMaxImageSize ;}
@@ -155,8 +156,9 @@ class LLSnapshotLivePreview : public LLView
 	LLViewerTexture* getCurrentImage();
 	F32 getImageAspect();
 	F32 getAspect() ;
-	LLRect getImageRect();
-	BOOL isImageScaled();
+	const LLRect& getImageRect() const { return mImageRect[mCurImageIndex]; }
+	BOOL isImageScaled() const { return mImageScaled[mCurImageIndex]; }
+	void setImageScaled(BOOL scaled) { mImageScaled[mCurImageIndex] = scaled; }
 	const LLVector3d& getPosTakenGlobal() const { return mPosTakenGlobal; }
 	
 	void setSnapshotType(ESnapshotType type) { mSnapshotType = type; }
@@ -171,6 +173,7 @@ class LLSnapshotLivePreview : public LLView
 	LLPointer<LLImageFormatted>	getFormattedImage() const { return mFormattedImage; }
 	LLPointer<LLImageRaw>		getEncodedImage() const { return mPreviewImageEncoded; }
 
+	/// Sets size of preview thumbnail image and thhe surrounding rect.
 	BOOL setThumbnailImageSize() ;
 	void generateThumbnailImage(BOOL force_update = FALSE) ;
 	void resetThumbnailImage() { mThumbnailImage = NULL ; }
@@ -299,7 +302,7 @@ LLViewerTexture* LLSnapshotLivePreview::getCurrentImage()
 
 F32 LLSnapshotLivePreview::getAspect()
 {
-	F32 image_aspect_ratio = ((F32)mWidth[mCurImageIndex]) / ((F32)mHeight[mCurImageIndex]);
+	F32 image_aspect_ratio = ((F32)getWidth()) / ((F32)getHeight());
 	F32 window_aspect_ratio = ((F32)getRect().getWidth()) / ((F32)getRect().getHeight());
 
 	if (!mKeepAspectRatio)//gSavedSettings.getBOOL("KeepAspectForSnapshot"))
@@ -314,7 +317,7 @@ F32 LLSnapshotLivePreview::getAspect()
 
 F32 LLSnapshotLivePreview::getImageAspect()
 {
-	if (!mViewerImage[mCurImageIndex])
+	if (!getCurrentImage())
 	{
 		return 0.f;
 	}
@@ -322,33 +325,24 @@ F32 LLSnapshotLivePreview::getImageAspect()
 	return getAspect() ;	
 }
 
-LLRect LLSnapshotLivePreview::getImageRect()
-{
-	return mImageRect[mCurImageIndex];
-}
-
-BOOL LLSnapshotLivePreview::isImageScaled()
-{
-	return mImageScaled[mCurImageIndex];
-}
-
 void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail, F32 delay) 
 {
-	lldebugs << "updateSnapshot: mSnapshotUpToDate = " << mSnapshotUpToDate << llendl;
-	if (mSnapshotUpToDate)
+	// Invalidate current image.
+	lldebugs << "updateSnapshot: mSnapshotUpToDate = " << getSnapshotUpToDate() << llendl;
+	if (getSnapshotUpToDate())
 	{
 		S32 old_image_index = mCurImageIndex;
 		mCurImageIndex = (mCurImageIndex + 1) % 2; 
-		mWidth[mCurImageIndex] = mWidth[old_image_index];
-		mHeight[mCurImageIndex] = mHeight[old_image_index];
+		setSize(mWidth[old_image_index], mHeight[old_image_index]);
 		mFallAnimTimer.start();		
 	}
 	mSnapshotUpToDate = FALSE; 		
 
+	// Update snapshot source rect depending on whether we keep the aspect ratio.
 	LLRect& rect = mImageRect[mCurImageIndex];
 	rect.set(0, getRect().getHeight(), getRect().getWidth(), 0);
 
-	F32 image_aspect_ratio = ((F32)mWidth[mCurImageIndex]) / ((F32)mHeight[mCurImageIndex]);
+	F32 image_aspect_ratio = ((F32)getWidth()) / ((F32)getHeight());
 	F32 window_aspect_ratio = ((F32)getRect().getWidth()) / ((F32)getRect().getHeight());
 
 	if (mKeepAspectRatio)//gSavedSettings.getBOOL("KeepAspectForSnapshot"))
@@ -369,18 +363,22 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail
 		}
 	}
 
+	// Stop shining animation.
 	mShineAnimTimer.stop();
+
+	// Update snapshot if requested.
 	if (new_snapshot)
 	{
 		mSnapshotDelayTimer.start();
 		mSnapshotDelayTimer.setTimerExpirySec(delay);
 		LLFloaterSnapshot::preUpdate();
 	}
+
+	// Update thumbnail if requested.
 	if(new_thumbnail)
 	{
 		mThumbnailUpToDate = FALSE ;
 	}
-	setThumbnailImageSize();
 }
 
 void LLSnapshotLivePreview::setSnapshotQuality(S32 quality)
@@ -436,26 +434,26 @@ void LLSnapshotLivePreview::drawPreviewRect(S32 offset_x, S32 offset_y)
 //called when the frame is frozen.
 void LLSnapshotLivePreview::draw()
 {
-	if (mViewerImage[mCurImageIndex].notNull() &&
+	if (getCurrentImage() &&
 	    mPreviewImageEncoded.notNull() &&
-	    mSnapshotUpToDate)
+	    getSnapshotUpToDate())
 	{
 		LLColor4 bg_color(0.f, 0.f, 0.3f, 0.4f);
 		gl_rect_2d(getRect(), bg_color);
-		LLRect &rect = mImageRect[mCurImageIndex];
-		LLRect shadow_rect = mImageRect[mCurImageIndex];
+		const LLRect& rect = getImageRect();
+		LLRect shadow_rect = rect;
 		shadow_rect.stretch(BORDER_WIDTH);
 		gl_drop_shadow(shadow_rect.mLeft, shadow_rect.mTop, shadow_rect.mRight, shadow_rect.mBottom, LLColor4(0.f, 0.f, 0.f, mNeedsFlash ? 0.f :0.5f), 10);
 
 		LLColor4 image_color(1.f, 1.f, 1.f, 1.f);
 		gGL.color4fv(image_color.mV);
-		gGL.getTexUnit(0)->bind(mViewerImage[mCurImageIndex]);
+		gGL.getTexUnit(0)->bind(getCurrentImage());
 		// calculate UV scale
-		F32 uv_width = mImageScaled[mCurImageIndex] ? 1.f : llmin((F32)mWidth[mCurImageIndex] / (F32)mViewerImage[mCurImageIndex]->getWidth(), 1.f);
-		F32 uv_height = mImageScaled[mCurImageIndex] ? 1.f : llmin((F32)mHeight[mCurImageIndex] / (F32)mViewerImage[mCurImageIndex]->getHeight(), 1.f);
-		glPushMatrix();
+		F32 uv_width = isImageScaled() ? 1.f : llmin((F32)getWidth() / (F32)getCurrentImage()->getWidth(), 1.f);
+		F32 uv_height = isImageScaled() ? 1.f : llmin((F32)getHeight() / (F32)getCurrentImage()->getHeight(), 1.f);
+		gGL.pushMatrix();
 		{
-			glTranslatef((F32)rect.mLeft, (F32)rect.mBottom, 0.f);
+			gGL.translatef((F32)rect.mLeft, (F32)rect.mBottom, 0.f);
 			gGL.begin(LLRender::QUADS);
 			{
 				gGL.texCoord2f(uv_width, uv_height);
@@ -472,7 +470,7 @@ void LLSnapshotLivePreview::draw()
 			}
 			gGL.end();
 		}
-		glPopMatrix();
+		gGL.popMatrix();
 
 		gGL.color4f(1.f, 1.f, 1.f, mFlashAlpha);
 		gl_rect_2d(getRect());
@@ -492,6 +490,7 @@ void LLSnapshotLivePreview::draw()
 			mFlashAlpha = lerp(mFlashAlpha, 0.f, LLCriticalDamp::getInterpolant(0.15f));
 		}
 
+		// Draw shining animation if appropriate.
 		if (mShineCountdown > 0)
 		{
 			mShineCountdown--;
@@ -502,6 +501,7 @@ void LLSnapshotLivePreview::draw()
 		}
 		else if (mShineAnimTimer.getStarted())
 		{
+			lldebugs << "Drawing shining animation" << llendl;
 			F32 shine_interp = llmin(1.f, mShineAnimTimer.getElapsedTimeF32() / SHINE_TIME);
 			
 			// draw "shine" effect
@@ -546,7 +546,7 @@ void LLSnapshotLivePreview::draw()
 	{
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 		gGL.color4f(1.f, 1.f, 1.f, 1.f);
-		LLRect outline_rect = mImageRect[mCurImageIndex];
+		const LLRect& outline_rect = getImageRect();
 		gGL.begin(LLRender::QUADS);
 		{
 			gGL.vertex2i(outline_rect.mLeft - BORDER_WIDTH, outline_rect.mTop + BORDER_WIDTH);
@@ -578,6 +578,7 @@ void LLSnapshotLivePreview::draw()
 		S32 old_image_index = (mCurImageIndex + 1) % 2;
 		if (mViewerImage[old_image_index].notNull() && mFallAnimTimer.getElapsedTimeF32() < FALL_TIME)
 		{
+			lldebugs << "Drawing fall animation" << llendl;
 			F32 fall_interp = mFallAnimTimer.getElapsedTimeF32() / FALL_TIME;
 			F32 alpha = clamp_rescale(fall_interp, 0.f, 1.f, 0.8f, 0.4f);
 			LLColor4 image_color(1.f, 1.f, 1.f, alpha);
@@ -588,11 +589,11 @@ void LLSnapshotLivePreview::draw()
 			BOOL rescale = !mImageScaled[old_image_index] && mViewerImage[mCurImageIndex].notNull();
 			F32 uv_width = rescale ? llmin((F32)mWidth[old_image_index] / (F32)mViewerImage[mCurImageIndex]->getWidth(), 1.f) : 1.f;
 			F32 uv_height = rescale ? llmin((F32)mHeight[old_image_index] / (F32)mViewerImage[mCurImageIndex]->getHeight(), 1.f) : 1.f;
-			glPushMatrix();
+			gGL.pushMatrix();
 			{
 				LLRect& rect = mImageRect[old_image_index];
-				glTranslatef((F32)rect.mLeft, (F32)rect.mBottom - llround(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f);
-				glRotatef(-45.f * fall_interp, 0.f, 0.f, 1.f);
+				gGL.translatef((F32)rect.mLeft, (F32)rect.mBottom - llround(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f);
+				gGL.rotatef(-45.f * fall_interp, 0.f, 0.f, 1.f);
 				gGL.begin(LLRender::QUADS);
 				{
 					gGL.texCoord2f(uv_width, uv_height);
@@ -609,7 +610,7 @@ void LLSnapshotLivePreview::draw()
 				}
 				gGL.end();
 			}
-			glPopMatrix();
+			gGL.popMatrix();
 		}
 	}
 }
@@ -621,13 +622,14 @@ void LLSnapshotLivePreview::reshape(S32 width, S32 height, BOOL called_from_pare
 	LLView::reshape(width, height, called_from_parent);
 	if (old_rect.getWidth() != width || old_rect.getHeight() != height)
 	{
+		lldebugs << "window reshaped, updating thumbnail" << llendl;
 		updateSnapshot(FALSE, TRUE);
 	}
 }
 
 BOOL LLSnapshotLivePreview::setThumbnailImageSize()
 {
-	if(mWidth[mCurImageIndex] < 10 || mHeight[mCurImageIndex] < 10)
+	if(getWidth() < 10 || getHeight() < 10)
 	{
 		return FALSE ;
 	}
@@ -663,11 +665,11 @@ BOOL LLSnapshotLivePreview::setThumbnailImageSize()
 	S32 left = 0 , top = mThumbnailHeight, right = mThumbnailWidth, bottom = 0 ;
 	if(!mKeepAspectRatio)
 	{
-		F32 ratio_x = (F32)mWidth[mCurImageIndex] / window_width ;
-		F32 ratio_y = (F32)mHeight[mCurImageIndex] / window_height ;
+		F32 ratio_x = (F32)getWidth() / window_width ;
+		F32 ratio_y = (F32)getHeight() / window_height ;
 
-		//if(mWidth[mCurImageIndex] > window_width ||
-		//	mHeight[mCurImageIndex] > window_height )
+		//if(getWidth() > window_width ||
+		//	getHeight() > window_height )
 		{
 			if(ratio_x > ratio_y)
 			{
@@ -699,11 +701,11 @@ void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update)
 	{
 		return ;
 	}
-	if(mThumbnailUpToDate && !force_update)//already updated
+	if(getThumbnailUpToDate() && !force_update)//already updated
 	{
 		return ;
 	}
-	if(mWidth[mCurImageIndex] < 10 || mHeight[mCurImageIndex] < 10)
+	if(getWidth() < 10 || getHeight() < 10)
 	{
 		return ;
 	}
@@ -723,25 +725,19 @@ void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update)
 		resetThumbnailImage() ;
 	}		
 
-	LLPointer<LLImageRaw> raw = NULL ;
-	S32 w , h ;
-	w = get_lower_power_two(mThumbnailWidth, 512) * 2 ;
-	h = get_lower_power_two(mThumbnailHeight, 512) * 2 ;
-
+	LLPointer<LLImageRaw> raw = new LLImageRaw;
+	if(!gViewerWindow->thumbnailSnapshot(raw,
+							mThumbnailWidth, mThumbnailHeight,
+							gSavedSettings.getBOOL("RenderUIInSnapshot"),
+							FALSE,
+							mSnapshotBufferType) )								
 	{
-		raw = new LLImageRaw ;
-		if(!gViewerWindow->thumbnailSnapshot(raw,
-								w, h,
-								gSavedSettings.getBOOL("RenderUIInSnapshot"),
-								FALSE,
-								mSnapshotBufferType) )								
-		{
-			raw = NULL ;
-		}
+		raw = NULL ;
 	}
 
 	if(raw)
 	{
+		raw->expandToPowerOfTwo();
 		mThumbnailImage = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE); 		
 		mThumbnailUpToDate = TRUE ;
 	}
@@ -757,15 +753,13 @@ void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update)
 BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
 {
 	LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)snapshot_preview;
-
-#if 1 // XXX tmp
-	if (previewp->mWidth[previewp->mCurImageIndex] == 0 || previewp->mHeight[previewp->mCurImageIndex] == 0)
+	if (previewp->getWidth() == 0 || previewp->getHeight() == 0)
 	{
-		llwarns << "Incorrect dimensions: " << previewp->mWidth[previewp->mCurImageIndex] << "x" << previewp->mHeight[previewp->mCurImageIndex] << llendl;
+		llwarns << "Incorrect dimensions: " << previewp->getWidth() << "x" << previewp->getHeight() << llendl;
 		return FALSE;
 	}
-#endif
 
+	// If we're in freeze-frame mode and camera has moved, update snapshot.
 	LLVector3 new_camera_pos = LLViewerCamera::getInstance()->getOrigin();
 	LLQuaternion new_camera_rot = LLViewerCamera::getInstance()->getQuaternion();
 	if (gSavedSettings.getBOOL("FreezeTime") && 
@@ -775,6 +769,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
 		previewp->mCameraRot = new_camera_rot;
 		// request a new snapshot whenever the camera moves, with a time delay
 		BOOL autosnap = gSavedSettings.getBOOL("AutoSnapshot");
+		lldebugs << "camera moved, updating thumbnail" << llendl;
 		previewp->updateSnapshot(
 			autosnap, // whether a new snapshot is needed or merely invalidate the existing one
 			FALSE, // or if 1st arg is false, whether to produce a new thumbnail image.
@@ -791,6 +786,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
 	}
 
 	// time to produce a snapshot
+	previewp->setThumbnailImageSize();
 
 	lldebugs << "producing snapshot" << llendl;
 	if (!previewp->mPreviewImage)
@@ -807,13 +803,13 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
 	previewp->setEnabled(FALSE);
 	
 	previewp->getWindow()->incBusyCount();
-	previewp->mImageScaled[previewp->mCurImageIndex] = FALSE;
+	previewp->setImageScaled(FALSE);
 
 	// grab the raw image and encode it into desired format
 	if(gViewerWindow->rawSnapshot(
 							previewp->mPreviewImage,
-							previewp->mWidth[previewp->mCurImageIndex],
-							previewp->mHeight[previewp->mCurImageIndex],
+							previewp->getWidth(),
+							previewp->getHeight(),
 							previewp->mKeepAspectRatio,//gSavedSettings.getBOOL("KeepAspectForSnapshot"),
 							previewp->getSnapshotType() == LLSnapshotLivePreview::SNAPSHOT_TEXTURE,
 							gSavedSettings.getBOOL("RenderUIInSnapshot"),
@@ -836,8 +832,8 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
 				previewp->mPreviewImage->getHeight(),
 				previewp->mPreviewImage->getComponents());
 		
-			scaled->biasedScaleToPowerOfTwo(512);
-			previewp->mImageScaled[previewp->mCurImageIndex] = TRUE;
+			scaled->biasedScaleToPowerOfTwo(MAX_TEXTURE_SIZE);
+			previewp->setImageScaled(TRUE);
 			if (formatted->encode(scaled, 0.f))
 			{
 				previewp->mDataSize = formatted->getDataSize();
@@ -892,7 +888,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
 			{
 				// go ahead and shrink image to appropriate power of 2 for display
 				scaled->biasedScaleToPowerOfTwo(1024);
-				previewp->mImageScaled[previewp->mCurImageIndex] = TRUE;
+				previewp->setImageScaled(TRUE);
 			}
 			else
 			{
@@ -939,14 +935,14 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
 void LLSnapshotLivePreview::setSize(S32 w, S32 h)
 {
 	lldebugs << "setSize(" << w << ", " << h << ")" << llendl;
-	mWidth[mCurImageIndex] = w;
-	mHeight[mCurImageIndex] = h;
+	setWidth(w);
+	setHeight(h);
 }
 
 void LLSnapshotLivePreview::getSize(S32& w, S32& h) const
 {
-	w = mWidth[mCurImageIndex];
-	h = mHeight[mCurImageIndex];
+	w = getWidth();
+	h = getHeight();
 }
 
 void LLSnapshotLivePreview::saveTexture()
@@ -963,9 +959,9 @@ void LLSnapshotLivePreview::saveTexture()
 												  mPreviewImage->getHeight(),
 												  mPreviewImage->getComponents());
 	
-	scaled->biasedScaleToPowerOfTwo(512);
+	scaled->biasedScaleToPowerOfTwo(MAX_TEXTURE_SIZE);
 	lldebugs << "scaled texture to " << scaled->getWidth() << "x" << scaled->getHeight() << llendl;
-			
+
 	if (formatted->encode(scaled, 0.0f))
 	{
 		LLVFile::writeFile(formatted->getData(), formatted->getDataSize(), gVFS, new_asset_id, LLAssetType::AT_TEXTURE);
@@ -1003,13 +999,7 @@ void LLSnapshotLivePreview::saveTexture()
 
 BOOL LLSnapshotLivePreview::saveLocal()
 {
-	BOOL success = gViewerWindow->saveImageNumbered(mFormattedImage, true);
-
-	// Relinquish image memory. Save button will be disabled as a side-effect.
-	lldebugs << "resetting formatted image after saving to disk" << llendl;
-	mFormattedImage = NULL;
-	mDataSize = 0;
-	updateSnapshot(FALSE, FALSE);
+	BOOL success = gViewerWindow->saveImageNumbered(mFormattedImage);
 
 	if(success)
 	{
@@ -1064,6 +1054,7 @@ class LLFloaterSnapshot::Impl
 	:	mAvatarPauseHandles(),
 		mLastToolset(NULL),
 		mAspectRatioCheckOff(false),
+		mNeedRefresh(false),
 		mStatus(STATUS_READY)
 	{
 	}
@@ -1079,25 +1070,18 @@ class LLFloaterSnapshot::Impl
 	static void onClickMore(void* data) ;
 	static void onClickUICheck(LLUICtrl *ctrl, void* data);
 	static void onClickHUDCheck(LLUICtrl *ctrl, void* data);
-#if 0
-	static void onClickKeepAspectCheck(LLUICtrl *ctrl, void* data);
-#endif
 	static void applyKeepAspectCheck(LLFloaterSnapshot* view, BOOL checked);
-	static void onCommitResolution(LLUICtrl* ctrl, void* data) { updateResolution(ctrl, data); }
 	static void updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update = TRUE);
 	static void onCommitFreezeFrame(LLUICtrl* ctrl, void* data);
 	static void onCommitLayerTypes(LLUICtrl* ctrl, void*data);
 	static void onImageQualityChange(LLFloaterSnapshot* view, S32 quality_val);
 	static void onImageFormatChange(LLFloaterSnapshot* view);
-#if 0
-	static void onCommitSnapshotType(LLUICtrl* ctrl, void* data);
-	static void onCommitCustomResolution(LLUICtrl *ctrl, void* data);
-#endif
 	static void applyCustomResolution(LLFloaterSnapshot* view, S32 w, S32 h);
 	static void onSnapshotUploadFinished(bool status);
 	static void onSendingPostcardFinished(bool status);
-	static void resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32 width, S32 height) ;
 	static BOOL checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value);
+	static void setImageSizeSpinnersValues(LLFloaterSnapshot *view, S32 width, S32 height) ;
+	static void updateSpinners(LLFloaterSnapshot* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL is_width_changed);
 
 	static LLPanelSnapshot* getActivePanel(LLFloaterSnapshot* floater, bool ok_if_not_found = true);
 	static LLSnapshotLivePreview::ESnapshotType getActiveSnapshotType(LLFloaterSnapshot* floater);
@@ -1113,6 +1097,7 @@ class LLFloaterSnapshot::Impl
 	static void updateLayout(LLFloaterSnapshot* floater);
 	static void setStatus(EStatus status, bool ok = true, const std::string& msg = LLStringUtil::null);
 	EStatus getStatus() const { return mStatus; }
+	static void setNeedRefresh(LLFloaterSnapshot* floater, bool need);
 
 private:
 	static LLViewerWindow::ESnapshotType getLayerType(LLFloaterSnapshot* floater);
@@ -1129,6 +1114,7 @@ class LLFloaterSnapshot::Impl
 	LLToolset*	mLastToolset;
 	LLHandle<LLView> mPreviewHandle;
 	bool mAspectRatioCheckOff ;
+	bool mNeedRefresh;
 	EStatus mStatus;
 };
 
@@ -1251,7 +1237,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
 
 	// Show/hide advanced options.
 	LLPanel* advanced_options_panel = floaterp->getChild<LLPanel>("advanced_options_panel");
-	floaterp->getChild<LLButton>("advanced_options_btn")->setToggleState(advanced);
+	floaterp->getChild<LLButton>("advanced_options_btn")->setImageOverlay(advanced ? "TabIcon_Open_Off" : "TabIcon_Close_Off");
 	if (advanced != advanced_options_panel->getVisible())
 	{
 		S32 panel_width = advanced_options_panel->getRect().getWidth();
@@ -1266,16 +1252,9 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
 		previewp->mKeepAspectRatio = TRUE;
 
 		floaterp->getChild<LLComboBox>("profile_size_combo")->setCurrentByIndex(0);
-		gSavedSettings.setS32("SnapshotProfileLastResolution", 0);
-
 		floaterp->getChild<LLComboBox>("postcard_size_combo")->setCurrentByIndex(0);
-		gSavedSettings.setS32("SnapshotPostcardLastResolution", 0);
-
 		floaterp->getChild<LLComboBox>("texture_size_combo")->setCurrentByIndex(0);
-		gSavedSettings.setS32("SnapshotTextureLastResolution", 0);
-
 		floaterp->getChild<LLComboBox>("local_size_combo")->setCurrentByIndex(0);
-		gSavedSettings.setS32("SnapshotLocalLastResolution", 0);
 
 		LLSnapshotLivePreview* previewp = getPreviewView(floaterp);
 		previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw());
@@ -1347,6 +1326,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
 // No other methods should be changing any of the controls directly except for helpers called by this method.
 // The basic pattern for programmatically changing the GUI settings is to first set the
 // appropriate saved settings and then call this method to sync the GUI with them.
+// FIXME: The above comment seems obsolete now.
 // static
 void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
 {
@@ -1358,19 +1338,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
 	floater->getChildView("share_to_web")->setVisible( gSavedSettings.getBOOL("SnapshotSharingEnabled"));
 #endif
 
-#if 0
-	floater->getChildView("postcard_size_combo")->setVisible( FALSE);
-	floater->getChildView("texture_size_combo")->setVisible( FALSE);
-	floater->getChildView("local_size_combo")->setVisible( FALSE);
-#endif
-
-	floater->getChild<LLComboBox>("profile_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotProfileLastResolution"));
-	floater->getChild<LLComboBox>("postcard_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotPostcardLastResolution"));
-	floater->getChild<LLComboBox>("texture_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotTextureLastResolution"));
-	floater->getChild<LLComboBox>("local_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotLocalLastResolution"));
 	floater->getChild<LLComboBox>("local_format_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFormat"));
-
-	// *TODO: Separate settings for Web images from postcards
 	enableAspectRatioCheckbox(floater, !floater->impl.mAspectRatioCheckOff);
 	setAspectRatioCheckboxValue(floater, gSavedSettings.getBOOL("KeepAspectForSnapshot"));
 	floater->getChildView("layer_types")->setEnabled(shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL);
@@ -1384,19 +1352,20 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
 		// Initialize spinners.
 		if (width_ctrl->getValue().asInteger() == 0)
 		{
-			S32 w = gSavedSettings.getS32(lastSnapshotWidthName(shot_type));
+			S32 w = gViewerWindow->getWindowWidthRaw();
 			lldebugs << "Initializing width spinner (" << width_ctrl->getName() << "): " << w << llendl;
 			width_ctrl->setValue(w);
 		}
 		if (height_ctrl->getValue().asInteger() == 0)
 		{
-			S32 h = gSavedSettings.getS32(lastSnapshotHeightName(shot_type));
+			S32 h = gViewerWindow->getWindowHeightRaw();
 			lldebugs << "Initializing height spinner (" << height_ctrl->getName() << "): " << h << llendl;
 			height_ctrl->setValue(h);
 		}
 
+		// Сlamp snapshot resolution to window size when showing UI or HUD in snapshot.
 		if (gSavedSettings.getBOOL("RenderUIInSnapshot") || gSavedSettings.getBOOL("RenderHUDInSnapshot"))
-		{ //clamp snapshot resolution to window size when showing UI or HUD in snapshot
+		{
 			S32 width = gViewerWindow->getWindowWidthRaw();
 			S32 height = gViewerWindow->getWindowHeightRaw();
 
@@ -1425,7 +1394,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
 	BOOL got_snap = previewp && previewp->getSnapshotUpToDate();
 
 	// *TODO: Separate maximum size for Web images from postcards
-	//lldebugs << "Is snapshot up-to-date? " << got_snap << llendl;
+	lldebugs << "Is snapshot up-to-date? " << got_snap << llendl;
 
 	LLLocale locale(LLLocale::USER_LOCALE);
 	std::string bytes_string;
@@ -1450,6 +1419,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
 		&& got_bytes
 		&& previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" ));
 
+	// Update the width and height spinners based on the corresponding resolution combos. (?)
 	switch(shot_type)
 	{
 	  case LLSnapshotLivePreview::SNAPSHOT_WEB:
@@ -1476,7 +1446,6 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
 
 	if (previewp)
 	{
-		lldebugs << "Setting snapshot type (" << shot_type << "), format (" << shot_format << ")" << llendl;
 		previewp->setSnapshotType(shot_type);
 		previewp->setSnapshotFormat(shot_format);
 		previewp->setSnapshotBufferType(layer_type);
@@ -1489,6 +1458,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
 		info["have-snapshot"] = got_snap;
 		current_panel->updateControls(info);
 	}
+	lldebugs << "finished updating controls" << llendl;
 }
 
 // static
@@ -1514,12 +1484,28 @@ void LLFloaterSnapshot::Impl::setStatus(EStatus status, bool ok, const std::stri
 	floater->impl.mStatus = status;
 }
 
+// static
+void LLFloaterSnapshot::Impl::setNeedRefresh(LLFloaterSnapshot* floater, bool need)
+{
+	if (!floater) return;
+
+	// Don't display the "Refresh to save" message if we're in auto-refresh mode.
+	if (gSavedSettings.getBOOL("AutoSnapshot"))
+	{
+		need = false;
+	}
+
+	floater->mRefreshLabel->setVisible(need);
+	floater->impl.mNeedRefresh = need;
+}
+
 // static
 void LLFloaterSnapshot::Impl::checkAutoSnapshot(LLSnapshotLivePreview* previewp, BOOL update_thumbnail)
 {
 	if (previewp)
 	{
 		BOOL autosnap = gSavedSettings.getBOOL("AutoSnapshot");
+		lldebugs << "updating " << (autosnap ? "snapshot" : "thumbnail") << llendl;
 		previewp->updateSnapshot(autosnap, update_thumbnail, autosnap ? AUTO_SNAPSHOT_TIME_DELAY : 0.f);
 	}
 }
@@ -1531,6 +1517,8 @@ void LLFloaterSnapshot::Impl::onClickNewSnapshot(void* data)
 	LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
 	if (previewp && view)
 	{
+		view->impl.setStatus(Impl::STATUS_READY);
+		lldebugs << "updating snapshot" << llendl;
 		previewp->updateSnapshot(TRUE);
 	}
 }
@@ -1556,18 +1544,10 @@ void LLFloaterSnapshot::Impl::onClickMore(void* data)
 	LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
 	if (view)
 	{
+		view->impl.setStatus(Impl::STATUS_READY);
 		gSavedSettings.setBOOL("AdvanceSnapshot", !visible);
-#if 0
-		view->translate( 0, view->getUIWinHeightShort() - view->getUIWinHeightLong() );
-		view->reshape(view->getRect().getWidth(), view->getUIWinHeightLong());
-#endif
 		updateControls(view) ;
 		updateLayout(view) ;
-		// *TODO: redundant?
-		if(getPreviewView(view))
-		{
-			getPreviewView(view)->setThumbnailImageSize() ;
-		}
 	}
 }
 
@@ -1599,16 +1579,6 @@ void LLFloaterSnapshot::Impl::onClickHUDCheck(LLUICtrl *ctrl, void* data)
 	}
 }
 
-#if 0
-// static
-void LLFloaterSnapshot::Impl::onClickKeepAspectCheck(LLUICtrl* ctrl, void* data)
-{
-	LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;
-	LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
-	applyKeepAspectCheck(view, check->get());
-}
-#endif
-
 // static
 void LLFloaterSnapshot::Impl::applyKeepAspectCheck(LLFloaterSnapshot* view, BOOL checked)
 {
@@ -1623,11 +1593,9 @@ void LLFloaterSnapshot::Impl::applyKeepAspectCheck(LLFloaterSnapshot* view, BOOL
 
 			S32 w, h ;
 			previewp->getSize(w, h) ;
-			if(checkImageSize(previewp, w, h, TRUE, previewp->getMaxImageSize()))
-			{
-				resetSnapshotSizeOnUI(view, w, h) ;
-			}
+			updateSpinners(view, previewp, w, h, TRUE); // may change w and h
 
+			lldebugs << "updating thumbnail" << llendl;
 			previewp->setSize(w, h) ;
 			previewp->updateSnapshot(FALSE, TRUE);
 			checkAutoSnapshot(previewp, TRUE);
@@ -1662,41 +1630,34 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde
 		previewp->mKeepAspectRatio = FALSE ;
 		return ;
 	}
-	
-	if(0 == index) //current window size
-	{
-		view->impl.mAspectRatioCheckOff = true ;
-		enableAspectRatioCheckbox(view, FALSE);
 
-		if(previewp)
-		{
-			previewp->mKeepAspectRatio = TRUE ;
-		}
+	BOOL keep_aspect = FALSE, enable_cb = FALSE;
+
+	if (0 == index) // current window size
+	{
+		enable_cb = FALSE;
+		keep_aspect = TRUE;
 	}
-	else if(-1 == index) //custom
+	else if (-1 == index) // custom
 	{
-		view->impl.mAspectRatioCheckOff = false ;
-		enableAspectRatioCheckbox(view, TRUE);
-
-		if(previewp)
-		{
-			previewp->mKeepAspectRatio = gSavedSettings.getBOOL("KeepAspectForSnapshot") ;
-		}
+		enable_cb = TRUE;
+		keep_aspect = gSavedSettings.getBOOL("KeepAspectForSnapshot");
 	}
-	else
+	else // predefined resolution
 	{
-		view->impl.mAspectRatioCheckOff = true ;
-		enableAspectRatioCheckbox(view, FALSE);
-
-		if(previewp)
-		{
-			previewp->mKeepAspectRatio = FALSE ;
-		}
+		enable_cb = FALSE;
+		keep_aspect = FALSE;
 	}
 
-	return ;
+	view->impl.mAspectRatioCheckOff = !enable_cb;
+	enableAspectRatioCheckbox(view, enable_cb);
+	if (previewp)
+	{
+		previewp->mKeepAspectRatio = keep_aspect;
+	}
 }
 
+// Show/hide upload progress indicators.
 // static
 void LLFloaterSnapshot::Impl::setWorking(LLFloaterSnapshot* floater, bool working)
 {
@@ -1712,20 +1673,21 @@ void LLFloaterSnapshot::Impl::setWorking(LLFloaterSnapshot* floater, bool workin
 		working_lbl->setValue(progress_text);
 	}
 
-	// All controls should be disable while posting.
+	// All controls should be disabled while posting.
 	floater->setCtrlsEnabled(!working);
 	LLPanelSnapshot* active_panel = getActivePanel(floater);
 	if (active_panel)
 	{
-		active_panel->setCtrlsEnabled(!working);
+		active_panel->enableControls(!working);
 	}
 }
 
+// Show/hide upload status message.
 // static
 void LLFloaterSnapshot::Impl::setFinished(LLFloaterSnapshot* floater, bool finished, bool ok, const std::string& msg)
 {
-	floater->getChild<LLUICtrl>("succeeded_panel")->setVisible(finished && ok);
-	floater->getChild<LLUICtrl>("failed_panel")->setVisible(finished && !ok);
+	floater->mSucceessLblPanel->setVisible(finished && ok);
+	floater->mFailureLblPanel->setVisible(finished && !ok);
 
 	if (finished)
 	{
@@ -1739,27 +1701,7 @@ void LLFloaterSnapshot::Impl::setFinished(LLFloaterSnapshot* floater, bool finis
 	}
 }
 
-static std::string lastSnapshotWidthName(S32 shot_type)
-{
-	switch (shot_type)
-	{
-	  case LLSnapshotLivePreview::SNAPSHOT_WEB:		 return "LastSnapshotToProfileWidth";
-	  case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: return "LastSnapshotToEmailWidth";
-	  case LLSnapshotLivePreview::SNAPSHOT_TEXTURE:  return "LastSnapshotToInventoryWidth";
-	  default:                                       return "LastSnapshotToDiskWidth";
-	}
-}
-static std::string lastSnapshotHeightName(S32 shot_type)
-{
-	switch (shot_type)
-	{
-	  case LLSnapshotLivePreview::SNAPSHOT_WEB:	     return "LastSnapshotToProfileHeight";
-	  case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: return "LastSnapshotToEmailHeight";
-	  case LLSnapshotLivePreview::SNAPSHOT_TEXTURE:  return "LastSnapshotToInventoryHeight";
-	  default:                                       return "LastSnapshotToDiskHeight";
-	}
-}
-
+// Apply a new resolution selected from the given combobox.
 // static
 void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update)
 {
@@ -1772,12 +1714,6 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL
 		return;
 	}
 
-	// save off all selected resolution values
-	gSavedSettings.setS32("SnapshotProfileLastResolution",  view->getChild<LLComboBox>("profile_size_combo")->getCurrentIndex());
-	gSavedSettings.setS32("SnapshotPostcardLastResolution", view->getChild<LLComboBox>("postcard_size_combo")->getCurrentIndex());
-	gSavedSettings.setS32("SnapshotTextureLastResolution",  view->getChild<LLComboBox>("texture_size_combo")->getCurrentIndex());
-	gSavedSettings.setS32("SnapshotLocalLastResolution",    view->getChild<LLComboBox>("local_size_combo")->getCurrentIndex());
-
 	std::string sdstring = combobox->getSelectedValue();
 	LLSD sdres;
 	std::stringstream sstream(sdstring);
@@ -1801,7 +1737,6 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL
 		else if (width == -1 || height == -1)
 		{
 			// load last custom value
-#if 1
 			S32 new_width = 0, new_height = 0;
 			LLPanelSnapshot* spanel = getActivePanel(view);
 			if (spanel)
@@ -1809,26 +1744,24 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL
 				lldebugs << "Loading typed res from panel " << spanel->getName() << llendl;
 				new_width = spanel->getTypedPreviewWidth();
 				new_height = spanel->getTypedPreviewHeight();
+
+				// Limit custom size for inventory snapshots to 512x512 px.
+				if (getActiveSnapshotType(view) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE)
+				{
+					new_width = llmin(new_width, MAX_TEXTURE_SIZE);
+					new_height = llmin(new_height, MAX_TEXTURE_SIZE);
+				}
 			}
 			else
 			{
-				const S32 shot_type = getActiveSnapshotType(view);
-				lldebugs << "Loading saved res for shot_type " << shot_type << llendl;
-				new_width = gSavedSettings.getS32(lastSnapshotWidthName(shot_type));
-				new_height = gSavedSettings.getS32(lastSnapshotHeightName(shot_type));
+				lldebugs << "No custom res chosen, setting preview res from window: "
+					<< gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << llendl;
+				new_width = gViewerWindow->getWindowWidthRaw();
+				new_height = gViewerWindow->getWindowHeightRaw();
 			}
 
 			llassert(new_width > 0 && new_height > 0);
 			previewp->setSize(new_width, new_height);
-#else
-			LLPanelSnapshot* spanel = getActivePanel(view);
-			if (spanel)
-			{
-				lldebugs << "Setting custom preview res : " << spanel->getTypedPreviewWidth() << "x" << spanel->getTypedPreviewHeight() << llendl;
-				previewp->setSize(spanel->getTypedPreviewWidth(), spanel->getTypedPreviewHeight());
-			}
-			//previewp->setSize(gSavedSettings.getS32(lastSnapshotWidthName()), gSavedSettings.getS32(lastSnapshotHeightName()));
-#endif
 		}
 		else
 		{
@@ -1847,11 +1780,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL
 			height = llmin(height, gViewerWindow->getWindowHeightRaw());
 		}
 
-		
-		if(checkImageSize(previewp, width, height, TRUE, previewp->getMaxImageSize()))
-		{
-			resetSnapshotSizeOnUI(view, width, height) ;
-		}
+		updateSpinners(view, previewp, width, height, TRUE); // may change width and height
 		
 		if(getWidthSpinner(view)->getValue().asInteger() != width || getHeightSpinner(view)->getValue().asInteger() != height)
 		{
@@ -1865,10 +1794,13 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL
 
 			// hide old preview as the aspect ratio could be wrong
 			checkAutoSnapshot(previewp, FALSE);
+			lldebugs << "updating thumbnail" << llendl;
 			getPreviewView(view)->updateSnapshot(FALSE, TRUE);
 			if(do_update)
 			{
+				lldebugs << "Will update controls" << llendl;
 				updateControls(view);
+				setNeedRefresh(view, true);
 			}
 		}
 	}
@@ -1909,92 +1841,29 @@ void LLFloaterSnapshot::Impl::onImageFormatChange(LLFloaterSnapshot* view)
 	if (view)
 	{
 		gSavedSettings.setS32("SnapshotFormat", getImageFormat(view));
+		lldebugs << "image format changed, updating snapshot" << llendl;
 		getPreviewView(view)->updateSnapshot(TRUE);
 		updateControls(view);
+		setNeedRefresh(view, false); // we're refreshing
 	}
 }
 
-#if 0
-//static 
-void LLFloaterSnapshot::Impl::onCommitSnapshotType(LLUICtrl* ctrl, void* data)
-{
-	LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;		
-	if (view)
-	{
-		gSavedSettings.setS32("LastSnapshotType", getTypeIndex(view));
-		getPreviewView(view)->updateSnapshot(TRUE);
-		updateControls(view);
-	}
-}
-#endif
-
 // Sets the named size combo to "custom" mode.
 // static
 void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const std::string& comboname)
 {
 	LLComboBox* combo = floater->getChild<LLComboBox>(comboname);
-
 	combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index
-
-	if(comboname == "postcard_size_combo") 
-	{
-		gSavedSettings.setS32("SnapshotPostcardLastResolution", combo->getCurrentIndex());
-	}
-	else if(comboname == "profile_size_combo")
-	{
-		gSavedSettings.setS32("SnapshotProfileLastResolution", combo->getCurrentIndex());
-	}
-	else if(comboname == "texture_size_combo") 
-	{
-		gSavedSettings.setS32("SnapshotTextureLastResolution", combo->getCurrentIndex());
-	}
-	else if(comboname == "local_size_combo") 
-	{
-		gSavedSettings.setS32("SnapshotLocalLastResolution", combo->getCurrentIndex());
-	}
-
 	checkAspectRatio(floater, -1); // -1 means custom
 }
 
-
-
+// Update supplied width and height according to the constrain proportions flag; limit them by max_val.
 //static
 BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value)
 {
 	S32 w = width ;
 	S32 h = height ;
 
-	//if texture, ignore aspect ratio setting, round image size to power of 2.
-#if 0 // Don't round texture sizes; textures are commonly stretched in world, profiles, etc and need to be "squashed" during upload, not cropped here
-	if(LLSnapshotLivePreview::SNAPSHOT_TEXTURE == gSavedSettings.getS32("LastSnapshotType"))
-	{
-		if(width > max_value)
-		{
-			width = max_value ;
-		}
-		if(height > max_value)
-		{
-			height = max_value ;
-		}
-
-		//round to nearest power of 2 based on the direction of movement
-		// i.e. higher power of two if increasing texture resolution
-		if(gSavedSettings.getS32("LastSnapshotToInventoryWidth") < width ||
-			gSavedSettings.getS32("LastSnapshotToInventoryHeight") < height)
-		{
-			// Up arrow pressed
-			width = get_next_power_two(width, MAX_TEXTURE_SIZE) ;
-			height = get_next_power_two(height, MAX_TEXTURE_SIZE) ;
-		}
-		else
-		{
-			// Down or no change
-			width = get_lower_power_two(width, MAX_TEXTURE_SIZE) ;
-			height = get_lower_power_two(height, MAX_TEXTURE_SIZE) ;
-		}
-	}
-	else
-#endif
 	if(previewp && previewp->mKeepAspectRatio)
 	{
 		if(gViewerWindow->getWindowWidthRaw() < 1 || gViewerWindow->getWindowHeightRaw() < 1)
@@ -2008,11 +1877,11 @@ BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S3
 		//change another value proportionally
 		if(isWidthChanged)
 		{
-			height = (S32)(width / aspect_ratio) ;
+			height = llround(width / aspect_ratio) ;
 		}
 		else
 		{
-			width = (S32)(height * aspect_ratio) ;
+			width = llround(height * aspect_ratio) ;
 		}
 
 		//bound w/h by the max_value
@@ -2030,93 +1899,63 @@ BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S3
 			}
 		}
 	}
-	else
-	{
-	}
 
 	return (w != width || h != height) ;
 }
 
 //static
-void LLFloaterSnapshot::Impl::resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32 width, S32 height)
+void LLFloaterSnapshot::Impl::setImageSizeSpinnersValues(LLFloaterSnapshot *view, S32 width, S32 height)
 {
 	getWidthSpinner(view)->forceSetValue(width);
 	getHeightSpinner(view)->forceSetValue(height);
-	gSavedSettings.setS32(lastSnapshotWidthName(getActiveSnapshotType(view)), width);
-	gSavedSettings.setS32(lastSnapshotHeightName(getActiveSnapshotType(view)), height);
 }
 
-#if 0
-//static
-void LLFloaterSnapshot::Impl::onCommitCustomResolution(LLUICtrl *ctrl, void* data)
+// static
+void LLFloaterSnapshot::Impl::updateSpinners(LLFloaterSnapshot* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL is_width_changed)
 {
-	LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
-	S32 w = llfloor((F32)getWidthSpinner(view)->getValue().asReal());
-	S32 h = llfloor((F32)getHeightSpinner(view)->getValue().asReal());
-	applyCustomResolution(view, w, h);
+	if (checkImageSize(previewp, width, height, is_width_changed, previewp->getMaxImageSize()))
+	{
+		setImageSizeSpinnersValues(view, width, height);
+	}
 }
-#endif
 
 // static
 void LLFloaterSnapshot::Impl::applyCustomResolution(LLFloaterSnapshot* view, S32 w, S32 h)
 {
+	bool need_refresh = false;
+
 	lldebugs << "applyCustomResolution(" << w << ", " << h << ")" << llendl;
-	if (view)
+	if (!view) return;
+
+	LLSnapshotLivePreview* previewp = getPreviewView(view);
+	if (previewp)
 	{
-		LLSnapshotLivePreview* previewp = getPreviewView(view);
-		if (previewp)
+		S32 curw,curh;
+		previewp->getSize(curw, curh);
+
+		if (w != curw || h != curh)
 		{
-			S32 curw,curh;
-			previewp->getSize(curw, curh);
-			
-			if (w != curw || h != curh)
-			{
-				BOOL update_ = FALSE ;
-				//if to upload a snapshot, process spinner input in a special way.
-#if 0  // Don't round texture sizes; textures are commonly stretched in world, profiles, etc and need to be "squashed" during upload, not cropped here
-				if(LLSnapshotLivePreview::SNAPSHOT_TEXTURE == gSavedSettings.getS32("LastSnapshotType"))
-				{
-					S32 spinner_increment = (S32)((LLSpinCtrl*)ctrl)->getIncrement() ;
-					S32 dw = w - curw ;
-					S32 dh = h - curh ;
-					dw = (dw == spinner_increment) ? 1 : ((dw == -spinner_increment) ? -1 : 0) ;
-					dh = (dh == spinner_increment) ? 1 : ((dh == -spinner_increment) ? -1 : 0) ;
-
-					if(dw)
-					{
-						w = (dw > 0) ? curw << dw : curw >> -dw ;
-						update_ = TRUE ;
-					}
-					if(dh)
-					{
-						h = (dh > 0) ? curh << dh : curh >> -dh ;
-						update_ = TRUE ;
-					}
-				}
-#endif
-				previewp->setMaxImageSize((S32) getWidthSpinner(view)->getMaxValue()) ;
-				
-				// Check image size changes the value of height and width
-				if(checkImageSize(previewp, w, h, w != curw, previewp->getMaxImageSize())
-					|| update_)
-				{
-					resetSnapshotSizeOnUI(view, w, h) ;
-				}
+			//if to upload a snapshot, process spinner input in a special way.
+			previewp->setMaxImageSize((S32) getWidthSpinner(view)->getMaxValue()) ;
 
-				previewp->setSize(w,h);
-				checkAutoSnapshot(previewp, FALSE);
-				previewp->updateSnapshot(FALSE, TRUE);
-				comboSetCustom(view, "profile_size_combo");
-				comboSetCustom(view, "postcard_size_combo");
-				comboSetCustom(view, "texture_size_combo");
-				comboSetCustom(view, "local_size_combo");
-			}
-		}
+			updateSpinners(view, previewp, w, h, w != curw); // may change w and h
 
-		gSavedSettings.setS32(lastSnapshotWidthName(getActiveSnapshotType(view)), w);
-		gSavedSettings.setS32(lastSnapshotHeightName(getActiveSnapshotType(view)), h);
+			previewp->setSize(w,h);
+			checkAutoSnapshot(previewp, FALSE);
+			lldebugs << "applied custom resolution, updating thumbnail" << llendl;
+			previewp->updateSnapshot(FALSE, TRUE);
+			comboSetCustom(view, "profile_size_combo");
+			comboSetCustom(view, "postcard_size_combo");
+			comboSetCustom(view, "texture_size_combo");
+			comboSetCustom(view, "local_size_combo");
+			need_refresh = true;
+		}
+	}
 
-		updateControls(view);
+	updateControls(view);
+	if (need_refresh)
+	{
+		setNeedRefresh(view, true); // need to do this after updateControls()
 	}
 }
 
@@ -2140,6 +1979,10 @@ void LLFloaterSnapshot::Impl::onSendingPostcardFinished(bool status)
 // Default constructor
 LLFloaterSnapshot::LLFloaterSnapshot(const LLSD& key)
 	: LLFloater(key),
+	  mRefreshBtn(NULL),
+	  mRefreshLabel(NULL),
+	  mSucceessLblPanel(NULL),
+	  mFailureLblPanel(NULL),
 	  impl (*(new Impl))
 {
 }
@@ -2147,7 +1990,7 @@ LLFloaterSnapshot::LLFloaterSnapshot(const LLSD& key)
 // Destroys the object
 LLFloaterSnapshot::~LLFloaterSnapshot()
 {
-	delete impl.mPreviewHandle.get();
+	if (impl.mPreviewHandle.get()) impl.mPreviewHandle.get()->die();
 
 	//unfreeze everything else
 	gSavedSettings.setBOOL("FreezeTime", FALSE);
@@ -2169,50 +2012,32 @@ BOOL LLFloaterSnapshot::postBuild()
 		LLWebSharing::instance().init();
 	}
 
-#if 0
-	childSetCommitCallback("snapshot_type_radio", Impl::onCommitSnapshotType, this);
-#endif
-	
+	mRefreshBtn = getChild<LLUICtrl>("new_snapshot_btn");
 	childSetAction("new_snapshot_btn", Impl::onClickNewSnapshot, this);
+	mRefreshLabel = getChild<LLUICtrl>("refresh_lbl");
+	mSucceessLblPanel = getChild<LLUICtrl>("succeeded_panel");
+	mFailureLblPanel = getChild<LLUICtrl>("failed_panel");
 
 	childSetAction("advanced_options_btn", Impl::onClickMore, this);
 
-#if 0
-	childSetCommitCallback("snapshot_width", Impl::onCommitCustomResolution, this);
-	childSetCommitCallback("snapshot_height", Impl::onCommitCustomResolution, this);
-#endif
-
 	childSetCommitCallback("ui_check", Impl::onClickUICheck, this);
 	getChild<LLUICtrl>("ui_check")->setValue(gSavedSettings.getBOOL("RenderUIInSnapshot"));
 
 	childSetCommitCallback("hud_check", Impl::onClickHUDCheck, this);
 	getChild<LLUICtrl>("hud_check")->setValue(gSavedSettings.getBOOL("RenderHUDInSnapshot"));
 
-#if 0
-	childSetCommitCallback("keep_aspect_check", Impl::onClickKeepAspectCheck, this);
-#endif
 	impl.setAspectRatioCheckboxValue(this, gSavedSettings.getBOOL("KeepAspectForSnapshot"));
 
 	childSetCommitCallback("layer_types", Impl::onCommitLayerTypes, this);
 	getChild<LLUICtrl>("layer_types")->setValue("colors");
 	getChildView("layer_types")->setEnabled(FALSE);
 
-#if 0 // leads to crash later if one of the settings values is 0
-	impl.getWidthSpinner(this)->setValue(gSavedSettings.getS32(lastSnapshotWidthName()));
-	impl.getHeightSpinner(this)->setValue(gSavedSettings.getS32(lastSnapshotHeightName()));
-#endif
-
 	getChild<LLUICtrl>("freeze_frame_check")->setValue(gSavedSettings.getBOOL("UseFreezeFrame"));
 	childSetCommitCallback("freeze_frame_check", Impl::onCommitFreezeFrame, this);
 
 	getChild<LLUICtrl>("auto_snapshot_check")->setValue(gSavedSettings.getBOOL("AutoSnapshot"));
 	childSetCommitCallback("auto_snapshot_check", Impl::onClickAutoSnap, this);
 
-	childSetCommitCallback("profile_size_combo", Impl::onCommitResolution, this);
-	childSetCommitCallback("postcard_size_combo", Impl::onCommitResolution, this);
-	childSetCommitCallback("texture_size_combo", Impl::onCommitResolution, this);
-	childSetCommitCallback("local_size_combo", Impl::onCommitResolution, this);
-
 	LLWebProfile::setImageUploadResultCallback(boost::bind(&LLFloaterSnapshot::Impl::onSnapshotUploadFinished, _1));
 	LLPostCard::setPostResultCallback(boost::bind(&LLFloaterSnapshot::Impl::onSendingPostcardFinished, _1));
 
@@ -2234,6 +2059,13 @@ BOOL LLFloaterSnapshot::postBuild()
 	gFloaterView->removeChild(this);
 	gSnapshotFloaterView->addChild(this);
 
+	// Pre-select "Current Window" resolution.
+	getChild<LLComboBox>("profile_size_combo")->selectNthItem(0);
+	getChild<LLComboBox>("postcard_size_combo")->selectNthItem(0);
+	getChild<LLComboBox>("texture_size_combo")->selectNthItem(0);
+	getChild<LLComboBox>("local_size_combo")->selectNthItem(0);
+	getChild<LLComboBox>("local_format_combo")->selectNthItem(0);
+
 	impl.mPreviewHandle = previewp->getHandle();
 	impl.updateControls(this);
 	impl.updateLayout(this);
@@ -2259,28 +2091,63 @@ void LLFloaterSnapshot::draw()
 		{
 			bool working = impl.getStatus() == Impl::STATUS_WORKING;
 			const LLRect& thumbnail_rect = getThumbnailPlaceholderRect();
-			S32 offset_x = thumbnail_rect.mLeft + (thumbnail_rect.getWidth() - previewp->getThumbnailWidth()) / 2 ;
-			S32 offset_y = thumbnail_rect.mBottom + (thumbnail_rect.getHeight() - previewp->getThumbnailHeight()) / 2 ;
+			const S32 thumbnail_w = previewp->getThumbnailWidth();
+			const S32 thumbnail_h = previewp->getThumbnailHeight();
+
+			// calc preview offset within the preview rect
+			const S32 local_offset_x = (thumbnail_rect.getWidth() - thumbnail_w) / 2 ;
+			const S32 local_offset_y = (thumbnail_rect.getHeight() - thumbnail_h) / 2 ; // preview y pos within the preview rect
 
-			glMatrixMode(GL_MODELVIEW);
+			// calc preview offset within the floater rect
+			S32 offset_x = thumbnail_rect.mLeft + local_offset_x;
+			S32 offset_y = thumbnail_rect.mBottom + local_offset_y;
+
+			gGL.matrixMode(LLRender::MM_MODELVIEW);
 			// Apply floater transparency to the texture unless the floater is focused.
 			F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
 			LLColor4 color = working ? LLColor4::grey4 : LLColor4::white;
 			gl_draw_scaled_image(offset_x, offset_y, 
-					previewp->getThumbnailWidth(), previewp->getThumbnailHeight(), 
+					thumbnail_w, thumbnail_h,
 					previewp->getThumbnailImage(), color % alpha);
 
 			previewp->drawPreviewRect(offset_x, offset_y) ;
 
-			// Draw progress indicators on top of the preview.
-			if (working)
+			// Draw some controls on top of the preview thumbnail.
+			static const S32 PADDING = 5;
+			static const S32 REFRESH_LBL_BG_HEIGHT = 32;
+
+			// Reshape and position the posting result message panels at the top of the thumbnail.
+			// Do this regardless of current posting status (finished or not) to avoid flicker
+			// when the result message is displayed for the first time.
+			// if (impl.getStatus() == Impl::STATUS_FINISHED)
 			{
-				gGL.pushUIMatrix();
-				const LLRect& r = getThumbnailPlaceholderRect();
-				LLUI::translate((F32) r.mLeft, (F32) r.mBottom);
-				sThumbnailPlaceholder->draw();
-				gGL.popUIMatrix();
+				LLRect result_lbl_rect = mSucceessLblPanel->getRect();
+				const S32 result_lbl_h = result_lbl_rect.getHeight();
+				result_lbl_rect.setLeftTopAndSize(local_offset_x, local_offset_y + thumbnail_h, thumbnail_w - 1, result_lbl_h);
+				mSucceessLblPanel->reshape(result_lbl_rect.getWidth(), result_lbl_h);
+				mSucceessLblPanel->setRect(result_lbl_rect);
+				mFailureLblPanel->reshape(result_lbl_rect.getWidth(), result_lbl_h);
+				mFailureLblPanel->setRect(result_lbl_rect);
 			}
+
+			// Position the refresh button in the bottom left corner of the thumbnail.
+			mRefreshBtn->setOrigin(local_offset_x + PADDING, local_offset_y + PADDING);
+
+			if (impl.mNeedRefresh)
+			{
+				// Place the refresh hint text to the right of the refresh button.
+				const LLRect& refresh_btn_rect = mRefreshBtn->getRect();
+				mRefreshLabel->setOrigin(refresh_btn_rect.mLeft + refresh_btn_rect.getWidth() + PADDING, refresh_btn_rect.mBottom);
+
+				// Draw the refresh hint background.
+				LLRect refresh_label_bg_rect(offset_x, offset_y + REFRESH_LBL_BG_HEIGHT, offset_x + thumbnail_w - 1, offset_y);
+				gl_rect_2d(refresh_label_bg_rect, LLColor4::white % 0.9f, TRUE);
+			}
+
+			gGL.pushUIMatrix();
+			LLUI::translate((F32) thumbnail_rect.mLeft, (F32) thumbnail_rect.mBottom);
+			sThumbnailPlaceholder->draw();
+			gGL.popUIMatrix();
 		}
 	}
 }
@@ -2290,6 +2157,7 @@ void LLFloaterSnapshot::onOpen(const LLSD& key)
 	LLSnapshotLivePreview* preview = LLFloaterSnapshot::Impl::getPreviewView(this);
 	if(preview)
 	{
+		lldebugs << "opened, updating snapshot" << llendl;
 		preview->updateSnapshot(TRUE);
 	}
 	focusFirstItem(FALSE);
@@ -2371,6 +2239,7 @@ void LLFloaterSnapshot::update()
 		return;
 	
 	BOOL changed = FALSE;
+	lldebugs << "npreviews: " << LLSnapshotLivePreview::sList.size() << llendl;
 	for (std::set<LLSnapshotLivePreview*>::iterator iter = LLSnapshotLivePreview::sList.begin();
 		 iter != LLSnapshotLivePreview::sList.end(); ++iter)
 	{
@@ -2378,6 +2247,7 @@ void LLFloaterSnapshot::update()
 	}
 	if(changed)
 	{
+		lldebugs << "changed" << llendl;
 		inst->impl.updateControls(inst);
 	}
 }
@@ -2411,7 +2281,7 @@ void LLFloaterSnapshot::saveTexture()
 }
 
 // static
-void LLFloaterSnapshot::saveLocal()
+BOOL LLFloaterSnapshot::saveLocal()
 {
 	lldebugs << "saveLocal" << llendl;
 	// FIXME: duplicated code
@@ -2419,16 +2289,16 @@ void LLFloaterSnapshot::saveLocal()
 	if (!instance)
 	{
 		llassert(instance != NULL);
-		return;
+		return FALSE;
 	}
 	LLSnapshotLivePreview* previewp = Impl::getPreviewView(instance);
 	if (!previewp)
 	{
 		llassert(previewp != NULL);
-		return;
+		return FALSE;
 	}
 
-	previewp->saveLocal();
+	return previewp->saveLocal();
 }
 
 // static
@@ -2440,6 +2310,9 @@ void LLFloaterSnapshot::preUpdate()
 	{
 		// Disable the send/post/save buttons until snapshot is ready.
 		Impl::updateControls(instance);
+
+		// Force hiding the "Refresh to save" hint because we know we've just started refresh.
+		Impl::setNeedRefresh(instance, false);
 	}
 }
 
@@ -2452,6 +2325,16 @@ void LLFloaterSnapshot::postUpdate()
 	{
 		// Enable the send/post/save buttons.
 		Impl::updateControls(instance);
+
+		// We've just done refresh.
+		Impl::setNeedRefresh(instance, false);
+
+		// The refresh button is initially hidden. We show it after the first update,
+		// i.e. when preview appears.
+		if (!instance->mRefreshBtn->getVisible())
+		{
+			instance->mRefreshBtn->setVisible(true);
+		}
 	}
 }
 
@@ -2474,6 +2357,9 @@ void LLFloaterSnapshot::postPanelSwitch()
 {
 	LLFloaterSnapshot* instance = getInstance();
 	instance->impl.updateControls(instance);
+
+	// Remove the success/failure indicator whenever user presses a snapshot option button.
+	instance->impl.setStatus(Impl::STATUS_READY);
 }
 
 // static
diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h
index 2c79c749d60809311dc114e99d61d7bb3c11fbc7..afe135fa407cd009258f4c5a375e28dd96867963 100644
--- a/indra/newview/llfloatersnapshot.h
+++ b/indra/newview/llfloatersnapshot.h
@@ -58,7 +58,7 @@ class LLFloaterSnapshot : public LLFloater
 	// TODO: create a snapshot model instead
 	static LLFloaterSnapshot* getInstance();
 	static void saveTexture();
-	static void saveLocal();
+	static BOOL saveLocal();
 	static void preUpdate();
 	static void postUpdate();
 	static void postSave();
@@ -71,6 +71,8 @@ class LLFloaterSnapshot : public LLFloater
 
 private:
 	static LLUICtrl* sThumbnailPlaceholder;
+	LLUICtrl *mRefreshBtn, *mRefreshLabel;
+	LLUICtrl *mSucceessLblPanel, *mFailureLblPanel;
 
 	class Impl;
 	Impl& impl;
diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp
index 1008b4a6e4c3830534d8304c90cb56def84fb9dd..6978e6a430c4e4b1a74dd197365d0a0d1b6564eb 100644
--- a/indra/newview/llfloatertools.cpp
+++ b/indra/newview/llfloatertools.cpp
@@ -36,6 +36,7 @@
 #include "llagentcamera.h"
 #include "llbutton.h"
 #include "llcheckboxctrl.h"
+#include "llcombobox.h"
 #include "lldraghandle.h"
 #include "llerror.h"
 #include "llfloaterbuildoptions.h"
@@ -103,6 +104,7 @@ const std::string PANEL_NAMES[LLFloaterTools::PANEL_COUNT] =
 
 
 // Local prototypes
+void commit_grid_mode(LLUICtrl *ctrl);
 void commit_select_component(void *data);
 void click_show_more(void*);
 void click_popup_info(void*);
@@ -252,6 +254,7 @@ BOOL	LLFloaterTools::postBuild()
 	getChild<LLUICtrl>("checkbox uniform")->setValue((BOOL)gSavedSettings.getBOOL("ScaleUniform"));
 	mCheckStretchTexture	= getChild<LLCheckBoxCtrl>("checkbox stretch textures");
 	getChild<LLUICtrl>("checkbox stretch textures")->setValue((BOOL)gSavedSettings.getBOOL("ScaleStretchTextures"));
+	mComboGridMode			= getChild<LLComboBox>("combobox grid mode");
 	mCheckStretchUniformLabel = getChild<LLTextBox>("checkbox uniform label");
 
 	//
@@ -330,6 +333,7 @@ LLFloaterTools::LLFloaterTools(const LLSD& key)
 	mCheckSnapToGrid(NULL),
 	mBtnGridOptions(NULL),
 	mTitleMedia(NULL),
+	mComboGridMode(NULL),
 	mCheckStretchUniform(NULL),
 	mCheckStretchTexture(NULL),
 	mCheckStretchUniformLabel(NULL),
@@ -386,6 +390,7 @@ LLFloaterTools::LLFloaterTools(const LLSD& key)
 	mCommitCallbackRegistrar.add("BuildTool.commitRadioMove",	boost::bind(&commit_radio_group_move,_1));
 	mCommitCallbackRegistrar.add("BuildTool.commitRadioEdit",	boost::bind(&commit_radio_group_edit,_1));
 
+	mCommitCallbackRegistrar.add("BuildTool.gridMode",			boost::bind(&commit_grid_mode,_1));
 	mCommitCallbackRegistrar.add("BuildTool.selectComponent",	boost::bind(&commit_select_component, this));
 	mCommitCallbackRegistrar.add("BuildTool.gridOptions",		boost::bind(&LLFloaterTools::onClickGridOptions,this));
 	mCommitCallbackRegistrar.add("BuildTool.applyToSelection",	boost::bind(&click_apply_to_selection, this));
@@ -529,7 +534,7 @@ void LLFloaterTools::refresh()
 	mPanelLandInfo->refresh();
 
 	// Refresh the advanced weights floater
-	LLFloaterObjectWeights* object_weights_floater = LLFloaterReg::getTypedInstance<LLFloaterObjectWeights>("object_weights");
+	LLFloaterObjectWeights* object_weights_floater = LLFloaterReg::findTypedInstance<LLFloaterObjectWeights>("object_weights");
 	if(object_weights_floater && object_weights_floater->getVisible())
 	{
 		object_weights_floater->refresh();
@@ -687,6 +692,33 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
 		mRadioGroupEdit->setValue("radio select face");
 	}
 
+	if (mComboGridMode) 
+	{
+		mComboGridMode->setVisible( edit_visible );
+		S32 index = mComboGridMode->getCurrentIndex();
+		mComboGridMode->removeall();
+
+		switch (mObjectSelection->getSelectType())
+		{
+			case SELECT_TYPE_HUD:
+				mComboGridMode->add(getString("grid_screen_text"));
+				mComboGridMode->add(getString("grid_local_text"));
+				break;
+			case SELECT_TYPE_WORLD:
+				mComboGridMode->add(getString("grid_world_text"));
+				mComboGridMode->add(getString("grid_local_text"));
+				mComboGridMode->add(getString("grid_reference_text"));
+				break;
+			case SELECT_TYPE_ATTACHMENT:
+				mComboGridMode->add(getString("grid_attachment_text"));
+				mComboGridMode->add(getString("grid_local_text"));
+				mComboGridMode->add(getString("grid_reference_text"));
+				break;
+		}
+
+		mComboGridMode->setCurrentByIndex(index);
+	}
+
 	// Snap to grid disabled for grab tool - very confusing
 	if (mCheckSnapToGrid) mCheckSnapToGrid->setVisible( edit_visible /* || tool == LLToolGrab::getInstance() */ );
 	if (mBtnGridOptions) mBtnGridOptions->setVisible( edit_visible /* || tool == LLToolGrab::getInstance() */ );
@@ -1037,6 +1069,13 @@ void LLFloaterTools::setObjectType( LLPCode pcode )
 	gFocusMgr.setMouseCapture(NULL);
 }
 
+void commit_grid_mode(LLUICtrl *ctrl)
+{
+	LLComboBox* combo = (LLComboBox*)ctrl;
+
+	LLSelectMgr::getInstance()->setGridMode((EGridMode)combo->getCurrentIndex());
+}
+
 
 void LLFloaterTools::onClickGridOptions()
 {
@@ -1144,7 +1183,7 @@ void LLFloaterTools::updateLandImpacts()
 	childSetTextArg("remaining_capacity", "[CAPACITY_STRING]", remaining_capacity_str);
 
 	// Update land impacts info in the weights floater
-	LLFloaterObjectWeights* object_weights_floater = LLFloaterReg::getTypedInstance<LLFloaterObjectWeights>("object_weights");
+	LLFloaterObjectWeights* object_weights_floater = LLFloaterReg::findTypedInstance<LLFloaterObjectWeights>("object_weights");
 	if(object_weights_floater)
 	{
 		object_weights_floater->updateLandImpacts(parcel);
@@ -1234,6 +1273,7 @@ void LLFloaterTools::getMediaState()
 		}
 	} func;
 	
+	
 	// check if all faces have media(or, all dont have media)
 	LLFloaterMediaSettings::getInstance()->mIdenticalHasMediaInfo = selected_objects->getSelectedTEValue( &func, bool_has_media );
 	
@@ -1409,9 +1449,7 @@ bool LLFloaterTools::deleteMediaConfirm(const LLSD& notification, const LLSD& re
 //
 void LLFloaterTools::clearMediaSettings()
 {
-	LLFloaterMediaSettings::getInstance();
 	LLFloaterMediaSettings::clearValues(false);
-
 }
 
 //////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h
index 63ed9dc82bacbb7408dea583f395e5cfb2cfb053..7a19d093a42f7ad5ea7f1594a640870bb92c2b0d 100644
--- a/indra/newview/llfloatertools.h
+++ b/indra/newview/llfloatertools.h
@@ -33,6 +33,7 @@
 
 class LLButton;
 class LLCheckBoxCtrl;
+class LLComboBox;
 class LLPanelPermissions;
 class LLPanelObject;
 class LLPanelVolume;
@@ -140,6 +141,7 @@ class LLFloaterTools
 
 	LLCheckBoxCtrl*	mCheckSnapToGrid;
 	LLButton*		mBtnGridOptions;
+	LLComboBox*		mComboGridMode;
 	LLCheckBoxCtrl*	mCheckStretchUniform;
 	LLCheckBoxCtrl*	mCheckStretchTexture;
 
diff --git a/indra/newview/llfloatertranslationsettings.cpp b/indra/newview/llfloatertranslationsettings.cpp
index 959edff713fb35da98d6b18b7d5843d4da4a250b..1a17183efdd39b0f2903c626601bd5e508a20e2a 100644
--- a/indra/newview/llfloatertranslationsettings.cpp
+++ b/indra/newview/llfloatertranslationsettings.cpp
@@ -29,6 +29,7 @@
 #include "llfloatertranslationsettings.h"
 
 // Viewer includes
+#include "llnearbychatbar.h"
 #include "lltranslate.h"
 #include "llviewercontrol.h" // for gSavedSettings
 
@@ -292,5 +293,6 @@ void LLFloaterTranslationSettings::onBtnOK()
 	gSavedSettings.setString("TranslationService", getSelectedService());
 	gSavedSettings.setString("BingTranslateAPIKey", getEnteredBingKey());
 	gSavedSettings.setString("GoogleTranslateAPIKey", getEnteredGoogleKey());
+	LLNearbyChatBar::getInstance()->showTranslationCheckbox(LLTranslate::isTranslationConfigured());
 	closeFloater(false);
 }
diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp
index 4c9c4cb154af0c9b515c6d9daac139888cd7750f..d741b5b1335c3a6f14926dae90a18829f16f478d 100644
--- a/indra/newview/llfloateruipreview.cpp
+++ b/indra/newview/llfloateruipreview.cpp
@@ -915,14 +915,16 @@ void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID, bool save)
 		{
 			panel->buildFromFile(path);										// build it
 			LLRect new_size = panel->getRect();								// get its rectangle
-			panel->setOrigin(0,0);											// reset its origin point so it's not offset by -left or other XUI attributes
+			panel->setOrigin(2,2);											// reset its origin point so it's not offset by -left or other XUI attributes
 			(*floaterp)->setTitle(path);									// use the file name as its title, since panels have no guaranteed meaningful name attribute
 			panel->setUseBoundingRect(TRUE);								// enable the use of its outer bounding rect (normally disabled because it's O(n) on the number of sub-elements)
 			panel->updateBoundingRect();									// update bounding rect
 			LLRect bounding_rect = panel->getBoundingRect();				// get the bounding rect
 			LLRect new_rect = panel->getRect();								// get the panel's rect
 			new_rect.unionWith(bounding_rect);								// union them to make sure we get the biggest one possible
-			(*floaterp)->reshape(new_rect.getWidth(), new_rect.getHeight() + floater_header_size);	// reshape floater to match the union rect's dimensions
+			LLRect floater_rect = new_rect;
+			floater_rect.stretch(4, 4);
+			(*floaterp)->reshape(floater_rect.getWidth(), floater_rect.getHeight() + floater_header_size);	// reshape floater to match the union rect's dimensions
 			panel->reshape(new_rect.getWidth(), new_rect.getHeight());		// reshape panel to match the union rect's dimensions as well (both are needed)
 			(*floaterp)->addChild(panel);					// add panel as child
 			(*floaterp)->openFloater();						// open floater (needed?)
diff --git a/indra/newview/llfloatervoiceeffect.cpp b/indra/newview/llfloatervoiceeffect.cpp
index 030fed0575deaa9508652140c417745934463da1..227720bee34975370dd10a45d2b79c79e7885327 100644
--- a/indra/newview/llfloatervoiceeffect.cpp
+++ b/indra/newview/llfloatervoiceeffect.cpp
@@ -145,7 +145,9 @@ void LLFloaterVoiceEffect::refreshEffectList()
 		for (voice_effect_list_t::const_iterator it = template_list.begin(); it != template_list.end(); ++it)
 		{
 			const LLUUID& effect_id = it->second;
-			std::string effect_name = getString("effect_" + it->first); // will throw an error if the effect is not listed in the XML
+
+			std::string localized_effect = "effect_" + it->first;
+			std::string effect_name = hasString(localized_effect) ? getString(localized_effect) : it->first;  // XML contains localized effects names
 
 			LLSD effect_properties = effect_interface->getVoiceEffectProperties(effect_id);
 
diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp
index f410c31f44fe4b2893ffa4e9671dcaad606f2a31..3fe2518de67230cb185fda3cc036366796cfd5aa 100644
--- a/indra/newview/llfloaterwebcontent.cpp
+++ b/indra/newview/llfloaterwebcontent.cpp
@@ -55,6 +55,15 @@ LLFloaterWebContent::_Params::_Params()
 LLFloaterWebContent::LLFloaterWebContent( const Params& params )
 :	LLFloater( params ),
 	LLInstanceTracker<LLFloaterWebContent, std::string>(params.id()),
+	mWebBrowser(NULL),
+	mAddressCombo(NULL),
+	mSecureLockIcon(NULL),
+	mStatusBarText(NULL),
+	mStatusBarProgress(NULL),
+	mBtnBack(NULL),
+	mBtnForward(NULL),
+	mBtnReload(NULL),
+	mBtnStop(NULL),
 	mUUID(params.id()),
 	mShowPageTitle(params.show_page_title)
 {
@@ -74,11 +83,16 @@ BOOL LLFloaterWebContent::postBuild()
 	mStatusBarText     = getChild< LLTextBox >( "statusbartext" );
 	mStatusBarProgress = getChild<LLProgressBar>("statusbarprogress" );
 
+	mBtnBack           = getChildView( "back" );
+	mBtnForward        = getChildView( "forward" );
+	mBtnReload         = getChildView( "reload" );
+	mBtnStop           = getChildView( "stop" );
+
 	// observe browser events
 	mWebBrowser->addObserver( this );
 
 	// these buttons are always enabled
-	getChildView("reload")->setEnabled( true );
+	mBtnReload->setEnabled( true );
 	getChildView("popexternal")->setEnabled( true );
 
 	// cache image for secure browsing
@@ -128,46 +142,14 @@ bool LLFloaterWebContent::matchesKey(const LLSD& key)
 //static
 LLFloater* LLFloaterWebContent::create( Params p)
 {
-	lldebugs << "url = " << p.url() << ", target = " << p.target() << ", uuid = " << p.id() << llendl;
-
-	if (!p.id.isProvided())
-	{
-		p.id = LLUUID::generateNewID().asString();
-	}
-
-	if(p.target().empty() || p.target() == "_blank")
-	{
-		p.target = p.id();
-	}
-
-	S32 browser_window_limit = gSavedSettings.getS32("WebContentWindowLimit");
-	if(browser_window_limit != 0)
-	{
-		// showInstance will open a new window.  Figure out how many web browsers are already open,
-		// and close the least recently opened one if this will put us over the limit.
-
-		LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList(p.window_class);
-		lldebugs << "total instance count is " << instances.size() << llendl;
-
-		for(LLFloaterReg::const_instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); iter++)
-		{
-			lldebugs << "    " << (*iter)->getKey()["target"] << llendl;
-		}
-
-		if(instances.size() >= (size_t)browser_window_limit)
-		{
-			// Destroy the least recently opened instance
-			(*instances.begin())->closeFloater();
-		}
-	}
-
+	preCreate(p);
 	return new LLFloaterWebContent(p);
 }
 
 //static
 void LLFloaterWebContent::closeRequest(const std::string &uuid)
 {
-	LLFloaterWebContent* floaterp = getInstance(uuid);
+	LLFloaterWebContent* floaterp = instance_tracker_t::getInstance(uuid);
 	if (floaterp)
 	{
 		floaterp->closeFloater(false);
@@ -177,7 +159,7 @@ void LLFloaterWebContent::closeRequest(const std::string &uuid)
 //static
 void LLFloaterWebContent::geometryChanged(const std::string &uuid, S32 x, S32 y, S32 width, S32 height)
 {
-	LLFloaterWebContent* floaterp = getInstance(uuid);
+	LLFloaterWebContent* floaterp = instance_tracker_t::getInstance(uuid);
 	if (floaterp)
 	{
 		floaterp->geometryChanged(x, y, width, height);
@@ -187,7 +169,7 @@ void LLFloaterWebContent::geometryChanged(const std::string &uuid, S32 x, S32 y,
 void LLFloaterWebContent::geometryChanged(S32 x, S32 y, S32 width, S32 height)
 {
 	// Make sure the layout of the browser control is updated, so this calculation is correct.
-	LLLayoutStack::updateClass();
+	getChild<LLLayoutStack>("stack1")->updateLayout();
 
 	// TODO: need to adjust size and constrain position to make sure floaters aren't moved outside the window view, etc.
 	LLCoordWindow window_size;
@@ -211,6 +193,43 @@ void LLFloaterWebContent::geometryChanged(S32 x, S32 y, S32 width, S32 height)
 	setShape(new_rect);	
 }
 
+// static
+void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p)
+{
+	lldebugs << "url = " << p.url() << ", target = " << p.target() << ", uuid = " << p.id() << llendl;
+
+	if (!p.id.isProvided())
+	{
+		p.id = LLUUID::generateNewID().asString();
+	}
+
+	if(p.target().empty() || p.target() == "_blank")
+	{
+		p.target = p.id();
+	}
+
+	S32 browser_window_limit = gSavedSettings.getS32("WebContentWindowLimit");
+	if(browser_window_limit != 0)
+	{
+		// showInstance will open a new window.  Figure out how many web browsers are already open,
+		// and close the least recently opened one if this will put us over the limit.
+
+		LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList(p.window_class);
+		lldebugs << "total instance count is " << instances.size() << llendl;
+
+		for(LLFloaterReg::const_instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); iter++)
+		{
+			lldebugs << "    " << (*iter)->getKey()["target"] << llendl;
+		}
+
+		if(instances.size() >= (size_t)browser_window_limit)
+		{
+			// Destroy the least recently opened instance
+			(*instances.begin())->closeFloater();
+		}
+	}
+}
+
 void LLFloaterWebContent::open_media(const Params& p)
 {
 	// Specifying a mime type of text/html here causes the plugin system to skip the MIME type probe and just open a browser plugin.
@@ -239,7 +258,7 @@ void LLFloaterWebContent::open_media(const Params& p)
 
 	if (!p.preferred_media_size().isEmpty())
 	{
-		LLLayoutStack::updateClass();
+		getChild<LLLayoutStack>("stack1")->updateLayout();
 		LLRect browser_rect = mWebBrowser->calcScreenRect();
 		LLCoordWindow window_size;
 		getWindow()->getSize(&window_size);
@@ -276,8 +295,8 @@ void LLFloaterWebContent::onClose(bool app_quitting)
 void LLFloaterWebContent::draw()
 {
 	// this is asynchronous so we need to keep checking
-	getChildView( "back" )->setEnabled( mWebBrowser->canNavigateBack() );
-	getChildView( "forward" )->setEnabled( mWebBrowser->canNavigateForward() );
+	mBtnBack->setEnabled( mWebBrowser->canNavigateBack() );
+	mBtnForward->setEnabled( mWebBrowser->canNavigateForward() );
 
 	LLFloater::draw();
 }
@@ -297,12 +316,12 @@ void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent
 	else if(event == MEDIA_EVENT_NAVIGATE_BEGIN)
 	{
 		// flags are sent with this event
-		getChildView("back")->setEnabled( self->getHistoryBackAvailable() );
-		getChildView("forward")->setEnabled( self->getHistoryForwardAvailable() );
+		mBtnBack->setEnabled( self->getHistoryBackAvailable() );
+		mBtnForward->setEnabled( self->getHistoryForwardAvailable() );
 
 		// toggle visibility of these buttons based on browser state
-		getChildView("reload")->setVisible( false );
-		getChildView("stop")->setVisible( true );
+		mBtnReload->setVisible( false );
+		mBtnStop->setVisible( true );
 
 		// turn "on" progress bar now we're about to start loading
 		mStatusBarProgress->setVisible( true );
@@ -310,12 +329,12 @@ void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent
 	else if(event == MEDIA_EVENT_NAVIGATE_COMPLETE)
 	{
 		// flags are sent with this event
-		getChildView("back")->setEnabled( self->getHistoryBackAvailable() );
-		getChildView("forward")->setEnabled( self->getHistoryForwardAvailable() );
+		mBtnBack->setEnabled( self->getHistoryBackAvailable() );
+		mBtnForward->setEnabled( self->getHistoryForwardAvailable() );
 
 		// toggle visibility of these buttons based on browser state
-		getChildView("reload")->setVisible( true );
-		getChildView("stop")->setVisible( false );
+		mBtnReload->setVisible( true );
+		mBtnStop->setVisible( false );
 
 		// turn "off" progress bar now we're loaded
 		mStatusBarProgress->setVisible( false );
@@ -421,8 +440,8 @@ void LLFloaterWebContent::onClickStop()
 	// still should happen when we catch the navigate complete event
 	// but sometimes (don't know why) that event isn't sent from Qt
 	// and we ghetto a point where the stop button stays active.
-	getChildView("reload")->setVisible( true );
-	getChildView("stop")->setVisible( false );
+	mBtnReload->setVisible( true );
+	mBtnStop->setVisible( false );
 }
 
 void LLFloaterWebContent::onEnterAddress()
diff --git a/indra/newview/llfloaterwebcontent.h b/indra/newview/llfloaterwebcontent.h
index 6fc66d1ad8cbae8236b4100bc0a51cfd1b6cd97b..cfc87e90155fd91c248e366ddc03d935715c0bda 100644
--- a/indra/newview/llfloaterwebcontent.h
+++ b/indra/newview/llfloaterwebcontent.h
@@ -43,6 +43,7 @@ class LLFloaterWebContent :
 	public LLInstanceTracker<LLFloaterWebContent, std::string>
 {
 public:
+	typedef LLInstanceTracker<LLFloaterWebContent, std::string> instance_tracker_t;
     LOG_CLASS(LLFloaterWebContent);
 
 	struct _Params : public LLInitParam::Block<_Params>
@@ -89,6 +90,7 @@ class LLFloaterWebContent :
 	void onEnterAddress();
 	void onPopExternal();
 
+	static void preCreate(Params& p);
 	void open_media(const Params& );
 	void set_current_url(const std::string& url);
 
@@ -97,6 +99,12 @@ class LLFloaterWebContent :
 	LLIconCtrl*		mSecureLockIcon;
 	LLTextBox*		mStatusBarText;
 	LLProgressBar*	mStatusBarProgress;
+
+	LLView*			mBtnBack;
+	LLView*			mBtnForward;
+	LLView*			mBtnReload;
+	LLView*			mBtnStop;
+
 	std::string		mCurrentURL;
 	std::string		mUUID;
 	bool			mShowPageTitle;
diff --git a/indra/newview/llfloaterwebprofile.cpp b/indra/newview/llfloaterwebprofile.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c41f6f148f317b50cb55542b8aadcbd47dce976a
--- /dev/null
+++ b/indra/newview/llfloaterwebprofile.cpp
@@ -0,0 +1,79 @@
+/** 
+ * @file llfloaterwebprofile.cpp
+ * @brief Avatar profile floater.
+ *
+ * $LicenseInfo:firstyear=2009&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llfloaterwebprofile.h"
+
+#include "llviewercontrol.h"
+
+LLFloaterWebProfile::LLFloaterWebProfile(const Params& key) :
+	LLFloaterWebContent(key)
+{
+}
+
+void LLFloaterWebProfile::onOpen(const LLSD& key)
+{
+	Params p(key);
+	p.show_chrome(false).
+		window_class("profile");
+	LLFloaterWebContent::onOpen(p);
+	applyPreferredRect();
+}
+
+// virtual
+void LLFloaterWebProfile::handleReshape(const LLRect& new_rect, bool by_user)
+{
+	lldebugs << "handleReshape: " << new_rect << llendl;
+
+	if (by_user && !isMinimized())
+	{
+		lldebugs << "Storing new rect" << llendl;
+		gSavedSettings.setRect("WebProfileFloaterRect", new_rect);
+	}
+
+	LLFloaterWebContent::handleReshape(new_rect, by_user);
+}
+
+LLFloater* LLFloaterWebProfile::create(const LLSD& key)
+{
+	LLFloaterWebContent::Params p(key);
+	preCreate(p);
+	return new LLFloaterWebProfile(p);
+}
+
+void LLFloaterWebProfile::applyPreferredRect()
+{
+	const LLRect preferred_rect = gSavedSettings.getRect("WebProfileFloaterRect");
+	lldebugs << "Applying preferred rect: " << preferred_rect << llendl;
+
+	// Don't override position that may have been set by floater stacking code.
+	LLRect new_rect = getRect();
+	new_rect.setLeftTopAndSize(
+		new_rect.mLeft, new_rect.mTop,
+		preferred_rect.getWidth(), preferred_rect.getHeight());
+	setShape(new_rect);
+}
diff --git a/indra/newview/llmenucommands.h b/indra/newview/llfloaterwebprofile.h
similarity index 54%
rename from indra/newview/llmenucommands.h
rename to indra/newview/llfloaterwebprofile.h
index fa845c6f02a15d5b9386a766378441833458b43a..4c355e401b6d425f8b97fb4929a3e98fab837187 100644
--- a/indra/newview/llmenucommands.h
+++ b/indra/newview/llfloaterwebprofile.h
@@ -1,8 +1,8 @@
 /** 
- * @file llmenucommands.h
- * @brief Implementations of menu commands.
+ * @file llfloaterwebprofile.h
+ * @brief Avatar profile floater.
  *
- * $LicenseInfo:firstyear=2003&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2009&license=viewerlgpl$
  * Second Life Viewer Source Code
  * Copyright (C) 2010, Linden Research, Inc.
  * 
@@ -24,14 +24,36 @@
  * $/LicenseInfo$
  */
 
-#ifndef LL_LLMENUCOMMANDS_H
-#define LL_LLMENUCOMMANDS_H
+#ifndef LL_LLFLOATERWEBPROFILE_H
+#define LL_LLFLOATERWEBPROFILE_H
 
-class LLUUID;
+#include "llfloaterwebcontent.h"
+#include "llviewermediaobserver.h"
 
-void handle_mouselook(void*);
-void handle_chat(void*);
-void handle_return_key(void*);
-void handle_slash_key(void*);
+#include <string>
+
+class LLMediaCtrl;
+
+/**
+ * Displays avatar profile web page.
+ */
+class LLFloaterWebProfile
+:	public LLFloaterWebContent
+{
+	LOG_CLASS(LLFloaterWebProfile);
+public:
+	typedef LLFloaterWebContent::Params Params;
+
+	LLFloaterWebProfile(const Params& key);
+
+	/*virtual*/ void onOpen(const LLSD& key);
+	/*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false);
+
+	static LLFloater* create(const LLSD& key);
+
+private:
+	void applyPreferredRect();
+};
+
+#endif  // LL_LLFLOATERWEBPROFILE_H
 
-#endif
diff --git a/indra/newview/llfloaterwindowsize.cpp b/indra/newview/llfloaterwindowsize.cpp
index a70f2af11a180c8bdeaf10ceaea6e356a0e6c272..ec161018b843a1933aeb8f61bda2729a60253b11 100644
--- a/indra/newview/llfloaterwindowsize.cpp
+++ b/indra/newview/llfloaterwindowsize.cpp
@@ -58,33 +58,12 @@ bool extractWindowSizeFromString(const std::string& instr, U32 *width, U32 *heig
 }
 
 
-///----------------------------------------------------------------------------
-/// Class LLFloaterWindowSize
-///----------------------------------------------------------------------------
-class LLFloaterWindowSize
-:	public LLFloater
-{
-	friend class LLFloaterReg;
-private:
-	LLFloaterWindowSize(const LLSD& key);
-	virtual ~LLFloaterWindowSize();
-
-public:
-	/*virtual*/ BOOL postBuild();
-	void initWindowSizeControls();
-	void onClickSet();
-	void onClickCancel();
-};
-
-
 LLFloaterWindowSize::LLFloaterWindowSize(const LLSD& key) 
 :	LLFloater(key)
-{
-}
+{}
 
 LLFloaterWindowSize::~LLFloaterWindowSize()
-{
-}
+{}
 
 BOOL LLFloaterWindowSize::postBuild()
 {
@@ -145,13 +124,3 @@ void LLFloaterWindowSize::onClickCancel()
 {
 	closeFloater();
 }
-
-///----------------------------------------------------------------------------
-/// LLFloaterWindowSizeUtil
-///----------------------------------------------------------------------------
-void LLFloaterWindowSizeUtil::registerFloater()
-{
-	LLFloaterReg::add("window_size", "floater_window_size.xml",
-		&LLFloaterReg::build<LLFloaterWindowSize>);
-
-}
diff --git a/indra/newview/llfloaterwindowsize.h b/indra/newview/llfloaterwindowsize.h
index 40f1a25bb3acfc38bd6ab8bde3ba23ac166820fb..a71e5e273c9252f77d03cc1b912f7196c2b4d3f0 100644
--- a/indra/newview/llfloaterwindowsize.h
+++ b/indra/newview/llfloaterwindowsize.h
@@ -26,10 +26,24 @@
 #ifndef LLFLOATERWINDOWSIZE_H
 #define LLFLOATERWINDOWSIZE_H
 
-// Allow user to set the window size for filming tutorials, machinima, etc
-namespace LLFloaterWindowSizeUtil
+#include "llfloater.h"
+
+///----------------------------------------------------------------------------
+/// Class LLFloaterWindowSize
+///----------------------------------------------------------------------------
+class LLFloaterWindowSize
+	:	public LLFloater
 {
-	void registerFloater();
-}
+	friend class LLFloaterReg;
+private:
+	LLFloaterWindowSize(const LLSD& key);
+	virtual ~LLFloaterWindowSize();
+
+public:
+	/*virtual*/ BOOL postBuild();
+	void initWindowSizeControls();
+	void onClickSet();
+	void onClickCancel();
+};
 
 #endif
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index 6ec2598e4479ee7b0ecfdee947b8598571380442..1fa194ab1918b41bb8d9a1c01ff1c1113ef2bf8c 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -30,7 +30,7 @@
 
 #include "llcallbacklist.h"
 #include "llinventorybridge.h"
-#include "llinventoryclipboard.h" // *TODO: remove this once hack below gone.
+#include "llclipboard.h" // *TODO: remove this once hack below gone.
 #include "llinventoryfilter.h"
 #include "llinventoryfunctions.h"
 #include "llinventorymodelbackgroundfetch.h"
@@ -164,6 +164,33 @@ void LLCloseAllFoldersFunctor::doFolder(LLFolderViewFolder* folder)
 void LLCloseAllFoldersFunctor::doItem(LLFolderViewItem* item)
 { }
 
+///----------------------------------------------------------------------------
+/// Class LLFolderViewScrollContainer
+///----------------------------------------------------------------------------
+
+// virtual
+const LLRect LLFolderViewScrollContainer::getScrolledViewRect() const
+{
+	LLRect rect = LLRect::null;
+	if (mScrolledView)
+	{
+		LLFolderView* folder_view = dynamic_cast<LLFolderView*>(mScrolledView);
+		if (folder_view)
+		{
+			S32 height = folder_view->mRunningHeight;
+
+			rect = mScrolledView->getRect();
+			rect.setLeftTopAndSize(rect.mLeft, rect.mTop, rect.getWidth(), height);
+		}
+	}
+
+	return rect;
+}
+
+LLFolderViewScrollContainer::LLFolderViewScrollContainer(const LLScrollContainer::Params& p)
+:	LLScrollContainer(p)
+{}
+
 ///----------------------------------------------------------------------------
 /// Class LLFolderView
 ///----------------------------------------------------------------------------
@@ -172,6 +199,7 @@ LLFolderView::Params::Params()
 	title("title"),
 	use_label_suffix("use_label_suffix"),
 	allow_multiselect("allow_multiselect", true),
+	show_empty_message("show_empty_message", true),
 	show_load_status("show_load_status", true),
 	use_ellipses("use_ellipses", false)
 {
@@ -185,6 +213,7 @@ LLFolderView::LLFolderView(const Params& p)
 	mScrollContainer( NULL ),
 	mPopupMenuHandle(),
 	mAllowMultiSelect(p.allow_multiselect),
+	mShowEmptyMessage(p.show_empty_message),
 	mShowFolderHierarchy(FALSE),
 	mSourceID(p.task_id),
 	mRenameItem( NULL ),
@@ -253,7 +282,7 @@ LLFolderView::LLFolderView(const Params& p)
 	LLRect new_r = LLRect(rect.mLeft + ICON_PAD,
 			      rect.mTop - TEXT_PAD,
 			      rect.mRight,
-			      rect.mTop - TEXT_PAD - llfloor(font->getLineHeight()));
+			      rect.mTop - TEXT_PAD - font->getLineHeight());
 	text_p.rect(new_r);
 	text_p.name(std::string(p.name));
 	text_p.font(font);
@@ -299,7 +328,7 @@ LLFolderView::~LLFolderView( void )
 	mAutoOpenItems.removeAllNodes();
 	gIdleCallbacks.deleteFunction(idle, this);
 
-	delete mPopupMenuHandle.get();
+	if (mPopupMenuHandle.get()) mPopupMenuHandle.get()->die();
 
 	mAutoOpenItems.removeAllNodes();
 	clearSelection();
@@ -349,10 +378,6 @@ BOOL LLFolderView::addFolder( LLFolderViewFolder* folder)
 	{
 		mFolders.insert(mFolders.begin(), folder);
 	}
-	if (folder->numSelected())
-	{
-		recursiveIncrementNumDescendantsSelected(folder->numSelected());
-	}
 	folder->setShowLoadStatus(mShowLoadStatus);
 	folder->setOrigin(0, 0);
 	folder->reshape(getRect().getWidth(), 0);
@@ -390,7 +415,7 @@ void LLFolderView::setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse
 
 static LLFastTimer::DeclareTimer FTM_ARRANGE("Arrange");
 
-// This view grows and shinks to enclose all of its children items and folders.
+// This view grows and shrinks to enclose all of its children items and folders.
 S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_generation )
 {
 	if (getListener()->getUUID().notNull())
@@ -416,7 +441,7 @@ S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_gen
 		getRoot()->getFilter()->getShowFolderState();
 
 	S32 total_width = LEFT_PAD;
-	S32 running_height = mDebugFilters ? llceil(LLFontGL::getFontMonospace()->getLineHeight()) : 0;
+	S32 running_height = mDebugFilters ? LLFontGL::getFontMonospace()->getLineHeight() : 0;
 	S32 target_height = running_height;
 	S32 parent_item_height = getRect().getHeight();
 
@@ -431,8 +456,8 @@ S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_gen
 		}
 		else
 		{
-			folderp->setVisible(show_folder_state == LLInventoryFilter::SHOW_ALL_FOLDERS || // always show folders?
-									(folderp->getFiltered(filter_generation) || folderp->hasFilteredDescendants(filter_generation))); // passed filter or has descendants that passed filter
+			folderp->setVisible((show_folder_state == LLInventoryFilter::SHOW_ALL_FOLDERS || // always show folders?
+								 (folderp->getFiltered(filter_generation) || folderp->hasFilteredDescendants(filter_generation))));
 		}
 
 		if (folderp->getVisible())
@@ -529,15 +554,16 @@ void LLFolderView::reshape(S32 width, S32 height, BOOL called_from_parent)
 		LLView::reshape(width, height, called_from_parent);
 		scroll_rect = mScrollContainer->getContentWindowRect();
 	}
-	width = llmax(mMinWidth, scroll_rect.getWidth());
+	width  = llmax(mMinWidth, scroll_rect.getWidth());
 	height = llmax(mRunningHeight, scroll_rect.getHeight());
 
-	// restrict width with scroll container's width
-	if (mUseEllipses)
+	// Restrict width within scroll container's width
+	if (mUseEllipses && mScrollContainer)
+	{
 		width = scroll_rect.getWidth();
+	}
 
 	LLView::reshape(width, height, called_from_parent);
-
 	mReshapeSignal(mSelectedItems, FALSE);
 }
 
@@ -694,26 +720,6 @@ BOOL LLFolderView::changeSelection(LLFolderViewItem* selection, BOOL selected)
 	return rv;
 }
 
-void LLFolderView::extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items)
-{
-	// now store resulting selection
-	if (mAllowMultiSelect)
-	{
-		LLFolderViewItem *cur_selection = getCurSelectedItem();
-		LLFolderViewFolder::extendSelection(selection, cur_selection, items);
-		for (S32 i = 0; i < items.count(); i++)
-		{
-			addToSelectionList(items[i]);
-		}
-	}
-	else
-	{
-		setSelection(selection, FALSE, FALSE);
-	}
-
-	mSignalSelectCallback = SIGNAL_KEYBOARD_FOCUS;
-}
-
 static LLFastTimer::DeclareTimer FTM_SANITIZE_SELECTION("Sanitize Selection");
 void LLFolderView::sanitizeSelection()
 {
@@ -791,7 +797,7 @@ void LLFolderView::sanitizeSelection()
 	// if nothing selected after prior constraints...
 	if (mSelectedItems.empty())
 	{
-		// ...select first available parent of original selection, or "My Inventory" otherwise
+		// ...select first available parent of original selection
 		LLFolderViewItem* new_selection = NULL;
 		if (original_selected_item)
 		{
@@ -932,9 +938,9 @@ void LLFolderView::draw()
 		mStatusText.clear();
 		mStatusTextBox->setVisible( FALSE );
 	}
-	else
+	else if (mShowEmptyMessage)
 	{
-		if (LLInventoryModelBackgroundFetch::instance().backgroundFetchActive() || mCompletedFilterGeneration < mFilter->getMinRequiredGeneration())
+		if (LLInventoryModelBackgroundFetch::instance().folderFetchActive() || mCompletedFilterGeneration < mFilter->getMinRequiredGeneration())
 		{
 			mStatusText = LLTrans::getString("Searching");
 		}
@@ -965,8 +971,10 @@ void LLFolderView::draw()
 			// We should call this method to also notify parent about required rect.
 			// See EXT-7564, EXT-7047.
 			arrangeFromRoot();
+			LLUI::popMatrix();
+			LLUI::pushMatrix();
+			LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom);
 		}
-		
 	}
 
 	// skip over LLFolderViewFolder::draw since we don't want the folder icon, label, 
@@ -1037,6 +1045,24 @@ bool isDescendantOfASelectedItem(LLFolderViewItem* item, const std::vector<LLFol
 	return false;
 }
 
+// static
+void LLFolderView::removeCutItems()
+{
+	// There's no item in "cut" mode on the clipboard -> exit
+	if (!LLClipboard::instance().isCutMode())
+		return;
+
+	// Get the list of clipboard item uuids and iterate through them
+	LLDynamicArray<LLUUID> objects;
+	LLClipboard::instance().pasteFromClipboard(objects);
+	for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin();
+		 iter != objects.end();
+		 ++iter)
+	{
+		gInventory.removeObject(*iter);
+	}
+}
+
 void LLFolderView::onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response)
 {
 	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
@@ -1058,7 +1084,7 @@ void LLFolderView::onItemsRemovalConfirmation(const LLSD& notification, const LL
 		for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it)
 		{
 			item = *item_it;
-			if(item->isRemovable())
+			if (item && item->isRemovable())
 			{
 				items.push_back(item);
 			}
@@ -1222,7 +1248,9 @@ void LLFolderView::changeType(LLInventoryModel *model, LLFolderType::EType new_f
 
 void LLFolderView::autoOpenItem( LLFolderViewFolder* item )
 {
-	if (mAutoOpenItems.check() == item || mAutoOpenItems.getDepth() >= (U32)AUTO_OPEN_STACK_DEPTH)
+	if ((mAutoOpenItems.check() == item) || 
+		(mAutoOpenItems.getDepth() >= (U32)AUTO_OPEN_STACK_DEPTH) ||
+		item->isOpen())
 	{
 		return;
 	}
@@ -1314,7 +1342,7 @@ BOOL LLFolderView::canCopy() const
 void LLFolderView::copy()
 {
 	// *NOTE: total hack to clear the inventory clipboard
-	LLInventoryClipboard::instance().reset();
+	LLClipboard::instance().reset();
 	S32 count = mSelectedItems.size();
 	if(getVisible() && getEnabled() && (count > 0))
 	{
@@ -1355,7 +1383,7 @@ BOOL LLFolderView::canCut() const
 void LLFolderView::cut()
 {
 	// clear the inventory clipboard
-	LLInventoryClipboard::instance().reset();
+	LLClipboard::instance().reset();
 	S32 count = mSelectedItems.size();
 	if(getVisible() && getEnabled() && (count > 0))
 	{
@@ -1369,6 +1397,7 @@ void LLFolderView::cut()
 				listener->cutToClipboard();
 			}
 		}
+		LLFolderView::removeCutItems();
 	}
 	mSearchString.clear();
 }
@@ -1945,9 +1974,9 @@ BOOL LLFolderView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 	if (!handled)
 	{
 		if (getListener()->getUUID().notNull())
-	{
-		handled = LLFolderViewFolder::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
-	}
+		{
+			handled = LLFolderViewFolder::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
+		}
 		else
 		{
 			if (!mFolders.empty())
@@ -1969,7 +1998,7 @@ BOOL LLFolderView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 void LLFolderView::deleteAllChildren()
 {
 	closeRenamer();
-	delete mPopupMenuHandle.get();
+	if (mPopupMenuHandle.get()) mPopupMenuHandle.get()->die();
 	mPopupMenuHandle = LLHandle<LLView>();
 	mScrollContainer = NULL;
 	mRenameItem = NULL;
@@ -1982,19 +2011,13 @@ void LLFolderView::deleteAllChildren()
 
 void LLFolderView::scrollToShowSelection()
 {
-	// If items are filtered while background fetch is in progress
-	// scrollbar resets to the first filtered item. See EXT-3981.
-	// However we allow scrolling for folder views with mAutoSelectOverride
-	// (used in Places SP) as an exception because the selection in them
-	// is not reset during items filtering. See STORM-133.
-	if ( (!LLInventoryModelBackgroundFetch::instance().backgroundFetchActive() || mAutoSelectOverride)
-			&& mSelectedItems.size() )
+	if ( mSelectedItems.size() )
 	{
 		mNeedsScroll = TRUE;
 	}
 }
 
-// If the parent is scroll containter, scroll it to make the selection
+// If the parent is scroll container, scroll it to make the selection
 // is maximally visible.
 void LLFolderView::scrollToShowItem(LLFolderViewItem* item, const LLRect& constraint_rect)
 {
@@ -2015,7 +2038,7 @@ void LLFolderView::scrollToShowItem(LLFolderViewItem* item, const LLRect& constr
 		LLRect visible_doc_rect = mScrollContainer->getVisibleContentRect();
 		
 		S32 icon_height = mIcon.isNull() ? 0 : mIcon->getHeight(); 
-		S32 label_height = llround(getLabelFontForStyle(mLabelStyle)->getLineHeight()); 
+		S32 label_height = getLabelFontForStyle(mLabelStyle)->getLineHeight(); 
 		// when navigating with keyboard, only move top of opened folder on screen, otherwise show whole folder
 		S32 max_height_to_show = item->isOpen() && mScrollContainer->hasFocus() ? (llmax( icon_height, label_height ) + ICON_PAD) : local_rect.getHeight(); 
 		
@@ -2129,10 +2152,10 @@ bool LLFolderView::doToSelected(LLInventoryModel* model, const LLSD& userdata)
 		removeSelectedItems();
 		return true;
 	}
-
-	if ("copy" == action)
-	{	
-		LLInventoryClipboard::instance().reset();
+	if (("copy" == action) || ("cut" == action))
+	{
+		// Clear the clipboard before we start adding things on it
+		LLClipboard::instance().reset();
 	}
 
 	static const std::string change_folder_string = "change_folder_type_";
@@ -2213,46 +2236,56 @@ void LLFolderView::doIdle()
 		arrangeAll();
 	}
 
+	if (mFilter->isModified() && mFilter->isNotDefault())
+	{
+		mNeedsAutoSelect = TRUE;
+	}
 	mFilter->clearModified();
-	BOOL filter_modified_and_active = mCompletedFilterGeneration < mFilter->getCurrentGeneration() && 
-										mFilter->isNotDefault();
-	mNeedsAutoSelect = filter_modified_and_active &&
-							!(gFocusMgr.childHasKeyboardFocus(this) || gFocusMgr.getMouseCapture());
 
-	// filter to determine visiblity before arranging
+	// filter to determine visibility before arranging
 	filterFromRoot();
 
 	// automatically show matching items, and select first one if we had a selection
-	// do this every frame until user puts keyboard focus into the inventory window
-	// signaling the end of the automatic update
-	// only do this when mNeedsFilter is set, meaning filtered items have
-	// potentially changed
 	if (mNeedsAutoSelect)
 	{
 		LLFastTimer t3(FTM_AUTO_SELECT);
 		// select new item only if a filtered item not currently selected
 		LLFolderViewItem* selected_itemp = mSelectedItems.empty() ? NULL : mSelectedItems.back();
-		if ((selected_itemp && !selected_itemp->getFiltered()) && !mAutoSelectOverride)
+		if (!mAutoSelectOverride && (!selected_itemp || !selected_itemp->potentiallyFiltered()))
 		{
-			// select first filtered item
-			LLSelectFirstFilteredItem filter;
-			applyFunctorRecursively(filter);
+			// these are named variables to get around gcc not binding non-const references to rvalues
+			// and functor application is inherently non-const to allow for stateful functors
+			LLSelectFirstFilteredItem functor;
+			applyFunctorRecursively(functor);
 		}
 
 		// Open filtered folders for folder views with mAutoSelectOverride=TRUE.
 		// Used by LLPlacesFolderView.
 		if (mAutoSelectOverride && !mFilter->getFilterSubString().empty())
 		{
-			LLOpenFilteredFolders filter;
-			applyFunctorRecursively(filter);
+			// these are named variables to get around gcc not binding non-const references to rvalues
+			// and functor application is inherently non-const to allow for stateful functors
+			LLOpenFilteredFolders functor;
+			applyFunctorRecursively(functor);
 		}
 
 		scrollToShowSelection();
 	}
 
+	BOOL filter_finished = mCompletedFilterGeneration >= mFilter->getCurrentGeneration() 
+						&& !LLInventoryModelBackgroundFetch::instance().folderFetchActive();
+	if (filter_finished 
+		|| gFocusMgr.childHasKeyboardFocus(inventory_panel) 
+		|| gFocusMgr.childHasMouseCapture(inventory_panel))
+	{
+		// finishing the filter process, giving focus to the folder view, or dragging the scrollbar all stop the auto select process
+		mNeedsAutoSelect = FALSE;
+	}
+
+
 	// during filtering process, try to pin selected item's location on screen
 	// this will happen when searching your inventory and when new items arrive
-	if (filter_modified_and_active)
+	if (!filter_finished)
 	{
 		// calculate rectangle to pin item to at start of animated rearrange
 		if (!mPinningSelectedItem && !mSelectedItems.empty())
@@ -2318,7 +2351,7 @@ void LLFolderView::doIdle()
 	{
 		scrollToShowItem(mSelectedItems.back(), constraint_rect);
 		// continue scrolling until animated layout change is done
-		if (!filter_modified_and_active 
+		if (filter_finished
 			&& (!needsArrange() || !is_visible))
 		{
 			mNeedsScroll = FALSE;
diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h
index 8af01e9102b8667e386527a1e59ef207b9a59e7d..da8bb15f8ef9397c45efad6f36d346caf8491f4e 100644
--- a/indra/newview/llfolderview.h
+++ b/indra/newview/llfolderview.h
@@ -44,6 +44,7 @@
 #include "lldepthstack.h"
 #include "lleditmenuhandler.h"
 #include "llfontgl.h"
+#include "llscrollcontainer.h"
 #include "lltooldraganddrop.h"
 #include "llviewertexture.h"
 
@@ -54,15 +55,33 @@ class LLInventoryModel;
 class LLPanel;
 class LLLineEditor;
 class LLMenuGL;
-class LLScrollContainer;
 class LLUICtrl;
 class LLTextBox;
 
+/**
+ * Class LLFolderViewScrollContainer
+ *
+ * A scroll container which provides the information about the height
+ * of currently displayed folder view contents.
+ * Used for updating vertical scroll bar visibility in inventory panel.
+ * See LLScrollContainer::calcVisibleSize().
+ */
+class LLFolderViewScrollContainer : public LLScrollContainer
+{
+public:
+	/*virtual*/ ~LLFolderViewScrollContainer() {};
+	/*virtual*/ const LLRect getScrolledViewRect() const;
+
+protected:
+	LLFolderViewScrollContainer(const LLScrollContainer::Params& p);
+	friend class LLUICtrlFactory;
+};
+
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // Class LLFolderView
 //
-// Th LLFolderView represents the root level folder view object. It
-// manages the screen region of the folder view.
+// The LLFolderView represents the root level folder view object. 
+// It manages the screen region of the folder view.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
@@ -75,11 +94,15 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 		Optional<std::string>   title;
 		Optional<bool>			use_label_suffix,
 								allow_multiselect,
+								show_empty_message,
 								show_load_status,
 								use_ellipses;
 
 		Params();
 	};
+
+	friend class LLFolderViewScrollContainer;
+
 	LLFolderView(const Params&);
 	virtual ~LLFolderView( void );
 
@@ -87,7 +110,7 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 
 	virtual LLFolderView*	getRoot() { return this; }
 
-	// FolderViews default to sort by name.  This will change that,
+	// FolderViews default to sort by name. This will change that,
 	// and resort the items if necessary.
 	void setSortOrder(U32 order);
 	void setFilterPermMask(PermissionMask filter_perm_mask);
@@ -106,6 +129,8 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 	U32 getSortOrder() const;
 	BOOL isFilterModified();
 
+	bool getAllowMultiSelect() { return mAllowMultiSelect; }
+
 	// Close all folders in the view
 	void closeAllFolders();
 	void openTopLevelFolders();
@@ -114,20 +139,20 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 	virtual void setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse);
 	virtual BOOL addFolder( LLFolderViewFolder* folder);
 
-	// Finds width and height of this object and it's children.  Also
-	// makes sure that this view and it's children are the right size.
+	// Find width and height of this object and its children. Also
+	// makes sure that this view and its children are the right size.
 	virtual S32 arrange( S32* width, S32* height, S32 filter_generation );
 
 	void arrangeAll() { mArrangeGeneration++; }
 	S32 getArrangeGeneration() { return mArrangeGeneration; }
 
-	// applies filters to control visibility of inventory items
+	// Apply filters to control visibility of inventory items
 	virtual void filter( LLInventoryFilter& filter);
 
-	// get the last selected item
+	// Get the last selected item
 	virtual LLFolderViewItem* getCurSelectedItem( void );
 
-	// Record the selected item and pass it down the hierachy.
+	// Record the selected item and pass it down the hierarchy.
 	virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem,
 		BOOL take_keyboard_focus);
 
@@ -137,15 +162,13 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 	// Called once a frame to update the selection if mSelectThisID has been set
 	void updateSelection();
 
-	// This method is used to toggle the selection of an item. Walks
-	// children, and keeps track of selected objects.
+	// This method is used to toggle the selection of an item. 
+	// Walks children and keeps track of selected objects.
 	virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected);
 
-	virtual void extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items);
-
 	virtual std::set<LLUUID> getSelectionList() const;
 
-	// make sure if ancestor is selected, descendents are not
+	// Make sure if ancestor is selected, descendents are not
 	void sanitizeSelection();
 	void clearSelection();
 	void addToSelectionList(LLFolderViewItem* item);
@@ -156,22 +179,22 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 	void setDraggingOverItem(LLFolderViewItem* item) { mDraggingOverItem = item; }
 	LLFolderViewItem* getDraggingOverItem() { return mDraggingOverItem; }
 
-
-	// deletion functionality
+	// Deletion functionality
  	void removeSelectedItems();
+ 	static void removeCutItems();
 
-	// open the selected item.
+	// Open the selected item
 	void openSelectedItems( void );
 	void propertiesSelectedItems( void );
 
-	// change the folder type
+	// Change the folder type
 	void changeType(LLInventoryModel *model, LLFolderType::EType new_folder_type);
 
 	void autoOpenItem(LLFolderViewFolder* item);
 	void closeAutoOpenedFolders();
 	BOOL autoOpenTest(LLFolderViewFolder* item);
 
-	// copy & paste
+	// Copy & paste
 	virtual void	copy();
 	virtual BOOL	canCopy() const;
 
@@ -184,7 +207,7 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 	virtual void	doDelete();
 	virtual BOOL	canDoDelete() const;
 
-	// public rename functionality - can only start the process
+	// Public rename functionality - can only start the process
 	void startRenamingSelectedItem( void );
 
 	// These functions were used when there was only one folderview,
@@ -282,6 +305,7 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 	selected_items_t				mSelectedItems;
 	BOOL							mKeyboardSelection;
 	BOOL							mAllowMultiSelect;
+	BOOL							mShowEmptyMessage;
 	BOOL							mShowFolderHierarchy;
 	LLUUID							mSourceID;
 
@@ -324,7 +348,7 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 
 	/**
 	 * Is used to determine if we need to cut text In LLFolderViewItem to avoid horizontal scroll.
-	 * NOTE: For now it uses only to cut LLFolderViewItem::mLabel text to be used for Landmarks in Places Panel.
+	 * NOTE: For now it's used only to cut LLFolderViewItem::mLabel text for Landmarks in Places Panel.
 	 */
 	bool							mUseEllipses; // See EXT-719
 
diff --git a/indra/newview/llfoldervieweventlistener.h b/indra/newview/llfoldervieweventlistener.h
index aee31ca0339e2caa1f39ed1b4dc57bf10e44da23..06682dcbf1f9d8058e9449e146027f4ae80f38a0 100644
--- a/indra/newview/llfoldervieweventlistener.h
+++ b/indra/newview/llfoldervieweventlistener.h
@@ -75,7 +75,7 @@ class LLFolderViewEventListener
 	virtual void move( LLFolderViewEventListener* parent_listener ) = 0;
 	virtual BOOL isItemCopyable() const = 0;
 	virtual BOOL copyToClipboard() const = 0;
-	virtual void cutToClipboard() = 0;
+	virtual BOOL cutToClipboard() const = 0;
 	virtual BOOL isClipboardPasteable() const = 0;
 	virtual void pasteFromClipboard() = 0;
 	virtual void pasteLinkFromClipboard() = 0;
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index 622dcfe8ddbeab9cd6bba470b6cf9758844dddf0..d2b4866987e69b3b61667bce6de36f25c7e587c3 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -40,6 +40,7 @@
 #include "llviewerwindow.h"		// Argh, only for setCursor()
 
 // linden library includes
+#include "llclipboard.h"
 #include "llfocusmgr.h"		// gFocusMgr
 #include "lltrans.h"
 
@@ -220,6 +221,11 @@ BOOL LLFolderViewItem::potentiallyVisible()
 {
 	// we haven't been checked against min required filter
 	// or we have and we passed
+	return potentiallyFiltered();
+}
+
+BOOL LLFolderViewItem::potentiallyFiltered()
+{
 	return getLastFilterGeneration() < getRoot()->getFilter()->getMinRequiredGeneration() || getFiltered();
 }
 
@@ -386,13 +392,6 @@ void LLFolderViewItem::changeSelectionFromRoot(LLFolderViewItem* selection, BOOL
 	getRoot()->changeSelection(selection, selected);
 }
 
-void LLFolderViewItem::extendSelectionFromRoot(LLFolderViewItem* selection)
-{
-	LLDynamicArray<LLFolderViewItem*> selected_items;
-
-	getRoot()->extendSelection(selection, NULL, selected_items);
-}
-
 std::set<LLUUID> LLFolderViewItem::getSelectionList() const
 {
 	std::set<LLUUID> selection;
@@ -417,8 +416,8 @@ BOOL LLFolderViewItem::addToFolder(LLFolderViewFolder* folder, LLFolderView* roo
 }
 
 
-// Finds width and height of this object and it's children.  Also
-// makes sure that this view and it's children are the right size.
+// Finds width and height of this object and its children.  Also
+// makes sure that this view and its children are the right size.
 S32 LLFolderViewItem::arrange( S32* width, S32* height, S32 filter_generation)
 {
 	const Params& p = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
@@ -430,7 +429,7 @@ S32 LLFolderViewItem::arrange( S32* width, S32* height, S32 filter_generation)
 		: 0;
 	if (mLabelWidthDirty)
 	{
-		mLabelWidth = ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + getLabelFontForStyle(mLabelStyle)->getWidth(mSearchableLabel); 
+		mLabelWidth = ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel) + getLabelFontForStyle(mLabelStyle)->getWidth(mLabelSuffix) + TEXT_PAD_RIGHT; 
 		mLabelWidthDirty = false;
 	}
 
@@ -496,10 +495,6 @@ BOOL LLFolderViewItem::setSelection(LLFolderViewItem* selection, BOOL openitem,
 	if (selection == this && !mIsSelected)
 	{
 		selectItem();
-		if (mListener)
-		{
-			mListener->selectItem();
-		}
 	}
 	else if (mIsSelected)	// Deselect everything else.
 	{
@@ -510,7 +505,7 @@ BOOL LLFolderViewItem::setSelection(LLFolderViewItem* selection, BOOL openitem,
 
 BOOL LLFolderViewItem::changeSelection(LLFolderViewItem* selection, BOOL selected)
 {
-	if (selection == this && mIsSelected != selected)
+	if (selection == this)
 	{
 		if (mIsSelected)
 		{
@@ -520,10 +515,6 @@ BOOL LLFolderViewItem::changeSelection(LLFolderViewItem* selection, BOOL selecte
 		{
 			selectItem();
 		}
-		if (mListener)
-		{
-			mListener->selectItem();
-		}
 		return TRUE;
 	}
 	return FALSE;
@@ -531,29 +522,18 @@ BOOL LLFolderViewItem::changeSelection(LLFolderViewItem* selection, BOOL selecte
 
 void LLFolderViewItem::deselectItem(void)
 {
-	llassert(mIsSelected);
-
 	mIsSelected = FALSE;
-
-	// Update ancestors' count of selected descendents.
-	LLFolderViewFolder* parent_folder = getParentFolder();
-	if (parent_folder)
-	{
-		parent_folder->recursiveIncrementNumDescendantsSelected(-1);
-	}
 }
 
 void LLFolderViewItem::selectItem(void)
 {
-	llassert(!mIsSelected);
-
-	mIsSelected = TRUE;
-
-	// Update ancestors' count of selected descendents.
-	LLFolderViewFolder* parent_folder = getParentFolder();
-	if (parent_folder)
+	if (mIsSelected == FALSE)
 	{
-		parent_folder->recursiveIncrementNumDescendantsSelected(1);
+		if (mListener)
+		{
+			mListener->selectItem();
+		}
+		mIsSelected = TRUE;
 	}
 }
 
@@ -658,7 +638,7 @@ LLViewerInventoryItem * LLFolderViewItem::getInventoryItem(void)
 	return gInventory.getItem(getListener()->getUUID());
 }
 
-std::string LLFolderViewItem::getName( void ) const
+const std::string& LLFolderViewItem::getName( void ) const
 {
 	if(mListener)
 	{
@@ -697,7 +677,7 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask )
 		}
 		else if (mask & MASK_SHIFT)
 		{
-			extendSelectionFromRoot(this);
+			getParentFolder()->extendSelectionTo(this);
 		}
 		else
 		{
@@ -812,7 +792,7 @@ BOOL LLFolderViewItem::handleMouseUp( S32 x, S32 y, MASK mask )
 		}
 		else if (mask & MASK_SHIFT)
 		{
-			extendSelectionFromRoot(this);
+			getParentFolder()->extendSelectionTo(this);
 		}
 		else
 		{
@@ -1028,7 +1008,7 @@ void LLFolderViewItem::draw()
 	LLColor4 color = (mIsSelected && filled) ? sHighlightFgColor : sFgColor;
 	if (highlight_link) color = sLinkColor;
 	if (in_library) color = sLibraryColor;
-
+	
 	F32 right_x  = 0;
 	F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD;
 	F32 text_left = (F32)(ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + mIndentation);
@@ -1071,7 +1051,7 @@ void LLFolderViewItem::draw()
 	}
 	if ((mIsLoading
 		&&	mTimeSinceRequestStart.getElapsedTimeF32() >= gSavedSettings.getF32("FolderLoadingMessageWaitTime"))
-			||	(LLInventoryModelBackgroundFetch::instance().backgroundFetchActive()
+			||	(LLInventoryModelBackgroundFetch::instance().folderFetchActive()
 				&&	root_is_loading
 				&&	mShowLoadStatus))
 	{
@@ -1125,7 +1105,6 @@ void LLFolderViewItem::draw()
 
 LLFolderViewFolder::LLFolderViewFolder( const LLFolderViewItem::Params& p ): 
 	LLFolderViewItem( p ),	// 0 = no create time
-	mNumDescendantsSelected(0),
 	mIsOpen(FALSE),
 	mExpanderHighlighted(FALSE),
 	mCurHeight(0.f),
@@ -1173,8 +1152,8 @@ BOOL LLFolderViewFolder::addToFolder(LLFolderViewFolder* folder, LLFolderView* r
 	return folder->addFolder(this);
 }
 
-// Finds width and height of this object and it's children.  Also
-// makes sure that this view and it's children are the right size.
+// Finds width and height of this object and its children. Also
+// makes sure that this view and its children are the right size.
 S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation)
 {
 	// sort before laying out contents
@@ -1185,7 +1164,37 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation)
 		mNeedsSort = false;
 	}
 
-	mHasVisibleChildren = hasFilteredDescendants(filter_generation);
+	// evaluate mHasVisibleChildren
+	mHasVisibleChildren = false;
+	if (hasFilteredDescendants(filter_generation))
+	{
+		// We have to verify that there's at least one child that's not filtered out
+		bool found = false;
+		// Try the items first
+		for (items_t::iterator iit = mItems.begin(); iit != mItems.end(); ++iit)
+		{
+			LLFolderViewItem* itemp = (*iit);
+			found = (itemp->getFiltered(filter_generation));
+			if (found)
+				break;
+		}
+		if (!found)
+		{
+			// If no item found, try the folders
+			for (folders_t::iterator fit = mFolders.begin(); fit != mFolders.end(); ++fit)
+			{
+				LLFolderViewFolder* folderp = (*fit);
+				found = ( folderp->getListener()
+								&&	(folderp->getFiltered(filter_generation)
+									 ||	(folderp->getFilteredFolder(filter_generation) 
+										 && folderp->hasFilteredDescendants(filter_generation))));
+				if (found)
+					break;
+			}
+		}
+
+		mHasVisibleChildren = found;
+	}
 
 	// calculate height as a single item (without any children), and reshapes rectangle to match
 	LLFolderViewItem::arrange( width, height, filter_generation );
@@ -1338,7 +1347,7 @@ void LLFolderViewFolder::requestSort()
 
 void LLFolderViewFolder::setCompletedFilterGeneration(S32 generation, BOOL recurse_up)
 {
-	mMostFilteredDescendantGeneration = llmin(mMostFilteredDescendantGeneration, generation);
+	//mMostFilteredDescendantGeneration = llmin(mMostFilteredDescendantGeneration, generation);
 	mCompletedFilterGeneration = generation;
 	// only aggregate up if we are a lower (older) value
 	if (recurse_up
@@ -1372,7 +1381,8 @@ void LLFolderViewFolder::filter( LLInventoryFilter& filter)
 			&& !mPassedFilter)									// and did not pass the filter
 		{
 			// go ahead and flag this folder as done
-			mLastFilterGeneration = filter_generation;			
+			mLastFilterGeneration = filter_generation;
+			mStringMatchOffset = std::string::npos;
 		}
 		else // filter self only on first pass through
 		{
@@ -1572,21 +1582,6 @@ BOOL LLFolderViewFolder::hasFilteredDescendants()
 	return mMostFilteredDescendantGeneration >= getRoot()->getFilter()->getCurrentGeneration();
 }
 
-void LLFolderViewFolder::recursiveIncrementNumDescendantsSelected(S32 increment)
-{
-	LLFolderViewFolder* parent_folder = this;
-	do
-	{
-		parent_folder->mNumDescendantsSelected += increment;
-
-		// Make sure we don't have negative values.
-		llassert(parent_folder->mNumDescendantsSelected >= 0);
-
-		parent_folder = parent_folder->getParentFolder();
-	}
-	while(parent_folder);
-}
-
 // Passes selection information on to children and record selection
 // information if necessary.
 BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem,
@@ -1599,10 +1594,6 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem
 		{
 			selectItem();
 		}
-		if (mListener)
-		{
-			mListener->selectItem();
-		}
 		rv = TRUE;
 	}
 	else
@@ -1663,10 +1654,6 @@ BOOL LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, BOOL selec
 				deselectItem();
 			}
 		}
-		if (mListener && selected)
-		{
-			mListener->selectItem();
-		}
 	}
 
 	for (folders_t::iterator iter = mFolders.begin();
@@ -1690,119 +1677,261 @@ BOOL LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, BOOL selec
 	return rv;
 }
 
-void LLFolderViewFolder::extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& selected_items)
+LLFolderViewFolder* LLFolderViewFolder::getCommonAncestor(LLFolderViewItem* item_a, LLFolderViewItem* item_b, bool& reverse)
 {
-	// pass on to child folders first
-	for (folders_t::iterator iter = mFolders.begin();
-		iter != mFolders.end();)
+	if (!item_a->getParentFolder() || !item_b->getParentFolder()) return NULL;
+
+	std::deque<LLFolderViewFolder*> item_a_ancestors;
+
+	LLFolderViewFolder* parent = item_a->getParentFolder();
+	while(parent)
 	{
-		folders_t::iterator fit = iter++;
-		(*fit)->extendSelection(selection, last_selected, selected_items);
+		item_a_ancestors.push_back(parent);
+		parent = parent->getParentFolder();
 	}
 
-	// handle selection of our immediate children...
-	BOOL reverse_select = FALSE;
-	BOOL found_last_selected = FALSE;
-	BOOL found_selection = FALSE;
-	LLDynamicArray<LLFolderViewItem*> items_to_select;
-	LLFolderViewItem* item;
+	std::deque<LLFolderViewFolder*> item_b_ancestors;
+	
+	parent = item_b->getParentFolder();
+	while(parent)
+	{
+		item_b_ancestors.push_back(parent);
+		parent = parent->getParentFolder();
+	}
 
-	//...folders first...
-	for (folders_t::iterator iter = mFolders.begin();
-		iter != mFolders.end();)
+	LLFolderViewFolder* common_ancestor = item_a->getRoot();
+
+	while(item_a_ancestors.size() > item_b_ancestors.size())
 	{
-		folders_t::iterator fit = iter++;
-		item = (*fit);
-		if(item == selection)
-		{
-			found_selection = TRUE;
-		}
-		else if (item == last_selected)
+		item_a = item_a_ancestors.front();
+		item_a_ancestors.pop_front();
+	}
+
+	while(item_b_ancestors.size() > item_a_ancestors.size())
+	{
+		item_b = item_b_ancestors.front();
+		item_b_ancestors.pop_front();
+	}
+
+	while(item_a_ancestors.size())
+	{
+		common_ancestor = item_a_ancestors.front();
+
+		if (item_a_ancestors.front() == item_b_ancestors.front())
 		{
-			found_last_selected = TRUE;
-			if (found_selection)
+			// which came first, sibling a or sibling b?
+			for (folders_t::iterator it = common_ancestor->mFolders.begin(), end_it = common_ancestor->mFolders.end();
+				it != end_it;
+				++it)
 			{
-				reverse_select = TRUE;
+				LLFolderViewItem* item = *it;
+
+				if (item == item_a)
+				{
+					reverse = false;
+					return common_ancestor;
+				}
+				if (item == item_b)
+				{
+					reverse = true;
+					return common_ancestor;
+				}
 			}
-		}
 
-		if (found_selection || found_last_selected)
-		{
-			// deselect currently selected items so they can be pushed back on queue
-			if (item->isSelected())
+			for (items_t::iterator it = common_ancestor->mItems.begin(), end_it = common_ancestor->mItems.end();
+				it != end_it;
+				++it)
 			{
-				item->changeSelection(item, FALSE);
+				LLFolderViewItem* item = *it;
+
+				if (item == item_a)
+				{
+					reverse = false;
+					return common_ancestor;
+				}
+				if (item == item_b)
+				{
+					reverse = true;
+					return common_ancestor;
+				}
 			}
-			items_to_select.put(item);
+			break;
 		}
 
-		if (found_selection && found_last_selected)
-		{
-			break;
-		}		
+		item_a = item_a_ancestors.front();
+		item_a_ancestors.pop_front();
+		item_b = item_b_ancestors.front();
+		item_b_ancestors.pop_front();
 	}
 
-	if (!(found_selection && found_last_selected))
+	return NULL;
+}
+
+void LLFolderViewFolder::gatherChildRangeExclusive(LLFolderViewItem* start, LLFolderViewItem* end, bool reverse, std::vector<LLFolderViewItem*>& items)
+{
+	bool selecting = start == NULL;
+	if (reverse)
 	{
-		//,,,then items
-		for (items_t::iterator iter = mItems.begin();
-			iter != mItems.end();)
+		for (items_t::reverse_iterator it = mItems.rbegin(), end_it = mItems.rend();
+			it != end_it;
+			++it)
 		{
-			items_t::iterator iit = iter++;
-			item = (*iit);
-			if(item == selection)
+			if (*it == end)
 			{
-				found_selection = TRUE;
+				return;
 			}
-			else if (item == last_selected)
+			if (selecting)
 			{
-				found_last_selected = TRUE;
-				if (found_selection)
-				{
-					reverse_select = TRUE;
-				}
+				items.push_back(*it);
 			}
 
-			if (found_selection || found_last_selected)
+			if (*it == start)
 			{
-				// deselect currently selected items so they can be pushed back on queue
-				if (item->isSelected())
-				{
-					item->changeSelection(item, FALSE);
-				}
-				items_to_select.put(item);
+				selecting = true;
+			}
+		}
+		for (folders_t::reverse_iterator it = mFolders.rbegin(), end_it = mFolders.rend();
+			it != end_it;
+			++it)
+		{
+			if (*it == end)
+			{
+				return;
 			}
 
-			if (found_selection && found_last_selected)
+			if (selecting)
 			{
-				break;
+				items.push_back(*it);
+			}
+
+			if (*it == start)
+			{
+				selecting = true;
 			}
 		}
 	}
-
-	if (found_last_selected && found_selection)
+	else
 	{
-		// we have a complete selection inside this folder
-		for (S32 index = reverse_select ? items_to_select.getLength() - 1 : 0; 
-			reverse_select ? index >= 0 : index < items_to_select.getLength(); reverse_select ? index-- : index++)
+		for (folders_t::iterator it = mFolders.begin(), end_it = mFolders.end();
+			it != end_it;
+			++it)
+		{
+			if (*it == end)
+			{
+				return;
+			}
+
+			if (selecting)
+			{
+				items.push_back(*it);
+			}
+
+			if (*it == start)
+			{
+				selecting = true;
+			}
+		}
+		for (items_t::iterator it = mItems.begin(), end_it = mItems.end();
+			it != end_it;
+			++it)
 		{
-			LLFolderViewItem* item = items_to_select[index];
-			if (item->changeSelection(item, TRUE))
+			if (*it == end)
+			{
+				return;
+			}
+
+			if (selecting)
 			{
-				selected_items.put(item);
+				items.push_back(*it);
+			}
+
+			if (*it == start)
+			{
+				selecting = true;
 			}
 		}
 	}
-	else if (found_selection)
+}
+
+void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection)
+{
+	if (getRoot()->getAllowMultiSelect() == FALSE) return;
+
+	LLFolderViewItem* cur_selected_item = getRoot()->getCurSelectedItem();
+	if (cur_selected_item == NULL)
+	{
+		cur_selected_item = new_selection;
+	}
+
+
+	bool reverse = false;
+	LLFolderViewFolder* common_ancestor = getCommonAncestor(cur_selected_item, new_selection, reverse);
+	if (!common_ancestor) return;
+
+	LLFolderViewItem* last_selected_item_from_cur = cur_selected_item;
+	LLFolderViewFolder* cur_folder = cur_selected_item->getParentFolder();
+
+	std::vector<LLFolderViewItem*> items_to_select_forward;
+
+	while(cur_folder != common_ancestor)
+	{
+		cur_folder->gatherChildRangeExclusive(last_selected_item_from_cur, NULL, reverse, items_to_select_forward);
+			
+		last_selected_item_from_cur = cur_folder;
+		cur_folder = cur_folder->getParentFolder();
+	}
+
+	std::vector<LLFolderViewItem*> items_to_select_reverse;
+
+	LLFolderViewItem* last_selected_item_from_new = new_selection;
+	cur_folder = new_selection->getParentFolder();
+	while(cur_folder != common_ancestor)
+	{
+		cur_folder->gatherChildRangeExclusive(last_selected_item_from_new, NULL, !reverse, items_to_select_reverse);
+
+		last_selected_item_from_new = cur_folder;
+		cur_folder = cur_folder->getParentFolder();
+	}
+
+	common_ancestor->gatherChildRangeExclusive(last_selected_item_from_cur, last_selected_item_from_new, reverse, items_to_select_forward);
+
+	for (std::vector<LLFolderViewItem*>::reverse_iterator it = items_to_select_reverse.rbegin(), end_it = items_to_select_reverse.rend();
+		it != end_it;
+		++it)
 	{
-		// last selection was not in this folder....go ahead and select just the new item
-		if (selection->changeSelection(selection, TRUE))
+		items_to_select_forward.push_back(*it);
+	}
+
+	LLFolderView* root = getRoot();
+
+	for (std::vector<LLFolderViewItem*>::iterator it = items_to_select_forward.begin(), end_it = items_to_select_forward.end();
+		it != end_it;
+		++it)
+	{
+		LLFolderViewItem* item = *it;
+		if (item->isSelected())
+		{
+			root->removeFromSelectionList(item);
+		}
+		else
 		{
-			selected_items.put(selection);
+			item->selectItem();
 		}
+		root->addToSelectionList(item);
 	}
+
+	if (new_selection->isSelected())
+	{
+		root->removeFromSelectionList(new_selection);
+	}
+	else
+	{
+		new_selection->selectItem();
+	}
+	root->addToSelectionList(new_selection);
 }
 
+
 void LLFolderViewFolder::destroyView()
 {
 	for (items_t::iterator iter = mItems.begin();
@@ -1874,19 +2003,11 @@ void LLFolderViewFolder::extractItem( LLFolderViewItem* item )
 		ft = std::find(mFolders.begin(), mFolders.end(), f);
 		if (ft != mFolders.end())
 		{
-			if ((*ft)->numSelected())
-			{
-				recursiveIncrementNumDescendantsSelected(-(*ft)->numSelected());
-			}
 			mFolders.erase(ft);
 		}
 	}
 	else
 	{
-		if ((*it)->isSelected())
-		{
-			recursiveIncrementNumDescendantsSelected(-1);
-		}
 		mItems.erase(it);
 	}
 	//item has been removed, need to update filter
@@ -2055,11 +2176,6 @@ BOOL LLFolderViewFolder::addItem(LLFolderViewItem* item)
 {
 	mItems.push_back(item);
 	
-	if (item->isSelected())
-	{
-		recursiveIncrementNumDescendantsSelected(1);
-	}
-	
 	item->setRect(LLRect(0, 0, getRect().getWidth(), 0));
 	item->setVisible(FALSE);
 	
@@ -2067,8 +2183,14 @@ BOOL LLFolderViewFolder::addItem(LLFolderViewItem* item)
 	
 	item->dirtyFilter();
 
-	// Update the folder creation date if the child is newer than our current date
-	setCreationDate(llmax<time_t>(mCreationDate, item->getCreationDate()));
+	// Update the folder creation date if the folder has no creation date
+	bool setting_date = false;
+	const time_t item_creation_date = item->getCreationDate();
+	if ((item_creation_date > 0) && (mCreationDate == 0))
+	{
+		setCreationDate(item_creation_date);
+		setting_date = true;
+	}
 
 	// Handle sorting
 	requestArrange();
@@ -2078,8 +2200,11 @@ BOOL LLFolderViewFolder::addItem(LLFolderViewItem* item)
 	LLFolderViewFolder* parentp = getParentFolder();
 	while (parentp)
 	{
-		// Update the folder creation date if the child is newer than our current date
-		parentp->setCreationDate(llmax<time_t>(parentp->mCreationDate, item->getCreationDate()));
+		// Update the parent folder creation date
+		if (setting_date && (parentp->mCreationDate == 0))
+		{
+			parentp->setCreationDate(item_creation_date);
+		}
 
 		if (parentp->mSortFunction.isByDate())
 		{
@@ -2097,10 +2222,6 @@ BOOL LLFolderViewFolder::addItem(LLFolderViewItem* item)
 BOOL LLFolderViewFolder::addFolder(LLFolderViewFolder* folder)
 {
 	mFolders.push_back(folder);
-	if (folder->numSelected())
-	{
-		recursiveIncrementNumDescendantsSelected(folder->numSelected());
-	}
 	folder->setOrigin(0, 0);
 	folder->reshape(getRect().getWidth(), 0);
 	folder->setVisible(FALSE);
@@ -2276,33 +2397,16 @@ BOOL LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask,
 										   EAcceptance* accept,
 										   std::string& tooltip_msg)
 {
-	LLFolderView* root_view = getRoot();
-
 	BOOL handled = FALSE;
-	if(mIsOpen)
+
+	if (mIsOpen)
 	{
-		handled = childrenHandleDragAndDrop(x, y, mask, drop, cargo_type,
-			cargo_data, accept, tooltip_msg) != NULL;
+		handled = (childrenHandleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg) != NULL);
 	}
 
 	if (!handled)
 	{
-		BOOL accepted = mListener && mListener->dragOrDrop(mask, drop,cargo_type,cargo_data, tooltip_msg);
-
-		if (accepted) 
-		{
-			mDragAndDropTarget = TRUE;
-			*accept = ACCEPT_YES_MULTI;
-		}
-		else 
-		{
-			*accept = ACCEPT_NO;
-		}
-
-		if (!drop && accepted)
-		{
-			root_view->autoOpenTest(this);
-		}
+		handleDragAndDropToThisFolder(mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
 
 		lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLFolderViewFolder" << llendl;
 	}
@@ -2310,6 +2414,33 @@ BOOL LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask,
 	return TRUE;
 }
 
+BOOL LLFolderViewFolder::handleDragAndDropToThisFolder(MASK mask,
+													   BOOL drop,
+													   EDragAndDropType cargo_type,
+													   void* cargo_data,
+													   EAcceptance* accept,
+													   std::string& tooltip_msg)
+{
+	BOOL accepted = mListener && mListener->dragOrDrop(mask, drop, cargo_type, cargo_data, tooltip_msg);
+	
+	if (accepted) 
+	{
+		mDragAndDropTarget = TRUE;
+		*accept = ACCEPT_YES_MULTI;
+	}
+	else 
+	{
+		*accept = ACCEPT_NO;
+	}
+	
+	if (!drop && accepted)
+	{
+		getRoot()->autoOpenTest(this);
+	}
+	
+	return TRUE;
+}
+
 
 BOOL LLFolderViewFolder::handleRightMouseDown( S32 x, S32 y, MASK mask )
 {
diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h
index a26515821d4536682b2d3a36c45a0e9b18e22a44..3c7592046a15dc0d589f586af2e573363503e38f 100644
--- a/indra/newview/llfolderviewitem.h
+++ b/indra/newview/llfolderviewitem.h
@@ -114,6 +114,7 @@ class LLFolderViewItem : public LLView
 	static const S32 ICON_PAD = 2;
 	static const S32 ICON_WIDTH = 16;
 	static const S32 TEXT_PAD = 1;
+	static const S32 TEXT_PAD_RIGHT = 4;
 	static const S32 ARROW_SIZE = 12;
 	static const S32 MAX_FOLDER_ITEM_OVERLAP = 2;
 	// animation parameters
@@ -122,6 +123,8 @@ class LLFolderViewItem : public LLView
 
 	// Mostly for debugging printout purposes.
 	const std::string& getSearchableLabel() { return mSearchableLabel; }
+	
+	BOOL isLoading() const { return mIsLoading; }
 
 private:
 	BOOL						mIsSelected;
@@ -164,9 +167,6 @@ class LLFolderViewItem : public LLView
 	// helper function to change the selection from the root.
 	void changeSelectionFromRoot(LLFolderViewItem* selection, BOOL selected);
 
-	// helper function to change the selection from the root.
-	void extendSelectionFromRoot(LLFolderViewItem* selection);
-
 	// this is an internal method used for adding items to folders. A
 	// no-op at this level, but reimplemented in derived classes.
 	virtual BOOL addItem(LLFolderViewItem*) { return FALSE; }
@@ -224,9 +224,6 @@ class LLFolderViewItem : public LLView
 	// Returns TRUE if the selection state of this item was changed.
 	virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected);
 
-	// this method is used to group select items
-	virtual void extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items) { }
-
 	// this method is used to deselect this element
 	void deselectItem();
 
@@ -267,7 +264,7 @@ class LLFolderViewItem : public LLView
 
 	// This method returns the actual name of the thing being
 	// viewed. This method will ask the viewed object itself.
-	std::string getName( void ) const;
+	const std::string& getName( void ) const;
 
 	const std::string& getSearchableLabel( void ) const;
 
@@ -307,7 +304,8 @@ class LLFolderViewItem : public LLView
 	BOOL			isDescendantOf( const LLFolderViewFolder* potential_ancestor );
 	S32				getIndentation() { return mIndentation; }
 
-	virtual BOOL	potentiallyVisible(); // do we know for a fact that this item has been filtered out?
+	virtual BOOL	potentiallyVisible(); // do we know for a fact that this item won't be displayed?
+	virtual BOOL	potentiallyFiltered(); // do we know for a fact that this item has been filtered out?
 
 	virtual BOOL	getFiltered();
 	virtual BOOL	getFiltered(S32 filter_generation);
@@ -373,13 +371,6 @@ class LLFolderViewFolder : public LLFolderViewItem
 	typedef std::list<LLFolderViewItem*> items_t;
 	typedef std::list<LLFolderViewFolder*> folders_t;
 
-private:
-	S32		mNumDescendantsSelected;
-
-public:		// Accessed needed by LLFolderViewItem
-	void recursiveIncrementNumDescendantsSelected(S32 increment);
-	S32 numSelected(void) const { return mNumDescendantsSelected + (isSelected() ? 1 : 0); }
-
 protected:
 	items_t mItems;
 	folders_t mFolders;
@@ -461,7 +452,7 @@ class LLFolderViewFolder : public LLFolderViewItem
 	virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected);
 
 	// this method is used to group select items
-	virtual void extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items);
+	void extendSelectionTo(LLFolderViewItem* selection);
 
 	// Returns true is this object and all of its children can be removed.
 	virtual BOOL isRemovable();
@@ -547,11 +538,15 @@ class LLFolderViewFolder : public LLFolderViewItem
 		void* cargo_data,
 		EAcceptance* accept,
 		std::string& tooltip_msg);
+	BOOL handleDragAndDropToThisFolder(MASK mask, BOOL drop,
+									   EDragAndDropType cargo_type,
+									   void* cargo_data,
+									   EAcceptance* accept,
+									   std::string& tooltip_msg);
 	virtual void draw();
 
 	time_t getCreationDate() const;
 	bool isTrash() const;
-	S32 getNumSelectedDescendants(void) const { return mNumDescendantsSelected; }
 
 	folders_t::const_iterator getFoldersBegin() const { return mFolders.begin(); }
 	folders_t::const_iterator getFoldersEnd() const { return mFolders.end(); }
@@ -560,6 +555,8 @@ class LLFolderViewFolder : public LLFolderViewItem
 	items_t::const_iterator getItemsBegin() const { return mItems.begin(); }
 	items_t::const_iterator getItemsEnd() const { return mItems.end(); }
 	items_t::size_type getItemsCount() const { return mItems.size(); }
+	LLFolderViewFolder* getCommonAncestor(LLFolderViewItem* item_a, LLFolderViewItem* item_b, bool& reverse);
+	void gatherChildRangeExclusive(LLFolderViewItem* start, LLFolderViewItem* end, bool reverse,  std::vector<LLFolderViewItem*>& items);
 };
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp
index 2b9c113a72aac742b346230709be2f161235de69..1208c9378e9024f84582c879eed315a5b7f1c597 100644
--- a/indra/newview/llglsandbox.cpp
+++ b/indra/newview/llglsandbox.cpp
@@ -115,7 +115,7 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)
 	S32 center_y = (top + bottom) / 2;
 
 	// save drawing mode
-	glMatrixMode(GL_PROJECTION);
+	gGL.matrixMode(LLRender::MM_PROJECTION);
 	gGL.pushMatrix();
 
 	BOOL limit_select_distance = gSavedSettings.getBOOL("LimitSelectDistance");
@@ -230,9 +230,9 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)
 	}
 
 	// restore drawing mode
-	glMatrixMode(GL_PROJECTION);
+	gGL.matrixMode(LLRender::MM_PROJECTION);
 	gGL.popMatrix();
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 
 	// restore camera
 	LLViewerCamera::getInstance()->setFar(old_far_plane);
@@ -777,13 +777,17 @@ void LLViewerObjectList::renderObjectBeacons()
 
 	LLGLSUIDefault gls_ui;
 
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		gUIProgram.bind();
+	}
+
 	{
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 
 		S32 last_line_width = -1;
 		// gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width)
 		
-		BOOL flush = FALSE;
 		for (std::vector<LLDebugBeacon>::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter)
 		{
 			const LLDebugBeacon &debug_beacon = *iter;
@@ -792,18 +796,14 @@ void LLViewerObjectList::renderObjectBeacons()
 			S32 line_width = debug_beacon.mLineWidth;
 			if (line_width != last_line_width)
 			{
-				if (flush)
-				{
-					gGL.end();
-				}
-				flush = TRUE;
 				gGL.flush();
 				glLineWidth( (F32)line_width );
 				last_line_width = line_width;
-				gGL.begin(LLRender::LINES);
 			}
 
 			const LLVector3 &thisline = debug_beacon.mPositionAgent;
+		
+			gGL.begin(LLRender::LINES);
 			gGL.color4fv(color.mV);
 			gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] - 50.f);
 			gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] + 50.f);
@@ -813,8 +813,9 @@ void LLViewerObjectList::renderObjectBeacons()
 			gGL.vertex3f(thisline.mV[VX],thisline.mV[VY] + 2.f,thisline.mV[VZ]);
 
 			draw_line_cube(0.10f, thisline);
+			
+			gGL.end();
 		}
-		gGL.end();
 	}
 
 	{
@@ -824,7 +825,6 @@ void LLViewerObjectList::renderObjectBeacons()
 		S32 last_line_width = -1;
 		// gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width)
 		
-		BOOL flush = FALSE;
 		for (std::vector<LLDebugBeacon>::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter)
 		{
 			const LLDebugBeacon &debug_beacon = *iter;
@@ -832,18 +832,13 @@ void LLViewerObjectList::renderObjectBeacons()
 			S32 line_width = debug_beacon.mLineWidth;
 			if (line_width != last_line_width)
 			{
-				if (flush)
-				{
-					gGL.end();
-				}
-				flush = TRUE;
 				gGL.flush();
 				glLineWidth( (F32)line_width );
 				last_line_width = line_width;
-				gGL.begin(LLRender::LINES);
 			}
 
 			const LLVector3 &thisline = debug_beacon.mPositionAgent;
+			gGL.begin(LLRender::LINES);
 			gGL.color4fv(debug_beacon.mColor.mV);
 			gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] - 0.5f);
 			gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] + 0.5f);
@@ -853,9 +848,10 @@ void LLViewerObjectList::renderObjectBeacons()
 			gGL.vertex3f(thisline.mV[VX],thisline.mV[VY] + 0.5f,thisline.mV[VZ]);
 
 			draw_line_cube(0.10f, thisline);
+
+			gGL.end();
 		}
 		
-		gGL.end();
 		gGL.flush();
 		glLineWidth(1.f);
 
diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp
index f7ed1116cbd38c05ca55c59971812d1b08ee62f7..129cddda455f404f18b2f821560dee2ecace2384 100644
--- a/indra/newview/llgrouplist.cpp
+++ b/indra/newview/llgrouplist.cpp
@@ -95,7 +95,7 @@ LLGroupList::LLGroupList(const Params& p)
 LLGroupList::~LLGroupList()
 {
 	gAgent.removeListener(this);
-	delete mContextMenuHandle.get();
+	if (mContextMenuHandle.get()) mContextMenuHandle.get()->die();
 }
 
 // virtual
@@ -123,6 +123,22 @@ BOOL LLGroupList::handleRightMouseDown(S32 x, S32 y, MASK mask)
 	return handled;
 }
 
+// virtual
+BOOL LLGroupList::handleDoubleClick(S32 x, S32 y, MASK mask)
+{
+	BOOL handled = LLView::handleDoubleClick(x, y, mask);
+	// Handle double click only for the selected item in the list, skip clicks on empty space.
+	if (handled)
+	{
+		if (mDoubleClickSignal)
+		{
+			(*mDoubleClickSignal)(this, x, y, mask);
+		}
+	}
+
+	return handled;
+}
+
 void LLGroupList::setNameFilter(const std::string& filter)
 {
 	std::string filter_upper = filter;
diff --git a/indra/newview/llgrouplist.h b/indra/newview/llgrouplist.h
index d7051db891c9f83f09d3fe97fbf62ce212b9b468..8abf14b3d031542fdd75f7d5dd55241fcc9593da 100644
--- a/indra/newview/llgrouplist.h
+++ b/indra/newview/llgrouplist.h
@@ -51,6 +51,7 @@ class LLGroupList: public LLFlatListViewEx, public LLOldEvents::LLSimpleListener
 
 	virtual void draw(); // from LLView
 	/*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); // from LLView
+	/*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); // from LLView
 
 	void setNameFilter(const std::string& filter);
 	void toggleIcons();
diff --git a/indra/newview/llhudeffectbeam.cpp b/indra/newview/llhudeffectbeam.cpp
index 37b7b2e75dc6abe3b0139c1ed17f7878a0b7ded9..8abad3d292f41dd9d3f6e5967a0c3d369ba3b7e6 100644
--- a/indra/newview/llhudeffectbeam.cpp
+++ b/indra/newview/llhudeffectbeam.cpp
@@ -295,13 +295,13 @@ void LLHUDEffectBeam::render()
 		F32 alpha = mFadeInterp.getCurVal()*mColor.mV[3];
 		alpha *= mInterpFade[i].getCurVal();
 		coloru.mV[3] = (U8)alpha;
-		glColor4ubv(coloru.mV);
+		gGL.color4ubv(coloru.mV);
 
-		glPushMatrix();
-		glTranslatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
-		glScalef(scale, scale, scale);
-		gSphere.render(0);
-		glPopMatrix();
+		gGL.pushMatrix();
+		gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
+		gGL.scalef(scale, scale, scale);
+		gSphere.render();
+		gGL.popMatrix();
 	}
 }
 
diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp
index b380b3fe2020abe4edb2ae026099ee31a06d05e6..bc3b220dc098d9183782f865469c1e78251e6db0 100644
--- a/indra/newview/llhudeffectlookat.cpp
+++ b/indra/newview/llhudeffectlookat.cpp
@@ -498,10 +498,10 @@ void LLHUDEffectLookAt::render()
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 
 		LLVector3 target = mTargetPos + ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->mHeadp->getWorldPosition();
-		glMatrixMode(GL_MODELVIEW);
+		gGL.matrixMode(LLRender::MM_MODELVIEW);
 		gGL.pushMatrix();
 		gGL.translatef(target.mV[VX], target.mV[VY], target.mV[VZ]);
-		glScalef(0.3f, 0.3f, 0.3f);
+		gGL.scalef(0.3f, 0.3f, 0.3f);
 		gGL.begin(LLRender::LINES);
 		{
 			LLColor3 color = (*mAttentions)[mTargetType].mColor;
diff --git a/indra/newview/llhudeffectpointat.cpp b/indra/newview/llhudeffectpointat.cpp
index 28fe8e1c015f4dee42efc991e007c7e454f39528..114a633821c93b9867061769aa33d36166ccff1f 100644
--- a/indra/newview/llhudeffectpointat.cpp
+++ b/indra/newview/llhudeffectpointat.cpp
@@ -327,7 +327,7 @@ void LLHUDEffectPointAt::render()
 		LLVector3 target = mTargetPos + mSourceObject->getRenderPosition();
 		gGL.pushMatrix();
 		gGL.translatef(target.mV[VX], target.mV[VY], target.mV[VZ]);
-		glScalef(0.3f, 0.3f, 0.3f);
+		gGL.scalef(0.3f, 0.3f, 0.3f);
 		gGL.begin(LLRender::LINES);
 		{
 			gGL.color3f(1.f, 0.f, 0.f);
diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp
index 1156e764a17a548beab38508f6d446755c791673..dff310ecf930bfda15c71964e73dbfe35a606f9e 100644
--- a/indra/newview/llhudrender.cpp
+++ b/indra/newview/llhudrender.cpp
@@ -107,14 +107,24 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
 	viewport[1] = world_view_rect.mBottom;
 	viewport[2] = world_view_rect.getWidth();
 	viewport[3] = world_view_rect.getHeight();
+
+	F64 mdlv[16];
+	F64 proj[16];
+
+	for (U32 i = 0; i < 16; i++)
+	{
+		mdlv[i] = (F64) gGLModelView[i];
+		proj[i] = (F64) gGLProjection[i];
+	}
+
 	gluProject(render_pos.mV[0], render_pos.mV[1], render_pos.mV[2],
-				gGLModelView, gGLProjection, (GLint*) viewport,
+				mdlv, proj, (GLint*) viewport,
 				&winX, &winY, &winZ);
 		
 	//fonts all render orthographically, set up projection``
-	glMatrixMode(GL_PROJECTION);
-	glPushMatrix();
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.pushMatrix();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.pushMatrix();
 	LLUI::pushMatrix();
 		
@@ -124,16 +134,16 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
 	winX -= world_view_rect.mLeft;
 	winY -= world_view_rect.mBottom;
 	LLUI::loadIdentity();
-	glLoadIdentity();
+	gGL.loadIdentity();
 	LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f));
 	F32 right_x;
 	
-	font.render(wstr, 0, 0, 0, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, wstr.length(), 1000, &right_x);
+	font.render(wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, wstr.length(), 1000, &right_x);
 
 	LLUI::popMatrix();
 	gGL.popMatrix();
 
-	glMatrixMode(GL_PROJECTION);
-	glPopMatrix();
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.popMatrix();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 }
diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp
index 24a876c59adde175e9c7d612f29415e26584aee2..579b6008ae85ad769e63b2bccba042383b3fc8f0 100644
--- a/indra/newview/llhudtext.cpp
+++ b/indra/newview/llhudtext.cpp
@@ -227,7 +227,7 @@ void LLHUDText::renderText()
 			 segment_iter != mTextSegments.end(); ++segment_iter )
 		{
 			const LLFontGL* fontp = segment_iter->mFont;
-			y_offset -= fontp->getLineHeight();
+			y_offset -= fontp->getLineHeight() - 1; // correction factor to match legacy font metrics
 
 			U8 style = segment_iter->mStyle;
 			LLFontGL::ShadowType shadow = LLFontGL::DROP_SHADOW;
@@ -480,8 +480,6 @@ void LLHUDText::updateSize()
 	F32 width = 0.f;
 
 	S32 max_lines = getMaxLines();
-	//S32 lines = (max_lines < 0) ? (S32)mTextSegments.size() : llmin((S32)mTextSegments.size(), max_lines);
-	//F32 height = (F32)mFontp->getLineHeight() * (lines + mLabelSegments.size());
 
 	S32 start_segment;
 	if (max_lines < 0) start_segment = 0;
@@ -491,7 +489,7 @@ void LLHUDText::updateSize()
 	while (iter != mTextSegments.end())
 	{
 		const LLFontGL* fontp = iter->mFont;
-		height += fontp->getLineHeight();
+		height += fontp->getLineHeight() - 1; // correction factor to match legacy font metrics
 		width = llmax(width, llmin(iter->getWidth(fontp), HUD_TEXT_MAX_WIDTH));
 		++iter;
 	}
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index f5cda52d444e2f8f2741357a558eb4923da9d864..f67464078b20d085aa6331608f69d1af2a8d6f32 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -234,12 +234,6 @@ LLIMFloater::~LLIMFloater()
 //virtual
 BOOL LLIMFloater::postBuild()
 {
-	// User-resizable control panels in P2P sessions look ugly (EXT-3470).
-	if (mDialog == IM_NOTHING_SPECIAL || mDialog == IM_SESSION_P2P_INVITE)
-	{
-		getChild<LLLayoutStack>("im_panels")->setPanelUserResize("panel_im_control_panel", FALSE);
-	}
-
 	const LLUUID& other_party_id = LLIMModel::getInstance()->getOtherParticipantID(mSessionID);
 	if (other_party_id.notNull())
 	{
@@ -385,9 +379,6 @@ void LLIMFloater::onSlide()
 
 	getChild<LLButton>("slide_left_btn")->setVisible(mControlPanel->getParent()->getVisible());
 	getChild<LLButton>("slide_right_btn")->setVisible(!mControlPanel->getParent()->getVisible());
-
-	LLLayoutStack* stack = getChild<LLLayoutStack>("im_panels");
-	if (stack) stack->setAnimate(true);
 }
 
 //static
diff --git a/indra/newview/llimhandler.cpp b/indra/newview/llimhandler.cpp
index cd71da73935742a5cce912dd279d4ee95e96613e..07d73c8c66f3f943f6a51b9d4aba99ae48d686a1 100644
--- a/indra/newview/llimhandler.cpp
+++ b/indra/newview/llimhandler.cpp
@@ -42,7 +42,7 @@ LLIMHandler::LLIMHandler(e_notification_type type, const LLSD& id)
 	mType = type;
 
 	// Getting a Channel for our notifications
-	mChannel = LLChannelManager::getInstance()->createNotificationChannel();
+	mChannel = LLChannelManager::getInstance()->createNotificationChannel()->getHandle();
 }
 
 //--------------------------------------------------------------------------
@@ -55,13 +55,13 @@ void LLIMHandler::initChannel()
 {
 	S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); 
 	S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
-	mChannel->init(channel_right_bound - channel_width, channel_right_bound);
+	mChannel.get()->init(channel_right_bound - channel_width, channel_right_bound);
 }
 
 //--------------------------------------------------------------------------
 bool LLIMHandler::processNotification(const LLSD& notify)
 {
-	if(!mChannel)
+	if(mChannel.isDead())
 	{
 		return false;
 	}
@@ -72,7 +72,7 @@ bool LLIMHandler::processNotification(const LLSD& notify)
 		return false;
 
 	// arrange a channel on a screen
-	if(!mChannel->getVisible())
+	if(!mChannel.get()->getVisible())
 	{
 		initChannel();
 	}
@@ -104,7 +104,7 @@ bool LLIMHandler::processNotification(const LLSD& notify)
 		p.panel = im_box;
 		p.can_be_stored = false;
 		p.on_delete_toast = boost::bind(&LLIMHandler::onDeleteToast, this, _1);
-		LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+		LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
 		if(channel)
 			channel->addToast(p);
 
@@ -113,7 +113,7 @@ bool LLIMHandler::processNotification(const LLSD& notify)
 	}
 	else if (notify["sigtype"].asString() == "delete")
 	{
-		mChannel->killToastByNotificationID(notification->getID());
+		mChannel.get()->killToastByNotificationID(notification->getID());
 	}
 	return false;
 }
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index ed4bb727cd77043c0baebad5c881c37614df6420..a7c4618fa4ecea10b3a95cc129c2ac66f9624eaf 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -171,8 +171,8 @@ void LLIMModel::setActiveSessionID(const LLUUID& session_id)
 
 LLIMModel::LLIMModel() 
 {
-	addNewMsgCallback(LLIMFloater::newIMCallback);
-	addNewMsgCallback(toast_callback);
+	addNewMsgCallback(boost::bind(&LLIMFloater::newIMCallback, _1));
+	addNewMsgCallback(boost::bind(&toast_callback, _1));
 }
 
 LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice)
@@ -2403,15 +2403,6 @@ void LLIMMgr::addMessage(
 	bool link_name) // If this is true, then we insert the name and link it to a profile
 {
 	LLUUID other_participant_id = target_id;
-
-	// don't process muted IMs
-	if (LLMuteList::getInstance()->isMuted(
-			other_participant_id,
-			LLMute::flagTextChat) && !LLMuteList::getInstance()->isLinden(from))
-	{
-		return;
-	}
-
 	LLUUID new_session_id = session_id;
 	if (new_session_id.isNull())
 	{
@@ -2452,10 +2443,28 @@ void LLIMMgr::addMessage(
 			LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, bonus_info.str());
 		}
 
+		// Logically it would make more sense to reject the session sooner, in another area of the
+		// code, but the session has to be established inside the server before it can be left.
+		if (LLMuteList::getInstance()->isMuted(other_participant_id) && !LLMuteList::getInstance()->isLinden(from))
+		{
+			llwarns << "Leaving IM session from initiating muted resident " << from << llendl;
+			if(!gIMMgr->leaveSession(new_session_id))
+			{
+				llinfos << "Session " << new_session_id << " does not exist." << llendl;
+			}
+			return;
+		}
+
 		make_ui_sound("UISndNewIncomingIMSession");
 	}
 
-	LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, msg);
+	bool skip_message = (gSavedSettings.getBOOL("VoiceCallsFriendsOnly") &&
+		LLAvatarTracker::instance().getBuddyInfo(other_participant_id) == NULL);
+
+	if (!LLMuteList::getInstance()->isMuted(other_participant_id, LLMute::flagTextChat) && !skip_message)
+	{
+		LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, msg);
+	}
 }
 
 void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& message_name, const LLSD& args)
@@ -2661,18 +2670,15 @@ void LLIMMgr::inviteToSession(
 	const std::string& session_handle,
 	const std::string& session_uri)
 {
-	//ignore invites from muted residents
-	if (LLMuteList::getInstance()->isMuted(caller_id))
-	{
-		return;
-	}
-
 	std::string notify_box_type;
 	// voice invite question is different from default only for group call (EXT-7118)
 	std::string question_type = "VoiceInviteQuestionDefault";
 
 	BOOL ad_hoc_invite = FALSE;
 	BOOL voice_invite = FALSE;
+	bool is_linden = LLMuteList::getInstance()->isLinden(caller_name);
+
+
 	if(type == IM_SESSION_P2P_INVITE)
 	{
 		//P2P is different...they only have voice invitations
@@ -2711,7 +2717,18 @@ void LLIMMgr::inviteToSession(
 	payload["session_uri"] = session_uri;
 	payload["notify_box_type"] = notify_box_type;
 	payload["question_type"] = question_type;
-	
+
+	//ignore invites from muted residents
+	if (LLMuteList::getInstance()->isMuted(caller_id) && !is_linden)
+	{
+		if (voice_invite && "VoiceInviteQuestionDefault" == question_type)
+		{
+			llinfos << "Rejecting voice call from initiating muted resident " << caller_name << llendl;
+			LLIncomingCallDialog::processCallResponse(1, payload);
+		}
+		return;
+	}
+
 	LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(session_id);
 	if (channelp && channelp->callStarted())
 	{
@@ -2963,6 +2980,17 @@ bool LLIMMgr::isVoiceCall(const LLUUID& session_id)
 	return im_session->mStartedAsIMCall;
 }
 
+void LLIMMgr::addNotifiedNonFriendSessionID(const LLUUID& session_id)
+{
+	mNotifiedNonFriendSessions.insert(session_id);
+}
+
+bool LLIMMgr::isNonFriendSessionNotified(const LLUUID& session_id)
+{
+	return mNotifiedNonFriendSessions.end() != mNotifiedNonFriendSessions.find(session_id);
+
+}
+
 void LLIMMgr::noteOfflineUsers(
 	const LLUUID& session_id,
 	const LLDynamicArray<LLUUID>& ids)
@@ -3234,7 +3262,7 @@ class LLViewerChatterBoxInvitation : public LLHTTPNode
 			chat.mFromID = from_id;
 			chat.mFromName = name;
 
-			if (!is_linden && (is_busy || is_muted))
+			if (!is_linden && is_busy)
 			{
 				return;
 			}
@@ -3266,6 +3294,11 @@ class LLViewerChatterBoxInvitation : public LLHTTPNode
 				ll_vector3_from_sd(message_params["position"]),
 				true);
 
+			if (LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat))
+			{
+				return;
+			}
+
 			//K now we want to accept the invitation
 			std::string url = gAgent.getRegion()->getCapability(
 				"ChatSessionRequest");
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index b1be26a169ee962e80701cfed82cec74e1dd1e8e..7c2cd03d9704f69c216c991c56620877ea868dae 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -153,7 +153,6 @@ class LLIMModel :  public LLSingleton<LLIMModel>
 	std::map<LLUUID, LLIMSession*> mId2SessionMap;
 
 	typedef boost::signals2::signal<void(const LLSD&)> session_signal_t;
-	typedef boost::function<void(const LLSD&)> session_callback_t;
 	session_signal_t mNewMsgSignal;
 	session_signal_t mNoUnreadMsgsSignal;
 	
@@ -174,8 +173,8 @@ class LLIMModel :  public LLSingleton<LLIMModel>
 	 */
 	void processSessionInitializedReply(const LLUUID& old_session_id, const LLUUID& new_session_id);
 
-	boost::signals2::connection addNewMsgCallback( session_callback_t cb ) { return mNewMsgSignal.connect(cb); }
-	boost::signals2::connection addNoUnreadMsgsCallback( session_callback_t cb ) { return mNoUnreadMsgsSignal.connect(cb); }
+	boost::signals2::connection addNewMsgCallback(const session_signal_t::slot_type& cb ) { return mNewMsgSignal.connect(cb); }
+	boost::signals2::connection addNoUnreadMsgsCallback(const session_signal_t::slot_type& cb ) { return mNoUnreadMsgsSignal.connect(cb); }
 
 	/**
 	 * Create new session object in a model
@@ -438,6 +437,10 @@ class LLIMMgr : public LLSingleton<LLIMMgr>
 
 	bool isVoiceCall(const LLUUID& session_id);
 
+	void addNotifiedNonFriendSessionID(const LLUUID& session_id);
+
+	bool isNonFriendSessionNotified(const LLUUID& session_id);
+
 private:
 
 	/**
@@ -465,6 +468,14 @@ class LLIMMgr : public LLSingleton<LLIMMgr>
 	typedef std::list <LLIMSessionObserver *> session_observers_list_t;
 	session_observers_list_t mSessionObservers;
 
+	// EXP-901
+	// If "Only friends and groups can IM me" option is ON but the user got message from non-friend,
+	// the user should be notified that to be able to see this message the option should be OFF.
+	// This set stores session IDs in which user was notified. Need to store this IDs so that the user
+	// be notified only one time per session with non-friend.
+	typedef std::set<LLUUID> notified_non_friend_sessions_t;
+	notified_non_friend_sessions_t mNotifiedNonFriendSessions;
+
 	LLSD mPendingInvitations;
 	LLSD mPendingAgentListUpdates;
 };
diff --git a/indra/newview/llinspectremoteobject.cpp b/indra/newview/llinspectremoteobject.cpp
index bf6cf5229803ce02c32823e64e02e731dde3512a..a12ec390af477035e79523785c88b3b511d1ad58 100644
--- a/indra/newview/llinspectremoteobject.cpp
+++ b/indra/newview/llinspectremoteobject.cpp
@@ -60,12 +60,10 @@ class LLInspectRemoteObject : public LLInspect
 	
 private:
 	void update();
-	void onNameCache(const LLUUID& id, const std::string& name, bool is_group);
 	
 private:
 	LLUUID		 mObjectID;
 	LLUUID		 mOwnerID;
-	std::string  mOwnerLegacyName;
 	std::string  mSLurl;
 	std::string  mName;
 	bool         mGroupOwned;
@@ -75,7 +73,6 @@ LLInspectRemoteObject::LLInspectRemoteObject(const LLSD& sd) :
 	LLInspect(LLSD()),
 	mObjectID(NULL),
 	mOwnerID(NULL),
-	mOwnerLegacyName(),
 	mSLurl(""),
 	mName(""),
 	mGroupOwned(false)
@@ -111,14 +108,6 @@ void LLInspectRemoteObject::onOpen(const LLSD& data)
 	mGroupOwned = data["group_owned"].asBoolean();
 	mSLurl      = data["slurl"].asString();
 
-	// work out the owner's name
-	mOwnerLegacyName = "";
-	if (gCacheName)
-	{
-		gCacheName->get(mOwnerID, mGroupOwned,  // muting
-			boost::bind(&LLInspectRemoteObject::onNameCache, this, _1, _2, _3));
-	}
-
 	// update the inspector with the current object state
 	update();
 
@@ -144,8 +133,7 @@ void LLInspectRemoteObject::onClickMap()
 
 void LLInspectRemoteObject::onClickBlock()
 {
-	LLMute::EType mute_type = mGroupOwned ? LLMute::GROUP : LLMute::AGENT;
-	LLMute mute(mOwnerID, mOwnerLegacyName, mute_type);
+	LLMute mute(mObjectID, mName, LLMute::OBJECT);
 	LLMuteList::getInstance()->add(mute);
 	LLPanelBlockedList::showPanelAndSelect(mute.mID);
 	closeFloater();
@@ -156,12 +144,6 @@ void LLInspectRemoteObject::onClickClose()
 	closeFloater();
 }
 
-void LLInspectRemoteObject::onNameCache(const LLUUID& id, const std::string& name, bool is_group)
-{
-	mOwnerLegacyName = name;
-	update();
-}
-
 void LLInspectRemoteObject::update()
 {
 	// show the object name as the inspector's title
@@ -198,8 +180,8 @@ void LLInspectRemoteObject::update()
 	// disable the Map button if we don't have a SLurl
 	getChild<LLUICtrl>("map_btn")->setEnabled(! mSLurl.empty());
 
-	// disable the Block button if we don't have the owner ID
-	getChild<LLUICtrl>("block_btn")->setEnabled(! mOwnerID.isNull());
+	// disable the Block button if we don't have the object ID (will this ever happen?)
+	getChild<LLUICtrl>("block_btn")->setEnabled(! mObjectID.isNull());
 }
 
 //////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llinspecttoast.cpp b/indra/newview/llinspecttoast.cpp
index d7b82667d17732dacbfa5a7e6521c011f4f8af3f..f4fe5dec01437692ba104e5fc0855e32e455944a 100644
--- a/indra/newview/llinspecttoast.cpp
+++ b/indra/newview/llinspecttoast.cpp
@@ -72,6 +72,8 @@ LLInspectToast::LLInspectToast(const LLSD& notification_id) :
 LLInspectToast::~LLInspectToast()
 {
 	LLTransientFloaterMgr::getInstance()->removeControlView(this);
+
+	mConnection.disconnect();
 }
 
 // virtual
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 0c092e9a561fd7526f20046fbc66e4d9711a01ef..b86c453d617693bced1035bd28af8d9a3c0654ce 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -47,12 +47,13 @@
 #include "llgiveinventory.h" 
 #include "llimfloater.h"
 #include "llimview.h"
-#include "llinventoryclipboard.h"
+#include "llclipboard.h"
 #include "llinventorydefines.h"
 #include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
 #include "llinventorymodelbackgroundfetch.h"
 #include "llinventorypanel.h"
+#include "llmarketplacefunctions.h"
 #include "llnotifications.h"
 #include "llnotificationsutil.h"
 #include "llpreviewanim.h"
@@ -60,6 +61,7 @@
 #include "llpreviewtexture.h"
 #include "llselectmgr.h"
 #include "llsidepanelappearance.h"
+#include "lltooldraganddrop.h"
 #include "lltrans.h"
 #include "llviewerassettype.h"
 #include "llviewerfoldertype.h"
@@ -71,7 +73,9 @@
 #include "llwearablelist.h"
 
 // Marketplace outbox current disabled
-#define ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU	0	// keep in sync with ENABLE_INVENTORY_DISPLAY_OUTBOX, ENABLE_MERCHANT_OUTBOX_PANEL
+#define ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU	1
+#define ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU 0
+#define BLOCK_WORN_ITEMS_IN_OUTBOX 1
 
 typedef std::pair<LLUUID, LLUUID> two_uuids_t;
 typedef std::list<two_uuids_t> two_uuids_list_t;
@@ -109,6 +113,13 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response
 bool confirm_attachment_rez(const LLSD& notification, const LLSD& response);
 void teleport_via_landmark(const LLUUID& asset_id);
 static BOOL can_move_to_outfit(LLInventoryItem* inv_item, BOOL move_is_into_current_outfit);
+static bool check_category(LLInventoryModel* model,
+						   const LLUUID& cat_id,
+						   LLFolderView* active_folder_view,
+						   LLInventoryFilter* filter);
+static bool check_item(const LLUUID& item_id,
+					   LLFolderView* active_folder_view,
+					   LLInventoryFilter* filter);
 
 // Helper functions
 
@@ -127,6 +138,47 @@ bool isMarketplaceCopyAction(const std::string& action)
 	return (("copy_to_outbox" == action) || ("move_to_outbox" == action));
 }
 
+bool isMarketplaceSendAction(const std::string& action)
+{
+	return ("send_to_marketplace" == action);
+}
+
+// Used by LLFolderBridge as callback for directory fetching recursion
+class LLRightClickInventoryFetchDescendentsObserver : public LLInventoryFetchDescendentsObserver
+{
+public:
+	LLRightClickInventoryFetchDescendentsObserver(const uuid_vec_t& ids) : LLInventoryFetchDescendentsObserver(ids) {}
+	~LLRightClickInventoryFetchDescendentsObserver() {}
+	virtual void execute(bool clear_observer = false);
+	virtual void done()
+	{
+		execute(true);
+	}
+};
+
+// Used by LLFolderBridge as callback for directory content items fetching
+class LLRightClickInventoryFetchObserver : public LLInventoryFetchItemsObserver
+{
+public:
+	LLRightClickInventoryFetchObserver(const uuid_vec_t& ids) : LLInventoryFetchItemsObserver(ids) { };
+	~LLRightClickInventoryFetchObserver() {}
+	void execute(bool clear_observer = false)
+	{
+		if (clear_observer)
+		{
+			dec_busy_count();
+			gInventory.removeObserver(this);
+			delete this;
+		}
+		// we've downloaded all the items, so repaint the dialog
+		LLFolderBridge::staticFolderOptionsMenu();
+	}
+	virtual void done()
+	{
+		execute(true);
+	}
+};
+
 // +=================================================+
 // |        LLInvFVBridge                            |
 // +=================================================+
@@ -139,7 +191,7 @@ LLInvFVBridge::LLInvFVBridge(LLInventoryPanel* inventory,
 	mInvType(LLInventoryType::IT_NONE),
 	mIsLink(FALSE)
 {
-	mInventoryPanel = inventory->getHandle();
+	mInventoryPanel = inventory->getInventoryPanelHandle();
 	const LLInventoryObject* obj = getInventoryObject();
 	mIsLink = obj && obj->getIsLinkType();
 }
@@ -199,13 +251,27 @@ BOOL LLInvFVBridge::isLink() const
 /**
  * @brief Adds this item into clipboard storage
  */
-void LLInvFVBridge::cutToClipboard()
+BOOL LLInvFVBridge::cutToClipboard() const
+{
+	const LLInventoryObject* obj = gInventory.getObject(mUUID);
+	if (obj && isItemMovable() && isItemRemovable())
+	{
+		LLClipboard::instance().setCutMode(true);
+		return LLClipboard::instance().addToClipboard(mUUID);
+	}
+	return FALSE;
+}
+
+BOOL LLInvFVBridge::copyToClipboard() const
 {
-	if(isItemMovable())
+	const LLInventoryObject* obj = gInventory.getObject(mUUID);
+	if (obj && isItemCopyable())
 	{
-		LLInventoryClipboard::instance().cut(mUUID);
+		return LLClipboard::instance().addToClipboard(mUUID);
 	}
+	return FALSE;
 }
+
 // *TODO: make sure this does the right thing
 void LLInvFVBridge::showProperties()
 {
@@ -380,6 +446,11 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*
 	for(; it != end; ++it)
 	{
 		gInventory.moveObject((*it), trash_id);
+		LLViewerInventoryItem* item = gInventory.getItem(*it);
+		if (item)
+		{
+			model->updateItem(item);
+		}
 	}
 
 	// notify inventory observers.
@@ -388,7 +459,8 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*
 
 BOOL LLInvFVBridge::isClipboardPasteable() const
 {
-	if (!LLInventoryClipboard::instance().hasContents() || !isAgentInventory())
+	// Return FALSE on degenerated cases: empty clipboard, no inventory, no agent
+	if (!LLClipboard::instance().hasContents() || !isAgentInventory())
 	{
 		return FALSE;
 	}
@@ -398,37 +470,42 @@ BOOL LLInvFVBridge::isClipboardPasteable() const
 		return FALSE;
 	}
 
-	const LLUUID &agent_id = gAgent.getID();
+	// In cut mode, whatever is on the clipboard is always pastable
+	if (LLClipboard::instance().isCutMode())
+	{
+		return TRUE;
+	}
 
+	// In normal mode, we need to check each element of the clipboard to know if we can paste or not
 	LLDynamicArray<LLUUID> objects;
-	LLInventoryClipboard::instance().retrieve(objects);
+	LLClipboard::instance().pasteFromClipboard(objects);
 	S32 count = objects.count();
 	for(S32 i = 0; i < count; i++)
 	{
 		const LLUUID &item_id = objects.get(i);
 
-		// Can't paste folders
+		// Folders are pastable if all items in there are copyable
 		const LLInventoryCategory *cat = model->getCategory(item_id);
 		if (cat)
 		{
+			LLFolderBridge cat_br(mInventoryPanel.get(), mRoot, item_id);
+			if (!cat_br.isItemCopyable())
 			return FALSE;
+			// Skip to the next item in the clipboard
+			continue;
 		}
 
-		const LLInventoryItem *item = model->getItem(item_id);
-		if (item)
-		{
-			if (!item->getPermissions().allowCopyBy(agent_id))
-			{
+		// Each item must be copyable to be pastable
+		LLItemBridge item_br(mInventoryPanel.get(), mRoot, item_id);
+		if (!item_br.isItemCopyable())
 				return FALSE;
 			}
-		}
-	}
 	return TRUE;
 }
 
 BOOL LLInvFVBridge::isClipboardPasteableAsLink() const
 {
-	if (!LLInventoryClipboard::instance().hasContents() || !isAgentInventory())
+	if (!LLClipboard::instance().hasContents() || !isAgentInventory())
 	{
 		return FALSE;
 	}
@@ -439,7 +516,7 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const
 	}
 
 	LLDynamicArray<LLUUID> objects;
-	LLInventoryClipboard::instance().retrieve(objects);
+	LLClipboard::instance().pasteFromClipboard(objects);
 	S32 count = objects.count();
 	for(S32 i = 0; i < count; i++)
 	{
@@ -462,14 +539,13 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const
 
 void hide_context_entries(LLMenuGL& menu, 
 						  const menuentry_vec_t &entries_to_show,
-						  const menuentry_vec_t &disabled_entries,
-						  BOOL append) // If append is TRUE, then new enabled entries 
+						  const menuentry_vec_t &disabled_entries)
 {
 	const LLView::child_list_t *list = menu.getChildList();
 
 	// For removing double separators or leading separator.  Start at true so that
 	// if the first element is a separator, it will not be shown.
-	BOOL is_previous_entry_separator = TRUE;
+	bool is_previous_entry_separator = true;
 
 	for (LLView::child_list_t::const_iterator itor = list->begin(); 
 		 itor != list->end(); 
@@ -485,7 +561,6 @@ void hide_context_entries(LLMenuGL& menu,
 			hide_context_entries(*branchp->getBranch(), entries_to_show, disabled_entries);
 		}
 
-
 		bool found = false;
 		menuentry_vec_t::const_iterator itor2;
 		for (itor2 = entries_to_show.begin(); itor2 != entries_to_show.end(); ++itor2)
@@ -493,6 +568,7 @@ void hide_context_entries(LLMenuGL& menu,
 			if (*itor2 == name)
 			{
 				found = true;
+				break;
 			}
 		}
 
@@ -500,9 +576,8 @@ void hide_context_entries(LLMenuGL& menu,
 		// between two separators).
 		if (found)
 		{
-			const BOOL is_entry_separator = (dynamic_cast<LLMenuItemSeparatorGL *>(menu_item) != NULL);
-			if (is_entry_separator && is_previous_entry_separator)
-				found = false;
+			const bool is_entry_separator = (dynamic_cast<LLMenuItemSeparatorGL *>(menu_item) != NULL);
+			found = !(is_entry_separator && is_previous_entry_separator);
 			is_previous_entry_separator = is_entry_separator;
 		}
 		
@@ -512,6 +587,7 @@ void hide_context_entries(LLMenuGL& menu,
 			{
 				menu_item->setVisible(FALSE);
 			}
+
 			menu_item->setEnabled(FALSE);
 		}
 		else
@@ -520,17 +596,14 @@ void hide_context_entries(LLMenuGL& menu,
 			// A bit of a hack so we can remember that some UI element explicitly set this to be visible
 			// so that some other UI element from multi-select doesn't later set this invisible.
 			menu_item->pushVisible(TRUE);
-			if (append)
-			{
-				menu_item->setEnabled(TRUE);
-			}
-			for (itor2 = disabled_entries.begin(); itor2 != disabled_entries.end(); ++itor2)
+
+			bool enabled = (menu_item->getEnabled() == TRUE);
+			for (itor2 = disabled_entries.begin(); enabled && (itor2 != disabled_entries.end()); ++itor2)
 			{
-				if (*itor2 == name)
-				{
-					menu_item->setEnabled(FALSE);
-				}
+				enabled &= (*itor2 != name);
 			}
+
+			menu_item->setEnabled(enabled);
 		}
 	}
 }
@@ -594,29 +667,26 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
 				disabled_items.push_back(std::string("Copy"));
 			}
 
+			items.push_back(std::string("Cut"));
+			if (!isItemMovable() || !isItemRemovable())
+			{
+				disabled_items.push_back(std::string("Cut"));
+			}
+
 			if (canListOnMarketplace())
 			{
 				items.push_back(std::string("Marketplace Separator"));
 
-				bool copyable = true;
-				LLViewerInventoryItem* inv_item = gInventory.getItem(mUUID);
-				if (inv_item)
-				{
-					copyable = inv_item->getPermissions().allowCopyBy(gAgent.getID());
-				}
-
-				const std::string merchant_action = ((copyable == true) ? "Merchant Copy" : "Merchant Move");
-				items.push_back(merchant_action);
-
+				items.push_back(std::string("Merchant Copy"));
 				if (!canListOnMarketplaceNow())
 				{
-					disabled_items.push_back(merchant_action);
+					disabled_items.push_back(std::string("Merchant Copy"));
 				}
 			}
 		}
 	}
 
-	// Don't allow items to be pasted directly into the COF or the inbox
+	// Don't allow items to be pasted directly into the COF or the inbox/outbox
 	if (!isCOFFolder() && !isInboxFolder() && !isOutboxFolder())
 	{
 		items.push_back(std::string("Paste"));
@@ -657,7 +727,7 @@ void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	}	
 	else if(isOutboxFolder())
 	{
-		items.push_back(std::string("Delete"));
+		addOutboxContextMenuOptions(flags, items, disabled_items);
 	}
 	else
 	{
@@ -734,6 +804,32 @@ void LLInvFVBridge::addOpenRightClickMenuOption(menuentry_vec_t &items)
 		items.push_back(std::string("Open"));
 }
 
+void LLInvFVBridge::addOutboxContextMenuOptions(U32 flags,
+												menuentry_vec_t &items,
+												menuentry_vec_t &disabled_items)
+{
+	items.push_back(std::string("Rename"));
+	items.push_back(std::string("Delete"));
+	
+	if ((flags & FIRST_SELECTED_ITEM) == 0)
+	{
+		disabled_items.push_back(std::string("Rename"));
+	}
+	
+#if ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU
+	if (isOutboxFolderDirectParent())
+	{
+		items.push_back(std::string("Marketplace Separator"));
+		items.push_back(std::string("Marketplace Send"));
+		
+		if ((flags & FIRST_SELECTED_ITEM) == 0)
+		{
+			disabled_items.push_back(std::string("Marketplace Send"));
+		}
+	}
+#endif // ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU
+}
+
 // *TODO: remove this
 BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const
 {
@@ -776,7 +872,7 @@ LLInventoryObject* LLInvFVBridge::getInventoryObject() const
 
 LLInventoryModel* LLInvFVBridge::getInventoryModel() const
 {
-	LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
+	LLInventoryPanel* panel = mInventoryPanel.get();
 	return panel ? panel->getModel() : NULL;
 }
 
@@ -854,6 +950,22 @@ BOOL LLInvFVBridge::isOutboxFolder() const
 	return gInventory.isObjectDescendentOf(mUUID, outbox_id);
 }
 
+BOOL LLInvFVBridge::isOutboxFolderDirectParent() const
+{
+	BOOL outbox_is_parent = FALSE;
+	
+	const LLInventoryCategory *cat = gInventory.getCategory(mUUID);
+
+	if (cat)
+	{
+		const LLUUID outbox_id = getOutboxFolder();
+		
+		outbox_is_parent = (outbox_id.notNull() && (outbox_id == cat->getParentUUID()));
+	}
+	
+	return outbox_is_parent;
+}
+
 const LLUUID LLInvFVBridge::getOutboxFolder() const
 {
 	const LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false, false);
@@ -872,7 +984,7 @@ void LLInvFVBridge::changeItemParent(LLInventoryModel* model,
 									 const LLUUID& new_parent_id,
 									 BOOL restamp)
 {
-	change_item_parent(model, item, new_parent_id, restamp);
+	model->changeItemParent(item, new_parent_id, restamp);
 }
 
 // static
@@ -881,7 +993,7 @@ void LLInvFVBridge::changeCategoryParent(LLInventoryModel* model,
 										 const LLUUID& new_parent_id,
 										 BOOL restamp)
 {
-	change_category_parent(model, cat, new_parent_id, restamp);
+	model->changeCategoryParent(cat, new_parent_id, restamp);
 }
 
 LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
@@ -1040,82 +1152,134 @@ void LLInvFVBridge::purgeItem(LLInventoryModel *model, const LLUUID &uuid)
 	}
 }
 
-BOOL LLInvFVBridge::canShare() const
+bool LLInvFVBridge::canShare() const
 {
-	if (!isAgentInventory()) return FALSE;
-
-	const LLInventoryModel* model = getInventoryModel();
-	if (!model) return FALSE;
+	bool can_share = false;
 
-	const LLViewerInventoryItem *item = model->getItem(mUUID);
-	if (item)
+	if (isAgentInventory())
 	{
-		if (!LLInventoryCollectFunctor::itemTransferCommonlyAllowed(item)) 
-			return FALSE;
-		return (BOOL)LLGiveInventory::isInventoryGiveAcceptable(item);
+		const LLInventoryModel* model = getInventoryModel();
+		if (model)
+		{
+			const LLViewerInventoryItem *item = model->getItem(mUUID);
+			if (item)
+			{
+				if (LLInventoryCollectFunctor::itemTransferCommonlyAllowed(item)) 
+				{
+					can_share = LLGiveInventory::isInventoryGiveAcceptable(item);
+				}
+			}
+			else
+			{
+				// Categories can be given.
+				can_share = (model->getCategory(mUUID) != NULL);
+			}
+		}
 	}
 
-	// Categories can be given.
-	if (model->getCategory(mUUID)) return TRUE;
-
-	return FALSE;
+	return can_share;
 }
 
-BOOL LLInvFVBridge::canListOnMarketplace() const
+bool LLInvFVBridge::canListOnMarketplace() const
 {
 #if ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU
+
 	LLInventoryModel * model = getInventoryModel();
+
 	const LLViewerInventoryCategory * cat = model->getCategory(mUUID);
 	if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
 	{
-		return FALSE;
+		return false;
 	}
 
 	if (!isAgentInventory())
 	{
-		return FALSE;
+		return false;
 	}
 	
 	if (getOutboxFolder().isNull())
 	{
-		return FALSE;
+		return false;
 	}
 
 	if (isInboxFolder() || isOutboxFolder())
 	{
-		return FALSE;
+		return false;
 	}
-
+	
 	LLViewerInventoryItem * item = model->getItem(mUUID);
-	if (item && !item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
+	if (item)
 	{
-		return FALSE;
+		if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
+		{
+			return false;
+		}
+		
+		if (LLAssetType::AT_CALLINGCARD == item->getType())
+		{
+			return false;
+		}
 	}
 
-	return TRUE;
+	return true;
+
 #else
-	return FALSE;
+	return false;
 #endif
 }
 
-BOOL LLInvFVBridge::canListOnMarketplaceNow() const
+bool LLInvFVBridge::canListOnMarketplaceNow() const
 {
 #if ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU
-	if (get_is_item_worn(mUUID))
+	
+	bool can_list = true;
+
+	// Do not allow listing while import is in progress
+	if (LLMarketplaceInventoryImporter::instanceExists())
 	{
-		return FALSE;
+		can_list = !LLMarketplaceInventoryImporter::instance().isImportInProgress();
 	}
+	
+	const LLInventoryObject* obj = getInventoryObject();
+	can_list &= (obj != NULL);
 
-	// Loop through all items worn by avatar and check to see if they are descendants
-	// of the item we are trying to list on the marketplace
-	if (get_is_parent_to_worn_item(mUUID))
+	if (can_list)
 	{
-		return FALSE;
+		const LLUUID& object_id = obj->getLinkedUUID();
+		can_list = object_id.notNull();
+
+		if (can_list)
+		{
+			LLFolderViewFolder * object_folderp = mRoot->getFolderByID(object_id);
+			if (object_folderp)
+			{
+				can_list = !object_folderp->isLoading();
+			}
+		}
+		
+		if (can_list)
+		{
+			// Get outbox id
+			const LLUUID & outbox_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false);
+			LLFolderViewItem * outbox_itemp = mRoot->getItemByID(outbox_id);
+
+			if (outbox_itemp)
+			{
+				MASK mask = 0x0;
+				BOOL drop = FALSE;
+				EDragAndDropType cargo_type = LLViewerAssetType::lookupDragAndDropType(obj->getActualType());
+				void * cargo_data = (void *) obj;
+				std::string tooltip_msg;
+				
+				can_list = outbox_itemp->getListener()->dragOrDrop(mask, drop, cargo_type, cargo_data, tooltip_msg);
+			}
+		}
 	}
+	
+	return can_list;
 
-	return TRUE;
 #else
-	return FALSE;
+	return false;
 #endif
 }
 
@@ -1188,6 +1352,12 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action)
 		gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(buffer));
 		return;
 	}
+	else if ("cut" == action)
+	{
+		cutToClipboard();
+		LLFolderView::removeCutItems();
+		return;
+	}
 	else if ("copy" == action)
 	{
 		copyToClipboard();
@@ -1195,7 +1365,6 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action)
 	}
 	else if ("paste" == action)
 	{
-		// Single item only
 		LLInventoryItem* itemp = model->getItem(mUUID);
 		if (!itemp) return;
 
@@ -1225,7 +1394,7 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action)
 		if (!itemp) return;
 
 		const LLUUID outbox_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false, false);
-		copy_item_to_outbox(itemp, outbox_id, LLUUID::null);
+		copy_item_to_outbox(itemp, outbox_id, LLUUID::null, LLToolDragAndDrop::getOperationId());
 	}
 }
 
@@ -1234,7 +1403,8 @@ void LLItemBridge::selectItem()
 	LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem());
 	if(item && !item->isFinished())
 	{
-		item->fetchFromServer();
+		//item->fetchFromServer();
+		LLInventoryModelBackgroundFetch::instance().start(item->getUUID(), false);
 	}
 }
 
@@ -1564,21 +1734,7 @@ BOOL LLItemBridge::isItemCopyable() const
 			return FALSE;
 		}
 
-		// All items can be copied in god mode since you can
-		// at least paste-as-link the item, though you 
-		// still may not be able paste the item.
-		return TRUE;
-		// return (item->getPermissions().allowCopyBy(gAgent.getID()));
-	}
-	return FALSE;
-}
-
-BOOL LLItemBridge::copyToClipboard() const
-{
-	if(isItemCopyable())
-	{
-		LLInventoryClipboard::instance().add(mUUID);
-		return TRUE;
+		return item->getPermissions().allowCopyBy(gAgent.getID()) || gSavedSettings.getBOOL("InventoryLinking");
 	}
 	return FALSE;
 }
@@ -1616,16 +1772,20 @@ BOOL LLFolderBridge::isItemMovable() const
 	LLInventoryObject* obj = getInventoryObject();
 	if(obj)
 	{
-		return (!LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)obj)->getPreferredType()));
+		// If it's a protected type folder, we can't move it
+		if (LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)obj)->getPreferredType()))
+			return FALSE;
+		return TRUE;
 	}
 	return FALSE;
 }
 
 void LLFolderBridge::selectItem()
 {
+	// Have no fear: the first thing start() does is to test if everything for that folder has been fetched...
+	LLInventoryModelBackgroundFetch::instance().start(getUUID(), true);
 }
 
-
 // Iterate through a folder's children to determine if
 // all the children are removable.
 class LLIsItemRemovable : public LLFolderViewFunctor
@@ -1651,7 +1811,7 @@ BOOL LLFolderBridge::isItemRemovable() const
 		return FALSE;
 	}
 
-	LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
+	LLInventoryPanel* panel = mInventoryPanel.get();
 	LLFolderViewFolder* folderp = dynamic_cast<LLFolderViewFolder*>(panel ? panel->getRootFolder()->getItemByID(mUUID) : NULL);
 	if (folderp)
 	{
@@ -1681,23 +1841,35 @@ BOOL LLFolderBridge::isUpToDate() const
 
 BOOL LLFolderBridge::isItemCopyable() const
 {
-	if (gSavedSettings.getBOOL("InventoryLinking"))
-	{
-		// Can copy folders to paste-as-link, but not for straight paste.
-		return TRUE;
-	}
-	return FALSE;
+	// Folders are copyable if items in them are, recursively, copyable.
+	
+	// Get the content of the folder
+	LLInventoryModel::cat_array_t* cat_array;
+	LLInventoryModel::item_array_t* item_array;
+	gInventory.getDirectDescendentsOf(mUUID,cat_array,item_array);
+
+	// Check the items
+	LLInventoryModel::item_array_t item_array_copy = *item_array;
+	for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++)
+	{
+		LLInventoryItem* item = *iter;
+		LLItemBridge item_br(mInventoryPanel.get(), mRoot, item->getUUID());
+		if (!item_br.isItemCopyable())
+			return FALSE;
 }
 
-BOOL LLFolderBridge::copyToClipboard() const
+	// Check the folders
+	LLInventoryModel::cat_array_t cat_array_copy = *cat_array;
+	for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
 {
-	if(isItemCopyable())
-	{
-		LLInventoryClipboard::instance().add(mUUID);
+		LLViewerInventoryCategory* category = *iter;
+		LLFolderBridge cat_br(mInventoryPanel.get(), mRoot, category->getUUID());
+		if (!cat_br.isItemCopyable())
+			return FALSE;
+	}
+	
 		return TRUE;
 	}
-	return FALSE;
-}
 
 BOOL LLFolderBridge::isClipboardPasteable() const
 {
@@ -1714,7 +1886,7 @@ BOOL LLFolderBridge::isClipboardPasteable() const
 		}
 
 		LLDynamicArray<LLUUID> objects;
-		LLInventoryClipboard::instance().retrieve(objects);
+		LLClipboard::instance().pasteFromClipboard(objects);
 		const LLViewerInventoryCategory *current_cat = getCategory();
 
 		// Search for the direct descendent of current Friends subfolder among all pasted items,
@@ -1752,7 +1924,7 @@ BOOL LLFolderBridge::isClipboardPasteableAsLink() const
 		const BOOL is_in_friend_folder = LLFriendCardsManager::instance().isCategoryInFriendFolder( current_cat );
 		const LLUUID &current_cat_id = current_cat->getUUID();
 		LLDynamicArray<LLUUID> objects;
-		LLInventoryClipboard::instance().retrieve(objects);
+		LLClipboard::instance().pasteFromClipboard(objects);
 		S32 count = objects.count();
 		for(S32 i = 0; i < count; i++)
 		{
@@ -1787,30 +1959,41 @@ BOOL LLFolderBridge::isClipboardPasteableAsLink() const
 
 static BOOL can_move_to_outbox(LLInventoryItem* inv_item, std::string& tooltip_msg)
 {
-	bool worn = get_is_item_worn(inv_item->getUUID());
+	// Collapse links directly to items/folders
+	LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) inv_item;
+	LLViewerInventoryItem * linked_item = viewer_inv_item->getLinkedItem();
+	if (linked_item != NULL)
+	{
+		inv_item = linked_item;
+	}
+	
 	bool allow_transfer = inv_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID());
-
 	if (!allow_transfer)
 	{
 		tooltip_msg = LLTrans::getString("TooltipOutboxNoTransfer");
+		return false;
 	}
-	else if(worn)
+
+#if BLOCK_WORN_ITEMS_IN_OUTBOX
+	bool worn = get_is_item_worn(inv_item->getUUID());
+	if (worn)
 	{
 		tooltip_msg = LLTrans::getString("TooltipOutboxWorn");
+		return false;
 	}
+#endif
 	
-	return !worn && allow_transfer;
-}
-
-
-
-void LLFolderBridge::dropFolderToOutbox(LLInventoryCategory* inv_cat)
-{
-	copy_folder_to_outbox(inv_cat, getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false), inv_cat->getUUID());	
+	bool calling_card = (LLAssetType::AT_CALLINGCARD == inv_item->getType());
+	if (calling_card)
+	{
+		tooltip_msg = LLTrans::getString("TooltipOutboxCallingCard");
+		return false;
+	}
+	
+	return true;
 }
 
 
-
 int get_folder_levels(LLInventoryCategory* inv_cat)
 {
 	LLInventoryModel::cat_array_t* cats;
@@ -1865,54 +2048,84 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 	if (!isAgentAvatarValid()) return FALSE;
 	if (!isAgentInventory()) return FALSE; // cannot drag categories into library
 
+	LLInventoryPanel* destination_panel = mInventoryPanel.get();
+	if (!destination_panel) return false;
 
-	// check to make sure source is agent inventory, and is represented there.
-	LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
-	const BOOL is_agent_inventory = (model->getCategory(inv_cat->getUUID()) != NULL)
-		&& (LLToolDragAndDrop::SOURCE_AGENT == source);
+	LLInventoryFilter* filter = destination_panel->getFilter();
+	if (!filter) return false;
 
+	const LLUUID &cat_id = inv_cat->getUUID();
 	const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
+	const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false);
+	
 	const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
+	const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); 
+	const BOOL move_is_from_outbox = model->isObjectDescendentOf(cat_id, outbox_id);
+
+	// check to make sure source is agent inventory, and is represented there.
+	LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
+	const BOOL is_agent_inventory = (model->getCategory(cat_id) != NULL)
+		&& (LLToolDragAndDrop::SOURCE_AGENT == source);
 
 	BOOL accept = FALSE;
 	if (is_agent_inventory)
 	{
-		const LLUUID &cat_id = inv_cat->getUUID();
 		const LLUUID &trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH, false);
 		const LLUUID &landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK, false);
-		const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false);
 
 		const BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id);
 		const BOOL move_is_into_outfit = getCategory() && (getCategory()->getPreferredType() == LLFolderType::FT_OUTFIT);
 		const BOOL move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id);
-		const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); 
-		const BOOL move_is_from_outbox = model->isObjectDescendentOf(inv_cat->getUUID(), outbox_id);
 
 		//--------------------------------------------------------------------------------
 		// Determine if folder can be moved.
 		//
 
 		BOOL is_movable = TRUE;
-		if (LLFolderType::lookupIsProtectedType(inv_cat->getPreferredType()))
+
+		if (is_movable && (mUUID == cat_id))
+		{
+			is_movable = FALSE;
+			tooltip_msg = LLTrans::getString("TooltipDragOntoSelf");
+		}
+		if (is_movable && (model->isObjectDescendentOf(mUUID, cat_id)))
+		{
 			is_movable = FALSE;
-		if (move_is_into_outfit)
+			tooltip_msg = LLTrans::getString("TooltipDragOntoOwnChild");
+		}
+		if (is_movable && LLFolderType::lookupIsProtectedType(inv_cat->getPreferredType()))
+		{
+			is_movable = FALSE;
+			// tooltip?
+		}
+		if (is_movable && move_is_into_outfit)
+		{
 			is_movable = FALSE;
-		if (mUUID == gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE))
+			// tooltip?
+		}
+		if (is_movable && (mUUID == model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE)))
+		{
 			is_movable = FALSE;
+			// tooltip?
+		}
+		
 		LLInventoryModel::cat_array_t descendent_categories;
 		LLInventoryModel::item_array_t descendent_items;
-		gInventory.collectDescendents(cat_id, descendent_categories, descendent_items, FALSE);
-		for (S32 i=0; i < descendent_categories.count(); ++i)
+		if (is_movable)
 		{
-			LLInventoryCategory* category = descendent_categories[i];
-			if(LLFolderType::lookupIsProtectedType(category->getPreferredType()))
+			model->collectDescendents(cat_id, descendent_categories, descendent_items, FALSE);
+			for (S32 i=0; i < descendent_categories.count(); ++i)
 			{
-				// Can't move "special folders" (e.g. Textures Folder).
-				is_movable = FALSE;
-				break;
+				LLInventoryCategory* category = descendent_categories[i];
+				if(LLFolderType::lookupIsProtectedType(category->getPreferredType()))
+				{
+					// Can't move "special folders" (e.g. Textures Folder).
+					is_movable = FALSE;
+					break;
+				}
 			}
 		}
-		if (move_is_into_trash)
+		if (is_movable && move_is_into_trash)
 		{
 			for (S32 i=0; i < descendent_items.count(); ++i)
 			{
@@ -1924,7 +2137,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 				}
 			}
 		}
-		if (move_is_into_landmarks)
+		if (is_movable && move_is_into_landmarks)
 		{
 			for (S32 i=0; i < descendent_items.count(); ++i)
 			{
@@ -1939,41 +2152,139 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 				}
 			}
 		}
-		if (move_is_into_outbox)
+		if (is_movable && move_is_into_outbox)
 		{
-			for (S32 i=0; i < descendent_items.count(); ++i)
-			{
-				LLInventoryItem* item = descendent_items[i];
-				if (!can_move_to_outbox(item, tooltip_msg))
-				{
-					is_movable = FALSE;
-					break; 
-				}
-			}
-
-			int nested_folder_levels = get_folder_path_length(outbox_id, mUUID) + get_folder_levels(inv_cat);
-
-			if (nested_folder_levels > 4)
+			const int nested_folder_levels = get_folder_path_length(outbox_id, mUUID) + get_folder_levels(inv_cat);
+			
+			if (nested_folder_levels > gSavedSettings.getU32("InventoryOutboxMaxFolderDepth"))
 			{
 				tooltip_msg = LLTrans::getString("TooltipOutboxFolderLevels");
 				is_movable = FALSE;
 			}
-			
-		}
-
-		// 
-		//--------------------------------------------------------------------------------
-
-		accept = is_movable
-			&& (mUUID != cat_id)								// Can't move a folder into itself
-			&& (mUUID != inv_cat->getParentUUID())				// Avoid moves that would change nothing
-			&& !(model->isObjectDescendentOf(mUUID, cat_id));	// Avoid circularity
-		if (accept && drop)
-		{
-			// Look for any gestures and deactivate them
-			if (move_is_into_trash)
+			else
 			{
-				for (S32 i=0; i < descendent_items.count(); i++)
+				int dragged_folder_count = descendent_categories.count();
+				int existing_item_count = 0;
+				int existing_folder_count = 0;
+				
+				const LLViewerInventoryCategory * master_folder = model->getFirstDescendantOf(outbox_id, mUUID);
+				
+				if (master_folder != NULL)
+				{
+					if (model->isObjectDescendentOf(cat_id, master_folder->getUUID()))
+					{
+						// Don't use count because we're already inside the same category anyway
+						dragged_folder_count = 0;
+					}
+					else
+					{
+						existing_folder_count = 1; // Include the master folder in the count!
+
+						// If we're in the drop operation as opposed to the drag without drop, we are doing a
+						// single category at a time so don't block based on the total amount of cargo data items
+						if (drop)
+						{
+							dragged_folder_count += 1;
+						}
+						else
+						{
+							// NOTE: The cargo id's count is a total of categories AND items but we err on the side of
+							//       prevention rather than letting too many folders into the hierarchy of the outbox,
+							//       when we're dragging the item to a new parent
+							dragged_folder_count += LLToolDragAndDrop::instance().getCargoCount();
+						}
+					}
+					
+					// Tally the total number of categories and items inside the master folder
+
+					LLInventoryModel::cat_array_t existing_categories;
+					LLInventoryModel::item_array_t existing_items;
+
+					model->collectDescendents(master_folder->getUUID(), existing_categories, existing_items, FALSE);
+					
+					existing_folder_count += existing_categories.count();
+					existing_item_count += existing_items.count();
+				}
+				else
+				{
+					// Assume a single category is being dragged to the outbox since we evaluate one at a time
+					// when not putting them under a parent item.
+					dragged_folder_count += 1;
+				}
+
+				const int nested_folder_count = existing_folder_count + dragged_folder_count;
+				const int nested_item_count = existing_item_count + descendent_items.count();
+				
+				if (nested_folder_count > gSavedSettings.getU32("InventoryOutboxMaxFolderCount"))
+				{
+					tooltip_msg = LLTrans::getString("TooltipOutboxTooManyFolders");
+					is_movable = FALSE;
+				}
+				else if (nested_item_count > gSavedSettings.getU32("InventoryOutboxMaxItemCount"))
+				{
+					tooltip_msg = LLTrans::getString("TooltipOutboxTooManyObjects");
+					is_movable = FALSE;
+				}
+				
+				if (is_movable == TRUE)
+				{
+					for (S32 i=0; i < descendent_items.count(); ++i)
+					{
+						LLInventoryItem* item = descendent_items[i];
+						if (!can_move_to_outbox(item, tooltip_msg))
+						{
+							is_movable = FALSE;
+							break; 
+						}
+					}
+				}
+			}
+		}
+
+		if (is_movable)
+		{
+			LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
+			is_movable = active_panel != NULL;
+
+			// For a folder to pass the filter all its descendants are required to pass.
+			// We make this exception to allow reordering folders within an inventory panel,
+			// which has a filter applied, like Recent tab for example.
+			// There may be folders which are displayed because some of their descendants pass
+			// the filter, but other don't, and thus remain hidden. Without this check,
+			// such folders would not be allowed to be moved within a panel.
+			if (destination_panel == active_panel)
+			{
+				is_movable = true;
+			}
+			else
+			{
+				LLFolderView* active_folder_view = NULL;
+
+				if (is_movable)
+				{
+					active_folder_view = active_panel->getRootFolder();
+					is_movable = active_folder_view != NULL;
+				}
+
+				if (is_movable)
+				{
+					// Check whether the folder being dragged from active inventory panel
+					// passes the filter of the destination panel.
+					is_movable = check_category(model, cat_id, active_folder_view, filter);
+				}
+			}
+		}
+		// 
+		//--------------------------------------------------------------------------------
+
+		accept = is_movable;
+
+		if (accept && drop)
+		{
+			// Look for any gestures and deactivate them
+			if (move_is_into_trash)
+			{
+				for (S32 i=0; i < descendent_items.count(); i++)
 				{
 					LLInventoryItem* item = descendent_items[i];
 					if (item->getType() == LLAssetType::AT_GESTURE
@@ -1999,7 +2310,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 						// Recursively create links in target outfit.
 						LLInventoryModel::cat_array_t cats;
 						LLInventoryModel::item_array_t items;
-						gInventory.collectDescendents(inv_cat->getUUID(), cats, items, LLInventoryModel::EXCLUDE_TRASH);
+						model->collectDescendents(cat_id, cats, items, LLInventoryModel::EXCLUDE_TRASH);
 						LLAppearanceMgr::instance().linkAll(mUUID,items,NULL);
 					}
 				}
@@ -2017,7 +2328,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 						const std::string empty_description = "";
 						link_inventory_item(
 							gAgent.getID(),
-							inv_cat->getUUID(),
+							cat_id,
 							mUUID,
 							inv_cat->getName(),
 							empty_description,
@@ -2029,13 +2340,13 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 			}
 			else if (move_is_into_outbox && !move_is_from_outbox)
 			{
-				dropFolderToOutbox(inv_cat);
+				copy_folder_to_outbox(inv_cat, mUUID, cat_id, LLToolDragAndDrop::getOperationId());
 			}
 			else
 			{
-				if (gInventory.isObjectDescendentOf(inv_cat->getUUID(), gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX, false, false)))
+				if (model->isObjectDescendentOf(cat_id, model->findCategoryUUIDForType(LLFolderType::FT_INBOX, false, false)))
 				{
-					set_dad_inbox_object(inv_cat->getUUID());
+					set_dad_inbox_object(cat_id);
 				}
 
 				// Reparent the folder and restamp children if it's moving
@@ -2050,15 +2361,28 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 	}
 	else if (LLToolDragAndDrop::SOURCE_WORLD == source)
 	{
-		// content category has same ID as object itself
-		LLUUID object_id = inv_cat->getUUID();
-		LLUUID category_id = mUUID;
-		accept = move_inv_category_world_to_agent(object_id, category_id, drop);
+		if (move_is_into_outbox)
+		{
+			tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory");
+			accept = FALSE;
+		}
+		else
+		{
+			accept = move_inv_category_world_to_agent(cat_id, mUUID, drop, NULL, NULL, filter);
+		}
 	}
 	else if (LLToolDragAndDrop::SOURCE_LIBRARY == source)
 	{
-		// Accept folders that contain complete outfits.
-		accept = move_is_into_current_outfit && LLAppearanceMgr::instance().getCanMakeFolderIntoOutfit(inv_cat->getUUID());
+		if (move_is_into_outbox)
+		{
+			tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory");
+			accept = FALSE;
+		}
+		else
+		{
+			// Accept folders that contain complete outfits.
+			accept = move_is_into_current_outfit && LLAppearanceMgr::instance().getCanMakeFolderIntoOutfit(cat_id);
+		}		
 
 		if (accept && drop)
 		{
@@ -2089,7 +2413,8 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
 									  const LLUUID& category_id,
 									  BOOL drop,
 									  void (*callback)(S32, void*),
-									  void* user_data)
+									  void* user_data,
+									  LLInventoryFilter* filter)
 {
 	// Make sure the object exists. If we allowed dragging from
 	// anonymous objects, it would be possible to bypass
@@ -2113,7 +2438,7 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
 		return FALSE;
 	}
 
-	BOOL accept = TRUE;
+	BOOL accept = FALSE;
 	BOOL is_move = FALSE;
 
 	// coming from a task. Need to figure out if the person can
@@ -2122,9 +2447,16 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
 	LLInventoryObject::object_list_t::iterator end = inventory_objects.end();
 	for ( ; it != end; ++it)
 	{
+		LLInventoryItem* item = dynamic_cast<LLInventoryItem*>(it->get());
+		if (!item)
+		{
+			llwarns << "Invalid inventory item for drop" << llendl;
+			continue;
+		}
+
 		// coming from a task. Need to figure out if the person can
 		// move/copy this item.
-		LLPermissions perm(((LLInventoryItem*)((LLInventoryObject*)(*it)))->getPermissions());
+		LLPermissions perm(item->getPermissions());
 		if((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID())
 			&& perm.allowTransferTo(gAgent.getID())))
 //			|| gAgent.isGodlike())
@@ -2139,9 +2471,14 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
 			is_move = TRUE;
 			accept = TRUE;
 		}
-		else
+
+		if (filter && accept)
+		{
+			accept = filter->check(item);
+		}
+
+		if (!accept)
 		{
-			accept = FALSE;
 			break;
 		}
 	}
@@ -2177,122 +2514,114 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
 	return accept;
 }
 
-//Used by LLFolderBridge as callback for directory recursion.
-class LLRightClickInventoryFetchObserver : public LLInventoryFetchItemsObserver
-{
-public:
-	LLRightClickInventoryFetchObserver(const uuid_vec_t& ids) :
-		LLInventoryFetchItemsObserver(ids),
-		mCopyItems(false)
-	{ };
-	LLRightClickInventoryFetchObserver(const uuid_vec_t& ids,
-									   const LLUUID& cat_id, 
-									   bool copy_items) :
-		LLInventoryFetchItemsObserver(ids),
-		mCatID(cat_id),
-		mCopyItems(copy_items)
-	{ };
-	virtual void done()
-	{
-		// we've downloaded all the items, so repaint the dialog
-		LLFolderBridge::staticFolderOptionsMenu();
-
-		gInventory.removeObserver(this);
-		delete this;
-	}
-
-
-protected:
-	LLUUID mCatID;
-	bool mCopyItems;
-
-};
-
-//Used by LLFolderBridge as callback for directory recursion.
-class LLRightClickInventoryFetchDescendentsObserver : public LLInventoryFetchDescendentsObserver
+void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer)
 {
-public:
-	LLRightClickInventoryFetchDescendentsObserver(const uuid_vec_t& ids,
-												  bool copy_items) : 
-		LLInventoryFetchDescendentsObserver(ids),
-		mCopyItems(copy_items) 
-	{}
-	~LLRightClickInventoryFetchDescendentsObserver() {}
-	virtual void done();
-protected:
-	bool mCopyItems;
-};
-
-void LLRightClickInventoryFetchDescendentsObserver::done()
-{
-	// Avoid passing a NULL-ref as mCompleteFolders.front() down to
-	// gInventory.collectDescendents()
+	// Bail out immediately if no descendents
 	if( mComplete.empty() )
 	{
 		llwarns << "LLRightClickInventoryFetchDescendentsObserver::done with empty mCompleteFolders" << llendl;
+		if (clear_observer)
+		{
 		dec_busy_count();
 		gInventory.removeObserver(this);
 		delete this;
+		}
 		return;
 	}
 
-	// What we do here is get the complete information on the items in
-	// the library, and set up an observer that will wait for that to
-	// happen.
-	LLInventoryModel::cat_array_t cat_array;
-	LLInventoryModel::item_array_t item_array;
-	gInventory.collectDescendents(mComplete.front(),
-								  cat_array,
-								  item_array,
-								  LLInventoryModel::EXCLUDE_TRASH);
-	S32 count = item_array.count();
-#if 0 // HACK/TODO: Why?
-	// This early causes a giant menu to get produced, and doesn't seem to be needed.
-	if(!count)
-	{
-		llwarns << "Nothing fetched in category " << mCompleteFolders.front()
-				<< llendl;
+	// Copy the list of complete fetched folders while "this" is still valid
+	uuid_vec_t completed_folder = mComplete;
+	
+	// Clean up, and remove this as an observer now since recursive calls
+	// could notify observers and throw us into an infinite loop.
+	if (clear_observer)
+	{
 		dec_busy_count();
 		gInventory.removeObserver(this);
 		delete this;
-		return;
 	}
-#endif
 
-	uuid_vec_t ids;
-	for(S32 i = 0; i < count; ++i)
+	for (uuid_vec_t::iterator current_folder = completed_folder.begin(); current_folder != completed_folder.end(); ++current_folder)
 	{
-		ids.push_back(item_array.get(i)->getUUID());
-	}
+		// Get the information on the fetched folder items and subfolders and fetch those 
+		LLInventoryModel::cat_array_t* cat_array;
+		LLInventoryModel::item_array_t* item_array;
+		gInventory.getDirectDescendentsOf(*current_folder, cat_array, item_array);
 
-	LLRightClickInventoryFetchObserver* outfit = new LLRightClickInventoryFetchObserver(ids, mComplete.front(), mCopyItems);
+		S32 item_count = item_array->count();
+		S32 cat_count = cat_array->count();
+	
+		// Move to next if current folder empty
+		if ((item_count == 0) && (cat_count == 0))
+	{
+			continue;
+	}
 
-	// clean up, and remove this as an observer since the call to the
-	// outfit could notify observers and throw us into an infinite
-	// loop.
-	dec_busy_count();
-	gInventory.removeObserver(this);
-	delete this;
+		uuid_vec_t ids;
+		LLRightClickInventoryFetchObserver* outfit = NULL;
+		LLRightClickInventoryFetchDescendentsObserver* categories = NULL;
 
-	// increment busy count and either tell the inventory to check &
-	// call done, or add this object to the inventory for observation.
-	inc_busy_count();
+		// Fetch the items
+		if (item_count)
+		{
+			for (S32 i = 0; i < item_count; ++i)
+			{
+				ids.push_back(item_array->get(i)->getUUID());
+			}
+			outfit = new LLRightClickInventoryFetchObserver(ids);
+		}
+		// Fetch the subfolders
+		if (cat_count)
+		{
+			for (S32 i = 0; i < cat_count; ++i)
+			{
+				ids.push_back(cat_array->get(i)->getUUID());
+			}
+			categories = new LLRightClickInventoryFetchDescendentsObserver(ids);
+		}
 
-	// do the fetch
+		// Perform the item fetch
+		if (outfit)
+		{
 	outfit->startFetch();
-	outfit->done();				//Not interested in waiting and this will be right 99% of the time.
+			outfit->execute();				// Not interested in waiting and this will be right 99% of the time.
+			delete outfit;
 //Uncomment the following code for laggy Inventory UI.
-/*	if(outfit->isFinished())
+			/*
+			 if (outfit->isFinished())
 	{
 	// everything is already here - call done.
-	outfit->done();
+				outfit->execute();
+				delete outfit;
 	}
 	else
 	{
-	// it's all on it's way - add an observer, and the inventory
+				// it's all on its way - add an observer, and the inventory
 	// will call done for us when everything is here.
+				inc_busy_count();
 	gInventory.addObserver(outfit);
-	}*/
+			}
+			*/
+		}
+		// Perform the subfolders fetch : this is where we truly recurse down the folder hierarchy
+		if (categories)
+		{
+			categories->startFetch();
+			if (categories->isFinished())
+			{
+				// everything is already here - call done.
+				categories->execute();
+				delete categories;
+			}
+			else
+			{
+				// it's all on its way - add an observer, and the inventory
+				// will call done for us when everything is here.
+				inc_busy_count();
+				gInventory.addObserver(categories);
+			}
+		}
+	}
 }
 
 
@@ -2305,15 +2634,15 @@ void LLRightClickInventoryFetchDescendentsObserver::done()
 class LLInventoryCopyAndWearObserver : public LLInventoryObserver
 {
 public:
-	LLInventoryCopyAndWearObserver(const LLUUID& cat_id, int count) :
-		mCatID(cat_id), mContentsCount(count), mFolderAdded(FALSE) {}
+	LLInventoryCopyAndWearObserver(const LLUUID& cat_id, int count, bool folder_added=false) :
+		mCatID(cat_id), mContentsCount(count), mFolderAdded(folder_added) {}
 	virtual ~LLInventoryCopyAndWearObserver() {}
 	virtual void changed(U32 mask);
 
 protected:
 	LLUUID mCatID;
 	int    mContentsCount;
-	BOOL   mFolderAdded;
+	bool   mFolderAdded;
 };
 
 
@@ -2341,7 +2670,6 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask)
 		if (mFolderAdded)
 		{
 			LLViewerInventoryCategory* category = gInventory.getCategory(mCatID);
-
 			if (NULL == category)
 			{
 				llwarns << "gInventory.getCategory(" << mCatID
@@ -2412,6 +2740,12 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action)
 		modifyOutfit(TRUE);
 		return;
 	}
+	else if ("cut" == action)
+	{
+		cutToClipboard();
+		LLFolderView::removeCutItems();
+		return;
+	}
 	else if ("copy" == action)
 	{
 		copyToClipboard();
@@ -2451,8 +2785,19 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action)
 		if (!cat) return;
 
 		const LLUUID outbox_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false, false);
-		copy_folder_to_outbox(cat, outbox_id, cat->getUUID());
+		copy_folder_to_outbox(cat, outbox_id, cat->getUUID(), LLToolDragAndDrop::getOperationId());
+	}
+#if ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU
+	else if (isMarketplaceSendAction(action))
+	{
+		llinfos << "Send to marketplace action!" << llendl;
+
+		LLInventoryCategory * cat = gInventory.getCategory(mUUID);
+		if (!cat) return;
+		
+		send_to_marketplace(cat);
 	}
+#endif // ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU
 }
 
 void LLFolderBridge::openItem()
@@ -2603,7 +2948,7 @@ bool LLFolderBridge::removeItemResponse(const LLSD& notification, const LLSD& re
 	{
 		// move it to the trash
 		LLPreview::hide(mUUID);
-		remove_category(getInventoryModel(), mUUID);
+		getInventoryModel()->removeCategory(mUUID);
 		return TRUE;
 	}
 	return FALSE;
@@ -2615,20 +2960,65 @@ void LLFolderBridge::pasteFromClipboard()
 	if(model && isClipboardPasteable())
 	{
 		const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
+		const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false);
+
 		const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
 		const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
+		const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id);
+
+		LLDynamicArray<LLUUID> objects;
+		LLClipboard::instance().pasteFromClipboard(objects);
+
+		if (move_is_into_outbox)
+		{
+			LLFolderViewItem * outbox_itemp = mRoot->getItemByID(mUUID);
+
+			if (outbox_itemp)
+			{
+				LLToolDragAndDrop::instance().setCargoCount(objects.size());
+
+				BOOL can_list = TRUE;
+
+				for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin();
+					(iter != objects.end()) && (can_list == TRUE);
+					++iter)
+				{
+					const LLUUID& item_id = (*iter);
+					LLInventoryItem *item = model->getItem(item_id);
+
+					if (item)
+					{
+						MASK mask = 0x0;
+						BOOL drop = FALSE;
+						EDragAndDropType cargo_type = LLViewerAssetType::lookupDragAndDropType(item->getActualType());
+						void * cargo_data = (void *) item;
+						std::string tooltip_msg;
+
+						can_list = outbox_itemp->getListener()->dragOrDrop(mask, drop, cargo_type, cargo_data, tooltip_msg);
+					}
+				}
+
+				LLToolDragAndDrop::instance().resetCargoCount();
+
+				if (can_list == FALSE)
+				{
+					// Notify user of failure somehow -- play error sound?  modal dialog?
+					return;
+				}
+			}
+		}
 
 		const LLUUID parent_id(mUUID);
 
-		LLDynamicArray<LLUUID> objects;
-		LLInventoryClipboard::instance().retrieve(objects);
 		for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin();
 			 iter != objects.end();
 			 ++iter)
 		{
 			const LLUUID& item_id = (*iter);
+
 			LLInventoryItem *item = model->getItem(item_id);
-			if (item)
+			LLInventoryObject *obj = model->getObject(item_id);
+			if (obj)
 			{
 				if (move_is_into_current_outfit || move_is_into_outfit)
 				{
@@ -2637,10 +3027,21 @@ void LLFolderBridge::pasteFromClipboard()
 						dropToOutfit(item, move_is_into_current_outfit);
 					}
 				}
-				else if(LLInventoryClipboard::instance().isCutMode())
+				else if (LLClipboard::instance().isCutMode())
+				{
+					// Do a move to "paste" a "cut"
+					// move_inventory_item() is not enough, as we have to update inventory locally too
+					if (LLAssetType::AT_CATEGORY == obj->getType())
+					{
+						LLViewerInventoryCategory* vicat = (LLViewerInventoryCategory *) model->getCategory(item_id);
+						llassert(vicat);
+						if (vicat)
+						{
+							changeCategoryParent(model, vicat, parent_id, FALSE);
+						}
+					}
+					else
 				{
-					// move_inventory_item() is not enough,
-					//we have to update inventory locally too
 					LLViewerInventoryItem* viitem = dynamic_cast<LLViewerInventoryItem*>(item);
 					llassert(viitem);
 					if (viitem)
@@ -2648,6 +3049,19 @@ void LLFolderBridge::pasteFromClipboard()
 						changeItemParent(model, viitem, parent_id, FALSE);
 					}
 				}
+				}
+				else
+				{
+					// Do a "copy" to "paste" a regular copy clipboard
+					if (LLAssetType::AT_CATEGORY == obj->getType())
+					{
+						LLViewerInventoryCategory* vicat = (LLViewerInventoryCategory *) model->getCategory(item_id);
+						llassert(vicat);
+						if (vicat)
+						{
+							copy_inventory_category(model, vicat, parent_id);
+						}
+					}
 				else
 				{
 					copy_inventory_item(
@@ -2661,6 +3075,9 @@ void LLFolderBridge::pasteFromClipboard()
 			}
 		}
 	}
+		// Change mode to paste for next paste
+		LLClipboard::instance().setCutMode(false);
+	}
 }
 
 void LLFolderBridge::pasteLinkFromClipboard()
@@ -2669,13 +3086,22 @@ void LLFolderBridge::pasteLinkFromClipboard()
 	if(model)
 	{
 		const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
+		const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false);
+
 		const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
 		const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
+		const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id);
+
+		if (move_is_into_outbox)
+		{
+			// Notify user of failure somehow -- play error sound?  modal dialog?
+			return;
+		}
 
 		const LLUUID parent_id(mUUID);
 
 		LLDynamicArray<LLUUID> objects;
-		LLInventoryClipboard::instance().retrieve(objects);
+		LLClipboard::instance().pasteFromClipboard(objects);
 		for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin();
 			 iter != objects.end();
 			 ++iter)
@@ -2713,109 +3139,18 @@ void LLFolderBridge::pasteLinkFromClipboard()
 					LLPointer<LLInventoryCallback>(NULL));
 			}
 		}
+		// Change mode to paste for next paste
+		LLClipboard::instance().setCutMode(false);
 	}
 }
 
 void LLFolderBridge::staticFolderOptionsMenu()
 {
 	LLFolderBridge* selfp = sSelf.get();
-	if (selfp)
-	{
-		selfp->folderOptionsMenu();
-	}
-}
-
-void LLFolderBridge::folderOptionsMenu()
-{
-	LLInventoryModel* model = getInventoryModel();
-	if(!model) return;
-
-	const LLInventoryCategory* category = model->getCategory(mUUID);
-	if(!category) return;
-
-	const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
-	if (trash_id == mUUID) return;
-	if (isItemInTrash()) return;
-	if (!isAgentInventory()) return;
-	if (isOutboxFolder()) return;
-
-	LLFolderType::EType type = category->getPreferredType();
-	const bool is_system_folder = LLFolderType::lookupIsProtectedType(type);
-	// BAP change once we're no longer treating regular categories as ensembles.
-	const bool is_ensemble = (type == LLFolderType::FT_NONE ||
-							  LLFolderType::lookupIsEnsembleType(type));
-
-	// Only enable calling-card related options for non-system folders.
-	if (!is_system_folder)
-	{
-		LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD);
-		if (mCallingCards || checkFolderForContentsOfType(model, is_callingcard))
-		{
-			mItems.push_back(std::string("Calling Card Separator"));
-			mItems.push_back(std::string("Conference Chat Folder"));
-			mItems.push_back(std::string("IM All Contacts In Folder"));
-		}
-	}
-
-	if (!isItemRemovable())
-	{
-		mDisabledItems.push_back(std::string("Delete"));
-	}
-
-#ifndef LL_RELEASE_FOR_DOWNLOAD
-	if (LLFolderType::lookupIsProtectedType(type))
-	{
-		mItems.push_back(std::string("Delete System Folder"));
-	}
-#endif
-
-	// wearables related functionality for folders.
-	//is_wearable
-	LLFindWearables is_wearable;
-	LLIsType is_object( LLAssetType::AT_OBJECT );
-	LLIsType is_gesture( LLAssetType::AT_GESTURE );
-
-	if (mWearables ||
-		checkFolderForContentsOfType(model, is_wearable)  ||
-		checkFolderForContentsOfType(model, is_object) ||
-		checkFolderForContentsOfType(model, is_gesture) )
-	{
-		mItems.push_back(std::string("Folder Wearables Separator"));
-
-		// Only enable add/replace outfit for non-system folders.
-		if (!is_system_folder)
-		{
-			// Adding an outfit onto another (versus replacing) doesn't make sense.
-			if (type != LLFolderType::FT_OUTFIT)
-			{
-				mItems.push_back(std::string("Add To Outfit"));
-			}
 
-			mItems.push_back(std::string("Replace Outfit"));
-		}
-		if (is_ensemble)
-		{
-			mItems.push_back(std::string("Wear As Ensemble"));
-		}
-		mItems.push_back(std::string("Remove From Outfit"));
-		if (!LLAppearanceMgr::getCanRemoveFromCOF(mUUID))
-		{
-			mDisabledItems.push_back(std::string("Remove From Outfit"));
-		}
-		if (!LLAppearanceMgr::instance().getCanReplaceCOF(mUUID))
-		{
-			mDisabledItems.push_back(std::string("Replace Outfit"));
-		}
-		mItems.push_back(std::string("Outfit Separator"));
-	}
-	LLMenuGL* menup = dynamic_cast<LLMenuGL*>(mMenu.get());
-	if (menup)
+	if (selfp && selfp->mRoot)
 	{
-		hide_context_entries(*menup, mItems, mDisabledItems, TRUE);
-
-		// Reposition the menu, in case we're adding items to an existing menu.
-		menup->needsArrange();
-		menup->arrangeAndClear();
+		selfp->mRoot->updateMenu();
 	}
 }
 
@@ -2831,17 +3166,11 @@ BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInv
 	return ((item_array.count() > 0) ? TRUE : FALSE );
 }
 
-// Flags unused
-void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+void LLFolderBridge::buildContextMenuBaseOptions(U32 flags)
 {
-	mItems.clear();
-	mDisabledItems.clear();
-
-	lldebugs << "LLFolderBridge::buildContextMenu()" << llendl;
-
-//	menuentry_vec_t disabled_items;
 	LLInventoryModel* model = getInventoryModel();
-	if(!model) return;
+	llassert(model != NULL);
+
 	const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
 	const LLUUID lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
 
@@ -2858,10 +3187,6 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 		mDisabledItems.push_back(std::string("New Body Parts"));
 	}
 
-	// clear out old menu and folder pointers
-	mMenu.markDead();
-	sSelf.markDead();
-
 	if(trash_id == mUUID)
 	{
 		// This is the trash.
@@ -2875,20 +3200,23 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	}
 	else if(isOutboxFolder())
 	{
-		mItems.push_back(std::string("Delete"));
+		addOutboxContextMenuOptions(flags, mItems, mDisabledItems);
 	}
 	else if(isAgentInventory()) // do not allow creating in library
 	{
-		LLViewerInventoryCategory *cat =  getCategory();
+		LLViewerInventoryCategory *cat = getCategory();
 		// BAP removed protected check to re-enable standard ops in untyped folders.
 		// Not sure what the right thing is to do here.
 		if (!isCOFFolder() && cat && (cat->getPreferredType() != LLFolderType::FT_OUTFIT))
 		{
-			if (!isInboxFolder() && !isOutboxFolder()) // don't allow creation in inbox
+			if (!isInboxFolder() && !isOutboxFolder()) // don't allow creation in inbox or outbox
 			{
 				// Do not allow to create 2-level subfolder in the Calling Card/Friends folder. EXT-694.
 				if (!LLFriendCardsManager::instance().isCategoryInFriendFolder(cat))
+				{
 					mItems.push_back(std::string("New Folder"));
+				}
+
 				mItems.push_back(std::string("New Script"));
 				mItems.push_back(std::string("New Note"));
 				mItems.push_back(std::string("New Gesture"));
@@ -2937,54 +3265,161 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 		LLIsType is_object( LLAssetType::AT_OBJECT );
 		LLIsType is_gesture( LLAssetType::AT_GESTURE );
 
-		if (checkFolderForContentsOfType(model, is_wearable)  ||
-			checkFolderForContentsOfType(model, is_object) ||
-			checkFolderForContentsOfType(model, is_gesture) )
+		if (checkFolderForContentsOfType(model, is_wearable)  ||
+			checkFolderForContentsOfType(model, is_object) ||
+			checkFolderForContentsOfType(model, is_gesture) )
+		{
+			mWearables=TRUE;
+		}
+	}
+
+	// Preemptively disable system folder removal if more than one item selected.
+	if ((flags & FIRST_SELECTED_ITEM) == 0)
+	{
+		mDisabledItems.push_back(std::string("Delete System Folder"));
+	}
+
+	if (!isOutboxFolder())
+	{
+		mItems.push_back(std::string("Share"));
+		if (!canShare())
+		{
+			mDisabledItems.push_back(std::string("Share"));
+		}
+	}
+}
+
+void LLFolderBridge::buildContextMenuFolderOptions(U32 flags)
+{
+	// Build folder specific options back up
+	LLInventoryModel* model = getInventoryModel();
+	if(!model) return;
+
+	const LLInventoryCategory* category = model->getCategory(mUUID);
+	if(!category) return;
+
+	const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+	if (trash_id == mUUID) return;
+	if (isItemInTrash()) return;
+	if (!isAgentInventory()) return;
+	if (isOutboxFolder()) return;
+
+	LLFolderType::EType type = category->getPreferredType();
+	const bool is_system_folder = LLFolderType::lookupIsProtectedType(type);
+	// BAP change once we're no longer treating regular categories as ensembles.
+	const bool is_ensemble = (type == LLFolderType::FT_NONE ||
+		LLFolderType::lookupIsEnsembleType(type));
+
+	// Only enable calling-card related options for non-system folders.
+	if (!is_system_folder)
+	{
+		LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD);
+		if (mCallingCards || checkFolderForContentsOfType(model, is_callingcard))
 		{
-			mWearables=TRUE;
+			mItems.push_back(std::string("Calling Card Separator"));
+			mItems.push_back(std::string("Conference Chat Folder"));
+			mItems.push_back(std::string("IM All Contacts In Folder"));
 		}
 	}
 
-	// Preemptively disable system folder removal if more than one item selected.
-	if ((flags & FIRST_SELECTED_ITEM) == 0)
+	if (!isItemRemovable())
 	{
-		mDisabledItems.push_back(std::string("Delete System Folder"));
+		mDisabledItems.push_back(std::string("Delete"));
 	}
 
-	if (!isOutboxFolder())
+#ifndef LL_RELEASE_FOR_DOWNLOAD
+	if (LLFolderType::lookupIsProtectedType(type))
 	{
-		mItems.push_back(std::string("Share"));
-		if (!canShare())
+		mItems.push_back(std::string("Delete System Folder"));
+	}
+#endif
+
+	// wearables related functionality for folders.
+	//is_wearable
+	LLFindWearables is_wearable;
+	LLIsType is_object( LLAssetType::AT_OBJECT );
+	LLIsType is_gesture( LLAssetType::AT_GESTURE );
+
+	if (mWearables ||
+		checkFolderForContentsOfType(model, is_wearable)  ||
+		checkFolderForContentsOfType(model, is_object) ||
+		checkFolderForContentsOfType(model, is_gesture) )
+	{
+		mItems.push_back(std::string("Folder Wearables Separator"));
+
+		// Only enable add/replace outfit for non-system folders.
+		if (!is_system_folder)
 		{
-			mDisabledItems.push_back(std::string("Share"));
+			// Adding an outfit onto another (versus replacing) doesn't make sense.
+			if (type != LLFolderType::FT_OUTFIT)
+			{
+				mItems.push_back(std::string("Add To Outfit"));
+			}
+
+			mItems.push_back(std::string("Replace Outfit"));
+		}
+		if (is_ensemble)
+		{
+			mItems.push_back(std::string("Wear As Ensemble"));
+		}
+		mItems.push_back(std::string("Remove From Outfit"));
+		if (!LLAppearanceMgr::getCanRemoveFromCOF(mUUID))
+		{
+			mDisabledItems.push_back(std::string("Remove From Outfit"));
+		}
+		if (!LLAppearanceMgr::instance().getCanReplaceCOF(mUUID))
+		{
+			mDisabledItems.push_back(std::string("Replace Outfit"));
 		}
+		mItems.push_back(std::string("Outfit Separator"));
 	}
+}
 
-	hide_context_entries(menu, mItems, mDisabledItems);
+// Flags unused
+void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+	sSelf.markDead();
+
+	mItems.clear();
+	mDisabledItems.clear();
+
+	lldebugs << "LLFolderBridge::buildContextMenu()" << llendl;
+
+	LLInventoryModel* model = getInventoryModel();
+	if(!model) return;
+
+	buildContextMenuBaseOptions(flags);
 
 	// Add menu items that are dependent on the contents of the folder.
-	uuid_vec_t folders;
-	LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID);
+	LLViewerInventoryCategory* category = (LLViewerInventoryCategory *) model->getCategory(mUUID);
 	if (category)
 	{
+		uuid_vec_t folders;
 		folders.push_back(category->getUUID());
-	}
 
-	mMenu = menu.getHandle();
-	sSelf = getHandle();
-	LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(folders, FALSE);
-	fetch->startFetch();
-	inc_busy_count();
-	if(fetch->isFinished())
-	{
-		// everything is already here - call done.
-		fetch->done();
-	}
-	else
-	{
-		// it's all on its way - add an observer, and the inventory will call done for us when everything is here.
-		gInventory.addObserver(fetch);
+		sSelf = getHandle();
+		LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(folders);
+		fetch->startFetch();
+		if (fetch->isFinished())
+		{
+			// Do not call execute() or done() here as if the folder is here, there's likely no point drilling down 
+			// This saves lots of time as buildContextMenu() is called a lot
+			delete fetch;
+			buildContextMenuFolderOptions(flags);
+		}
+		else
+		{
+			// it's all on its way - add an observer, and the inventory will call done for us when everything is here.
+			inc_busy_count();
+			gInventory.addObserver(fetch);
+		}
 	}
+
+	hide_context_entries(menu, mItems, mDisabledItems);
+
+	// Reposition the menu, in case we're adding items to an existing menu.
+	menu.needsArrange();
+	menu.arrangeAndClear();
 }
 
 BOOL LLFolderBridge::hasChildren() const
@@ -3081,7 +3516,7 @@ void LLFolderBridge::createNewCategory(void* user_data)
 {
 	LLFolderBridge* bridge = (LLFolderBridge*)user_data;
 	if(!bridge) return;
-	LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(bridge->mInventoryPanel.get());
+	LLInventoryPanel* panel = bridge->mInventoryPanel.get();
 	if (!panel) return;
 	LLInventoryModel* model = panel->getModel();
 	if(!model) return;
@@ -3188,13 +3623,13 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response
 
 	if(option == 0 && object)
 	{
-		if (cat_and_wear && cat_and_wear->mWear)
+		if (cat_and_wear && cat_and_wear->mWear) // && !cat_and_wear->mFolderResponded)
 		{
 			LLInventoryObject::object_list_t inventory_objects;
 			object->getInventoryContents(inventory_objects);
 			int contents_count = inventory_objects.size()-1; //subtract one for containing folder
-
-			LLInventoryCopyAndWearObserver* inventoryObserver = new LLInventoryCopyAndWearObserver(cat_and_wear->mCatID, contents_count);
+			LLInventoryCopyAndWearObserver* inventoryObserver = new LLInventoryCopyAndWearObserver(cat_and_wear->mCatID, contents_count, cat_and_wear->mFolderResponded);
+			
 			gInventory.addObserver(inventoryObserver);
 		}
 
@@ -3261,7 +3696,7 @@ void LLFolderBridge::dropToFavorites(LLInventoryItem* inv_item)
 	// use callback to rearrange favorite landmarks after adding
 	// to have new one placed before target (on which it was dropped). See EXT-4312.
 	LLPointer<AddFavoriteLandmarkCallback> cb = new AddFavoriteLandmarkCallback();
-	LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
+	LLInventoryPanel* panel = mInventoryPanel.get();
 	LLFolderViewItem* drag_over_item = panel ? panel->getRootFolder()->getDraggingOverItem() : NULL;
 	if (drag_over_item && drag_over_item->getListener())
 	{
@@ -3307,10 +3742,16 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 {
 	LLInventoryModel* model = getInventoryModel();
 
-	if(!model || !inv_item) return FALSE;
-	if(!isAgentInventory()) return FALSE; // cannot drag into library
+	if (!model || !inv_item) return FALSE;
+	if (!isAgentInventory()) return FALSE; // cannot drag into library
 	if (!isAgentAvatarValid()) return FALSE;
 
+	LLInventoryPanel* destination_panel = mInventoryPanel.get();
+	if (!destination_panel) return false;
+
+	LLInventoryFilter* filter = destination_panel->getFilter();
+	if (!filter) return false;
+
 	const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
 	const LLUUID &favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE, false);
 	const LLUUID &landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK, false);
@@ -3320,7 +3761,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 	const BOOL move_is_into_favorites = (mUUID == favorites_id);
 	const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
 	const BOOL move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id);
-	const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); //(mUUID == outbox_id);
+	const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id);
 	const BOOL move_is_from_outbox = model->isObjectDescendentOf(inv_item->getUUID(), outbox_id);
 
 	LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
@@ -3376,10 +3817,14 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 		accept = TRUE;
 
 		if (!is_movable) 
+		{
 			accept = FALSE;
-		if ((mUUID == inv_item->getParentUUID()) && !move_is_into_favorites)
+		}
+		else if ((mUUID == inv_item->getParentUUID()) && !move_is_into_favorites)
+		{
 			accept = FALSE;
-		if (move_is_into_current_outfit || move_is_into_outfit)
+		}
+		else if (move_is_into_current_outfit || move_is_into_outfit)
 		{
 			accept = can_move_to_outfit(inv_item, move_is_into_current_outfit);
 		}
@@ -3390,9 +3835,47 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 		else if (move_is_into_outbox)
 		{
 			accept = can_move_to_outbox(inv_item, tooltip_msg);
+			
+			if (accept)
+			{
+				const LLViewerInventoryCategory * master_folder = model->getFirstDescendantOf(outbox_id, mUUID);
+				
+				int existing_item_count = LLToolDragAndDrop::instance().getCargoCount();
+				
+				if (master_folder != NULL)
+				{
+					LLInventoryModel::cat_array_t existing_categories;
+					LLInventoryModel::item_array_t existing_items;
+					
+					gInventory.collectDescendents(master_folder->getUUID(), existing_categories, existing_items, FALSE);
+					
+					existing_item_count += existing_items.count();
+				}
+				
+				if (existing_item_count > gSavedSettings.getU32("InventoryOutboxMaxItemCount"))
+				{
+					tooltip_msg = LLTrans::getString("TooltipOutboxTooManyObjects");
+					accept = FALSE;
+				}
+			}
+		}
+
+		LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
+
+		// Check whether the item being dragged from active inventory panel
+		// passes the filter of the destination panel.
+		if (accept && active_panel)
+		{
+			LLFolderView* active_folder_view = active_panel->getRootFolder();
+			if (!active_folder_view) return false;
+
+			LLFolderViewItem* fv_item = active_folder_view->getItemByID(inv_item->getUUID());
+			if (!fv_item) return false;
+
+			accept = filter->check(fv_item);
 		}
 
-		if(accept && drop)
+		if (accept && drop)
 		{
 			if (inv_item->getType() == LLAssetType::AT_GESTURE
 				&& LLGestureMgr::instance().isGestureActive(inv_item->getUUID()) && move_is_into_trash)
@@ -3401,15 +3884,10 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 			}
 			// If an item is being dragged between windows, unselect everything in the active window 
 			// so that we don't follow the selection to its new location (which is very annoying).
-			LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
-			if (active_panel)
-			{
-				LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
-				if (active_panel && (panel != active_panel))
+			if (active_panel && (destination_panel != active_panel))
 				{
 					active_panel->unSelectAll();
 				}
-			}
 
 			//--------------------------------------------------------------------------------
 			// Destination folder logic
@@ -3419,8 +3897,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 			// (only reorder the item in Favorites folder)
 			if ((mUUID == inv_item->getParentUUID()) && move_is_into_favorites)
 			{
-				LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
-				LLFolderViewItem* itemp = panel ? panel->getRootFolder()->getDraggingOverItem() : NULL;
+				LLFolderViewItem* itemp = destination_panel->getRootFolder()->getDraggingOverItem();
 				if (itemp)
 				{
 					LLUUID srcItemId = inv_item->getUUID();
@@ -3441,9 +3918,16 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 			{
 				dropToOutfit(inv_item, move_is_into_current_outfit);
 			}
-			else if (move_is_into_outbox && !move_is_from_outbox)
+			else if (move_is_into_outbox)
 			{
-				copy_item_to_outbox(inv_item, outbox_id, LLUUID::null);
+				if (move_is_from_outbox)
+				{
+					move_item_within_outbox(inv_item, mUUID, LLToolDragAndDrop::getOperationId());
+				}
+				else
+				{
+					copy_item_to_outbox(inv_item, mUUID, LLUUID::null, LLToolDragAndDrop::getOperationId());
+				}
 			}
 			// NORMAL or TRASH folder
 			// (move the item, restamp if into trash)
@@ -3464,7 +3948,6 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 
 			// 
 			//--------------------------------------------------------------------------------
-
 		}
 	}
 	else if (LLToolDragAndDrop::SOURCE_WORLD == source)
@@ -3473,7 +3956,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 		// anonymous objects, it would be possible to bypass
 		// permissions.
 		object = gObjectList.findObject(inv_item->getParentUUID());
-		if(!object)
+		if (!object)
 		{
 			llinfos << "Object not found for drop." << llendl;
 			return FALSE;
@@ -3483,10 +3966,9 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 		// move/copy this item.
 		LLPermissions perm(inv_item->getPermissions());
 		BOOL is_move = FALSE;
-		if((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID())
+		if ((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID())
 			&& perm.allowTransferTo(gAgent.getID())))
 			// || gAgent.isGodlike())
-
 		{
 			accept = TRUE;
 		}
@@ -3502,7 +3984,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 		// Don't allow placing an original item into Current Outfit or an outfit folder
 		// because they must contain only links to wearable items.
 		// *TODO: Probably we should create a link to an item if it was dragged to outfit or COF.
-		if(move_is_into_current_outfit || move_is_into_outfit)
+		if (move_is_into_current_outfit || move_is_into_outfit)
 		{
 			accept = FALSE;
 		}
@@ -3513,8 +3995,20 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 		{
 			accept = FALSE;
 		}
+		else if (move_is_into_outbox)
+		{
+			tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory");
+			accept = FALSE;
+		}
+		
+		// Check whether the item being dragged from in world
+		// passes the filter of the destination panel.
+		if (accept)
+		{
+			accept = filter->check(inv_item);
+		}
 
-		if(drop && accept)
+		if (accept && drop)
 		{
 			LLMoveInv* move_inv = new LLMoveInv;
 			move_inv->mObjectID = inv_item->getParentUUID();
@@ -3536,15 +4030,29 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 				LLNotifications::instance().forceResponse(params, 0);
 			}
 		}
-
 	}
 	else if(LLToolDragAndDrop::SOURCE_NOTECARD == source)
 	{
-		// Don't allow placing an original item from a notecard to Current Outfit or an outfit folder
-		// because they must contain only links to wearable items.
-		accept = !(move_is_into_current_outfit || move_is_into_outfit);
+		if (move_is_into_outbox)
+		{
+			tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory");
+			accept = FALSE;
+		}
+		else
+		{
+			// Don't allow placing an original item from a notecard to Current Outfit or an outfit folder
+			// because they must contain only links to wearable items.
+			accept = !(move_is_into_current_outfit || move_is_into_outfit);
+		}
+		
+		// Check whether the item being dragged from notecard
+		// passes the filter of the destination panel.
+		if (accept)
+		{
+			accept = filter->check(inv_item);
+		}
 
-		if(accept && drop)
+		if (accept && drop)
 		{
 			copy_inventory_from_notecard(mUUID,  // Drop to the chosen destination folder
 										 LLToolDragAndDrop::getInstance()->getObjectID(),
@@ -3559,7 +4067,12 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 		{
 			accept = TRUE;
 
-			if (move_is_into_current_outfit || move_is_into_outfit)
+			if (move_is_into_outbox)
+			{
+				tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory");
+				accept = FALSE;
+			}
+			else if (move_is_into_current_outfit || move_is_into_outfit)
 			{
 				accept = can_move_to_outfit(inv_item, move_is_into_current_outfit);
 			}
@@ -3570,6 +4083,21 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 				accept = can_move_to_landmarks(inv_item);
 			}
 
+			LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
+
+			// Check whether the item being dragged from the library
+			// passes the filter of the destination panel.
+			if (accept && active_panel)
+			{
+				LLFolderView* active_folder_view = active_panel->getRootFolder();
+				if (!active_folder_view) return false;
+
+				LLFolderViewItem* fv_item = active_folder_view->getItemByID(inv_item->getUUID());
+				if (!fv_item) return false;
+
+				accept = filter->check(fv_item);
+			}
+
 			if (accept && drop)
 			{
 				// FAVORITES folder
@@ -3604,6 +4132,69 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 	return accept;
 }
 
+// static
+bool check_category(LLInventoryModel* model,
+					const LLUUID& cat_id,
+					LLFolderView* active_folder_view,
+					LLInventoryFilter* filter)
+{
+	if (!model || !active_folder_view || !filter)
+		return false;
+
+	if (!filter->checkFolder(cat_id))
+	{
+		return false;
+	}
+
+	LLInventoryModel::cat_array_t descendent_categories;
+	LLInventoryModel::item_array_t descendent_items;
+	model->collectDescendents(cat_id, descendent_categories, descendent_items, TRUE);
+
+	S32 num_descendent_categories = descendent_categories.count();
+	S32 num_descendent_items = descendent_items.count();
+
+	if (num_descendent_categories + num_descendent_items == 0)
+	{
+		// Empty folder should be checked as any other folder view item.
+		// If we are filtering by date the folder should not pass because
+		// it doesn't have its own creation date. See LLInvFVBridge::getCreationDate().
+		return check_item(cat_id, active_folder_view, filter);
+	}
+
+	for (S32 i = 0; i < num_descendent_categories; ++i)
+	{
+		LLInventoryCategory* category = descendent_categories[i];
+		if(!check_category(model, category->getUUID(), active_folder_view, filter))
+		{
+			return false;
+		}
+	}
+
+	for (S32 i = 0; i < num_descendent_items; ++i)
+	{
+		LLViewerInventoryItem* item = descendent_items[i];
+		if(!check_item(item->getUUID(), active_folder_view, filter))
+		{
+			return false;
+		}
+	}
+
+	return true;
+}
+
+// static
+bool check_item(const LLUUID& item_id,
+				LLFolderView* active_folder_view,
+				LLInventoryFilter* filter)
+{
+	if (!active_folder_view || !filter) return false;
+
+	LLFolderViewItem* fv_item = active_folder_view->getItemByID(item_id);
+	if (!fv_item) return false;
+
+	return filter->check(fv_item);
+}
+
 // +=================================================+
 // |        LLTextureBridge                          |
 // +=================================================+
@@ -3650,7 +4241,7 @@ void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	}	
 	else if(isOutboxFolder())
 	{
-		items.push_back(std::string("Delete"));
+		addOutboxContextMenuOptions(flags, items, disabled_items);
 	}
 	else
 	{
@@ -3724,29 +4315,29 @@ void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	menuentry_vec_t items;
 	menuentry_vec_t disabled_items;
 
-	if(isItemInTrash())
-	{
-		addTrashContextMenuOptions(items, disabled_items);
-	}	
-	else if(isOutboxFolder())
+	if (isOutboxFolder())
 	{
-		items.push_back(std::string("Delete"));
+		addOutboxContextMenuOptions(flags, items, disabled_items);
 	}
 	else
 	{
-		items.push_back(std::string("Share"));
-		if (!canShare())
+		if (isItemInTrash())
 		{
-			disabled_items.push_back(std::string("Share"));
-		}
-		items.push_back(std::string("Sound Open"));
-		items.push_back(std::string("Properties"));
+			addTrashContextMenuOptions(items, disabled_items);
+		}	
+		else
+		{
+			items.push_back(std::string("Share"));
+			if (!canShare())
+			{
+				disabled_items.push_back(std::string("Share"));
+			}
+			items.push_back(std::string("Sound Open"));
+			items.push_back(std::string("Properties"));
 
-		getClipboardEntries(true, items, disabled_items, flags);
-	}
+			getClipboardEntries(true, items, disabled_items, flags);
+		}
 
-	if (!isOutboxFolder())
-	{
 		items.push_back(std::string("Sound Separator"));
 		items.push_back(std::string("Sound Play"));
 	}
@@ -3782,29 +4373,29 @@ void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	menuentry_vec_t disabled_items;
 
 	lldebugs << "LLLandmarkBridge::buildContextMenu()" << llendl;
-	if(isItemInTrash())
-	{
-		addTrashContextMenuOptions(items, disabled_items);
-	}	
-	else if(isOutboxFolder())
+	if(isOutboxFolder())
 	{
-		items.push_back(std::string("Delete"));
+		addOutboxContextMenuOptions(flags, items, disabled_items);
 	}
 	else
 	{
-		items.push_back(std::string("Share"));
-		if (!canShare())
+		if(isItemInTrash())
 		{
-			disabled_items.push_back(std::string("Share"));
-		}
-		items.push_back(std::string("Landmark Open"));
-		items.push_back(std::string("Properties"));
+			addTrashContextMenuOptions(items, disabled_items);
+		}	
+		else
+		{
+			items.push_back(std::string("Share"));
+			if (!canShare())
+			{
+				disabled_items.push_back(std::string("Share"));
+			}
+			items.push_back(std::string("Landmark Open"));
+			items.push_back(std::string("Properties"));
 
-		getClipboardEntries(true, items, disabled_items, flags);
-	}
+			getClipboardEntries(true, items, disabled_items, flags);
+		}
 
-	if (!isOutboxFolder())
-	{
 		items.push_back(std::string("Landmark Separator"));
 		items.push_back(std::string("About Landmark"));
 	}
@@ -3926,7 +4517,7 @@ LLCallingCardBridge::~LLCallingCardBridge()
 
 void LLCallingCardBridge::refreshFolderViewItem()
 {
-	LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
+	LLInventoryPanel* panel = mInventoryPanel.get();
 	LLFolderViewItem* itemp = panel ? panel->getRootFolder()->getItemByID(mUUID) : NULL;
 	if (itemp)
 	{
@@ -4337,36 +4928,35 @@ void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	menuentry_vec_t disabled_items;
 
 	lldebugs << "LLAnimationBridge::buildContextMenu()" << llendl;
-	if(isItemInTrash())
-	{
-		addTrashContextMenuOptions(items, disabled_items);
-	}	
-	else if(isOutboxFolder())
+	if(isOutboxFolder())
 	{
 		items.push_back(std::string("Delete"));
 	}
 	else
 	{
-		items.push_back(std::string("Share"));
-		if (!canShare())
+		if(isItemInTrash())
 		{
-			disabled_items.push_back(std::string("Share"));
-		}
-		items.push_back(std::string("Animation Open"));
-		items.push_back(std::string("Properties"));
+			addTrashContextMenuOptions(items, disabled_items);
+		}	
+		else
+		{
+			items.push_back(std::string("Share"));
+			if (!canShare())
+			{
+				disabled_items.push_back(std::string("Share"));
+			}
+			items.push_back(std::string("Animation Open"));
+			items.push_back(std::string("Properties"));
 
-		getClipboardEntries(true, items, disabled_items, flags);
-	}
+			getClipboardEntries(true, items, disabled_items, flags);
+		}
 
-	if (!isOutboxFolder())
-	{
 		items.push_back(std::string("Animation Separator"));
 		items.push_back(std::string("Animation Play"));
 		items.push_back(std::string("Animation Audition"));
 	}
 
 	hide_context_entries(menu, items, disabled_items);
-
 }
 
 // virtual
@@ -4376,14 +4966,14 @@ void LLAnimationBridge::performAction(LLInventoryModel* model, std::string actio
 	{
 		if (getItem())
 		{
-			LLPreviewAnim::e_activation_type activate = LLPreviewAnim::NONE;
-			if ("playworld" == action) activate = LLPreviewAnim::PLAY;
-			if ("playlocal" == action) activate = LLPreviewAnim::AUDITION;
+			LLSD::String activate = "NONE";
+			if ("playworld" == action) activate = "Inworld";
+			if ("playlocal" == action) activate = "Locally";
 
 			LLPreviewAnim* preview = LLFloaterReg::showTypedInstance<LLPreviewAnim>("preview_anim", LLSD(mUUID));
 			if (preview)
 			{
-				preview->activate(activate);
+				preview->play(activate);
 			}
 		}
 	}
@@ -5351,7 +5941,7 @@ void LLMeshBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	}
 	else if(isOutboxFolder())
 	{
-		items.push_back(std::string("Delete"));
+		addOutboxContextMenuOptions(flags, items, disabled_items);
 	}
 	else
 	{
@@ -5360,7 +5950,6 @@ void LLMeshBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 		getClipboardEntries(true, items, disabled_items, flags);
 	}
 
-
 	hide_context_entries(menu, items, disabled_items);
 }
 
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index 2d625befb4cff555fb26f94ad01e3de584016aba..dc9e88d54d84fb2c048609a5478eb0ad6b335098 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -35,6 +35,7 @@
 #include "llviewercontrol.h"
 #include "llwearable.h"
 
+class LLInventoryFilter;
 class LLInventoryPanel;
 class LLInventoryModel;
 class LLMenuGL;
@@ -69,9 +70,9 @@ class LLInvFVBridge : public LLFolderViewEventListener
 									   U32 flags = 0x00);
 	virtual ~LLInvFVBridge() {}
 
-	BOOL canShare() const;
-	BOOL canListOnMarketplace() const;
-	BOOL canListOnMarketplaceNow() const;
+	bool canShare() const;
+	bool canListOnMarketplace() const;
+	bool canListOnMarketplaceNow() const;
 
 	//--------------------------------------------------------------------
 	// LLInvFVBridge functionality
@@ -105,8 +106,8 @@ class LLInvFVBridge : public LLFolderViewEventListener
 	virtual void removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batch);
 	virtual void move(LLFolderViewEventListener* new_parent_bridge) {}
 	virtual BOOL isItemCopyable() const { return FALSE; }
-	virtual BOOL copyToClipboard() const { return FALSE; }
-	virtual void cutToClipboard();
+	virtual BOOL copyToClipboard() const;
+	virtual BOOL cutToClipboard() const;
 	virtual BOOL isClipboardPasteable() const;
 	virtual BOOL isClipboardPasteableAsLink() const;
 	virtual void pasteFromClipboard() {}
@@ -131,6 +132,9 @@ class LLInvFVBridge : public LLFolderViewEventListener
 	virtual void addDeleteContextMenuOptions(menuentry_vec_t &items,
 											 menuentry_vec_t &disabled_items);
 	virtual void addOpenRightClickMenuOption(menuentry_vec_t &items);
+	virtual void addOutboxContextMenuOptions(U32 flags,
+											 menuentry_vec_t &items,
+											 menuentry_vec_t &disabled_items);
 protected:
 	LLInvFVBridge(LLInventoryPanel* inventory, LLFolderView* root, const LLUUID& uuid);
 
@@ -144,6 +148,7 @@ class LLInvFVBridge : public LLFolderViewEventListener
 	BOOL isCOFFolder() const; // true if COF or descendent of
 	BOOL isInboxFolder() const; // true if COF or descendent of marketplace inbox
 	BOOL isOutboxFolder() const; // true if COF or descendent of marketplace outbox
+	BOOL isOutboxFolderDirectParent() const;
 	const LLUUID getOutboxFolder() const;
 
 	virtual BOOL isItemPermissive() const;
@@ -157,7 +162,7 @@ class LLInvFVBridge : public LLFolderViewEventListener
 									 BOOL restamp);
 	void removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*>& batch);
 protected:
-	LLHandle<LLPanel> mInventoryPanel;
+	LLHandle<LLInventoryPanel> mInventoryPanel;
 	LLFolderView* mRoot;
 	const LLUUID mUUID;	// item id
 	LLInventoryType::EType mInvType;
@@ -207,7 +212,6 @@ class LLItemBridge : public LLInvFVBridge
 	virtual BOOL renameItem(const std::string& new_name);
 	virtual BOOL removeItem();
 	virtual BOOL isItemCopyable() const;
-	virtual BOOL copyToClipboard() const;
 	virtual BOOL hasChildren() const { return FALSE; }
 	virtual BOOL isUpToDate() const { return TRUE; }
 
@@ -270,7 +274,6 @@ class LLFolderBridge : public LLInvFVBridge
 	virtual BOOL isItemCopyable() const;
 	virtual BOOL isClipboardPasteable() const;
 	virtual BOOL isClipboardPasteableAsLink() const;
-	virtual BOOL copyToClipboard() const;
 	
 	static void createWearable(LLFolderBridge* bridge, LLWearableType::EType type);
 
@@ -278,6 +281,9 @@ class LLFolderBridge : public LLInvFVBridge
 	LLHandle<LLFolderBridge> getHandle() { mHandle.bind(this); return mHandle; }
 
 protected:
+	void buildContextMenuBaseOptions(U32 flags);
+	void buildContextMenuFolderOptions(U32 flags);
+
 	//--------------------------------------------------------------------
 	// Menu callbacks
 	//--------------------------------------------------------------------
@@ -306,8 +312,6 @@ class LLFolderBridge : public LLInvFVBridge
 
 	void dropToFavorites(LLInventoryItem* inv_item);
 	void dropToOutfit(LLInventoryItem* inv_item, BOOL move_is_into_current_outfit);
-	void dropToOutbox(LLInventoryItem* inv_item);
-	void dropFolderToOutbox(LLInventoryCategory* inv_cat);
 
 	//--------------------------------------------------------------------
 	// Messy hacks for handling folder options
@@ -315,12 +319,10 @@ class LLFolderBridge : public LLInvFVBridge
 public:
 	static LLHandle<LLFolderBridge> sSelf;
 	static void staticFolderOptionsMenu();
-	void folderOptionsMenu();
 
 private:
 	BOOL				mCallingCards;
 	BOOL				mWearables;
-	LLHandle<LLView>	mMenu;
 	menuentry_vec_t		mItems;
 	menuentry_vec_t		mDisabledItems;
 	LLRootHandle<LLFolderBridge> mHandle;
@@ -642,7 +644,8 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
 									  const LLUUID& category_id,
 									  BOOL drop,
 									  void (*callback)(S32, void*) = NULL,
-									  void* user_data = NULL);
+									  void* user_data = NULL,
+									  LLInventoryFilter* filter = NULL);
 
 // Utility function to hide all entries except those in the list
 // Can be called multiple times on the same menu (e.g. if multiple items
@@ -650,7 +653,6 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
 // are set as enabled.
 void hide_context_entries(LLMenuGL& menu, 
 						  const menuentry_vec_t &entries_to_show, 
-						  const menuentry_vec_t &disabled_entries,
-						  BOOL append = FALSE);
+						  const menuentry_vec_t &disabled_entries);
 
 #endif // LL_LLINVENTORYBRIDGE_H
diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp
index 516b47e616dfe7a7239d12ce75d2ff12d3daf542..4d0af94f9f62b70b6b37f71ccc973d4444f59970 100644
--- a/indra/newview/llinventoryfilter.cpp
+++ b/indra/newview/llinventoryfilter.cpp
@@ -36,10 +36,14 @@
 #include "llviewercontrol.h"
 #include "llfolderview.h"
 #include "llinventorybridge.h"
+#include "llviewerfoldertype.h"
 
 // linden library includes
+#include "llclipboard.h"
 #include "lltrans.h"
 
+LLFastTimer::DeclareTimer FT_FILTER_CLIPBOARD("Filter Clipboard");
+
 LLInventoryFilter::FilterOps::FilterOps() :
 	mFilterObjectTypes(0xffffffffffffffffULL),
 	mFilterCategoryTypes(0xffffffffffffffffULL),
@@ -87,11 +91,15 @@ LLInventoryFilter::~LLInventoryFilter()
 
 BOOL LLInventoryFilter::check(const LLFolderViewItem* item) 
 {
-	// If it's a folder and we're showing all folders, return TRUE automatically.
+	// Clipboard cut items are *always* filtered so we need this value upfront
+	const LLFolderViewEventListener* listener = item->getListener();
+	const BOOL passed_clipboard = (listener ? checkAgainstClipboard(listener->getUUID()) : TRUE);
+
+	// If it's a folder and we're showing all folders, return automatically.
 	const BOOL is_folder = (dynamic_cast<const LLFolderViewFolder*>(item) != NULL);
 	if (is_folder && (mFilterOps.mShowFolderState == LLInventoryFilter::SHOW_ALL_FOLDERS))
 	{
-		return TRUE;
+		return passed_clipboard;
 	}
 
 	mSubStringMatchOffset = mFilterSubString.size() ? item->getSearchableLabel().find(mFilterSubString) : std::string::npos;
@@ -102,22 +110,60 @@ BOOL LLInventoryFilter::check(const LLFolderViewItem* item)
 	const BOOL passed = (passed_filtertype &&
 						 passed_permissions &&
 						 passed_filterlink &&
+						 passed_clipboard &&
 						 (mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos));
 
 	return passed;
 }
 
-bool LLInventoryFilter::checkFolder(const LLFolderViewFolder* folder)
+bool LLInventoryFilter::check(const LLInventoryItem* item)
 {
-	// we're showing all folders, overriding filter
-	if (mFilterOps.mShowFolderState == LLInventoryFilter::SHOW_ALL_FOLDERS)
+	mSubStringMatchOffset = mFilterSubString.size() ? item->getName().find(mFilterSubString) : std::string::npos;
+
+	const bool passed_filtertype = checkAgainstFilterType(item);
+	const bool passed_permissions = checkAgainstPermissions(item);
+	const BOOL passed_clipboard = checkAgainstClipboard(item->getUUID());
+	const bool passed = (passed_filtertype &&
+						 passed_permissions &&
+						 passed_clipboard &&
+						 (mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos));
+
+	return passed;
+}
+
+bool LLInventoryFilter::checkFolder(const LLFolderViewFolder* folder) const
+{
+	if (!folder)
 	{
-		return true;
+		llwarns << "The filter can not be checked on an invalid folder." << llendl;
+		llassert(false); // crash in development builds
+		return false;
 	}
 
 	const LLFolderViewEventListener* listener = folder->getListener();
+	if (!listener)
+	{
+		llwarns << "Folder view event listener not found." << llendl;
+		llassert(false); // crash in development builds
+		return false;
+	}
+
 	const LLUUID folder_id = listener->getUUID();
 
+	return checkFolder(folder_id);
+}
+
+bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const
+{
+	// Always check against the clipboard
+	const BOOL passed_clipboard = checkAgainstClipboard(folder_id);
+	
+	// we're showing all folders, overriding filter
+	if (mFilterOps.mShowFolderState == LLInventoryFilter::SHOW_ALL_FOLDERS)
+	{
+		return passed_clipboard;
+	}
+
 	if (mFilterOps.mFilterTypes & FILTERTYPE_CATEGORY)
 	{
 		// Can only filter categories for items in your inventory
@@ -130,7 +176,7 @@ bool LLInventoryFilter::checkFolder(const LLFolderViewFolder* folder)
 			return false;
 	}
 
-	return true;
+	return passed_clipboard;
 }
 
 BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item) const
@@ -206,9 +252,101 @@ BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item) con
 		}
 	}
 
+	////////////////////////////////////////////////////////////////////////////////
+	// FILTERTYPE_EMPTYFOLDERS
+	// Pass if this item is a folder and is not a system folder that should be hidden
+	if (filterTypes & FILTERTYPE_EMPTYFOLDERS)
+	{
+		if (object_type == LLInventoryType::IT_CATEGORY)
+		{
+			bool is_hidden_if_empty = LLViewerFolderType::lookupIsHiddenIfEmpty(listener->getPreferredType());
+			if (is_hidden_if_empty)
+			{
+				// Force the fetching of those folders so they are hidden iff they really are empty...
+				gInventory.fetchDescendentsOf(object_id);
+				return FALSE;
+			}
+		}
+	}
+
 	return TRUE;
 }
 
+bool LLInventoryFilter::checkAgainstFilterType(const LLInventoryItem* item) const
+{
+	LLInventoryType::EType object_type = item->getInventoryType();
+	const LLUUID object_id = item->getUUID();
+
+	const U32 filterTypes = mFilterOps.mFilterTypes;
+
+	////////////////////////////////////////////////////////////////////////////////
+	// FILTERTYPE_OBJECT
+	// Pass if this item's type is of the correct filter type
+	if (filterTypes & FILTERTYPE_OBJECT)
+	{
+		// If it has no type, pass it, unless it's a link.
+		if (object_type == LLInventoryType::IT_NONE)
+		{
+			if (item && item->getIsLinkType())
+			{
+				return false;
+			}
+		}
+		else if ((1LL << object_type & mFilterOps.mFilterObjectTypes) == U64(0))
+		{
+			return false;
+		}
+	}
+
+	////////////////////////////////////////////////////////////////////////////////
+	// FILTERTYPE_UUID
+	// Pass if this item is the target UUID or if it links to the target UUID
+	if (filterTypes & FILTERTYPE_UUID)
+	{
+		if (!item) return false;
+
+		if (item->getLinkedUUID() != mFilterOps.mFilterUUID)
+			return false;
+	}
+
+	////////////////////////////////////////////////////////////////////////////////
+	// FILTERTYPE_DATE
+	// Pass if this item is within the date range.
+	if (filterTypes & FILTERTYPE_DATE)
+	{
+		// We don't get the updated item creation date for the task inventory or
+		// a notecard embedded item. See LLTaskInvFVBridge::getCreationDate().
+		return false;
+	}
+
+	return true;
+}
+
+// Items and folders that are on the clipboard or, recursively, in a folder which  
+// is on the clipboard must be filtered out if the clipboard is in the "cut" mode.
+bool LLInventoryFilter::checkAgainstClipboard(const LLUUID& object_id) const
+{
+	if (LLClipboard::instance().isCutMode())
+	{
+		LLFastTimer ft(FT_FILTER_CLIPBOARD);
+		LLUUID current_id = object_id;
+		LLInventoryObject *current_object = gInventory.getObject(object_id);
+		while (current_id.notNull() && current_object)
+		{
+			if (LLClipboard::instance().isOnClipboard(current_id))
+			{
+				return false;
+			}
+			current_id = current_object->getParentUUID();
+			if (current_id.notNull())
+			{
+				current_object = gInventory.getObject(current_id);
+			}
+		}
+	}
+	return true;
+}
+
 BOOL LLInventoryFilter::checkAgainstPermissions(const LLFolderViewItem* item) const
 {
 	const LLFolderViewEventListener* listener = item->getListener();
@@ -226,6 +364,17 @@ BOOL LLInventoryFilter::checkAgainstPermissions(const LLFolderViewItem* item) co
 	return (perm & mFilterOps.mPermissions) == mFilterOps.mPermissions;
 }
 
+bool LLInventoryFilter::checkAgainstPermissions(const LLInventoryItem* item) const
+{
+	if (!item) return false;
+
+	LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+	PermissionMask perm = new_item->getPermissionMask();
+	new_item = NULL;
+
+	return (perm & mFilterOps.mPermissions) == mFilterOps.mPermissions;
+}
+
 BOOL LLInventoryFilter::checkAgainstFilterLinks(const LLFolderViewItem* item) const
 {
 	const LLFolderViewEventListener* listener = item->getListener();
@@ -253,6 +402,11 @@ std::string::size_type LLInventoryFilter::getStringMatchOffset() const
 	return mSubStringMatchOffset;
 }
 
+BOOL LLInventoryFilter::isDefault() const
+{
+	return !isNotDefault();
+}
+
 // has user modified default filter params?
 BOOL LLInventoryFilter::isNotDefault() const
 {
@@ -268,7 +422,7 @@ BOOL LLInventoryFilter::isNotDefault() const
 	not_default |= (mFilterOps.mMinDate != mDefaultFilterOps.mMinDate);
 	not_default |= (mFilterOps.mMaxDate != mDefaultFilterOps.mMaxDate);
 	not_default |= (mFilterOps.mHoursAgo != mDefaultFilterOps.mHoursAgo);
-
+	
 	return not_default;
 }
 
@@ -343,6 +497,11 @@ void LLInventoryFilter::setFilterWearableTypes(U64 types)
 	mFilterOps.mFilterTypes |= FILTERTYPE_WEARABLE;
 }
 
+void LLInventoryFilter::setFilterEmptySystemFolders()
+{
+	mFilterOps.mFilterTypes |= FILTERTYPE_EMPTYFOLDERS;
+}
+
 void LLInventoryFilter::setFilterUUID(const LLUUID& object_id)
 {
 	if (mFilterOps.mFilterUUID == LLUUID::null)
@@ -441,7 +600,15 @@ void LLInventoryFilter::setDateRange(time_t min_date, time_t max_date)
 		mFilterOps.mMaxDate = llmax(mFilterOps.mMinDate, max_date);
 		setModified();
 	}
-	mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
+
+	if (areDateLimitsSet())
+	{
+		mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
+	}
+	else
+	{
+		mFilterOps.mFilterTypes &= ~FILTERTYPE_DATE;
+	}
 }
 
 void LLInventoryFilter::setDateRangeLastLogoff(BOOL sl)
@@ -453,10 +620,18 @@ void LLInventoryFilter::setDateRangeLastLogoff(BOOL sl)
 	}
 	if (!sl && isSinceLogoff())
 	{
-		setDateRange(0, time_max());
+		setDateRange(time_min(), time_max());
 		setModified();
 	}
-	mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
+
+	if (areDateLimitsSet())
+	{
+		mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
+	}
+	else
+	{
+		mFilterOps.mFilterTypes &= ~FILTERTYPE_DATE;
+	}
 }
 
 BOOL LLInventoryFilter::isSinceLogoff() const
@@ -501,7 +676,15 @@ void LLInventoryFilter::setHoursAgo(U32 hours)
 			setModified(FILTER_RESTART);
 		}
 	}
-	mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
+
+	if (areDateLimitsSet())
+	{
+		mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
+	}
+	else
+	{
+		mFilterOps.mFilterTypes &= ~FILTERTYPE_DATE;
+	}
 }
 
 void LLInventoryFilter::setFilterLinks(U64 filter_links)
@@ -781,7 +964,7 @@ const std::string& LLInventoryFilter::getFilterText()
 		filtered_by_all_types = FALSE;
 	}
 
-	if (!LLInventoryModelBackgroundFetch::instance().backgroundFetchActive()
+	if (!LLInventoryModelBackgroundFetch::instance().folderFetchActive()
 		&& filtered_by_type
 		&& !filtered_by_all_types)
 	{
@@ -825,7 +1008,7 @@ void LLInventoryFilter::fromLLSD(LLSD& data)
 {
 	if(data.has("filter_types"))
 	{
-		setFilterObjectTypes((U32)data["filter_types"].asInteger());
+		setFilterObjectTypes((U64)data["filter_types"].asInteger());
 	}
 
 	if(data.has("min_date") && data.has("max_date"))
@@ -951,3 +1134,10 @@ const std::string& LLInventoryFilter::getEmptyLookupMessage() const
 	return mEmptyLookupMessage;
 
 }
+
+bool LLInventoryFilter::areDateLimitsSet()
+{
+	return     mFilterOps.mMinDate != time_min()
+			|| mFilterOps.mMaxDate != time_max()
+			|| mFilterOps.mHoursAgo != 0;
+}
diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h
index f9460822f7d54c8ba5d80e9c442b72540d74cc09..9e600c036f0e8679846b564bacbc478fb7db1d1c 100644
--- a/indra/newview/llinventoryfilter.h
+++ b/indra/newview/llinventoryfilter.h
@@ -32,6 +32,7 @@
 
 class LLFolderViewItem;
 class LLFolderViewFolder;
+class LLInventoryItem;
 
 class LLInventoryFilter
 {
@@ -57,7 +58,8 @@ class LLInventoryFilter
 		FILTERTYPE_CATEGORY = 0x1 << 1,	// search by folder type
 		FILTERTYPE_UUID	= 0x1 << 2,		// find the object with UUID and any links to it
 		FILTERTYPE_DATE = 0x1 << 3,		// search by date range
-		FILTERTYPE_WEARABLE = 0x1 << 4	// search by wearable type
+		FILTERTYPE_WEARABLE = 0x1 << 4,	// search by wearable type
+		FILTERTYPE_EMPTYFOLDERS = 0x1 << 5	// pass if folder is not a system folder to be hidden if empty
 	};
 
 	enum EFilterLink
@@ -88,6 +90,7 @@ class LLInventoryFilter
 	void 				setFilterCategoryTypes(U64 types);
 	void 				setFilterUUID(const LLUUID &object_id);
 	void				setFilterWearableTypes(U64 types);
+	void				setFilterEmptySystemFolders();
 	void				updateFilterTypes(U64 types, U64& current_types);
 
 	void 				setFilterSubString(const std::string& string);
@@ -113,10 +116,15 @@ class LLInventoryFilter
 	// + Execution And Results
 	// +-------------------------------------------------------------------+
 	BOOL 				check(const LLFolderViewItem* item);
-	bool				checkFolder(const LLFolderViewFolder* folder);
+	bool				check(const LLInventoryItem* item);
+	bool				checkFolder(const LLFolderViewFolder* folder) const;
+	bool				checkFolder(const LLUUID& folder_id) const;
 	BOOL 				checkAgainstFilterType(const LLFolderViewItem* item) const;
+	bool 				checkAgainstFilterType(const LLInventoryItem* item) const;
 	BOOL 				checkAgainstPermissions(const LLFolderViewItem* item) const;
+	bool 				checkAgainstPermissions(const LLInventoryItem* item) const;
 	BOOL 				checkAgainstFilterLinks(const LLFolderViewItem* item) const;
+	bool				checkAgainstClipboard(const LLUUID& object_id) const;
 
 	std::string::size_type getStringMatchOffset() const;
 
@@ -155,6 +163,7 @@ class LLInventoryFilter
 	// +-------------------------------------------------------------------+
 	// + Default
 	// +-------------------------------------------------------------------+
+	BOOL 				isDefault() const;
 	BOOL 				isNotDefault() const;
 	void 				markDefault();
 	void 				resetDefault();
@@ -173,6 +182,8 @@ class LLInventoryFilter
 	void 				fromLLSD(LLSD& data);
 
 private:
+	bool				areDateLimitsSet();
+
 	struct FilterOps
 	{
 		FilterOps();
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 5fb3f15cd5996ff69a6c11ed421d57468a7af79a..ab5b08291568165e81d6cb38c35349c9d6f25630 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -54,10 +54,10 @@
 #include "lliconctrl.h"
 #include "llimview.h"
 #include "llinventorybridge.h"
-#include "llinventoryclipboard.h"
 #include "llinventorymodel.h"
 #include "llinventorypanel.h"
 #include "lllineeditor.h"
+#include "llmarketplacenotifications.h"
 #include "llmenugl.h"
 #include "llnotificationsutil.h"
 #include "llpanelmaininventory.h"
@@ -82,6 +82,8 @@
 #include "llvoavatarself.h"
 #include "llwearablelist.h"
 
+#include <boost/foreach.hpp>
+
 BOOL LLInventoryState::sWearNewClothing = FALSE;
 LLUUID LLInventoryState::sWearNewClothingTransactionID;
 
@@ -106,91 +108,6 @@ void append_path(const LLUUID& id, std::string& path)
 	path.append(temp);
 }
 
-void change_item_parent(LLInventoryModel* model,
-						LLViewerInventoryItem* item,
-						const LLUUID& new_parent_id,
-						BOOL restamp)
-{
-	if (item->getParentUUID() != new_parent_id)
-	{
-		LLInventoryModel::update_list_t update;
-		LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
-		update.push_back(old_folder);
-		LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
-		update.push_back(new_folder);
-		gInventory.accountForUpdate(update);
-
-		LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
-		new_item->setParent(new_parent_id);
-		new_item->updateParentOnServer(restamp);
-		model->updateItem(new_item);
-		model->notifyObservers();
-	}
-}
-
-void change_category_parent(LLInventoryModel* model,
-	LLViewerInventoryCategory* cat,
-	const LLUUID& new_parent_id,
-	BOOL restamp)
-{
-	if (!model || !cat)
-	{
-		return;
-	}
-
-	// Can't move a folder into a child of itself.
-	if (model->isObjectDescendentOf(new_parent_id, cat->getUUID()))
-	{
-		return;
-	}
-
-	LLInventoryModel::update_list_t update;
-	LLInventoryModel::LLCategoryUpdate old_folder(cat->getParentUUID(), -1);
-	update.push_back(old_folder);
-	LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
-	update.push_back(new_folder);
-	model->accountForUpdate(update);
-
-	LLPointer<LLViewerInventoryCategory> new_cat = new LLViewerInventoryCategory(cat);
-	new_cat->setParent(new_parent_id);
-	new_cat->updateParentOnServer(restamp);
-	model->updateCategory(new_cat);
-	model->notifyObservers();
-}
-
-void remove_category(LLInventoryModel* model, const LLUUID& cat_id)
-{
-	if (!model || !get_is_category_removable(model, cat_id))
-	{
-		return;
-	}
-
-	// Look for any gestures and deactivate them
-	LLInventoryModel::cat_array_t	descendent_categories;
-	LLInventoryModel::item_array_t	descendent_items;
-	gInventory.collectDescendents(cat_id, descendent_categories, descendent_items, FALSE);
-
-	for (LLInventoryModel::item_array_t::const_iterator iter = descendent_items.begin();
-		 iter != descendent_items.end();
-		 ++iter)
-	{
-		const LLViewerInventoryItem* item = (*iter);
-		const LLUUID& item_id = item->getUUID();
-		if (item->getType() == LLAssetType::AT_GESTURE
-			&& LLGestureMgr::instance().isGestureActive(item_id))
-		{
-			LLGestureMgr::instance().deactivateGesture(item_id);
-		}
-	}
-
-	LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
-	if (cat)
-	{
-		const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
-		change_category_parent(model, cat, trash_id, TRUE);
-	}
-}
-
 void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name)
 {
 	LLViewerInventoryCategory* cat;
@@ -211,6 +128,49 @@ void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::s
 	model->notifyObservers();
 }
 
+void copy_inventory_category(LLInventoryModel* model,
+							 LLViewerInventoryCategory* cat,
+							 const LLUUID& parent_id,
+							 const LLUUID& root_copy_id)
+{
+	// Create the initial folder
+	LLUUID new_cat_uuid = gInventory.createNewCategory(parent_id, LLFolderType::FT_NONE, cat->getName());
+	model->notifyObservers();
+	
+	// We need to exclude the initial root of the copy to avoid recursively copying the copy, etc...
+	LLUUID root_id = (root_copy_id.isNull() ? new_cat_uuid : root_copy_id);
+
+	// Get the content of the folder
+	LLInventoryModel::cat_array_t* cat_array;
+	LLInventoryModel::item_array_t* item_array;
+	gInventory.getDirectDescendentsOf(cat->getUUID(),cat_array,item_array);
+
+	// Copy all the items
+	LLInventoryModel::item_array_t item_array_copy = *item_array;
+	for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++)
+	{
+		LLInventoryItem* item = *iter;
+		copy_inventory_item(
+							gAgent.getID(),
+							item->getPermissions().getOwner(),
+							item->getUUID(),
+							new_cat_uuid,
+							std::string(),
+							LLPointer<LLInventoryCallback>(NULL));
+	}
+	
+	// Copy all the folders
+	LLInventoryModel::cat_array_t cat_array_copy = *cat_array;
+	for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
+	{
+		LLViewerInventoryCategory* category = *iter;
+		if (category->getUUID() != root_id)
+		{
+			copy_inventory_category(model, category, new_cat_uuid, root_id);
+		}
+	}
+}
+
 class LLInventoryCollectAllItems : public LLInventoryCollectFunctor
 {
 public:
@@ -530,37 +490,52 @@ void show_item_original(const LLUUID& item_uuid)
 	}
 }
 
-void move_to_outbox_cb(const LLSD& notification, const LLSD& response)
+
+void open_outbox()
 {
-	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-	if (option != 0) return; // canceled
+	LLFloaterReg::showInstance("outbox");
+}
 
-	LLViewerInventoryItem * viitem = gInventory.getItem(notification["payload"]["item_id"].asUUID());
-	LLUUID dest_folder_id = notification["payload"]["dest_folder_id"].asUUID();
+LLUUID create_folder_in_outbox_for_item(LLInventoryItem* item, const LLUUID& destFolderId, S32 operation_id)
+{
+	llassert(item);
+	llassert(destFolderId.notNull());
+
+	LLUUID created_folder_id = gInventory.createNewCategory(destFolderId, LLFolderType::FT_NONE, item->getName());
+	gInventory.notifyObservers();
+
+	LLNotificationsUtil::add("OutboxFolderCreated");
+
+	return created_folder_id;
+}
+
+void move_to_outbox_cb_action(const LLSD& payload)
+{
+	LLViewerInventoryItem * viitem = gInventory.getItem(payload["item_id"].asUUID());
+	LLUUID dest_folder_id = payload["dest_folder_id"].asUUID();
 
 	if (viitem)
 	{	
 		// when moving item directly into outbox create folder with that name
 		if (dest_folder_id == gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false))
 		{
-			dest_folder_id = gInventory.createNewCategory(dest_folder_id,  LLFolderType::FT_NONE, viitem->getName());
-			gInventory.notifyObservers();
+			S32 operation_id = payload["operation_id"].asInteger();
+			dest_folder_id = create_folder_in_outbox_for_item(viitem, dest_folder_id, operation_id);
 		}
 
 		LLUUID parent = viitem->getParentUUID();
 
-		change_item_parent(
-			&gInventory,
+		gInventory.changeItemParent(
 			viitem,
 			dest_folder_id,
 			false);
 
-		LLUUID top_level_folder = notification["payload"]["top_level_folder"].asUUID();
+		LLUUID top_level_folder = payload["top_level_folder"].asUUID();
 
 		if (top_level_folder != LLUUID::null)
 		{
 			LLViewerInventoryCategory* category;
-			
+
 			while (parent.notNull())
 			{
 				LLInventoryModel::cat_array_t* cat_array;
@@ -577,7 +552,7 @@ void move_to_outbox_cb(const LLSD& notification, const LLSD& response)
 
 				if (cat_array->empty() && item_array->empty())
 				{
-					remove_category(&gInventory, parent);
+					gInventory.removeCategory(parent);
 				}
 
 				if (parent == top_level_folder)
@@ -589,42 +564,75 @@ void move_to_outbox_cb(const LLSD& notification, const LLSD& response)
 			}
 		}
 
+		open_outbox();
 	}
 }
 
-
-void copy_item_to_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, const LLUUID& top_level_folder)
+void copy_item_to_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, const LLUUID& top_level_folder, S32 operation_id)
 {
-	if (inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID()))
+	// Collapse links directly to items/folders
+	LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) inv_item;
+	LLViewerInventoryCategory * linked_category = viewer_inv_item->getLinkedCategory();
+	if (linked_category != NULL)
 	{
-		// when moving item directly into outbox create folder with that name
-		if (dest_folder == gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false))
+		copy_folder_to_outbox(linked_category, dest_folder, top_level_folder, operation_id);
+	}
+	else
+	{
+		LLViewerInventoryItem * linked_item = viewer_inv_item->getLinkedItem();
+		if (linked_item != NULL)
 		{
-			dest_folder = gInventory.createNewCategory(dest_folder, LLFolderType::FT_NONE, inv_item->getName());
-			gInventory.notifyObservers();
+			inv_item = (LLInventoryItem *) linked_item;
+		}
+		
+		// Check for copy permissions
+		if (inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID()))
+		{
+			// when moving item directly into outbox create folder with that name
+			if (dest_folder == gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false))
+			{
+				dest_folder = create_folder_in_outbox_for_item(inv_item, dest_folder, operation_id);
+			}
+			
+			copy_inventory_item(gAgent.getID(),
+								inv_item->getPermissions().getOwner(),
+								inv_item->getUUID(),
+								dest_folder,
+								inv_item->getName(),
+								LLPointer<LLInventoryCallback>(NULL));
+
+			open_outbox();
+		}
+		else
+		{
+			LLSD payload;
+			payload["item_id"] = inv_item->getUUID();
+			payload["dest_folder_id"] = dest_folder;
+			payload["top_level_folder"] = top_level_folder;
+			payload["operation_id"] = operation_id;
+			
+			LLMarketplaceInventoryNotifications::addNoCopyNotification(payload, move_to_outbox_cb_action);
 		}
-
-		copy_inventory_item(
-			gAgent.getID(),
-			inv_item->getPermissions().getOwner(),
-			inv_item->getUUID(),
-			dest_folder,
-			inv_item->getName(),
-			LLPointer<LLInventoryCallback>(NULL));
 	}
-	else
-	{	
-		LLSD args;
-		args["ITEM_NAME"] = inv_item->getName();
-		LLSD payload;
-		payload["item_id"] = inv_item->getUUID();
-		payload["dest_folder_id"] = dest_folder;
-		payload["top_level_folder"] = top_level_folder;
-		LLNotificationsUtil::add("ConfirmNoCopyToOutbox", args, payload, boost::bind(&move_to_outbox_cb, _1, _2));
+}
+
+void move_item_within_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, S32 operation_id)
+{
+	// when moving item directly into outbox create folder with that name
+	if (dest_folder == gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false))
+	{
+		dest_folder = create_folder_in_outbox_for_item(inv_item, dest_folder, operation_id);
 	}
+	
+	LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) inv_item;
+
+	gInventory.changeItemParent(
+					   viewer_inv_item,
+					   dest_folder,
+					   false);
 }
 
-void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, const LLUUID& top_level_folder)
+void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, const LLUUID& top_level_folder, S32 operation_id)
 {
 	LLUUID new_folder_id = gInventory.createNewCategory(dest_folder, LLFolderType::FT_NONE, inv_cat->getName());
 	gInventory.notifyObservers();
@@ -639,7 +647,7 @@ void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_fold
 	for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++)
 	{
 		LLInventoryItem* item = *iter;
-		copy_item_to_outbox(item, new_folder_id, top_level_folder);
+		copy_item_to_outbox(item, new_folder_id, top_level_folder, operation_id);
 	}
 
 	LLInventoryModel::cat_array_t cat_array_copy = *cat_array;
@@ -647,14 +655,10 @@ void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_fold
 	for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
 	{
 		LLViewerInventoryCategory* category = *iter;
-		copy_folder_to_outbox(category, new_folder_id, top_level_folder);
+		copy_folder_to_outbox(category, new_folder_id, top_level_folder, operation_id);
 	}
 
-	// delete the folder if we have emptied it
-	//if (cat_array->empty() && item_array->empty())
-	//{
-	//	remove_category(inventory_model, inv_cat->getUUID());
-	//}
+	open_outbox();
 }
 
 ///----------------------------------------------------------------------------
@@ -944,20 +948,24 @@ void LLSaveFolderState::setApply(BOOL apply)
 void LLSaveFolderState::doFolder(LLFolderViewFolder* folder)
 {
 	LLMemType mt(LLMemType::MTYPE_INVENTORY_DO_FOLDER);
+	LLInvFVBridge* bridge = (LLInvFVBridge*)folder->getListener();
+	if(!bridge) return;
+	
 	if(mApply)
 	{
 		// we're applying the open state
-		LLInvFVBridge* bridge = (LLInvFVBridge*)folder->getListener();
-		if(!bridge) return;
 		LLUUID id(bridge->getUUID());
 		if(mOpenFolders.find(id) != mOpenFolders.end())
 		{
-			folder->setOpen(TRUE);
+			if (!folder->isOpen())
+			{
+				folder->setOpen(TRUE);
+			}
 		}
 		else
 		{
 			// keep selected filter in its current state, this is less jarring to user
-			if (!folder->isSelected())
+			if (!folder->isSelected() && folder->isOpen())
 			{
 				folder->setOpen(FALSE);
 			}
@@ -968,8 +976,6 @@ void LLSaveFolderState::doFolder(LLFolderViewFolder* folder)
 		// we're recording state at this point
 		if(folder->isOpen())
 		{
-			LLInvFVBridge* bridge = (LLInvFVBridge*)folder->getListener();
-			if(!bridge) return;
 			mOpenFolders.insert(bridge->getUUID());
 		}
 	}
@@ -1005,7 +1011,6 @@ void LLSelectFirstFilteredItem::doItem(LLFolderViewItem *item)
 		{
 			item->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
 		}
-		item->getRoot()->scrollToShowSelection();
 		mItemSelected = TRUE;
 	}
 }
@@ -1019,7 +1024,6 @@ void LLSelectFirstFilteredItem::doFolder(LLFolderViewFolder* folder)
 		{
 			folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
 		}
-		folder->getRoot()->scrollToShowSelection();
 		mItemSelected = TRUE;
 	}
 }
diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h
index 7b452537f83b039ed4d898de95c9ddadd3c42e2d..5cf9c528b01057ad0095a48f032ee286a7beb0bf 100644
--- a/indra/newview/llinventoryfunctions.h
+++ b/indra/newview/llinventoryfunctions.h
@@ -57,26 +57,17 @@ void show_task_item_profile(const LLUUID& item_uuid, const LLUUID& object_id);
 
 void show_item_original(const LLUUID& item_uuid);
 
-void change_item_parent(LLInventoryModel* model,
-									 LLViewerInventoryItem* item,
-									 const LLUUID& new_parent_id,
-									 BOOL restamp);
-
-void change_category_parent(LLInventoryModel* model,
-	LLViewerInventoryCategory* cat,
-	const LLUUID& new_parent_id,
-	BOOL restamp);
-
-void remove_category(LLInventoryModel* model, const LLUUID& cat_id);
-
 void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name);
 
+void copy_inventory_category(LLInventoryModel* model, LLViewerInventoryCategory* cat, const LLUUID& parent_id, const LLUUID& root_copy_id = LLUUID::null);
+
 // Generates a string containing the path to the item specified by item_id.
 void append_path(const LLUUID& id, std::string& path);
 
-void copy_item_to_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, const LLUUID& top_level_folder);
+void copy_item_to_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, const LLUUID& top_level_folder, S32 operation_id);
+void move_item_within_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, S32 operation_id);
 
-void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, const LLUUID& top_level_folder);
+void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, const LLUUID& top_level_folder, S32 operation_id);
 
 /**                    Miscellaneous global functions
  **                                                                            **
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index dc25689fa3f58391df5d24512a7c15846797ee82..85ecb133d07eefea4624693663a7f92dc71a37e1 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -30,6 +30,7 @@
 #include "llagent.h"
 #include "llagentwearables.h"
 #include "llappearancemgr.h"
+#include "llclipboard.h"
 #include "llinventorypanel.h"
 #include "llinventorybridge.h"
 #include "llinventoryfunctions.h"
@@ -46,6 +47,8 @@
 #include "llviewerregion.h"
 #include "llcallbacklist.h"
 #include "llvoavatarself.h"
+#include "llgesturemgr.h"
+#include <typeinfo>
 
 //#define DIFF_INVENTORY_FILES
 #ifdef DIFF_INVENTORY_FILES
@@ -217,6 +220,38 @@ const LLViewerInventoryCategory *LLInventoryModel::getFirstNondefaultParent(cons
 	return NULL;
 }
 
+//
+// Search up the parent chain until we get to the specified parent, then return the first child category under it
+//
+const LLViewerInventoryCategory* LLInventoryModel::getFirstDescendantOf(const LLUUID& master_parent_id, const LLUUID& obj_id) const
+{
+	if (master_parent_id == obj_id)
+	{
+		return NULL;
+	}
+
+	const LLViewerInventoryCategory* current_cat = getCategory(obj_id);
+
+	if (current_cat == NULL)
+	{
+		current_cat = getCategory(getObject(obj_id)->getParentUUID());
+	}
+	
+	while (current_cat != NULL)
+	{
+		const LLUUID& current_parent_id = current_cat->getParentUUID();
+		
+		if (current_parent_id == master_parent_id)
+		{
+			return current_cat;
+		}
+		
+		current_cat = getCategory(current_parent_id);
+	}
+
+	return NULL;
+}
+
 // Get the object by id. Returns NULL if not found.
 LLInventoryObject* LLInventoryModel::getObject(const LLUUID& id) const
 {
@@ -377,14 +412,67 @@ const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType prefe
 	return rv;
 }
 
+class LLCreateInventoryCategoryResponder : public LLHTTPClient::Responder
+{
+public:
+	LLCreateInventoryCategoryResponder(LLInventoryModel* model, 
+									   void (*callback)(const LLSD&, void*),
+									   void* user_data) :
+										mModel(model),
+										mCallback(callback), 
+										mData(user_data) 
+	{
+	}
+	
+	virtual void error(U32 status, const std::string& reason)
+	{
+		LL_WARNS("InvAPI") << "CreateInventoryCategory failed.   status = " << status << ", reasion = \"" << reason << "\"" << LL_ENDL;
+	}
+	
+	virtual void result(const LLSD& content)
+	{
+		//Server has created folder.
+		
+		LLUUID category_id = content["folder_id"].asUUID();
+		
+		
+		// Add the category to the internal representation
+		LLPointer<LLViewerInventoryCategory> cat =
+		new LLViewerInventoryCategory( category_id, 
+									  content["parent_id"].asUUID(),
+									  (LLFolderType::EType)content["type"].asInteger(),
+									  content["name"].asString(), 
+									  gAgent.getID() );
+		cat->setVersion(LLViewerInventoryCategory::VERSION_INITIAL);
+		cat->setDescendentCount(0);
+		LLInventoryModel::LLCategoryUpdate update(cat->getParentUUID(), 1);
+		mModel->accountForUpdate(update);
+		mModel->updateCategory(cat);
+		
+		if (mCallback && mData)
+		{
+			mCallback(content, mData);
+		}
+		
+	}
+	
+private:
+	void (*mCallback)(const LLSD&, void*);
+	void* mData;
+	LLInventoryModel* mModel;
+};
+
 // Convenience function to create a new category. You could call
 // updateCategory() with a newly generated UUID category, but this
 // version will take care of details like what the name should be
 // based on preferred type. Returns the UUID of the new category.
 LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id,
 										   LLFolderType::EType preferred_type,
-										   const std::string& pname)
+										   const std::string& pname,
+										   void (*callback)(const LLSD&, void*),	//Default to NULL
+										   void* user_data)							//Default to NULL
 {
+	
 	LLUUID id;
 	if(!isInventoryUsable())
 	{
@@ -408,6 +496,35 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id,
 	{
 		name.assign(LLViewerFolderType::lookupNewCategoryName(preferred_type));
 	}
+	
+	if ( callback && user_data )  //callback required for acked message.
+	{
+		LLViewerRegion* viewer_region = gAgent.getRegion();
+		std::string url;
+		if ( viewer_region )
+			url = viewer_region->getCapability("CreateInventoryCategory");
+		
+		if (!url.empty())
+		{
+			//Let's use the new capability.
+			
+			LLSD request, body;
+			body["folder_id"] = id;
+			body["parent_id"] = parent_id;
+			body["type"] = (LLSD::Integer) preferred_type;
+			body["name"] = name;
+			
+			request["message"] = "CreateInventoryCategory";
+			request["payload"] = body;
+			
+	//		viewer_region->getCapAPI().post(request);
+			LLHTTPClient::post(
+							   url,
+							   body,
+							   new LLCreateInventoryCategoryResponder(this, callback, user_data) );
+			return LLUUID::null;
+		}
+	}
 
 	// Add the category to the internal representation
 	LLPointer<LLViewerInventoryCategory> cat =
@@ -903,6 +1020,66 @@ void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id)
 	}
 }
 
+// Migrated from llinventoryfunctions
+void LLInventoryModel::changeItemParent(LLViewerInventoryItem* item,
+										const LLUUID& new_parent_id,
+										BOOL restamp)
+{
+	if (item->getParentUUID() == new_parent_id)
+	{
+		LL_DEBUGS("Inventory") << "'" << item->getName() << "' (" << item->getUUID()
+							   << ") is already in folder " << new_parent_id << LL_ENDL;
+	}
+	else
+	{
+		LL_INFOS("Inventory") << "Moving '" << item->getName() << "' (" << item->getUUID()
+							  << ") from " << item->getParentUUID() << " to folder "
+							  << new_parent_id << LL_ENDL;
+		LLInventoryModel::update_list_t update;
+		LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
+		update.push_back(old_folder);
+		LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
+		update.push_back(new_folder);
+		accountForUpdate(update);
+
+		LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+		new_item->setParent(new_parent_id);
+		new_item->updateParentOnServer(restamp);
+		updateItem(new_item);
+		notifyObservers();
+	}
+}
+
+// Migrated from llinventoryfunctions
+void LLInventoryModel::changeCategoryParent(LLViewerInventoryCategory* cat,
+											const LLUUID& new_parent_id,
+											BOOL restamp)
+{
+	if (!cat)
+	{
+		return;
+	}
+
+	// Can't move a folder into a child of itself.
+	if (isObjectDescendentOf(new_parent_id, cat->getUUID()))
+	{
+		return;
+	}
+
+	LLInventoryModel::update_list_t update;
+	LLInventoryModel::LLCategoryUpdate old_folder(cat->getParentUUID(), -1);
+	update.push_back(old_folder);
+	LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
+	update.push_back(new_folder);
+	accountForUpdate(update);
+
+	LLPointer<LLViewerInventoryCategory> new_cat = new LLViewerInventoryCategory(cat);
+	new_cat->setParent(new_parent_id);
+	new_cat->updateParentOnServer(restamp);
+	updateCategory(new_cat);
+	notifyObservers();
+}
+
 // Delete a particular inventory object by ID.
 void LLInventoryModel::deleteObject(const LLUUID& id)
 {
@@ -996,50 +1173,82 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id)
 		return;
 	}
 	LLPointer<LLViewerInventoryCategory> cat = getCategory(id);
-	if(cat.notNull())
-	{
-		// do the cache accounting
-		llinfos << "LLInventoryModel::purgeDescendentsOf " << cat->getName()
-				<< llendl;
-		S32 descendents = cat->getDescendentCount();
-		if(descendents > 0)
-		{
-			LLCategoryUpdate up(id, -descendents);
-			accountForUpdate(up);
+	if (cat.notNull())
+	{
+		if (LLClipboard::instance().hasContents() && LLClipboard::instance().isCutMode())
+		{
+			// Something on the clipboard is in "cut mode" and needs to be preserved
+			llinfos << "LLInventoryModel::purgeDescendentsOf " << cat->getName()
+			<< " iterate and purge non hidden items" << llendl;
+			cat_array_t* categories;
+			item_array_t* items;
+			// Get the list of direct descendants in tha categoy passed as argument
+			getDirectDescendentsOf(id, categories, items);
+			std::vector<LLUUID> list_uuids;
+			// Make a unique list with all the UUIDs of the direct descendants (items and categories are not treated differently)
+			// Note: we need to do that shallow copy as purging things will invalidate the categories or items lists
+			for (cat_array_t::const_iterator it = categories->begin(); it != categories->end(); ++it)
+			{
+				list_uuids.push_back((*it)->getUUID());
+			}
+			for (item_array_t::const_iterator it = items->begin(); it != items->end(); ++it)
+			{
+				list_uuids.push_back((*it)->getUUID());
+			}
+			// Iterate through the list and only purge the UUIDs that are not on the clipboard
+			for (std::vector<LLUUID>::const_iterator it = list_uuids.begin(); it != list_uuids.end(); ++it)
+			{
+				if (!LLClipboard::instance().isOnClipboard(*it))
+				{
+					purgeObject(*it);
+				}
+			}
 		}
+		else
+		{
+			// Fast purge
+			// do the cache accounting
+			llinfos << "LLInventoryModel::purgeDescendentsOf " << cat->getName()
+				<< llendl;
+			S32 descendents = cat->getDescendentCount();
+			if(descendents > 0)
+			{
+				LLCategoryUpdate up(id, -descendents);
+				accountForUpdate(up);
+			}
 
-		// we know that descendent count is 0, aide since the
-		// accounting may actually not do an update, we should force
-		// it here.
-		cat->setDescendentCount(0);
+			// we know that descendent count is 0, however since the
+			// accounting may actually not do an update, we should force
+			// it here.
+			cat->setDescendentCount(0);
+
+			// send it upstream
+			LLMessageSystem* msg = gMessageSystem;
+			msg->newMessage("PurgeInventoryDescendents");
+			msg->nextBlock("AgentData");
+			msg->addUUID("AgentID", gAgent.getID());
+			msg->addUUID("SessionID", gAgent.getSessionID());
+			msg->nextBlock("InventoryData");
+			msg->addUUID("FolderID", id);
+			gAgent.sendReliableMessage();
 
-		// send it upstream
-		LLMessageSystem* msg = gMessageSystem;
-		msg->newMessage("PurgeInventoryDescendents");
-		msg->nextBlock("AgentData");
-		msg->addUUID("AgentID", gAgent.getID());
-		msg->addUUID("SessionID", gAgent.getSessionID());
-		msg->nextBlock("InventoryData");
-		msg->addUUID("FolderID", id);
-		gAgent.sendReliableMessage();
-
-		// unceremoniously remove anything we have locally stored.
-		cat_array_t categories;
-		item_array_t items;
-		collectDescendents(id,
-						   categories,
-						   items,
-						   INCLUDE_TRASH);
-		S32 count = items.count();
-		S32 i;
-		for(i = 0; i < count; ++i)
-		{
-			deleteObject(items.get(i)->getUUID());
-		}
-		count = categories.count();
-		for(i = 0; i < count; ++i)
-		{
-			deleteObject(categories.get(i)->getUUID());
+			// unceremoniously remove anything we have locally stored.
+			cat_array_t categories;
+			item_array_t items;
+			collectDescendents(id,
+							   categories,
+							   items,
+							   INCLUDE_TRASH);
+			S32 count = items.count();
+			for(S32 i = 0; i < count; ++i)
+			{
+				deleteObject(items.get(i)->getUUID());
+			}
+			count = categories.count();
+			for(S32 i = 0; i < count; ++i)
+			{
+				deleteObject(categories.get(i)->getUUID());
+			}
 		}
 	}
 }
@@ -1087,7 +1296,6 @@ void LLInventoryModel::notifyObservers()
 		 iter != mObservers.end(); )
 	{
 		LLInventoryObserver* observer = *iter;
-		
 		observer->changed(mModifyMask);
 
 		// safe way to increment since changed may delete entries! (@!##%@!@&*!)
@@ -2574,7 +2782,7 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**)
 				<< titem->getParentUUID() << llendl;
 		U32 callback_id;
 		msg->getU32Fast(_PREHASH_ItemData, _PREHASH_CallbackID, callback_id);
-		if(titem->getUUID().notNull())
+		if(titem->getUUID().notNull() ) // && callback_id.notNull() )
 		{
 			items.push_back(titem);
 			cblist.push_back(InventoryCallbackInfo(callback_id, titem->getUUID()));
@@ -2818,21 +3026,77 @@ void LLInventoryModel::emptyFolderType(const std::string notification, LLFolderT
 void LLInventoryModel::removeItem(const LLUUID& item_id)
 {
 	LLViewerInventoryItem* item = getItem(item_id);
-	const LLUUID new_parent = findCategoryUUIDForType(LLFolderType::FT_TRASH);
-	if (item && item->getParentUUID() != new_parent)
+	if (! item)
 	{
-		LLInventoryModel::update_list_t update;
-		LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
-		update.push_back(old_folder);
-		LLInventoryModel::LLCategoryUpdate new_folder(new_parent, 1);
-		update.push_back(new_folder);
-		accountForUpdate(update);
+		LL_WARNS("Inventory") << "couldn't find inventory item " << item_id << LL_ENDL;
+	}
+	else
+	{
+		const LLUUID new_parent = findCategoryUUIDForType(LLFolderType::FT_TRASH);
+		if (new_parent.notNull())
+		{
+			LL_INFOS("Inventory") << "Moving to Trash (" << new_parent << "):" << LL_ENDL;
+			changeItemParent(item, new_parent, TRUE);
+		}
+	}
+}
 
-		LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
-		new_item->setParent(new_parent);
-		new_item->updateParentOnServer(TRUE);
-		updateItem(new_item);
-		notifyObservers();
+void LLInventoryModel::removeCategory(const LLUUID& category_id)
+{
+	if (! get_is_category_removable(this, category_id))
+	{
+		return;
+	}
+
+	// Look for any gestures and deactivate them
+	LLInventoryModel::cat_array_t	descendent_categories;
+	LLInventoryModel::item_array_t	descendent_items;
+	collectDescendents(category_id, descendent_categories, descendent_items, FALSE);
+
+	for (LLInventoryModel::item_array_t::const_iterator iter = descendent_items.begin();
+		 iter != descendent_items.end();
+		 ++iter)
+	{
+		const LLViewerInventoryItem* item = (*iter);
+		const LLUUID& item_id = item->getUUID();
+		if (item->getType() == LLAssetType::AT_GESTURE
+			&& LLGestureMgr::instance().isGestureActive(item_id))
+		{
+			LLGestureMgr::instance().deactivateGesture(item_id);
+		}
+	}
+
+	LLViewerInventoryCategory* cat = getCategory(category_id);
+	if (cat)
+	{
+		const LLUUID trash_id = findCategoryUUIDForType(LLFolderType::FT_TRASH);
+		if (trash_id.notNull())
+		{
+			changeCategoryParent(cat, trash_id, TRUE);
+		}
+	}
+}
+
+void LLInventoryModel::removeObject(const LLUUID& object_id)
+{
+	LLInventoryObject* obj = getObject(object_id);
+	if (dynamic_cast<LLViewerInventoryItem*>(obj))
+	{
+		removeItem(object_id);
+	}
+	else if (dynamic_cast<LLViewerInventoryCategory*>(obj))
+	{
+		removeCategory(object_id);
+	}
+	else if (obj)
+	{
+		LL_WARNS("Inventory") << "object ID " << object_id
+							  << " is an object of unrecognized class "
+							  << typeid(*obj).name() << LL_ENDL;
+	}
+	else
+	{
+		LL_WARNS("Inventory") << "object ID " << object_id << " not found" << LL_ENDL;
 	}
 }
 
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index a0fd455cf3b75d8131734ff5fabd2542eeff367b..8382e875b48690a67c87feefa92ea03747aac248 100644
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -64,6 +64,7 @@ class LLInventoryCollectFunctor;
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 class LLInventoryModel
 {
+	LOG_CLASS(LLInventoryModel);
 public:
 	friend class LLInventoryModelFetchDescendentsResponder;
 
@@ -238,6 +239,9 @@ class LLInventoryModel
 	
 	// Get whatever special folder this object is a child of, if any.
 	const LLViewerInventoryCategory *getFirstNondefaultParent(const LLUUID& obj_id) const;
+	
+	// Get first descendant of the child object under the specified parent
+	const LLViewerInventoryCategory *getFirstDescendantOf(const LLUUID& master_parent_id, const LLUUID& obj_id) const;
 
 	// Get the object by id. Returns NULL if not found.
 	//   NOTE: Use the pointer returned for read operations - do
@@ -302,6 +306,16 @@ class LLInventoryModel
 	// observer notification, or server update is performed.
 	void moveObject(const LLUUID& object_id, const LLUUID& cat_id);
 
+	// Migrated from llinventoryfunctions
+	void changeItemParent(LLViewerInventoryItem* item,
+						  const LLUUID& new_parent_id,
+						  BOOL restamp);
+
+	// Migrated from llinventoryfunctions
+	void changeCategoryParent(LLViewerInventoryCategory* cat,
+							  const LLUUID& new_parent_id,
+							  BOOL restamp);
+
 	//--------------------------------------------------------------------
 	// Delete
 	//--------------------------------------------------------------------
@@ -311,8 +325,13 @@ class LLInventoryModel
 	// consistent internal state. No cache accounting, observer
 	// notification, or server update is performed.
 	void deleteObject(const LLUUID& id);
+	/// move Item item_id to Trash
 	void removeItem(const LLUUID& item_id);
-	
+	/// move Category category_id to Trash
+	void removeCategory(const LLUUID& category_id);
+	/// removeItem() or removeCategory(), whichever is appropriate
+	void removeObject(const LLUUID& object_id);
+
 	// Delete a particular inventory object by ID, and delete it from
 	// the server. Also updates linked items.
 	void purgeObject(const LLUUID& id);
@@ -360,7 +379,9 @@ class LLInventoryModel
 	// name based on type, pass in a NULL to the 'name' parameter.
 	LLUUID createNewCategory(const LLUUID& parent_id,
 							 LLFolderType::EType preferred_type,
-							 const std::string& name);
+							 const std::string& name,
+							 void (*callback)(const LLSD&, void*) = NULL,
+							 void* user_data = NULL );
 protected:
 	// Internal methods that add inventory and make sure that all of
 	// the internal data structures are consistent. These methods
@@ -411,7 +432,7 @@ class LLInventoryModel
 	// Return (yes/no/maybe) child status of category children.
 	EHasChildren categoryHasChildren(const LLUUID& cat_id) const;
 
-	// Returns true iff category version is known and theoretical
+	// Returns true if category version is known and theoretical
 	// descendents == actual descendents.
 	bool isCategoryComplete(const LLUUID& cat_id) const;
 	
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
index 91fdd678063195234545c8c16e83cc5d6758f17c..f4d0110b0f478114b74ea91d7fb3ed635355713a 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.cpp
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -43,6 +43,7 @@ const S32 MAX_FETCH_RETRIES = 10;
 
 LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch() :
 	mBackgroundFetchActive(FALSE),
+	mFolderFetchActive(false),
 	mAllFoldersFetched(FALSE),
 	mRecursiveInventoryFetchStarted(FALSE),
 	mRecursiveLibraryFetchStarted(FALSE),
@@ -50,7 +51,7 @@ LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch() :
 	mMinTimeBetweenFetches(0.3f),
 	mMaxTimeBetweenFetches(10.f),
 	mTimelyFetchPending(FALSE),
-	mBulkFetchCount(0)
+	mFetchCount(0)
 {
 }
 
@@ -60,7 +61,7 @@ LLInventoryModelBackgroundFetch::~LLInventoryModelBackgroundFetch()
 
 bool LLInventoryModelBackgroundFetch::isBulkFetchProcessingComplete() const
 {
-	return mFetchQueue.empty() && mBulkFetchCount<=0;
+	return mFetchQueue.empty() && mFetchCount<=0;
 }
 
 bool LLInventoryModelBackgroundFetch::libraryFetchStarted() const
@@ -98,19 +99,21 @@ bool LLInventoryModelBackgroundFetch::isEverythingFetched() const
 	return mAllFoldersFetched;
 }
 
-BOOL LLInventoryModelBackgroundFetch::backgroundFetchActive() const
+BOOL LLInventoryModelBackgroundFetch::folderFetchActive() const
 {
-	return mBackgroundFetchActive;
+	return mFolderFetchActive;
 }
 
-void LLInventoryModelBackgroundFetch::start(const LLUUID& cat_id, BOOL recursive)
+void LLInventoryModelBackgroundFetch::start(const LLUUID& id, BOOL recursive)
 {
-	if (!mAllFoldersFetched || cat_id.notNull())
-	{
-		LL_DEBUGS("InventoryFetch") << "Start fetching category: " << cat_id << ", recursive: " << recursive << LL_ENDL;
+	LLViewerInventoryCategory* cat = gInventory.getCategory(id);
+	if (cat || (id.isNull() && !isEverythingFetched()))
+	{	// it's a folder, do a bulk fetch
+		LL_DEBUGS("InventoryFetch") << "Start fetching category: " << id << ", recursive: " << recursive << LL_ENDL;
 
 		mBackgroundFetchActive = TRUE;
-		if (cat_id.isNull())
+		mFolderFetchActive = true;
+		if (id.isNull())
 		{
 			if (!mRecursiveInventoryFetchStarted)
 			{
@@ -128,41 +131,41 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& cat_id, BOOL recursive
 		else
 		{
 			// Specific folder requests go to front of queue.
-			if (mFetchQueue.empty() || mFetchQueue.front().mCatUUID != cat_id)
+			if (mFetchQueue.empty() || mFetchQueue.front().mUUID != id)
 			{
-				mFetchQueue.push_front(FetchQueueInfo(cat_id, recursive));
+				mFetchQueue.push_front(FetchQueueInfo(id, recursive));
 				gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
 			}
-			if (cat_id == gInventory.getLibraryRootFolderID())
+			if (id == gInventory.getLibraryRootFolderID())
 			{
 				mRecursiveLibraryFetchStarted |= recursive;
 			}
-			if (cat_id == gInventory.getRootFolderID())
+			if (id == gInventory.getRootFolderID())
 			{
 				mRecursiveInventoryFetchStarted |= recursive;
 			}
 		}
 	}
+	else if (LLViewerInventoryItem* itemp = gInventory.getItem(id))
+	{
+		if (!itemp->mIsComplete && (mFetchQueue.empty() || mFetchQueue.front().mUUID != id))
+		{
+			mBackgroundFetchActive = TRUE;
+
+			mFetchQueue.push_front(FetchQueueInfo(id, false, false));
+			gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
+		}
+	}
 }
 
 void LLInventoryModelBackgroundFetch::findLostItems()
 {
 	mBackgroundFetchActive = TRUE;
+	mFolderFetchActive = true;
     mFetchQueue.push_back(FetchQueueInfo(LLUUID::null, TRUE));
     gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
 }
 
-void LLInventoryModelBackgroundFetch::stopBackgroundFetch()
-{
-	if (mBackgroundFetchActive)
-	{
-		mBackgroundFetchActive = FALSE;
-		gIdleCallbacks.deleteFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
-		mBulkFetchCount=0;
-		mMinTimeBetweenFetches=0.0f;
-	}
-}
-
 void LLInventoryModelBackgroundFetch::setAllFoldersFetched()
 {
 	if (mRecursiveInventoryFetchStarted &&
@@ -170,7 +173,7 @@ void LLInventoryModelBackgroundFetch::setAllFoldersFetched()
 	{
 		mAllFoldersFetched = TRUE;
 	}
-	stopBackgroundFetch();
+	mFolderFetchActive = false;
 }
 
 void LLInventoryModelBackgroundFetch::backgroundFetchCB(void *)
@@ -183,10 +186,9 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
 	if (mBackgroundFetchActive && gAgent.getRegion())
 	{
 		// If we'll be using the capability, we'll be sending batches and the background thing isn't as important.
-		std::string url = gAgent.getRegion()->getCapability("FetchInventoryDescendents2");   
-		if (gSavedSettings.getBOOL("UseHTTPInventory") && !url.empty()) 
+		if (gSavedSettings.getBOOL("UseHTTPInventory")) 
 		{
-			bulkFetch(url);
+			bulkFetch();
 			return;
 		}
 		
@@ -201,6 +203,9 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
 			llinfos << "Inventory fetch completed" << llendl;
 
 			setAllFoldersFetched();
+			mBackgroundFetchActive = false;
+			mFolderFetchActive = false;
+
 			return;
 		}
 
@@ -230,80 +235,114 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
 			}
 
 			const FetchQueueInfo info = mFetchQueue.front();
-			LLViewerInventoryCategory* cat = gInventory.getCategory(info.mCatUUID);
 
-			// Category has been deleted, remove from queue.
-			if (!cat)
+			if (info.mIsCategory)
 			{
-				mFetchQueue.pop_front();
-				continue;
-			}
+
+				LLViewerInventoryCategory* cat = gInventory.getCategory(info.mUUID);
+
+				// Category has been deleted, remove from queue.
+				if (!cat)
+				{
+					mFetchQueue.pop_front();
+					continue;
+				}
 			
-			if (mFetchTimer.getElapsedTimeF32() > mMinTimeBetweenFetches && 
-				LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion())
-			{
-				// Category exists but has no children yet, fetch the descendants
-				// for now, just request every time and rely on retry timer to throttle.
-				if (cat->fetch())
+				if (mFetchTimer.getElapsedTimeF32() > mMinTimeBetweenFetches && 
+					LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion())
 				{
-					mFetchTimer.reset();
-					mTimelyFetchPending = TRUE;
+					// Category exists but has no children yet, fetch the descendants
+					// for now, just request every time and rely on retry timer to throttle.
+					if (cat->fetch())
+					{
+						mFetchTimer.reset();
+						mTimelyFetchPending = TRUE;
+					}
+					else
+					{
+						//  The catagory also tracks if it has expired and here it says it hasn't
+						//  yet.  Get out of here because nothing is going to happen until we
+						//  update the timers.
+						break;
+					}
 				}
-				else
+				// Do I have all my children?
+				else if (gInventory.isCategoryComplete(info.mUUID))
 				{
-					//  The catagory also tracks if it has expired and here it says it hasn't
-					//  yet.  Get out of here because nothing is going to happen until we
-					//  update the timers.
+					// Finished with this category, remove from queue.
+					mFetchQueue.pop_front();
+
+					// Add all children to queue.
+					LLInventoryModel::cat_array_t* categories;
+					LLInventoryModel::item_array_t* items;
+					gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items);
+					for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin();
+						 it != categories->end();
+						 ++it)
+					{
+						mFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(),info.mRecursive));
+					}
+
+					// We received a response in less than the fast time.
+					if (mTimelyFetchPending && mFetchTimer.getElapsedTimeF32() < fast_fetch_time)
+					{
+						// Shrink timeouts based on success.
+						mMinTimeBetweenFetches = llmax(mMinTimeBetweenFetches * 0.8f, 0.3f);
+						mMaxTimeBetweenFetches = llmax(mMaxTimeBetweenFetches * 0.8f, 10.f);
+						lldebugs << "Inventory fetch times shrunk to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << llendl;
+					}
+
+					mTimelyFetchPending = FALSE;
+					continue;
+				}
+				else if (mFetchTimer.getElapsedTimeF32() > mMaxTimeBetweenFetches)
+				{
+					// Received first packet, but our num descendants does not match db's num descendants
+					// so try again later.
+					mFetchQueue.pop_front();
+
+					if (mNumFetchRetries++ < MAX_FETCH_RETRIES)
+					{
+						// push on back of queue
+						mFetchQueue.push_back(info);
+					}
+					mTimelyFetchPending = FALSE;
+					mFetchTimer.reset();
 					break;
 				}
+
+				// Not enough time has elapsed to do a new fetch
+				break;
 			}
-			// Do I have all my children?
-			else if (gInventory.isCategoryComplete(info.mCatUUID))
+			else
 			{
-				// Finished with this category, remove from queue.
-				mFetchQueue.pop_front();
+				LLViewerInventoryItem* itemp = gInventory.getItem(info.mUUID);
 
-				// Add all children to queue.
-				LLInventoryModel::cat_array_t* categories;
-				LLInventoryModel::item_array_t* items;
-				gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items);
-				for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin();
-					 it != categories->end();
-					 ++it)
+				mFetchQueue.pop_front();
+				if (!itemp) 
 				{
-					mFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(),info.mRecursive));
+					continue;
 				}
 
-				// We received a response in less than the fast time.
-				if (mTimelyFetchPending && mFetchTimer.getElapsedTimeF32() < fast_fetch_time)
+				if (mFetchTimer.getElapsedTimeF32() > mMinTimeBetweenFetches)
 				{
-					// Shrink timeouts based on success.
-					mMinTimeBetweenFetches = llmax(mMinTimeBetweenFetches * 0.8f, 0.3f);
-					mMaxTimeBetweenFetches = llmax(mMaxTimeBetweenFetches * 0.8f, 10.f);
-					lldebugs << "Inventory fetch times shrunk to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << llendl;
+					itemp->fetchFromServer();
+					mFetchTimer.reset();
+					mTimelyFetchPending = TRUE;
 				}
-
-				mTimelyFetchPending = FALSE;
-				continue;
-			}
-			else if (mFetchTimer.getElapsedTimeF32() > mMaxTimeBetweenFetches)
-			{
-				// Received first packet, but our num descendants does not match db's num descendants
-				// so try again later.
-				mFetchQueue.pop_front();
-
-				if (mNumFetchRetries++ < MAX_FETCH_RETRIES)
+				else if (itemp->mIsComplete)
+				{
+					mTimelyFetchPending = FALSE;
+				}
+				else if (mFetchTimer.getElapsedTimeF32() > mMaxTimeBetweenFetches)
 				{
-					// push on back of queue
 					mFetchQueue.push_back(info);
+					mFetchTimer.reset();
+					mTimelyFetchPending = FALSE;
 				}
-				mTimelyFetchPending = FALSE;
-				mFetchTimer.reset();
+				// Not enough time has elapsed to do a new fetch
 				break;
 			}
-
-			// Not enough time has elapsed to do a new fetch
-			break;
 		}
 
 		//
@@ -313,15 +352,35 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
 	}
 }
 
-void LLInventoryModelBackgroundFetch::incrBulkFetch(S16 fetching) 
+void LLInventoryModelBackgroundFetch::incrFetchCount(S16 fetching) 
 {  
-	mBulkFetchCount += fetching; 
-	if (mBulkFetchCount < 0)
+	mFetchCount += fetching; 
+	if (mFetchCount < 0)
 	{
-		mBulkFetchCount = 0; 
+		mFetchCount = 0; 
 	}
 }
 
+class LLInventoryModelFetchItemResponder : public LLInventoryModel::fetchInventoryResponder
+{
+public:
+	LLInventoryModelFetchItemResponder(const LLSD& request_sd) : LLInventoryModel::fetchInventoryResponder(request_sd) {};
+	void result(const LLSD& content);			
+	void error(U32 status, const std::string& reason);
+};
+
+void LLInventoryModelFetchItemResponder::result( const LLSD& content )
+{
+	LLInventoryModel::fetchInventoryResponder::result(content);
+	LLInventoryModelBackgroundFetch::instance().incrFetchCount(-1);
+}
+
+void LLInventoryModelFetchItemResponder::error( U32 status, const std::string& reason )
+{
+	LLInventoryModel::fetchInventoryResponder::error(status, reason);
+	LLInventoryModelBackgroundFetch::instance().incrFetchCount(-1);
+}
+
 
 class LLInventoryModelFetchDescendentsResponder: public LLHTTPClient::Responder
 {
@@ -458,7 +517,7 @@ void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content)
 		}
 	}
 
-	fetcher->incrBulkFetch(-1);
+	fetcher->incrFetchCount(-1);
 	
 	if (fetcher->isBulkFetchProcessingComplete())
 	{
@@ -477,7 +536,7 @@ void LLInventoryModelFetchDescendentsResponder::error(U32 status, const std::str
 	llinfos << "LLInventoryModelFetchDescendentsResponder::error "
 		<< status << ": " << reason << llendl;
 						
-	fetcher->incrBulkFetch(-1);
+	fetcher->incrFetchCount(-1);
 
 	if (status==499) // timed out
 	{
@@ -508,12 +567,13 @@ BOOL LLInventoryModelFetchDescendentsResponder::getIsRecursive(const LLUUID& cat
 
 // Bundle up a bunch of requests to send all at once.
 // static   
-void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
+void LLInventoryModelBackgroundFetch::bulkFetch()
 {
 	//Background fetch is called from gIdleCallbacks in a loop until background fetch is stopped.
 	//If there are items in mFetchQueue, we want to check the time since the last bulkFetch was 
 	//sent.  If it exceeds our retry time, go ahead and fire off another batch.  
-	//Stopbackgroundfetch will be run from the Responder instead of here.  
+	LLViewerRegion* region = gAgent.getRegion();
+	if (!region) return;
 
 	S16 max_concurrent_fetches=8;
 	F32 new_min_time = 0.5f;			//HACK!  Clean this up when old code goes away entirely.
@@ -523,12 +583,13 @@ void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
 	}
 	
 	if (gDisconnected ||
-		(mBulkFetchCount > max_concurrent_fetches) ||
+		(mFetchCount > max_concurrent_fetches) ||
 		(mFetchTimer.getElapsedTimeF32() < mMinTimeBetweenFetches))
 	{
 		return; // just bail if we are disconnected
 	}	
 
+	U32 item_count=0;
 	U32 folder_count=0;
 	U32 max_batch_size=5;
 
@@ -536,83 +597,159 @@ void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
 
 	uuid_vec_t recursive_cats;
 
-	LLSD body;
-	LLSD body_lib;
+	LLSD folder_request_body;
+	LLSD folder_request_body_lib;
+	LLSD item_request_body;
+	LLSD item_request_body_lib;
 
-	while (!(mFetchQueue.empty()) && (folder_count < max_batch_size))
+	while (!mFetchQueue.empty() 
+			&& (item_count + folder_count) < max_batch_size)
 	{
 		const FetchQueueInfo& fetch_info = mFetchQueue.front();
-		const LLUUID &cat_id = fetch_info.mCatUUID;
-        if (cat_id.isNull()) //DEV-17797
-        {
-			LLSD folder_sd;
-			folder_sd["folder_id"]		= LLUUID::null.asString();
-			folder_sd["owner_id"]		= gAgent.getID();
-			folder_sd["sort_order"]		= (LLSD::Integer)sort_order;
-			folder_sd["fetch_folders"]	= (LLSD::Boolean)FALSE;
-			folder_sd["fetch_items"]	= (LLSD::Boolean)TRUE;
-			body["folders"].append(folder_sd);
-            folder_count++;
-        }
-        else
-        {
-		    const LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
+		if (fetch_info.mIsCategory)
+		{
+			const LLUUID &cat_id = fetch_info.mUUID;
+			if (cat_id.isNull()) //DEV-17797
+			{
+				LLSD folder_sd;
+				folder_sd["folder_id"]		= LLUUID::null.asString();
+				folder_sd["owner_id"]		= gAgent.getID();
+				folder_sd["sort_order"]		= (LLSD::Integer)sort_order;
+				folder_sd["fetch_folders"]	= (LLSD::Boolean)FALSE;
+				folder_sd["fetch_items"]	= (LLSD::Boolean)TRUE;
+				folder_request_body["folders"].append(folder_sd);
+				folder_count++;
+			}
+			else
+			{
+				const LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
 		
-		    if (cat)
-		    {
-			    if (LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion())
-			    {
-				    LLSD folder_sd;
-				    folder_sd["folder_id"]		= cat->getUUID();
-				    folder_sd["owner_id"]		= cat->getOwnerID();
-				    folder_sd["sort_order"]		= (LLSD::Integer)sort_order;
-				    folder_sd["fetch_folders"]	= TRUE; //(LLSD::Boolean)sFullFetchStarted;
-				    folder_sd["fetch_items"]	= (LLSD::Boolean)TRUE;
-				    
-				    if (ALEXANDRIA_LINDEN_ID == cat->getOwnerID())
-					    body_lib["folders"].append(folder_sd);
-				    else
-					    body["folders"].append(folder_sd);
-				    folder_count++;
-			    }
-				// May already have this folder, but append child folders to list.
-			    if (fetch_info.mRecursive)
-			    {	
-					LLInventoryModel::cat_array_t* categories;
-					LLInventoryModel::item_array_t* items;
-					gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items);
-					for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin();
-						 it != categories->end();
-						 ++it)
+				if (cat)
+				{
+					if (LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion())
 					{
-						mFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(), fetch_info.mRecursive));
-				    }
-			    }
-		    }
-        }
-		if (fetch_info.mRecursive)
-			recursive_cats.push_back(cat_id);
+						LLSD folder_sd;
+						folder_sd["folder_id"]		= cat->getUUID();
+						folder_sd["owner_id"]		= cat->getOwnerID();
+						folder_sd["sort_order"]		= (LLSD::Integer)sort_order;
+						folder_sd["fetch_folders"]	= TRUE; //(LLSD::Boolean)sFullFetchStarted;
+						folder_sd["fetch_items"]	= (LLSD::Boolean)TRUE;
+				    
+						if (ALEXANDRIA_LINDEN_ID == cat->getOwnerID())
+							folder_request_body_lib["folders"].append(folder_sd);
+						else
+							folder_request_body["folders"].append(folder_sd);
+						folder_count++;
+					}
+					// May already have this folder, but append child folders to list.
+					if (fetch_info.mRecursive)
+					{	
+						LLInventoryModel::cat_array_t* categories;
+						LLInventoryModel::item_array_t* items;
+						gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items);
+						for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin();
+							 it != categories->end();
+							 ++it)
+						{
+							mFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(), fetch_info.mRecursive));
+						}
+					}
+				}
+			}
+			if (fetch_info.mRecursive)
+				recursive_cats.push_back(cat_id);
+		}
+		else
+		{
+			LLViewerInventoryItem* itemp = gInventory.getItem(fetch_info.mUUID);
+			if (itemp)
+			{
+				LLSD item_sd;
+				item_sd["owner_id"] = itemp->getPermissions().getOwner();
+				item_sd["item_id"] = itemp->getUUID();
+				if (itemp->getPermissions().getOwner() == gAgent.getID())
+				{
+					item_request_body.append(item_sd);
+				}
+				else
+				{
+					item_request_body_lib.append(item_sd);
+				}
+				//itemp->fetchFromServer();
+				item_count++;
+			}
+		}
 
 		mFetchQueue.pop_front();
 	}
 		
-	if (folder_count > 0)
+	if (item_count + folder_count > 0)
 	{
-		mBulkFetchCount++;
-		if (body["folders"].size())
+		if (folder_count)
 		{
-			LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(body, recursive_cats);
-			LLHTTPClient::post(url, body, fetcher, 300.0);
+			std::string url = region->getCapability("FetchInventoryDescendents2");   
+			mFetchCount++;
+			if (folder_request_body["folders"].size())
+			{
+				LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(folder_request_body, recursive_cats);
+				LLHTTPClient::post(url, folder_request_body, fetcher, 300.0);
+			}
+			if (folder_request_body_lib["folders"].size())
+			{
+				std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents2");
+
+				LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(folder_request_body_lib, recursive_cats);
+				LLHTTPClient::post(url_lib, folder_request_body_lib, fetcher, 300.0);
+			}
 		}
-		if (body_lib["folders"].size())
+		if (item_count)
 		{
-			std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents2");
-			
-			LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(body_lib, recursive_cats);
-			LLHTTPClient::post(url_lib, body_lib, fetcher, 300.0);
+			std::string url;
+
+			if (item_request_body.size())
+			{
+				mFetchCount++;
+				url = region->getCapability("FetchInventory2");
+				if (!url.empty())
+				{
+					LLSD body;
+					body["agent_id"]	= gAgent.getID();
+					body["items"] = item_request_body;
+
+					LLHTTPClient::post(url, body, new LLInventoryModelFetchItemResponder(body));
+				}
+				//else
+				//{
+				//	LLMessageSystem* msg = gMessageSystem;
+				//	msg->newMessage("FetchInventory");
+				//	msg->nextBlock("AgentData");
+				//	msg->addUUID("AgentID", gAgent.getID());
+				//	msg->addUUID("SessionID", gAgent.getSessionID());
+				//	msg->nextBlock("InventoryData");
+				//	msg->addUUID("OwnerID", mPermissions.getOwner());
+				//	msg->addUUID("ItemID", mUUID);
+				//	gAgent.sendReliableMessage();
+				//}
+			}
+
+			if (item_request_body_lib.size())
+			{
+				mFetchCount++;
+
+				url = region->getCapability("FetchLib2");
+				if (!url.empty())
+				{
+					LLSD body;
+					body["agent_id"]	= gAgent.getID();
+					body["items"] = item_request_body_lib;
+
+					LLHTTPClient::post(url, body, new LLInventoryModelFetchItemResponder(body));
+				}
+			}
 		}
 		mFetchTimer.reset();
 	}
+
 	else if (isBulkFetchProcessingComplete())
 	{
 		setAllFoldersFetched();
@@ -624,7 +761,7 @@ bool LLInventoryModelBackgroundFetch::fetchQueueContainsNoDescendentsOf(const LL
 	for (fetch_queue_t::const_iterator it = mFetchQueue.begin();
 		 it != mFetchQueue.end(); ++it)
 	{
-		const LLUUID& fetch_id = (*it).mCatUUID;
+		const LLUUID& fetch_id = (*it).mUUID;
 		if (gInventory.isObjectDescendentOf(fetch_id, cat_id))
 			return false;
 	}
diff --git a/indra/newview/llinventorymodelbackgroundfetch.h b/indra/newview/llinventorymodelbackgroundfetch.h
index c35c785ceb34dfb7f6f424353aef4517d1a443ef..9dfedddd6d28d8ac82eeef2f9d4103bfa34443ad 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.h
+++ b/indra/newview/llinventorymodelbackgroundfetch.h
@@ -48,7 +48,7 @@ class LLInventoryModelBackgroundFetch : public LLSingleton<LLInventoryModelBackg
 	// This gets triggered when performing a filter-search.
 	void start(const LLUUID& cat_id = LLUUID::null, BOOL recursive = TRUE);
 
-	BOOL backgroundFetchActive() const;
+	BOOL folderFetchActive() const;
 	bool isEverythingFetched() const; // completing the fetch once per session should be sufficient
 
 	bool libraryFetchStarted() const;
@@ -60,14 +60,13 @@ class LLInventoryModelBackgroundFetch : public LLSingleton<LLInventoryModelBackg
 	bool inventoryFetchInProgress() const;
 
     void findLostItems();	
+	void incrFetchCount(S16 fetching);
 protected:
-	void incrBulkFetch(S16 fetching);
 	bool isBulkFetchProcessingComplete() const;
-	void bulkFetch(std::string url);
+	void bulkFetch();
 
 	void backgroundFetch();
 	static void backgroundFetchCB(void*); // background fetch idle function
-	void stopBackgroundFetch(); // stop fetch process
 
 	void setAllFoldersFetched();
 	bool fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id) const;
@@ -77,7 +76,8 @@ class LLInventoryModelBackgroundFetch : public LLSingleton<LLInventoryModelBackg
 	BOOL mAllFoldersFetched;
 
 	BOOL mBackgroundFetchActive;
-	S16 mBulkFetchCount;
+	bool mFolderFetchActive;
+	S16 mFetchCount;
 	BOOL mTimelyFetchPending;
 	S32 mNumFetchRetries;
 
@@ -87,11 +87,11 @@ class LLInventoryModelBackgroundFetch : public LLSingleton<LLInventoryModelBackg
 
 	struct FetchQueueInfo
 	{
-		FetchQueueInfo(const LLUUID& id, BOOL recursive) :
-			mCatUUID(id), mRecursive(recursive)
-		{
-		}
-		LLUUID mCatUUID;
+		FetchQueueInfo(const LLUUID& id, BOOL recursive, bool is_category = true) :
+			mUUID(id), mRecursive(recursive), mIsCategory(is_category)
+		{}
+		LLUUID mUUID;
+		bool mIsCategory;
 		BOOL mRecursive;
 	};
 	typedef std::deque<FetchQueueInfo> fetch_queue_t;
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index acbec531b6adc5cb2ede24952fa856a07990a2f5..71dd963f28c0dcc8ebd3a2a537cb7cb865293083 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -33,6 +33,7 @@
 #include "llagentwearables.h"
 #include "llappearancemgr.h"
 #include "llavataractions.h"
+#include "llclipboard.h"
 #include "llfloaterinventory.h"
 #include "llfloaterreg.h"
 #include "llfloatersidepanelcontainer.h"
@@ -132,6 +133,7 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) :
 	mAcceptsDragAndDrop(p.accepts_drag_and_drop),
 	mAllowMultiSelect(p.allow_multi_select),
 	mShowItemLinkOverlays(p.show_item_link_overlays),
+	mShowEmptyMessage(p.show_empty_message),
 	mShowLoadStatus(p.show_load_status),
 	mViewsInitialized(false),
 	mInvFVBridgeBuilder(NULL)
@@ -205,10 +207,11 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
 		scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom);
 		LLScrollContainer::Params scroller_params(params.scroll());
 		scroller_params.rect(scroller_view_rect);
-		mScroller = LLUICtrlFactory::create<LLScrollContainer>(scroller_params);
+		mScroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroller_params);
 		addChild(mScroller);
 		mScroller->addChild(mFolderRoot);
 		mFolderRoot->setScrollContainer(mScroller);
+		mFolderRoot->setFollowsAll();
 		mFolderRoot->addChild(mFolderRoot->mStatusTextBox);
 	}
 
@@ -240,6 +243,15 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
 	getFilter()->setFilterCategoryTypes(getFilter()->getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_INBOX));
 	getFilter()->setFilterCategoryTypes(getFilter()->getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_OUTBOX));
 
+	// set the filter for the empty folder if the debug setting is on
+	if (gSavedSettings.getBOOL("DebugHideEmptySystemFolders"))
+	{
+		getFilter()->setFilterEmptySystemFolders();
+	}
+	
+	// keep track of the clipboard state so that we avoid filtering too much
+	mClipboardState = LLClipboard::instance().getGeneration();
+	
 	// Initialize base class params.
 	LLPanel::initFromParams(params);
 }
@@ -270,6 +282,14 @@ void LLInventoryPanel::draw()
 {
 	// Select the desired item (in case it wasn't loaded when the selection was requested)
 	mFolderRoot->updateSelection();
+	
+	// Nudge the filter if the clipboard state changed
+	if (mClipboardState != LLClipboard::instance().getGeneration())
+	{
+		mClipboardState = LLClipboard::instance().getGeneration();
+		getFilter()->setModified(LLClipboard::instance().isCutMode() ? LLInventoryFilter::FILTER_MORE_RESTRICTIVE : LLInventoryFilter::FILTER_LESS_RESTRICTIVE);
+	}
+	
 	LLPanel::draw();
 }
 
@@ -611,6 +631,7 @@ LLFolderView * LLInventoryPanel::createFolderView(LLInvFVBridge * bridge, bool u
 	p.listener =  bridge;
 	p.use_label_suffix = useLabelSuffix;
 	p.allow_multiselect = mAllowMultiSelect;
+	p.show_empty_message = mShowEmptyMessage;
 	p.show_load_status = mShowLoadStatus;
 
 	return LLUICtrlFactory::create<LLFolderView>(p);
@@ -697,7 +718,10 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id)
   				if (new_listener)
   				{
 					LLFolderViewFolder* folderp = createFolderViewFolder(new_listener);
-  					folderp->setItemSortOrder(mFolderRoot->getSortOrder());
+					if (folderp)
+					{
+						folderp->setItemSortOrder(mFolderRoot->getSortOrder());
+					}
   					itemp = folderp;
   				}
   			}
@@ -806,7 +830,7 @@ BOOL LLInventoryPanel::handleHover(S32 x, S32 y, MASK mask)
 	if(handled)
 	{
 		ECursorType cursor = getWindow()->getCursor();
-		if (LLInventoryModelBackgroundFetch::instance().backgroundFetchActive() && cursor == UI_CURSOR_ARROW)
+		if (LLInventoryModelBackgroundFetch::instance().folderFetchActive() && cursor == UI_CURSOR_ARROW)
 		{
 			// replace arrow cursor with arrow and hourglass cursor
 			getWindow()->setCursor(UI_CURSOR_WORKING);
@@ -1096,30 +1120,23 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open)
 		return FALSE;
 	}
 
-	LLSidepanelInventory *sidepanel_inventory =	LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
-
-	// A. If the inventory side panel floater is open, use that preferably.
-	if (is_inventorysp_active())
-	{
-		// Get the floater's z order to compare it to other inventory floaters' order later.
-		res = sidepanel_inventory->getActivePanel();
-		z_min = gFloaterView->getZOrder(floater_inventory);
-		active_inv_floaterp = floater_inventory;
-	}
+	LLSidepanelInventory *inventory_panel =	LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
 
-	// B. Iterate through the inventory floaters and return whichever is on top.
+	// Iterate through the inventory floaters and return whichever is on top.
 	LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory");
 	for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter)
 	{
-		LLFloaterInventory* iv = dynamic_cast<LLFloaterInventory*>(*iter);
-		if (iv && iv->getVisible())
+		LLFloaterSidePanelContainer* inventory_floater = dynamic_cast<LLFloaterSidePanelContainer*>(*iter);
+		inventory_panel = inventory_floater->findChild<LLSidepanelInventory>("main_panel");
+
+		if (inventory_floater && inventory_panel && inventory_floater->getVisible())
 		{
-			S32 z_order = gFloaterView->getZOrder(iv);
+			S32 z_order = gFloaterView->getZOrder(inventory_floater);
 			if (z_order < z_min)
 			{
-				res = iv->getPanel();
+				res = inventory_panel->getActivePanel();
 				z_min = z_order;
-				active_inv_floaterp = iv;
+				active_inv_floaterp = inventory_floater;
 			}
 		}
 	}
@@ -1136,7 +1153,7 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open)
 	{
 		floater_inventory->openFloater();
 
-		res = sidepanel_inventory->getActivePanel();
+		res = inventory_panel->getActivePanel();
 	}
 
 	return res;
@@ -1155,7 +1172,6 @@ void LLInventoryPanel::openInventoryPanelAndSetSelection(BOOL auto_open, const L
 		LLViewerInventoryCategory * cat = gInventory.getCategory(obj_id);
 		
 		bool in_inbox = false;
-		bool in_outbox = false;
 		
 		LLViewerInventoryCategory * parent_cat = NULL;
 		
@@ -1171,10 +1187,9 @@ void LLInventoryPanel::openInventoryPanelAndSetSelection(BOOL auto_open, const L
 		if (parent_cat)
 		{
 			in_inbox = (LLFolderType::FT_INBOX == parent_cat->getPreferredType());
-			in_outbox = (LLFolderType::FT_OUTBOX == parent_cat->getPreferredType());
 		}
 		
-		if (in_inbox || in_outbox)
+		if (in_inbox)
 		{
 			LLSidepanelInventory * sidepanel_inventory =	LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
 			LLInventoryPanel * inventory_panel = NULL;
@@ -1184,11 +1199,6 @@ void LLInventoryPanel::openInventoryPanelAndSetSelection(BOOL auto_open, const L
 				sidepanel_inventory->openInbox();
 				inventory_panel = sidepanel_inventory->getInboxPanel();
 			}
-			else
-			{
-				sidepanel_inventory->openOutbox();
-				inventory_panel = sidepanel_inventory->getOutboxPanel();
-			}
 
 			if (inventory_panel)
 			{
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index 2a24327115360a29e5becbeea5d5f5c779da160d..6db59afb9b92a7a967a3bf5d81e4aeb30ac50b86 100644
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -84,6 +84,7 @@ class LLInventoryPanel : public LLPanel
 		Optional<Filter>					filter;
 		Optional<std::string>               start_folder;
 		Optional<bool>						use_label_suffix;
+		Optional<bool>						show_empty_message;
 		Optional<bool>						show_load_status;
 		Optional<LLScrollContainer::Params>	scroll;
 		Optional<bool>						accepts_drag_and_drop;
@@ -96,6 +97,7 @@ class LLInventoryPanel : public LLPanel
 			filter("filter"),
 			start_folder("start_folder"),
 			use_label_suffix("use_label_suffix", true),
+			show_empty_message("show_empty_message", true),
 			show_load_status("show_load_status"),
 			scroll("scroll"),
 			accepts_drag_and_drop("accepts_drag_and_drop")
@@ -158,6 +160,8 @@ class LLInventoryPanel : public LLPanel
 	
 	void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
 	
+	LLHandle<LLInventoryPanel> getInventoryPanelHandle() const { return getDerivedHandle<LLInventoryPanel>(); }
+
 	// Callbacks
 	void doToSelected(const LLSD& userdata);
 	void doCreate(const LLSD& userdata);
@@ -188,6 +192,7 @@ class LLInventoryPanel : public LLPanel
 	BOOL						mAcceptsDragAndDrop;
 	BOOL 						mAllowMultiSelect;
 	BOOL 						mShowItemLinkOverlays; // Shows link graphic over inventory item icons
+	BOOL						mShowEmptyMessage;
 	BOOL						mShowLoadStatus;
 
 	LLFolderView*				mFolderRoot;
@@ -217,6 +222,7 @@ class LLInventoryPanel : public LLPanel
 
 private:
 	std::string					mSortOrderSetting;
+	int							mClipboardState;
 
 	//--------------------------------------------------------------------
 	// Hidden folders
diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..459e52c4f4e6f7844b17e664d1e9aa20a738d888
--- /dev/null
+++ b/indra/newview/lllocalbitmaps.cpp
@@ -0,0 +1,942 @@
+/** 
+ * @file lllocalbitmaps.cpp
+ * @author Vaalith Jinn
+ * @brief Local Bitmaps source
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+/* precompiled headers */
+#include "llviewerprecompiledheaders.h"
+
+/* own header */
+#include "lllocalbitmaps.h"
+
+/* boost: will not compile unless equivalent is undef'd, beware. */
+#ifdef equivalent
+#undef equivalent
+#endif 
+#include <boost/filesystem.hpp>
+
+/* image compression headers. */
+#include "llimagebmp.h"
+#include "llimagetga.h"
+#include "llimagejpeg.h"
+#include "llimagepng.h"
+
+/* time headers */
+#include <time.h>
+#include <ctime>
+
+/* misc headers */
+#include "llscrolllistctrl.h"
+#include "llfilepicker.h"
+#include "llviewertexturelist.h"
+#include "llviewerobjectlist.h"
+#include "llviewerobject.h"
+#include "llface.h"
+#include "llvoavatarself.h"
+#include "llwearable.h"
+#include "llagentwearables.h"
+#include "lltexlayerparams.h"
+#include "llvovolume.h"
+#include "llnotificationsutil.h"
+
+/*=======================================*/
+/*  Formal declarations, constants, etc. */
+/*=======================================*/ 
+std::list<LLLocalBitmap*>   LLLocalBitmapMgr::sBitmapList;
+LLLocalBitmapTimer          LLLocalBitmapMgr::sTimer;
+bool                        LLLocalBitmapMgr::sNeedsRebake;
+
+static const F32 LL_LOCAL_TIMER_HEARTBEAT   = 3.0;
+static const BOOL LL_LOCAL_USE_MIPMAPS      = true;
+static const S32 LL_LOCAL_DISCARD_LEVEL     = 0;
+static const U32 LL_LOCAL_TEXLAYER_FOR_IDX  = 0;
+static const bool LL_LOCAL_SLAM_FOR_DEBUG   = true;
+static const bool LL_LOCAL_REPLACE_ON_DEL   = true;
+static const S32 LL_LOCAL_UPDATE_RETRIES    = 5;
+
+/*=======================================*/
+/*  LLLocalBitmap: unit class            */
+/*=======================================*/ 
+LLLocalBitmap::LLLocalBitmap(std::string filename)
+	: mFilename(filename)
+	, mShortName(gDirUtilp->getBaseFileName(filename, true))
+	, mValid(false)
+	, mLastModified()
+	, mLinkStatus(LS_ON)
+	, mUpdateRetries(LL_LOCAL_UPDATE_RETRIES)
+{
+	mTrackingID.generate();
+
+	/* extension */
+	std::string temp_exten = gDirUtilp->getExtension(mFilename);
+
+	if (temp_exten == "bmp")
+	{ 
+		mExtension = ET_IMG_BMP;
+	}
+	else if (temp_exten == "tga")
+	{
+		mExtension = ET_IMG_TGA;
+	}
+	else if (temp_exten == "jpg" || temp_exten == "jpeg")
+	{
+		mExtension = ET_IMG_JPG;
+	}
+	else if (temp_exten == "png")
+	{
+		mExtension = ET_IMG_PNG;
+	}
+	else
+	{
+		llwarns << "File of no valid extension given, local bitmap creation aborted." << "\n"
+			    << "Filename: " << mFilename << llendl;
+		return; // no valid extension.
+	}
+
+	/* next phase of unit creation is nearly the same as an update cycle.
+	   we're running updateSelf as a special case with the optional UT_FIRSTUSE
+	   which omits the parts associated with removing the outdated texture */
+	mValid = updateSelf(UT_FIRSTUSE);
+}
+
+LLLocalBitmap::~LLLocalBitmap()
+{
+	// replace IDs with defaults, if set to do so.
+	if(LL_LOCAL_REPLACE_ON_DEL && mValid) // fix for STORM-1837
+	{
+		replaceIDs(mWorldID, IMG_DEFAULT);
+		LLLocalBitmapMgr::doRebake();
+	}
+
+	// delete self from gimagelist
+	LLViewerFetchedTexture* image = gTextureList.findImage(mWorldID);
+	gTextureList.deleteImage(image);
+
+	if (image)
+	{
+		image->unref();
+	}
+}
+
+/* accessors */
+std::string LLLocalBitmap::getFilename()
+{
+	return mFilename;
+}
+
+std::string LLLocalBitmap::getShortName()
+{
+	return mShortName;
+}
+
+LLUUID LLLocalBitmap::getTrackingID()
+{
+	return mTrackingID;
+}
+
+LLUUID LLLocalBitmap::getWorldID()
+{
+	return mWorldID;
+}
+
+bool LLLocalBitmap::getValid()
+{
+	return mValid;
+}
+
+/* update functions */
+bool LLLocalBitmap::updateSelf(EUpdateType optional_firstupdate)
+{
+	bool updated = false;
+	
+	if (mLinkStatus == LS_ON)
+	{
+		// verifying that the file exists
+		if (gDirUtilp->fileExists(mFilename))
+		{
+			// verifying that the file has indeed been modified
+			const std::time_t temp_time = boost::filesystem::last_write_time(boost::filesystem::path(mFilename));
+			LLSD new_last_modified = asctime(localtime(&temp_time));
+
+			if (mLastModified.asString() != new_last_modified.asString())
+			{
+				/* loading the image file and decoding it, here is a critical point which,
+				   if fails, invalidates the whole update (or unit creation) process. */
+				LLPointer<LLImageRaw> raw_image = new LLImageRaw();
+				if (decodeBitmap(raw_image))
+				{
+					// decode is successful, we can safely proceed.
+					LLUUID old_id = LLUUID::null;
+					if (!(optional_firstupdate == UT_FIRSTUSE) && !mWorldID.isNull())
+					{
+						old_id = mWorldID;
+					}
+					mWorldID.generate();
+					mLastModified = new_last_modified;
+
+					LLPointer<LLViewerFetchedTexture> texture = new LLViewerFetchedTexture
+						("file://"+mFilename, mWorldID, LL_LOCAL_USE_MIPMAPS);
+
+					texture->createGLTexture(LL_LOCAL_DISCARD_LEVEL, raw_image);
+					texture->setCachedRawImage(LL_LOCAL_DISCARD_LEVEL, raw_image);
+					texture->ref(); 
+
+					gTextureList.addImage(texture);
+			
+					if (!optional_firstupdate == UT_FIRSTUSE)
+					{
+						// seek out everything old_id uses and replace it with mWorldID
+						replaceIDs(old_id, mWorldID);
+
+						// remove old_id from gimagelist
+						LLViewerFetchedTexture* image = gTextureList.findImage(old_id);
+						gTextureList.deleteImage(image);
+						image->unref();
+					}
+
+					mUpdateRetries = LL_LOCAL_UPDATE_RETRIES;
+					updated = true;
+				}
+
+				// if decoding failed, we get here and it will attempt to decode it in the next cycles
+				// until mUpdateRetries runs out. this is done because some software lock the bitmap while writing to it
+				else
+				{
+					if (mUpdateRetries)
+					{
+						mUpdateRetries--;
+					}
+					else
+					{
+						llwarns << "During the update process the following file was found" << "\n"
+							    << "but could not be opened or decoded for " << LL_LOCAL_UPDATE_RETRIES << " attempts." << "\n"
+								<< "Filename: " << mFilename << "\n"
+								<< "Disabling further update attempts for this file." << llendl;
+
+						LLSD notif_args;
+						notif_args["FNAME"] = mFilename;
+						notif_args["NRETRIES"] = LL_LOCAL_UPDATE_RETRIES;
+						LLNotificationsUtil::add("LocalBitmapsUpdateFailedFinal", notif_args);
+
+						mLinkStatus = LS_BROKEN;
+					}
+				}		
+			}
+			
+		} // end if file exists
+
+		else
+		{
+			llwarns << "During the update process, the following file was not found." << "\n" 
+			        << "Filename: " << mFilename << "\n"
+				    << "Disabling further update attempts for this file." << llendl;
+
+			LLSD notif_args;
+			notif_args["FNAME"] = mFilename;
+			LLNotificationsUtil::add("LocalBitmapsUpdateFileNotFound", notif_args);
+
+			mLinkStatus = LS_BROKEN;
+		}
+	}
+
+	return updated;
+}
+
+bool LLLocalBitmap::decodeBitmap(LLPointer<LLImageRaw> rawimg)
+{
+	bool decode_successful = false;
+
+	switch (mExtension)
+	{
+		case ET_IMG_BMP:
+		{
+			LLPointer<LLImageBMP> bmp_image = new LLImageBMP;
+			if (bmp_image->load(mFilename) && bmp_image->decode(rawimg, 0.0f))
+			{
+				rawimg->biasedScaleToPowerOfTwo(LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT);
+				decode_successful = true;
+			}
+			break;
+		}
+
+		case ET_IMG_TGA:
+		{
+			LLPointer<LLImageTGA> tga_image = new LLImageTGA;
+			if ((tga_image->load(mFilename) && tga_image->decode(rawimg))
+			&& ((tga_image->getComponents() == 3) || (tga_image->getComponents() == 4)))
+			{
+				rawimg->biasedScaleToPowerOfTwo(LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT);
+				decode_successful = true;
+			}
+			break;
+		}
+
+		case ET_IMG_JPG:
+		{
+			LLPointer<LLImageJPEG> jpeg_image = new LLImageJPEG;
+			if (jpeg_image->load(mFilename) && jpeg_image->decode(rawimg, 0.0f))
+			{
+				rawimg->biasedScaleToPowerOfTwo(LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT);
+				decode_successful = true;
+			}
+			break;
+		}
+
+		case ET_IMG_PNG:
+		{
+			LLPointer<LLImagePNG> png_image = new LLImagePNG;
+			if (png_image->load(mFilename) && png_image->decode(rawimg, 0.0f))
+			{
+				rawimg->biasedScaleToPowerOfTwo(LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT);
+				decode_successful = true;
+			}
+			break;
+		}
+
+		default:
+		{
+			// separating this into -several- llwarns calls because in the extremely unlikely case that this happens
+			// accessing mFilename and any other object properties might very well crash the viewer.
+			// getting here should be impossible, or there's been a pretty serious bug.
+
+			llwarns << "During a decode attempt, the following local bitmap had no properly assigned extension." << llendl;
+			llwarns << "Filename: " << mFilename << llendl;
+		    llwarns << "Disabling further update attempts for this file." << llendl;
+			mLinkStatus = LS_BROKEN;
+		}
+	}
+
+	return decode_successful;
+}
+
+void LLLocalBitmap::replaceIDs(LLUUID old_id, LLUUID new_id)
+{
+	// checking for misuse.
+	if (old_id == new_id)
+	{
+		llinfos << "An attempt was made to replace a texture with itself. (matching UUIDs)" << "\n"
+			    << "Texture UUID: " << old_id.asString() << llendl;
+		return;
+	}
+
+	updateUserPrims(old_id, new_id);
+	updateUserSculpts(old_id, new_id); // isn't there supposed to be an IMG_DEFAULT_SCULPT or something?
+	
+	// default safeguard image for layers
+	if( new_id == IMG_DEFAULT )
+	{
+		new_id = IMG_DEFAULT_AVATAR;
+	}
+
+	/* It doesn't actually update all of those, it merely checks if any of them
+		contain the referenced ID and if so, updates. */
+	updateUserLayers(old_id, new_id, LLWearableType::WT_ALPHA);
+	updateUserLayers(old_id, new_id, LLWearableType::WT_EYES);
+	updateUserLayers(old_id, new_id, LLWearableType::WT_GLOVES);
+	updateUserLayers(old_id, new_id, LLWearableType::WT_JACKET);
+	updateUserLayers(old_id, new_id, LLWearableType::WT_PANTS);
+	updateUserLayers(old_id, new_id, LLWearableType::WT_SHIRT);
+	updateUserLayers(old_id, new_id, LLWearableType::WT_SHOES);
+	updateUserLayers(old_id, new_id, LLWearableType::WT_SKIN);
+	updateUserLayers(old_id, new_id, LLWearableType::WT_SKIRT);
+	updateUserLayers(old_id, new_id, LLWearableType::WT_SOCKS);
+	updateUserLayers(old_id, new_id, LLWearableType::WT_TATTOO);
+	updateUserLayers(old_id, new_id, LLWearableType::WT_UNDERPANTS);
+	updateUserLayers(old_id, new_id, LLWearableType::WT_UNDERSHIRT);
+}
+
+// this function sorts the faces from a getFaceList[getNumFaces] into a list of objects
+// in order to prevent multiple sendTEUpdate calls per object during updateUserPrims
+std::vector<LLViewerObject*> LLLocalBitmap::prepUpdateObjects(LLUUID old_id)
+{
+	std::vector<LLViewerObject*> obj_list;
+	LLViewerFetchedTexture* old_texture = gTextureList.findImage(old_id);
+
+	for(U32 face_iterator = 0; face_iterator < old_texture->getNumFaces(); face_iterator++)
+	{
+		// getting an object from a face
+		LLFace* face_to_object = (*old_texture->getFaceList())[face_iterator];
+
+		if(face_to_object)
+		{
+			LLViewerObject* affected_object = face_to_object->getViewerObject();
+
+			if(affected_object)
+			{
+
+				// we have an object, we'll take it's UUID and compare it to
+				// whatever we already have in the returnable object list.
+				// if there is a match - we do not add (to prevent duplicates)
+				LLUUID mainlist_obj_id = affected_object->getID();
+				bool add_object = true;
+
+				// begin looking for duplicates
+				std::vector<LLViewerObject*>::iterator objlist_iter = obj_list.begin();
+				for(; (objlist_iter != obj_list.end()) && add_object; objlist_iter++)
+				{
+					LLViewerObject* obj = *objlist_iter;
+					if (obj->getID() == mainlist_obj_id)
+					{
+						add_object = false; // duplicate found.
+					}
+				}
+				// end looking for duplicates
+
+				if(add_object)
+				{
+					obj_list.push_back(affected_object);
+				}
+
+			}
+
+		}
+		
+	} // end of face-iterating for()
+
+	return obj_list;
+}
+
+void LLLocalBitmap::updateUserPrims(LLUUID old_id, LLUUID new_id)
+{
+	std::vector<LLViewerObject*> objectlist = prepUpdateObjects(old_id);
+
+	for(std::vector<LLViewerObject*>::iterator object_iterator = objectlist.begin();
+		object_iterator != objectlist.end(); object_iterator++)
+	{
+		LLViewerObject* object = *object_iterator;
+
+		if(object)
+		{
+			bool update_obj = false;
+			S32 num_faces = object->getNumFaces();
+
+			for (U8 face_iter = 0; face_iter < num_faces; face_iter++)
+			{
+				if (object->mDrawable)
+				{
+					LLFace* face = object->mDrawable->getFace(face_iter);
+					if (face && face->getTexture() && face->getTexture()->getID() == old_id)
+					{
+						object->setTEImage(face_iter, LLViewerTextureManager::getFetchedTexture
+							(new_id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE));
+
+						update_obj = true;
+					}
+				}
+			}
+			
+			if (update_obj)
+			{
+				object->sendTEUpdate();
+			}
+		}
+	}
+	
+}
+
+void LLLocalBitmap::updateUserSculpts(LLUUID old_id, LLUUID new_id)
+{
+	LLViewerFetchedTexture* old_texture = gTextureList.findImage(old_id);
+	for(U32 volume_iter = 0; volume_iter < old_texture->getNumVolumes(); volume_iter++)
+	{
+		LLVOVolume* volume_to_object = (*old_texture->getVolumeList())[volume_iter];
+		LLViewerObject* object = (LLViewerObject*)volume_to_object;
+	
+		if(object)
+		{
+			if (object->isSculpted() && object->getVolume() &&
+				object->getVolume()->getParams().getSculptID() == old_id)
+			{
+				LLSculptParams* old_params = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
+				LLSculptParams new_params(*old_params);
+				new_params.setSculptTexture(new_id);
+				object->setParameterEntry(LLNetworkData::PARAMS_SCULPT, new_params, TRUE);
+			}
+		}
+	}
+}
+
+void LLLocalBitmap::updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableType::EType type)
+{
+	U32 count = gAgentWearables.getWearableCount(type);
+	for(U32 wearable_iter = 0; wearable_iter < count; wearable_iter++)
+	{
+		LLWearable* wearable = gAgentWearables.getWearable(type, wearable_iter);
+		if (wearable)
+		{
+			std::vector<LLLocalTextureObject*> texture_list = wearable->getLocalTextureListSeq();
+			for(std::vector<LLLocalTextureObject*>::iterator texture_iter = texture_list.begin();
+				texture_iter != texture_list.end(); texture_iter++)
+			{
+				LLLocalTextureObject* lto = *texture_iter;
+
+				if (lto && lto->getID() == old_id)
+				{
+					U32 local_texlayer_index = 0; /* can't keep that as static const, gives errors, so i'm leaving this var here */
+					LLVOAvatarDefines::EBakedTextureIndex baked_texind =
+						lto->getTexLayer(local_texlayer_index)->getTexLayerSet()->getBakedTexIndex();
+				
+					LLVOAvatarDefines::ETextureIndex reg_texind = getTexIndex(type, baked_texind);
+					if (reg_texind != LLVOAvatarDefines::TEX_NUM_INDICES)
+					{
+						U32 index = gAgentWearables.getWearableIndex(wearable);
+						gAgentAvatarp->setLocalTexture(reg_texind, gTextureList.getImage(new_id), FALSE, index);
+						gAgentAvatarp->wearableUpdated(type, FALSE);
+
+						/* telling the manager to rebake once update cycle is fully done */
+						LLLocalBitmapMgr::setNeedsRebake();
+					}
+
+				}
+			}
+		}
+	}
+}
+
+LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
+	LLWearableType::EType type, LLVOAvatarDefines::EBakedTextureIndex baked_texind)
+{
+	LLVOAvatarDefines::ETextureIndex result = LLVOAvatarDefines::TEX_NUM_INDICES; // using as a default/fail return.
+
+	switch(type)
+	{
+		case LLWearableType::WT_ALPHA:
+		{
+			switch(baked_texind)
+			{
+				case LLVOAvatarDefines::BAKED_EYES:
+				{
+					result = LLVOAvatarDefines::TEX_EYES_ALPHA;
+					break;
+				}
+
+				case LLVOAvatarDefines::BAKED_HAIR:
+				{
+					result = LLVOAvatarDefines::TEX_HAIR_ALPHA;
+					break;
+				}
+
+				case LLVOAvatarDefines::BAKED_HEAD:
+				{
+					result = LLVOAvatarDefines::TEX_HEAD_ALPHA;
+					break;
+				}
+
+				case LLVOAvatarDefines::BAKED_LOWER:
+				{
+					result = LLVOAvatarDefines::TEX_LOWER_ALPHA;
+					break;
+				}
+				case LLVOAvatarDefines::BAKED_UPPER:
+				{
+					result = LLVOAvatarDefines::TEX_UPPER_ALPHA;
+					break;
+				}
+
+				default:
+				{
+					break;
+				}
+
+			}
+			break;
+
+		}
+
+		case LLWearableType::WT_EYES:
+		{
+			if (baked_texind == LLVOAvatarDefines::BAKED_EYES)
+			{
+				result = LLVOAvatarDefines::TEX_EYES_IRIS;
+			}
+
+			break;
+		}
+
+		case LLWearableType::WT_GLOVES:
+		{
+			if (baked_texind == LLVOAvatarDefines::BAKED_UPPER)
+			{
+				result = LLVOAvatarDefines::TEX_UPPER_GLOVES;
+			}
+
+			break;
+		}
+
+		case LLWearableType::WT_JACKET:
+		{
+			if (baked_texind == LLVOAvatarDefines::BAKED_LOWER)
+			{
+				result = LLVOAvatarDefines::TEX_LOWER_JACKET;
+			}
+			else if (baked_texind == LLVOAvatarDefines::BAKED_UPPER)
+			{
+				result = LLVOAvatarDefines::TEX_UPPER_JACKET;
+			}
+
+			break;
+		}
+
+		case LLWearableType::WT_PANTS:
+		{
+			if (baked_texind == LLVOAvatarDefines::BAKED_LOWER)
+			{
+				result = LLVOAvatarDefines::TEX_LOWER_PANTS;
+			}
+
+			break;
+		}
+
+		case LLWearableType::WT_SHIRT:
+		{
+			if (baked_texind == LLVOAvatarDefines::BAKED_UPPER)
+			{
+				result = LLVOAvatarDefines::TEX_UPPER_SHIRT;
+			}
+
+			break;
+		}
+
+		case LLWearableType::WT_SHOES:
+		{
+			if (baked_texind == LLVOAvatarDefines::BAKED_LOWER)
+			{
+				result = LLVOAvatarDefines::TEX_LOWER_SHOES;
+			}
+
+			break;
+		}
+
+		case LLWearableType::WT_SKIN:
+		{
+			switch(baked_texind)
+			{
+				case LLVOAvatarDefines::BAKED_HEAD:
+				{
+					result = LLVOAvatarDefines::TEX_HEAD_BODYPAINT;
+					break;
+				}
+
+				case LLVOAvatarDefines::BAKED_LOWER:
+				{
+					result = LLVOAvatarDefines::TEX_LOWER_BODYPAINT;
+					break;
+				}
+				case LLVOAvatarDefines::BAKED_UPPER:
+				{
+					result = LLVOAvatarDefines::TEX_UPPER_BODYPAINT;
+					break;
+				}
+
+				default:
+				{
+					break;
+				}
+
+			}
+			break;
+		}
+
+		case LLWearableType::WT_SKIRT:
+		{
+			if (baked_texind == LLVOAvatarDefines::BAKED_SKIRT)
+			{
+				result = LLVOAvatarDefines::TEX_SKIRT;
+			}
+
+			break;
+		}
+
+		case LLWearableType::WT_SOCKS:
+		{
+			if (baked_texind == LLVOAvatarDefines::BAKED_LOWER)
+			{
+				result = LLVOAvatarDefines::TEX_LOWER_SOCKS;
+			}
+
+			break;
+		}
+
+		case LLWearableType::WT_TATTOO:
+		{
+			switch(baked_texind)
+			{
+				case LLVOAvatarDefines::BAKED_HEAD:
+				{
+					result = LLVOAvatarDefines::TEX_HEAD_TATTOO;
+					break;
+				}
+
+				case LLVOAvatarDefines::BAKED_LOWER:
+				{
+					result = LLVOAvatarDefines::TEX_LOWER_TATTOO;
+					break;
+				}
+				case LLVOAvatarDefines::BAKED_UPPER:
+				{
+					result = LLVOAvatarDefines::TEX_UPPER_TATTOO;
+					break;
+				}
+
+				default:
+				{
+					break;
+				}
+
+			}
+			break;
+		}
+
+		case LLWearableType::WT_UNDERPANTS:
+		{
+			if (baked_texind == LLVOAvatarDefines::BAKED_LOWER)
+			{
+				result = LLVOAvatarDefines::TEX_LOWER_UNDERPANTS;
+			}
+
+			break;
+		}
+
+		case LLWearableType::WT_UNDERSHIRT:
+		{
+			if (baked_texind == LLVOAvatarDefines::BAKED_UPPER)
+			{
+				result = LLVOAvatarDefines::TEX_UPPER_UNDERSHIRT;
+			}
+
+			break;
+		}
+
+		default:
+		{
+			llwarns << "Unknown wearable type: " << (int)type << "\n"
+				    << "Baked Texture Index: " << (int)baked_texind << "\n"
+					<< "Filename: " << mFilename << "\n"
+					<< "TrackingID: " << mTrackingID << "\n"
+					<< "InworldID: " << mWorldID << llendl;
+		}
+
+	}
+	return result;
+}
+
+/*=======================================*/
+/*  LLLocalBitmapTimer: timer class      */
+/*=======================================*/ 
+LLLocalBitmapTimer::LLLocalBitmapTimer() : LLEventTimer(LL_LOCAL_TIMER_HEARTBEAT)
+{
+}
+
+LLLocalBitmapTimer::~LLLocalBitmapTimer()
+{
+}
+
+void LLLocalBitmapTimer::startTimer()
+{
+	mEventTimer.start();
+}
+
+void LLLocalBitmapTimer::stopTimer()
+{
+	mEventTimer.stop();
+}
+
+bool LLLocalBitmapTimer::isRunning()
+{
+	return mEventTimer.getStarted();
+}
+
+BOOL LLLocalBitmapTimer::tick()
+{
+	LLLocalBitmapMgr::doUpdates();
+	return FALSE;
+}
+
+/*=======================================*/
+/*  LLLocalBitmapMgr: manager class      */
+/*=======================================*/ 
+LLLocalBitmapMgr::LLLocalBitmapMgr()
+{
+	// The class is all made of static members, should i even bother instantiating?
+}
+
+LLLocalBitmapMgr::~LLLocalBitmapMgr()
+{
+}
+
+bool LLLocalBitmapMgr::addUnit()
+{
+	bool add_successful = false;
+
+	LLFilePicker& picker = LLFilePicker::instance();
+	if (picker.getMultipleOpenFiles(LLFilePicker::FFLOAD_IMAGE))
+	{
+		sTimer.stopTimer();
+
+		std::string filename = picker.getFirstFile();
+		while(!filename.empty())
+		{
+			LLLocalBitmap* unit = new LLLocalBitmap(filename);
+
+			if (unit->getValid())
+			{
+				sBitmapList.push_back(unit);
+				add_successful = true;
+			}
+			else
+			{
+				llwarns << "Attempted to add invalid or unreadable image file, attempt cancelled.\n"
+					    << "Filename: " << filename << llendl;
+
+				LLSD notif_args;
+				notif_args["FNAME"] = filename;
+				LLNotificationsUtil::add("LocalBitmapsVerifyFail", notif_args);
+
+				delete unit;
+				unit = NULL;
+			}
+
+			filename = picker.getNextFile();
+		}
+		
+		sTimer.startTimer();
+	}
+
+	return add_successful;
+}
+
+void LLLocalBitmapMgr::delUnit(LLUUID tracking_id)
+{
+	if (!sBitmapList.empty())
+	{	
+		std::vector<LLLocalBitmap*> to_delete;
+		for (local_list_iter iter = sBitmapList.begin(); iter != sBitmapList.end(); iter++)
+		{   /* finding which ones we want deleted and making a separate list */
+			LLLocalBitmap* unit = *iter;
+			if (unit->getTrackingID() == tracking_id)
+			{
+				to_delete.push_back(unit);
+			}
+		}
+
+		for(std::vector<LLLocalBitmap*>::iterator del_iter = to_delete.begin();
+			del_iter != to_delete.end(); del_iter++)
+		{   /* iterating over a temporary list, hence preserving the iterator validity while deleting. */
+			LLLocalBitmap* unit = *del_iter;
+			sBitmapList.remove(unit);
+			delete unit;
+			unit = NULL;
+		}
+	}
+}
+
+LLUUID LLLocalBitmapMgr::getWorldID(LLUUID tracking_id)
+{
+	LLUUID world_id = LLUUID::null;
+
+	for (local_list_iter iter = sBitmapList.begin(); iter != sBitmapList.end(); iter++)
+	{
+		LLLocalBitmap* unit = *iter;
+		if (unit->getTrackingID() == tracking_id)
+		{
+			world_id = unit->getWorldID();
+		}
+	}
+
+	return world_id;
+}
+
+std::string LLLocalBitmapMgr::getFilename(LLUUID tracking_id)
+{
+	std::string filename = "";
+
+	for (local_list_iter iter = sBitmapList.begin(); iter != sBitmapList.end(); iter++)
+	{
+		LLLocalBitmap* unit = *iter;
+		if (unit->getTrackingID() == tracking_id)
+		{
+			filename = unit->getFilename();
+		}
+	}
+
+	return filename;
+}
+
+void LLLocalBitmapMgr::feedScrollList(LLScrollListCtrl* ctrl)
+{
+	if (ctrl)
+	{
+		ctrl->clearRows();
+
+		if (!sBitmapList.empty())
+		{
+			for (local_list_iter iter = sBitmapList.begin();
+				 iter != sBitmapList.end(); iter++)
+			{
+				LLSD element;
+				element["columns"][0]["column"] = "unit_name";
+				element["columns"][0]["type"]   = "text";
+				element["columns"][0]["value"]  = (*iter)->getShortName();
+
+				element["columns"][1]["column"] = "unit_id_HIDDEN";
+				element["columns"][1]["type"]   = "text";
+				element["columns"][1]["value"]  = (*iter)->getTrackingID();
+
+				ctrl->addElement(element);
+			}
+		}
+	}
+
+}
+
+void LLLocalBitmapMgr::doUpdates()
+{
+	// preventing theoretical overlap in cases with huge number of loaded images.
+	sTimer.stopTimer();
+	sNeedsRebake = false;
+
+	for (local_list_iter iter = sBitmapList.begin(); iter != sBitmapList.end(); iter++)
+	{
+		(*iter)->updateSelf();
+	}
+
+	doRebake();
+	sTimer.startTimer();
+}
+
+void LLLocalBitmapMgr::setNeedsRebake()
+{
+	sNeedsRebake = true;
+}
+
+void LLLocalBitmapMgr::doRebake()
+{ /* separated that from doUpdates to insure a rebake can be called separately during deletion */
+	if (sNeedsRebake)
+	{
+		gAgentAvatarp->forceBakeAllTextures(LL_LOCAL_SLAM_FOR_DEBUG);
+		sNeedsRebake = false;
+	}
+}
+
diff --git a/indra/newview/lllocalbitmaps.h b/indra/newview/lllocalbitmaps.h
new file mode 100644
index 0000000000000000000000000000000000000000..7a23c7ef6e3d2a203b07b4137960f58e00fafd40
--- /dev/null
+++ b/indra/newview/lllocalbitmaps.h
@@ -0,0 +1,136 @@
+/** 
+ * @file lllocalbitmaps.h
+ * @author Vaalith Jinn
+ * @brief Local Bitmaps header
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LOCALBITMAPS_H
+#define LL_LOCALBITMAPS_H
+
+#include "lleventtimer.h"
+#include "llwearabletype.h"
+#include "llvoavatardefines.h"
+
+class LLScrollListCtrl;
+
+class LLLocalBitmap
+{
+	public: /* main */
+		LLLocalBitmap(std::string filename);
+		~LLLocalBitmap();
+
+	public: /* accessors */
+		std::string	getFilename();
+		std::string	getShortName();
+		LLUUID		getTrackingID();
+		LLUUID		getWorldID();
+		bool		getValid();
+
+	public: /* self update public section */
+		enum EUpdateType
+		{
+			UT_FIRSTUSE,
+			UT_REGUPDATE
+		};
+
+		bool updateSelf(EUpdateType = UT_REGUPDATE);
+
+	private: /* self update private section */
+		bool decodeBitmap(LLPointer<LLImageRaw> raw);
+		void replaceIDs(LLUUID old_id, LLUUID new_id);
+		std::vector<LLViewerObject*> prepUpdateObjects(LLUUID old_id);
+		void updateUserPrims(LLUUID old_id, LLUUID new_id);
+		void updateUserSculpts(LLUUID old_id, LLUUID new_id);
+		void updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableType::EType type);
+		LLVOAvatarDefines::ETextureIndex getTexIndex(LLWearableType::EType type, LLVOAvatarDefines::EBakedTextureIndex baked_texind);
+
+	private: /* private enums */
+		enum ELinkStatus
+		{
+			LS_ON,
+			LS_BROKEN,
+		};
+
+		enum EExtension
+		{
+			ET_IMG_BMP,
+			ET_IMG_TGA,
+			ET_IMG_JPG,
+			ET_IMG_PNG
+		};
+
+	private: /* members */
+		std::string mFilename;
+		std::string mShortName;
+		LLUUID      mTrackingID;
+		LLUUID      mWorldID;
+		bool        mValid;
+		LLSD        mLastModified;
+		EExtension  mExtension;
+		ELinkStatus mLinkStatus;
+		S32         mUpdateRetries;
+
+};
+
+class LLLocalBitmapTimer : public LLEventTimer
+{
+	public:
+		LLLocalBitmapTimer();
+		~LLLocalBitmapTimer();
+
+	public:
+		void startTimer();
+		void stopTimer();
+		bool isRunning();
+		BOOL tick();
+
+};
+
+class LLLocalBitmapMgr
+{
+	public:
+		LLLocalBitmapMgr();
+		~LLLocalBitmapMgr();
+
+	public:
+		static bool         addUnit();
+		static void         delUnit(LLUUID tracking_id);
+
+		static LLUUID       getWorldID(LLUUID tracking_id);
+		static std::string  getFilename(LLUUID tracking_id);
+		
+		static void         feedScrollList(LLScrollListCtrl* ctrl);
+		static void         doUpdates();
+		static void         setNeedsRebake();
+		static void         doRebake();
+		
+	private:
+		static std::list<LLLocalBitmap*>    sBitmapList;
+		static LLLocalBitmapTimer           sTimer;
+		static bool                         sNeedsRebake;
+		typedef std::list<LLLocalBitmap*>::iterator local_list_iter;
+};
+
+#endif
+
diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp
index 85e00436510ee64a187ef4cb69c6d1d6d97b3106..6e0f360cbc05174e8fde998bde64e2e8bec141e7 100644
--- a/indra/newview/llmanip.cpp
+++ b/indra/newview/llmanip.cpp
@@ -372,14 +372,14 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z)
 	//LLVector3  center_agent  = LLSelectMgr::getInstance()->getBBoxOfSelection().getCenterAgent();
 	LLVector3  center_agent  = getPivotPoint();
 
-	glPushMatrix();
+	gGL.pushMatrix();
 	{
-		glTranslatef(center_agent.mV[VX], center_agent.mV[VY], center_agent.mV[VZ]);
+		gGL.translatef(center_agent.mV[VX], center_agent.mV[VY], center_agent.mV[VZ]);
 
 		F32 angle_radians, x, y, z;
 
 		grid_rot.getAngleAxis(&angle_radians, &x, &y, &z);
-		glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
+		gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
 
 		F32 region_size = LLWorld::getInstance()->getRegionWidthInMeters();
 
@@ -416,7 +416,7 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z)
 		}
 		LLUI::setLineWidth(1.0f);
 	}
-	glPopMatrix();
+	gGL.popMatrix();
 }
 
 void LLManip::renderXYZ(const LLVector3 &vec) 
@@ -466,11 +466,11 @@ void LLManip::renderXYZ(const LLVector3 &vec)
 		feedback_string = llformat("X: %.3f", vec.mV[VX]);
 		hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -102.f, (F32)vertical_offset, LLColor4(1.f, 0.5f, 0.5f, 1.f), FALSE);
 
-		glColor3f(0.5f, 1.f, 0.5f);
+		gGL.diffuseColor3f(0.5f, 1.f, 0.5f);
 		feedback_string = llformat("Y: %.3f", vec.mV[VY]);
 		hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -27.f, (F32)vertical_offset, LLColor4(0.5f, 1.f, 0.5f, 1.f), FALSE);
 		
-		glColor3f(0.5f, 0.5f, 1.f);
+		gGL.diffuseColor3f(0.5f, 0.5f, 1.f);
 		feedback_string = llformat("Z: %.3f", vec.mV[VZ]);
 		hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, 48.f, (F32)vertical_offset, LLColor4(0.5f, 0.5f, 1.f, 1.f), FALSE);
 	}
@@ -481,8 +481,8 @@ void LLManip::renderTickText(const LLVector3& pos, const std::string& text, cons
 	const LLFontGL* big_fontp = LLFontGL::getFontSansSerif();
 
 	BOOL hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD;
-	glMatrixMode(GL_MODELVIEW);
-	glPushMatrix();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
+	gGL.pushMatrix();
 	LLVector3 render_pos = pos;
 	if (hud_selection)
 	{
@@ -490,7 +490,7 @@ void LLManip::renderTickText(const LLVector3& pos, const std::string& text, cons
 		F32 inv_zoom_amt = 1.f / zoom_amt;
 		// scale text back up to counter-act zoom level
 		render_pos = pos * zoom_amt;
-		glScalef(inv_zoom_amt, inv_zoom_amt, inv_zoom_amt);
+		gGL.scalef(inv_zoom_amt, inv_zoom_amt, inv_zoom_amt);
 	}
 
 	// render shadow first
@@ -501,7 +501,7 @@ void LLManip::renderTickText(const LLVector3& pos, const std::string& text, cons
 	gViewerWindow->setup3DViewport();
 	hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
 
-	glPopMatrix();
+	gGL.popMatrix();
 }
 
 void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string& suffix, const LLColor4 &color)
@@ -539,8 +539,8 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string
 	}
 
 	BOOL hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD;
-	glMatrixMode(GL_MODELVIEW);
-	glPushMatrix();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
+	gGL.pushMatrix();
 	LLVector3 render_pos = pos;
 	if (hud_selection)
 	{
@@ -548,7 +548,7 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string
 		F32 inv_zoom_amt = 1.f / zoom_amt;
 		// scale text back up to counter-act zoom level
 		render_pos = pos * zoom_amt;
-		glScalef(inv_zoom_amt, inv_zoom_amt, inv_zoom_amt);
+		gGL.scalef(inv_zoom_amt, inv_zoom_amt, inv_zoom_amt);
 	}
 
 	LLColor4 shadow_color = LLColor4::black;
@@ -573,7 +573,7 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string
 		gViewerWindow->setup3DViewport();
 		hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection);
 	}
-	glPopMatrix();
+	gGL.popMatrix();
 }
 
 LLColor4 LLManip::setupSnapGuideRenderPass(S32 pass)
diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp
index 6ee095475fb04fc73e69ee9fee82dc887229ef58..a8da94f75e2f1809e1d553bab8c57d3ceb3d6e2e 100644
--- a/indra/newview/llmaniprotate.cpp
+++ b/indra/newview/llmaniprotate.cpp
@@ -53,6 +53,7 @@
 #include "llviewercamera.h"
 #include "llviewerobject.h"
 #include "llviewerobject.h"
+#include "llviewershadermgr.h"
 #include "llviewerwindow.h"
 #include "llworld.h"
 #include "pipeline.h"
@@ -113,7 +114,7 @@ void LLManipRotate::handleSelect()
 void LLManipRotate::render()
 {
 	LLGLSUIDefault gls_ui;
-	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+	gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep);
 	LLGLDepthTest gls_depth(GL_TRUE);
 	LLGLEnable gl_blend(GL_BLEND);
 	LLGLEnable gls_alpha_test(GL_ALPHA_TEST);
@@ -130,12 +131,12 @@ void LLManipRotate::render()
 		return;
 	}
 
-	glMatrixMode(GL_MODELVIEW);
-	glPushMatrix();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
+	gGL.pushMatrix();
 	if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
 	{
 		F32 zoom = gAgentCamera.mHUDCurZoom;
-		glScalef(zoom, zoom, zoom);
+		gGL.scalef(zoom, zoom, zoom);
 	}
 
 
@@ -145,8 +146,9 @@ void LLManipRotate::render()
 	LLColor4 highlight_inside( 0.7f, 0.7f, 0.f, 0.5f );
 	F32 width_meters = WIDTH_PIXELS * mRadiusMeters / RADIUS_PIXELS;
 
-	glPushMatrix();
+	gGL.pushMatrix();
 	{
+		
 		// are we in the middle of a constrained drag?
 		if (mManipPart >= LL_ROT_X && mManipPart <= LL_ROT_Z)
 		{
@@ -154,13 +156,18 @@ void LLManipRotate::render()
 		}
 		else
 		{
+			if (LLGLSLShader::sNoFixedFunction)
+			{
+				gDebugProgram.bind();
+			}
+
 			LLGLEnable cull_face(GL_CULL_FACE);
 			LLGLDepthTest gls_depth(GL_FALSE);
-			glPushMatrix();
+			gGL.pushMatrix();
 			{
 				// Draw "sphere" (intersection of sphere with tangent cone that has apex at camera)
-				glTranslatef( mCenterToProfilePlane.mV[VX], mCenterToProfilePlane.mV[VY], mCenterToProfilePlane.mV[VZ] );
-				glTranslatef( center.mV[VX], center.mV[VY], center.mV[VZ] );
+				gGL.translatef( mCenterToProfilePlane.mV[VX], mCenterToProfilePlane.mV[VY], mCenterToProfilePlane.mV[VZ] );
+				gGL.translatef( center.mV[VX], center.mV[VY], center.mV[VZ] );
 
 				// Inverse change of basis vectors
 				LLVector3 forward = mCenterToCamNorm;
@@ -177,35 +184,41 @@ void LLManipRotate::render()
 				LLMatrix4 mat;
 				mat.initRows(a, b, c, LLVector4(0.f, 0.f, 0.f, 1.f));
 
-				glMultMatrixf( &mat.mMatrix[0][0] );
+				gGL.multMatrix( &mat.mMatrix[0][0] );
 
-				glRotatef( -90, 0.f, 1.f, 0.f);
+				gGL.rotatef( -90, 0.f, 1.f, 0.f);
 				LLColor4 color;
 				if (mManipPart == LL_ROT_ROLL || mHighlightedPart == LL_ROT_ROLL)
 				{
 					color.setVec(0.8f, 0.8f, 0.8f, 0.8f);
-					glScalef(mManipulatorScales.mV[VW], mManipulatorScales.mV[VW], mManipulatorScales.mV[VW]);
+					gGL.scalef(mManipulatorScales.mV[VW], mManipulatorScales.mV[VW], mManipulatorScales.mV[VW]);
 				}
 				else
 				{
 					color.setVec( 0.7f, 0.7f, 0.7f, 0.6f );
 				}
+				gGL.diffuseColor4fv(color.mV);
 				gl_washer_2d(mRadiusMeters + width_meters, mRadiusMeters, CIRCLE_STEPS, color, color);
 
 
 				if (mManipPart == LL_NO_PART)
 				{
 					gGL.color4f( 0.7f, 0.7f, 0.7f, 0.3f );
+					gGL.diffuseColor4f(0.7f, 0.7f, 0.7f, 0.3f);
 					gl_circle_2d( 0, 0,  mRadiusMeters, CIRCLE_STEPS, TRUE );
 				}
 				
-				GLdouble plane_eqn[] = { 0, 0, 1, 0 };
-				glClipPlane( GL_CLIP_PLANE0, plane_eqn );
+				gGL.flush();
 			}
-			glPopMatrix();
-		}
+			gGL.popMatrix();
 
-		glTranslatef( center.mV[VX], center.mV[VY], center.mV[VZ] );
+			if (LLGLSLShader::sNoFixedFunction)
+			{
+				gUIProgram.bind();
+			}
+		}
+		
+		gGL.translatef( center.mV[VX], center.mV[VY], center.mV[VZ] );
 
 		LLQuaternion rot;
 		F32 angle_radians, x, y, z;
@@ -217,41 +230,46 @@ void LLManipRotate::render()
 		LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
 
 		grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z);
-		glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
+		gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
 
 
+		if (LLGLSLShader::sNoFixedFunction)
+		{
+			gDebugProgram.bind();
+		}
+
 		if (mManipPart == LL_ROT_Z)
 		{
 			mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
-			glPushMatrix();
+			gGL.pushMatrix();
 			{
 				// selected part
-				glScalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]);
+				gGL.scalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]);
 				renderActiveRing( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 1.f, 1.f) , LLColor4( 0.f, 0.f, 1.f, 0.3f ));
 			}
-			glPopMatrix();
+			gGL.popMatrix();
 		}
 		else if (mManipPart == LL_ROT_Y)
 		{
 			mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
-			glPushMatrix();
+			gGL.pushMatrix();
 			{
-				glRotatef( 90.f, 1.f, 0.f, 0.f );
-				glScalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]);
+				gGL.rotatef( 90.f, 1.f, 0.f, 0.f );
+				gGL.scalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]);
 				renderActiveRing( mRadiusMeters, width_meters, LLColor4( 0.f, 1.f, 0.f, 1.f), LLColor4( 0.f, 1.f, 0.f, 0.3f));
 			}
-			glPopMatrix();
+			gGL.popMatrix();
 		}
 		else if (mManipPart == LL_ROT_X)
 		{
 			mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
-			glPushMatrix();
+			gGL.pushMatrix();
 			{
-				glRotatef( 90.f, 0.f, 1.f, 0.f );
-				glScalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]);
+				gGL.rotatef( 90.f, 0.f, 1.f, 0.f );
+				gGL.scalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]);
 				renderActiveRing( mRadiusMeters, width_meters, LLColor4( 1.f, 0.f, 0.f, 1.f), LLColor4( 1.f, 0.f, 0.f, 0.3f));
 			}
-			glPopMatrix();
+			gGL.popMatrix();
 		}
 		else if (mManipPart == LL_ROT_ROLL)
 		{
@@ -271,12 +289,13 @@ void LLManipRotate::render()
 			// First pass: centers. Second pass: sides.
 			for( S32 i=0; i<2; i++ )
 			{
-				glPushMatrix();
+				
+				gGL.pushMatrix();
 				{
 					if (mHighlightedPart == LL_ROT_Z)
 					{
 						mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
-						glScalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]);
+						gGL.scalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]);
 						// hovering over part
 						gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 1.f, 1.f ), LLColor4( 0.f, 0.f, 1.f, 0.5f ), CIRCLE_STEPS, i);
 					}
@@ -286,15 +305,15 @@ void LLManipRotate::render()
 						gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 0.8f, 0.8f ), LLColor4( 0.f, 0.f, 0.8f, 0.4f ), CIRCLE_STEPS, i);
 					}
 				}
-				glPopMatrix();
-
-				glPushMatrix();
+				gGL.popMatrix();
+				
+				gGL.pushMatrix();
 				{
-					glRotatef( 90.f, 1.f, 0.f, 0.f );
+					gGL.rotatef( 90.f, 1.f, 0.f, 0.f );
 					if (mHighlightedPart == LL_ROT_Y)
 					{
 						mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
-						glScalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]);
+						gGL.scalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]);
 						// hovering over part
 						gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 1.f, 0.f, 1.f ), LLColor4( 0.f, 1.f, 0.f, 0.5f ), CIRCLE_STEPS, i);
 					}
@@ -304,15 +323,15 @@ void LLManipRotate::render()
 						gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.8f, 0.f, 0.8f ), LLColor4( 0.f, 0.8f, 0.f, 0.4f ), CIRCLE_STEPS, i);
 					}						
 				}
-				glPopMatrix();
+				gGL.popMatrix();
 
-				glPushMatrix();
+				gGL.pushMatrix();
 				{
-					glRotatef( 90.f, 0.f, 1.f, 0.f );
+					gGL.rotatef( 90.f, 0.f, 1.f, 0.f );
 					if (mHighlightedPart == LL_ROT_X)
 					{
 						mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
-						glScalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]);
+						gGL.scalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]);
 	
 						// hovering over part
 						gl_ring( mRadiusMeters, width_meters, LLColor4( 1.f, 0.f, 0.f, 1.f ), LLColor4( 1.f, 0.f, 0.f, 0.5f ), CIRCLE_STEPS, i);
@@ -323,17 +342,26 @@ void LLManipRotate::render()
 						gl_ring( mRadiusMeters, width_meters, LLColor4( 0.8f, 0.f, 0.f, 0.8f ), LLColor4( 0.8f, 0.f, 0.f, 0.4f ), CIRCLE_STEPS, i);
 					}
 				}
-				glPopMatrix();
+				gGL.popMatrix();
 
 				if (mHighlightedPart == LL_ROT_ROLL)
 				{
 					mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
 				}
+				
 			}
+			
 		}
+
+		if (LLGLSLShader::sNoFixedFunction)
+		{
+			gUIProgram.bind();
+		}
+		
 	}
-	glPopMatrix();
-	glPopMatrix();
+	gGL.popMatrix();
+	gGL.popMatrix();
+	
 
 	LLVector3 euler_angles;
 	LLQuaternion object_rot = first_object->getRotationEdit();
@@ -796,14 +824,14 @@ void LLManipRotate::renderSnapGuides()
 		for (S32 pass = 0; pass < 3; pass++)
 		{
 			// render snap guide ring
-			glPushMatrix();
+			gGL.pushMatrix();
 			
 			LLQuaternion snap_guide_rot;
 			F32 angle_radians, x, y, z;
 			snap_guide_rot.shortestArc(LLVector3::z_axis, getConstraintAxis());
 			snap_guide_rot.getAngleAxis(&angle_radians, &x, &y, &z);
-			glTranslatef(center.mV[VX], center.mV[VY], center.mV[VZ]);
-			glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
+			gGL.translatef(center.mV[VX], center.mV[VY], center.mV[VZ]);
+			gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
 
 			LLColor4 line_color = setupSnapGuideRenderPass(pass);
 
@@ -826,7 +854,7 @@ void LLManipRotate::renderSnapGuides()
 			{
 				gl_circle_2d(0.f, 0.f, mRadiusMeters * SNAP_GUIDE_INNER_RADIUS, CIRCLE_STEPS, FALSE);
 			}
-			glPopMatrix();
+			gGL.popMatrix();
 
 			for (S32 i = 0; i < 64; i++)
 			{
diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp
index 4eb94dfb8e805997665212b06761bd929675cc30..f6df4cdfbfe0c8530d5c3efa9eb56858e4d315d1 100644
--- a/indra/newview/llmanipscale.cpp
+++ b/indra/newview/llmanipscale.cpp
@@ -217,12 +217,12 @@ void LLManipScale::render()
 	
 	if( canAffectSelection() )
 	{
-		glMatrixMode(GL_MODELVIEW);
-		glPushMatrix();
+		gGL.matrixMode(LLRender::MM_MODELVIEW);
+		gGL.pushMatrix();
 		if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
 		{
 			F32 zoom = gAgentCamera.mHUDCurZoom;
-			glScalef(zoom, zoom, zoom);
+			gGL.scalef(zoom, zoom, zoom);
 		}
 
 		////////////////////////////////////////////////////////////////////////
@@ -274,14 +274,14 @@ void LLManipScale::render()
 		LLVector3 pos_agent = bbox.getPositionAgent();
 		LLQuaternion rot = bbox.getRotation();
 
-		glMatrixMode(GL_MODELVIEW);
-		glPushMatrix();
+		gGL.matrixMode(LLRender::MM_MODELVIEW);
+		gGL.pushMatrix();
 		{
-			glTranslatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ]);
+			gGL.translatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ]);
 
 			F32 angle_radians, x, y, z;
 			rot.getAngleAxis(&angle_radians, &x, &y, &z);
-			glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
+			gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
 
 			
 			{
@@ -303,13 +303,13 @@ void LLManipScale::render()
 				glPolygonOffset( 0.f, 0.f);
 			}
 		}
-		glPopMatrix();
+		gGL.popMatrix();
 
 		if (mManipPart != LL_NO_PART)
 		{
 			renderSnapGuides(bbox);
 		}
-		glPopMatrix();
+		gGL.popMatrix();
 
 		renderXYZ(bbox.getExtentLocal());
 	}
@@ -719,17 +719,17 @@ void LLManipScale::renderEdges( const LLBBox& bbox )
 		LLVector3 direction = edgeToUnitVector( part );
 		LLVector3 center_to_edge = unitVectorToLocalBBoxExtent( direction, bbox );
 
-		glPushMatrix();
+		gGL.pushMatrix();
 		{
-			glTranslatef( center_to_edge.mV[0], center_to_edge.mV[1], center_to_edge.mV[2] );
+			gGL.translatef( center_to_edge.mV[0], center_to_edge.mV[1], center_to_edge.mV[2] );
 			conditionalHighlight( part );
-			glScalef( 
+			gGL.scalef( 
 				direction.mV[0] ? edge_width : extent.mV[VX],
 				direction.mV[1] ? edge_width : extent.mV[VY],
 				direction.mV[2] ? edge_width : extent.mV[VZ] );
 			gBox.render();
 		}
-		glPopMatrix();
+		gGL.popMatrix();
 	}
 }
 
@@ -766,13 +766,13 @@ void LLManipScale::renderBoxHandle( F32 x, F32 y, F32 z )
 	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 	LLGLDepthTest gls_depth(GL_FALSE);
 
-	glPushMatrix();
+	gGL.pushMatrix();
 	{
-		glTranslatef( x, y, z );
-		glScalef( mScaledBoxHandleSize, mScaledBoxHandleSize, mScaledBoxHandleSize );
+		gGL.translatef( x, y, z );
+		gGL.scalef( mScaledBoxHandleSize, mScaledBoxHandleSize, mScaledBoxHandleSize );
 		gBox.render();
 	}
-	glPopMatrix();
+	gGL.popMatrix();
 }
 
 
@@ -788,16 +788,16 @@ void LLManipScale::renderAxisHandle( const LLVector3& start, const LLVector3& en
 		LLVector3 delta = end - offset_start;
 		LLVector3 pos = offset_start + 0.5f * delta;
 
-		glPushMatrix();
+		gGL.pushMatrix();
 		{
-			glTranslatef( pos.mV[VX], pos.mV[VY], pos.mV[VZ] );
-			glScalef( 
+			gGL.translatef( pos.mV[VX], pos.mV[VY], pos.mV[VZ] );
+			gGL.scalef( 
 				mBoxHandleSize + llabs(delta.mV[VX]),
 				mBoxHandleSize + llabs(delta.mV[VY]),
 				mBoxHandleSize + llabs(delta.mV[VZ]));
 			gBox.render();
 		}
-		glPopMatrix();
+		gGL.popMatrix();
 	}
 	else
 	{
diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp
index f871df0c36cc787abe6a9081f33961f4e16512e3..3a88fbd96deab76c4a0a8811d5f5497071cc6f43 100644
--- a/indra/newview/llmaniptranslate.cpp
+++ b/indra/newview/llmaniptranslate.cpp
@@ -1066,12 +1066,12 @@ BOOL LLManipTranslate::handleMouseUp(S32 x, S32 y, MASK mask)
 
 void LLManipTranslate::render()
 {
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.pushMatrix();
 	if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
 	{
 		F32 zoom = gAgentCamera.mHUDCurZoom;
-		glScalef(zoom, zoom, zoom);
+		gGL.scalef(zoom, zoom, zoom);
 	}
 	{
 		LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
@@ -1515,11 +1515,12 @@ void LLManipTranslate::renderSnapGuides()
 		F32 x,y,z,angle_radians;
 		grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z);
 		gGL.translatef(selection_center.mV[VX], selection_center.mV[VY], selection_center.mV[VZ]);
-		glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
+		gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
 		
 		F32 sz = mGridSizeMeters;
 		F32 tiles = sz;
-		glMatrixMode(GL_TEXTURE);
+
+		gGL.matrixMode(LLRender::MM_TEXTURE);
 		gGL.pushMatrix();
 		usc = 1.0f/usc;
 		vsc = 1.0f/vsc;
@@ -1533,7 +1534,7 @@ void LLManipTranslate::renderSnapGuides()
 			vsc *= 0.5f;
 		}
 
-		glScalef(usc, vsc, 1.0f);
+		gGL.scalef(usc, vsc, 1.0f);
 		gGL.translatef(u, v, 0);
 		
 		float a = line_alpha;
@@ -1566,7 +1567,7 @@ void LLManipTranslate::renderSnapGuides()
 					renderGrid(u,v,tiles,1,1,1,a);
 
 					gGL.popMatrix();
-					glMatrixMode(GL_MODELVIEW);
+					gGL.matrixMode(LLRender::MM_MODELVIEW);
 					gGL.popMatrix();
 				}
 
@@ -1665,7 +1666,7 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal,
 		glStencilFunc(GL_ALWAYS, 0, stencil_mask);
 		gGL.setColorMask(false, false);
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-		glColor4f(1,1,1,1);
+		gGL.diffuseColor4f(1,1,1,1);
 
 		//setup clip plane
 		normal = normal * grid_rotation;
@@ -1723,7 +1724,7 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal,
 	F32 x,y,z,angle_radians;
 	grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z);
 	gGL.translatef(selection_center.mV[VX], selection_center.mV[VY], selection_center.mV[VZ]);
-	glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
+	gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
 	
 	F32 sz = mGridSizeMeters;
 	F32 tiles = sz;
@@ -1852,7 +1853,7 @@ void LLManipTranslate::renderTranslationHandles()
 	mGridSizeMeters = gSavedSettings.getF32("GridDrawSize");
 	mConeSize = mArrowLengthMeters / 4.f;
 
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.pushMatrix();
 	{
 		gGL.translatef(selection_center.mV[VX], selection_center.mV[VY], selection_center.mV[VZ]);
@@ -1860,7 +1861,7 @@ void LLManipTranslate::renderTranslationHandles()
 		F32 angle_radians, x, y, z;
 		grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z);
 
-		glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
+		gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
 
 		LLQuaternion invRotation = grid_rotation;
 		invRotation.conjQuat();
@@ -1908,9 +1909,9 @@ void LLManipTranslate::renderTranslationHandles()
 			{
 				// render YZ plane manipulator
 				gGL.pushMatrix();
-				glScalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]);
+				gGL.scalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]);
 				gGL.translatef(0.f, mPlaneManipOffsetMeters, mPlaneManipOffsetMeters);
-				glScalef(mPlaneScales.mV[VX], mPlaneScales.mV[VX], mPlaneScales.mV[VX]);
+				gGL.scalef(mPlaneScales.mV[VX], mPlaneScales.mV[VX], mPlaneScales.mV[VX]);
 				if (mHighlightedPart == LL_YZ_PLANE)
 				{
 					color1.setVec(0.f, 1.f, 0.f, 1.f);
@@ -1962,9 +1963,9 @@ void LLManipTranslate::renderTranslationHandles()
 			{
 				// render XZ plane manipulator
 				gGL.pushMatrix();
-				glScalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]);
+				gGL.scalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]);
 				gGL.translatef(mPlaneManipOffsetMeters, 0.f, mPlaneManipOffsetMeters);
-				glScalef(mPlaneScales.mV[VY], mPlaneScales.mV[VY], mPlaneScales.mV[VY]);
+				gGL.scalef(mPlaneScales.mV[VY], mPlaneScales.mV[VY], mPlaneScales.mV[VY]);
 				if (mHighlightedPart == LL_XZ_PLANE)
 				{
 					color1.setVec(0.f, 0.f, 1.f, 1.f);
@@ -2018,7 +2019,7 @@ void LLManipTranslate::renderTranslationHandles()
 			{
 				// render XY plane manipulator
 				gGL.pushMatrix();
-				glScalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]);
+				gGL.scalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]);
 				
 /*				 			  Y
 				 			  ^
@@ -2043,7 +2044,7 @@ void LLManipTranslate::renderTranslationHandles()
 					v2 = LLVector3(mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), 0.f);
 					v3 = LLVector3(mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.75f), mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), 0.f);
 #endif
-					glScalef(mPlaneScales.mV[VZ], mPlaneScales.mV[VZ], mPlaneScales.mV[VZ]);
+					gGL.scalef(mPlaneScales.mV[VZ], mPlaneScales.mV[VZ], mPlaneScales.mV[VZ]);
 					if (mHighlightedPart == LL_XY_PLANE)
 					{
 						color1.setVec(1.f, 0.f, 0.f, 1.f);
@@ -2215,7 +2216,7 @@ void LLManipTranslate::renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_
 		}
 		
 		gGL.translatef(vec.mV[0], vec.mV[1], vec.mV[2]);
-		glScalef(handle_size, handle_size, handle_size);
+		gGL.scalef(handle_size, handle_size, handle_size);
 
 		F32 rot = 0.0f;
 		LLVector3 axis;
@@ -2239,11 +2240,11 @@ void LLManipTranslate::renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_
 			break;
 		}
 
-		glColor4fv(color.mV);
-		glRotatef(rot, axis.mV[0], axis.mV[1], axis.mV[2]);
-		glScalef(mArrowScales.mV[index], mArrowScales.mV[index], mArrowScales.mV[index] * 1.5f);
+		gGL.diffuseColor4fv(color.mV);
+		gGL.rotatef(rot, axis.mV[0], axis.mV[1], axis.mV[2]);
+		gGL.scalef(mArrowScales.mV[index], mArrowScales.mV[index], mArrowScales.mV[index] * 1.5f);
 
-		gCone.render(CONE_LOD_HIGHEST);
+		gCone.render();
 
 		gGL.popMatrix();
 	}
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..93dd82957f5316b7eb0a915d76b5a1ab65cc03fb
--- /dev/null
+++ b/indra/newview/llmarketplacefunctions.cpp
@@ -0,0 +1,478 @@
+/** 
+ * @file llmarketplacefunctions.cpp
+ * @brief Implementation of assorted functions related to the marketplace
+ *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llmarketplacefunctions.h"
+
+#include "llagent.h"
+#include "llhttpclient.h"
+#include "lltimer.h"
+#include "lltrans.h"
+#include "llviewercontrol.h"
+#include "llviewermedia.h"
+#include "llviewernetwork.h"
+
+
+//
+// Helpers
+//
+
+static std::string getMarketplaceDomain()
+{
+	std::string domain = "secondlife.com";
+	
+	if (!LLGridManager::getInstance()->isInProductionGrid())
+	{
+		const std::string& grid_label = LLGridManager::getInstance()->getGridLabel();
+		const std::string& grid_label_lower = utf8str_tolower(grid_label);
+		
+		if (grid_label_lower == "damballah")
+		{
+			domain = "secondlife-staging.com";
+		}
+		else
+		{
+			domain = llformat("%s.lindenlab.com", grid_label_lower.c_str());
+		}
+	}
+	
+	return domain;
+}
+
+static std::string getMarketplaceURL(const std::string& urlStringName)
+{
+	LLStringUtil::format_map_t domain_arg;
+	domain_arg["[MARKETPLACE_DOMAIN_NAME]"] = getMarketplaceDomain();
+	
+	std::string marketplace_url = LLTrans::getString(urlStringName, domain_arg);
+	
+	return marketplace_url;
+}
+
+LLSD getMarketplaceStringSubstitutions()
+{
+	std::string marketplace_url = getMarketplaceURL("MarketplaceURL");
+	std::string marketplace_url_create = getMarketplaceURL("MarketplaceURL_CreateStore");
+	std::string marketplace_url_dashboard = getMarketplaceURL("MarketplaceURL_Dashboard");
+	std::string marketplace_url_imports = getMarketplaceURL("MarketplaceURL_Imports");
+	std::string marketplace_url_info = getMarketplaceURL("MarketplaceURL_LearnMore");
+	
+	LLSD marketplace_sub_map;
+
+	marketplace_sub_map["[MARKETPLACE_URL]"] = marketplace_url;
+	marketplace_sub_map["[MARKETPLACE_CREATE_STORE_URL]"] = marketplace_url_create;
+	marketplace_sub_map["[MARKETPLACE_LEARN_MORE_URL]"] = marketplace_url_info;
+	marketplace_sub_map["[MARKETPLACE_DASHBOARD_URL]"] = marketplace_url_dashboard;
+	marketplace_sub_map["[MARKETPLACE_IMPORTS_URL]"] = marketplace_url_imports;
+	
+	return marketplace_sub_map;
+}
+
+namespace LLMarketplaceImport
+{
+	// Basic interface for this namespace
+
+	bool hasSessionCookie();
+	bool inProgress();
+	bool resultPending();
+	U32 getResultStatus();
+	const LLSD& getResults();
+
+	bool establishMarketplaceSessionCookie();
+	bool pollStatus();
+	bool triggerImport();
+	
+	// Internal state variables
+
+	static std::string sMarketplaceCookie = "";
+	static LLSD sImportId = LLSD::emptyMap();
+	static bool sImportInProgress = false;
+	static bool sImportPostPending = false;
+	static bool sImportGetPending = false;
+	static U32 sImportResultStatus = 0;
+	static LLSD sImportResults = LLSD::emptyMap();
+
+	static LLTimer slmGetTimer;
+	static LLTimer slmPostTimer;
+
+	// Responders
+	
+	class LLImportPostResponder : public LLHTTPClient::Responder
+	{
+	public:
+		LLImportPostResponder() : LLCurl::Responder() {}
+		
+		void completed(U32 status, const std::string& reason, const LLSD& content)
+		{
+			slmPostTimer.stop();
+
+			if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
+			{
+				llinfos << " SLM POST status: " << status << llendl;
+				llinfos << " SLM POST reason: " << reason << llendl;
+				llinfos << " SLM POST content: " << content.asString() << llendl;
+
+				llinfos << " SLM POST timer: " << slmPostTimer.getElapsedTimeF32() << llendl;
+			}
+
+			if ((status == MarketplaceErrorCodes::IMPORT_REDIRECT) ||
+				(status == MarketplaceErrorCodes::IMPORT_AUTHENTICATION_ERROR) ||
+				(status == MarketplaceErrorCodes::IMPORT_JOB_TIMEOUT))
+			{
+				if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
+				{
+					llinfos << " SLM POST clearing marketplace cookie due to authentication failure or timeout" << llendl;
+				}
+
+				sMarketplaceCookie.clear();
+			}
+
+			sImportInProgress = (status == MarketplaceErrorCodes::IMPORT_DONE);
+			sImportPostPending = false;
+			sImportResultStatus = status;
+			sImportId = content;
+		}
+	};
+	
+	class LLImportGetResponder : public LLHTTPClient::Responder
+	{
+	public:
+		LLImportGetResponder() : LLCurl::Responder() {}
+		
+		void completedHeader(U32 status, const std::string& reason, const LLSD& content)
+		{
+			const std::string& set_cookie_string = content["set-cookie"].asString();
+			
+			if (!set_cookie_string.empty())
+			{
+				sMarketplaceCookie = set_cookie_string;
+			}
+		}
+		
+		void completed(U32 status, const std::string& reason, const LLSD& content)
+		{
+			slmGetTimer.stop();
+
+			if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
+			{
+				llinfos << " SLM GET status: " << status << llendl;
+				llinfos << " SLM GET reason: " << reason << llendl;
+				llinfos << " SLM GET content: " << content.asString() << llendl;
+
+				llinfos << " SLM GET timer: " << slmGetTimer.getElapsedTimeF32() << llendl;
+			}
+			
+			if ((status == MarketplaceErrorCodes::IMPORT_AUTHENTICATION_ERROR) ||
+				(status == MarketplaceErrorCodes::IMPORT_JOB_TIMEOUT))
+			{
+				if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
+				{
+					llinfos << " SLM GET clearing marketplace cookie due to authentication failure or timeout" << llendl;
+				}
+
+				sMarketplaceCookie.clear();
+			}
+
+			sImportInProgress = (status == MarketplaceErrorCodes::IMPORT_PROCESSING);
+			sImportGetPending = false;
+			sImportResultStatus = status;
+			sImportResults = content;
+		}
+	};
+
+	// Basic API
+
+	bool hasSessionCookie()
+	{
+		return !sMarketplaceCookie.empty();
+	}
+	
+	bool inProgress()
+	{
+		return sImportInProgress;
+	}
+	
+	bool resultPending()
+	{
+		return (sImportPostPending || sImportGetPending);
+	}
+	
+	U32 getResultStatus()
+	{
+		return sImportResultStatus;
+	}
+	
+	const LLSD& getResults()
+	{
+		return sImportResults;
+	}
+	
+	static std::string getInventoryImportURL()
+	{
+		std::string url = getMarketplaceURL("MarketplaceURL");
+		
+		url += "api/1/";
+		url += gAgent.getID().getString();
+		url += "/inventory/import/";
+		
+		return url;
+	}
+	
+	bool establishMarketplaceSessionCookie()
+	{
+		if (hasSessionCookie())
+		{
+			return false;
+		}
+
+		sImportInProgress = true;
+		sImportGetPending = true;
+		
+		std::string url = getInventoryImportURL();
+		
+		if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
+		{
+			llinfos << " SLM GET: " << url << llendl;
+		}
+
+		slmGetTimer.start();
+		LLHTTPClient::get(url, new LLImportGetResponder(), LLViewerMedia::getHeaders());
+		
+		return true;
+	}
+	
+	bool pollStatus()
+	{
+		if (!hasSessionCookie())
+		{
+			return false;
+		}
+		
+		sImportGetPending = true;
+
+		std::string url = getInventoryImportURL();
+
+		url += sImportId.asString();
+
+		// Make the headers for the post
+		LLSD headers = LLSD::emptyMap();
+		headers["Accept"] = "*/*";
+		headers["Cookie"] = sMarketplaceCookie;
+		headers["Content-Type"] = "application/llsd+xml";
+		headers["User-Agent"] = LLViewerMedia::getCurrentUserAgent();
+		
+		if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
+		{
+			llinfos << " SLM GET: " << url << llendl;
+		}
+
+		slmGetTimer.start();
+		LLHTTPClient::get(url, new LLImportGetResponder(), headers);
+		
+		return true;
+	}
+	
+	bool triggerImport()
+	{
+		if (!hasSessionCookie())
+		{
+			return false;
+		}
+
+		sImportId = LLSD::emptyMap();
+		sImportInProgress = true;
+		sImportPostPending = true;
+		sImportResultStatus = MarketplaceErrorCodes::IMPORT_PROCESSING;
+		sImportResults = LLSD::emptyMap();
+
+		std::string url = getInventoryImportURL();
+		
+		// Make the headers for the post
+		LLSD headers = LLSD::emptyMap();
+		headers["Accept"] = "*/*";
+		headers["Connection"] = "Keep-Alive";
+		headers["Cookie"] = sMarketplaceCookie;
+		headers["Content-Type"] = "application/xml";
+		headers["User-Agent"] = LLViewerMedia::getCurrentUserAgent();
+		
+		if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
+		{
+			llinfos << " SLM POST: " << url << llendl;
+		}
+
+		slmPostTimer.start();
+		LLHTTPClient::post(url, LLSD(), new LLImportPostResponder(), headers);
+		
+		return true;
+	}
+}
+
+
+//
+// Interface class
+//
+
+
+//static
+void LLMarketplaceInventoryImporter::update()
+{
+	if (instanceExists())
+	{
+		LLMarketplaceInventoryImporter::instance().updateImport();
+	}
+}
+
+LLMarketplaceInventoryImporter::LLMarketplaceInventoryImporter()
+	: mAutoTriggerImport(false)
+	, mImportInProgress(false)
+	, mInitialized(false)
+	, mErrorInitSignal(NULL)
+	, mStatusChangedSignal(NULL)
+	, mStatusReportSignal(NULL)
+{
+}
+
+boost::signals2::connection LLMarketplaceInventoryImporter::setInitializationErrorCallback(const status_report_signal_t::slot_type& cb)
+{
+	if (mErrorInitSignal == NULL)
+	{
+		mErrorInitSignal = new status_report_signal_t();
+	}
+	
+	return mErrorInitSignal->connect(cb);
+}
+
+boost::signals2::connection LLMarketplaceInventoryImporter::setStatusChangedCallback(const status_changed_signal_t::slot_type& cb)
+{
+	if (mStatusChangedSignal == NULL)
+	{
+		mStatusChangedSignal = new status_changed_signal_t();
+	}
+
+	return mStatusChangedSignal->connect(cb);
+}
+
+boost::signals2::connection LLMarketplaceInventoryImporter::setStatusReportCallback(const status_report_signal_t::slot_type& cb)
+{
+	if (mStatusReportSignal == NULL)
+	{
+		mStatusReportSignal = new status_report_signal_t();
+	}
+
+	return mStatusReportSignal->connect(cb);
+}
+
+void LLMarketplaceInventoryImporter::initialize()
+{
+	llassert(!mInitialized);
+
+	if (!LLMarketplaceImport::hasSessionCookie())
+	{
+		LLMarketplaceImport::establishMarketplaceSessionCookie();
+	}
+}
+
+void LLMarketplaceInventoryImporter::reinitializeAndTriggerImport()
+{
+	mInitialized = false;
+
+	initialize();
+
+	mAutoTriggerImport = true;
+}
+
+bool LLMarketplaceInventoryImporter::triggerImport()
+{
+	const bool import_triggered = LLMarketplaceImport::triggerImport();
+	
+	if (!import_triggered)
+	{
+		reinitializeAndTriggerImport();
+	}
+	
+	return import_triggered;
+}
+
+void LLMarketplaceInventoryImporter::updateImport()
+{
+	const bool in_progress = LLMarketplaceImport::inProgress();
+	
+	if (in_progress && !LLMarketplaceImport::resultPending())
+	{
+		const bool polling_status = LLMarketplaceImport::pollStatus();
+		
+		if (!polling_status)
+		{
+			reinitializeAndTriggerImport();
+		}
+	}	
+	
+	if (mImportInProgress != in_progress)
+	{
+		mImportInProgress = in_progress;
+
+		// If we are no longer in progress
+		if (!mImportInProgress)
+		{
+			if (mInitialized)
+			{
+				// Report results
+				if (mStatusReportSignal)
+				{
+					(*mStatusReportSignal)(LLMarketplaceImport::getResultStatus(), LLMarketplaceImport::getResults());
+				}
+			}
+			else
+			{
+				// Look for results success
+				mInitialized = LLMarketplaceImport::hasSessionCookie();
+				
+				if (mInitialized)
+				{
+					// Follow up with auto trigger of import
+					if (mAutoTriggerImport)
+					{
+						mAutoTriggerImport = false;
+
+						mImportInProgress = triggerImport();
+					}
+				}
+				else if (mErrorInitSignal)
+				{
+					(*mErrorInitSignal)(LLMarketplaceImport::getResultStatus(), LLMarketplaceImport::getResults());
+				}
+			}
+		}
+
+		// Make sure we trigger the status change with the final state (in case of auto trigger after initialize)
+		if (mStatusChangedSignal)
+		{
+			(*mStatusChangedSignal)(mImportInProgress);
+		}
+	}
+}
+
diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h
new file mode 100644
index 0000000000000000000000000000000000000000..4b8f7a1ac77676b1422fea28d7f1e5cc24aa9d19
--- /dev/null
+++ b/indra/newview/llmarketplacefunctions.h
@@ -0,0 +1,94 @@
+/** 
+ * @file llmarketplacefunctions.h
+ * @brief Miscellaneous marketplace-related functions and classes
+ * class definition
+ *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLMARKETPLACEFUNCTIONS_H
+#define LL_LLMARKETPLACEFUNCTIONS_H
+
+
+#include <llsd.h>
+#include <boost/function.hpp>
+#include <boost/signals2.hpp>
+
+#include "llsingleton.h"
+#include "llstring.h"
+
+
+LLSD getMarketplaceStringSubstitutions();
+
+
+namespace MarketplaceErrorCodes
+{
+	enum eCode
+	{
+		IMPORT_DONE = 200,
+		IMPORT_PROCESSING = 202,
+		IMPORT_REDIRECT = 302,
+		IMPORT_AUTHENTICATION_ERROR = 401,
+		IMPORT_DONE_WITH_ERRORS = 409,
+		IMPORT_JOB_FAILED = 410,
+		IMPORT_JOB_TIMEOUT = 499,
+	};
+}
+
+
+class LLMarketplaceInventoryImporter
+	: public LLSingleton<LLMarketplaceInventoryImporter>
+{
+public:
+	static void update();
+	
+	LLMarketplaceInventoryImporter();
+	
+	typedef boost::signals2::signal<void (bool)> status_changed_signal_t;
+	typedef boost::signals2::signal<void (U32, const LLSD&)> status_report_signal_t;
+
+	boost::signals2::connection setInitializationErrorCallback(const status_report_signal_t::slot_type& cb);
+	boost::signals2::connection setStatusChangedCallback(const status_changed_signal_t::slot_type& cb);
+	boost::signals2::connection setStatusReportCallback(const status_report_signal_t::slot_type& cb);
+	
+	void initialize();
+	bool triggerImport();
+	bool isImportInProgress() const { return mImportInProgress; }
+	
+protected:
+	void reinitializeAndTriggerImport();
+	void updateImport();
+	
+private:
+	bool mAutoTriggerImport;
+	bool mImportInProgress;
+	bool mInitialized;
+	
+	status_report_signal_t *	mErrorInitSignal;
+	status_changed_signal_t *	mStatusChangedSignal;
+	status_report_signal_t *	mStatusReportSignal;
+};
+
+
+
+#endif // LL_LLMARKETPLACEFUNCTIONS_H
+
diff --git a/indra/newview/llmarketplacenotifications.cpp b/indra/newview/llmarketplacenotifications.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..0886f9a99046605cef305496c0fc97c57ec072f9
--- /dev/null
+++ b/indra/newview/llmarketplacenotifications.cpp
@@ -0,0 +1,90 @@
+/** 
+ * @file llmarketplacenotifications.cpp
+ * @brief Handler for notifications related to marketplace file I/O
+ * class definition
+ *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+// Precompiled header
+#include "llviewerprecompiledheaders.h"
+
+#include "llmarketplacenotifications.h"
+#include "llnotificationsutil.h"
+
+#include "llerror.h"
+
+#include <boost/foreach.hpp>
+#include <boost/signals2.hpp>
+
+
+namespace LLMarketplaceInventoryNotifications
+{
+	typedef boost::signals2::signal<void (const LLSD& param)>	no_copy_payload_cb_signal_t;
+
+	static no_copy_payload_cb_signal_t*	no_copy_cb_action = NULL;
+	static bool							no_copy_notify_active = false;
+	static std::list<LLSD>				no_copy_payloads;
+
+	void notifyNoCopyCallback(const LLSD& notification, const LLSD& response)
+	{
+		const S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+		
+		if (option == 0)
+		{
+			llassert(!no_copy_payloads.empty());
+			llassert(no_copy_cb_action != NULL);
+			
+			BOOST_FOREACH(const LLSD& payload, no_copy_payloads)
+			{
+				(*no_copy_cb_action)(payload);
+			}
+		}
+		
+		delete no_copy_cb_action;
+		no_copy_cb_action = NULL;
+		
+		no_copy_notify_active = false;
+		no_copy_payloads.clear();
+	}
+
+	void update()
+	{
+		if (!no_copy_notify_active && !no_copy_payloads.empty())
+		{
+			no_copy_notify_active = true;
+			
+			LLNotificationsUtil::add("ConfirmNoCopyToOutbox", LLSD(), LLSD(), boost::bind(&notifyNoCopyCallback, _1, _2));
+		}
+	}
+		
+	void addNoCopyNotification(const LLSD& payload, const NoCopyCallbackFunction& cb)
+	{
+		if (no_copy_cb_action == NULL)
+		{
+			no_copy_cb_action = new no_copy_payload_cb_signal_t;
+			no_copy_cb_action->connect(boost::bind(cb, _1));
+		}
+
+		no_copy_payloads.push_back(payload);
+	}
+}
diff --git a/indra/newview/llmarketplacenotifications.h b/indra/newview/llmarketplacenotifications.h
new file mode 100644
index 0000000000000000000000000000000000000000..83a4e163c7c5d9eb447376b425033c1ff736b46e
--- /dev/null
+++ b/indra/newview/llmarketplacenotifications.h
@@ -0,0 +1,57 @@
+/** 
+ * @file llmarketplacenotifications.h
+ * @brief Handler for notifications related to marketplace file I/O
+ * class definition
+ *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLMARKETPLACENOTIFICATIONS_H
+#define LL_LLMARKETPLACENOTIFICATIONS_H
+
+
+#include <llsd.h>
+#include <boost/function.hpp>
+
+
+//
+// This is a set of helper functions to handle a unique notification with multiple
+// payloads, helpful when dragging and dropping items to the merchant outbox that
+// trigger notifications that can potentially interfere with the current drag and
+// drop operation.
+//
+// Notification payloads are cached locally when initiated, the notification itself
+// is triggered on the following frame during the call to "update" and then the
+// response is triggered once per payload.
+//
+
+namespace LLMarketplaceInventoryNotifications
+{
+	void update();
+
+	typedef boost::function<void (const LLSD&)> NoCopyCallbackFunction;
+	
+	void addNoCopyNotification(const LLSD& payload, const NoCopyCallbackFunction& cb);
+};
+
+
+#endif // LL_LLMARKETPLACENOTIFICATIONS_H
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index 74fa5d350a3da19ee3b06ccfa685b65f4dbc78a7..7650fe92296b825db8d8f873f38f198910d0227c 100644
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -133,10 +133,15 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) :
 		navigateHome();
 	}
 		
-	// FIXME: How do we create a bevel now?
-//	LLRect border_rect( 0, getRect().getHeight() + 2, getRect().getWidth() + 2, 0 );
-//	mBorder = new LLViewBorder( std::string("web control border"), border_rect, LLViewBorder::BEVEL_IN );
-//	addChild( mBorder );
+	LLWindowShade::Params params;
+	params.name = "notification_shade";
+	params.rect = getLocalRect();
+	params.follows.flags = FOLLOWS_ALL;
+	params.modal = true;
+
+	mWindowShade = LLUICtrlFactory::create<LLWindowShade>(params);
+
+	addChild(mWindowShade);
 }
 
 LLMediaCtrl::~LLMediaCtrl()
@@ -1092,39 +1097,28 @@ void LLMediaCtrl::onPopup(const LLSD& notification, const LLSD& response)
 
 void LLMediaCtrl::showNotification(LLNotificationPtr notify)
 {
-	delete mWindowShade;
+	LLWindowShade* shade = getChild<LLWindowShade>("notification_shade");
 
-	LLWindowShade::Params params;
-	params.name = "notification_shade";
-	params.rect = getLocalRect();
-	params.follows.flags = FOLLOWS_ALL;
-	params.notification = notify;
-	params.modal = true;
-	//HACK: don't hardcode this
 	if (notify->getIcon() == "Popup_Caution")
 	{
-		params.bg_image.name = "Yellow_Gradient";
-		params.text_color = LLColor4::black;
+		shade->setBackgroundImage(LLUI::getUIImage("Yellow_Gradient"));
+		shade->setTextColor(LLColor4::black);
+		shade->setCanClose(true);
 	}
-	else
-	//HACK: another one since XUI doesn't support what we need right now
-	if (notify->getName() == "AuthRequest")
+	else if (notify->getName() == "AuthRequest")
 	{
-		params.bg_image.name = "Yellow_Gradient";
-		params.text_color = LLColor4::black;
-		params.can_close = false;
+		shade->setBackgroundImage(LLUI::getUIImage("Yellow_Gradient"));
+		shade->setTextColor(LLColor4::black);
+		shade->setCanClose(false);
 	}
 	else
 	{
 		//HACK: make this a property of the notification itself, "cancellable"
-		params.can_close = false;
-		params.text_color.control = "LabelTextColor";
+		shade->setCanClose(false);
+		shade->setTextColor(LLUIColorTable::instance().getColor("LabelTextColor"));
 	}
 
-	mWindowShade = LLUICtrlFactory::create<LLWindowShade>(params);
-
-	addChild(mWindowShade);
-	mWindowShade->show();
+	mWindowShade->show(notify);
 }
 
 void LLMediaCtrl::hideNotification()
diff --git a/indra/newview/llmemoryview.cpp b/indra/newview/llmemoryview.cpp
index 7e9c3c84a742147582dbf636ecce9f7c821f9f8a..c0a323d6cb3afeb81838d5bf35d9f70c41037624 100644
--- a/indra/newview/llmemoryview.cpp
+++ b/indra/newview/llmemoryview.cpp
@@ -220,7 +220,7 @@ void LLMemoryView::draw()
 	S32 x, y;
 
 	S32 margin = 10;
-	S32 texth = (S32)LLFontGL::getFontMonospace()->getLineHeight();
+	S32 texth = LLFontGL::getFontMonospace()->getLineHeight();
 
 	S32 xleft = margin;
 	S32 ytop = height - margin;
diff --git a/indra/newview/llmenucommands.cpp b/indra/newview/llmenucommands.cpp
deleted file mode 100644
index 4b7f9432e304a5ac46c4024d2767a94b1cffdf4f..0000000000000000000000000000000000000000
--- a/indra/newview/llmenucommands.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/** 
- * @file llmenucommands.cpp
- * @brief Implementations of menu commands.
- *
- * $LicenseInfo:firstyear=2003&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#include "llviewerprecompiledheaders.h"
-
-#include "llmenucommands.h"
-
-#include "imageids.h"
-#include "llfloaterreg.h"
-#include "llfontgl.h"
-#include "llrect.h"
-#include "llerror.h"
-#include "llstring.h"
-#include "message.h"
-
-#include "llagentcamera.h"
-#include "llcallingcard.h"
-#include "llviewercontrol.h"
-//#include "llfirstuse.h"
-#include "llfloaterworldmap.h"
-#include "lllineeditor.h"
-#include "llstatusbar.h"
-#include "llimview.h"
-#include "lltextbox.h"
-#include "llui.h"
-#include "llviewergesture.h"			// for triggering gestures
-#include "llviewermessage.h"
-#include "llviewerparceloverlay.h"
-#include "llviewerregion.h"
-#include "llviewerstats.h"
-#include "lluictrlfactory.h"
-#include "llviewerwindow.h"
-#include "llworld.h"
-#include "llworldmap.h"
-#include "llfocusmgr.h"
-#include "llnearbychatbar.h"
-
-void handle_mouselook(void*)
-{
-	gAgentCamera.changeCameraToMouselook();
-}
-
-
-void handle_chat(void*)
-{
-	// give focus to chatbar if it's open but not focused
-	if (gSavedSettings.getBOOL("ChatVisible") && 
-		gFocusMgr.childHasKeyboardFocus(LLNearbyChatBar::getInstance()->getChatBox()))
-	{
-		LLNearbyChatBar::stopChat();
-	}
-	else
-	{
-		LLNearbyChatBar::startChat(NULL);
-	}
-}
-
-void handle_slash_key(void*)
-{
-	// LLBottomTray::startChat("/");
-	//
-	// Don't do this, it results in a double-slash in the input field.
-	// Another "/" will be automatically typed for us, because the WM_KEYDOWN event
-	// that generated the menu accelerator call (and hence puts focus in
-	// the chat edtior) will be followed by a "/" WM_CHAR character message,
-	// which will type the slash.  Yes, it's weird.  It only matters for
-	// menu accelerators that put input focus into a field.   And Mac works
-	// the same way.  JC
-
-	LLNearbyChatBar::startChat(NULL);
-}
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
old mode 100644
new mode 100755
index a97e256c899eaaee64f94034fc4fbb1a139af816..f461c7e46fb4baa46bdc46ac2f5c31404f1230a8
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -88,6 +88,9 @@ const S32 MAX_MESH_VERSION = 999;
 U32 LLMeshRepository::sBytesReceived = 0;
 U32 LLMeshRepository::sHTTPRequestCount = 0;
 U32 LLMeshRepository::sHTTPRetryCount = 0;
+U32 LLMeshRepository::sLODProcessing = 0;
+U32 LLMeshRepository::sLODPending = 0;
+
 U32 LLMeshRepository::sCacheBytesRead = 0;
 U32 LLMeshRepository::sCacheBytesWritten = 0;
 U32 LLMeshRepository::sPeakKbps = 0;
@@ -205,6 +208,12 @@ class LLMeshHeaderResponder : public LLCurl::Responder
 	LLMeshHeaderResponder(const LLVolumeParams& mesh_params)
 		: mMeshParams(mesh_params)
 	{
+		LLMeshRepoThread::sActiveHeaderRequests++;
+	}
+
+	~LLMeshHeaderResponder()
+	{
+		LLMeshRepoThread::sActiveHeaderRequests--;
 	}
 
 	virtual void completedRaw(U32 status, const std::string& reason,
@@ -224,6 +233,12 @@ class LLMeshLODResponder : public LLCurl::Responder
 	LLMeshLODResponder(const LLVolumeParams& mesh_params, S32 lod, U32 offset, U32 requested_bytes)
 		: mMeshParams(mesh_params), mLOD(lod), mOffset(offset), mRequestedBytes(requested_bytes)
 	{
+		LLMeshRepoThread::sActiveLODRequests++;
+	}
+
+	~LLMeshLODResponder()
+	{
+		LLMeshRepoThread::sActiveLODRequests--;
 	}
 
 	virtual void completedRaw(U32 status, const std::string& reason,
@@ -493,28 +508,35 @@ void LLMeshRepoThread::run()
 			
 			while (!mLODReqQ.empty() && count < MAX_MESH_REQUESTS_PER_SECOND && sActiveLODRequests < sMaxConcurrentRequests)
 			{
+				if (mMutex)
 				{
 					mMutex->lock();
 					LODRequest req = mLODReqQ.front();
 					mLODReqQ.pop();
+					LLMeshRepository::sLODProcessing--;
 					mMutex->unlock();
-					if (fetchMeshLOD(req.mMeshParams, req.mLOD))
+					if (!fetchMeshLOD(req.mMeshParams, req.mLOD, count))//failed, resubmit
 					{
-						count++;
+						mMutex->lock();
+						mLODReqQ.push(req) ; 
+						mMutex->unlock();
 					}
 				}
 			}
 
 			while (!mHeaderReqQ.empty() && count < MAX_MESH_REQUESTS_PER_SECOND && sActiveHeaderRequests < sMaxConcurrentRequests)
 			{
+				if (mMutex)
 				{
 					mMutex->lock();
 					HeaderRequest req = mHeaderReqQ.front();
 					mHeaderReqQ.pop();
 					mMutex->unlock();
-					if (fetchMeshHeader(req.mMeshParams))
+					if (!fetchMeshHeader(req.mMeshParams, count))//failed, resubmit
 					{
-						count++;
+						mMutex->lock();
+						mHeaderReqQ.push(req) ;
+						mMutex->unlock();
 					}
 				}
 			}
@@ -603,6 +625,7 @@ void LLMeshRepoThread::loadMeshLOD(const LLVolumeParams& mesh_params, S32 lod)
 		{
 			LLMutexLock lock(mMutex);
 			mLODReqQ.push(req);
+			LLMeshRepository::sLODProcessing++;
 		}
 	}
 	else
@@ -650,6 +673,12 @@ std::string LLMeshRepoThread::constructUrl(LLUUID mesh_id)
 
 bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id)
 { //protected by mMutex
+	
+	if (!mHeaderMutex)
+	{
+		return false;
+	}
+
 	mHeaderMutex->lock();
 
 	if (mMeshHeader.find(mesh_id) == mMeshHeader.end())
@@ -658,6 +687,7 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id)
 		return false;
 	}
 
+	bool ret = true ;
 	U32 header_size = mMeshHeaderSize[mesh_id];
 	
 	if (header_size > 0)
@@ -673,7 +703,7 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id)
 			//check VFS for mesh skin info
 			LLVFile file(gVFS, mesh_id, LLAssetType::AT_MESH);
 			if (file.getSize() >= offset+size)
-			{
+			{				
 				LLMeshRepository::sCacheBytesRead += size;
 				file.seek(offset);
 				U8* buffer = new U8[size];
@@ -689,7 +719,7 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id)
 				if (!zero)
 				{ //attempt to parse
 					if (skinInfoReceived(mesh_id, buffer, size))
-					{
+					{						
 						delete[] buffer;
 						return true;
 					}
@@ -704,11 +734,13 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id)
 
 			std::string http_url = constructUrl(mesh_id);
 			if (!http_url.empty())
-			{
-				++sActiveLODRequests;
-				LLMeshRepository::sHTTPRequestCount++;
-				mCurlRequest->getByteRange(constructUrl(mesh_id), headers, offset, size,
-										   new LLMeshSkinInfoResponder(mesh_id, offset, size));
+			{				
+				ret = mCurlRequest->getByteRange(http_url, headers, offset, size,
+												 new LLMeshSkinInfoResponder(mesh_id, offset, size));
+				if(ret)
+				{
+					LLMeshRepository::sHTTPRequestCount++;
+				}
 			}
 		}
 	}
@@ -718,11 +750,16 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id)
 	}
 
 	//early out was not hit, effectively fetched
-	return true;
+	return ret;
 }
 
 bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id)
 { //protected by mMutex
+	if (!mHeaderMutex)
+	{
+		return false;
+	}
+
 	mHeaderMutex->lock();
 
 	if (mMeshHeader.find(mesh_id) == mMeshHeader.end())
@@ -732,7 +769,8 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id)
 	}
 
 	U32 header_size = mMeshHeaderSize[mesh_id];
-
+	bool ret = true ;
+	
 	if (header_size > 0)
 	{
 		S32 version = mMeshHeader[mesh_id]["version"].asInteger();
@@ -748,6 +786,7 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id)
 			if (file.getSize() >= offset+size)
 			{
 				LLMeshRepository::sCacheBytesRead += size;
+
 				file.seek(offset);
 				U8* buffer = new U8[size];
 				file.read(buffer, size);
@@ -777,11 +816,13 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id)
 
 			std::string http_url = constructUrl(mesh_id);
 			if (!http_url.empty())
-			{
-				++sActiveLODRequests;
-				LLMeshRepository::sHTTPRequestCount++;
-				mCurlRequest->getByteRange(http_url, headers, offset, size,
-										   new LLMeshDecompositionResponder(mesh_id, offset, size));
+			{				
+				ret = mCurlRequest->getByteRange(http_url, headers, offset, size,
+												 new LLMeshDecompositionResponder(mesh_id, offset, size));
+				if(ret)
+				{
+					LLMeshRepository::sHTTPRequestCount++;
+				}
 			}
 		}
 	}
@@ -791,11 +832,16 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id)
 	}
 
 	//early out was not hit, effectively fetched
-	return true;
+	return ret;
 }
 
 bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id)
 { //protected by mMutex
+	if (!mHeaderMutex)
+	{
+		return false;
+	}
+
 	mHeaderMutex->lock();
 
 	if (mMeshHeader.find(mesh_id) == mMeshHeader.end())
@@ -805,6 +851,7 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id)
 	}
 
 	U32 header_size = mMeshHeaderSize[mesh_id];
+	bool ret = true ;
 
 	if (header_size > 0)
 	{
@@ -850,11 +897,14 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id)
 
 			std::string http_url = constructUrl(mesh_id);
 			if (!http_url.empty())
-			{
-				++sActiveLODRequests;
-				LLMeshRepository::sHTTPRequestCount++;
-				mCurlRequest->getByteRange(http_url, headers, offset, size,
-										   new LLMeshPhysicsShapeResponder(mesh_id, offset, size));
+			{				
+				ret = mCurlRequest->getByteRange(http_url, headers, offset, size,
+												 new LLMeshPhysicsShapeResponder(mesh_id, offset, size));
+
+				if(ret)
+				{
+					LLMeshRepository::sHTTPRequestCount++;
+				}
 			}
 		}
 		else
@@ -868,13 +918,12 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id)
 	}
 
 	//early out was not hit, effectively fetched
-	return true;
+	return ret;
 }
 
-bool LLMeshRepoThread::fetchMeshHeader(const LLVolumeParams& mesh_params)
+//return false if failed to get header
+bool LLMeshRepoThread::fetchMeshHeader(const LLVolumeParams& mesh_params, U32& count)
 {
-	bool retval = false;
-
 	{
 		//look for mesh in asset in vfs
 		LLVFile file(gVFS, mesh_params.getSculptID(), LLAssetType::AT_MESH);
@@ -889,36 +938,44 @@ bool LLMeshRepoThread::fetchMeshHeader(const LLVolumeParams& mesh_params)
 			file.read(buffer, bytes);
 			if (headerReceived(mesh_params, buffer, bytes))
 			{ //did not do an HTTP request, return false
-				return false;
+				return true;
 			}
 		}
 	}
 
-	//either cache entry doesn't exist or is corrupt, request header from simulator
-
+	//either cache entry doesn't exist or is corrupt, request header from simulator	
+	bool retval = true ;
 	std::vector<std::string> headers;
 	headers.push_back("Accept: application/octet-stream");
 
 	std::string http_url = constructUrl(mesh_params.getSculptID());
 	if (!http_url.empty())
 	{
-		++sActiveHeaderRequests;
-		retval = true;
 		//grab first 4KB if we're going to bother with a fetch.  Cache will prevent future fetches if a full mesh fits
 		//within the first 4KB
-		//NOTE -- this will break of headers ever exceed 4KB
-		LLMeshRepository::sHTTPRequestCount++;
-		mCurlRequest->getByteRange(http_url, headers, 0, 4096, new LLMeshHeaderResponder(mesh_params));
+		//NOTE -- this will break of headers ever exceed 4KB		
+		retval = mCurlRequest->getByteRange(http_url, headers, 0, 4096, new LLMeshHeaderResponder(mesh_params));
+		if(retval)
+		{
+			LLMeshRepository::sHTTPRequestCount++;
+		}
+		count++;
 	}
 
 	return retval;
 }
 
-bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod)
+//return false if failed to get mesh lod.
+bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod, U32& count)
 { //protected by mMutex
+	if (!mHeaderMutex)
+	{
+		return false;
+	}
+
 	mHeaderMutex->lock();
 
-	bool retval = false;
+	bool retval = true;
 
 	LLUUID mesh_id = mesh_params.getSculptID();
 	
@@ -955,7 +1012,7 @@ bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod)
 					if (lodReceived(mesh_params, lod, buffer, size))
 					{
 						delete[] buffer;
-						return false;
+						return true;
 					}
 				}
 
@@ -968,12 +1025,15 @@ bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod)
 
 			std::string http_url = constructUrl(mesh_id);
 			if (!http_url.empty())
-			{
-				++sActiveLODRequests;
-				retval = true;
-				LLMeshRepository::sHTTPRequestCount++;
-				mCurlRequest->getByteRange(constructUrl(mesh_id), headers, offset, size,
+			{				
+				retval = mCurlRequest->getByteRange(constructUrl(mesh_id), headers, offset, size,
 										   new LLMeshLODResponder(mesh_params, lod, offset, size));
+
+				if(retval)
+				{
+					LLMeshRepository::sHTTPRequestCount++;
+				}
+				count++;
 			}
 			else
 			{
@@ -1031,10 +1091,11 @@ bool LLMeshRepoThread::headerReceived(const LLVolumeParams& mesh_params, U8* dat
 	{
 		LLUUID mesh_id = mesh_params.getSculptID();
 		
-		mHeaderMutex->lock();
-		mMeshHeaderSize[mesh_id] = header_size;
-		mMeshHeader[mesh_id] = header;
-		mHeaderMutex->unlock();
+		{
+			LLMutexLock lock(mHeaderMutex);
+			mMeshHeaderSize[mesh_id] = header_size;
+			mMeshHeader[mesh_id] = header;
+			}
 
 		//check for pending requests
 		pending_lod_map::iterator iter = mPendingLOD.find(mesh_params);
@@ -1045,6 +1106,7 @@ bool LLMeshRepoThread::headerReceived(const LLVolumeParams& mesh_params, U8* dat
 			{
 				LODRequest req(mesh_params, iter->second[i]);
 				mLODReqQ.push(req);
+				LLMeshRepository::sLODProcessing++;
 			}
 		}
 		mPendingLOD.erase(iter);
@@ -1055,17 +1117,19 @@ bool LLMeshRepoThread::headerReceived(const LLVolumeParams& mesh_params, U8* dat
 
 bool LLMeshRepoThread::lodReceived(const LLVolumeParams& mesh_params, S32 lod, U8* data, S32 data_size)
 {
-	LLVolume* volume = new LLVolume(mesh_params, LLVolumeLODGroup::getVolumeScaleFromDetail(lod));
+	LLPointer<LLVolume> volume = new LLVolume(mesh_params, LLVolumeLODGroup::getVolumeScaleFromDetail(lod));
 	std::string mesh_string((char*) data, data_size);
 	std::istringstream stream(mesh_string);
 
 	if (volume->unpackVolumeFaces(stream, data_size))
 	{
-		LoadedMesh mesh(volume, mesh_params, lod);
 		if (volume->getNumFaces() > 0)
 		{
-			LLMutexLock lock(mMutex);
-			mLoadedQ.push(mesh);
+			LoadedMesh mesh(volume, mesh_params, lod);
+			{
+				LLMutexLock lock(mMutex);
+				mLoadedQ.push(mesh);
+			}
 			return true;
 		}
 	}
@@ -1540,8 +1604,17 @@ void LLMeshUploadThread::doWholeModelUpload()
 		LLSD body = full_model_data["asset_resources"];
 		dump_llsd_to_file(body,make_dump_name("whole_model_body_",dump_num));
 		LLCurlRequest::headers_t headers;
-		mCurlRequest->post(mWholeModelUploadURL, headers, body,
-						   new LLWholeModelUploadResponder(this, full_model_data, mUploadObserverHandle), mMeshUploadTimeOut);
+
+		{
+			LLCurl::ResponderPtr responder = new LLWholeModelUploadResponder(this, full_model_data, mUploadObserverHandle) ;
+
+			while(!mCurlRequest->post(mWholeModelUploadURL, headers, body, responder, mMeshUploadTimeOut))
+			{
+				//sleep for 10ms to prevent eating a whole core
+				apr_sleep(10000);
+			}
+		}
+
 		do
 		{
 			mCurlRequest->process();
@@ -1571,8 +1644,15 @@ void LLMeshUploadThread::requestWholeModelFee()
 
 	mPendingUploads++;
 	LLCurlRequest::headers_t headers;
-	mCurlRequest->post(mWholeModelFeeCapability, headers, model_data,
-					   new LLWholeModelFeeResponder(this,model_data, mFeeObserverHandle), mMeshUploadTimeOut);
+
+	{
+		LLCurl::ResponderPtr responder = new LLWholeModelFeeResponder(this,model_data, mFeeObserverHandle) ;
+		while(!mCurlRequest->post(mWholeModelFeeCapability, headers, model_data, responder, mMeshUploadTimeOut))
+		{
+			//sleep for 10ms to prevent eating a whole core
+			apr_sleep(10000);
+		}
+	}
 
 	do
 	{
@@ -1590,6 +1670,11 @@ void LLMeshUploadThread::requestWholeModelFee()
 
 void LLMeshRepoThread::notifyLoadedMeshes()
 {
+	if (!mMutex)
+	{
+		return;
+	}
+
 	while (!mLoadedQ.empty())
 	{
 		mMutex->lock();
@@ -1712,7 +1797,6 @@ void LLMeshLODResponder::completedRaw(U32 status, const std::string& reason,
 							  const LLIOPipe::buffer_ptr_t& buffer)
 {
 
-	LLMeshRepoThread::sActiveLODRequests--;
 	S32 data_size = buffer->countAfter(channels.in(), NULL);
 
 	if (status < 200 || status > 400)
@@ -1929,7 +2013,6 @@ void LLMeshHeaderResponder::completedRaw(U32 status, const std::string& reason,
 							  const LLChannelDescriptors& channels,
 							  const LLIOPipe::buffer_ptr_t& buffer)
 {
-	LLMeshRepoThread::sActiveHeaderRequests--;
 	if (status < 200 || status > 400)
 	{
 		//llwarns
@@ -2147,6 +2230,7 @@ S32 LLMeshRepository::loadMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_para
 			//first request for this mesh
 			mLoadingMeshes[detail][mesh_params].insert(vobj->getID());
 			mPendingRequests.push_back(LLMeshRepoThread::LODRequest(mesh_params, detail));
+			LLMeshRepository::sLODPending++;
 		}
 	}
 
@@ -2302,92 +2386,92 @@ void LLMeshRepository::notifyLoadedMeshes()
 		}
 	}
 
-	mMeshMutex->lock();	
-	mThread->mMutex->lock();
-		
-	//popup queued error messages from background threads
-	while (!mUploadErrorQ.empty())
 	{
-		LLNotificationsUtil::add("MeshUploadError", mUploadErrorQ.front());
-		mUploadErrorQ.pop();
-	}
+		LLMutexLock lock1(mMeshMutex);
+		LLMutexLock lock2(mThread->mMutex);
+		
+		//popup queued error messages from background threads
+		while (!mUploadErrorQ.empty())
+		{
+			LLNotificationsUtil::add("MeshUploadError", mUploadErrorQ.front());
+			mUploadErrorQ.pop();
+		}
 
-	S32 push_count = LLMeshRepoThread::sMaxConcurrentRequests-(LLMeshRepoThread::sActiveHeaderRequests+LLMeshRepoThread::sActiveLODRequests);
+		S32 push_count = LLMeshRepoThread::sMaxConcurrentRequests-(LLMeshRepoThread::sActiveHeaderRequests+LLMeshRepoThread::sActiveLODRequests);
 
-	if (push_count > 0)
-	{
-		//calculate "score" for pending requests
+		if (push_count > 0)
+		{
+			//calculate "score" for pending requests
 
-		//create score map
-		std::map<LLUUID, F32> score_map;
+			//create score map
+			std::map<LLUUID, F32> score_map;
 
-		for (U32 i = 0; i < 4; ++i)
-		{
-			for (mesh_load_map::iterator iter = mLoadingMeshes[i].begin();  iter != mLoadingMeshes[i].end(); ++iter)
+			for (U32 i = 0; i < 4; ++i)
 			{
-				F32 max_score = 0.f;
-				for (std::set<LLUUID>::iterator obj_iter = iter->second.begin(); obj_iter != iter->second.end(); ++obj_iter)
+				for (mesh_load_map::iterator iter = mLoadingMeshes[i].begin();  iter != mLoadingMeshes[i].end(); ++iter)
 				{
-					LLViewerObject* object = gObjectList.findObject(*obj_iter);
-
-					if (object)
+					F32 max_score = 0.f;
+					for (std::set<LLUUID>::iterator obj_iter = iter->second.begin(); obj_iter != iter->second.end(); ++obj_iter)
 					{
-						LLDrawable* drawable = object->mDrawable;
-						if (drawable)
+						LLViewerObject* object = gObjectList.findObject(*obj_iter);
+
+						if (object)
 						{
-							F32 cur_score = drawable->getRadius()/llmax(drawable->mDistanceWRTCamera, 1.f);
-							max_score = llmax(max_score, cur_score);
+							LLDrawable* drawable = object->mDrawable;
+							if (drawable)
+							{
+								F32 cur_score = drawable->getRadius()/llmax(drawable->mDistanceWRTCamera, 1.f);
+								max_score = llmax(max_score, cur_score);
+							}
 						}
 					}
-				}
 				
-				score_map[iter->first.getSculptID()] = max_score;
+					score_map[iter->first.getSculptID()] = max_score;
+				}
+			}
+
+			//set "score" for pending requests
+			for (std::vector<LLMeshRepoThread::LODRequest>::iterator iter = mPendingRequests.begin(); iter != mPendingRequests.end(); ++iter)
+			{
+				iter->mScore = score_map[iter->mMeshParams.getSculptID()];
+			}
+
+			//sort by "score"
+			std::sort(mPendingRequests.begin(), mPendingRequests.end(), LLMeshRepoThread::CompareScoreGreater());
+
+			while (!mPendingRequests.empty() && push_count > 0)
+			{
+				LLMeshRepoThread::LODRequest& request = mPendingRequests.front();
+				mThread->loadMeshLOD(request.mMeshParams, request.mLOD);
+				mPendingRequests.erase(mPendingRequests.begin());
+				LLMeshRepository::sLODPending--;
+				push_count--;
 			}
 		}
 
-		//set "score" for pending requests
-		for (std::vector<LLMeshRepoThread::LODRequest>::iterator iter = mPendingRequests.begin(); iter != mPendingRequests.end(); ++iter)
+		//send skin info requests
+		while (!mPendingSkinRequests.empty())
 		{
-			iter->mScore = score_map[iter->mMeshParams.getSculptID()];
+			mThread->loadMeshSkinInfo(mPendingSkinRequests.front());
+			mPendingSkinRequests.pop();
 		}
-
-		//sort by "score"
-		std::sort(mPendingRequests.begin(), mPendingRequests.end(), LLMeshRepoThread::CompareScoreGreater());
-
-		while (!mPendingRequests.empty() && push_count > 0)
+	
+		//send decomposition requests
+		while (!mPendingDecompositionRequests.empty())
 		{
-			LLMeshRepoThread::LODRequest& request = mPendingRequests.front();
-			mThread->loadMeshLOD(request.mMeshParams, request.mLOD);
-			mPendingRequests.erase(mPendingRequests.begin());
-			push_count--;
+			mThread->loadMeshDecomposition(mPendingDecompositionRequests.front());
+			mPendingDecompositionRequests.pop();
 		}
-	}
-
-	//send skin info requests
-	while (!mPendingSkinRequests.empty())
-	{
-		mThread->loadMeshSkinInfo(mPendingSkinRequests.front());
-		mPendingSkinRequests.pop();
-	}
 	
-	//send decomposition requests
-	while (!mPendingDecompositionRequests.empty())
-	{
-		mThread->loadMeshDecomposition(mPendingDecompositionRequests.front());
-		mPendingDecompositionRequests.pop();
-	}
+		//send physics shapes decomposition requests
+		while (!mPendingPhysicsShapeRequests.empty())
+		{
+			mThread->loadMeshPhysicsShape(mPendingPhysicsShapeRequests.front());
+			mPendingPhysicsShapeRequests.pop();
+		}
 	
-	//send physics shapes decomposition requests
-	while (!mPendingPhysicsShapeRequests.empty())
-	{
-		mThread->loadMeshPhysicsShape(mPendingPhysicsShapeRequests.front());
-		mPendingPhysicsShapeRequests.pop();
+		mThread->notifyLoadedMeshes();
 	}
-	
-	mThread->notifyLoadedMeshes();
-
-	mThread->mMutex->unlock();
-	mMeshMutex->unlock();
 
 	mThread->mSignal->signal();
 }
@@ -3035,13 +3119,14 @@ void LLPhysicsDecomp::doDecomposition()
 			num_hulls = LLConvexDecomposition::getInstance()->getNumHullsFromStage(stage);
 		}
 		
-		mMutex->lock();
-		mCurRequest->mHull.clear();
-		mCurRequest->mHull.resize(num_hulls);
+		{
+			LLMutexLock lock(mMutex);
+			mCurRequest->mHull.clear();
+			mCurRequest->mHull.resize(num_hulls);
 
-		mCurRequest->mHullMesh.clear();
-		mCurRequest->mHullMesh.resize(num_hulls);
-		mMutex->unlock();
+			mCurRequest->mHullMesh.clear();
+			mCurRequest->mHullMesh.resize(num_hulls);
+		}
 
 		for (S32 i = 0; i < num_hulls; ++i)
 		{
@@ -3065,14 +3150,14 @@ void LLPhysicsDecomp::doDecomposition()
 
 			get_vertex_buffer_from_mesh(mesh, mCurRequest->mHullMesh[i]);
 			
-			mMutex->lock();
-			mCurRequest->mHull[i] = p;
-			mMutex->unlock();
+			{
+				LLMutexLock lock(mMutex);
+				mCurRequest->mHull[i] = p;
+			}
 		}
 	
 		{
 			LLMutexLock lock(mMutex);
-
 			mCurRequest->setStatusMessage("FAIL");
 			completeCurrent();						
 		}
@@ -3140,7 +3225,6 @@ void LLPhysicsDecomp::doDecompositionSingleHull()
 	
 	LLCDMeshData mesh;	
 
-#if 1
 	setMeshData(mesh, true);
 
 	LLCDResult ret = decomp->buildSingleHull() ;
@@ -3151,11 +3235,12 @@ void LLPhysicsDecomp::doDecompositionSingleHull()
 	}
 	else
 	{
-		mMutex->lock();
-		mCurRequest->mHull.clear();
-		mCurRequest->mHull.resize(1);
-		mCurRequest->mHullMesh.clear();
-		mMutex->unlock();
+		{
+			LLMutexLock lock(mMutex);
+			mCurRequest->mHull.clear();
+			mCurRequest->mHull.resize(1);
+			mCurRequest->mHullMesh.clear();
+		}
 
 		std::vector<LLVector3> p;
 		LLCDHull hull;
@@ -3171,93 +3256,12 @@ void LLPhysicsDecomp::doDecompositionSingleHull()
 			p.push_back(vert);
 			v = (F32*) (((U8*) v) + hull.mVertexStrideBytes);
 		}
-						
-		mMutex->lock();
-		mCurRequest->mHull[0] = p;
-		mMutex->unlock();	
-	}		
-#else
-	setMeshData(mesh, false);
-
-	//set all parameters to default
-	std::map<std::string, const LLCDParam*> param_map;
-
-	static const LLCDParam* params = NULL;
-	static S32 param_count = 0;
-
-	if (!params)
-	{
-		param_count = decomp->getParameters(&params);
-	}
-	
-	for (S32 i = 0; i < param_count; ++i)
-	{
-		decomp->setParam(params[i].mName, params[i].mDefault.mIntOrEnumValue);
-	}
-
-	const S32 STAGE_DECOMPOSE = mStageID["Decompose"];	
-	const S32 STAGE_SIMPLIFY = mStageID["Simplify"];
-	const S32 DECOMP_PREVIEW = 0;
-	const S32 SIMPLIFY_RETAIN = 0;
-	
-	decomp->setParam("Decompose Quality", DECOMP_PREVIEW);
-	decomp->setParam("Simplify Method", SIMPLIFY_RETAIN);
-	decomp->setParam("Retain%", 0.f);
-
-	LLCDResult ret = LLCD_OK;
-	ret = decomp->executeStage(STAGE_DECOMPOSE);
-	
-	if (ret)
-	{
-		llwarns << "Could not execute decomposition stage when attempting to create single hull." << llendl;
-		make_box(mCurRequest);
-	}
-	else
-	{
-		ret = decomp->executeStage(STAGE_SIMPLIFY);
-
-		if (ret)
-		{
-			llwarns << "Could not execute simiplification stage when attempting to create single hull." << llendl;
-			make_box(mCurRequest);
-		}
-		else
+					
 		{
-			S32 num_hulls =0;
-			if (LLConvexDecomposition::getInstance() != NULL)
-			{
-				num_hulls = LLConvexDecomposition::getInstance()->getNumHullsFromStage(STAGE_SIMPLIFY);
-			}
-			
-			mMutex->lock();
-			mCurRequest->mHull.clear();
-			mCurRequest->mHull.resize(num_hulls);
-			mCurRequest->mHullMesh.clear();
-			mMutex->unlock();
-
-			for (S32 i = 0; i < num_hulls; ++i)
-			{
-				std::vector<LLVector3> p;
-				LLCDHull hull;
-				// if LLConvexDecomposition is a stub, num_hulls should have been set to 0 above, and we should not reach this code
-				LLConvexDecomposition::getInstance()->getHullFromStage(STAGE_SIMPLIFY, i, &hull);
-
-				const F32* v = hull.mVertexBase;
-
-				for (S32 j = 0; j < hull.mNumVertices; ++j)
-				{
-					LLVector3 vert(v[0], v[1], v[2]); 
-					p.push_back(vert);
-					v = (F32*) (((U8*) v) + hull.mVertexStrideBytes);
-				}
-						
-				mMutex->lock();
-				mCurRequest->mHull[i] = p;
-				mMutex->unlock();
-			}
+			LLMutexLock lock(mMutex);
+			mCurRequest->mHull[0] = p;
 		}
-	}
-#endif
+	}		
 
 	{
 		completeCurrent();
diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h
index 31b84ea0d9f716290ce2a73ef8a8544a749b04cd..da81bb057bc5acb44e5382e3985eba8e8cb740f8 100644
--- a/indra/newview/llmeshrepository.h
+++ b/indra/newview/llmeshrepository.h
@@ -323,8 +323,8 @@ class LLMeshRepoThread : public LLThread
 	virtual void run();
 
 	void loadMeshLOD(const LLVolumeParams& mesh_params, S32 lod);
-	bool fetchMeshHeader(const LLVolumeParams& mesh_params);
-	bool fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod);
+	bool fetchMeshHeader(const LLVolumeParams& mesh_params, U32& count);
+	bool fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod, U32& count);
 	bool headerReceived(const LLVolumeParams& mesh_params, U8* data, S32 data_size);
 	bool lodReceived(const LLVolumeParams& mesh_params, S32 lod, U8* data, S32 data_size);
 	bool skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 data_size);
@@ -441,6 +441,8 @@ class LLMeshRepository
 	static U32 sBytesReceived;
 	static U32 sHTTPRequestCount;
 	static U32 sHTTPRetryCount;
+	static U32 sLODPending;
+	static U32 sLODProcessing;
 	static U32 sCacheBytesRead;
 	static U32 sCacheBytesWritten;
 	static U32 sPeakKbps;
diff --git a/indra/newview/llmutelist.h b/indra/newview/llmutelist.h
index 04e157008111bf7c43e51933aad8876dc8884caf..7a70370fe33519106950250dd2f98d197ac25bdd 100644
--- a/indra/newview/llmutelist.h
+++ b/indra/newview/llmutelist.h
@@ -29,6 +29,7 @@
 
 #include "llstring.h"
 #include "lluuid.h"
+#include "llextendedstatus.h"
 
 class LLViewerObject;
 class LLMessageSystem;
diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp
index 146bcbe47b18cc8321b981323a3aca61c27cf48a..2a08cb184526b8cae2f3458ca142802e00cd91a0 100644
--- a/indra/newview/llnavigationbar.cpp
+++ b/indra/newview/llnavigationbar.cpp
@@ -317,7 +317,7 @@ BOOL LLNavigationBar::postBuild()
 	LLTeleportHistory::getInstance()->setHistoryChangedCallback(
 			boost::bind(&LLNavigationBar::onTeleportHistoryChanged, this));
 
-	LLHints::registerHintTarget("nav_bar", LLView::getHandle());
+	LLHints::registerHintTarget("nav_bar", getHandle());
 
 	return TRUE;
 }
diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp
index 114472ba568682c2e51520bd2a37f9523283d2fb..b4224e30e688d884104a85403e20e022f98fdfad 100644
--- a/indra/newview/llnearbychatbar.cpp
+++ b/indra/newview/llnearbychatbar.cpp
@@ -48,6 +48,7 @@
 #include "llrootview.h"
 #include "llviewerchat.h"
 #include "llnearbychat.h"
+#include "lltranslate.h"
 
 #include "llresizehandle.h"
 
@@ -71,9 +72,14 @@ static LLChatTypeTrigger sChatTypeTriggers[] = {
 };
 
 LLNearbyChatBar::LLNearbyChatBar(const LLSD& key)
-	: LLFloater(key),
-	mChatBox(NULL)
-{	mSpeakerMgr = LLLocalSpeakerMgr::getInstance();
+:	LLFloater(key),
+	mChatBox(NULL),
+	mNearbyChat(NULL),
+	mOutputMonitor(NULL),
+	mSpeakerMgr(NULL),
+	mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT)
+{
+	mSpeakerMgr = LLLocalSpeakerMgr::getInstance();
 }
 
 //virtual
@@ -95,6 +101,7 @@ BOOL LLNearbyChatBar::postBuild()
 	mChatBox->setEnableLineHistory(TRUE);
 	mChatBox->setFont(LLViewerChat::getChatFont());
 
+	mNearbyChat = getChildView("nearby_chat");
 
 	LLUICtrl* show_btn = getChild<LLUICtrl>("show_nearby_chat");
 	show_btn->setCommitCallback(boost::bind(&LLNearbyChatBar::onToggleNearbyChatPanel, this));
@@ -102,22 +109,29 @@ BOOL LLNearbyChatBar::postBuild()
 	mOutputMonitor = getChild<LLOutputMonitorCtrl>("chat_zone_indicator");
 	mOutputMonitor->setVisible(FALSE);
 
+	gSavedSettings.declareBOOL("nearbychat_history_visibility", mNearbyChat->getVisible(), "Visibility state of nearby chat history", TRUE);
+
+	mNearbyChat->setVisible(gSavedSettings.getBOOL("nearbychat_history_visibility"));
+
 	// Register for font change notifications
 	LLViewerChat::setFontChangedCallback(boost::bind(&LLNearbyChatBar::onChatFontChange, this, _1));
 
-	mExpandedHeight = COLLAPSED_HEIGHT + EXPANDED_HEIGHT;
-
 	enableResizeCtrls(true, true, false);
 
 	return TRUE;
 }
 
+// virtual
+void LLNearbyChatBar::onOpen(const LLSD& key)
+{
+	showTranslationCheckbox(LLTranslate::isTranslationConfigured());
+}
+
 bool LLNearbyChatBar::applyRectControl()
 {
 	bool rect_controlled = LLFloater::applyRectControl();
 
-	LLView* nearby_chat = getChildView("nearby_chat");	
-	if (!nearby_chat->getVisible())
+	if (!mNearbyChat->getVisible())
 	{
 		reshape(getRect().getWidth(), getMinHeight());
 		enableResizeCtrls(true, true, false);
@@ -156,6 +170,11 @@ void LLNearbyChatBar::showHistory()
 	}
 }
 
+void LLNearbyChatBar::showTranslationCheckbox(BOOL show)
+{
+	getChild<LLUICtrl>("translate_chat_checkbox_lp")->setVisible(show);
+}
+
 void LLNearbyChatBar::draw()
 {
 	displaySpeakingIndicator();
@@ -398,6 +417,8 @@ void LLNearbyChatBar::onToggleNearbyChatPanel()
 		enableResizeCtrls(true);
 		storeRectControl();
 	}
+
+	gSavedSettings.setBOOL("nearbychat_history_visibility", mNearbyChat->getVisible());
 }
 
 void LLNearbyChatBar::setMinimized(BOOL b)
diff --git a/indra/newview/llnearbychatbar.h b/indra/newview/llnearbychatbar.h
index e9734899b3118166265e88efcd004f34e8373c53..8547cf0bcedbf83b5a05bc61d1fbcce8d4508d92 100644
--- a/indra/newview/llnearbychatbar.h
+++ b/indra/newview/llnearbychatbar.h
@@ -43,6 +43,7 @@ class LLNearbyChatBar :	public LLFloater
 	~LLNearbyChatBar() {}
 
 	virtual BOOL postBuild();
+	/*virtual*/ void onOpen(const LLSD& key);
 
 	static LLNearbyChatBar* getInstance();
 
@@ -60,6 +61,7 @@ class LLNearbyChatBar :	public LLFloater
 	static void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate);
 
 	void showHistory();
+	void showTranslationCheckbox(BOOL show);
 	/*virtual*/void setMinimized(BOOL b);
 
 protected:
@@ -84,9 +86,10 @@ class LLNearbyChatBar :	public LLFloater
 	// Which non-zero channel did we last chat on?
 	static S32 sLastSpecialChatChannel;
 
-	LLLineEditor*		mChatBox;
-	LLOutputMonitorCtrl* mOutputMonitor;
-	LLLocalSpeakerMgr*  mSpeakerMgr;
+	LLLineEditor*			mChatBox;
+	LLView*					mNearbyChat;
+	LLOutputMonitorCtrl*	mOutputMonitor;
+	LLLocalSpeakerMgr*		mSpeakerMgr;
 
 	S32 mExpandedHeight;
 };
diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp
index c43c95a366d4598a42261a3cffdfe44c04e8d9b0..600fd395fb02525486b9927855d9cd336cf30e37 100644
--- a/indra/newview/llnearbychathandler.cpp
+++ b/indra/newview/llnearbychathandler.cpp
@@ -63,7 +63,8 @@ class LLNearbyChatScreenChannel: public LLScreenChannelBase
 	typedef std::vector<LLHandle<LLToast> > toast_vec_t;
 	typedef std::list<LLHandle<LLToast> > toast_list_t;
 
-	LLNearbyChatScreenChannel(const Params& p):LLScreenChannelBase(p)
+	LLNearbyChatScreenChannel(const Params& p)
+		: LLScreenChannelBase(p)
 	{
 		mStopProcessing = false;
 
@@ -365,12 +366,15 @@ void LLNearbyChatScreenChannel::arrangeToasts()
 	if(mStopProcessing || isHovering())
 		return;
 
-	LLView* floater_snap_region = gViewerWindow->getRootView()->getChildView("floater_snap_region");
-
+	if (mFloaterSnapRegion == NULL)
+	{
+		mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region");
+	}
+	
 	if (!getParent())
 	{
 		// connect to floater snap region just to get resize events, we don't care about being a proper widget 
-		floater_snap_region->addChild(this);
+		mFloaterSnapRegion->addChild(this);
 		setFollows(FOLLOWS_ALL);
 	}
 
@@ -378,13 +382,13 @@ void LLNearbyChatScreenChannel::arrangeToasts()
 	updateRect();
 
 	LLRect channel_rect;
-	floater_snap_region->localRectToOtherView(floater_snap_region->getLocalRect(), &channel_rect, gFloaterView);
+	mFloaterSnapRegion->localRectToOtherView(mFloaterSnapRegion->getLocalRect(), &channel_rect, gFloaterView);
 	channel_rect.mLeft += 10;
 	channel_rect.mRight = channel_rect.mLeft + 300;
 
 	S32 channel_bottom = channel_rect.mBottom;
 
-	S32		bottom = channel_bottom + 10;
+	S32		bottom = channel_bottom + 80;
 	S32		margin = gSavedSettings.getS32("ToastGap");
 
 	//sort active toasts
@@ -454,7 +458,9 @@ LLNearbyChatHandler::LLNearbyChatHandler(e_notification_type type, const LLSD& i
 
 	channel->setCreatePanelCallback(callback);
 
-	mChannel = LLChannelManager::getInstance()->addChannel(channel);
+	LLChannelManager::getInstance()->addChannel(channel);
+
+	mChannel = channel->getHandle();
 }
 
 LLNearbyChatHandler::~LLNearbyChatHandler()
@@ -470,7 +476,7 @@ void LLNearbyChatHandler::initChannel()
 
 
 
-void LLNearbyChatHandler::processChat(const LLChat& chat_msg,		// WARNING - not really const, see hack below changing chat_msg.mText
+void LLNearbyChatHandler::processChat(const LLChat& chat_msg,
 									  const LLSD &args)
 {
 	if(chat_msg.mMuted == TRUE)
@@ -479,28 +485,10 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg,		// WARNING - not
 	if(chat_msg.mText.empty())
 		return;//don't process empty messages
 
-	// Handle irc styled messages for toast panel
-	// HACK ALERT - changes mText, stripping out IRC style "/me" prefixes
-	LLChat& tmp_chat = const_cast<LLChat&>(chat_msg);
-	std::string original_message = tmp_chat.mText;			// Save un-modified version of chat text
-	if (tmp_chat.mChatStyle == CHAT_STYLE_IRC)
-	{
-		if(!tmp_chat.mFromName.empty())
-			tmp_chat.mText = tmp_chat.mFromName + tmp_chat.mText.substr(3);
-		else
-			tmp_chat.mText = tmp_chat.mText.substr(3);
-	}
-
 	LLFloater* chat_bar = LLFloaterReg::getInstance("chat_bar");
 
 	LLNearbyChat* nearby_chat = chat_bar->findChild<LLNearbyChat>("nearby_chat");
 
-	{
-		//sometimes its usefull to have no name at all...
-		//if(tmp_chat.mFromName.empty() && tmp_chat.mFromID!= LLUUID::null)
-		//	tmp_chat.mFromName = tmp_chat.mFromID.asString();
-	}
-
 	// Build notification data 
 	LLSD notification;
 	notification["message"] = chat_msg.mText;
@@ -543,7 +531,7 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg,		// WARNING - not
 
 			LLViewerChat::getChatColor(chat_msg,txt_color);
 
-			LLFloaterScriptDebug::addScriptLine(original_message,		// Send full message with "/me" style prefix
+			LLFloaterScriptDebug::addScriptLine(chat_msg.mText,
 												chat_msg.mFromName,
 												txt_color,
 												chat_msg.mFromID);
@@ -572,11 +560,12 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg,		// WARNING - not
 		&& nearby_chat->isInVisibleChain() 
 		|| ( chat_msg.mSourceType == CHAT_SOURCE_AGENT
 			&& gSavedSettings.getBOOL("UseChatBubbles") )
-		|| !mChannel->getShowToasts() ) // to prevent toasts in Busy mode
+		|| mChannel.isDead()
+		|| !mChannel.get()->getShowToasts() ) // to prevent toasts in Busy mode
 		return;//no need in toast if chat is visible or if bubble chat is enabled
 
 	// arrange a channel on a screen
-	if(!mChannel->getVisible())
+	if(!mChannel.get()->getVisible())
 	{
 		initChannel();
 	}
@@ -593,10 +582,25 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg,		// WARNING - not
 	}
 	*/
 
-	LLNearbyChatScreenChannel* channel = dynamic_cast<LLNearbyChatScreenChannel*>(mChannel);
+	LLNearbyChatScreenChannel* channel = dynamic_cast<LLNearbyChatScreenChannel*>(mChannel.get());
 
 	if(channel)
 	{
+		// Handle IRC styled messages.
+		std::string toast_msg;
+		if (chat_msg.mChatStyle == CHAT_STYLE_IRC)
+		{
+			if (!chat_msg.mFromName.empty())
+			{
+				toast_msg += chat_msg.mFromName;
+			}
+			toast_msg += chat_msg.mText.substr(3);
+		}
+		else
+		{
+			toast_msg = chat_msg.mText;
+		}
+
 		// Add a nearby chat toast.
 		LLUUID id;
 		id.generate();
@@ -608,6 +612,7 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg,		// WARNING - not
 		notification["text_color"] = r_color_name;
 		notification["color_alpha"] = r_color_alpha;
 		notification["font_size"] = (S32)LLViewerChat::getChatFontSize() ;
+		notification["message"] = toast_msg;
 		channel->addNotification(notification);	
 	}
 }
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index 5fe5c9b1e8a4e03c0073cd053ee3599f8f1d3633..1bda7640bd32825149e429ab3a451a85adfd5692 100644
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -74,6 +74,8 @@ const F32 DOT_SCALE = 0.75f;
 const F32 MIN_PICK_SCALE = 2.f;
 const S32 MOUSE_DRAG_SLOP = 2;		// How far the mouse needs to move before we think it's a drag
 
+const F64 COARSEUPDATE_MAX_Z = 1020.0f;
+
 LLNetMap::LLNetMap (const Params & p)
 :	LLUICtrl (p),
 	mBackgroundColor (p.bg_color()),
@@ -172,10 +174,10 @@ void LLNetMap::draw()
 	LLVector3 offset = gGL.getUITranslation();
 	LLVector3 scale = gGL.getUIScale();
 
-	glLoadIdentity();
+	gGL.loadIdentity();
 	gGL.loadUIIdentity();
 
-	glScalef(scale.mV[0], scale.mV[1], scale.mV[2]);
+	gGL.scalef(scale.mV[0], scale.mV[1], scale.mV[2]);
 	gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]);
 	
 	{
@@ -183,7 +185,7 @@ void LLNetMap::draw()
 		{
 			gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 
-			glMatrixMode(GL_MODELVIEW);
+			gGL.matrixMode(LLRender::MM_MODELVIEW);
 
 			// Draw background rectangle
 			LLColor4 background_color = mBackgroundColor.get();
@@ -204,7 +206,7 @@ void LLNetMap::draw()
 		{
 			// rotate subsequent draws to agent rotation
 			rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
-			glRotatef( rotation * RAD_TO_DEG, 0.f, 0.f, 1.f);
+			gGL.rotatef( rotation * RAD_TO_DEG, 0.f, 0.f, 1.f);
 		}
 
 		// figure out where agent is
@@ -300,7 +302,8 @@ void LLNetMap::draw()
 		}
 
 		LLVector3 map_center_agent = gAgent.getPosAgentFromGlobal(mObjectImageCenterGlobal);
-		map_center_agent -= gAgentCamera.getCameraPositionAgent();
+		LLVector3 camera_position = gAgentCamera.getCameraPositionAgent();
+		map_center_agent -= camera_position;
 		map_center_agent.mV[VX] *= mScale/region_width;
 		map_center_agent.mV[VY] *= mScale/region_width;
 
@@ -321,9 +324,6 @@ void LLNetMap::draw()
 
 		gGL.popMatrix();
 
-		LLVector3d pos_global;
-		LLVector3 pos_map;
-
 		// Mouse pointer in local coordinates
 		S32 local_mouse_x;
 		S32 local_mouse_y;
@@ -333,90 +333,67 @@ void LLNetMap::draw()
 		F32 closest_dist_squared = F32_MAX; // value will be overridden in the loop
 		F32 min_pick_dist_squared = (mDotRadius * MIN_PICK_SCALE) * (mDotRadius * MIN_PICK_SCALE);
 
+		LLVector3 pos_map;
+		uuid_vec_t avatar_ids;
+		std::vector<LLVector3d> positions;
+		bool unknown_relative_z;
+
+		LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, gAgentCamera.getCameraPositionGlobal());
+
 		// Draw avatars
-		for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
-			 iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+		for (U32 i = 0; i < avatar_ids.size(); i++)
 		{
-			LLViewerRegion* regionp = *iter;
-			const LLVector3d& origin_global = regionp->getOriginGlobal();
-
-			S32 count = regionp->mMapAvatars.count();
-			S32 i;
-			LLVector3 pos_local;
-			U32 compact_local;
-			U8 bits;
-			// TODO: it'd be very cool to draw these in sorted order from lowest Z to highest.
-			// just be careful to sort the avatar IDs along with the positions. -MG
-			for (i = 0; i < count; i++)
-			{
-				compact_local = regionp->mMapAvatars.get(i);
+			pos_map = globalPosToView(positions[i]);
+			LLUUID uuid = avatar_ids[i];
 
-				bits = compact_local & 0xFF;
-				pos_local.mV[VZ] = F32(bits) * 4.f;
-				compact_local >>= 8;
+			bool show_as_friend = (LLAvatarTracker::instance().getBuddyInfo(uuid) != NULL);
 
-				bits = compact_local & 0xFF;
-				pos_local.mV[VY] = (F32)bits;
-				compact_local >>= 8;
+			LLColor4 color = show_as_friend ? map_avatar_friend_color : map_avatar_color;
 
-				bits = compact_local & 0xFF;
-				pos_local.mV[VX] = (F32)bits;
+			unknown_relative_z = positions[i].mdV[VZ] == COARSEUPDATE_MAX_Z &&
+					camera_position.mV[VZ] >= COARSEUPDATE_MAX_Z;
 
-				pos_global.setVec( pos_local );
-				pos_global += origin_global;
+			LLWorldMapView::drawAvatar(
+				pos_map.mV[VX], pos_map.mV[VY], 
+				color, 
+				pos_map.mV[VZ], mDotRadius,
+				unknown_relative_z);
 
-				pos_map = globalPosToView(pos_global);
-
-				LLUUID uuid(NULL);
-				BOOL show_as_friend = FALSE;
-				if( i < regionp->mMapAvatarIDs.count())
+			if(uuid.notNull())
+			{
+				bool selected = false;
+				uuid_vec_t::iterator sel_iter = gmSelected.begin();
+				for (; sel_iter != gmSelected.end(); sel_iter++)
 				{
-					uuid = regionp->mMapAvatarIDs.get(i);
-					show_as_friend = (LLAvatarTracker::instance().getBuddyInfo(uuid) != NULL);
+					if(*sel_iter == uuid)
+					{
+						selected = true;
+						break;
+					}
 				}
-
-				LLColor4 color = show_as_friend ? map_avatar_friend_color : map_avatar_color;
-				LLWorldMapView::drawAvatar(
-					pos_map.mV[VX], pos_map.mV[VY], 
-					color, 
-					pos_map.mV[VZ], mDotRadius);
-
-				if(uuid.notNull())
+				if(selected)
 				{
-					bool selected = false;
-					uuid_vec_t::iterator sel_iter = gmSelected.begin();
-					for (; sel_iter != gmSelected.end(); sel_iter++)
+					if( (pos_map.mV[VX] < 0) ||
+						(pos_map.mV[VY] < 0) ||
+						(pos_map.mV[VX] >= getRect().getWidth()) ||
+						(pos_map.mV[VY] >= getRect().getHeight()) )
 					{
-						if(*sel_iter == uuid)
-						{
-							selected = true;
-							break;
-						}
-					}
-					if(selected)
+						S32 x = llround( pos_map.mV[VX] );
+						S32 y = llround( pos_map.mV[VY] );
+						LLWorldMapView::drawTrackingCircle( getRect(), x, y, color, 1, 10);
+					} else
 					{
-						if( (pos_map.mV[VX] < 0) ||
-							(pos_map.mV[VY] < 0) ||
-							(pos_map.mV[VX] >= getRect().getWidth()) ||
-							(pos_map.mV[VY] >= getRect().getHeight()) )
-						{
-							S32 x = llround( pos_map.mV[VX] );
-							S32 y = llround( pos_map.mV[VY] );
-							LLWorldMapView::drawTrackingCircle( getRect(), x, y, color, 1, 10);
-						} else
-						{
-							LLWorldMapView::drawTrackingDot(pos_map.mV[VX],pos_map.mV[VY],color,0.f);
-						}
+						LLWorldMapView::drawTrackingDot(pos_map.mV[VX],pos_map.mV[VY],color,0.f);
 					}
 				}
+			}
 
-				F32	dist_to_cursor_squared = dist_vec_squared(LLVector2(pos_map.mV[VX], pos_map.mV[VY]),
-											  LLVector2(local_mouse_x,local_mouse_y));
-				if(dist_to_cursor_squared < min_pick_dist_squared && dist_to_cursor_squared < closest_dist_squared)
-				{
-					closest_dist_squared = dist_to_cursor_squared;
-					mClosestAgentToCursor = regionp->mMapAvatarIDs.get(i);
-				}
+			F32	dist_to_cursor_squared = dist_vec_squared(LLVector2(pos_map.mV[VX], pos_map.mV[VY]),
+										  LLVector2(local_mouse_x,local_mouse_y));
+			if(dist_to_cursor_squared < min_pick_dist_squared && dist_to_cursor_squared < closest_dist_squared)
+			{
+				closest_dist_squared = dist_to_cursor_squared;
+				mClosestAgentToCursor = uuid;
 			}
 		}
 
@@ -440,7 +417,7 @@ void LLNetMap::draw()
 		}
 
 		// Draw dot for self avatar position
-		pos_global = gAgent.getPositionGlobal();
+		LLVector3d pos_global = gAgent.getPositionGlobal();
 		pos_map = globalPosToView(pos_global);
 		S32 dot_width = llround(mDotRadius * 2.f);
 		LLUIImagePtr you = LLWorldMapView::sAvatarYouLargeImage;
@@ -492,7 +469,7 @@ void LLNetMap::draw()
 			// If we don't rotate the map, we have to rotate the frustum.
 			gGL.pushMatrix();
 				gGL.translatef( ctr_x, ctr_y, 0 );
-				glRotatef( atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ) * RAD_TO_DEG, 0.f, 0.f, -1.f);
+				gGL.rotatef( atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ) * RAD_TO_DEG, 0.f, 0.f, -1.f);
 				gGL.begin( LLRender::TRIANGLES  );
 					gGL.vertex2f( 0, 0 );
 					gGL.vertex2f( -half_width_pixels, far_clip_pixels );
@@ -514,9 +491,11 @@ void LLNetMap::reshape(S32 width, S32 height, BOOL called_from_parent)
 	createObjectImage();
 }
 
-LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos )
+LLVector3 LLNetMap::globalPosToView(const LLVector3d& global_pos)
 {
-	LLVector3d relative_pos_global = global_pos - gAgentCamera.getCameraPositionGlobal();
+	LLVector3d camera_position = gAgentCamera.getCameraPositionGlobal();
+
+	LLVector3d relative_pos_global = global_pos - camera_position;
 	LLVector3 pos_local;
 	pos_local.setVec(relative_pos_global);  // convert to floats from doubles
 
@@ -541,7 +520,7 @@ LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos )
 void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color, 
 							BOOL draw_arrow )
 {
-	LLVector3 pos_local = globalPosToView( pos_global );
+	LLVector3 pos_local = globalPosToView(pos_global);
 	if( (pos_local.mV[VX] < 0) ||
 		(pos_local.mV[VY] < 0) ||
 		(pos_local.mV[VX] >= getRect().getWidth()) ||
diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h
index 20fcee0814bf2ff1db301dddf3e4028b06e4c47e..1f7e7d68c60ffea70a2382de406fb00f5d1e4b62 100644
--- a/indra/newview/llnetmap.h
+++ b/indra/newview/llnetmap.h
@@ -33,9 +33,9 @@
 #include "v3dmath.h"
 #include "v4color.h"
 #include "llpointer.h"
+#include "llcoord.h"
 
 class LLColor4U;
-class LLCoordGL;
 class LLImageRaw;
 class LLViewerTexture;
 class LLFloaterMap;
diff --git a/indra/newview/llnotificationalerthandler.cpp b/indra/newview/llnotificationalerthandler.cpp
index cae7d02fedd3ddf46ca4d0ec00c14d382b742de2..89fe7bb3c22d76f9de9c7e89c539de7cbd696e01 100644
--- a/indra/newview/llnotificationalerthandler.cpp
+++ b/indra/newview/llnotificationalerthandler.cpp
@@ -51,8 +51,8 @@ LLAlertHandler::LLAlertHandler(e_notification_type type, const LLSD& id) : mIsMo
 	p.channel_align = CA_CENTRE;
 
 	// Getting a Channel for our notifications
-	mChannel = LLChannelManager::getInstance()->getChannel(p);
-	mChannel->setCanStoreToasts(false);
+	mChannel = LLChannelManager::getInstance()->getChannel(p)->getHandle();
+	mChannel.get()->setCanStoreToasts(false);
 }
 
 //--------------------------------------------------------------------------
@@ -64,13 +64,13 @@ LLAlertHandler::~LLAlertHandler()
 void LLAlertHandler::initChannel()
 {
 	S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().getWidth() / 2;
-	mChannel->init(channel_right_bound, channel_right_bound);
+	mChannel.get()->init(channel_right_bound, channel_right_bound);
 }
 
 //--------------------------------------------------------------------------
 bool LLAlertHandler::processNotification(const LLSD& notify)
 {
-	if(!mChannel)
+	if(mChannel.isDead())
 	{
 		return false;
 	}
@@ -81,7 +81,7 @@ bool LLAlertHandler::processNotification(const LLSD& notify)
 		return false;
 
 	// arrange a channel on a screen
-	if(!mChannel->getVisible())
+	if(!mChannel.get()->getVisible())
 	{
 		initChannel();
 	}
@@ -114,22 +114,22 @@ bool LLAlertHandler::processNotification(const LLSD& notify)
 		// Show alert in middle of progress view (during teleport) (EXT-1093)
 		LLProgressView* progress = gViewerWindow->getProgressView();
 		LLRect rc = progress && progress->getVisible() ? progress->getRect() : gViewerWindow->getWorldViewRectScaled();
-		mChannel->updatePositionAndSize(rc);
+		mChannel.get()->updatePositionAndSize(rc);
 
-		LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+		LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
 		if(channel)
 			channel->addToast(p);
 	}
 	else if (notify["sigtype"].asString() == "change")
 	{
 		LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal);
-		LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+		LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
 		if(channel)
 			channel->modifyToastByNotificationID(notification->getID(), (LLToastPanel*)alert_dialog);
 	}
 	else
 	{
-		LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+		LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
 		if(channel)
 			channel->killToastByNotificationID(notification->getID());
 	}
diff --git a/indra/newview/llnotificationgrouphandler.cpp b/indra/newview/llnotificationgrouphandler.cpp
index 9b7fdaef82b0a08f76092edd13e4e2719bfdcb9d..ad51389241caf864174ad411a1df65c4f734f285 100644
--- a/indra/newview/llnotificationgrouphandler.cpp
+++ b/indra/newview/llnotificationgrouphandler.cpp
@@ -42,10 +42,12 @@ LLGroupHandler::LLGroupHandler(e_notification_type type, const LLSD& id)
 	mType = type;
 
 	// Getting a Channel for our notifications
-	mChannel = LLChannelManager::getInstance()->createNotificationChannel();
-	LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+	LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();
 	if(channel)
+	{
 		channel->setOnRejectToastCallback(boost::bind(&LLGroupHandler::onRejectToast, this, _1));
+		mChannel = channel->getHandle();
+	}
 }
 
 //--------------------------------------------------------------------------
@@ -58,13 +60,13 @@ void LLGroupHandler::initChannel()
 {
 	S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); 
 	S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
-	mChannel->init(channel_right_bound - channel_width, channel_right_bound);
+	mChannel.get()->init(channel_right_bound - channel_width, channel_right_bound);
 }
 
 //--------------------------------------------------------------------------
 bool LLGroupHandler::processNotification(const LLSD& notify)
 {
-	if(!mChannel)
+	if(mChannel.isDead())
 	{
 		return false;
 	}
@@ -75,7 +77,7 @@ bool LLGroupHandler::processNotification(const LLSD& notify)
 		return false;
 
 	// arrange a channel on a screen
-	if(!mChannel->getVisible())
+	if(!mChannel.get()->getVisible())
 	{
 		initChannel();
 	}
@@ -91,7 +93,7 @@ bool LLGroupHandler::processNotification(const LLSD& notify)
 		p.panel = notify_box;
 		p.on_delete_toast = boost::bind(&LLGroupHandler::onDeleteToast, this, _1);
 
-		LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+		LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
 		if(channel)
 			channel->addToast(p);
 
@@ -102,7 +104,7 @@ bool LLGroupHandler::processNotification(const LLSD& notify)
 	}
 	else if (notify["sigtype"].asString() == "delete")
 	{
-		mChannel->killToastByNotificationID(notification->getID());
+		mChannel.get()->killToastByNotificationID(notification->getID());
 	}
 	return false;
 }
diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h
index 28a69f2373605ebdfd41407c5928348f74391361..3569ad644796b64b5648186354a207904a38e26b 100644
--- a/indra/newview/llnotificationhandler.h
+++ b/indra/newview/llnotificationhandler.h
@@ -103,8 +103,8 @@ class LLEventHandler
 	// at the moment, when a handlers creates a channel.
 	virtual void initChannel()=0;
 
-	LLScreenChannelBase*	mChannel;
-	e_notification_type		mType;
+	LLHandle<LLScreenChannelBase>	mChannel;
+	e_notification_type				mType;
 
 };
 
@@ -283,9 +283,17 @@ class LLBrowserNotification : public LLSingleton<LLBrowserNotification>
 {
 public:
 	virtual bool processNotification(const LLSD& notify);
+};
 	
+/**
+ * Handler for outbox notifications
+ */
+class LLOutboxNotification : public LLSingleton<LLOutboxNotification>
+{
+public:
+	virtual bool processNotification(const LLSD& notify);
 };
-
+	
 class LLHandlerUtil
 {
 public:
diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp
index 1b767e80d4232d00a4be3e04f6f1a8eb607298c1..7c6287967af3c1f5925a28488c3a6157e3dd4668 100644
--- a/indra/newview/llnotificationhandlerutil.cpp
+++ b/indra/newview/llnotificationhandlerutil.cpp
@@ -64,7 +64,7 @@ LLSysHandler::LLSysHandler()
 
 void LLSysHandler::removeExclusiveNotifications(const LLNotificationPtr& notif)
 {
-	LLScreenChannel* channel = dynamic_cast<LLScreenChannel *>(mChannel);
+	LLScreenChannel* channel = dynamic_cast<LLScreenChannel *>(mChannel.get());
 	if (channel == NULL)
 	{
 		return;
diff --git a/indra/newview/llnotificationmanager.cpp b/indra/newview/llnotificationmanager.cpp
index 69882271282d6a6c295d1f837f00352443b296ff..f792f53ac58d76c08bde206a55fa0a20283eaa51 100644
--- a/indra/newview/llnotificationmanager.cpp
+++ b/indra/newview/llnotificationmanager.cpp
@@ -35,6 +35,7 @@
 #include "llnotifications.h"
 
 #include <boost/bind.hpp>
+#include <boost/foreach.hpp>
 
 using namespace LLNotificationsUI;
 
@@ -48,6 +49,10 @@ LLNotificationManager::LLNotificationManager()
 //--------------------------------------------------------------------------
 LLNotificationManager::~LLNotificationManager()
 {
+	BOOST_FOREACH(listener_pair_t& pair, mChannelListeners)
+	{
+		pair.second.disconnect();
+	}
 }
 
 //--------------------------------------------------------------------------
@@ -62,16 +67,18 @@ void LLNotificationManager::init()
 	LLNotificationChannel::buildChannel("Offer", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "offer"));
 	LLNotificationChannel::buildChannel("Hints", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "hint"));
 	LLNotificationChannel::buildChannel("Browser", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "browser"));
+	LLNotificationChannel::buildChannel("Outbox", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "outbox"));
   
-	LLNotifications::instance().getChannel("Notifications")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
-	LLNotifications::instance().getChannel("NotificationTips")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
-	LLNotifications::instance().getChannel("Group Notifications")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
-	LLNotifications::instance().getChannel("Alerts")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
-	LLNotifications::instance().getChannel("AlertModal")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
-	LLNotifications::instance().getChannel("IM Notifications")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
-	LLNotifications::instance().getChannel("Offer")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
-	LLNotifications::instance().getChannel("Hints")->connectChanged(boost::bind(&LLHintHandler::processNotification, LLHintHandler::getInstance(), _1));
-	LLNotifications::instance().getChannel("Browser")->connectChanged(boost::bind(&LLBrowserNotification::processNotification, LLBrowserNotification::getInstance(), _1));
+	mChannelListeners["Notifications"] = LLNotifications::instance().getChannel("Notifications")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
+	mChannelListeners["NotificationTips"] = LLNotifications::instance().getChannel("NotificationTips")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
+	mChannelListeners["Group Notifications"] = LLNotifications::instance().getChannel("Group Notifications")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
+	mChannelListeners["Alerts"] = LLNotifications::instance().getChannel("Alerts")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
+	mChannelListeners["AlertModal"] = LLNotifications::instance().getChannel("AlertModal")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
+	mChannelListeners["IM Notifications"] = LLNotifications::instance().getChannel("IM Notifications")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
+	mChannelListeners["Offer"] = LLNotifications::instance().getChannel("Offer")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
+	mChannelListeners["Hints"] = LLNotifications::instance().getChannel("Hints")->connectChanged(boost::bind(&LLHintHandler::processNotification, LLHintHandler::getInstance(), _1));
+	mChannelListeners["Browser"] = LLNotifications::instance().getChannel("Browser")->connectChanged(boost::bind(&LLBrowserNotification::processNotification, LLBrowserNotification::getInstance(), _1));
+	mChannelListeners["Outbox"] = LLNotifications::instance().getChannel("Outbox")->connectChanged(boost::bind(&LLOutboxNotification::processNotification, LLOutboxNotification::getInstance(), _1));
 
 	mNotifyHandlers["notify"] = boost::shared_ptr<LLEventHandler>(new LLScriptHandler(NT_NOTIFY, LLSD()));
 	mNotifyHandlers["notifytip"] =  boost::shared_ptr<LLEventHandler>(new LLTipHandler(NT_NOTIFY, LLSD()));
@@ -90,6 +97,9 @@ bool LLNotificationManager::onNotification(const LLSD& notify)
 {
 	LLSysHandler* handle = NULL;
 
+	if (LLNotifications::destroyed())
+		return false;
+
 	LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
 	
 	if (!notification) 
diff --git a/indra/newview/llnotificationmanager.h b/indra/newview/llnotificationmanager.h
index 16e82e4cce025aee80e151b34513b19720d59c2a..27b6ba1c7173521cd059d67f57004c943a3a616a 100644
--- a/indra/newview/llnotificationmanager.h
+++ b/indra/newview/llnotificationmanager.h
@@ -28,6 +28,8 @@
 #ifndef LL_LLNOTIFICATIONMANAGER_H
 #define LL_LLNOTIFICATIONMANAGER_H
 
+#include "llevents.h"
+
 #include "lluictrl.h"
 #include "llnotificationhandler.h"
 
@@ -47,6 +49,7 @@ class LLToast;
 class LLNotificationManager : public LLSingleton<LLNotificationManager>
 {
 	typedef std::pair<std::string, LLEventHandler*> eventhandlers;
+	typedef std::pair<const std::string, LLBoundListener> listener_pair_t;
 public:	
 	LLNotificationManager();	
 	virtual ~LLNotificationManager();
@@ -70,6 +73,8 @@ class LLNotificationManager : public LLSingleton<LLNotificationManager>
 	//TODO (*)
 	std::map<std::string, boost::shared_ptr<LLEventHandler> > mNotifyHandlers;
 	// cruft std::map<std::string, LLChatHandler*> mChatHandlers;
+
+	std::map<std::string, LLBoundListener> mChannelListeners;
 };
 
 }
diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp
index 68fd65be0f9265eaa0bbcda5123ec552239b1c8b..1552ed3346c3e3e0865bbebe4beb2b557711bdac 100644
--- a/indra/newview/llnotificationofferhandler.cpp
+++ b/indra/newview/llnotificationofferhandler.cpp
@@ -45,12 +45,13 @@ LLOfferHandler::LLOfferHandler(e_notification_type type, const LLSD& id)
 	mType = type;
 
 	// Getting a Channel for our notifications
-	mChannel = LLChannelManager::getInstance()->createNotificationChannel();
-	mChannel->setControlHovering(true);
-
-	LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+	LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();
 	if(channel)
+	{
+		channel->setControlHovering(true);
 		channel->setOnRejectToastCallback(boost::bind(&LLOfferHandler::onRejectToast, this, _1));
+		mChannel = channel->getHandle();
+	}
 }
 
 //--------------------------------------------------------------------------
@@ -63,13 +64,13 @@ void LLOfferHandler::initChannel()
 {
 	S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
 	S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
-	mChannel->init(channel_right_bound - channel_width, channel_right_bound);
+	mChannel.get()->init(channel_right_bound - channel_width, channel_right_bound);
 }
 
 //--------------------------------------------------------------------------
 bool LLOfferHandler::processNotification(const LLSD& notify)
 {
-	if(!mChannel)
+	if(mChannel.isDead())
 	{
 		return false;
 	}
@@ -80,7 +81,7 @@ bool LLOfferHandler::processNotification(const LLSD& notify)
 		return false;
 
 	// arrange a channel on a screen
-	if(!mChannel->getVisible())
+	if(!mChannel.get()->getVisible())
 	{
 		initChannel();
 	}
@@ -134,7 +135,7 @@ bool LLOfferHandler::processNotification(const LLSD& notify)
 				// we not save offer notifications to the syswell floater that should be added to the IM floater
 				p.can_be_stored = !add_notid_to_im;
 
-				LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+				LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
 				if(channel)
 					channel->addToast(p);
 
@@ -175,7 +176,7 @@ bool LLOfferHandler::processNotification(const LLSD& notify)
 			{
 				LLHandlerUtil::decIMMesageCounter(notification);
 			}
-			mChannel->killToastByNotificationID(notification->getID());
+			mChannel.get()->killToastByNotificationID(notification->getID());
 		}
 	}
 
diff --git a/indra/newview/llnotificationscripthandler.cpp b/indra/newview/llnotificationscripthandler.cpp
index bbb4d03768b09e6809e0b615762dd5b3e21f3a6b..995915206bced30d7eb5a2535c030dfb9f373d35 100644
--- a/indra/newview/llnotificationscripthandler.cpp
+++ b/indra/newview/llnotificationscripthandler.cpp
@@ -47,13 +47,13 @@ LLScriptHandler::LLScriptHandler(e_notification_type type, const LLSD& id)
 	mType = type;
 
 	// Getting a Channel for our notifications
-	mChannel = LLChannelManager::getInstance()->createNotificationChannel();
-	mChannel->setControlHovering(true);
-	
-	LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+	LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();
 	if(channel)
+	{
+		channel->setControlHovering(true);
 		channel->setOnRejectToastCallback(boost::bind(&LLScriptHandler::onRejectToast, this, _1));
-
+		mChannel = channel->getHandle();
+	}
 }
 
 //--------------------------------------------------------------------------
@@ -66,13 +66,13 @@ void LLScriptHandler::initChannel()
 {
 	S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); 
 	S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
-	mChannel->init(channel_right_bound - channel_width, channel_right_bound);
+	mChannel.get()->init(channel_right_bound - channel_width, channel_right_bound);
 }
 
 //--------------------------------------------------------------------------
 bool LLScriptHandler::processNotification(const LLSD& notify)
 {
-	if(!mChannel)
+	if(mChannel.isDead())
 	{
 		return false;
 	}
@@ -83,7 +83,7 @@ bool LLScriptHandler::processNotification(const LLSD& notify)
 		return false;
 
 	// arrange a channel on a screen
-	if(!mChannel->getVisible())
+	if(!mChannel.get()->getVisible())
 	{
 		initChannel();
 	}
@@ -109,7 +109,7 @@ bool LLScriptHandler::processNotification(const LLSD& notify)
 			p.panel = notify_box;	
 			p.on_delete_toast = boost::bind(&LLScriptHandler::onDeleteToast, this, _1);
 
-			LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+			LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
 			if(channel)
 			{
 				channel->addToast(p);
@@ -127,7 +127,7 @@ bool LLScriptHandler::processNotification(const LLSD& notify)
 		}
 		else
 		{
-			mChannel->killToastByNotificationID(notification->getID());
+			mChannel.get()->killToastByNotificationID(notification->getID());
 		}
 	}
 	return false;
diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp
index aa009a76fa401d1189706693e1c4f4631c729d8d..e397cfa046d97efa2142bf3ca5ca02f9d43f1b04 100644
--- a/indra/newview/llnotificationtiphandler.cpp
+++ b/indra/newview/llnotificationtiphandler.cpp
@@ -46,11 +46,12 @@ LLTipHandler::LLTipHandler(e_notification_type type, const LLSD& id)
 	mType = type;	
 
 	// Getting a Channel for our notifications
-	mChannel = LLChannelManager::getInstance()->createNotificationChannel();
-
-	LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+	LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();
 	if(channel)
+	{
 		channel->setOnRejectToastCallback(boost::bind(&LLTipHandler::onRejectToast, this, _1));
+		mChannel = channel->getHandle();
+	}
 }
 
 //--------------------------------------------------------------------------
@@ -63,13 +64,13 @@ void LLTipHandler::initChannel()
 {
 	S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); 
 	S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
-	mChannel->init(channel_right_bound - channel_width, channel_right_bound);
+	mChannel.get()->init(channel_right_bound - channel_width, channel_right_bound);
 }
 
 //--------------------------------------------------------------------------
 bool LLTipHandler::processNotification(const LLSD& notify)
 {
-	if(!mChannel)
+	if(mChannel.isDead())
 	{
 		return false;
 	}
@@ -80,7 +81,7 @@ bool LLTipHandler::processNotification(const LLSD& notify)
 		return false;	
 
 	// arrange a channel on a screen
-	if(!mChannel->getVisible())
+	if(!mChannel.get()->getVisible())
 	{
 		initChannel();
 	}
@@ -95,7 +96,7 @@ bool LLTipHandler::processNotification(const LLSD& notify)
 			// don't show toast if Nearby Chat is opened
 			LLNearbyChat* nearby_chat = LLNearbyChat::getInstance();
 			LLNearbyChatBar* nearby_chat_bar = LLNearbyChatBar::getInstance();
-			if (nearby_chat_bar->getVisible() && nearby_chat->getVisible())
+			if (!nearby_chat_bar->isMinimized() && nearby_chat_bar->getVisible() && nearby_chat->getVisible())
 			{
 				return false;
 			}
@@ -137,13 +138,13 @@ bool LLTipHandler::processNotification(const LLSD& notify)
 		
 		removeExclusiveNotifications(notification);
 
-		LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+		LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
 		if(channel)
 			channel->addToast(p);
 	}
 	else if (notify["sigtype"].asString() == "delete")
 	{
-		mChannel->killToastByNotificationID(notification->getID());
+		mChannel.get()->killToastByNotificationID(notification->getID());
 	}
 	return false;
 }
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index 1dc4d796ab20d1af7f6953f6b5ffffdf24e2f41d..ef5ef2ddc82353bfc2e70d7d2ea8cfb60d574775 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -640,7 +640,7 @@ void LLOutfitsList::onOutfitsRemovalConfirmation(const LLSD& notification, const
 
 	if (mSelectedOutfitUUID.notNull())
 	{
-		remove_category(&gInventory, mSelectedOutfitUUID);
+		gInventory.removeCategory(mSelectedOutfitUUID);
 	}
 }
 
diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp
deleted file mode 100644
index c2bbec04700ed77ec65745199c7d76c6cb9033d9..0000000000000000000000000000000000000000
--- a/indra/newview/lloverlaybar.cpp
+++ /dev/null
@@ -1,378 +0,0 @@
-/** 
- * @file lloverlaybar.cpp
- * @brief LLOverlayBar class implementation
- *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-// Temporary buttons that appear at the bottom of the screen when you
-// are in a mode.
-
-#include "llviewerprecompiledheaders.h"
-
-#include "lloverlaybar.h"
-
-#include "llaudioengine.h"
-#include "llrender.h"
-#include "llagent.h"
-#include "llbutton.h"
-#include "llfocusmgr.h"
-#include "llimview.h"
-#include "llmediaremotectrl.h"
-#include "llparcel.h"
-#include "lltextbox.h"
-#include "llui.h"
-#include "llviewercontrol.h"
-#include "llviewertexturelist.h"
-#include "llviewerjoystick.h"
-#include "llviewermedia.h"
-#include "llviewermenu.h"	// handle_reset_view()
-#include "llviewermedia.h"
-#include "llviewerparcelmedia.h"
-#include "llviewerparcelmgr.h"
-#include "lluictrlfactory.h"
-#include "llviewerwindow.h"
-#include "llvoiceclient.h"
-#include "llvoavatarself.h"
-#include "llvoiceremotectrl.h"
-#include "llmediactrl.h"
-#include "llselectmgr.h"
-
-//
-// Globals
-//
-
-LLOverlayBar *gOverlayBar = NULL;
-
-extern S32 MENU_BAR_HEIGHT;
-
-//
-// Functions
-//
-
-
-
-void* LLOverlayBar::createMediaRemote(void* userdata)
-{
-	LLOverlayBar *self = (LLOverlayBar*)userdata;	
-	self->mMediaRemote =  new LLMediaRemoteCtrl ();
-	return self->mMediaRemote;
-}
-
-void* LLOverlayBar::createVoiceRemote(void* userdata)
-{
-	LLOverlayBar *self = (LLOverlayBar*)userdata;	
-	self->mVoiceRemote = new LLVoiceRemoteCtrl();
-	return self->mVoiceRemote;
-}
-
-LLOverlayBar::LLOverlayBar()
-	:	LLPanel(),
-		mMediaRemote(NULL),
-		mVoiceRemote(NULL),
-		mMusicState(STOPPED)
-{
-	setMouseOpaque(FALSE);
-	setIsChrome(TRUE);
-
-	mBuilt = false;
-
-	mFactoryMap["media_remote"] = LLCallbackMap(LLOverlayBar::createMediaRemote, this);
-	mFactoryMap["voice_remote"] = LLCallbackMap(LLOverlayBar::createVoiceRemote, this);
-	
-	LLUICtrlFactory::getInstance()->buildPanel(this, "panel_overlaybar.xml");
-}
-
-BOOL LLOverlayBar::postBuild()
-{
-	childSetAction("Set Not Busy",onClickSetNotBusy,this);
-	childSetAction("Mouselook",onClickMouselook,this);
-	childSetAction("Stand Up",onClickStandUp,this);
- 	childSetAction("Flycam",onClickFlycam,this);
-	childSetVisible("chat_bar", gSavedSettings.getBOOL("ChatVisible"));
-
-	mVoiceRemote->expandOrCollapse();
-	mMediaRemote->expandOrCollapse();
-
-	setFocusRoot(TRUE);
-	mBuilt = true;
-
-	layoutButtons();
-	return TRUE;
-}
-
-LLOverlayBar::~LLOverlayBar()
-{
-	// LLView destructor cleans up children
-}
-
-// virtual
-void LLOverlayBar::reshape(S32 width, S32 height, BOOL called_from_parent)
-{
-	LLView::reshape(width, height, called_from_parent);
-
-	if (mBuilt) 
-	{
-		layoutButtons();
-	}
-}
-
-void LLOverlayBar::layoutButtons()
-{
-	LLView* state_buttons_panel = getChildView("state_buttons");
-
-	if (state_buttons_panel->getVisible())
-	{
-		LLViewQuery query;
-		LLWidgetTypeFilter<LLButton> widget_filter;
-		query.addPreFilter(LLEnabledFilter::getInstance());
-		query.addPreFilter(&widget_filter);
-
-		child_list_t button_list = query(state_buttons_panel);
-
-		const S32 MAX_BAR_WIDTH = 600;
-		S32 bar_width = llclamp(state_buttons_panel->getRect().getWidth(), 0, MAX_BAR_WIDTH);
-
-		// calculate button widths
-		const S32 MAX_BUTTON_WIDTH = 150;
-		const S32 STATUS_BAR_PAD = 10;
-		S32 segment_width = llclamp(lltrunc((F32)(bar_width) / (F32)button_list.size()), 0, MAX_BUTTON_WIDTH);
-		S32 btn_width = segment_width - STATUS_BAR_PAD;
-
-		// Evenly space all buttons, starting from left
-		S32 left = 0;
-		S32 bottom = 1;
-
-		for (child_list_reverse_iter_t child_iter = button_list.rbegin();
-			child_iter != button_list.rend(); ++child_iter)
-		{
-			LLView *view = *child_iter;
-			LLRect r = view->getRect();
-			r.setOriginAndSize(left, bottom, btn_width, r.getHeight());
-			view->setRect(r);
-			left += segment_width;
-		}
-	}
-}
-
-// Per-frame updates of visibility
-void LLOverlayBar::refresh()
-{
-	BOOL buttons_changed = FALSE;
-
-	BOOL im_received = gIMMgr->getIMReceived();
-	LLButton* button = getChild<LLButton>("IM Received");
-	if (button && button->getVisible() != im_received)
-	{
-		button->setVisible(im_received);
-		sendChildToFront(button);
-		moveChildToBackOfTabGroup(button);
-		buttons_changed = TRUE;
-	}
-
-	BOOL busy = gAgent.getBusy();
-	button = getChild<LLButton>("Set Not Busy");
-	if (button && button->getVisible() != busy)
-	{
-		button->setVisible(busy);
-		sendChildToFront(button);
-		moveChildToBackOfTabGroup(button);
-		buttons_changed = TRUE;
-	}
-
-	BOOL flycam = LLViewerJoystick::getInstance()->getOverrideCamera();
-	button = getChild<LLButton>("Flycam");
-	if (button && button->getVisible() != flycam)
-	{
-		button->setVisible(flycam);
-		sendChildToFront(button);
-		moveChildToBackOfTabGroup(button);
-		buttons_changed = TRUE;
-	}		
-
-	BOOL mouselook_grabbed;
-	mouselook_grabbed = gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_DOWN_INDEX)
-		|| gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_UP_INDEX);
-	button = getChild<LLButton>("Mouselook");
-
-	if (button && button->getVisible() != mouselook_grabbed)
-	{
-		button->setVisible(mouselook_grabbed);
-		sendChildToFront(button);
-		moveChildToBackOfTabGroup(button);
-		buttons_changed = TRUE;
-	}
-
-	BOOL sitting = FALSE;
-	if (gAgent.getAvatarObject())
-	{
-		sitting = gAgent.getAvatarObject()->isSitting();
-	}
-	button = getChild<LLButton>("Stand Up");
-
-	if (button && button->getVisible() != sitting)
-	{
-		button->setVisible(sitting);
-		sendChildToFront(button);
-		moveChildToBackOfTabGroup(button);
-		buttons_changed = TRUE;
-	}
-
-
-	moveChildToBackOfTabGroup(mMediaRemote);
-	moveChildToBackOfTabGroup(mVoiceRemote);
-
-	// turn off the whole bar in mouselook
-	if (gAgent.cameraMouselook())
-	{
-		childSetVisible("media_remote_container", FALSE);
-		childSetVisible("voice_remote_container", FALSE);
-		childSetVisible("state_buttons", FALSE);
-	}
-	else
-	{
-		// update "remotes"
-		childSetVisible("media_remote_container", TRUE);
-		childSetVisible("voice_remote_container", LLVoiceClient::getInstance()->voiceEnabled());
-		childSetVisible("state_buttons", TRUE);
-	}
-
-	// always let user toggle into and out of chatbar
-	childSetVisible("chat_bar", gSavedSettings.getBOOL("ChatVisible"));
-
-	if (buttons_changed)
-	{
-		layoutButtons();
-	}
-}
-
-//-----------------------------------------------------------------------
-// Static functions
-//-----------------------------------------------------------------------
-
-// static
-void LLOverlayBar::onClickSetNotBusy(void*)
-{
-	gAgent.clearBusy();
-}
-
-
-// static
-void LLOverlayBar::onClickFlycam(void*)
-{
-	LLViewerJoystick::getInstance()->toggleFlycam();
-}
-
-// static
-void LLOverlayBar::onClickResetView(void* data)
-{
-	handle_reset_view();
-}
-
-//static
-void LLOverlayBar::onClickMouselook(void*)
-{
-	gAgent.changeCameraToMouselook();
-}
-
-//static
-void LLOverlayBar::onClickStandUp(void*)
-{
-	LLSelectMgr::getInstance()->deselectAllForStandingUp();
-	gAgent.setControlFlags(AGENT_CONTROL_STAND_UP);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// static media helpers
-// *TODO: Move this into an audio manager abstraction
-//static
-void LLOverlayBar::mediaStop(void*)
-{
-	if (!gOverlayBar)
-	{
-		// return;
-	}
-	LLViewerParcelMedia::stop();
-}
-//static
-void LLOverlayBar::toggleMediaPlay(void*)
-{
-	if (!gOverlayBar)
-	{
-		// return;
-	}
-
-	
-	if (LLViewerParcelMedia::getStatus() == LLViewerMediaImpl::MEDIA_PAUSED)
-	{
-		LLViewerParcelMedia::start();
-	}
-	else if(LLViewerParcelMedia::getStatus() == LLViewerMediaImpl::MEDIA_PLAYING)
-	{
-		LLViewerParcelMedia::pause();
-	}
-	else
-	{
-		LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
-		if (parcel)
-		{
-			LLViewerParcelMedia::play(parcel);
-		}
-	}
-}
-
-//static
-void LLOverlayBar::toggleMusicPlay(void*)
-{
-	if (gAudiop->isInternetStreamPlaying() != 1)
-	{
-		if (gAudiop)
-		{
-			LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
-			if ( parcel )
-			{
-				// this doesn't work properly when crossing parcel boundaries - even when the 
-				// stream is stopped, it doesn't return the right thing - commenting out for now.
-	// 			if ( gAudiop->isInternetStreamPlaying() == 0 )
-				{
-					gAudiop->startInternetStream(parcel->getMusicURL());
-				}
-			}
-		}
-	}
-	//else
-	//{
-	//	gOverlayBar->mMusicState = PAUSED; // desired state
-	//	if (gAudiop)
-	//	{
-	//		gAudiop->pauseInternetStream(1);
-	//	}
-	//}
-	else
-	{
-		if (gAudiop)
-		{
-			gAudiop->stopInternetStream();
-		}
-	}
-}
-
diff --git a/indra/newview/lloverlaybar.h b/indra/newview/lloverlaybar.h
deleted file mode 100644
index b36f5ebb731cc756bb991667f715dca770946b33..0000000000000000000000000000000000000000
--- a/indra/newview/lloverlaybar.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/** 
- * @file lloverlaybar.h
- * @brief LLOverlayBar class definition
- *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLOVERLAYBAR_H
-#define LL_LLOVERLAYBAR_H
-
-#include "llpanel.h"
-
-// "Constants" loaded from settings.xml at start time
-extern S32 STATUS_BAR_HEIGHT;
-
-class LLButton;
-class LLLineEditor;
-class LLMediaRemoteCtrl;
-class LLMessageSystem;
-class LLTextBox;
-class LLTextEditor;
-class LLUICtrl;
-class LLUUID;
-class LLFrameTimer;
-class LLStatGraph;
-class LLSlider;
-class LLVoiceRemoteCtrl;
-
-class LLOverlayBar
-:	public LLPanel
-{
-public:
-	LLOverlayBar();
-	~LLOverlayBar();
-
-	/*virtual*/ void refresh();
-	/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
-	/*virtual*/ BOOL postBuild();
-
-	void layoutButtons();
-
-	// helpers for returning desired state
-	BOOL musicPlaying() { return mMusicState == PLAYING; }
-	
-	static void onClickSetNotBusy(void* data);
-	static void onClickMouselook(void* data);
-	static void onClickStandUp(void* data);
-	static void onClickResetView(void* data);
- 	static void onClickFlycam(void* data);
-
-	//static media helper functions
-	static void toggleMediaPlay(void*);
-	static void toggleMusicPlay(void*);
-	static void musicPause(void*);
-	static void musicStop(void*);
-	static void mediaStop(void*);
-
-	static void toggleAudioVolumeFloater(void*);
-
-protected:	
-	static void* createMediaRemote(void* userdata);
-	static void* createVoiceRemote(void* userdata);
-
-	void enableMediaButtons();
-
-protected:
-	LLMediaRemoteCtrl*	mMediaRemote;
-	LLVoiceRemoteCtrl*	mVoiceRemote;
-	bool mBuilt;	// dialog constructed yet?
-	enum { STOPPED=0, PLAYING=1, PAUSED=2 };
-	S32 mMusicState;
-};
-
-extern LLOverlayBar* gOverlayBar;
-
-#endif
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp
index 988e801b61a12ca5f775bf27b3d669e72467ef1e..679b1bdcda6ebbdeac2f9b44116ddfc14e47ee59 100644
--- a/indra/newview/llpanelavatar.cpp
+++ b/indra/newview/llpanelavatar.cpp
@@ -120,269 +120,6 @@ BOOL LLDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 
 static LLDefaultChildRegistry::Register<LLDropTarget> r("drop_target");
 
-static LLRegisterPanelClassWrapper<LLPanelAvatarProfile> t_panel_profile("panel_profile");
-static LLRegisterPanelClassWrapper<LLPanelMyProfile> t_panel_my_profile("panel_my_profile");
-static LLRegisterPanelClassWrapper<LLPanelAvatarNotes> t_panel_notes("panel_notes");
-
-//-----------------------------------------------------------------------------
-// LLPanelAvatarNotes()
-//-----------------------------------------------------------------------------
-LLPanelAvatarNotes::LLPanelAvatarNotes()
-: LLPanelProfileTab()
-{
-
-}
-
-void LLPanelAvatarNotes::updateData()
-{
-	LLAvatarPropertiesProcessor::getInstance()->
-		sendAvatarNotesRequest(getAvatarId());
-}
-
-BOOL LLPanelAvatarNotes::postBuild()
-{
-	childSetCommitCallback("status_check", boost::bind(&LLPanelAvatarNotes::onCommitRights, this), NULL);
-	childSetCommitCallback("map_check", boost::bind(&LLPanelAvatarNotes::onCommitRights, this), NULL);
-	childSetCommitCallback("objects_check", boost::bind(&LLPanelAvatarNotes::onCommitRights, this), NULL);
-
-	childSetCommitCallback("add_friend", boost::bind(&LLPanelAvatarNotes::onAddFriendButtonClick, this),NULL);
-	childSetCommitCallback("im", boost::bind(&LLPanelAvatarNotes::onIMButtonClick, this), NULL);
-	childSetCommitCallback("call", boost::bind(&LLPanelAvatarNotes::onCallButtonClick, this), NULL);
-	childSetCommitCallback("teleport", boost::bind(&LLPanelAvatarNotes::onTeleportButtonClick, this), NULL);
-	childSetCommitCallback("share", boost::bind(&LLPanelAvatarNotes::onShareButtonClick, this), NULL);
-	childSetCommitCallback("show_on_map_btn", (boost::bind(
-				&LLPanelAvatarNotes::onMapButtonClick, this)), NULL);
-
-	LLTextEditor* te = getChild<LLTextEditor>("notes_edit");
-	te->setCommitCallback(boost::bind(&LLPanelAvatarNotes::onCommitNotes,this));
-	te->setCommitOnFocusLost(TRUE);
-
-	resetControls();
-	resetData();
-
-	LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this);
-
-	return TRUE;
-}
-
-void LLPanelAvatarNotes::onOpen(const LLSD& key)
-{
-	LLPanelProfileTab::onOpen(key);
-
-	fillRightsData();
-
-	//Disable "Add Friend" button for friends.
-	getChildView("add_friend")->setEnabled(!LLAvatarActions::isFriend(getAvatarId()));
-}
-
-void LLPanelAvatarNotes::fillRightsData()
-{
-	getChild<LLUICtrl>("status_check")->setValue(FALSE);
-	getChild<LLUICtrl>("map_check")->setValue(FALSE);
-	getChild<LLUICtrl>("objects_check")->setValue(FALSE);
-
-	const LLRelationship* relation = LLAvatarTracker::instance().getBuddyInfo(getAvatarId());
-	// If true - we are viewing friend's profile, enable check boxes and set values.
-	if(relation)
-	{
-		S32 rights = relation->getRightsGrantedTo();
-
-		getChild<LLUICtrl>("status_check")->setValue(LLRelationship::GRANT_ONLINE_STATUS & rights ? TRUE : FALSE);
-		getChild<LLUICtrl>("map_check")->setValue(LLRelationship::GRANT_MAP_LOCATION & rights ? TRUE : FALSE);
-		getChild<LLUICtrl>("objects_check")->setValue(LLRelationship::GRANT_MODIFY_OBJECTS & rights ? TRUE : FALSE);
-
-	}
-
-	enableCheckboxes(NULL != relation);
-}
-
-void LLPanelAvatarNotes::onCommitNotes()
-{
-	std::string notes = getChild<LLUICtrl>("notes_edit")->getValue().asString();
-	LLAvatarPropertiesProcessor::getInstance()-> sendNotes(getAvatarId(),notes);
-}
-
-void LLPanelAvatarNotes::rightsConfirmationCallback(const LLSD& notification,
-		const LLSD& response, S32 rights)
-{
-	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-	if (option == 0)
-	{
-		LLAvatarPropertiesProcessor::getInstance()->sendFriendRights(
-				getAvatarId(), rights);
-	}
-	else
-	{
-		getChild<LLUICtrl>("objects_check")->setValue(
-				getChild<LLUICtrl>("objects_check")->getValue().asBoolean() ? FALSE : TRUE);
-	}
-}
-
-void LLPanelAvatarNotes::confirmModifyRights(bool grant, S32 rights)
-{
-	LLSD args;
-	args["NAME"] = LLSLURL("agent", getAvatarId(), "displayname").getSLURLString();
-
-	if (grant)
-	{
-		LLNotificationsUtil::add("GrantModifyRights", args, LLSD(),
-				boost::bind(&LLPanelAvatarNotes::rightsConfirmationCallback, this,
-						_1, _2, rights));
-	}
-	else
-	{
-		LLNotificationsUtil::add("RevokeModifyRights", args, LLSD(),
-				boost::bind(&LLPanelAvatarNotes::rightsConfirmationCallback, this,
-						_1, _2, rights));
-	}
-}
-
-void LLPanelAvatarNotes::onCommitRights()
-{
-	const LLRelationship* buddy_relationship =
-		LLAvatarTracker::instance().getBuddyInfo(getAvatarId());
-
-	if (NULL == buddy_relationship)
-	{
-		// Lets have a warning log message instead of having a crash. EXT-4947.
-		llwarns << "Trying to modify rights for non-friend avatar. Skipped." << llendl;
-		return;
-	}
-
-
-	S32 rights = 0;
-
-	if(getChild<LLUICtrl>("status_check")->getValue().asBoolean())
-		rights |= LLRelationship::GRANT_ONLINE_STATUS;
-	if(getChild<LLUICtrl>("map_check")->getValue().asBoolean())
-		rights |= LLRelationship::GRANT_MAP_LOCATION;
-	if(getChild<LLUICtrl>("objects_check")->getValue().asBoolean())
-		rights |= LLRelationship::GRANT_MODIFY_OBJECTS;
-
-	bool allow_modify_objects = getChild<LLUICtrl>("objects_check")->getValue().asBoolean();
-
-	// if modify objects checkbox clicked
-	if (buddy_relationship->isRightGrantedTo(
-			LLRelationship::GRANT_MODIFY_OBJECTS) != allow_modify_objects)
-	{
-		confirmModifyRights(allow_modify_objects, rights);
-	}
-	// only one checkbox can trigger commit, so store the rest of rights
-	else
-	{
-		LLAvatarPropertiesProcessor::getInstance()->sendFriendRights(
-						getAvatarId(), rights);
-	}
-}
-
-void LLPanelAvatarNotes::processProperties(void* data, EAvatarProcessorType type)
-{
-	if(APT_NOTES == type)
-	{
-		LLAvatarNotes* avatar_notes = static_cast<LLAvatarNotes*>(data);
-		if(avatar_notes && getAvatarId() == avatar_notes->target_id)
-		{
-			getChild<LLUICtrl>("notes_edit")->setValue(avatar_notes->notes);
-			getChildView("notes edit")->setEnabled(true);
-
-			LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this);
-		}
-	}
-}
-
-void LLPanelAvatarNotes::resetData()
-{
-	getChild<LLUICtrl>("notes_edit")->setValue(LLStringUtil::null);
-	// Default value is TRUE
-	getChild<LLUICtrl>("status_check")->setValue(TRUE);
-}
-
-void LLPanelAvatarNotes::resetControls()
-{
-	//Disable "Add Friend" button for friends.
-	getChildView("add_friend")->setEnabled(TRUE);
-
-	enableCheckboxes(false);
-}
-
-void LLPanelAvatarNotes::onAddFriendButtonClick()
-{
-	LLAvatarActions::requestFriendshipDialog(getAvatarId());
-}
-
-void LLPanelAvatarNotes::onIMButtonClick()
-{
-	LLAvatarActions::startIM(getAvatarId());
-}
-
-void LLPanelAvatarNotes::onTeleportButtonClick()
-{
-	LLAvatarActions::offerTeleport(getAvatarId());
-}
-
-void LLPanelAvatarNotes::onCallButtonClick()
-{
-	LLAvatarActions::startCall(getAvatarId());
-}
-
-void LLPanelAvatarNotes::onShareButtonClick()
-{
-	//*TODO not implemented.
-}
-
-void LLPanelAvatarNotes::enableCheckboxes(bool enable)
-{
-	getChildView("status_check")->setEnabled(enable);
-	getChildView("map_check")->setEnabled(enable);
-	getChildView("objects_check")->setEnabled(enable);
-}
-
-LLPanelAvatarNotes::~LLPanelAvatarNotes()
-{
-	if(getAvatarId().notNull())
-	{
-		LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this);
-	}
-
-	if(LLVoiceClient::instanceExists())
-	{
-		LLVoiceClient::getInstance()->removeObserver((LLVoiceClientStatusObserver*)this);
-	}
-}
-
-// virtual, called by LLAvatarTracker
-void LLPanelAvatarNotes::changed(U32 mask)
-{
-	getChildView("teleport")->setEnabled(LLAvatarTracker::instance().isBuddyOnline(getAvatarId()));
-
-	// update rights to avoid have checkboxes enabled when friendship is terminated. EXT-4947.
-	fillRightsData();
-}
-
-// virtual
-void LLPanelAvatarNotes::onChange(EStatusType status, const std::string &channelURI, bool proximal)
-{
-	if(status == STATUS_JOINING || status == STATUS_LEFT_CHANNEL)
-	{
-		return;
-	}
-
-	getChildView("call")->setEnabled(LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking());
-}
-
-void LLPanelAvatarNotes::setAvatarId(const LLUUID& id)
-{
-	if(id.notNull())
-	{
-		if(getAvatarId().notNull())
-		{
-			LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this);
-		}
-		LLPanelProfileTab::setAvatarId(id);
-		LLAvatarTracker::instance().addParticularFriendObserver(getAvatarId(), this);
-	}
-}
-
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
@@ -461,449 +198,3 @@ void LLPanelProfileTab::updateButtons()
 		|| gAgent.isGodlike();
 	getChildView("show_on_map_btn")->setEnabled(enable_map_btn);
 }
-
-//////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////
-
-bool enable_god()
-{
-	return gAgent.isGodlike();
-}
-
-LLPanelAvatarProfile::LLPanelAvatarProfile()
-: LLPanelProfileTab()
-{
-}
-
-BOOL LLPanelAvatarProfile::postBuild()
-{
-	childSetCommitCallback("see_profile_btn",(boost::bind(&LLPanelAvatarProfile::onSeeProfileBtnClick,this)),NULL);
-	childSetCommitCallback("add_friend",(boost::bind(&LLPanelAvatarProfile::onAddFriendButtonClick,this)),NULL);
-	childSetCommitCallback("im",(boost::bind(&LLPanelAvatarProfile::onIMButtonClick,this)),NULL);
-	childSetCommitCallback("call",(boost::bind(&LLPanelAvatarProfile::onCallButtonClick,this)),NULL);
-	childSetCommitCallback("teleport",(boost::bind(&LLPanelAvatarProfile::onTeleportButtonClick,this)),NULL);
-	childSetCommitCallback("share",(boost::bind(&LLPanelAvatarProfile::onShareButtonClick,this)),NULL);
-	childSetCommitCallback("show_on_map_btn", (boost::bind(
-			&LLPanelAvatarProfile::onMapButtonClick, this)), NULL);
-
-	LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
-	registrar.add("Profile.ShowOnMap",  boost::bind(&LLPanelAvatarProfile::onMapButtonClick, this));
-	registrar.add("Profile.Pay",  boost::bind(&LLPanelAvatarProfile::pay, this));
-	registrar.add("Profile.Share", boost::bind(&LLPanelAvatarProfile::share, this));
-	registrar.add("Profile.BlockUnblock", boost::bind(&LLPanelAvatarProfile::toggleBlock, this));
-	registrar.add("Profile.Kick", boost::bind(&LLPanelAvatarProfile::kick, this));
-	registrar.add("Profile.Freeze", boost::bind(&LLPanelAvatarProfile::freeze, this));
-	registrar.add("Profile.Unfreeze", boost::bind(&LLPanelAvatarProfile::unfreeze, this));
-	registrar.add("Profile.CSR", boost::bind(&LLPanelAvatarProfile::csr, this));
-
-	LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable;
-	enable.add("Profile.EnableShowOnMap", boost::bind(&LLPanelAvatarProfile::enableShowOnMap, this));
-	enable.add("Profile.EnableGod", boost::bind(&enable_god));
-	enable.add("Profile.EnableBlock", boost::bind(&LLPanelAvatarProfile::enableBlock, this));
-	enable.add("Profile.EnableUnblock", boost::bind(&LLPanelAvatarProfile::enableUnblock, this));
-
-	LLToggleableMenu* profile_menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_profile_overflow.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
-	getChild<LLMenuButton>("overflow_btn")->setMenu(profile_menu, LLMenuButton::MP_TOP_RIGHT);
-
-	LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this);
-
-	resetControls();
-	resetData();
-
-	return TRUE;
-}
-
-void LLPanelAvatarProfile::onOpen(const LLSD& key)
-{
-	LLPanelProfileTab::onOpen(key);
-
-	mGroups.clear();
-
-	//Disable "Add Friend" button for friends.
-	getChildView("add_friend")->setEnabled(!LLAvatarActions::isFriend(getAvatarId()));
-}
-
-void LLPanelAvatarProfile::updateData()
-{
-	if (getAvatarId().notNull())
-	{
-		LLAvatarPropertiesProcessor::getInstance()->
-			sendAvatarPropertiesRequest(getAvatarId());
-		LLAvatarPropertiesProcessor::getInstance()->
-			sendAvatarGroupsRequest(getAvatarId());
-	}
-}
-
-void LLPanelAvatarProfile::resetControls()
-{
-	getChildView("status_panel")->setVisible( true);
-	getChildView("profile_buttons_panel")->setVisible( true);
-	getChildView("title_groups_text")->setVisible( true);
-	getChildView("sl_groups")->setVisible( true);
-	getChildView("add_friend")->setEnabled(true);
-
-	getChildView("status_me_panel")->setVisible( false);
-	getChildView("profile_me_buttons_panel")->setVisible( false);
-	getChildView("account_actions_panel")->setVisible( false);
-}
-
-void LLPanelAvatarProfile::resetData()
-{
-	mGroups.clear();
-	getChild<LLUICtrl>("2nd_life_pic")->setValue(LLUUID::null);
-	getChild<LLUICtrl>("real_world_pic")->setValue(LLUUID::null);
-	getChild<LLUICtrl>("online_status")->setValue(LLStringUtil::null);
-	getChild<LLUICtrl>("status_message")->setValue(LLStringUtil::null);
-	getChild<LLUICtrl>("sl_description_edit")->setValue(LLStringUtil::null);
-	getChild<LLUICtrl>("fl_description_edit")->setValue(LLStringUtil::null);
-	getChild<LLUICtrl>("sl_groups")->setValue(LLStringUtil::null);
-	getChild<LLUICtrl>("homepage_edit")->setValue(LLStringUtil::null);
-	getChild<LLUICtrl>("register_date")->setValue(LLStringUtil::null);
-	getChild<LLUICtrl>("acc_status_text")->setValue(LLStringUtil::null);
-	getChild<LLUICtrl>("partner_text")->setValue(LLStringUtil::null);
-}
-
-void LLPanelAvatarProfile::processProperties(void* data, EAvatarProcessorType type)
-{
-	if(APT_PROPERTIES == type)
-	{
-		const LLAvatarData* avatar_data = static_cast<const LLAvatarData*>(data);
-		if(avatar_data && getAvatarId() == avatar_data->avatar_id)
-		{
-			processProfileProperties(avatar_data);
-		}
-	}
-	else if(APT_GROUPS == type)
-	{
-		LLAvatarGroups* avatar_groups = static_cast<LLAvatarGroups*>(data);
-		if(avatar_groups && getAvatarId() == avatar_groups->avatar_id)
-		{
-			processGroupProperties(avatar_groups);
-		}
-	}
-}
-
-void LLPanelAvatarProfile::processProfileProperties(const LLAvatarData* avatar_data)
-{
-	fillCommonData(avatar_data);
-
-	fillPartnerData(avatar_data);
-
-	fillAccountStatus(avatar_data);
-}
-
-void LLPanelAvatarProfile::processGroupProperties(const LLAvatarGroups* avatar_groups)
-{
-	// *NOTE dzaporozhan
-	// Group properties may arrive in two callbacks, we need to save them across
-	// different calls. We can't do that in textbox as textbox may change the text.
-
-	LLAvatarGroups::group_list_t::const_iterator it = avatar_groups->group_list.begin();
-	const LLAvatarGroups::group_list_t::const_iterator it_end = avatar_groups->group_list.end();
-
-	for(; it_end != it; ++it)
-	{
-		LLAvatarGroups::LLGroupData group_data = *it;
-		mGroups[group_data.group_name] = group_data.group_id;
-	}
-
-	// Creating string, containing group list
-	std::string groups = "";
-	for (group_map_t::iterator it = mGroups.begin(); it != mGroups.end(); ++it)
-	{
-		if (it != mGroups.begin())
-			groups += ", ";
-
-		std::string group_name = LLURI::escape(it->first);
-		std::string group_url= it->second.notNull()
-				? "[secondlife:///app/group/" + it->second.asString() + "/about " + group_name + "]"
-						: getString("no_group_text");
-
-		groups += group_url;
-	}
-
-	getChild<LLUICtrl>("sl_groups")->setValue(groups);
-}
-
-static void got_full_name_callback( LLHandle<LLPanel> profile_panel_handle, const std::string& full_name )
-{
-	if (profile_panel_handle.isDead() ) return;
-
-	LLPanelAvatarProfile* profile_panel = dynamic_cast<LLPanelAvatarProfile*>(profile_panel_handle.get());
-	if ( ! profile_panel ) return;
-
-	LLStringUtil::format_map_t args;
-
-	std::string name;
-	if (LLAvatarNameCache::useDisplayNames())
-	{
-		name = LLCacheName::buildUsername(full_name);
-	}
-	else
-	{
-		name = full_name;
-	}
-
-	args["[NAME]"] = name;
-
-	std::string linden_name = profile_panel->getString("name_text_args", args);
-	profile_panel->getChild<LLUICtrl>("name_descr_text")->setValue(linden_name);
-}
-
-void LLPanelAvatarProfile::onNameCache(const LLUUID& agent_id, const LLAvatarName& av_name)
-{
-	LLStringUtil::format_map_t args;
-	args["[DISPLAY_NAME]"] = av_name.mDisplayName;
-
-	std::string display_name = getString("display_name_text_args", args);
-	getChild<LLUICtrl>("display_name_descr_text")->setValue(display_name);
-}
-
-void LLPanelAvatarProfile::fillCommonData(const LLAvatarData* avatar_data)
-{
-	//remove avatar id from cache to get fresh info
-	LLAvatarIconIDCache::getInstance()->remove(avatar_data->avatar_id);
-
-	LLStringUtil::format_map_t args;
-	{
-		std::string birth_date = LLTrans::getString("AvatarBirthDateFormat");
-		LLStringUtil::format(birth_date, LLSD().with("datetime", (S32) avatar_data->born_on.secondsSinceEpoch()));
-		args["[REG_DATE]"] = birth_date;
-	}
-
-	// ask (asynchronously) for the avatar name
-	LLHandle<LLPanel> profile_panel_handle = getHandle();
-	std::string full_name;
-	if (gCacheName->getFullName(avatar_data->agent_id, full_name))
-	{
-		// name in cache, call callback directly
-		got_full_name_callback( profile_panel_handle, full_name );
-	}
-	else
-	{
-		// not in cache, lookup name 
-		gCacheName->get(avatar_data->agent_id, false, boost::bind( got_full_name_callback, profile_panel_handle, _2 ));
-	}
-
-	// get display name
-	LLAvatarNameCache::get(avatar_data->avatar_id,
-		boost::bind(&LLPanelAvatarProfile::onNameCache, this, _1, _2));
-
-	args["[AGE]"] = LLDateUtil::ageFromDate( avatar_data->born_on, LLDate::now());
-	std::string register_date = getString("RegisterDateFormat", args);
-	getChild<LLUICtrl>("register_date")->setValue(register_date );
-	getChild<LLUICtrl>("sl_description_edit")->setValue(avatar_data->about_text);
-	getChild<LLUICtrl>("fl_description_edit")->setValue(avatar_data->fl_about_text);
-	getChild<LLUICtrl>("2nd_life_pic")->setValue(avatar_data->image_id);
-	getChild<LLUICtrl>("real_world_pic")->setValue(avatar_data->fl_image_id);
-	getChild<LLUICtrl>("homepage_edit")->setValue(avatar_data->profile_url);
-
-	// Hide home page textbox if no page was set to fix "homepage URL appears clickable without URL - EXT-4734"
-	getChildView("homepage_edit")->setVisible( !avatar_data->profile_url.empty());
-}
-
-void LLPanelAvatarProfile::fillPartnerData(const LLAvatarData* avatar_data)
-{
-	LLTextBox* partner_text = getChild<LLTextBox>("partner_text");
-	if (avatar_data->partner_id.notNull())
-	{
-		partner_text->setText(LLSLURL("agent", avatar_data->partner_id, "inspect").getSLURLString());
-	}
-	else
-	{
-		partner_text->setText(getString("no_partner_text"));
-	}
-}
-
-void LLPanelAvatarProfile::fillAccountStatus(const LLAvatarData* avatar_data)
-{
-	LLStringUtil::format_map_t args;
-	args["[ACCTTYPE]"] = LLAvatarPropertiesProcessor::accountType(avatar_data);
-	args["[PAYMENTINFO]"] = LLAvatarPropertiesProcessor::paymentInfo(avatar_data);
-	// *NOTE: AVATAR_AGEVERIFIED not currently getting set in 
-	// dataserver/lldataavatar.cpp for privacy considerations
-	args["[AGEVERIFICATION]"] = "";
-	std::string caption_text = getString("CaptionTextAcctInfo", args);
-	getChild<LLUICtrl>("acc_status_text")->setValue(caption_text);
-}
-
-void LLPanelAvatarProfile::pay()
-{
-	LLAvatarActions::pay(getAvatarId());
-}
-
-void LLPanelAvatarProfile::share()
-{
-	LLAvatarActions::share(getAvatarId());
-}
-
-void LLPanelAvatarProfile::toggleBlock()
-{
-	LLAvatarActions::toggleBlock(getAvatarId());
-}
-
-bool LLPanelAvatarProfile::enableShowOnMap()
-{
-	bool is_buddy_online = LLAvatarTracker::instance().isBuddyOnline(getAvatarId());
-
-	bool enable_map_btn = (is_buddy_online && is_agent_mappable(getAvatarId()))
-		|| gAgent.isGodlike();
-	return enable_map_btn;
-}
-
-bool LLPanelAvatarProfile::enableBlock()
-{
-	return LLAvatarActions::canBlock(getAvatarId()) && !LLAvatarActions::isBlocked(getAvatarId());
-}
-
-bool LLPanelAvatarProfile::enableUnblock()
-{
-	return LLAvatarActions::isBlocked(getAvatarId());
-}
-
-void LLPanelAvatarProfile::kick()
-{
-	LLAvatarActions::kick(getAvatarId());
-}
-
-void LLPanelAvatarProfile::freeze()
-{
-	LLAvatarActions::freeze(getAvatarId());
-}
-
-void LLPanelAvatarProfile::unfreeze()
-{
-	LLAvatarActions::unfreeze(getAvatarId());
-}
-
-void LLPanelAvatarProfile::csr()
-{
-	std::string name;
-	gCacheName->getFullName(getAvatarId(), name);
-	LLAvatarActions::csr(getAvatarId(), name);
-}
-
-void LLPanelAvatarProfile::onAddFriendButtonClick()
-{
-	LLAvatarActions::requestFriendshipDialog(getAvatarId());
-}
-
-void LLPanelAvatarProfile::onSeeProfileBtnClick()
-{
-	LLAvatarActions::showProfile(getAvatarId());
-}
-
-void LLPanelAvatarProfile::onIMButtonClick()
-{
-	LLAvatarActions::startIM(getAvatarId());
-}
-
-void LLPanelAvatarProfile::onTeleportButtonClick()
-{
-	LLAvatarActions::offerTeleport(getAvatarId());
-}
-
-void LLPanelAvatarProfile::onCallButtonClick()
-{
-	LLAvatarActions::startCall(getAvatarId());
-}
-
-void LLPanelAvatarProfile::onShareButtonClick()
-{
-	//*TODO not implemented
-}
-
-LLPanelAvatarProfile::~LLPanelAvatarProfile()
-{
-	if(getAvatarId().notNull())
-	{
-		LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this);
-	}
-
-	if(LLVoiceClient::instanceExists())
-	{
-		LLVoiceClient::getInstance()->removeObserver((LLVoiceClientStatusObserver*)this);
-	}
-}
-
-// virtual, called by LLAvatarTracker
-void LLPanelAvatarProfile::changed(U32 mask)
-{
-	getChildView("teleport")->setEnabled(LLAvatarTracker::instance().isBuddyOnline(getAvatarId()));
-}
-
-// virtual
-void LLPanelAvatarProfile::onChange(EStatusType status, const std::string &channelURI, bool proximal)
-{
-	if(status == STATUS_JOINING || status == STATUS_LEFT_CHANNEL)
-	{
-		return;
-	}
-
-	getChildView("call")->setEnabled(LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking());
-}
-
-void LLPanelAvatarProfile::setAvatarId(const LLUUID& id)
-{
-	if(id.notNull())
-	{
-		if(getAvatarId().notNull())
-		{
-			LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this);
-		}
-		LLPanelProfileTab::setAvatarId(id);
-		LLAvatarTracker::instance().addParticularFriendObserver(getAvatarId(), this);
-	}
-}
-
-//////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////
-
-LLPanelMyProfile::LLPanelMyProfile()
-: LLPanelAvatarProfile()
-{
-}
-
-BOOL LLPanelMyProfile::postBuild()
-{
-	LLPanelAvatarProfile::postBuild();
-
-	childSetCommitCallback("status_me_message_text", boost::bind(&LLPanelMyProfile::onStatusMessageChanged, this), NULL);
-
-	resetControls();
-	resetData();
-
-	return TRUE;
-}
-
-void LLPanelMyProfile::onOpen(const LLSD& key)
-{
-	LLPanelProfileTab::onOpen(key);
-}
-
-void LLPanelMyProfile::processProfileProperties(const LLAvatarData* avatar_data)
-{
-	fillCommonData(avatar_data);
-
-	fillPartnerData(avatar_data);
-
-	fillAccountStatus(avatar_data);
-}
-
-void LLPanelMyProfile::resetControls()
-{
-	getChildView("status_panel")->setVisible( false);
-	getChildView("profile_buttons_panel")->setVisible( false);
-	getChildView("title_groups_text")->setVisible( false);
-	getChildView("sl_groups")->setVisible( false);
-	getChildView("status_me_panel")->setVisible( true);
-	getChildView("profile_me_buttons_panel")->setVisible( true);
-}
-
-
-void LLPanelMyProfile::onStatusMessageChanged()
-{
-	updateData();
-}
diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h
index e95441cd581e2bbc071061904187ee18a55e0a94..e33a850cfa4a908926d7392b1e9faa58ede43bac 100644
--- a/indra/newview/llpanelavatar.h
+++ b/indra/newview/llpanelavatar.h
@@ -36,14 +36,8 @@
 class LLComboBox;
 class LLLineEditor;
 
-enum EOnlineStatus
-{
-	ONLINE_STATUS_NO      = 0,
-	ONLINE_STATUS_YES     = 1
-};
-
 /**
-* Base class for any Profile View or My Profile Panel.
+* Base class for any Profile View.
 */
 class LLPanelProfileTab
 	: public LLPanel
@@ -111,187 +105,4 @@ class LLPanelProfileTab
 	LLUUID mAvatarId;
 };
 
-/**
-* Panel for displaying Avatar's first and second life related info.
-*/
-class LLPanelAvatarProfile
-	: public LLPanelProfileTab
-	, public LLFriendObserver
-	, public LLVoiceClientStatusObserver
-{
-public:
-	LLPanelAvatarProfile();
-	/*virtual*/ ~LLPanelAvatarProfile();
-
-	/*virtual*/ void onOpen(const LLSD& key);
-
-	/**
-	 * LLFriendObserver trigger
-	 */
-	virtual void changed(U32 mask);
-
-	// Implements LLVoiceClientStatusObserver::onChange() to enable the call
-	// button when voice is available
-	/*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal);
-
-	/*virtual*/ void setAvatarId(const LLUUID& id);
-
-	/**
-	 * Processes data received from server.
-	 */
-	/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
-
-	/*virtual*/ BOOL postBuild();
-
-	/*virtual*/ void updateData();
-
-	/*virtual*/ void resetControls();
-
-	/*virtual*/ void resetData();
-
-protected:
-
-	/**
-	 * Process profile related data received from server.
-	 */
-	virtual void processProfileProperties(const LLAvatarData* avatar_data);
-
-	/**
-	 * Processes group related data received from server.
-	 */
-	virtual void processGroupProperties(const LLAvatarGroups* avatar_groups);
-
-	/**
-	 * Fills common for Avatar profile and My Profile fields.
-	 */
-	virtual void fillCommonData(const LLAvatarData* avatar_data);
-
-	/**
-	 * Fills partner data.
-	 */
-	virtual void fillPartnerData(const LLAvatarData* avatar_data);
-
-	/**
-	 * Fills account status.
-	 */
-	virtual void fillAccountStatus(const LLAvatarData* avatar_data);
-
-	/**
-	 * Opens "Pay Resident" dialog.
-	 */
-	void pay();
-
-	/**
-	 * opens inventory and IM for sharing items
-	 */
-	void share();
-
-	/**
-	 * Add/remove resident to/from your block list.
-	 */
-	void toggleBlock();
-
-	void kick();
-	void freeze();
-	void unfreeze();
-	void csr();
-	
-	bool enableShowOnMap();
-	bool enableBlock();
-	bool enableUnblock();
-	bool enableGod();
-
-	void onSeeProfileBtnClick();
-	void onAddFriendButtonClick();
-	void onIMButtonClick();
-	void onCallButtonClick();
-	void onTeleportButtonClick();
-	void onShareButtonClick();
-
-private:
-	void onNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
-
-	typedef std::map< std::string,LLUUID>	group_map_t;
-	group_map_t 			mGroups;
-};
-
-/**
- * Panel for displaying own first and second life related info.
- */
-class LLPanelMyProfile
-	: public LLPanelAvatarProfile
-{
-public:
-	LLPanelMyProfile();
-
-	/*virtual*/ BOOL postBuild();
-
-protected:
-
-	/*virtual*/ void onOpen(const LLSD& key);
-
-	/*virtual*/ void processProfileProperties(const LLAvatarData* avatar_data);
-
-	/*virtual*/ void resetControls();
-
-protected:
-	void onStatusMessageChanged();
-};
-
-/**
- * Panel for displaying Avatar's notes and modifying friend's rights.
- */
-class LLPanelAvatarNotes 
-	: public LLPanelProfileTab
-	, public LLFriendObserver
-	, public LLVoiceClientStatusObserver
-{
-public:
-	LLPanelAvatarNotes();
-	/*virtual*/ ~LLPanelAvatarNotes();
-
-	virtual void setAvatarId(const LLUUID& id);
-
-	/** 
-	 * LLFriendObserver trigger
-	 */
-	virtual void changed(U32 mask);
-
-	// Implements LLVoiceClientStatusObserver::onChange() to enable the call
-	// button when voice is available
-	/*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal);
-
-	/*virtual*/ void onOpen(const LLSD& key);
-
-	/*virtual*/ BOOL postBuild();
-
-	/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
-
-	/*virtual*/ void updateData();
-
-protected:
-
-	/*virtual*/ void resetControls();
-
-	/*virtual*/ void resetData();
-
-	/**
-	 * Fills rights data for friends.
-	 */
-	void fillRightsData();
-
-	void rightsConfirmationCallback(const LLSD& notification,
-			const LLSD& response, S32 rights);
-	void confirmModifyRights(bool grant, S32 rights);
-	void onCommitRights();
-	void onCommitNotes();
-
-	void onAddFriendButtonClick();
-	void onIMButtonClick();
-	void onCallButtonClick();
-	void onTeleportButtonClick();
-	void onShareButtonClick();
-	void enableCheckboxes(bool enable);
-};
-
 #endif // LL_LLPANELAVATAR_H
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index b73d97e4c41f13d8fb639a65befb2fcc545eecc6..03404e816b11a2581e81707c1a39bf563787e36f 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -356,9 +356,9 @@ LLEditWearableDictionary::ColorSwatchCtrls::ColorSwatchCtrls()
 
 LLEditWearableDictionary::TextureCtrls::TextureCtrls()
 {
-        addEntry ( TEX_HEAD_BODYPAINT,  new PickerControlEntry (TEX_HEAD_BODYPAINT,  "Head Tattoos", LLUUID::null, TRUE ));
-        addEntry ( TEX_UPPER_BODYPAINT, new PickerControlEntry (TEX_UPPER_BODYPAINT, "Upper Tattoos", LLUUID::null, TRUE ));
-        addEntry ( TEX_LOWER_BODYPAINT, new PickerControlEntry (TEX_LOWER_BODYPAINT, "Lower Tattoos", LLUUID::null, TRUE ));
+        addEntry ( TEX_HEAD_BODYPAINT,  new PickerControlEntry (TEX_HEAD_BODYPAINT,  "Head", LLUUID::null, TRUE ));
+        addEntry ( TEX_UPPER_BODYPAINT, new PickerControlEntry (TEX_UPPER_BODYPAINT, "Upper Body", LLUUID::null, TRUE ));
+        addEntry ( TEX_LOWER_BODYPAINT, new PickerControlEntry (TEX_LOWER_BODYPAINT, "Lower Body", LLUUID::null, TRUE ));
         addEntry ( TEX_HAIR, new PickerControlEntry (TEX_HAIR, "Texture", LLUUID( gSavedSettings.getString( "UIImgDefaultHairUUID" ) ), FALSE ));
         addEntry ( TEX_EYES_IRIS, new PickerControlEntry (TEX_EYES_IRIS, "Iris", LLUUID( gSavedSettings.getString( "UIImgDefaultEyesUUID" ) ), FALSE ));
         addEntry ( TEX_UPPER_SHIRT, new PickerControlEntry (TEX_UPPER_SHIRT, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultShirtUUID" ) ), FALSE ));
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index a4f6921f9879ee4c4d73bc1347808c58d05b2540..7301b305b2d54182110e48c6caf68e360a47c379 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -875,8 +875,15 @@ void LLPanelFace::getState()
 			{
 				getChild<LLUICtrl>("TexScaleU")->setValue(2.0f * getChild<LLUICtrl>("TexScaleU")->getValue().asReal() );
 				getChild<LLUICtrl>("TexScaleV")->setValue(2.0f * getChild<LLUICtrl>("TexScaleV")->getValue().asReal() );
-			}
 
+				// EXP-1507 (change label based on the mapping mode)
+				getChild<LLUICtrl>("rpt")->setValue(getString("string repeats per meter"));
+			}
+			else
+			if (selected_texgen == 0)  // FIXME: should not be magic numbers
+			{
+				getChild<LLUICtrl>("rpt")->setValue(getString("string repeats per face"));
+			}
 		}
 
 		{
diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp
index ca48e8561b11aa4b9dbd1fe769717992bb37a227..7a15d931811371ac3dc5bd7fcf22e69c1270416f 100644
--- a/indra/newview/llpanelgroupinvite.cpp
+++ b/indra/newview/llpanelgroupinvite.cpp
@@ -289,12 +289,12 @@ void LLPanelGroupInvite::impl::callbackClickAdd(void* userdata)
 		//Soon the avatar picker will be embedded into this panel
 		//instead of being it's own separate floater.  But that is next week.
 		//This will do for now. -jwolk May 10, 2006
-		LLFloater* parentp;
-
-		parentp = gFloaterView->getParentFloater(panelp);
-		parentp->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(impl::callbackAddUsers, _1,
-																panelp->mImplementation),
-																 TRUE));
+		LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(
+			boost::bind(impl::callbackAddUsers, _1, panelp->mImplementation), TRUE);
+		if (picker)
+		{
+			gFloaterView->getParentFloater(panelp)->addDependentFloater(picker);
+		}
 	}
 }
 
diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp
index e66dd5690c2fa4f6132d98e256d10499dfe41eb1..363443646d567d5c51c6c97b3e40df4b78978efa 100644
--- a/indra/newview/llpanelgrouplandmoney.cpp
+++ b/indra/newview/llpanelgrouplandmoney.cpp
@@ -1062,7 +1062,7 @@ void LLGroupMoneyDetailsTabEventHandler::processReply(LLMessageSystem* msg,
 
 	// We don't do time zone corrections of the calculated number of seconds
 	// because we don't have a full time stamp, only a date.
-	substitution["datetime"] = LLDateUtil::secondsSinceEpochFromString("%A %b %d, %Y", start_date);
+	substitution["datetime"] = LLDateUtil::secondsSinceEpochFromString("%Y-%m-%d", start_date);
 	LLStringUtil::format (time_str, substitution);
 
 	if ( interval_days != mImplementationp->mIntervalLength || 
@@ -1217,7 +1217,7 @@ void LLGroupMoneySalesTabEventHandler::processReply(LLMessageSystem* msg,
 
 		// We don't do time zone corrections of the calculated number of seconds
 		// because we don't have a full time stamp, only a date.
-		substitution["datetime"] = LLDateUtil::secondsSinceEpochFromString("%A %b %d, %Y", start_date);
+		substitution["datetime"] = LLDateUtil::secondsSinceEpochFromString("%Y-%m-%d", start_date);
 		LLStringUtil::format (time_str, substitution);
 
 		text = time_str + "\n\n";
diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp
index fbe331c7ab925edef1c90a3faf5bd2e10cf21d76..f825ee3215ba8f15dbbc0a1da8a08c18b63b3129 100644
--- a/indra/newview/llpanelgrouproles.cpp
+++ b/indra/newview/llpanelgrouproles.cpp
@@ -749,7 +749,10 @@ LLPanelGroupMembersSubTab::LLPanelGroupMembersSubTab()
 
 LLPanelGroupMembersSubTab::~LLPanelGroupMembersSubTab()
 {
-	gSavedSettings.setString("GroupMembersSortOrder", mMembersList->getSortColumnName());
+	if (mMembersList)
+	{
+		gSavedSettings.setString("GroupMembersSortOrder", mMembersList->getSortColumnName());
+	}
 }
 
 BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root)
diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp
index 0295ad151f4b7f733bda7237a1be8703023578d0..eda0749cdb56afb2f9214498b8ddde1e96f7780c 100644
--- a/indra/newview/llpanelimcontrolpanel.cpp
+++ b/indra/newview/llpanelimcontrolpanel.cpp
@@ -374,7 +374,7 @@ void LLPanelGroupControlPanel::draw()
 {
 	// Need to resort the participant list if it's in sort by recent speaker order.
 	if (mParticipantList)
-		mParticipantList->updateRecentSpeakersOrder();
+		mParticipantList->update();
 	LLPanelChatControlPanel::draw();
 }
 
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index c7454e85a91d82929c11adffd9256ff2c645a32d..68a3b6d1cdd5957b8abb76ed6d0676ad1bb2e4b1 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -1149,7 +1149,7 @@ Processes such actions: cut/rename/delete/paste actions
 	- cut/rename/delete in any other accordions
 	- paste - only in Favorites, Landmarks accordions
  3. For Folders we can: perform any action in Landmarks accordion, except Received folder
- 4. We can not paste folders from Clipboard (processed by LLFolderView::canPaste())
+ 4. We can paste folders from Clipboard (processed by LLFolderView::canPaste())
  5. Check LLFolderView/Inventory Bridges rules
  */
 bool LLLandmarksPanel::canItemBeModified(const std::string& command_name, LLFolderViewItem* item) const
@@ -1206,8 +1206,7 @@ bool LLLandmarksPanel::canItemBeModified(const std::string& command_name, LLFold
 
 		if ("cut" == command_name)
 		{
-			// "Cut" disabled for folders. See EXT-8697.
-			can_be_modified = root_folder->canCut() && listenerp->getInventoryType() != LLInventoryType::IT_CATEGORY;
+			can_be_modified = root_folder->canCut();
 		}
 		else if ("rename" == command_name)
 		{
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index bef809f3a71749423ad6e8f6c0c28cc16401f13c..76aadcd9138d1458bcb886b94e6031ff74a93049 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -216,6 +216,7 @@ void LLPanelLogin::addUsersWithFavoritesToUsername()
 
 void LLPanelLogin::addFavoritesToStartLocation()
 {
+	// Clear the combo.
 	LLComboBox* combo = getChild<LLComboBox>("start_location_combo");
 	if (!combo) return;
 	int num_items = combo->getItemCount();
@@ -223,6 +224,10 @@ void LLPanelLogin::addFavoritesToStartLocation()
 	{
 		combo->remove(i);
 	}
+
+	// Load favorites into the combo.
+	std::string user_defined_name = getChild<LLComboBox>("username_combo")->getSimple();
+	std::string canonical_user_name = canonicalize_username(user_defined_name);
 	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
 	LLSD fav_llsd;
 	llifstream file;
@@ -232,15 +237,18 @@ void LLPanelLogin::addFavoritesToStartLocation()
 	for (LLSD::map_const_iterator iter = fav_llsd.beginMap();
 		iter != fav_llsd.endMap(); ++iter)
 	{
-		std::string user_defined_name = getChild<LLComboBox>("username_combo")->getSimple();
-
 		// The account name in stored_favorites.xml has Resident last name even if user has
 		// a single word account name, so it can be compared case-insensitive with the
 		// user defined "firstname lastname".
-		S32 res = LLStringUtil::compareInsensitive(canonicalize_username(user_defined_name), iter->first);
-		if (res != 0) continue;
+		S32 res = LLStringUtil::compareInsensitive(canonical_user_name, iter->first);
+		if (res != 0)
+		{
+			lldebugs << "Skipping favorites for " << iter->first << llendl;
+			continue;
+		}
 
 		combo->addSeparator();
+		lldebugs << "Loading favorites for " << iter->first << llendl;
 		LLSD user_llsd = iter->second;
 		for (LLSD::array_const_iterator iter1 = user_llsd.beginArray();
 			iter1 != user_llsd.endArray(); ++iter1)
@@ -283,15 +291,15 @@ LLPanelLogin::~LLPanelLogin()
 // virtual
 void LLPanelLogin::draw()
 {
-	glPushMatrix();
+	gGL.pushMatrix();
 	{
 		F32 image_aspect = 1.333333f;
 		F32 view_aspect = (F32)getRect().getWidth() / (F32)getRect().getHeight();
 		// stretch image to maintain aspect ratio
 		if (image_aspect > view_aspect)
 		{
-			glTranslatef(-0.5f * (image_aspect / view_aspect - 1.f) * getRect().getWidth(), 0.f, 0.f);
-			glScalef(image_aspect / view_aspect, 1.f, 1.f);
+			gGL.translatef(-0.5f * (image_aspect / view_aspect - 1.f) * getRect().getWidth(), 0.f, 0.f);
+			gGL.scalef(image_aspect / view_aspect, 1.f, 1.f);
 		}
 
 		S32 width = getRect().getWidth();
@@ -306,7 +314,7 @@ void LLPanelLogin::draw()
 			mLogoImage->draw(0, -264, width + 8, mLogoImage->getHeight());
 		};
 	}
-	glPopMatrix();
+	gGL.popMatrix();
 
 	LLPanel::draw();
 }
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 9944b51902dd52b9b7450b429ca7a7585e9b14f0..c11597f532366fd793cafca0d26a6910cfcf5336 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -28,6 +28,7 @@
 #include "llpanelmaininventory.h"
 
 #include "llagent.h"
+#include "llagentcamera.h"
 #include "llavataractions.h"
 #include "lldndbutton.h"
 #include "lleconomy.h"
@@ -294,7 +295,13 @@ void LLPanelMainInventory::closeAllFolders()
 
 void LLPanelMainInventory::newWindow()
 {
-	LLFloaterInventory::showAgentInventory();
+	static S32 instance_num = 0;
+	instance_num = (instance_num + 1) % S32_MAX;
+
+	if (!gAgentCamera.cameraMouselook())
+	{
+		LLFloaterReg::showTypedInstance<LLFloaterSidePanelContainer>("inventory", LLSD(instance_num));
+	}
 }
 
 void LLPanelMainInventory::doCreate(const LLSD& userdata)
@@ -368,7 +375,7 @@ void LLPanelMainInventory::onClearSearch()
 	if (mActivePanel)
 	{
 		mActivePanel->setFilterSubString(LLStringUtil::null);
-		mActivePanel->setFilterTypes(0xffffffff);
+		mActivePanel->setFilterTypes(0xffffffffffffffffULL);
 		mActivePanel->setFilterLinks(LLInventoryFilter::FILTERLINK_INCLUDE_LINKS);
 	}
 
@@ -560,7 +567,7 @@ void LLPanelMainInventory::updateItemcountText()
 
 	std::string text = "";
 
-	if (LLInventoryModelBackgroundFetch::instance().backgroundFetchActive())
+	if (LLInventoryModelBackgroundFetch::instance().folderFetchActive())
 	{
 		text = getString("ItemcountFetching", string_args);
 	}
@@ -586,7 +593,7 @@ void LLPanelMainInventory::onFocusReceived()
 		return;
 	}
 
-	sidepanel_inventory->clearSelections(false, true, true);
+	sidepanel_inventory->clearSelections(false, true);
 }
 
 void LLPanelMainInventory::setFilterTextFromFilter() 
@@ -719,7 +726,7 @@ void LLFloaterInventoryFinder::updateElementsFromFilter()
 void LLFloaterInventoryFinder::draw()
 {
 	LLMemType mt(LLMemType::MTYPE_INVENTORY_DRAW);
-	U32 filter = 0xffffffff;
+	U64 filter = 0xffffffffffffffffULL;
 	BOOL filtered_by_all_types = TRUE;
 
 	if (!getChild<LLUICtrl>("check_animation")->getValue())
diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp
index 7cb4bbf891d264eebbbc515be5eda377cd124a83..66c9c323cb76ef6ba1456b1a39955f02e0b5c2a5 100644
--- a/indra/newview/llpanelmarketplaceinbox.cpp
+++ b/indra/newview/llpanelmarketplaceinbox.cpp
@@ -48,6 +48,8 @@ const LLPanelMarketplaceInbox::Params& LLPanelMarketplaceInbox::getDefaultParams
 // protected
 LLPanelMarketplaceInbox::LLPanelMarketplaceInbox(const Params& p)
 	: LLPanel(p)
+	, mFreshCountCtrl(NULL)
+	, mInboxButton(NULL)
 	, mInventoryPanel(NULL)
 {
 }
@@ -60,6 +62,9 @@ LLPanelMarketplaceInbox::~LLPanelMarketplaceInbox()
 BOOL LLPanelMarketplaceInbox::postBuild()
 {
 	LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMarketplaceInbox::onFocusReceived, this));
+
+	mFreshCountCtrl = getChild<LLUICtrl>("inbox_fresh_new_count");
+	mInboxButton = getChild<LLButton>("inbox_btn");
 	
 	return TRUE;
 }
@@ -109,7 +114,7 @@ void LLPanelMarketplaceInbox::onFocusReceived()
 	LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
 	if (sidepanel_inventory)
 	{
-		sidepanel_inventory->clearSelections(true, false, true);
+		sidepanel_inventory->clearSelections(true, false);
 	}
 
 	gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
@@ -216,7 +221,7 @@ void LLPanelMarketplaceInbox::draw()
 {
 	U32 item_count = getTotalItemCount();
 
-	LLView * fresh_new_count_view = getChildView("inbox_fresh_new_count");
+	llassert(mFreshCountCtrl != NULL);
 
 	if (item_count > 0)
 	{
@@ -224,26 +229,26 @@ void LLPanelMarketplaceInbox::draw()
 
 		LLStringUtil::format_map_t args;
 		args["[NUM]"] = item_count_str;
-		getChild<LLButton>("inbox_btn")->setLabel(getString("InboxLabelWithArg", args));
+		mInboxButton->setLabel(getString("InboxLabelWithArg", args));
 
 #if SUPPORTING_FRESH_ITEM_COUNT
 		// set green text to fresh item count
 		U32 fresh_item_count = getFreshItemCount();
-		fresh_new_count_view->setVisible((fresh_item_count > 0));
+		mFreshCountCtrl->setVisible((fresh_item_count > 0));
 
 		if (fresh_item_count > 0)
 		{
-			getChild<LLUICtrl>("inbox_fresh_new_count")->setTextArg("[NUM]", llformat("%d", fresh_item_count));
+			mFreshCountCtrl->setTextArg("[NUM]", llformat("%d", fresh_item_count));
 		}
 #else
-		fresh_new_count_view->setVisible(FALSE);
+		mFreshCountCtrl->setVisible(FALSE);
 #endif
 	}
 	else
 	{
-		getChild<LLButton>("inbox_btn")->setLabel(getString("InboxLabelNoArg"));
+		mInboxButton->setLabel(getString("InboxLabelNoArg"));
 
-		fresh_new_count_view->setVisible(FALSE);
+		mFreshCountCtrl->setVisible(FALSE);
 	}
 		
 	LLPanel::draw();
diff --git a/indra/newview/llpanelmarketplaceinbox.h b/indra/newview/llpanelmarketplaceinbox.h
index 3531518e518af9109d8184c332df1fd0d983c87b..9eb74581a2fd56de8f846949f0e5ab1435770959 100644
--- a/indra/newview/llpanelmarketplaceinbox.h
+++ b/indra/newview/llpanelmarketplaceinbox.h
@@ -29,7 +29,9 @@
 
 #include "llpanel.h"
 
+class LLButton;
 class LLInventoryPanel;
+class LLUICtrl;
 
 class LLPanelMarketplaceInbox : public LLPanel
 {
@@ -66,9 +68,10 @@ class LLPanelMarketplaceInbox : public LLPanel
 	void onFocusReceived();
 
 private:
-	LLInventoryPanel* mInventoryPanel;
+	LLUICtrl *			mFreshCountCtrl;
+	LLButton *			mInboxButton;
+	LLInventoryPanel *	mInventoryPanel;
 };
 
 
 #endif //LL_LLPANELMARKETPLACEINBOX_H
-
diff --git a/indra/newview/llpanelmarketplaceoutbox.cpp b/indra/newview/llpanelmarketplaceoutbox.cpp
deleted file mode 100644
index 12960fd0d60086385f2f8275d348180de4089d2f..0000000000000000000000000000000000000000
--- a/indra/newview/llpanelmarketplaceoutbox.cpp
+++ /dev/null
@@ -1,363 +0,0 @@
-/** 
- * @file llpanelmarketplaceoutbox.cpp
- * @brief Panel for marketplace outbox
- *
-* $LicenseInfo:firstyear=2011&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#include "llviewerprecompiledheaders.h"
-
-#include "llpanelmarketplaceoutbox.h"
-#include "llpanelmarketplaceoutboxinventory.h"
-
-#include "llappviewer.h"
-#include "llbutton.h"
-#include "llcoros.h"
-#include "lleventcoro.h"
-#include "llfloatersidepanelcontainer.h"
-#include "llinventorypanel.h"
-#include "llloadingindicator.h"
-#include "llnotificationsutil.h"
-#include "llpanelmarketplaceinbox.h"
-#include "llsdutil.h"
-#include "llsidepanelinventory.h"
-#include "lltimer.h"
-#include "llviewernetwork.h"
-#include "llagent.h"
-#include "llviewermedia.h"
-#include "llfolderview.h"
-#include "llinventoryfunctions.h"
-
-static LLRegisterPanelClassWrapper<LLPanelMarketplaceOutbox> t_panel_marketplace_outbox("panel_marketplace_outbox");
-
-const LLPanelMarketplaceOutbox::Params& LLPanelMarketplaceOutbox::getDefaultParams() 
-{ 
-	return LLUICtrlFactory::getDefaultParams<LLPanelMarketplaceOutbox>(); 
-}
-
-// protected
-LLPanelMarketplaceOutbox::LLPanelMarketplaceOutbox(const Params& p)
-	: LLPanel(p)
-	, mInventoryPanel(NULL)
-	, mSyncButton(NULL)
-	, mSyncIndicator(NULL)
-	, mSyncInProgress(false)
-{
-}
-
-LLPanelMarketplaceOutbox::~LLPanelMarketplaceOutbox()
-{
-}
-
-// virtual
-BOOL LLPanelMarketplaceOutbox::postBuild()
-{
-	LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLPanelMarketplaceOutbox::handleLoginComplete, this));
-	
-	LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMarketplaceOutbox::onFocusReceived, this));
-
-	return TRUE;
-}
-
-void LLPanelMarketplaceOutbox::handleLoginComplete()
-{
-	mSyncButton = getChild<LLButton>("outbox_sync_btn");
-	mSyncButton->setCommitCallback(boost::bind(&LLPanelMarketplaceOutbox::onSyncButtonClicked, this));
-	mSyncButton->setEnabled(!isOutboxEmpty());
-	
-	mSyncIndicator = getChild<LLLoadingIndicator>("outbox_sync_indicator");
-}
-
-void LLPanelMarketplaceOutbox::onFocusReceived()
-{
-	LLSidepanelInventory * sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
-	if (sidepanel_inventory)
-	{
-		sidepanel_inventory->clearSelections(true, true, false);
-	}
-}
-
-void LLPanelMarketplaceOutbox::onSelectionChange()
-{
-	LLSidepanelInventory* sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
-	if (sidepanel_inventory)
-	{
-		sidepanel_inventory->updateVerbs();
-	}
-}
-
-LLInventoryPanel * LLPanelMarketplaceOutbox::setupInventoryPanel()
-{
-	LLView * outbox_inventory_placeholder = getChild<LLView>("outbox_inventory_placeholder_panel");
-	LLView * outbox_inventory_parent = outbox_inventory_placeholder->getParent();
-	
-	mInventoryPanel = 
-		LLUICtrlFactory::createFromFile<LLInventoryPanel>("panel_outbox_inventory.xml",
-														  outbox_inventory_parent,
-														  LLInventoryPanel::child_registry_t::instance());
-	
-	llassert(mInventoryPanel);
-	
-	// Reshape the inventory to the proper size
-	LLRect inventory_placeholder_rect = outbox_inventory_placeholder->getRect();
-	mInventoryPanel->setShape(inventory_placeholder_rect);
-	
-	// Set the sort order newest to oldest
-	mInventoryPanel->setSortOrder(LLInventoryFilter::SO_DATE);	
-	mInventoryPanel->getFilter()->markDefault();
-
-	// Set selection callback for proper update of inventory status buttons
-	mInventoryPanel->setSelectCallback(boost::bind(&LLPanelMarketplaceOutbox::onSelectionChange, this));
-	
-	// Set up the note to display when the outbox is empty
-	mInventoryPanel->getFilter()->setEmptyLookupMessage("InventoryOutboxNoItems");
-	
-	// Hide the placeholder text
-	outbox_inventory_placeholder->setVisible(FALSE);
-	
-	return mInventoryPanel;
-}
-
-BOOL LLPanelMarketplaceOutbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
-								   EDragAndDropType cargo_type,
-								   void* cargo_data,
-								   EAcceptance* accept,
-								   std::string& tooltip_msg)
-{
-	BOOL handled = LLPanel::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
-
-	if (!handled && mInventoryPanel && mInventoryPanel->getRootFolder())
-	{
-		handled = mInventoryPanel->getRootFolder()->handleDragAndDropFromChild(mask,drop,cargo_type,cargo_data,accept,tooltip_msg);
-
-		if (handled)
-		{
-			mInventoryPanel->getRootFolder()->setDragAndDropThisFrame();
-		}
-	}
-
-	return handled;
-}
-
-bool LLPanelMarketplaceOutbox::isOutboxEmpty() const
-{
-	return (getTotalItemCount() == 0);
-}
-
-bool LLPanelMarketplaceOutbox::isSyncInProgress() const
-{
-	return mSyncInProgress;
-}
-
-
-std::string gTimeDelayDebugFunc = "";
-
-void timeDelay(LLCoros::self& self, LLPanelMarketplaceOutbox* outboxPanel)
-{
-	waitForEventOn(self, "mainloop");
-
-	LLTimer delayTimer;
-	delayTimer.reset();
-	delayTimer.setTimerExpirySec(5.0f);
-
-	while (!delayTimer.hasExpired())
-	{
-		waitForEventOn(self, "mainloop");
-	}
-
-	outboxPanel->onSyncComplete(true, LLSD::emptyMap());
-
-	gTimeDelayDebugFunc = "";
-}
-
-
-class LLInventorySyncResponder : public LLHTTPClient::Responder
-{
-public:
-	LLInventorySyncResponder(LLPanelMarketplaceOutbox * outboxPanel)
-		: LLCurl::Responder()
-		, mOutboxPanel(outboxPanel)
-	{
-	}
-
-	void completed(U32 status, const std::string& reason, const LLSD& content)
-	{
-		llinfos << "inventory_import complete status: " << status << ", reason: " << reason << llendl;
-
-		if (isGoodStatus(status))
-		{
-			// Complete success
-			llinfos << "success" << llendl;
-		}	
-		else
-		{
-			llwarns << "failed" << llendl;
-		}
-
-		mOutboxPanel->onSyncComplete(isGoodStatus(status), content);
-	}
-
-private:
-	LLPanelMarketplaceOutbox *	mOutboxPanel;
-};
-
-void LLPanelMarketplaceOutbox::onSyncButtonClicked()
-{
-	// Get the sync animation going
-	mSyncInProgress = true;
-	updateSyncButtonStatus();
-
-	// Make the url for the inventory import request
-	std::string url = "https://marketplace.secondlife.com/";
-
-	if (!LLGridManager::getInstance()->isInProductionGrid())
-	{
-		std::string gridLabel = LLGridManager::getInstance()->getGridLabel();
-		url = llformat("https://marketplace.%s.lindenlab.com/", utf8str_tolower(gridLabel).c_str());
-
-		// TEMP for Jim's pdp
-		//url = "http://pdp24.lindenlab.com:3000/";
-	}
-	
-	url += "api/1/users/";
-	url += gAgent.getID().getString();
-	url += "/inventory_import";
-
-	llinfos << "http get:  " << url << llendl;
-	LLHTTPClient::get(url, new LLInventorySyncResponder(this), LLViewerMedia::getHeaders());
-
-	// Set a timer (for testing only)
-    //gTimeDelayDebugFunc = LLCoros::instance().launch("LLPanelMarketplaceOutbox timeDelay", boost::bind(&timeDelay, _1, this));
-}
-
-void LLPanelMarketplaceOutbox::onSyncComplete(bool goodStatus, const LLSD& content)
-{
-	mSyncInProgress = false;
-	updateSyncButtonStatus();
-	
-	const LLSD& errors_list = content["errors"];
-
-	if (goodStatus && (errors_list.size() == 0))
-	{
-		LLNotificationsUtil::add("OutboxUploadComplete", LLSD::emptyMap(), LLSD::emptyMap());
-	}
-	else
-	{
-		LLNotificationsUtil::add("OutboxUploadHadErrors", LLSD::emptyMap(), LLSD::emptyMap());
-	}
-
-	llinfos << "Marketplace upload llsd:" << llendl;
-	llinfos << ll_pretty_print_sd(content) << llendl;
-	llinfos << llendl;
-
-	const LLSD& imported_list = content["imported"];
-	LLSD::array_const_iterator it = imported_list.beginArray();
-	for ( ; it != imported_list.endArray(); ++it)
-	{
-		LLUUID imported_folder = (*it).asUUID();
-		llinfos << "Successfully uploaded folder " << imported_folder.asString() << " to marketplace." << llendl;
-	}
-
-	for (it = errors_list.beginArray(); it != errors_list.endArray(); ++it)
-	{
-		const LLSD& item_error_map = (*it);
-
-		LLUUID error_folder = item_error_map["folder_id"].asUUID();
-		const std::string& error_string = item_error_map["identifier"].asString();
-		LLUUID error_item = item_error_map["item_id"].asUUID();
-		const std::string& error_item_name = item_error_map["item_name"].asString();
-		const std::string& error_message = item_error_map["message"].asString();
-
-		llinfos << "Error item " << error_folder.asString() << ", " << error_string << ", "
-				<< error_item.asString() << ", " << error_item_name << ", " << error_message << llendl;
-		
-		LLFolderViewFolder * item_folder = mInventoryPanel->getRootFolder()->getFolderByID(error_folder);
-		LLOutboxFolderViewFolder * outbox_item_folder = dynamic_cast<LLOutboxFolderViewFolder *>(item_folder);
-
-		llassert(outbox_item_folder);
-
-		outbox_item_folder->setErrorString(error_string);
-	}
-}
-
-void LLPanelMarketplaceOutbox::updateSyncButtonStatus()
-{
-	if (isSyncInProgress())
-	{
-		mSyncButton->setVisible(false);
-
-		mSyncIndicator->setVisible(true);
-		mSyncIndicator->reset();
-		mSyncIndicator->start();
-	}
-	else
-	{
-		mSyncIndicator->stop();
-		mSyncIndicator->setVisible(false);
-
-		mSyncButton->setVisible(true);
-		mSyncButton->setEnabled(!isOutboxEmpty());
-	}
-}
-
-U32 LLPanelMarketplaceOutbox::getTotalItemCount() const
-{
-	U32 item_count = 0;
-
-	if (mInventoryPanel)
-	{
-		const LLFolderViewFolder * outbox_folder = mInventoryPanel->getRootFolder();
-
-		if (outbox_folder)
-		{
-			item_count += outbox_folder->getFoldersCount();
-		}
-	}
-
-	return item_count;
-}
-
-void LLPanelMarketplaceOutbox::draw()
-{
-	const U32 item_count = getTotalItemCount();
-	const bool not_empty = (item_count > 0);
-
-	if (not_empty)
-	{
-		std::string item_count_str = llformat("%d", item_count);
-
-		LLStringUtil::format_map_t args;
-		args["[NUM]"] = item_count_str;
-		getChild<LLButton>("outbox_btn")->setLabel(getString("OutboxLabelWithArg", args));
-	}
-	else
-	{
-		getChild<LLButton>("outbox_btn")->setLabel(getString("OutboxLabelNoArg"));
-	}
-	
-	if (!isSyncInProgress())
-	{
-		mSyncButton->setEnabled(not_empty);
-	}
-	
-	LLPanel::draw();
-}
diff --git a/indra/newview/llpanelmarketplaceoutbox.h b/indra/newview/llpanelmarketplaceoutbox.h
deleted file mode 100644
index c6b4a5abe2f04dbad64cbfa47f02522247beed14..0000000000000000000000000000000000000000
--- a/indra/newview/llpanelmarketplaceoutbox.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/** 
- * @file llpanelmarketplaceoutbox.h
- * @brief Panel for marketplace outbox
- *
-* $LicenseInfo:firstyear=2011&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLPANELMARKETPLACEOUTBOX_H
-#define LL_LLPANELMARKETPLACEOUTBOX_H
-
-#include "llpanel.h"
-
-
-class LLButton;
-class LLInventoryPanel;
-class LLLoadingIndicator;
-
-
-class LLPanelMarketplaceOutbox : public LLPanel
-{
-public:
-	
-	struct Params :	public LLInitParam::Block<Params, LLPanel::Params>
-	{};
-	
-	LOG_CLASS(LLPanelMarketplaceOutbox);
-
-	// RN: for some reason you can't just use LLUICtrlFactory::getDefaultParams as a default argument in VC8
-	static const LLPanelMarketplaceOutbox::Params& getDefaultParams();
-	
-	LLPanelMarketplaceOutbox(const Params& p = getDefaultParams());
-	~LLPanelMarketplaceOutbox();
-
-	/*virtual*/ BOOL postBuild();
-
-	/*virtual*/ void draw();
-
-	LLInventoryPanel * setupInventoryPanel();
-
-	U32 getTotalItemCount() const;
-
-	bool isOutboxEmpty() const;
-	bool isSyncInProgress() const;
-
-	void onSyncComplete(bool goodStatus, const LLSD& content);
-
-	/*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
-								   EDragAndDropType cargo_type,
-								   void* cargo_data,
-								   EAcceptance* accept,
-								   std::string& tooltip_msg);
-
-protected:
-	void onSyncButtonClicked();
-	void updateSyncButtonStatus();
-
-	void handleLoginComplete();
-	void onFocusReceived();
-	void onSelectionChange();
-
-private:
-	LLInventoryPanel *		mInventoryPanel;
-
-	LLButton *				mSyncButton;
-	LLLoadingIndicator *	mSyncIndicator;
-	bool					mSyncInProgress;
-};
-
-
-#endif //LL_LLPANELMARKETPLACEOUTBOX_H
-
diff --git a/indra/newview/llpanelmarketplaceoutboxinventory.cpp b/indra/newview/llpanelmarketplaceoutboxinventory.cpp
index ed1206aec82eade5702da9a98e781e6470d67ba8..ff62cb23dbb18f6cc5b01fa6ff66d8e79e79136b 100644
--- a/indra/newview/llpanelmarketplaceoutboxinventory.cpp
+++ b/indra/newview/llpanelmarketplaceoutboxinventory.cpp
@@ -46,50 +46,6 @@ static LLDefaultChildRegistry::Register<LLOutboxInventoryPanel> r1("outbox_inven
 static LLDefaultChildRegistry::Register<LLOutboxFolderViewFolder> r2("outbox_folder_view_folder");
 
 
-//
-// Marketplace errors
-//
-
-enum
-{
-	MKTERR_NONE = 0,
-
-	MKTERR_NOT_MERCHANT,
-	MKTERR_FOLDER_EMPTY,
-	MKTERR_UNASSOCIATED_PRODUCTS,
-	MKTERR_OBJECT_LIMIT,
-	MKTERR_FOLDER_DEPTH,
-	MKTERR_UNSELLABLE_ITEM,
-	MKTERR_INTERNAL_IMPORT,
-
-	MKTERR_COUNT
-};
-
-static const std::string MARKETPLACE_ERROR_STRINGS[MKTERR_COUNT] =
-{
-	"NO_ERROR",
-	"NOT_MERCHANT_ERROR",
-	"FOLDER_EMPTY_ERROR",
-	"UNASSOCIATED_PRODUCTS_ERROR",
-	"OBJECT_LIMIT_ERROR",
-	"FOLDER_DEPTH_ERROR",
-	"UNSELLABLE_ITEM_FOUND",
-	"INTERNAL_IMPORT_ERROR",
-};
-
-static const std::string MARKETPLACE_ERROR_NAMES[MKTERR_COUNT] =
-{
-	"Marketplace Error None",
-	"Marketplace Error Not Merchant",
-	"Marketplace Error Empty Folder",
-	"Marketplace Error Unassociated Products",
-	"Marketplace Error Object Limit",
-	"Marketplace Error Folder Depth",
-	"Marketplace Error Unsellable Item",
-	"Marketplace Error Internal Import",
-};
-
-
 //
 // LLOutboxInventoryPanel Implementation
 //
@@ -111,37 +67,6 @@ void LLOutboxInventoryPanel::buildFolderView(const LLInventoryPanel::Params& par
 	
 	LLUUID root_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false, false);
 	
-	// leslie -- temporary HACK to work around sim not creating outbox with proper system folder type
-	if (root_id.isNull())
-	{
-		std::string start_folder_name(params.start_folder());
-		
-		LLInventoryModel::cat_array_t* cats;
-		LLInventoryModel::item_array_t* items;
-		
-		gInventory.getDirectDescendentsOf(gInventory.getRootFolderID(), cats, items);
-		
-		if (cats)
-		{
-			for (LLInventoryModel::cat_array_t::const_iterator cat_it = cats->begin(); cat_it != cats->end(); ++cat_it)
-			{
-				LLInventoryCategory* cat = *cat_it;
-				
-				if (cat->getName() == start_folder_name)
-				{
-					root_id = cat->getUUID();
-					break;
-				}
-			}
-		}
-		
-		if (root_id == LLUUID::null)
-		{
-			llwarns << "No category found that matches outbox inventory panel start_folder: " << start_folder_name << llendl;
-		}
-	}
-	// leslie -- end temporary HACK
-	
 	if (root_id == LLUUID::null)
 	{
 		llwarns << "Outbox inventory panel has no root folder!" << llendl;
@@ -206,66 +131,26 @@ LLFolderViewItem * LLOutboxInventoryPanel::createFolderViewItem(LLInvFVBridge *
 
 LLOutboxFolderViewFolder::LLOutboxFolderViewFolder(const Params& p)
 	: LLFolderViewFolder(p)
-	, LLBadgeOwner(getHandle())
-	, mError(0)
-{
-	initBadgeParams(p.error_badge());
-}
-
-LLOutboxFolderViewFolder::~LLOutboxFolderViewFolder()
 {
 }
 
-// virtual
-void LLOutboxFolderViewFolder::draw()
-{
-	if (!badgeHasParent())
-	{
-		addBadgeToParentPanel();
-	}
-	
-	setBadgeVisibility(hasError());
-
-	LLFolderViewFolder::draw();
-}
+//
+// LLOutboxFolderViewItem Implementation
+//
 
-void LLOutboxFolderViewFolder::setErrorString(const std::string& errorString)
+LLOutboxFolderViewItem::LLOutboxFolderViewItem(const Params& p)
+	: LLFolderViewItem(p)
 {
-	S32 error_code = MKTERR_NONE;
-
-	for (S32 i = 1; i < MKTERR_COUNT; ++i)
-	{
-		if (MARKETPLACE_ERROR_STRINGS[i] == errorString)
-		{
-			error_code = i;
-			break;
-		}
-	}
-
-	setError(error_code);
 }
 
-void LLOutboxFolderViewFolder::setError(S32 errorCode)
+BOOL LLOutboxFolderViewItem::handleDoubleClick(S32 x, S32 y, MASK mask)
 {
-	mError = errorCode;
-
-	if (hasError())
-	{
-		setToolTip(LLTrans::getString(MARKETPLACE_ERROR_NAMES[mError]));
-	}
-	else
-	{
-		setToolTip(LLStringExplicit(""));
-	}
+	return TRUE;
 }
 
-//
-// LLOutboxFolderViewItem Implementation
-//
-
-BOOL LLOutboxFolderViewItem::handleDoubleClick(S32 x, S32 y, MASK mask)
+void LLOutboxFolderViewItem::openItem()
 {
-	return TRUE;
+	// Intentionally do nothing to block attaching items from the outbox
 }
 
 // eof
diff --git a/indra/newview/llpanelmarketplaceoutboxinventory.h b/indra/newview/llpanelmarketplaceoutboxinventory.h
index 346680a79d9ab56d8c2966570bf1bfd6415d6829..a6c522b7c235401e411655856e1fa7a05a0c67e6 100644
--- a/indra/newview/llpanelmarketplaceoutboxinventory.h
+++ b/indra/newview/llpanelmarketplaceoutboxinventory.h
@@ -28,7 +28,6 @@
 #define LL_OUTBOXINVENTORYPANEL_H
 
 
-#include "llbadgeowner.h"
 #include "llinventorypanel.h"
 #include "llfolderviewitem.h"
 
@@ -53,44 +52,26 @@ class LLOutboxInventoryPanel : public LLInventoryPanel
 };
 
 
-class LLOutboxFolderViewFolder : public LLFolderViewFolder, public LLBadgeOwner
+class LLOutboxFolderViewFolder : public LLFolderViewFolder
 {
 public:
 	struct Params : public LLInitParam::Block<Params, LLFolderViewFolder::Params>
 	{
-		Optional<LLBadge::Params>	error_badge;
-		
-		Params()
-			: error_badge("error_badge")
-		{
-		}
+		Params() {}
 	};
 	
 	LLOutboxFolderViewFolder(const Params& p);
-	~LLOutboxFolderViewFolder();
-
-	void draw();
-
-	void setErrorString(const std::string& errorString);
-	void setError(S32 errorCode);
-	
-	bool hasError() const { return (mError != 0); }
-
-protected:
-	S32 mError;
 };
 
 
 class LLOutboxFolderViewItem : public LLFolderViewItem
 {
 public:
-	LLOutboxFolderViewItem(const Params& p)
-		: LLFolderViewItem(p)
-	{
-	}
+	LLOutboxFolderViewItem(const Params& p);
 
 	// virtual
 	BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
+	void openItem();
 };
 
 
diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp
index 7e47a96f44e4278a8f5e86aadeccd5b32119817b..a9af56f750b12a9bfbe43d876268136fbe44281d 100644
--- a/indra/newview/llpanelme.cpp
+++ b/indra/newview/llpanelme.cpp
@@ -48,16 +48,10 @@
 #include "lltabcontainer.h"
 #include "lltexturectrl.h"
 
-#define PICKER_SECOND_LIFE "2nd_life_pic"
-#define PICKER_FIRST_LIFE "real_world_pic"
-#define PANEL_PROFILE "panel_profile"
-
-static LLRegisterPanelClassWrapper<LLPanelMyProfileEdit> t_panel_me_profile_edit("edit_profile_panel");
 static LLRegisterPanelClassWrapper<LLPanelMe> t_panel_me_profile("panel_me");
 
 LLPanelMe::LLPanelMe(void) 
  : LLPanelProfile()
- , mEditPanel(NULL)
 {
 	setAvatarId(gAgent.getID());
 }
@@ -73,282 +67,3 @@ void LLPanelMe::onOpen(const LLSD& key)
 {
 	LLPanelProfile::onOpen(key);
 }
-
-void LLPanelMe::buildEditPanel()
-{
-	if (NULL == mEditPanel)
-	{
-		mEditPanel = new LLPanelMyProfileEdit();
-
-		// Note: Remove support for editing profile through this method.
-		//       All profile editing should go through the web.
-		//mEditPanel->childSetAction("save_btn", boost::bind(&LLPanelMe::onSaveChangesClicked, this), this);
-
-		//mEditPanel->childSetAction("cancel_btn", boost::bind(&LLPanelMe::onCancelClicked, this), this);
-	}
-}
-
-
-void LLPanelMe::onEditProfileClicked()
-{
-	buildEditPanel();
-}
-
-//////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////
-
-LLPanelMyProfileEdit::LLPanelMyProfileEdit() 
- : LLPanelMyProfile()
-{
-	buildFromFile( "panel_edit_profile.xml");
-
-	setAvatarId(gAgent.getID());
-
-	LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLPanelMyProfileEdit::onAvatarNameChanged, this));
-}
-
-void LLPanelMyProfileEdit::onOpen(const LLSD& key)
-{
-	resetData();
-
-	// Disable editing until data is loaded, or edited fields will be overwritten when data
-	// is loaded.
-	enableEditing(false);
-
-	// force new avatar name fetch so we have latest update time
-	LLAvatarNameCache::fetch(gAgent.getID()); 
-	LLPanelMyProfile::onOpen(getAvatarId());
-	
-	LLAvatarName av_name;	
-	if (LLAvatarNameCache::useDisplayNames())
-	{
-		if (LLAvatarNameCache::get(gAgent.getID(), &av_name) && av_name.mIsDisplayNameDefault)  	
-		{
-			LLFirstUse::setDisplayName();
-		}
-		else
-		{
-			LLFirstUse::setDisplayName(false);
-		}
-	}
-
-	if (LLAvatarNameCache::useDisplayNames())
-	{
-		getChild<LLUICtrl>("user_label")->setVisible( true );
-		getChild<LLUICtrl>("user_slid")->setVisible( true );
-		getChild<LLUICtrl>("display_name_label")->setVisible( true );
-		getChild<LLUICtrl>("set_name")->setVisible( true );
-		getChild<LLUICtrl>("set_name")->setEnabled( true );
-		getChild<LLUICtrl>("solo_user_name")->setVisible( false );
-		getChild<LLUICtrl>("solo_username_label")->setVisible( false );
-	}
-	else
-	{
-		getChild<LLUICtrl>("user_label")->setVisible( false );
-		getChild<LLUICtrl>("user_slid")->setVisible( false );
-		getChild<LLUICtrl>("display_name_label")->setVisible( false );
-		getChild<LLUICtrl>("set_name")->setVisible( false );
-		getChild<LLUICtrl>("set_name")->setEnabled( false );
-		getChild<LLUICtrl>("solo_user_name")->setVisible( true );
-		getChild<LLUICtrl>("solo_username_label")->setVisible( true );
-	}
-}
-
-void LLPanelMyProfileEdit::onClose(const LLSD& key)
-{
-	if (LLAvatarNameCache::useDisplayNames())
-	{
-		LLFirstUse::setDisplayName(false);
-	}	
-}
-
-void LLPanelMyProfileEdit::processProperties(void* data, EAvatarProcessorType type)
-{
-	if(APT_PROPERTIES == type)
-	{
-		const LLAvatarData* avatar_data = static_cast<const LLAvatarData*>(data);
-		if(avatar_data && getAvatarId() == avatar_data->avatar_id)
-		{
-			// *TODO dzaporozhan
-			// Workaround for ticket EXT-1099, waiting for fix for ticket EXT-1128
-			enableEditing(true);
-			processProfileProperties(avatar_data);
-			LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this);
-		}
-	}
-}
-
-void LLPanelMyProfileEdit::processProfileProperties(const LLAvatarData* avatar_data)
-{
-	fillCommonData(avatar_data);
-
-	// 'Home page' was hidden in LLPanelAvatarProfile::fillCommonData() to fix  EXT-4734
-	// Show 'Home page' in Edit My Profile (EXT-4873)
-	getChildView("homepage_edit")->setVisible( true);
-
-	fillPartnerData(avatar_data);
-
-	fillAccountStatus(avatar_data);
-
-	getChild<LLUICtrl>("show_in_search_checkbox")->setValue((BOOL)(avatar_data->flags & AVATAR_ALLOW_PUBLISH));
-
-	LLAvatarNameCache::get(avatar_data->avatar_id,
-		boost::bind(&LLPanelMyProfileEdit::onNameCache, this, _1, _2));
-}
-
-void LLPanelMyProfileEdit::onNameCache(const LLUUID& agent_id, const LLAvatarName& av_name)
-{
-	getChild<LLUICtrl>("user_name")->setValue( av_name.mDisplayName );
-	getChild<LLUICtrl>("user_slid")->setValue( av_name.mUsername );
-	getChild<LLUICtrl>("user_name_small")->setValue( av_name.mDisplayName );
-	getChild<LLUICtrl>("solo_user_name")->setValue( av_name.mDisplayName );
-
-
-	if (LLAvatarNameCache::useDisplayNames())
-	{
-		getChild<LLUICtrl>("user_label")->setVisible( true );
-		getChild<LLUICtrl>("user_slid")->setVisible( true );
-		getChild<LLUICtrl>("display_name_label")->setVisible( true );
-		getChild<LLUICtrl>("set_name")->setVisible( true );
-		getChild<LLUICtrl>("set_name")->setEnabled( true );
-
-		getChild<LLUICtrl>("solo_user_name")->setVisible( false );
-		getChild<LLUICtrl>("solo_username_label")->setVisible( false );
-
-		// show smaller display name if too long to display in regular size
-		if (getChild<LLTextBox>("user_name")->getTextPixelWidth() > getChild<LLTextBox>("user_name")->getRect().getWidth())
-		{
-			getChild<LLUICtrl>("user_name_small")->setVisible( true );
-			getChild<LLUICtrl>("user_name")->setVisible( false );
-		}
-		else
-		{
-			getChild<LLUICtrl>("user_name_small")->setVisible( false );
-			getChild<LLUICtrl>("user_name")->setVisible( true );
-		}
-	}
-	else
-	{
-		getChild<LLUICtrl>("user_label")->setVisible( false );
-		getChild<LLUICtrl>("user_slid")->setVisible( false );
-		getChild<LLUICtrl>("display_name_label")->setVisible( false );
-		getChild<LLUICtrl>("set_name")->setVisible( false );
-		getChild<LLUICtrl>("set_name")->setEnabled( false );
-		
-		getChild<LLUICtrl>("solo_user_name")->setVisible( true );
-		getChild<LLUICtrl>("user_name_small")->setVisible( false );
-		getChild<LLUICtrl>("user_name")->setVisible( false );
-		getChild<LLUICtrl>("solo_username_label")->setVisible( true );
-	}
-}
-
-
-void LLPanelMyProfileEdit::onAvatarNameChanged()
-{
-	LLAvatarNameCache::get(getAvatarId(),
-		boost::bind(&LLPanelMyProfileEdit::onNameCache, this, _1, _2));
-}
-
-BOOL LLPanelMyProfileEdit::postBuild()
-{
-	initTexturePickerMouseEvents();
-
-	getChild<LLUICtrl>("partner_edit_link")->setTextArg("[URL]", getString("partner_edit_link_url"));
-	getChild<LLUICtrl>("my_account_link")->setTextArg("[URL]", getString("my_account_link_url"));
-
-	getChild<LLUICtrl>("set_name")->setCommitCallback(
-		boost::bind(&LLPanelMyProfileEdit::onClickSetName, this));
-
-	LLHints::registerHintTarget("set_display_name", getChild<LLUICtrl>("set_name")->getHandle());
-	LLViewerDisplayName::addNameChangedCallback(boost::bind(&LLPanelMyProfileEdit::onAvatarNameChanged, this));
-	return LLPanelAvatarProfile::postBuild();
-}
-/**
- * Inits map with texture picker and appropriate edit icon.
- * Sets callbacks of Mouse Enter and Mouse Leave signals of Texture Pickers 
- */
-void LLPanelMyProfileEdit::initTexturePickerMouseEvents()
-{
-	LLTextureCtrl* text_pic = getChild<LLTextureCtrl>(PICKER_SECOND_LIFE);	
-	LLIconCtrl* text_icon = getChild<LLIconCtrl>("2nd_life_edit_icon");
-	mTextureEditIconMap[text_pic->getName()] = text_icon;
-	text_pic->setMouseEnterCallback(boost::bind(&LLPanelMyProfileEdit::onTexturePickerMouseEnter, this, _1));
-	text_pic->setMouseLeaveCallback(boost::bind(&LLPanelMyProfileEdit::onTexturePickerMouseLeave, this, _1));
-	text_icon->setVisible(FALSE);
-
-	text_pic = getChild<LLTextureCtrl>(PICKER_FIRST_LIFE);
-	text_icon = getChild<LLIconCtrl>("real_world_edit_icon");
-	mTextureEditIconMap[text_pic->getName()] = text_icon;
-	text_pic->setMouseEnterCallback(boost::bind(&LLPanelMyProfileEdit::onTexturePickerMouseEnter, this, _1));
-	text_pic->setMouseLeaveCallback(boost::bind(&LLPanelMyProfileEdit::onTexturePickerMouseLeave, this, _1));
-	text_icon->setVisible(FALSE);
-}
-
-void LLPanelMyProfileEdit::resetData()
-{
-	LLPanelMyProfile::resetData();
-
-	//childSetTextArg("name_text", "[FIRST]", LLStringUtil::null);
-	//childSetTextArg("name_text", "[LAST]", LLStringUtil::null);
-	getChild<LLUICtrl>("user_name")->setValue( LLSD() );
-	getChild<LLUICtrl>("user_slid")->setValue( LLSD() );
-	getChild<LLUICtrl>("solo_user_name")->setValue( LLSD() );
-	getChild<LLUICtrl>("user_name_small")->setValue( LLSD() );
-}
-
-void LLPanelMyProfileEdit::onTexturePickerMouseEnter(LLUICtrl* ctrl)
-{
-	mTextureEditIconMap[ctrl->getName()]->setVisible(TRUE);
-}
-void LLPanelMyProfileEdit::onTexturePickerMouseLeave(LLUICtrl* ctrl)
-{
-	mTextureEditIconMap[ctrl->getName()]->setVisible(FALSE);
-}
-
-void LLPanelMyProfileEdit::onClickSetName()
-{	
-	LLAvatarNameCache::get(getAvatarId(), 
-			boost::bind(&LLPanelMyProfileEdit::onAvatarNameCache,
-				this, _1, _2));	
-
-	LLFirstUse::setDisplayName(false);
-}
-
-void LLPanelMyProfileEdit::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name)
-{
-	if (av_name.mDisplayName.empty())
-	{
-		// something is wrong, tell user to try again later
-		LLNotificationsUtil::add("SetDisplayNameFailedGeneric");
-		return;		
-	}
-
-	llinfos << "name-change now " << LLDate::now() << " next_update "
-		<< LLDate(av_name.mNextUpdate) << llendl;
-	F64 now_secs = LLDate::now().secondsSinceEpoch();
-
-	if (now_secs < av_name.mNextUpdate)
-	{
-		// if the update time is more than a year in the future, it means updates have been blocked
-		// show a more general message
-        const int YEAR = 60*60*24*365; 
-		if (now_secs + YEAR < av_name.mNextUpdate)
-		{
-			LLNotificationsUtil::add("SetDisplayNameBlocked");
-			return;
-		}
-	}
-	
-	LLFloaterReg::showInstance("display_name");
-}
-
-void LLPanelMyProfileEdit::enableEditing(bool enable)
-{
-	getChildView("2nd_life_pic")->setEnabled(enable);
-	getChildView("real_world_pic")->setEnabled(enable);
-	getChildView("sl_description_edit")->setEnabled(enable);
-	getChildView("fl_description_edit")->setEnabled(enable);
-	getChildView("homepage_edit")->setEnabled(enable);
-	getChildView("show_in_search_checkbox")->setEnabled(enable);
-}
diff --git a/indra/newview/llpanelme.h b/indra/newview/llpanelme.h
index b0f5d184cc8ae5fdfd19f4d82f664da303e97f52..60e9d4317d8ee741993093ab6bf436c0177d1e54 100644
--- a/indra/newview/llpanelme.h
+++ b/indra/newview/llpanelme.h
@@ -30,15 +30,9 @@
 #include "llpanel.h"
 #include "llpanelprofile.h"
 
-class LLAvatarName;
-class LLPanelMyProfileEdit;
-class LLPanelProfile;
-class LLIconCtrl;
-
 /**
-* Panel for displaying Agent's profile, it consists of two sub panels - Profile
-* and Picks. 
-* LLPanelMe allows user to edit his profile and picks.
+* Panel for displaying Agent's Picks and Classifieds panel.
+* LLPanelMe allows user to edit his picks and classifieds.
 */
 class LLPanelMe : public LLPanelProfile
 {
@@ -51,60 +45,6 @@ class LLPanelMe : public LLPanelProfile
 	/*virtual*/ void onOpen(const LLSD& key);
 
 	/*virtual*/ BOOL postBuild();
-
-private:
-
-	void buildEditPanel();
-
-	void onEditProfileClicked();
-
-	LLPanelMyProfileEdit *  mEditPanel;
-
-};
-
-class LLPanelMyProfileEdit : public LLPanelMyProfile
-{
-	LOG_CLASS(LLPanelMyProfileEdit);
-
-public:
-
-	LLPanelMyProfileEdit();
-
-	/*virtual*/void processProperties(void* data, EAvatarProcessorType type);
-	
-	/*virtual*/BOOL postBuild();
-
-	/*virtual*/ void onOpen(const LLSD& key);
-	/*virtual*/ void onClose(const LLSD& key);
-
-	void onAvatarNameChanged();
-
-protected:	
-
-	/*virtual*/void resetData();
-
-	void processProfileProperties(const LLAvatarData* avatar_data);
-	void onNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
-
-private:
-	void initTexturePickerMouseEvents();
-	void onTexturePickerMouseEnter(LLUICtrl* ctrl);
-	void onTexturePickerMouseLeave(LLUICtrl* ctrl);
-	void onClickSetName();
-	void onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name);
-
-	/**
-	 * Enabled/disables controls to prevent overwriting edited data upon receiving
-	 * current data from server.
-	 */
-	void enableEditing(bool enable);
-
-
-
-private:
-	// map TexturePicker name => Edit Icon pointer should be visible while hovering Texture Picker
-	typedef std::map<std::string, LLIconCtrl*> texture_edit_icon_map_t;
-	texture_edit_icon_map_t mTextureEditIconMap;
 };
 
 #endif // LL_LLPANELMEPROFILE_H
diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp
index 2bbd15ae1175eb31200dada6f5d3405865e33c0d..c01adc3c3562eb0c3deb2d9460c3ff51aa780ae8 100644
--- a/indra/newview/llpanelnearbymedia.cpp
+++ b/indra/newview/llpanelnearbymedia.cpp
@@ -52,6 +52,7 @@
 #include "llvovolume.h"
 #include "llstatusbar.h"
 #include "llsdutil.h"
+#include "llvieweraudio.h"
 
 #include "llfloaterreg.h"
 #include "llfloaterpreference.h" // for the gear icon
@@ -807,14 +808,26 @@ bool LLPanelNearByMedia::setDisabled(const LLUUID &row_id, bool disabled)
 {
 	if (row_id == PARCEL_AUDIO_LIST_ITEM_UUID)
 	{
-		if (disabled) onClickParcelAudioStop();
-		else onClickParcelAudioStart();
+		if (disabled)
+		{
+			onClickParcelAudioStop();
+		}
+		else
+		{
+			onClickParcelAudioPlay();
+		}
 		return true;
 	}
 	else if (row_id == PARCEL_MEDIA_LIST_ITEM_UUID)
 	{
-		if (disabled) onClickDisableParcelMedia();
-		else onClickEnableParcelMedia();
+		if (disabled)
+		{
+			onClickDisableParcelMedia();
+		}
+		else
+		{
+			onClickEnableParcelMedia();
+		}
 		return true;
 	}
 	else {
@@ -857,24 +870,11 @@ void LLPanelNearByMedia::onClickParcelMediaPause()
 	LLViewerParcelMedia::pause();
 }
 
-void LLPanelNearByMedia::onClickParcelAudioStart()
-{
-	// User *explicitly* started the internet stream, so keep the stream
-	// playing and updated as they cross to other parcels etc.
-	mParcelAudioAutoStart = true;
-		
-	if (!gAudiop)
-		return;
-	
-	gAudiop->startInternetStream(LLViewerMedia::getParcelAudioURL());
-}
-
 void LLPanelNearByMedia::onClickParcelAudioPlay()
 {
 	// User *explicitly* started the internet stream, so keep the stream
 	// playing and updated as they cross to other parcels etc.
 	mParcelAudioAutoStart = true;
-
 	if (!gAudiop)
 		return;
 
@@ -883,8 +883,9 @@ void LLPanelNearByMedia::onClickParcelAudioPlay()
 		// 'false' means unpause
 		gAudiop->pauseInternetStream(false);
 	}
-	else {
-		gAudiop->startInternetStream(LLViewerMedia::getParcelAudioURL());
+	else
+	{
+		LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLViewerMedia::getParcelAudioURL());
 	}
 }
 
@@ -894,11 +895,10 @@ void LLPanelNearByMedia::onClickParcelAudioStop()
 	// re-start audio when i.e. they move to another parcel, until
 	// they explicitly start it again.
 	mParcelAudioAutoStart = false;
-
 	if (!gAudiop)
 		return;
 
-	gAudiop->stopInternetStream();
+	LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade();
 }
 
 void LLPanelNearByMedia::onClickParcelAudioPause()
diff --git a/indra/newview/llpanelnearbymedia.h b/indra/newview/llpanelnearbymedia.h
index be4d3137435fcc39b4b632e4fe3665da0c4182e5..c3634de9b47eec37311078efdd8db35377c372b6 100644
--- a/indra/newview/llpanelnearbymedia.h
+++ b/indra/newview/llpanelnearbymedia.h
@@ -115,7 +115,6 @@ class LLPanelNearByMedia : public LLPanel
 	void onClickParcelMediaPause();
 	void onClickParcelAudioPlay();
 	void onClickParcelAudioStop();
-	void onClickParcelAudioStart();
 	void onClickParcelAudioPause();
 	void onCheckAutoPlay();
 	void onAdvancedButtonClick();	
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index 98ea6805043ea1f69fb2f251e1553f0caed4a532..1ca24f30316339da42901fe3e6e0acddb20090cc 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -124,7 +124,7 @@ class LLTaskInvFVBridge : public LLFolderViewEventListener
 	virtual void move(LLFolderViewEventListener* parent_listener);
 	virtual BOOL isItemCopyable() const;
 	virtual BOOL copyToClipboard() const;
-	virtual void cutToClipboard();
+	virtual BOOL cutToClipboard() const;
 	virtual BOOL isClipboardPasteable() const;
 	virtual void pasteFromClipboard();
 	virtual void pasteLinkFromClipboard();
@@ -524,8 +524,9 @@ BOOL LLTaskInvFVBridge::copyToClipboard() const
 	return FALSE;
 }
 
-void LLTaskInvFVBridge::cutToClipboard()
+BOOL LLTaskInvFVBridge::cutToClipboard() const
 {
+	return FALSE;
 }
 
 BOOL LLTaskInvFVBridge::isClipboardPasteable() const
@@ -1568,7 +1569,7 @@ void LLPanelObjectInventory::reset()
 	scroll_p.rect(scroller_rect);
 	scroll_p.tab_stop(true);
 	scroll_p.follows.flags(FOLLOWS_ALL);
-	mScroller = LLUICtrlFactory::create<LLScrollContainer>(scroll_p);
+	mScroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroll_p);
 	addChild(mScroller);
 	mScroller->addChild(mFolders);
 	
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index d5e289e6e6ae31490a4dd9fbceede02956b96c9a..f1380e7a3628a4bf9e2c754b29dad164fae90315 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -526,11 +526,11 @@ LLPanelPeople::~LLPanelPeople()
 		LLVoiceClient::getInstance()->removeObserver(this);
 	}
 
-	delete mGroupPlusMenuHandle.get();
-	delete mNearbyViewSortMenuHandle.get();
-	delete mFriendsViewSortMenuHandle.get();
-	delete mGroupsViewSortMenuHandle.get();
-	delete mRecentViewSortMenuHandle.get();
+	if (mGroupPlusMenuHandle.get()) mGroupPlusMenuHandle.get()->die();
+	if (mNearbyViewSortMenuHandle.get()) mNearbyViewSortMenuHandle.get()->die();
+	if (mNearbyViewSortMenuHandle.get()) mNearbyViewSortMenuHandle.get()->die();
+	if (mGroupsViewSortMenuHandle.get()) mGroupsViewSortMenuHandle.get()->die();
+	if (mRecentViewSortMenuHandle.get()) mRecentViewSortMenuHandle.get()->die();
 
 }
 
@@ -1162,8 +1162,13 @@ void LLPanelPeople::onAddFriendWizButtonClicked()
 {
 	// Show add friend wizard.
 	LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelPeople::onAvatarPicked, _1, _2), FALSE, TRUE);
+	if (!picker)
+	{
+		return;
+	}
+
 	// Need to disable 'ok' button when friend occurs in selection
-	if (picker)	picker->setOkBtnEnableCb(boost::bind(&LLPanelPeople::isItemsFreeOfFriends, this, _1));
+	picker->setOkBtnEnableCb(boost::bind(&LLPanelPeople::isItemsFreeOfFriends, this, _1));
 	LLFloater* root_floater = gFloaterView->getParentFloater(this);
 	if (root_floater)
 	{
diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp
index 50dc66ed7c3e4d94eda556b12710a2f25472a626..cfbc8f1a94de31af71f925184fb24c8ac0dd78e1 100755
--- a/indra/newview/llpanelpicks.cpp
+++ b/indra/newview/llpanelpicks.cpp
@@ -1048,13 +1048,10 @@ void LLPanelPicks::createPickInfoPanel()
 
 void LLPanelPicks::createClassifiedInfoPanel()
 {
-	if(!mPanelClassifiedInfo)
-	{
-		mPanelClassifiedInfo = LLPanelClassifiedInfo::create();
-		mPanelClassifiedInfo->setExitCallback(boost::bind(&LLPanelPicks::onPanelClassifiedClose, this, mPanelClassifiedInfo));
-		mPanelClassifiedInfo->setEditClassifiedCallback(boost::bind(&LLPanelPicks::onPanelClassifiedEdit, this));
-		mPanelClassifiedInfo->setVisible(FALSE);
-	}
+	mPanelClassifiedInfo = LLPanelClassifiedInfo::create();
+	mPanelClassifiedInfo->setExitCallback(boost::bind(&LLPanelPicks::onPanelClassifiedClose, this, mPanelClassifiedInfo));
+	mPanelClassifiedInfo->setEditClassifiedCallback(boost::bind(&LLPanelPicks::onPanelClassifiedEdit, this));
+	mPanelClassifiedInfo->setVisible(FALSE);
 }
 
 void LLPanelPicks::createClassifiedEditPanel(LLPanelClassifiedEdit** panel)
@@ -1072,14 +1069,11 @@ void LLPanelPicks::createClassifiedEditPanel(LLPanelClassifiedEdit** panel)
 
 void LLPanelPicks::createPickEditPanel()
 {
-	if(!mPanelPickEdit)
-	{
-		mPanelPickEdit = LLPanelPickEdit::create();
-		mPanelPickEdit->setExitCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelPickEdit));
-		mPanelPickEdit->setSaveCallback(boost::bind(&LLPanelPicks::onPanelPickSave, this, mPanelPickEdit));
-		mPanelPickEdit->setCancelCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelPickEdit));
-		mPanelPickEdit->setVisible(FALSE);
-	}
+	mPanelPickEdit = LLPanelPickEdit::create();
+	mPanelPickEdit->setExitCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelPickEdit));
+	mPanelPickEdit->setSaveCallback(boost::bind(&LLPanelPicks::onPanelPickSave, this, mPanelPickEdit));
+	mPanelPickEdit->setCancelCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelPickEdit));
+	mPanelPickEdit->setVisible(FALSE);
 }
 
 // void LLPanelPicks::openPickEditPanel(LLPickItem* pick)
diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp
index 933b40ec7914955cdb2a4bc42eb242ee557f338c..76d38f067d4e263bd9593a2550737420418f24db 100644
--- a/indra/newview/llpanelprimmediacontrols.cpp
+++ b/indra/newview/llpanelprimmediacontrols.cpp
@@ -818,7 +818,7 @@ bool LLPanelPrimMediaControls::isMouseOver()
 		LLCoordGL cursor_pos_gl;
 		S32 x, y;
 		getWindow()->getCursorPosition(&cursor_pos_window);
-		getWindow()->convertCoords(cursor_pos_window, &cursor_pos_gl);
+		cursor_pos_gl = cursor_pos_window.convert();
 				
 		if(mMediaControlsStack->getVisible())
 		{
@@ -1351,7 +1351,6 @@ void LLPanelPrimMediaControls::showNotification(LLNotificationPtr notify)
 	LLWindowShade::Params params;
 	params.rect = mMediaRegion->getLocalRect();
 	params.follows.flags = FOLLOWS_ALL;
-	params.notification = notify;
 
 	//HACK: don't hardcode this
 	if (notify->getIcon() == "Popup_Caution")
@@ -1369,7 +1368,7 @@ void LLPanelPrimMediaControls::showNotification(LLNotificationPtr notify)
 	mWindowShade = LLUICtrlFactory::create<LLWindowShade>(params);
 
 	mMediaRegion->addChild(mWindowShade);
-	mWindowShade->show();
+	mWindowShade->show(notify);
 }
 
 void LLPanelPrimMediaControls::hideNotification()
diff --git a/indra/newview/llpanelprimmediacontrols.h b/indra/newview/llpanelprimmediacontrols.h
index 66956181f2b9d60146d967153711e4189460464b..eeb433e3062e0616dd6e8eeb8e5fa8c4d80db5b8 100644
--- a/indra/newview/llpanelprimmediacontrols.h
+++ b/indra/newview/llpanelprimmediacontrols.h
@@ -30,9 +30,9 @@
 #include "llpanel.h"
 #include "llviewermedia.h"
 #include "llnotificationptr.h"
+#include "llcoord.h"
 
 class LLButton;
-class LLCoordWindow;
 class LLIconCtrl;
 class LLLayoutStack;
 class LLProgressBar;
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index 5ce59d89599fd14aaa877940185cc96a1931e3be..e2e70067737035f532ae343562829e84a3361e7d 100755
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -38,7 +38,6 @@
 #include "llviewernetwork.h"
 
 static const std::string PANEL_PICKS = "panel_picks";
-static const std::string PANEL_PROFILE = "panel_profile";
 
 std::string getProfileURL(const std::string& agent_name)
 {
@@ -168,6 +167,23 @@ LLPanelProfile::ChildStack::ChildStack()
 {
 }
 
+LLPanelProfile::ChildStack::~ChildStack()
+{
+	while (mStack.size() != 0)
+	{
+		view_list_t& top = mStack.back();
+		for (view_list_t::const_iterator it = top.begin(); it != top.end(); ++it)
+		{
+			LLView* viewp = *it;
+			if (viewp)
+			{
+				viewp->die();
+			}
+		}
+		mStack.pop_back();
+	}
+}
+
 void LLPanelProfile::ChildStack::setParent(LLPanel* parent)
 {
 	llassert_always(parent != NULL);
@@ -272,7 +288,6 @@ BOOL LLPanelProfile::postBuild()
 	panel_picks->setProfilePanel(this);
 
 	getTabContainer()[PANEL_PICKS] = panel_picks;
-	getTabContainer()[PANEL_PROFILE] = findChild<LLPanelAvatarProfile>(PANEL_PROFILE);
 
 	return TRUE;
 }
diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h
index bd4457c240b35594d27d4637f0cdd61c832d7b0e..d97f60ed229ab16320932951e9a13c896e9b7177 100755
--- a/indra/newview/llpanelprofile.h
+++ b/indra/newview/llpanelprofile.h
@@ -74,6 +74,7 @@ class LLPanelProfile : public LLPanel
 		LOG_CLASS(LLPanelProfile::ChildStack);
 	public:
 		ChildStack();
+		~ChildStack();
 		void setParent(LLPanel* parent);
 
 		bool push();
diff --git a/indra/newview/llpanelprofileview.cpp b/indra/newview/llpanelprofileview.cpp
deleted file mode 100644
index 7635aedf58483234a6c2baaf0a382333ceacc503..0000000000000000000000000000000000000000
--- a/indra/newview/llpanelprofileview.cpp
+++ /dev/null
@@ -1,247 +0,0 @@
-/** 
-* @file llpanelprofileview.cpp
-* @brief Side tray "Profile View" panel
-*
-* $LicenseInfo:firstyear=2009&license=viewerlgpl$
-* Second Life Viewer Source Code
-* Copyright (C) 2010, Linden Research, Inc.
-* 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation;
-* version 2.1 of the License only.
-* 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
-* 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-* 
-* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
-* $/LicenseInfo$
-*/
-
-#include "llviewerprecompiledheaders.h"
-
-#include "llpanelprofileview.h"
-
-#include "llavatarconstants.h"
-#include "llavatarnamecache.h"	// IDEVO
-#include "llclipboard.h"
-#include "lluserrelations.h"
-
-#include "llavatarpropertiesprocessor.h"
-#include "llcallingcard.h"
-#include "llpanelavatar.h"
-#include "llpanelpicks.h"
-#include "llpanelprofile.h"
-#include "llsidetraypanelcontainer.h"
-
-static LLRegisterPanelClassWrapper<LLPanelProfileView> t_panel_target_profile("panel_profile_view");
-
-static std::string PANEL_NOTES = "panel_notes";
-static const std::string PANEL_PROFILE = "panel_profile";
-static const std::string PANEL_PICKS = "panel_picks";
-
-
-class AvatarStatusObserver : public LLAvatarPropertiesObserver
-{
-public:
-	AvatarStatusObserver(LLPanelProfileView* profile_view)
-	{
-		mProfileView = profile_view;
-	}
-
-	void processProperties(void* data, EAvatarProcessorType type)
-	{
-		if(APT_PROPERTIES != type) return;
-		const LLAvatarData* avatar_data = static_cast<const LLAvatarData*>(data);
-		if(avatar_data && mProfileView->getAvatarId() == avatar_data->avatar_id)
-		{
-			mProfileView->processOnlineStatus(avatar_data->flags & AVATAR_ONLINE);
-			LLAvatarPropertiesProcessor::instance().removeObserver(mProfileView->getAvatarId(), this);
-		}
-	}
-
-	void subscribe()
-	{
-		LLAvatarPropertiesProcessor::instance().addObserver(mProfileView->getAvatarId(), this);
-	}
-
-private:
-	LLPanelProfileView* mProfileView;
-};
-
-LLPanelProfileView::LLPanelProfileView()
-:	LLPanelProfile()
-,	mStatusText(NULL)
-,	mAvatarStatusObserver(NULL)
-{
-	mAvatarStatusObserver = new AvatarStatusObserver(this);
-}
-
-LLPanelProfileView::~LLPanelProfileView(void)
-{
-	delete mAvatarStatusObserver;
-}
-
-/*virtual*/ 
-void LLPanelProfileView::onOpen(const LLSD& key)
-{
-	LLUUID id;
-	if(key.has("id"))
-	{
-		id = key["id"];
-	}
-
-	if(id.notNull() && getAvatarId() != id)
-	{
-		setAvatarId(id);
-
-		// clear name fields, which might have old data
-		getChild<LLUICtrl>("user_name")->setValue( LLSD() );
-		getChild<LLUICtrl>("user_slid")->setValue( LLSD() );
-	}
-
-	// Update the avatar name.
-	LLAvatarNameCache::get(getAvatarId(),
-		boost::bind(&LLPanelProfileView::onAvatarNameCache, this, _1, _2));
-
-	updateOnlineStatus();
-
-
-	LLPanelProfile::onOpen(key);
-}
-
-BOOL LLPanelProfileView::postBuild()
-{
-	LLPanelProfile::postBuild();
-
-	getTabContainer()[PANEL_NOTES] = findChild<LLPanelAvatarNotes>(PANEL_NOTES);
-	
-	//*TODO remove this, according to style guide we don't use status combobox
-	getTabContainer()[PANEL_PROFILE]->getChildView("online_me_status_text")->setVisible( FALSE);
-	getTabContainer()[PANEL_PROFILE]->getChildView("status_combo")->setVisible( FALSE);
-
-	mStatusText = getChild<LLTextBox>("status");
-	mStatusText->setVisible(false);
-
-	childSetCommitCallback("back",boost::bind(&LLPanelProfileView::onBackBtnClick,this),NULL);
-	childSetCommitCallback("copy_to_clipboard",boost::bind(&LLPanelProfileView::onCopyToClipboard,this),NULL);
-		
-	return TRUE;
-}
-
-
-//private
-
-void LLPanelProfileView::onBackBtnClick()
-{
-	// Set dummy value to make picks panel dirty, 
-	// This will make Picks reload on next open.
-	getTabContainer()[PANEL_PICKS]->setValue(LLSD());
-
-	LLSideTrayPanelContainer* parent = dynamic_cast<LLSideTrayPanelContainer*>(getParent());
-	if(parent)
-	{
-		parent->openPreviousPanel();
-	}
-}
-
-void LLPanelProfileView::onCopyToClipboard()
-{
-	std::string name = getChild<LLUICtrl>("user_name")->getValue().asString() + " (" + getChild<LLUICtrl>("user_slid")->getValue().asString() + ")";
-	gClipboard.copyFromString(utf8str_to_wstring(name));
-}
-
-bool LLPanelProfileView::isGrantedToSeeOnlineStatus()
-{
-	const LLRelationship* relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId());
-	if (NULL == relationship)
-		return false;
-
-	// *NOTE: GRANT_ONLINE_STATUS is always set to false while changing any other status.
-	// When avatar disallow me to see her online status processOfflineNotification Message is received by the viewer
-	// see comments for ChangeUserRights template message. EXT-453.
-	// If GRANT_ONLINE_STATUS flag is changed it will be applied when viewer restarts. EXT-3880
-	return relationship->isRightGrantedFrom(LLRelationship::GRANT_ONLINE_STATUS);
-}
-
-// method was disabled according to EXT-2022. Re-enabled & improved according to EXT-3880
-void LLPanelProfileView::updateOnlineStatus()
-{
-	// set text box visible to show online status for non-friends who has not set in Preferences
-	// "Only Friends & Groups can see when I am online"
-	mStatusText->setVisible(TRUE);
-
-	const LLRelationship* relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId());
-	if (NULL == relationship)
-	{
-		// this is non-friend avatar. Status will be updated from LLAvatarPropertiesProcessor.
-		// in LLPanelProfileView::processOnlineStatus()
-
-		// subscribe observer to get online status. Request will be sent by LLPanelAvatarProfile itself.
-		// do not subscribe for friend avatar because online status can be wrong overridden
-		// via LLAvatarData::flags if Preferences: "Only Friends & Groups can see when I am online" is set.
-		mAvatarStatusObserver->subscribe();
-		return;
-	}
-	// For friend let check if he allowed me to see his status
-
-	// status should only show if viewer has permission to view online/offline. EXT-453, EXT-3880
-	mStatusText->setVisible(isGrantedToSeeOnlineStatus());
-
-	bool online = relationship->isOnline();
-	processOnlineStatus(online);
-}
-
-void LLPanelProfileView::processOnlineStatus(bool online)
-{
-	std::string status = getString(online ? "status_online" : "status_offline");
-
-	mStatusText->setValue(status);
-}
-
-void LLPanelProfileView::onAvatarNameCache(const LLUUID& agent_id,
-										   const LLAvatarName& av_name)
-{
-	getChild<LLUICtrl>("user_name")->setValue( av_name.mDisplayName );
-	getChild<LLUICtrl>("user_name_small")->setValue( av_name.mDisplayName );
-	getChild<LLUICtrl>("user_slid")->setValue( av_name.mUsername );
-
-	// show smaller display name if too long to display in regular size
-	if (getChild<LLTextBox>("user_name")->getTextPixelWidth() > getChild<LLTextBox>("user_name")->getRect().getWidth())
-	{
-		getChild<LLUICtrl>("user_name_small")->setVisible( true );
-		getChild<LLUICtrl>("user_name")->setVisible( false );
-	}
-	else
-	{
-		getChild<LLUICtrl>("user_name_small")->setVisible( false );
-		getChild<LLUICtrl>("user_name")->setVisible( true );
-	}
-
-	if (LLAvatarNameCache::useDisplayNames())
-	{
-		getChild<LLUICtrl>("user_label")->setVisible( true );
-		getChild<LLUICtrl>("user_slid")->setVisible( true );
-		getChild<LLUICtrl>("display_name_label")->setVisible( true );
-		getChild<LLUICtrl>("copy_to_clipboard")->setVisible( true );
-		getChild<LLUICtrl>("copy_to_clipboard")->setEnabled( true );
-		getChild<LLUICtrl>("solo_username_label")->setVisible( false );
-	}
-	else
-	{
-		getChild<LLUICtrl>("user_label")->setVisible( false );
-		getChild<LLUICtrl>("user_slid")->setVisible( false );
-		getChild<LLUICtrl>("display_name_label")->setVisible( false );
-		getChild<LLUICtrl>("copy_to_clipboard")->setVisible( false );
-		getChild<LLUICtrl>("copy_to_clipboard")->setEnabled( false );
-		getChild<LLUICtrl>("solo_username_label")->setVisible( true );
-	}
-}
-
-// EOF
diff --git a/indra/newview/llpanelprofileview.h b/indra/newview/llpanelprofileview.h
deleted file mode 100644
index c6d921fdc40eeb37cc175b37148e56b56d68e78f..0000000000000000000000000000000000000000
--- a/indra/newview/llpanelprofileview.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/** 
-* @file llpanelprofileview.h
-* @brief Side tray "Profile View" panel
-*
-* $LicenseInfo:firstyear=2009&license=viewerlgpl$
-* Second Life Viewer Source Code
-* Copyright (C) 2010, Linden Research, Inc.
-* 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation;
-* version 2.1 of the License only.
-* 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
-* 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-* 
-* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
-* $/LicenseInfo$
-*/
-
-#ifndef LL_LLPANELPROFILEVIEW_H
-#define LL_LLPANELPROFILEVIEW_H
-
-#include "llpanel.h"
-#include "llpanelprofile.h"
-#include "llavatarpropertiesprocessor.h"
-#include "llagent.h"
-#include "lltooldraganddrop.h"
-
-class LLAvatarName;
-class LLPanelProfile;
-class LLPanelProfileTab;
-class LLTextBox;
-class AvatarStatusObserver;
-
-/**
-* Panel for displaying Avatar's profile. It consists of three sub panels - Profile,
-* Picks and Notes.
-*/
-class LLPanelProfileView : public LLPanelProfile
-{
-	LOG_CLASS(LLPanelProfileView);
-	friend class LLUICtrlFactory;
-	friend class AvatarStatusObserver;
-
-public:
-
-	LLPanelProfileView();
-
-	/*virtual*/ ~LLPanelProfileView();
-
-	/*virtual*/ void onOpen(const LLSD& key);
-	
-	/*virtual*/ BOOL postBuild();
-
-	BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
-						   BOOL drop, EDragAndDropType cargo_type,
-						   void *cargo_data, EAcceptance *accept,
-						   std::string& tooltip_msg)
-	{
-		LLToolDragAndDrop::handleGiveDragAndDrop(getAvatarId(), gAgent.getSessionID(), drop,
-				 cargo_type, cargo_data, accept);
-
-		return TRUE;
-	}
-
-
-protected:
-
-	void onBackBtnClick();
-	void onCopyToClipboard();
-	bool isGrantedToSeeOnlineStatus();
-
-	/**
-	 * Displays avatar's online status if possible.
-	 *
-	 * Requirements from EXT-3880:
-	 * For friends:
-	 * - Online when online and privacy settings allow to show
-	 * - Offline when offline and privacy settings allow to show
-	 * - Else: nothing
-	 * For other avatars:
-	 *  - Online when online and was not set in Preferences/"Only Friends & Groups can see when I am online"
-	 *  - Else: Offline
-	 */
-	void updateOnlineStatus();
-	void processOnlineStatus(bool online);
-
-private:
-	// LLCacheName will call this function when avatar name is loaded from server.
-	// This is required to display names that have not been cached yet.
-//	void onNameCache(
-//		const LLUUID& id, 
-//		const std::string& full_name,
-//		bool is_group);
-	void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
-
-	LLTextBox* mStatusText;
-	AvatarStatusObserver* mAvatarStatusObserver;
-};
-
-#endif //LL_LLPANELPROFILEVIEW_H
diff --git a/indra/newview/llpanelsnapshot.cpp b/indra/newview/llpanelsnapshot.cpp
index fdae521ac52bc9d3388cb646dce2be7af52f81a8..2f29e758c6bb7aa676ee882ae4ed3794a5780447 100644
--- a/indra/newview/llpanelsnapshot.cpp
+++ b/indra/newview/llpanelsnapshot.cpp
@@ -74,6 +74,16 @@ LLFloaterSnapshot::ESnapshotFormat LLPanelSnapshot::getImageFormat() const
 	return LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG;
 }
 
+void LLPanelSnapshot::enableControls(BOOL enable)
+{
+	setCtrlsEnabled(enable);
+	if (enable)
+	{
+		// Make sure only relevant controls are enabled/shown.
+		updateCustomResControls();
+	}
+}
+
 LLSpinCtrl* LLPanelSnapshot::getWidthSpinner()
 {
 	return getChild<LLSpinCtrl>(getWidthSpinnerName());
@@ -114,15 +124,11 @@ LLSideTrayPanelContainer* LLPanelSnapshot::getParentContainer()
 // virtual
 void LLPanelSnapshot::updateCustomResControls()
 {
+	// Only show width/height spinners and the aspect ratio checkbox
+	// when a custom resolution is chosen.
 	LLComboBox* combo = getChild<LLComboBox>(getImageSizeComboName());
-	S32 selected_idx = combo->getFirstSelectedIndex();
-	const bool enable = selected_idx == (combo->getItemCount() - 1); // Current Window or Custom selected
-
-	getChild<LLUICtrl>(getWidthSpinnerName())->setEnabled(enable);
-	getChild<LLSpinCtrl>(getWidthSpinnerName())->setAllowEdit(enable);
-	getChild<LLUICtrl>(getHeightSpinnerName())->setEnabled(enable);
-	getChild<LLSpinCtrl>(getHeightSpinnerName())->setAllowEdit(enable);
-	enableAspectRatioCheckbox(enable);
+	const bool show = combo->getFirstSelectedIndex() == (combo->getItemCount() - 1);
+	getChild<LLUICtrl>(getImageSizePanelName())->setVisible(show);
 }
 
 void LLPanelSnapshot::updateImageQualityLevel()
diff --git a/indra/newview/llpanelsnapshot.h b/indra/newview/llpanelsnapshot.h
index a49782a3e0404b2649ad3bc4e5107348403c4aee..f3274cf5940988672b29067d44dc58ebf5f219cc 100644
--- a/indra/newview/llpanelsnapshot.h
+++ b/indra/newview/llpanelsnapshot.h
@@ -44,6 +44,7 @@ class LLPanelSnapshot: public LLPanel
 	virtual std::string getHeightSpinnerName() const = 0;
 	virtual std::string getAspectRatioCBName() const = 0;
 	virtual std::string getImageSizeComboName() const = 0;
+	virtual std::string getImageSizePanelName() const = 0;
 
 	virtual S32 getTypedPreviewWidth() const;
 	virtual S32 getTypedPreviewHeight() const;
@@ -52,6 +53,7 @@ class LLPanelSnapshot: public LLPanel
 	virtual void enableAspectRatioCheckbox(BOOL enable);
 	virtual LLFloaterSnapshot::ESnapshotFormat getImageFormat() const;
 	virtual void updateControls(const LLSD& info) = 0; ///< Update controls from saved settings
+	void enableControls(BOOL enable);
 
 protected:
 	LLSideTrayPanelContainer* getParentContainer();
diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp
index 63ccbc1b029fe1f3196bd716d2af1c073ce93072..381c11348d58084db53d1914060313dc1b020493 100644
--- a/indra/newview/llpanelsnapshotinventory.cpp
+++ b/indra/newview/llpanelsnapshotinventory.cpp
@@ -54,6 +54,7 @@ class LLPanelSnapshotInventory
 	/*virtual*/ std::string getHeightSpinnerName() const	{ return "inventory_snapshot_height"; }
 	/*virtual*/ std::string getAspectRatioCBName() const	{ return "inventory_keep_aspect_check"; }
 	/*virtual*/ std::string getImageSizeComboName() const	{ return "texture_size_combo"; }
+	/*virtual*/ std::string getImageSizePanelName() const	{ return LLStringUtil::null; }
 	/*virtual*/ void updateControls(const LLSD& info);
 
 	void onSend();
@@ -70,6 +71,9 @@ LLPanelSnapshotInventory::LLPanelSnapshotInventory()
 // virtual
 BOOL LLPanelSnapshotInventory::postBuild()
 {
+	getChild<LLSpinCtrl>(getWidthSpinnerName())->setAllowEdit(FALSE);
+	getChild<LLSpinCtrl>(getHeightSpinnerName())->setAllowEdit(FALSE);
+	getChild<LLUICtrl>(getAspectRatioCBName())->setVisible(FALSE); // we don't keep aspect ratio for inventory textures
 	return LLPanelSnapshot::postBuild();
 }
 
@@ -89,10 +93,6 @@ void LLPanelSnapshotInventory::updateCustomResControls()
 
 	getChild<LLUICtrl>(getWidthSpinnerName())->setVisible(show);
 	getChild<LLUICtrl>(getHeightSpinnerName())->setVisible(show);
-	getChild<LLUICtrl>(getAspectRatioCBName())->setVisible(show);
-
-	// enable controls if possible
-	LLPanelSnapshot::updateCustomResControls();
 }
 
 // virtual
diff --git a/indra/newview/llpanelsnapshotlocal.cpp b/indra/newview/llpanelsnapshotlocal.cpp
index eaa27b8d41065a872001d79baa36c2ffecf9bd80..d153ff598d0f16820a94fc0a1920f16af4c0c595 100644
--- a/indra/newview/llpanelsnapshotlocal.cpp
+++ b/indra/newview/llpanelsnapshotlocal.cpp
@@ -34,6 +34,7 @@
 #include "llfloatersnapshot.h" // FIXME: replace with a snapshot storage model
 #include "llpanelsnapshot.h"
 #include "llviewercontrol.h" // gSavedSettings
+#include "llviewerwindow.h"
 
 /**
  * The panel provides UI for saving snapshot to a local folder.
@@ -53,19 +54,19 @@ class LLPanelSnapshotLocal
 	/*virtual*/ std::string getHeightSpinnerName() const	{ return "local_snapshot_height"; }
 	/*virtual*/ std::string getAspectRatioCBName() const	{ return "local_keep_aspect_check"; }
 	/*virtual*/ std::string getImageSizeComboName() const	{ return "local_size_combo"; }
+	/*virtual*/ std::string getImageSizePanelName() const	{ return "local_image_size_lp"; }
 	/*virtual*/ LLFloaterSnapshot::ESnapshotFormat getImageFormat() const;
 	/*virtual*/ void updateControls(const LLSD& info);
 
 	void onFormatComboCommit(LLUICtrl* ctrl);
 	void onQualitySliderCommit(LLUICtrl* ctrl);
-	void onSend();
+	void onSaveFlyoutCommit(LLUICtrl* ctrl);
 };
 
 static LLRegisterPanelClassWrapper<LLPanelSnapshotLocal> panel_class("llpanelsnapshotlocal");
 
 LLPanelSnapshotLocal::LLPanelSnapshotLocal()
 {
-	mCommitCallbackRegistrar.add("Local.Save",		boost::bind(&LLPanelSnapshotLocal::onSend,		this));
 	mCommitCallbackRegistrar.add("Local.Cancel",	boost::bind(&LLPanelSnapshotLocal::cancel,		this));
 }
 
@@ -74,6 +75,7 @@ BOOL LLPanelSnapshotLocal::postBuild()
 {
 	getChild<LLUICtrl>("image_quality_slider")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onQualitySliderCommit, this, _1));
 	getChild<LLUICtrl>("local_format_combo")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onFormatComboCommit, this, _1));
+	getChild<LLUICtrl>("save_btn")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onSaveFlyoutCommit, this, _1));
 
 	return LLPanelSnapshot::postBuild();
 }
@@ -142,13 +144,25 @@ void LLPanelSnapshotLocal::onQualitySliderCommit(LLUICtrl* ctrl)
 	LLFloaterSnapshot::getInstance()->notify(info);
 }
 
-void LLPanelSnapshotLocal::onSend()
+void LLPanelSnapshotLocal::onSaveFlyoutCommit(LLUICtrl* ctrl)
 {
+	if (ctrl->getValue().asString() == "save as")
+	{
+		gViewerWindow->resetSnapshotLoc();
+	}
+
 	LLFloaterSnapshot* floater = LLFloaterSnapshot::getInstance();
 
 	floater->notify(LLSD().with("set-working", true));
-	LLFloaterSnapshot::saveLocal();
-	LLFloaterSnapshot::postSave();
-	goBack();
-	floater->notify(LLSD().with("set-finished", LLSD().with("ok", true).with("msg", "local")));
+	BOOL saved = LLFloaterSnapshot::saveLocal();
+	if (saved)
+	{
+		LLFloaterSnapshot::postSave();
+		goBack();
+		floater->notify(LLSD().with("set-finished", LLSD().with("ok", true).with("msg", "local")));
+	}
+	else
+	{
+		cancel();
+	}
 }
diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp
index df904b68365ee6f959d43a2fcdbf8cb1dc6021c5..554fabe5b3d38f0cd9dded22f1b071b327c9e7cb 100644
--- a/indra/newview/llpanelsnapshotoptions.cpp
+++ b/indra/newview/llpanelsnapshotoptions.cpp
@@ -37,14 +37,18 @@
  */
 class LLPanelSnapshotOptions
 :	public LLPanel
+,	public LLEconomyObserver
 {
 	LOG_CLASS(LLPanelSnapshotOptions);
 
 public:
 	LLPanelSnapshotOptions();
+	~LLPanelSnapshotOptions();
 	/*virtual*/ void onOpen(const LLSD& key);
+	/*virtual*/ void onEconomyDataChange() { updateUploadCost(); }
 
 private:
+	void updateUploadCost();
 	void openPanel(const std::string& panel_name);
 	void onSaveToProfile();
 	void onSaveToEmail();
@@ -60,10 +64,22 @@ LLPanelSnapshotOptions::LLPanelSnapshotOptions()
 	mCommitCallbackRegistrar.add("Snapshot.SaveToEmail",		boost::bind(&LLPanelSnapshotOptions::onSaveToEmail,		this));
 	mCommitCallbackRegistrar.add("Snapshot.SaveToInventory",	boost::bind(&LLPanelSnapshotOptions::onSaveToInventory,	this));
 	mCommitCallbackRegistrar.add("Snapshot.SaveToComputer",		boost::bind(&LLPanelSnapshotOptions::onSaveToComputer,	this));
+
+	LLGlobalEconomy::Singleton::getInstance()->addObserver(this);
+}
+
+LLPanelSnapshotOptions::~LLPanelSnapshotOptions()
+{
+	LLGlobalEconomy::Singleton::getInstance()->removeObserver(this);
 }
 
 // virtual
 void LLPanelSnapshotOptions::onOpen(const LLSD& key)
+{
+	updateUploadCost();
+}
+
+void LLPanelSnapshotOptions::updateUploadCost()
 {
 	S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
 	getChild<LLUICtrl>("save_to_inventory_btn")->setLabelArg("[AMOUNT]", llformat("%d", upload_cost));
diff --git a/indra/newview/llpanelsnapshotpostcard.cpp b/indra/newview/llpanelsnapshotpostcard.cpp
index 6867c7af4ef7c6f13b9530249e3fccebbffb4106..f2bb8f530bacde41a115b58965d7b304cfb21458 100644
--- a/indra/newview/llpanelsnapshotpostcard.cpp
+++ b/indra/newview/llpanelsnapshotpostcard.cpp
@@ -62,6 +62,7 @@ class LLPanelSnapshotPostcard
 	/*virtual*/ std::string getHeightSpinnerName() const	{ return "postcard_snapshot_height"; }
 	/*virtual*/ std::string getAspectRatioCBName() const	{ return "postcard_keep_aspect_check"; }
 	/*virtual*/ std::string getImageSizeComboName() const	{ return "postcard_size_combo"; }
+	/*virtual*/ std::string getImageSizePanelName() const	{ return "postcard_image_size_lp"; }
 	/*virtual*/ LLFloaterSnapshot::ESnapshotFormat getImageFormat() const { return LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG; }
 	/*virtual*/ void updateControls(const LLSD& info);
 
diff --git a/indra/newview/llpanelsnapshotprofile.cpp b/indra/newview/llpanelsnapshotprofile.cpp
index 89245fc804e7c25b4e8737dfe56793c34f29c48c..a7063183692ba9aebe9fbebec93c6f9b92c8786e 100644
--- a/indra/newview/llpanelsnapshotprofile.cpp
+++ b/indra/newview/llpanelsnapshotprofile.cpp
@@ -57,6 +57,7 @@ class LLPanelSnapshotProfile
 	/*virtual*/ std::string getHeightSpinnerName() const	{ return "profile_snapshot_height"; }
 	/*virtual*/ std::string getAspectRatioCBName() const	{ return "profile_keep_aspect_check"; }
 	/*virtual*/ std::string getImageSizeComboName() const	{ return "profile_size_combo"; }
+	/*virtual*/ std::string getImageSizePanelName() const	{ return "profile_image_size_lp"; }
 	/*virtual*/ LLFloaterSnapshot::ESnapshotFormat getImageFormat() const { return LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG; }
 	/*virtual*/ void updateControls(const LLSD& info);
 
diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp
index d3543daff082defd48068ea6a8cc6e9c3192c920..c63d89fc9812706427b7b41282a38184ca31e8f7 100644
--- a/indra/newview/llpanelteleporthistory.cpp
+++ b/indra/newview/llpanelteleporthistory.cpp
@@ -358,7 +358,7 @@ void LLTeleportHistoryPanel::ContextMenu::onInfo()
 //static
 void LLTeleportHistoryPanel::ContextMenu::gotSLURLCallback(const std::string& slurl)
 {
-	gClipboard.copyFromString(utf8str_to_wstring(slurl));
+	LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl),0,slurl.size());
 }
 
 void LLTeleportHistoryPanel::ContextMenu::onCopyToClipboard()
@@ -388,7 +388,7 @@ LLTeleportHistoryPanel::LLTeleportHistoryPanel()
 LLTeleportHistoryPanel::~LLTeleportHistoryPanel()
 {
 	LLTeleportHistoryFlatItemStorage::instance().purge();
-	delete mGearMenuHandle.get();
+	if (mGearMenuHandle.get()) mGearMenuHandle.get()->die();
 	mTeleportHistoryChangedConnection.disconnect();
 }
 
diff --git a/indra/newview/llpaneltopinfobar.cpp b/indra/newview/llpaneltopinfobar.cpp
index 5ed23d2f4252edf4d0e8aa268c0d1f0bb9a04da9..280cc11179670ea84450245460433d7890a1cf7f 100644
--- a/indra/newview/llpaneltopinfobar.cpp
+++ b/indra/newview/llpaneltopinfobar.cpp
@@ -203,6 +203,11 @@ void LLPanelTopInfoBar::onVisibilityChange(const LLSD& show)
 	gFloaterView->setMinimizePositionVerticalOffset(minimize_pos_offset);
 }
 
+boost::signals2::connection LLPanelTopInfoBar::setResizeCallback( const resize_signal_t::slot_type& cb )
+{
+	return mResizeSignal.connect(cb);
+}
+
 void LLPanelTopInfoBar::draw()
 {
 	updateParcelInfoText();
@@ -224,6 +229,7 @@ void LLPanelTopInfoBar::buildLocationString(std::string& loc_str, bool show_coor
 
 void LLPanelTopInfoBar::setParcelInfoText(const std::string& new_text)
 {
+	LLRect old_rect = getRect();
 	const LLFontGL* font = mParcelInfoText->getDefaultFont();
 	S32 new_text_width = font->getWidth(new_text);
 
@@ -235,6 +241,11 @@ void LLPanelTopInfoBar::setParcelInfoText(const std::string& new_text)
 	mParcelInfoText->reshape(rect.getWidth(), rect.getHeight(), TRUE);
 	mParcelInfoText->setRect(rect);
 	layoutParcelIcons();
+
+	if (old_rect != getRect())
+	{
+		mResizeSignal();
+	}
 }
 
 void LLPanelTopInfoBar::update()
@@ -342,6 +353,8 @@ void LLPanelTopInfoBar::updateHealth()
 
 void LLPanelTopInfoBar::layoutParcelIcons()
 {
+	LLRect old_rect = getRect();
+
 	// TODO: remove hard-coded values and read them as xml parameters
 	static const int FIRST_ICON_HPAD = 32;
 	static const int LAST_ICON_HPAD = 11;
@@ -358,6 +371,11 @@ void LLPanelTopInfoBar::layoutParcelIcons()
 	LLRect rect = getRect();
 	rect.set(rect.mLeft, rect.mTop, left + LAST_ICON_HPAD, rect.mBottom);
 	setRect(rect);
+
+	if (old_rect != getRect())
+	{
+		mResizeSignal();
+	}
 }
 
 S32 LLPanelTopInfoBar::layoutWidget(LLUICtrl* ctrl, S32 left)
@@ -449,7 +467,7 @@ void LLPanelTopInfoBar::onContextMenuItemClicked(const LLSD::String& item)
 		LLAgentUI::buildSLURL(slurl, false);
 		LLUIString location_str(slurl.getSLURLString());
 
-		gClipboard.copyFromString(location_str);
+		LLClipboard::instance().copyToClipboard(location_str,0,location_str.length());
 	}
 }
 
diff --git a/indra/newview/llpaneltopinfobar.h b/indra/newview/llpaneltopinfobar.h
index e934b522bed04f017b08349a72855419d3103775..d58d95be900eca41553706369f8fa8de843880ab 100644
--- a/indra/newview/llpaneltopinfobar.h
+++ b/indra/newview/llpaneltopinfobar.h
@@ -41,6 +41,8 @@ class LLPanelTopInfoBar : public LLPanel, public LLSingleton<LLPanelTopInfoBar>,
 	friend class LLDestroyClass<LLPanelTopInfoBar>;
 
 public:
+	typedef boost::signals2::signal<void ()> resize_signal_t;
+
 	LLPanelTopInfoBar();
 	~LLPanelTopInfoBar();
 
@@ -57,6 +59,8 @@ class LLPanelTopInfoBar : public LLPanel, public LLSingleton<LLPanelTopInfoBar>,
 	 */
 	void onVisibilityChange(const LLSD& show);
 
+	boost::signals2::connection setResizeCallback( const resize_signal_t::slot_type& cb );
+
 private:
 	class LLParcelChangeObserver;
 
@@ -167,6 +171,8 @@ class LLPanelTopInfoBar : public LLPanel, public LLSingleton<LLPanelTopInfoBar>,
 	boost::signals2::connection	mParcelPropsCtrlConnection;
 	boost::signals2::connection	mShowCoordsCtrlConnection;
 	boost::signals2::connection	mParcelMgrConnection;
+
+	resize_signal_t mResizeSignal;
 };
 
 #endif /* LLPANELTOPINFOBAR_H_ */
diff --git a/indra/newview/llpanelvoiceeffect.cpp b/indra/newview/llpanelvoiceeffect.cpp
index 4bbfec8ab715379d57bd0086ce63f78db90fb650..5fec6d967d4d8978083b15e615d19053e43482c9 100644
--- a/indra/newview/llpanelvoiceeffect.cpp
+++ b/indra/newview/llpanelvoiceeffect.cpp
@@ -123,7 +123,6 @@ void LLPanelVoiceEffect::update(bool list_updated)
 	if (mVoiceEffectCombo)
 	{
 		LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
-		llassert(effect_interface);
 		if (!effect_interface) return;
 		if (list_updated)
 		{
diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp
index e2801c09bde095d5a28b6f26b8c1b9b87cf6518c..3b9934d4be36b08b941ac55b711a455af598fc3d 100644
--- a/indra/newview/llpanelwearing.cpp
+++ b/indra/newview/llpanelwearing.cpp
@@ -302,6 +302,6 @@ void LLPanelWearing::copyToClipboard()
 		}
 	}
 
-	gClipboard.copyFromString(utf8str_to_wstring(text));
+	LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text),0,text.size());
 }
 // EOF
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index fb1153980aa3dae6893ba454f693713832ac90bc..975a6c67d80a57390b6246e939420db6f2df8acd 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -390,7 +390,10 @@ void LLParticipantList::onAvatarListRefreshed(LLUICtrl* ctrl, const LLSD& param)
 		{
 			const LLPointer<LLSpeaker>& speakerp = *it;
 
-			update_speaker_indicator(list, speakerp->mID, speakerp->mModeratorMutedVoice);
+			if (speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY)
+			{
+				update_speaker_indicator(list, speakerp->mID, speakerp->mModeratorMutedVoice);
+			}
 		}
 	}
 }
@@ -466,17 +469,24 @@ void LLParticipantList::setValidateSpeakerCallback(validate_speaker_callback_t c
 	mValidateSpeakerCallback = cb;
 }
 
-void LLParticipantList::updateRecentSpeakersOrder()
+void LLParticipantList::update()
 {
-	if (E_SORT_BY_RECENT_SPEAKERS == getSortOrder())
+	mSpeakerMgr->update(true);
+
+	if (E_SORT_BY_RECENT_SPEAKERS == getSortOrder() && !isHovered())
 	{
-		// Need to update speakers to sort list correctly
-		mSpeakerMgr->update(true);
 		// Resort avatar list
 		sort();
 	}
 }
 
+bool LLParticipantList::isHovered()
+{
+	S32 x, y;
+	LLUI::getMousePositionScreen(&x, &y);
+	return mAvatarList->calcScreenRect().pointInRect(x, y);
+}
+
 bool LLParticipantList::onAddItemEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
 {
 	LLUUID uu_id = event->getValue().asUUID();
@@ -753,6 +763,7 @@ void LLParticipantList::LLParticipantListMenu::toggleMute(const LLSD& userdata,
 	LLPointer<LLSpeaker> speakerp = mParent.mSpeakerMgr->findSpeaker(speaker_id);
 	if (speakerp.isNull())
 	{
+		LL_WARNS("Speakers") << "Speaker " << speaker_id << " not found" << llendl;
 		return;
 	}
 	LLAvatarListItem* item = dynamic_cast<LLAvatarListItem*>(mParent.mAvatarList->getItemByValue(speaker_id));
diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h
index e0b3d42c25d9229a21f44aa5e4e22323f9a7370a..53966c15fe6297096fcbf90892a8a81b44dfe85e 100644
--- a/indra/newview/llparticipantlist.h
+++ b/indra/newview/llparticipantlist.h
@@ -72,9 +72,9 @@ class LLParticipantList
 	const EParticipantSortOrder getSortOrder() const;
 
 	/**
-	 * Refreshes the participant list if it's in sort by recent speaker order.
+	 * Refreshes the participant list.
 	 */
-	void updateRecentSpeakersOrder();
+	void update();
 
 	/**
 	 * Set a callback to be called before adding a speaker. Invalid speakers will not be added.
@@ -251,6 +251,8 @@ class LLParticipantList
 	 */
 	void adjustParticipant(const LLUUID& speaker_id);
 
+	bool isHovered();
+
 	LLSpeakerMgr*		mSpeakerMgr;
 	LLAvatarList*		mAvatarList;
 
diff --git a/indra/newview/llplacesinventorybridge.cpp b/indra/newview/llplacesinventorybridge.cpp
index 225ac6e224fb06ae6eac3438cc9d16610ca1cded..fe4cc0f55ff5f89a5f93bae0e91d894fd9f806c0 100644
--- a/indra/newview/llplacesinventorybridge.cpp
+++ b/indra/newview/llplacesinventorybridge.cpp
@@ -89,7 +89,7 @@ void LLPlacesFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 		std::vector<std::string> items;
 		std::vector<std::string> disabled_items;
 
-		LLInventoryPanel* inv_panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
+		LLInventoryPanel* inv_panel = mInventoryPanel.get();
 		bool is_open = false;
 		if (inv_panel)
 		{
@@ -137,7 +137,7 @@ void LLPlacesFolderBridge::performAction(LLInventoryModel* model, std::string ac
 LLFolderViewFolder* LLPlacesFolderBridge::getFolder()
 {
 	LLFolderViewFolder* folder = NULL;
-	LLInventoryPanel* inv_panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
+	LLInventoryPanel* inv_panel = mInventoryPanel.get();
 	if (inv_panel)
 	{
 		folder = dynamic_cast<LLFolderViewFolder*>(inv_panel->getRootFolder()->getItemByID(mUUID));
diff --git a/indra/newview/llpopupview.cpp b/indra/newview/llpopupview.cpp
index 9fbb67a63aa436447a7f0fb5e8baa6a699d61330..08829c11840d5fd5b57cdfb2efb1a78048ab90ea 100644
--- a/indra/newview/llpopupview.cpp
+++ b/indra/newview/llpopupview.cpp
@@ -83,7 +83,7 @@ void LLPopupView::draw()
 
 			LLUI::pushMatrix();
 			{
-				LLUI::translate( (F32) screen_x, (F32) screen_y, 0.f);
+				LLUI::translate( (F32) screen_x, (F32) screen_y);
 				popup->draw();
 			}
 			LLUI::popMatrix();
diff --git a/indra/newview/llpreview.h b/indra/newview/llpreview.h
index 896e17c3c31d08024b38681f9eb2374fa8b2bcae..759430c3a5ef6bc1d8a9a4f24222e76da77e0f7d 100644
--- a/indra/newview/llpreview.h
+++ b/indra/newview/llpreview.h
@@ -32,6 +32,7 @@
 #include "llpointer.h"
 #include "lluuid.h"
 #include "llinventoryobserver.h"
+#include "llextendedstatus.h"
 #include <map>
 
 class LLInventoryItem;
diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp
index 8e8b530e1352c61ec084463ba6a10f2733b87e5d..35ac0537a3d01758397f939b3d13eb509d471ad4 100644
--- a/indra/newview/llpreviewanim.cpp
+++ b/indra/newview/llpreviewanim.cpp
@@ -43,19 +43,7 @@ extern LLAgent gAgent;
 LLPreviewAnim::LLPreviewAnim(const LLSD& key)
 	: LLPreview( key )
 {
-}
-
-// static
-void LLPreviewAnim::endAnimCallback( void *userdata )
-{
-	LLHandle<LLFloater>* handlep = ((LLHandle<LLFloater>*)userdata);
-	LLFloater* self = handlep->get();
-	delete handlep; // done with the handle
-	if (self)
-	{
-		self->getChild<LLUICtrl>("Anim play btn")->setValue(FALSE);
-		self->getChild<LLUICtrl>("Anim audition btn")->setValue(FALSE);
-	}
+	mCommitCallbackRegistrar.add("PreviewAnim.Play", boost::bind(&LLPreviewAnim::play, this, _2));
 }
 
 // virtual
@@ -68,105 +56,114 @@ BOOL LLPreviewAnim::postBuild()
 		getChild<LLUICtrl>("desc")->setValue(item->getDescription());
 	}
 
-	childSetAction("Anim play btn",playAnim, this);
-	childSetAction("Anim audition btn",auditionAnim, this);
-
 	childSetCommitCallback("desc", LLPreview::onText, this);
 	getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
-	
+
 	return LLPreview::postBuild();
 }
 
-void LLPreviewAnim::activate(e_activation_type type)
+// static
+// llinventorybridge also calls into here
+void LLPreviewAnim::play(const LLSD& param)
 {
-	switch ( type ) 
+	const LLInventoryItem *item = getItem();
+
+	if(item)
 	{
-		case PLAY:
+		LLUUID itemID=item->getAssetUUID();
+
+		std::string btn_name = param.asString();
+		LLButton* btn_inuse;
+		LLButton* btn_other;
+
+		if ("Inworld" == btn_name)
 		{
-			playAnim( (void *) this );
-			break;
+			btn_inuse = getChild<LLButton>("Inworld");
+			btn_other = getChild<LLButton>("Locally");
 		}
-		case AUDITION:
+		else if ("Locally" == btn_name)
 		{
-			auditionAnim( (void *) this );
-			break;
+			btn_inuse = getChild<LLButton>("Locally");
+			btn_other = getChild<LLButton>("Inworld");
 		}
-		default:
+		else
 		{
-		//do nothing
+			return;
 		}
-	}
-}
-
-// static
-void LLPreviewAnim::playAnim( void *userdata )
-{
-	LLPreviewAnim* self = (LLPreviewAnim*) userdata;
-	const LLInventoryItem *item = self->getItem();
 
-	if(item)
-	{
-		LLUUID itemID=item->getAssetUUID();
+		if (btn_inuse)
+		{
+			btn_inuse->toggleState();
+		}
 
-		LLButton* btn = self->getChild<LLButton>("Anim play btn");
-		if (btn)
+		if (btn_other)
 		{
-			btn->toggleState();
+			btn_other->setEnabled(false);
 		}
 		
-		if (self->getChild<LLUICtrl>("Anim play btn")->getValue().asBoolean() ) 
+		if (getChild<LLUICtrl>(btn_name)->getValue().asBoolean() ) 
 		{
-			self->mPauseRequest = NULL;
-			gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_START);
+			if("Inworld" == btn_name)
+			{
+				gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_START);
+			}
+			else
+			{
+				gAgentAvatarp->startMotion(item->getAssetUUID());
+			}
+
 			LLMotion* motion = gAgentAvatarp->findMotion(itemID);
 			if (motion)
 			{
-				motion->setDeactivateCallback(&endAnimCallback, (void *)(new LLHandle<LLFloater>(self->getHandle())));
+				mItemID = itemID;
+				mDidStart = false;
 			}
 		}
 		else
 		{
 			gAgentAvatarp->stopMotion(itemID);
 			gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_STOP);
+
+			if (btn_other)
+			{
+				btn_other->setEnabled(true);
+			}
 		}
 	}
 }
 
-// static
-void LLPreviewAnim::auditionAnim( void *userdata )
+// virtual
+void LLPreviewAnim::draw()
 {
-	LLPreviewAnim* self = (LLPreviewAnim*) userdata;
-	const LLInventoryItem *item = self->getItem();
-
-	if(item)
+	LLPreview::draw();
+	if (!this->mItemID.isNull())
 	{
-		LLUUID itemID=item->getAssetUUID();
-
-		LLButton* btn = self->getChild<LLButton>("Anim audition btn");
-		if (btn)
-		{
-			btn->toggleState();
-		}
-		
-		if (self->getChild<LLUICtrl>("Anim audition btn")->getValue().asBoolean() ) 
+		LLMotion* motion = gAgentAvatarp->findMotion(this->mItemID);
+		if (motion)
 		{
-			self->mPauseRequest = NULL;
-			gAgentAvatarp->startMotion(item->getAssetUUID());
-			LLMotion* motion = gAgentAvatarp->findMotion(itemID);
-			
-			if (motion)
+			if (motion->isStopped() && this->mDidStart)
 			{
-				motion->setDeactivateCallback(&endAnimCallback, (void *)(new LLHandle<LLFloater>(self->getHandle())));
+				cleanup();
+			}
+			if(gAgentAvatarp->isMotionActive(this->mItemID) && !this->mDidStart)
+			{
+				this->mDidStart = true;
 			}
-		}
-		else
-		{
-			gAgentAvatarp->stopMotion(itemID);
-			gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_STOP);
 		}
 	}
 }
 
+// virtual
+void LLPreviewAnim::cleanup()
+{
+	this->mItemID = LLUUID::null;
+	this->mDidStart = false;
+	getChild<LLUICtrl>("Inworld")->setValue(FALSE);
+	getChild<LLUICtrl>("Locally")->setValue(FALSE);
+	getChild<LLUICtrl>("Inworld")->setEnabled(true);
+	getChild<LLUICtrl>("Locally")->setEnabled(true);
+}
+
 // virtual
 void LLPreviewAnim::onClose(bool app_quitting)
 {
@@ -176,12 +173,5 @@ void LLPreviewAnim::onClose(bool app_quitting)
 	{
 		gAgentAvatarp->stopMotion(item->getAssetUUID());
 		gAgent.sendAnimationRequest(item->getAssetUUID(), ANIM_REQUEST_STOP);
-		LLMotion* motion = gAgentAvatarp->findMotion(item->getAssetUUID());
-		
-		if (motion)
-		{
-			// *TODO: minor memory leak here, user data is never deleted (Use real callbacks)
-			motion->setDeactivateCallback(NULL, (void *)NULL);
-		}
 	}
 }
diff --git a/indra/newview/llpreviewanim.h b/indra/newview/llpreviewanim.h
index 32e07ee33a0700953f435292d42e9d16d03723b4..8eaed6ca1f9ce1bcb29847a082f20034aa365aad 100644
--- a/indra/newview/llpreviewanim.h
+++ b/indra/newview/llpreviewanim.h
@@ -33,24 +33,18 @@
 class LLPreviewAnim : public LLPreview
 {
 public:
-	enum e_activation_type { NONE = 0, PLAY = 1, AUDITION = 2 };
-	LLPreviewAnim(const LLSD& key);
 
-	static void playAnim( void* userdata );
-	static void auditionAnim( void* userdata );
-	static void endAnimCallback( void *userdata );
+	LLPreviewAnim(const LLSD& key);
 	/*virtual*/	BOOL postBuild();
 	/*virtual*/ void onClose(bool app_quitting);
-	void activate(e_activation_type type);
+	void draw();
+	void cleanup();
+	void play(const LLSD& param);
 	
 protected:
 	
-	LLAnimPauseRequest	mPauseRequest;
-	LLUUID		mItemID;
-	std::string	mTitle;
-	LLUUID		mObjectID;
-	LLButton*	mPlayBtn;
-	LLButton*	mAuditionBtn;
+	LLUUID	mItemID;
+	bool	mDidStart;
 };
 
-#endif  // LL_LLPREVIEWSOUND_H
+#endif  // LL_LLPREVIEWANIM_H
diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp
index 4974dde282c24044446503e184dbe3fc36ccd76b..3a9360fd23dbab67252ce95890ef83fb87fe83da 100644
--- a/indra/newview/llpreviewnotecard.cpp
+++ b/indra/newview/llpreviewnotecard.cpp
@@ -29,7 +29,6 @@
 #include "llpreviewnotecard.h"
 
 #include "llinventory.h"
-#include "llinventoryfunctions.h" // for change_item_parent()
 
 #include "llagent.h"
 #include "llassetuploadresponders.h"
@@ -494,7 +493,7 @@ void LLPreviewNotecard::deleteNotecard()
 	if (item != NULL)
 	{
 		const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
-		change_item_parent(&gInventory, item, trash_id, FALSE);
+		gInventory.changeItemParent(item, trash_id, FALSE);
 	}
 
 	closeFloater();
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index b19bf5d234c36544e12aee92ac14709ccc038add..88727bf59b4fa58b46150072a5df4e4beb6188bf 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -35,6 +35,7 @@
 #include "llcombobox.h"
 #include "lldir.h"
 #include "llexternaleditor.h"
+#include "llfilepicker.h"
 #include "llfloaterreg.h"
 #include "llinventorydefines.h"
 #include "llinventorymodel.h"
@@ -503,6 +504,14 @@ void LLScriptEdCore::initMenu()
 
 	menuItem = getChild<LLMenuItemCallGL>("Keyword Help...");
 	menuItem->setClickCallback(boost::bind(&LLScriptEdCore::onBtnDynamicHelp, this));
+
+	menuItem = getChild<LLMenuItemCallGL>("LoadFromFile");
+	menuItem->setClickCallback(boost::bind(&LLScriptEdCore::onBtnLoadFromFile, this));
+	menuItem->setEnableCallback(boost::bind(&LLScriptEdCore::enableLoadFromFileMenu, this));
+
+	menuItem = getChild<LLMenuItemCallGL>("SaveToFile");
+	menuItem->setClickCallback(boost::bind(&LLScriptEdCore::onBtnSaveToFile, this));
+	menuItem->setEnableCallback(boost::bind(&LLScriptEdCore::enableSaveToFileMenu, this));
 }
 
 void LLScriptEdCore::setScriptText(const std::string& text, BOOL is_valid)
@@ -1096,6 +1105,88 @@ BOOL LLScriptEdCore::handleKeyHere(KEY key, MASK mask)
 	return FALSE;
 }
 
+void LLScriptEdCore::onBtnLoadFromFile( void* data )
+{
+	LLScriptEdCore* self = (LLScriptEdCore*) data;
+
+	// TODO Maybe add a dialogue warning here if the current file has unsaved changes.
+	LLFilePicker& file_picker = LLFilePicker::instance();
+	if( !file_picker.getOpenFile( LLFilePicker::FFLOAD_SCRIPT ) )
+	{
+		//File picking cancelled by user, so nothing to do.
+		return;
+	}
+
+	std::string filename = file_picker.getFirstFile();
+
+	std::ifstream fin(filename.c_str());
+
+	std::string line;
+	std::string text;
+	std::string linetotal;
+	while (!fin.eof())
+	{ 
+		getline(fin,line);
+		text += line;
+		if (!fin.eof())
+		{
+			text += "\n";
+		}
+	}
+	fin.close();
+
+	// Only replace the script if there is something to replace with.
+	if (text.length() > 0)
+	{
+		self->mEditor->selectAll();
+		LLWString script(utf8str_to_wstring(text));
+		self->mEditor->insertText(script);
+	}
+}
+
+void LLScriptEdCore::onBtnSaveToFile( void* userdata )
+{
+
+	LLViewerStats::getInstance()->incStat( LLViewerStats::ST_LSL_SAVE_COUNT );
+
+	LLScriptEdCore* self = (LLScriptEdCore*) userdata;
+
+	if( self->mSaveCallback )
+	{
+		LLFilePicker& file_picker = LLFilePicker::instance();
+		if( file_picker.getSaveFile( LLFilePicker::FFSAVE_SCRIPT ) )
+		{
+			std::string filename = file_picker.getFirstFile();
+			std::string scriptText=self->mEditor->getText();
+			std::ofstream fout(filename.c_str());
+			fout<<(scriptText);
+			fout.close();
+			self->mSaveCallback( self->mUserdata, FALSE );
+		}
+	}
+}
+
+bool LLScriptEdCore::canLoadOrSaveToFile( void* userdata )
+{
+	LLScriptEdCore* self = (LLScriptEdCore*) userdata;
+	return self->mEditor->canLoadOrSaveToFile();
+}
+
+// static
+bool LLScriptEdCore::enableSaveToFileMenu(void* userdata)
+{
+	LLScriptEdCore* self = (LLScriptEdCore*)userdata;
+	if (!self || !self->mEditor) return FALSE;
+	return self->mEditor->canLoadOrSaveToFile();
+}
+
+// static 
+bool LLScriptEdCore::enableLoadFromFileMenu(void* userdata)
+{
+	LLScriptEdCore* self = (LLScriptEdCore*)userdata;
+	return (self && self->mEditor) ? self->mEditor->canLoadOrSaveToFile() : FALSE;
+}
+
 /// ---------------------------------------------------------------------------
 /// LLScriptEdContainer
 /// ---------------------------------------------------------------------------
diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h
index f86be615c44ce396f69d295b7480ae545aeadf13..7563cecd9dba8b979f34e405d660d0a1e5500c95 100644
--- a/indra/newview/llpreviewscript.h
+++ b/indra/newview/llpreviewscript.h
@@ -79,6 +79,7 @@ class LLScriptEdCore : public LLPanel
 	/*virtual*/	BOOL	postBuild();
 	BOOL			canClose();
 	void			setEnableEditing(bool enable);
+	bool			canLoadOrSaveToFile( void* userdata );
 
 	void            setScriptText(const std::string& text, BOOL is_valid);
 	bool			loadScriptText(const std::string& filename);
@@ -98,6 +99,11 @@ class LLScriptEdCore : public LLPanel
 	static void		onClickForward(void* userdata);
 	static void		onBtnInsertSample(void*);
 	static void		onBtnInsertFunction(LLUICtrl*, void*);
+	static void		onBtnLoadFromFile(void*);
+	static void		onBtnSaveToFile(void*);
+
+	static bool		enableSaveToFileMenu(void* userdata);
+	static bool		enableLoadFromFileMenu(void* userdata);
 
 	virtual bool	hasAccelerators() const { return true; }
 
diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp
index 18d6731fcb2c997b21773a04b32c371beb080c53..3ff5a05d81e7b7a3a12246b19d879a56307af28b 100644
--- a/indra/newview/llpreviewtexture.cpp
+++ b/indra/newview/llpreviewtexture.cpp
@@ -169,7 +169,7 @@ void LLPreviewTexture::draw()
 				saveAs();
 			}
 			// Draw the texture
-			glColor3f( 1.f, 1.f, 1.f );
+			gGL.diffuseColor3f( 1.f, 1.f, 1.f );
 			gl_draw_scaled_image(interior.mLeft,
 								interior.mBottom,
 								interior.getWidth(),
diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp
index a1f38f185479e1e50f3242186786df891efe0d39..5d7a5b1c59b94e7e9462d20e9a84a9b9f9d19c12 100644
--- a/indra/newview/llprogressview.cpp
+++ b/indra/newview/llprogressview.cpp
@@ -187,7 +187,7 @@ void LLProgressView::setVisible(BOOL visible)
 
 void LLProgressView::drawStartTexture(F32 alpha)
 {
-	glPushMatrix();	
+	gGL.pushMatrix();	
 	if (gStartTexture)
 	{
 		LLGLSUIDefault gls_ui;
@@ -200,13 +200,13 @@ void LLProgressView::drawStartTexture(F32 alpha)
 		// stretch image to maintain aspect ratio
 		if (image_aspect > view_aspect)
 		{
-			glTranslatef(-0.5f * (image_aspect / view_aspect - 1.f) * width, 0.f, 0.f);
-			glScalef(image_aspect / view_aspect, 1.f, 1.f);
+			gGL.translatef(-0.5f * (image_aspect / view_aspect - 1.f) * width, 0.f, 0.f);
+			gGL.scalef(image_aspect / view_aspect, 1.f, 1.f);
 		}
 		else
 		{
-			glTranslatef(0.f, -0.5f * (view_aspect / image_aspect - 1.f) * height, 0.f);
-			glScalef(1.f, view_aspect / image_aspect, 1.f);
+			gGL.translatef(0.f, -0.5f * (view_aspect / image_aspect - 1.f) * height, 0.f);
+			gGL.scalef(1.f, view_aspect / image_aspect, 1.f);
 		}
 		gl_rect_2d_simple_tex( getRect().getWidth(), getRect().getHeight() );
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -217,7 +217,7 @@ void LLProgressView::drawStartTexture(F32 alpha)
 		gGL.color4f(0.f, 0.f, 0.f, 1.f);
 		gl_rect_2d(getRect());
 	}
-	glPopMatrix();
+	gGL.popMatrix();
 }
 
 
diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp
index 15ba5195d961a03bd3b9d7443d04915111fb10a6..d340b304ca802bfdabc61484f19023436c7fe8cb 100644
--- a/indra/newview/llscreenchannel.cpp
+++ b/indra/newview/llscreenchannel.cpp
@@ -53,13 +53,22 @@ LLFastTimer::DeclareTimer FTM_GET_CHANNEL_RECT("Calculate Notification Channel R
 LLRect LLScreenChannelBase::getChannelRect()
 {
 	LLFastTimer _(FTM_GET_CHANNEL_RECT);
+
+	if (mFloaterSnapRegion == NULL)
+	{
+		mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region");
+	}
+	
+	if (mChicletRegion == NULL)
+	{
+		mChicletRegion = gViewerWindow->getRootView()->getChildView("chiclet_container");
+	}
+	
 	LLRect channel_rect;
 	LLRect chiclet_rect;
-	LLView* floater_snap_region = gViewerWindow->getRootView()->getChildView("floater_snap_region");
-	floater_snap_region->localRectToScreen(floater_snap_region->getLocalRect(), &channel_rect);
 
-	LLView* chiclet_region = gViewerWindow->getRootView()->getChildView("chiclet_container");
-	chiclet_region->localRectToScreen(chiclet_region->getLocalRect(), &chiclet_rect);
+	mFloaterSnapRegion->localRectToScreen(mFloaterSnapRegion->getLocalRect(), &channel_rect);
+	mChicletRegion->localRectToScreen(mChicletRegion->getLocalRect(), &chiclet_rect);
 
 	channel_rect.mTop = chiclet_rect.mBottom;
 	return channel_rect;
@@ -81,14 +90,31 @@ LLScreenChannelBase::LLScreenChannelBase(const Params& p)
 	mShowToasts(true),
 	mID(p.id),
 	mDisplayToastsAlways(p.display_toasts_always),
-	mChannelAlignment(p.channel_align)
-{	
+	mChannelAlignment(p.channel_align),
+	mFloaterSnapRegion(NULL),
+	mChicletRegion(NULL)
+{
 	mID = p.id;
 
 	setMouseOpaque( false );
 	setVisible(FALSE);
 }
 
+BOOL LLScreenChannelBase::postBuild()
+{
+	if (mFloaterSnapRegion == NULL)
+	{
+		mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region");
+	}
+	
+	if (mChicletRegion == NULL)
+	{
+		mChicletRegion = gViewerWindow->getRootView()->getChildView("chiclet_container");
+	}
+	
+	return TRUE;
+}
+
 void LLScreenChannelBase::reshape(S32 width, S32 height, BOOL called_from_parent)
 {
 	redrawToasts();
@@ -169,17 +195,18 @@ LLScreenChannel::~LLScreenChannel()
 	
 }
 
-std::list<LLToast*> LLScreenChannel::findToasts(const Matcher& matcher)
+std::list<const LLToast*> LLScreenChannel::findToasts(const Matcher& matcher)
 {
-	std::list<LLToast*> res;
+	std::list<const LLToast*> res;
 
 	// collect stored toasts
 	for (std::vector<ToastElem>::iterator it = mStoredToastList.begin(); it
 			!= mStoredToastList.end(); it++)
 	{
-		if (matcher.matches(it->toast->getNotification()))
+		const LLToast* toast = it->getToast();
+		if (toast && matcher.matches(toast->getNotification()))
 		{
-			res.push_back(it->toast);
+			res.push_back(toast);
 		}
 	}
 
@@ -187,9 +214,10 @@ std::list<LLToast*> LLScreenChannel::findToasts(const Matcher& matcher)
 	for (std::vector<ToastElem>::iterator it = mToastList.begin(); it
 			!= mToastList.end(); it++)
 	{
-		if (matcher.matches(it->toast->getNotification()))
+		const LLToast* toast = it->getToast();
+		if (toast && matcher.matches(toast->getNotification()))
 		{
-			res.push_back(it->toast);
+			res.push_back(toast);
 		}
 	}
 
@@ -234,15 +262,16 @@ void LLScreenChannel::addToast(const LLToast::Params& p)
 		return;
 	}
 
-	ToastElem new_toast_elem(p);
+	LLToast* toast = new LLToast(p);
+	ToastElem new_toast_elem(toast->getHandle());
 
-	new_toast_elem.toast->setOnFadeCallback(boost::bind(&LLScreenChannel::onToastFade, this, _1));
-	new_toast_elem.toast->setOnToastDestroyedCallback(boost::bind(&LLScreenChannel::onToastDestroyed, this, _1));
+	toast->setOnFadeCallback(boost::bind(&LLScreenChannel::onToastFade, this, _1));
+	toast->setOnToastDestroyedCallback(boost::bind(&LLScreenChannel::onToastDestroyed, this, _1));
 	if(mControlHovering)
 	{
-		new_toast_elem.toast->setOnToastHoverCallback(boost::bind(&LLScreenChannel::onToastHover, this, _1, _2));
-		new_toast_elem.toast->setMouseEnterCallback(boost::bind(&LLScreenChannel::stopToastTimer, this, new_toast_elem.toast));
-		new_toast_elem.toast->setMouseLeaveCallback(boost::bind(&LLScreenChannel::startToastTimer, this, new_toast_elem.toast));
+		toast->setOnToastHoverCallback(boost::bind(&LLScreenChannel::onToastHover, this, _1, _2));
+		toast->setMouseEnterCallback(boost::bind(&LLScreenChannel::stopToastTimer, this, toast));
+		toast->setMouseLeaveCallback(boost::bind(&LLScreenChannel::startToastTimer, this, toast));
 	}
 	
 	if(show_toast)
@@ -314,13 +343,13 @@ void LLScreenChannel::onToastFade(LLToast* toast)
 //--------------------------------------------------------------------------
 void LLScreenChannel::deleteToast(LLToast* toast)
 {
-	if (toast->isDead())
+	if (!toast || toast->isDead())
 	{
 		return;
 	}
 
 	// send signal to observers about destroying of a toast
-	toast->mOnDeleteToastSignal(toast);
+	toast->closeToast();
 	
 	// update channel's Hovering state
 	// turning hovering off manually because onMouseLeave won't happen if a toast was closed using a keyboard
@@ -328,9 +357,6 @@ void LLScreenChannel::deleteToast(LLToast* toast)
 	{
 		mHoveredToast  = NULL;
 	}
-
-	// close the toast
-	toast->closeFloater();
 }
 
 //--------------------------------------------------------------------------
@@ -338,12 +364,16 @@ void LLScreenChannel::deleteToast(LLToast* toast)
 void LLScreenChannel::storeToast(ToastElem& toast_elem)
 {
 	// do not store clones
-	std::vector<ToastElem>::iterator it = find(mStoredToastList.begin(), mStoredToastList.end(), toast_elem.id);
+	std::vector<ToastElem>::iterator it = find(mStoredToastList.begin(), mStoredToastList.end(), toast_elem.getID());
 	if( it != mStoredToastList.end() )
 		return;
 
-	mStoredToastList.push_back(toast_elem);
-	mOnStoreToast(toast_elem.toast->getPanel(), toast_elem.id);
+	const LLToast* toast = toast_elem.getToast();
+	if (toast)
+	{
+		mStoredToastList.push_back(toast_elem);
+		mOnStoreToast(toast->getPanel(), toast->getNotificationID());
+	}
 }
 
 //--------------------------------------------------------------------------
@@ -356,9 +386,13 @@ void LLScreenChannel::loadStoredToastsToChannel()
 
 	for(it = mStoredToastList.begin(); it != mStoredToastList.end(); ++it)
 	{
-		(*it).toast->setIsHidden(false);
-		(*it).toast->startTimer();
-		mToastList.push_back((*it));
+		LLToast* toast = it->getToast();
+		if (toast)
+		{
+			toast->setIsHidden(false);
+			toast->startTimer();
+			mToastList.push_back(*it);
+		}
 	}
 
 	mStoredToastList.clear();
@@ -373,17 +407,19 @@ void LLScreenChannel::loadStoredToastByNotificationIDToChannel(LLUUID id)
 	if( it == mStoredToastList.end() )
 		return;
 
-	LLToast* toast = (*it).toast;
-
-	if(toast->getVisible())
+	LLToast* toast = it->getToast();
+	if (toast)
 	{
-		// toast is already in channel
-		return;
-	}
+		if(toast->getVisible())
+		{
+			// toast is already in channel
+			return;
+		}
 
-	toast->setIsHidden(false);
-	toast->startTimer();
-	mToastList.push_back((*it));
+		toast->setIsHidden(false);
+		toast->startTimer();
+		mToastList.push_back(*it);
+	}
 
 	redrawToasts();
 }
@@ -397,9 +433,19 @@ void LLScreenChannel::removeStoredToastByNotificationID(LLUUID id)
 	if( it == mStoredToastList.end() )
 		return;
 
-	LLToast* toast = (*it).toast;
-	mStoredToastList.erase(it);
-	mRejectToastSignal(toast->getNotificationID());
+	const LLToast* toast = it->getToast();
+	if (toast)
+	{
+		mRejectToastSignal(toast->getNotificationID());
+	}
+
+	// Call find() once more, because the mStoredToastList could have been changed
+	// in mRejectToastSignal callback and the iterator could have become invalid.
+	it = find(mStoredToastList.begin(), mStoredToastList.end(), id);
+	if (it != mStoredToastList.end())
+	{
+		mStoredToastList.erase(it);
+	}
 }
 
 //--------------------------------------------------------------------------
@@ -410,21 +456,22 @@ void LLScreenChannel::killToastByNotificationID(LLUUID id)
 	
 	if( it != mToastList.end())
 	{
-		LLToast* toast = (*it).toast;
+		LLToast* toast = it->getToast();
 		// if it is a notification toast and notification is UnResponded - then respond on it
 		// else - simply destroy a toast
 		//
 		// NOTE:	if a notification is unresponded this function will be called twice for the same toast.
 		//			At first, the notification will be discarded, at second (it will be caused by discarding),
 		//			the toast will be destroyed.
-		if(toast->isNotificationValid())
+		if(toast && toast->isNotificationValid())
 		{
 			mRejectToastSignal(toast->getNotificationID());
 		}
 		else
 		{
-			mToastList.erase(it);
+
 			deleteToast(toast);
+			mToastList.erase(it);
 			redrawToasts();
 		}
 		return;
@@ -433,20 +480,31 @@ void LLScreenChannel::killToastByNotificationID(LLUUID id)
 	// searching among stored toasts
 	it = find(mStoredToastList.begin(), mStoredToastList.end(), id);
 
-	if( it != mStoredToastList.end() )
+	if (it != mStoredToastList.end())
+	{
+		LLToast* toast = it->getToast();
+		if (toast)
+		{
+			// send signal to a listener to let him perform some action on toast rejecting
+			mRejectToastSignal(toast->getNotificationID());
+			deleteToast(toast);
+		}
+	}
+
+	// Call find() once more, because the mStoredToastList could have been changed
+	// in mRejectToastSignal callback and the iterator could have become invalid.
+	it = find(mStoredToastList.begin(), mStoredToastList.end(), id);
+	if (it != mStoredToastList.end())
 	{
-		LLToast* toast = (*it).toast;
 		mStoredToastList.erase(it);
-		// send signal to a listener to let him perform some action on toast rejecting
-		mRejectToastSignal(toast->getNotificationID());
-		deleteToast(toast);
 	}
+
 }
 
 void LLScreenChannel::killMatchedToasts(const Matcher& matcher)
 {
-	std::list<LLToast*> to_delete = findToasts(matcher);
-	for (std::list<LLToast*>::iterator it = to_delete.begin(); it
+	std::list<const LLToast*> to_delete = findToasts(matcher);
+	for (std::list<const LLToast*>::iterator it = to_delete.begin(); it
 			!= to_delete.end(); it++)
 	{
 		killToastByNotificationID((*it)-> getNotificationID());
@@ -460,12 +518,15 @@ void LLScreenChannel::modifyToastByNotificationID(LLUUID id, LLPanel* panel)
 	
 	if( it != mToastList.end() && panel)
 	{
-		LLToast* toast = (*it).toast;
-		LLPanel* old_panel = toast->getPanel();
-		toast->removeChild(old_panel);
-		delete old_panel;
-		toast->insertPanel(panel);
-		toast->startTimer();
+		LLToast* toast = it->getToast();
+		if (toast)
+		{
+			LLPanel* old_panel = toast->getPanel();
+			toast->removeChild(old_panel);
+			delete old_panel;
+			toast->insertPanel(panel);
+			toast->startTimer();
+		}
 		redrawToasts();
 	}
 }
@@ -473,12 +534,10 @@ void LLScreenChannel::modifyToastByNotificationID(LLUUID id, LLPanel* panel)
 //--------------------------------------------------------------------------
 void LLScreenChannel::redrawToasts()
 {
-	LLView* floater_snap_region = gViewerWindow->getRootView()->getChildView("floater_snap_region");
-
 	if (!getParent())
 	{
 		// connect to floater snap region just to get resize events, we don't care about being a proper widget 
-		floater_snap_region->addChild(this);
+		mFloaterSnapRegion->addChild(this);
 		setFollows(FOLLOWS_ALL);
 	}
 
@@ -516,16 +575,29 @@ void LLScreenChannel::showToastsBottom()
 	{
 		if(it != mToastList.rbegin())
 		{
-			LLToast* toast = (*(it-1)).toast;
+			LLToast* toast = (it-1)->getToast();
+			if (!toast)
+			{
+				llwarns << "Attempt to display a deleted toast." << llendl;
+				return;
+			}
+
 			bottom = toast->getRect().mTop - toast->getTopPad();
 			toast_margin = gSavedSettings.getS32("ToastGap");
 		}
 
-		toast_rect = (*it).toast->getRect();
+		LLToast* toast = it->getToast();
+		if(!toast)
+		{
+			llwarns << "Attempt to display a deleted toast." << llendl;
+			return;
+		}
+
+		toast_rect = toast->getRect();
 		toast_rect.setOriginAndSize(getRect().mRight - toast_rect.getWidth(),
 				bottom + toast_margin, toast_rect.getWidth(),
 				toast_rect.getHeight());
-		(*it).toast->setRect(toast_rect);
+		toast->setRect(toast_rect);
 
 		if(floater && floater->overlapsScreenChannel())
 		{
@@ -537,7 +609,7 @@ void LLScreenChannel::showToastsBottom()
 				{
 					shift += floater->getDockControl()->getTongueHeight();
 				}
-				(*it).toast->translate(0, shift);
+				toast->translate(0, shift);
 			}
 
 			LLRect channel_rect = getChannelRect();
@@ -548,13 +620,13 @@ void LLScreenChannel::showToastsBottom()
 			}
 		}
 
-		bool stop_showing_toasts = (*it).toast->getRect().mTop > getRect().mTop;
+		bool stop_showing_toasts = toast->getRect().mTop > getRect().mTop;
 
 		if(!stop_showing_toasts)
 		{
 			if( it != mToastList.rend()-1)
 			{
-				S32 toast_top = (*it).toast->getRect().mTop + gSavedSettings.getS32("ToastGap");
+				S32 toast_top = toast->getRect().mTop + gSavedSettings.getS32("ToastGap");
 				stop_showing_toasts = toast_top > getRect().mTop;
 			}
 		} 
@@ -568,17 +640,17 @@ void LLScreenChannel::showToastsBottom()
 		if(stop_showing_toasts)
 			break;
 
-		if( !(*it).toast->getVisible() )
+		if( !toast->getVisible() )
 		{
 			// HACK
 			// EXT-2653: it is necessary to prevent overlapping for secondary showed toasts
-			(*it).toast->setVisible(TRUE);
+			toast->setVisible(TRUE);
 		}		
-		if(!(*it).toast->hasFocus())
+		if(!toast->hasFocus())
 		{
 			// Fixing Z-order of toasts (EXT-4862)
 			// Next toast will be positioned under this one.
-			gFloaterView->sendChildToBack((*it).toast);
+			gFloaterView->sendChildToBack(toast);
 		}
 	}
 
@@ -588,7 +660,11 @@ void LLScreenChannel::showToastsBottom()
 		mHiddenToastsNum = 0;
 		for(; it != mToastList.rend(); it++)
 		{
-			(*it).toast->hide();
+			LLToast* toast = it->getToast();
+			if (toast)
+			{
+				toast->hide();
+			}
 		}
 	}
 }
@@ -596,17 +672,31 @@ void LLScreenChannel::showToastsBottom()
 //--------------------------------------------------------------------------
 void LLScreenChannel::showToastsCentre()
 {
-	LLRect	toast_rect;	
-	S32		bottom = (getRect().mTop - getRect().mBottom)/2 + mToastList[0].toast->getRect().getHeight()/2;
+	LLToast* toast = mToastList[0].getToast();
+	if (!toast)
+	{
+		llwarns << "Attempt to display a deleted toast." << llendl;
+		return;
+	}
+
+	LLRect	toast_rect;
+	S32		bottom = (getRect().mTop - getRect().mBottom)/2 + toast->getRect().getHeight()/2;
 	std::vector<ToastElem>::reverse_iterator it;
 
 	for(it = mToastList.rbegin(); it != mToastList.rend(); ++it)
 	{
-		toast_rect = (*it).toast->getRect();
+		LLToast* toast = it->getToast();
+		if (!toast)
+		{
+			llwarns << "Attempt to display a deleted toast." << llendl;
+			return;
+		}
+
+		toast_rect = toast->getRect();
 		toast_rect.setLeftTopAndSize(getRect().mLeft - toast_rect.getWidth() / 2, bottom + toast_rect.getHeight() / 2 + gSavedSettings.getS32("ToastGap"), toast_rect.getWidth() ,toast_rect.getHeight());
-		(*it).toast->setRect(toast_rect);
+		toast->setRect(toast_rect);
 
-		(*it).toast->setVisible(TRUE);	
+		toast->setVisible(TRUE);
 	}
 }
 
@@ -628,16 +718,29 @@ void LLScreenChannel::showToastsTop()
 	{
 		if(it != mToastList.rbegin())
 		{
-			LLToast* toast = (*(it-1)).toast;
+			LLToast* toast = (it-1)->getToast();
+			if (!toast)
+			{
+				llwarns << "Attempt to display a deleted toast." << llendl;
+				return;
+			}
+
 			top = toast->getRect().mBottom - toast->getTopPad();
 			toast_margin = gSavedSettings.getS32("ToastGap");
 		}
 
-		toast_rect = (*it).toast->getRect();
+		LLToast* toast = it->getToast();
+		if (!toast)
+		{
+			llwarns << "Attempt to display a deleted toast." << llendl;
+			return;
+		}
+
+		toast_rect = toast->getRect();
 		toast_rect.setLeftTopAndSize(channel_rect.mRight - toast_rect.getWidth(),
 			top, toast_rect.getWidth(),
 			toast_rect.getHeight());
-		(*it).toast->setRect(toast_rect);
+		toast->setRect(toast_rect);
 
 		if(floater && floater->overlapsScreenChannel())
 		{
@@ -649,7 +752,7 @@ void LLScreenChannel::showToastsTop()
 				{
 					shift -= floater->getDockControl()->getTongueHeight();
 				}
-				(*it).toast->translate(0, shift);
+				toast->translate(0, shift);
 			}
 
 			LLRect channel_rect = getChannelRect();
@@ -660,13 +763,13 @@ void LLScreenChannel::showToastsTop()
 			}
 		}
 
-		bool stop_showing_toasts = (*it).toast->getRect().mBottom < channel_rect.mBottom;
+		bool stop_showing_toasts = toast->getRect().mBottom < channel_rect.mBottom;
 
 		if(!stop_showing_toasts)
 		{
 			if( it != mToastList.rend()-1)
 			{
-				S32 toast_bottom = (*it).toast->getRect().mBottom - gSavedSettings.getS32("ToastGap");
+				S32 toast_bottom = toast->getRect().mBottom - gSavedSettings.getS32("ToastGap");
 				stop_showing_toasts = toast_bottom < channel_rect.mBottom;
 			}
 		} 
@@ -680,29 +783,41 @@ void LLScreenChannel::showToastsTop()
 		if(stop_showing_toasts)
 			break;
 
-		if( !(*it).toast->getVisible() )
+		if (!toast->getVisible())
 		{
 			// HACK
 			// EXT-2653: it is necessary to prevent overlapping for secondary showed toasts
-			(*it).toast->setVisible(TRUE);
+			toast->setVisible(TRUE);
 		}		
-		if(!(*it).toast->hasFocus())
+		if (!toast->hasFocus())
 		{
 			// Fixing Z-order of toasts (EXT-4862)
 			// Next toast will be positioned under this one.
-			gFloaterView->sendChildToBack((*it).toast);
+			gFloaterView->sendChildToBack(toast);
 		}
 	}
 
 	// Dismiss toasts we don't have space for (STORM-391).
+	std::vector<LLToast*> toasts_to_hide;
 	if(it != mToastList.rend())
 	{
 		mHiddenToastsNum = 0;
 		for(; it != mToastList.rend(); it++)
 		{
-			(*it).toast->hide();
+			LLToast* toast = it->getToast();
+			if (toast)
+			{
+				toasts_to_hide.push_back(toast);
+			}
 		}
 	}
+
+	for (std::vector<LLToast*>::iterator it = toasts_to_hide.begin(), end_it = toasts_to_hide.end();
+		it != end_it;
+		++it)
+	{
+		(*it)->hide();
+	}
 }
 
 //--------------------------------------------------------------------------
@@ -803,7 +918,17 @@ void LLNotificationsUI::LLScreenChannel::startToastTimer(LLToast* toast)
 void LLScreenChannel::hideToastsFromScreen()
 {
 	for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end(); it++)
-		(*it).toast->setVisible(FALSE);
+	{
+		LLToast* toast = it->getToast();
+		if (toast)
+		{
+			toast->setVisible(FALSE);
+		}
+		else
+		{
+			llwarns << "Attempt to hide a deleted toast." << llendl;
+		}
+	}
 }
 
 //--------------------------------------------------------------------------
@@ -812,8 +937,15 @@ void LLScreenChannel::hideToast(const LLUUID& notification_id)
 	std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), notification_id);
 	if(mToastList.end() != it)
 	{
-		ToastElem te = *it;
-		te.toast->hide();
+		LLToast* toast = it->getToast();
+		if (toast)
+		{
+			toast->hide();
+		}
+		else
+		{
+			llwarns << "Attempt to hide a deleted toast." << llendl;
+		}
 	}
 }
 
@@ -821,24 +953,25 @@ void LLScreenChannel::closeHiddenToasts(const Matcher& matcher)
 {
 	// since we can't guarantee that close toast operation doesn't change mToastList
 	// we collect matched toasts that should be closed into separate list
-	std::list<ToastElem> toasts;
+	std::list<LLToast*> toasts;
 	for (std::vector<ToastElem>::iterator it = mToastList.begin(); it
 			!= mToastList.end(); it++)
 	{
-		LLToast * toast = it->toast;
+		LLToast* toast = it->getToast();
 		// add to list valid toast that match to provided matcher criteria
 		if (toast != NULL && !toast->isDead() && toast->getNotification() != NULL
 				&& !toast->getVisible() && matcher.matches(toast->getNotification()))
 		{
-			toasts.push_back(*it);
+			toasts.push_back(toast);
 		}
 	}
 
 	// close collected toasts
-	for (std::list<ToastElem>::iterator it = toasts.begin(); it
+	for (std::list<LLToast*>::iterator it = toasts.begin(); it
 			!= toasts.end(); it++)
 	{
-		it->toast->closeFloater();
+		LLToast* toast = *it;
+		toast->closeFloater();
 	}
 }
 
@@ -848,7 +981,7 @@ void LLScreenChannel::removeToastsFromChannel()
 	hideToastsFromScreen();
 	for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end(); it++)
 	{
-		deleteToast((*it).toast);
+		deleteToast(it->getToast());
 	}
 	mToastList.clear();
 }
@@ -862,9 +995,10 @@ void LLScreenChannel::removeAndStoreAllStorableToasts()
 	hideToastsFromScreen();
 	for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end();)
 	{
-		if((*it).toast->getCanBeStored())
+		LLToast* toast = it->getToast();
+		if(toast && toast->getCanBeStored())
 		{
-			storeToast(*(it));
+			storeToast(*it);
 			it = mToastList.erase(it);
 		}
 		else
@@ -884,9 +1018,10 @@ void LLScreenChannel::removeToastsBySessionID(LLUUID id)
 	hideToastsFromScreen();
 	for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end();)
 	{
-		if((*it).toast->getSessionID() == id)
+		LLToast* toast = it->getToast();
+		if(toast && toast->getSessionID() == id)
 		{
-			deleteToast((*it).toast);
+			deleteToast(toast);
 			it = mToastList.erase(it);
 		}
 		else
@@ -944,5 +1079,5 @@ LLToast* LLScreenChannel::getToastByNotificationID(LLUUID id)
 	if (it == mStoredToastList.end())
 		return NULL;
 
-	return it->toast;
+	return it->getToast();
 }
diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h
index 2f23552828bf66335fa738a217f3835ea1f02f3d..56a9cf8b4ba6f8ced608745b9350f81009dafc7f 100644
--- a/indra/newview/llscreenchannel.h
+++ b/indra/newview/llscreenchannel.h
@@ -69,6 +69,8 @@ class LLScreenChannelBase : public LLUICtrl
 	};
 
 	LLScreenChannelBase(const Params&);
+	
+	BOOL postBuild();
 
 	void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
 
@@ -115,7 +117,7 @@ class LLScreenChannelBase : public LLUICtrl
 	
 	// get ID of a channel
 	LLUUID	getChannelID() { return mID; }
-	LLHandle<LLScreenChannelBase> getHandle() { mRootHandle.bind(this); return mRootHandle; }
+	LLHandle<LLScreenChannelBase> getHandle() { return getDerivedHandle<LLScreenChannelBase>(); }
 
 protected:
 	void	updateRect();
@@ -123,12 +125,11 @@ class LLScreenChannelBase : public LLUICtrl
 
 	// Channel's flags
 	bool		mControlHovering;
-	LLToast*		mHoveredToast;
+	LLToast*	mHoveredToast;
 	bool		mCanStoreToasts;
 	bool		mDisplayToastsAlways;
 	// controls whether a channel shows toasts or not
 	bool		mShowToasts;
-	LLRootHandle<LLScreenChannelBase> mRootHandle;
 	// 
 	EToastAlignment		mToastAlignment;
 	EChannelAlignment	mChannelAlignment;
@@ -137,6 +138,9 @@ class LLScreenChannelBase : public LLUICtrl
 
 	// channel's ID
 	LLUUID	mID;
+	
+	LLView*	mFloaterSnapRegion;
+	LLView* mChicletRegion;
 };
 
 
@@ -158,7 +162,7 @@ class LLScreenChannel : public LLScreenChannelBase
 		virtual bool matches(const LLNotificationPtr) const = 0;
 	};
 
-	std::list<LLToast*> findToasts(const Matcher& matcher);
+	std::list<const LLToast*> findToasts(const Matcher& matcher);
 
 	// Channel's outfit-functions
 	// update channel's size and position in the World View
@@ -233,31 +237,39 @@ class LLScreenChannel : public LLScreenChannelBase
 	reject_tost_signal_t mRejectToastSignal; boost::signals2::connection setOnRejectToastCallback(reject_tost_callback_t cb) { return mRejectToastSignal.connect(cb); }
 
 private:
-	struct ToastElem
+	class ToastElem
 	{
-		LLUUID		id;
-		LLToast*	toast;
+	public:
+		ToastElem(const LLHandle<LLToast>& toast) : mToast(toast)
+		{
+		}
 
-		ToastElem(LLToast::Params p) : id(p.notif_id)
+		ToastElem(const ToastElem& toast_elem) : mToast(toast_elem.mToast)
 		{
-			toast = new LLToast(p);
 		}
 
-		ToastElem(const ToastElem& toast_elem)
+		LLToast* getToast() const
 		{
-			id = toast_elem.id;
-			toast = toast_elem.toast;
+			return mToast.get();
+		}
+
+		LLUUID getID() const
+		{
+			return mToast.isDead() ? LLUUID() : mToast.get()->getNotificationID();
 		}
 
 		bool operator == (const LLUUID &id_op) const
 		{
-			return (id == id_op);
+			return (getID() == id_op);
 		}
 
 		bool operator == (LLPanel* panel_op) const
 		{
-			return (toast == panel_op);
+			return (mToast.get() == panel_op);
 		}
+
+	private:
+		LLHandle<LLToast>	mToast;
 	};
 
 	// Channel's handlers
diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp
index 85a7e752715fa1d75321f387016bb462bbaaff0f..6f98be1cb8763f89d2fbb2c982ab2a7766da1586 100644
--- a/indra/newview/llscriptfloater.cpp
+++ b/indra/newview/llscriptfloater.cpp
@@ -408,9 +408,16 @@ void LLScriptFloaterManager::onRemoveNotification(const LLUUID& notification_id)
 	}
 
 	// remove related chiclet
-	LLChicletBar::getInstance()->getChicletPanel()->removeChiclet(notification_id);
+	if (LLChicletBar::instanceExists())
+	{
+		LLChicletBar::getInstance()->getChicletPanel()->removeChiclet(notification_id);
+	}
 
-	LLIMWellWindow::getInstance()->removeObjectRow(notification_id);
+	LLIMWellWindow* im_well_window = LLIMWellWindow::findInstance();
+	if (im_well_window)
+	{
+		im_well_window->removeObjectRow(notification_id);
+	}
 
 	mNotifications.erase(notification_id);
 
diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp
index 8d64c8c04f4bf2b3bd00dd29f482f024d0263923..30400a4c6a6b7d44a616ca8c33ae0414a3f32627 100644
--- a/indra/newview/llsechandler_basic.cpp
+++ b/indra/newview/llsechandler_basic.cpp
@@ -1360,7 +1360,11 @@ void LLSecAPIBasicHandler::_writeProtectedData()
 		// (even though this file isn't really secure.  Perhaps in the future
 		// it may be, however.
 		LLFile::remove(tmp_filename);
-		throw LLProtectedDataException("Error writing Protected Data Store");
+
+		// EXP-1825 crash in LLSecAPIBasicHandler::_writeProtectedData()
+		// Decided throwing an exception here was overkill until we figure out why this happens
+		//throw LLProtectedDataException("Error writing Protected Data Store");
+		llinfos << "LLProtectedDataException(Error writing Protected Data Store)" << llendl;
 	}
 
 	// move the temporary file to the specified file location.
@@ -1369,7 +1373,11 @@ void LLSecAPIBasicHandler::_writeProtectedData()
 	   (LLFile::rename(tmp_filename, mProtectedDataFilename)))
 	{
 		LLFile::remove(tmp_filename);
-		throw LLProtectedDataException("Could not overwrite protected data store");
+
+		// EXP-1825 crash in LLSecAPIBasicHandler::_writeProtectedData()
+		// Decided throwing an exception here was overkill until we figure out why this happens
+		//throw LLProtectedDataException("Could not overwrite protected data store");
+		llinfos << "LLProtectedDataException(Could not overwrite protected data store)" << llendl;
 	}
 }
 		
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 733902ad30d937923f8bfe093d9a0942b028f06c..6111255a6649397322f95b17da3150215a694d06 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -89,6 +89,7 @@
 #include "llvoavatarself.h"
 #include "llvovolume.h"
 #include "pipeline.h"
+#include "llviewershadermgr.h"
 
 #include "llglheaders.h"
 
@@ -4837,7 +4838,7 @@ void LLSelectMgr::processForceObjectSelect(LLMessageSystem* msg, void**)
 	LLSelectMgr::getInstance()->highlightObjectAndFamily(objects);
 }
 
-extern LLGLdouble	gGLModelView[16];
+extern F32	gGLModelView[16];
 
 void LLSelectMgr::updateSilhouettes()
 {
@@ -5133,20 +5134,20 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
 		F32 cur_zoom = gAgentCamera.mHUDCurZoom;
 
 		// set up transform to encompass bounding box of HUD
-		glMatrixMode(GL_PROJECTION);
+		gGL.matrixMode(LLRender::MM_PROJECTION);
 		gGL.pushMatrix();
-		glLoadIdentity();
+		gGL.loadIdentity();
 		F32 depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f);
-		glOrtho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth);
+		gGL.ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth);
 
-		glMatrixMode(GL_MODELVIEW);
+		gGL.matrixMode(LLRender::MM_MODELVIEW);
 		gGL.pushMatrix();
 		gGL.pushUIMatrix();
 		gGL.loadUIIdentity();
-		glLoadIdentity();
-		glLoadMatrixf(OGL_TO_CFR_ROTATION);		// Load Cory's favorite reference frame
-		glTranslatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f);
-		glScalef(cur_zoom, cur_zoom, cur_zoom);
+		gGL.loadIdentity();
+		gGL.loadMatrix(OGL_TO_CFR_ROTATION);		// Load Cory's favorite reference frame
+		gGL.translatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f);
+		gGL.scalef(cur_zoom, cur_zoom, cur_zoom);
 	}
 	if (mSelectedObjects->getNumNodes())
 	{
@@ -5239,10 +5240,10 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
 
 	if (isAgentAvatarValid() && for_hud)
 	{
-		glMatrixMode(GL_PROJECTION);
+		gGL.matrixMode(LLRender::MM_PROJECTION);
 		gGL.popMatrix();
 
-		glMatrixMode(GL_MODELVIEW);
+		gGL.matrixMode(LLRender::MM_MODELVIEW);
 		gGL.popMatrix();
 		gGL.popUIMatrix();
 		stop_glerror();
@@ -5555,39 +5556,37 @@ BOOL LLSelectNode::allowOperationOnNode(PermissionBit op, U64 group_proxy_power)
 //helper function for pushing relevant vertices from drawable to GL
 void pushWireframe(LLDrawable* drawable)
 {
-	if (drawable->isState(LLDrawable::RIGGED))
-	{ //render straight from rigged volume if this is a rigged attachment
-		LLVOVolume* vobj = drawable->getVOVolume();
-		if (vobj)
+	LLVOVolume* vobj = drawable->getVOVolume();
+	if (vobj)
+	{
+		LLVertexBuffer::unbind();
+		gGL.pushMatrix();
+		gGL.multMatrix((F32*) vobj->getRelativeXform().mMatrix);
+
+		LLVolume* volume = NULL;
+
+		if (drawable->isState(LLDrawable::RIGGED))
 		{
-			vobj->updateRiggedVolume();
-			LLRiggedVolume* rigged_volume = vobj->getRiggedVolume();
-			if (rigged_volume)
-			{
-				LLVertexBuffer::unbind();
-				gGL.pushMatrix();
-				glMultMatrixf((F32*) vobj->getRelativeXform().mMatrix);
-				for (S32 i = 0; i < rigged_volume->getNumVolumeFaces(); ++i)
-				{
-					const LLVolumeFace& face = rigged_volume->getVolumeFace(i);
-					glVertexPointer(3, GL_FLOAT, 16, face.mPositions);
-					glDrawElements(GL_TRIANGLES, face.mNumIndices, GL_UNSIGNED_SHORT, face.mIndices);
-				}
-				gGL.popMatrix();
-			}
+				vobj->updateRiggedVolume();
+				volume = vobj->getRiggedVolume();
 		}
-	}
-	else
-	{
-		for (S32 i = 0; i < drawable->getNumFaces(); ++i)
+		else
 		{
-			LLFace* face = drawable->getFace(i);
-			if (face->verify())
+			volume = vobj->getVolume();
+		}
+
+		if (volume)
+		{
+			for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i)
 			{
-				pushVerts(face, LLVertexBuffer::MAP_VERTEX);
+				const LLVolumeFace& face = volume->getVolumeFace(i);
+				LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mPositions, face.mTexCoords, face.mNumIndices, face.mIndices);
 			}
 		}
+
+		gGL.popMatrix();
 	}
+	
 }
 
 void LLSelectNode::renderOneWireframe(const LLColor4& color)
@@ -5604,22 +5603,29 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color)
 		return;
 	}
 
-	glMatrixMode(GL_MODELVIEW);
+	LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+
+	if (shader)
+	{
+		gHighlightProgram.bind();
+	}
+
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.pushMatrix();
 	
 	BOOL is_hud_object = objectp->isHUDAttachment();
 
 	if (drawable->isActive())
 	{
-		glLoadMatrixd(gGLModelView);
-		glMultMatrixf((F32*) objectp->getRenderMatrix().mMatrix);
+		gGL.loadMatrix(gGLModelView);
+		gGL.multMatrix((F32*) objectp->getRenderMatrix().mMatrix);
 	}
 	else if (!is_hud_object)
 	{
-		glLoadIdentity();
-		glMultMatrixd(gGLModelView);
+		gGL.loadIdentity();
+		gGL.multMatrix(gGLModelView);
 		LLVector3 trans = objectp->getRegion()->getOriginAgent();		
-		glTranslatef(trans.mV[0], trans.mV[1], trans.mV[2]);		
+		gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]);		
 	}
 	
 	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
@@ -5627,26 +5633,35 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color)
 	if (LLSelectMgr::sRenderHiddenSelections) // && gFloaterTools && gFloaterTools->getVisible())
 	{
 		gGL.blendFunc(LLRender::BF_SOURCE_COLOR, LLRender::BF_ONE);
-		LLGLEnable fog(GL_FOG);
-		glFogi(GL_FOG_MODE, GL_LINEAR);
-		float d = (LLViewerCamera::getInstance()->getPointOfInterest()-LLViewerCamera::getInstance()->getOrigin()).magVec();
-		LLColor4 fogCol = color * (F32)llclamp((LLSelectMgr::getInstance()->getSelectionCenterGlobal()-gAgentCamera.getCameraPositionGlobal()).magVec()/(LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal().magVec()*4), 0.0, 1.0);
-		glFogf(GL_FOG_START, d);
-		glFogf(GL_FOG_END, d*(1 + (LLViewerCamera::getInstance()->getView() / LLViewerCamera::getInstance()->getDefaultFOV())));
-		glFogfv(GL_FOG_COLOR, fogCol.mV);
-
 		LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GEQUAL);
-		gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+		if (shader)
 		{
-			glColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f);
+			gGL.diffuseColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f);
 			pushWireframe(drawable);
 		}
+		else
+		{
+			LLGLEnable fog(GL_FOG);
+			glFogi(GL_FOG_MODE, GL_LINEAR);
+			float d = (LLViewerCamera::getInstance()->getPointOfInterest()-LLViewerCamera::getInstance()->getOrigin()).magVec();
+			LLColor4 fogCol = color * (F32)llclamp((LLSelectMgr::getInstance()->getSelectionCenterGlobal()-gAgentCamera.getCameraPositionGlobal()).magVec()/(LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal().magVec()*4), 0.0, 1.0);
+			glFogf(GL_FOG_START, d);
+			glFogf(GL_FOG_END, d*(1 + (LLViewerCamera::getInstance()->getView() / LLViewerCamera::getInstance()->getDefaultFOV())));
+			glFogfv(GL_FOG_COLOR, fogCol.mV);
+
+			gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+			{
+				gGL.diffuseColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f);
+				pushWireframe(drawable);
+			}
+		}
 	}
 
 	gGL.flush();
 	gGL.setSceneBlendType(LLRender::BT_ALPHA);
 
-	glColor4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2);
+	gGL.diffuseColor4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2);
+	
 	LLGLEnable offset(GL_POLYGON_OFFSET_LINE);
 	glPolygonOffset(3.f, 3.f);
 	glLineWidth(3.f);
@@ -5654,6 +5669,11 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color)
 	glLineWidth(1.f);
 	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
 	gGL.popMatrix();
+
+	if (shader)
+	{
+		shader->bind();
+	}
 }
 
 //-----------------------------------------------------------------------------
@@ -5692,21 +5712,29 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
 		return;
 	}
 
-	glMatrixMode(GL_MODELVIEW);
+
+	LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+
+	if (shader)
+	{ //switch to "solid color" program for SH-2690 -- works around driver bug causing bad triangles when rendering silhouettes
+		gSolidColorProgram.bind();
+	}
+
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.pushMatrix();
 	gGL.pushUIMatrix();
 	gGL.loadUIIdentity();
 
 	if (!is_hud_object)
 	{
-		glLoadIdentity();
-		glMultMatrixd(gGLModelView);
+		gGL.loadIdentity();
+		gGL.multMatrix(gGLModelView);
 	}
 	
 	
 	if (drawable->isActive())
 	{
-		glMultMatrixf((F32*) objectp->getRenderMatrix().mMatrix);
+		gGL.multMatrix((F32*) objectp->getRenderMatrix().mMatrix);
 	}
 
 	LLVolume *volume = objectp->getVolume();
@@ -5814,6 +5842,11 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
 	}
 	gGL.popMatrix();
 	gGL.popUIMatrix();
+
+	if (shader)
+	{
+		shader->bind();
+	}
 }
 
 //
@@ -6503,7 +6536,7 @@ F32 LLObjectSelection::getSelectedObjectStreamingCost(S32* total_bytes, S32* vis
 	return cost;
 }
 
-U32 LLObjectSelection::getSelectedObjectTriangleCount()
+U32 LLObjectSelection::getSelectedObjectTriangleCount(S32* vcount)
 {
 	U32 count = 0;
 	for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter)
@@ -6513,7 +6546,7 @@ U32 LLObjectSelection::getSelectedObjectTriangleCount()
 		
 		if (object)
 		{
-			count += object->getTriangleCount();
+			count += object->getTriangleCount(vcount);
 		}
 	}
 
diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h
index 166616e13e03e96ee1716ae54bcead366b0bca1e..87ada5ac6b6cbe3acc9535519a0356343e2a1f4d 100644
--- a/indra/newview/llselectmgr.h
+++ b/indra/newview/llselectmgr.h
@@ -286,7 +286,7 @@ class LLObjectSelection : public LLRefCount
 	S32 getSelectedObjectRenderCost();
 	
 	F32 getSelectedObjectStreamingCost(S32* total_bytes = NULL, S32* visible_bytes = NULL);
-	U32 getSelectedObjectTriangleCount();
+	U32 getSelectedObjectTriangleCount(S32* vcount = NULL);
 
 	S32 getTECount();
 	S32 getRootObjectCount();
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp
index 9d069c3996c26c9901b9e6263deae2eb23f869b8..4f9ab318a56807443cc0fdee6c3bad8f0b25d207 100644
--- a/indra/newview/llsidepanelinventory.cpp
+++ b/indra/newview/llsidepanelinventory.cpp
@@ -47,7 +47,6 @@
 #include "lloutfitobserver.h"
 #include "llpanelmaininventory.h"
 #include "llpanelmarketplaceinbox.h"
-#include "llpanelmarketplaceoutbox.h"
 #include "llselectmgr.h"
 #include "llsidepaneliteminfo.h"
 #include "llsidepaneltaskinfo.h"
@@ -68,35 +67,21 @@ static LLRegisterPanelClassWrapper<LLSidepanelInventory> t_inventory("sidepanel_
 // No longer want the inbox panel to auto-expand since it creates issues with the "new" tag time stamp
 #define AUTO_EXPAND_INBOX	0
 
-// Temporarily disabling the outbox until we straighten out the API
-#define ENABLE_MERCHANT_OUTBOX_PANEL		0	// keep in sync with ENABLE_INVENTORY_DISPLAY_OUTBOX, ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU
-
 static const char * const INBOX_BUTTON_NAME = "inbox_btn";
-static const char * const OUTBOX_BUTTON_NAME = "outbox_btn";
-
 static const char * const INBOX_LAYOUT_PANEL_NAME = "inbox_layout_panel";
-static const char * const OUTBOX_LAYOUT_PANEL_NAME = "outbox_layout_panel";
-
-static const char * const INBOX_OUTBOX_LAYOUT_PANEL_NAME = "inbox_outbox_layout_panel";
 static const char * const MAIN_INVENTORY_LAYOUT_PANEL_NAME = "main_inventory_layout_panel";
 
-static const char * const INBOX_INVENTORY_PANEL = "inventory_inbox";
-static const char * const OUTBOX_INVENTORY_PANEL = "inventory_outbox";
-
-static const char * const INBOX_OUTBOX_LAYOUT_STACK_NAME = "inbox_outbox_layout_stack";
 static const char * const INVENTORY_LAYOUT_STACK_NAME = "inventory_layout_stack";
 
 static const char * const MARKETPLACE_INBOX_PANEL = "marketplace_inbox";
-static const char * const MARKETPLACE_OUTBOX_PANEL = "marketplace_outbox";
 
 //
 // Helpers
 //
-
-class LLInboxOutboxAddedObserver : public LLInventoryCategoryAddedObserver
+class LLInboxAddedObserver : public LLInventoryCategoryAddedObserver
 {
 public:
-	LLInboxOutboxAddedObserver(LLSidepanelInventory * sidepanelInventory)
+	LLInboxAddedObserver(LLSidepanelInventory * sidepanelInventory)
 		: LLInventoryCategoryAddedObserver()
 		, mSidepanelInventory(sidepanelInventory)
 	{
@@ -116,10 +101,6 @@ class LLInboxOutboxAddedObserver : public LLInventoryCategoryAddedObserver
 					mSidepanelInventory->enableInbox(true);
 					mSidepanelInventory->observeInboxModifications(added_category->getUUID());
 					break;
-				case LLFolderType::FT_OUTBOX:
-					mSidepanelInventory->enableOutbox(true);
-					mSidepanelInventory->observeOutboxModifications(added_category->getUUID());
-					break;
 				default:
 					break;
 			}
@@ -138,29 +119,32 @@ LLSidepanelInventory::LLSidepanelInventory()
 	: LLPanel()
 	, mItemPanel(NULL)
 	, mInventoryPanelInbox(NULL)
-	, mInventoryPanelOutbox(NULL)
 	, mPanelMainInventory(NULL)
 	, mInboxEnabled(false)
-	, mOutboxEnabled(false)
 	, mCategoriesObserver(NULL)
-	, mInboxOutboxAddedObserver(NULL)
+	, mInboxAddedObserver(NULL)
 {
 	//buildFromFile( "panel_inventory.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder()
 }
 
 LLSidepanelInventory::~LLSidepanelInventory()
 {
+	LLLayoutPanel* inbox_layout_panel = getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME);
+
+	// Save the InventoryMainPanelHeight in settings per account
+	gSavedPerAccountSettings.setS32("InventoryInboxHeight", inbox_layout_panel->getTargetDim());
+
 	if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver))
 	{
 		gInventory.removeObserver(mCategoriesObserver);
 	}
 	delete mCategoriesObserver;
 	
-	if (mInboxOutboxAddedObserver && gInventory.containsObserver(mInboxOutboxAddedObserver))
+	if (mInboxAddedObserver && gInventory.containsObserver(mInboxAddedObserver))
 	{
-		gInventory.removeObserver(mInboxOutboxAddedObserver);
+		gInventory.removeObserver(mInboxAddedObserver);
 	}
-	delete mInboxOutboxAddedObserver;
+	delete mInboxAddedObserver;
 }
 
 void handleInventoryDisplayInboxChanged()
@@ -172,15 +156,6 @@ void handleInventoryDisplayInboxChanged()
 	}
 }
 
-void handleInventoryDisplayOutboxChanged()
-{
-	LLSidepanelInventory* sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
-	if (sidepanel_inventory)
-	{
-		sidepanel_inventory->enableOutbox(gSavedSettings.getBOOL("InventoryDisplayOutbox"));
-	}
-}
-
 BOOL LLSidepanelInventory::postBuild()
 {
 	// UI elements from inventory panel
@@ -242,43 +217,34 @@ BOOL LLSidepanelInventory::postBuild()
 		}
 	}
 	
-	// Marketplace inbox/outbox setup
+	// Received items inbox setup
 	{
 		LLLayoutStack* inv_stack = getChild<LLLayoutStack>(INVENTORY_LAYOUT_STACK_NAME);
 
-		// Disable user_resize on main inventory panel by default
-		inv_stack->setPanelUserResize(MAIN_INVENTORY_LAYOUT_PANEL_NAME, false);
-		inv_stack->setPanelUserResize(INBOX_OUTBOX_LAYOUT_PANEL_NAME, false);
-
-		// Collapse marketplace panel by default
-		inv_stack->collapsePanel(getChild<LLLayoutPanel>(INBOX_OUTBOX_LAYOUT_PANEL_NAME), true);
-		
-		LLLayoutStack* inout_stack = getChild<LLLayoutStack>(INBOX_OUTBOX_LAYOUT_STACK_NAME);
-
-		// Collapse both inbox and outbox panels
-		inout_stack->collapsePanel(getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME), true);
-		inout_stack->collapsePanel(getChild<LLLayoutPanel>(OUTBOX_LAYOUT_PANEL_NAME), true);
-		
 		// Set up button states and callbacks
 		LLButton * inbox_button = getChild<LLButton>(INBOX_BUTTON_NAME);
-		LLButton * outbox_button = getChild<LLButton>(OUTBOX_BUTTON_NAME);
-
-		inbox_button->setToggleState(false);
-		outbox_button->setToggleState(false);
 
 		inbox_button->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleInboxBtn, this));
-		outbox_button->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleOutboxBtn, this));
 
-		// Set the inbox and outbox visible based on debug settings (final setting comes from http request below)
+		// Get the previous inbox state from "InventoryInboxToggleState" setting.
+		bool is_inbox_collapsed = !inbox_button->getToggleState();
+
+		// Restore the collapsed inbox panel state
+		LLLayoutPanel* inbox_panel = getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME);
+		inv_stack->collapsePanel(inbox_panel, is_inbox_collapsed);
+		if (!is_inbox_collapsed)
+		{
+			inbox_panel->setTargetDim(gSavedPerAccountSettings.getS32("InventoryInboxHeight"));
+		}
+
+		// Set the inbox visible based on debug settings (final setting comes from http request below)
 		enableInbox(gSavedSettings.getBOOL("InventoryDisplayInbox"));
-		enableOutbox(gSavedSettings.getBOOL("InventoryDisplayOutbox"));
 
-		// Trigger callback for after login so we can setup to track inbox and outbox changes after initial inventory load
-		LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLSidepanelInventory::updateInboxOutbox, this));
+		// Trigger callback for after login so we can setup to track inbox changes after initial inventory load
+		LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLSidepanelInventory::updateInbox, this));
 	}
 
 	gSavedSettings.getControl("InventoryDisplayInbox")->getCommitSignal()->connect(boost::bind(&handleInventoryDisplayInboxChanged));
-	gSavedSettings.getControl("InventoryDisplayOutbox")->getCommitSignal()->connect(boost::bind(&handleInventoryDisplayOutboxChanged));
 
 	// Update the verbs buttons state.
 	updateVerbs();
@@ -286,168 +252,96 @@ BOOL LLSidepanelInventory::postBuild()
 	return TRUE;
 }
 
-void LLSidepanelInventory::updateInboxOutbox()
+void LLSidepanelInventory::updateInbox()
 {
 	//
-	// Track inbox and outbox folder changes
+	// Track inbox folder changes
 	//
 
 	const bool do_not_create_folder = false;
 	const bool do_not_find_in_library = false;
 
 	const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX, do_not_create_folder, do_not_find_in_library);
-	const LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, do_not_create_folder, do_not_find_in_library);
 	
-	// Set up observer to listen for creation of inbox and outbox if at least one of them doesn't exist
-	if (inbox_id.isNull() || outbox_id.isNull())
+	// Set up observer to listen for creation of inbox if at least one of them doesn't exist
+	if (inbox_id.isNull())
 	{
-		observeInboxOutboxCreation();
+		observeInboxCreation();
 	}
-
 	// Set up observer for inbox changes, if we have an inbox already
-	if (!inbox_id.isNull())
+	else 
 	{
 		// Enable the display of the inbox if it exists
 		enableInbox(true);
 
 		observeInboxModifications(inbox_id);
 	}
-	
-#if ENABLE_MERCHANT_OUTBOX_PANEL
-	// Set up observer for outbox changes, if we have an outbox already
-	if (!outbox_id.isNull())
-	{
-		// Enable the display of the outbox if it exists
-		enableOutbox(true);
-
-		observeOutboxModifications(outbox_id);
-	}
-#endif
 }
 
-void LLSidepanelInventory::observeInboxOutboxCreation()
+void LLSidepanelInventory::observeInboxCreation()
 {
 	//
-	// Set up observer to track inbox and outbox folder creation
+	// Set up observer to track inbox folder creation
 	//
 	
-	if (mInboxOutboxAddedObserver == NULL)
+	if (mInboxAddedObserver == NULL)
 	{
-		mInboxOutboxAddedObserver = new LLInboxOutboxAddedObserver(this);
+		mInboxAddedObserver = new LLInboxAddedObserver(this);
 		
-		gInventory.addObserver(mInboxOutboxAddedObserver);
+		gInventory.addObserver(mInboxAddedObserver);
 	}
 }
 
 void LLSidepanelInventory::observeInboxModifications(const LLUUID& inboxID)
 {
 	//
-	// Track inbox and outbox folder changes
+	// Silently do nothing if we already have an inbox inventory panel set up
+	// (this can happen multiple times on the initial session that creates the inbox)
 	//
-	
+
+	if (mInventoryPanelInbox != NULL)
+	{
+		return;
+	}
+
+	//
+	// Track inbox folder changes
+	//
+
 	if (inboxID.isNull())
 	{
-		llwarns << "Attempting to track modifications to non-existant inbox" << llendl;
+		llwarns << "Attempting to track modifications to non-existent inbox" << llendl;
 		return;
 	}
-	
+
 	if (mCategoriesObserver == NULL)
 	{
 		mCategoriesObserver = new LLInventoryCategoriesObserver();
 		gInventory.addObserver(mCategoriesObserver);
 	}
-	
+
 	mCategoriesObserver->addCategory(inboxID, boost::bind(&LLSidepanelInventory::onInboxChanged, this, inboxID));
-	
+
 	//
 	// Trigger a load for the entire contents of the Inbox
 	//
-	
+
 	LLInventoryModelBackgroundFetch::instance().start(inboxID);
-	
+
 	//
 	// Set up the inbox inventory view
 	//
-	
+
 	LLPanelMarketplaceInbox * inbox = getChild<LLPanelMarketplaceInbox>(MARKETPLACE_INBOX_PANEL);
 	mInventoryPanelInbox = inbox->setupInventoryPanel();
 }
 
-
-void LLSidepanelInventory::observeOutboxModifications(const LLUUID& outboxID)
-{
-	//
-	// Track outbox folder changes
-	//
-	
-	if (outboxID.isNull())
-	{
-		llwarns << "Attempting to track modifications to non-existant outbox" << llendl;
-		return;
-	}
-	
-	if (mCategoriesObserver == NULL)
-	{
-		mCategoriesObserver = new LLInventoryCategoriesObserver();
-		gInventory.addObserver(mCategoriesObserver);
-	}
-	
-	mCategoriesObserver->addCategory(outboxID, boost::bind(&LLSidepanelInventory::onOutboxChanged, this, outboxID));
-	
-	//
-	// Set up the outbox inventory view
-	//
-	
-	LLPanelMarketplaceOutbox * outbox = getChild<LLPanelMarketplaceOutbox>(MARKETPLACE_OUTBOX_PANEL);
-	mInventoryPanelOutbox = outbox->setupInventoryPanel();
-}
-
 void LLSidepanelInventory::enableInbox(bool enabled)
 {
 	mInboxEnabled = enabled;
 	
 	LLLayoutPanel * inbox_layout_panel = getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME);
 	inbox_layout_panel->setVisible(enabled);
-
-	if (mInboxEnabled)
-	{
-		LLLayoutPanel * inout_layout_panel = getChild<LLLayoutPanel>(INBOX_OUTBOX_LAYOUT_PANEL_NAME);
-
-		inout_layout_panel->setVisible(TRUE);
-		
-		if (mOutboxEnabled)
-		{
-			S32 inbox_min_dim = inbox_layout_panel->getMinDim();
-			S32 outbox_min_dim = getChild<LLLayoutPanel>(OUTBOX_LAYOUT_PANEL_NAME)->getMinDim();
-			
-			inout_layout_panel->setMinDim(inbox_min_dim + outbox_min_dim);
-		}
-	}
-}
-
-void LLSidepanelInventory::enableOutbox(bool enabled)
-{
-	mOutboxEnabled = enabled;
-	
-	LLLayoutPanel * outbox_layout_panel = getChild<LLLayoutPanel>(OUTBOX_LAYOUT_PANEL_NAME);
-	outbox_layout_panel->setVisible(enabled);
-
-	if (mOutboxEnabled)
-	{
-		LLLayoutPanel * inout_layout_panel = getChild<LLLayoutPanel>(INBOX_OUTBOX_LAYOUT_PANEL_NAME);
-		
-		inout_layout_panel->setVisible(TRUE);
-		
-		if (mInboxEnabled)
-		{
-			S32 inbox_min_dim = getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME)->getMinDim();
-			S32 outbox_min_dim = outbox_layout_panel->getMinDim();
-			
-			inout_layout_panel->setMinDim(inbox_min_dim + outbox_min_dim);
-		}
-		
-		updateOutboxUserStatus();
-	}
 }
 
 void LLSidepanelInventory::openInbox()
@@ -459,31 +353,13 @@ void LLSidepanelInventory::openInbox()
 	}
 }
 
-void LLSidepanelInventory::openOutbox()
-{
-	if (mOutboxEnabled)
-	{
-		getChild<LLButton>(OUTBOX_BUTTON_NAME)->setToggleState(true);
-		onToggleOutboxBtn();
-	}
-}
-
 void LLSidepanelInventory::onInboxChanged(const LLUUID& inbox_id)
 {
 	// Trigger a load of the entire inbox so we always know the contents and their creation dates for sorting
 	LLInventoryModelBackgroundFetch::instance().start(inbox_id);
 
 #if AUTO_EXPAND_INBOX
-	// If the outbox is expanded, don't auto-expand the inbox
-	if (mOutboxEnabled)
-	{
-		if (getChild<LLButton>(OUTBOX_BUTTON_NAME)->getToggleState())
-		{
-			return;
-		}
-	}
-
-	// Expand the inbox since we have fresh items and the outbox is not expanded
+	// Expand the inbox since we have fresh items
 	if (mInboxEnabled)
 	{
 		getChild<LLButton>(INBOX_BUTTON_NAME)->setToggleState(true);
@@ -492,83 +368,30 @@ void LLSidepanelInventory::onInboxChanged(const LLUUID& inbox_id)
 #endif
 }
 
-void LLSidepanelInventory::onOutboxChanged(const LLUUID& outbox_id)
-{
-	// Expand the outbox since we have new items in it
-	if (mOutboxEnabled)
-	{
-		getChild<LLButton>(OUTBOX_BUTTON_NAME)->setToggleState(true);
-		onToggleOutboxBtn();
-	}	
-}
-
-bool LLSidepanelInventory::manageInboxOutboxPanels(LLButton * pressedButton, LLLayoutPanel * pressedPanel,
-							 LLButton * otherButton, LLLayoutPanel * otherPanel)
+void LLSidepanelInventory::onToggleInboxBtn()
 {
-	bool expand = pressedButton->getToggleState();
-	bool otherExpanded = otherButton->getToggleState();
-
+	LLButton* inboxButton = getChild<LLButton>(INBOX_BUTTON_NAME);
+	LLLayoutPanel* inboxPanel = getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME);
 	LLLayoutStack* inv_stack = getChild<LLLayoutStack>(INVENTORY_LAYOUT_STACK_NAME);
-	LLLayoutStack* inout_stack = getChild<LLLayoutStack>(INBOX_OUTBOX_LAYOUT_STACK_NAME);
-	LLLayoutPanel* inout_panel = getChild<LLLayoutPanel>(INBOX_OUTBOX_LAYOUT_PANEL_NAME);
-
-	// Enable user_resize on main inventory panel only when a marketplace box is expanded
-	inv_stack->setPanelUserResize(MAIN_INVENTORY_LAYOUT_PANEL_NAME, expand);
-	inv_stack->collapsePanel(inout_panel, !expand);
+	
+	const bool inbox_expanded = inboxButton->getToggleState();
+	
+	// Expand/collapse the indicated panel
+	inv_stack->collapsePanel(inboxPanel, !inbox_expanded);
 
-	// Collapse other marketplace panel if it is expanded
-	if (expand && otherExpanded)
+	if (inbox_expanded)
 	{
-		// Reshape pressedPanel to the otherPanel's height so we preserve the marketplace panel size
-		pressedPanel->reshape(pressedPanel->getRect().getWidth(), otherPanel->getRect().getHeight());
-
-		inout_stack->collapsePanel(otherPanel, true);
-		otherButton->setToggleState(false);
-	}
-	else
-	{
-		// NOTE: This is an attempt to reshape the inventory panel to the proper size but it doesn't seem to propagate
-		// properly to the child panels.
-
-		S32 new_height = inout_panel->getRect().getHeight();
-
-		if (otherPanel->getVisible())
+		inboxPanel->setTargetDim(gSavedPerAccountSettings.getS32("InventoryInboxHeight"));
+		if (inboxPanel->isInVisibleChain())
 		{
-			new_height -= otherPanel->getMinDim();
+			gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
 		}
-
-		pressedPanel->reshape(pressedPanel->getRect().getWidth(), new_height);
 	}
-
-	// Expand/collapse the indicated panel
-	inout_stack->collapsePanel(pressedPanel, !expand);
-
-	return expand;
-}
-
-void LLSidepanelInventory::onToggleInboxBtn()
-{
-	LLButton* inboxButton = getChild<LLButton>(INBOX_BUTTON_NAME);
-	LLLayoutPanel* inboxPanel = getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME);
-	LLButton* outboxButton = getChild<LLButton>(OUTBOX_BUTTON_NAME);
-	LLLayoutPanel* outboxPanel = getChild<LLLayoutPanel>(OUTBOX_LAYOUT_PANEL_NAME);
-
-	const bool inbox_expanded = manageInboxOutboxPanels(inboxButton, inboxPanel, outboxButton, outboxPanel);
-
-	if (inbox_expanded && inboxPanel->isInVisibleChain())
+	else
 	{
-		gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
+		gSavedPerAccountSettings.setS32("InventoryInboxHeight", inboxPanel->getTargetDim());
 	}
-}
 
-void LLSidepanelInventory::onToggleOutboxBtn()
-{
-	LLButton* inboxButton = getChild<LLButton>(INBOX_BUTTON_NAME);
-	LLLayoutPanel* inboxPanel = getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME);
-	LLButton* outboxButton = getChild<LLButton>(OUTBOX_BUTTON_NAME);
-	LLLayoutPanel* outboxPanel = getChild<LLLayoutPanel>(OUTBOX_LAYOUT_PANEL_NAME);
-
-	manageInboxOutboxPanels(outboxButton, outboxPanel, inboxButton, inboxPanel);
 }
 
 void LLSidepanelInventory::onOpen(const LLSD& key)
@@ -740,77 +563,6 @@ void LLSidepanelInventory::showInventoryPanel()
 	updateVerbs();
 }
 
-void LLSidepanelInventory::updateOutboxUserStatus()
-{
-	const bool isMerchant = (gSavedSettings.getString("InventoryMarketplaceUserStatus") == "merchant");
-	const bool hasOutbox = !gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false, false).isNull();
-	
-	LLView * outbox_placeholder = getChild<LLView>("outbox_inventory_placeholder_panel");
-	LLView * outbox_placeholder_parent = outbox_placeholder->getParent();
-	
-	LLTextBox * outbox_title_box = outbox_placeholder->getChild<LLTextBox>("outbox_inventory_placeholder_title");
-	LLTextBox * outbox_text_box = outbox_placeholder->getChild<LLTextBox>("outbox_inventory_placeholder_text");
-
-	std::string outbox_text;
-	std::string outbox_title;
-	std::string outbox_tooltip;
-
-	if (isMerchant)
-	{
-		if (hasOutbox)
-		{
-			outbox_text = LLTrans::getString("InventoryOutboxNoItems");
-			outbox_title = LLTrans::getString("InventoryOutboxNoItemsTitle");
-			outbox_tooltip = LLTrans::getString("InventoryOutboxNoItemsTooltip");
-		}
-		else
-		{
-			outbox_text = LLTrans::getString("InventoryOutboxCreationError");
-			outbox_title = LLTrans::getString("InventoryOutboxCreationErrorTitle");
-			outbox_tooltip = LLTrans::getString("InventoryOutboxCreationErrorTooltip");
-		}
-	}
-	else
-	{
-		//
-		// The string to become a merchant contains 3 URL's which need the domain name patched in.
-		//
-		
-		std::string domain = "secondlife.com";
-		
-		if (!LLGridManager::getInstance()->isInProductionGrid())
-		{
-			std::string gridLabel = LLGridManager::getInstance()->getGridLabel();
-			domain = llformat("%s.lindenlab.com", utf8str_tolower(gridLabel).c_str());
-		}
-		
-		LLStringUtil::format_map_t domain_arg;
-		domain_arg["[DOMAIN_NAME]"] = domain;
-
-		std::string marketplace_url = LLTrans::getString("MarketplaceURL", domain_arg);
-		std::string marketplace_url_create = LLTrans::getString("MarketplaceURL_CreateStore", domain_arg);
-		std::string marketplace_url_info = LLTrans::getString("MarketplaceURL_LearnMore", domain_arg);
-		
-		LLStringUtil::format_map_t args1, args2, args3;
-		args1["[MARKETPLACE_URL]"] = marketplace_url;
-		args2["[LEARN_MORE_URL]"] = marketplace_url_info;
-		args3["[CREATE_STORE_URL]"] = marketplace_url_create;
-		
-		// NOTE: This is dumb, ridiculous and very finicky.  The order of these is very important
-		//       to have these three string substitutions work properly.
-		outbox_text = LLTrans::getString("InventoryOutboxNotMerchant", args1);
-		LLStringUtil::format(outbox_text, args2);
-		LLStringUtil::format(outbox_text, args3);
-
-		outbox_title = LLTrans::getString("InventoryOutboxNotMerchantTitle");
-		outbox_tooltip = LLTrans::getString("InventoryOutboxNotMerchantTooltip");
-	}
-	
-	outbox_text_box->setValue(outbox_text);
-	outbox_title_box->setValue(outbox_title);
-	outbox_placeholder_parent->setToolTip(outbox_tooltip);
-}
-
 void LLSidepanelInventory::updateVerbs()
 {
 	mInfoBtn->setEnabled(FALSE);
@@ -926,13 +678,6 @@ U32 LLSidepanelInventory::getSelectedCount()
 	{
 		selection_list = mInventoryPanelInbox->getRootFolder()->getSelectionList();
 
-	count += selection_list.size();
-	}
-
-	if ((count == 0) && mOutboxEnabled && (mInventoryPanelOutbox != NULL))
-	{
-		selection_list = mInventoryPanelOutbox->getRootFolder()->getSelectionList();
-		
 		count += selection_list.size();
 	}
 
@@ -957,7 +702,7 @@ BOOL LLSidepanelInventory::isMainInventoryPanelActive() const
 	return mInventoryPanel->getVisible();
 }
 
-void LLSidepanelInventory::clearSelections(bool clearMain, bool clearInbox, bool clearOutbox)
+void LLSidepanelInventory::clearSelections(bool clearMain, bool clearInbox)
 {
 	if (clearMain)
 	{
@@ -974,15 +719,10 @@ void LLSidepanelInventory::clearSelections(bool clearMain, bool clearInbox, bool
 		mInventoryPanelInbox->clearSelection();
 	}
 	
-	if (clearOutbox && mOutboxEnabled && (mInventoryPanelOutbox != NULL))
-	{
-		mInventoryPanelOutbox->clearSelection();
-	}
-	
 	updateVerbs();
 }
 
-std::set<LLUUID> LLSidepanelInventory::getInboxOrOutboxSelectionList()
+std::set<LLUUID> LLSidepanelInventory::getInboxSelectionList()
 {
 	std::set<LLUUID> inventory_selected_uuids;
 	
@@ -991,10 +731,5 @@ std::set<LLUUID> LLSidepanelInventory::getInboxOrOutboxSelectionList()
 		inventory_selected_uuids = mInventoryPanelInbox->getRootFolder()->getSelectionList();
 	}
 	
-	if (inventory_selected_uuids.empty() && mOutboxEnabled && (mInventoryPanelOutbox != NULL))
-	{
-		inventory_selected_uuids = mInventoryPanelOutbox->getRootFolder()->getSelectionList();
-	}
-	
 	return inventory_selected_uuids;
 }
diff --git a/indra/newview/llsidepanelinventory.h b/indra/newview/llsidepanelinventory.h
index 2c6f8070139d385cae10a337fe25d052217e1fe9..a33607f50d8a76177b133d0259118f325fad4ac6 100644
--- a/indra/newview/llsidepanelinventory.h
+++ b/indra/newview/llsidepanelinventory.h
@@ -31,7 +31,7 @@
 
 class LLButton;
 class LLFolderViewItem;
-class LLInboxOutboxAddedObserver;
+class LLInboxAddedObserver;
 class LLInventoryCategoriesObserver;
 class LLInventoryItem;
 class LLInventoryPanel;
@@ -47,25 +47,23 @@ class LLSidepanelInventory : public LLPanel
 	virtual ~LLSidepanelInventory();
 
 private:
-	void updateInboxOutbox();
+	void updateInbox();
 	
 public:
-	void observeInboxOutboxCreation();
+	void observeInboxCreation();
 	void observeInboxModifications(const LLUUID& inboxID);
-	void observeOutboxModifications(const LLUUID& outboxID);
 
 	/*virtual*/ BOOL postBuild();
 	/*virtual*/ void onOpen(const LLSD& key);
 
 	LLInventoryPanel* getActivePanel(); // Returns an active inventory panel, if any.
 	LLInventoryPanel* getInboxPanel() const { return mInventoryPanelInbox; }
-	LLInventoryPanel* getOutboxPanel() const { return mInventoryPanelOutbox; }
 
 	LLPanelMainInventory* getMainInventoryPanel() const { return mPanelMainInventory; }
 	BOOL isMainInventoryPanelActive() const;
 
-	void clearSelections(bool clearMain, bool clearInbox, bool clearOutbox);
-	std::set<LLUUID> getInboxOrOutboxSelectionList();
+	void clearSelections(bool clearMain, bool clearInbox);
+	std::set<LLUUID> getInboxSelectionList();
 
 	void showItemInfoPanel();
 	void showTaskInfoPanel();
@@ -75,18 +73,13 @@ class LLSidepanelInventory : public LLPanel
 	bool canShare();
 
 	void onToggleInboxBtn();
-	void onToggleOutboxBtn();
 
 	void enableInbox(bool enabled);
-	void enableOutbox(bool enabled);
 	
 	void openInbox();
-	void openOutbox();
 	
 	bool isInboxEnabled() const { return mInboxEnabled; }
-	bool isOutboxEnabled() const { return mOutboxEnabled; }
 
-	void updateOutboxUserStatus();
 	void updateVerbs();
 
 protected:
@@ -100,9 +93,6 @@ class LLSidepanelInventory : public LLPanel
 	bool canWearSelected(); // check whether selected items can be worn
 
 	void onInboxChanged(const LLUUID& inbox_id);
-	void onOutboxChanged(const LLUUID& outbox_id);
-
-	bool manageInboxOutboxPanels(LLButton * pressedButton, LLLayoutPanel * pressedPanel, LLButton * otherButton, LLLayoutPanel * otherPanel);
 
 	//
 	// UI Elements
@@ -110,7 +100,6 @@ class LLSidepanelInventory : public LLPanel
 private:
 	LLPanel*					mInventoryPanel; // Main inventory view
 	LLInventoryPanel*			mInventoryPanelInbox;
-	LLInventoryPanel*			mInventoryPanelOutbox;
 	LLSidepanelItemInfo*		mItemPanel; // Individual item view
 	LLSidepanelTaskInfo*		mTaskPanel; // Individual in-world object view
 	LLPanelMainInventory*		mPanelMainInventory;
@@ -135,10 +124,9 @@ class LLSidepanelInventory : public LLPanel
 	LLButton*					mShopBtn;
 
 	bool						mInboxEnabled;
-	bool						mOutboxEnabled;
 
-	LLInventoryCategoriesObserver* 			mCategoriesObserver;
-	LLInboxOutboxAddedObserver*				mInboxOutboxAddedObserver;
+	LLInventoryCategoriesObserver* 	mCategoriesObserver;
+	LLInboxAddedObserver*			mInboxAddedObserver;
 };
 
 #endif //LL_LLSIDEPANELINVENTORY_H
diff --git a/indra/newview/llsidepaneltaskinfo.cpp b/indra/newview/llsidepaneltaskinfo.cpp
index 8774482acdfd261da04de871b3faf603fe1ba4c8..24cb559fd058249cf163064d2161cd3cae6e9099 100644
--- a/indra/newview/llsidepaneltaskinfo.cpp
+++ b/indra/newview/llsidepaneltaskinfo.cpp
@@ -117,6 +117,42 @@ BOOL LLSidepanelTaskInfo::postBuild()
 	childSetCommitCallback("checkbox next owner can transfer",	&LLSidepanelTaskInfo::onCommitNextOwnerTransfer,this);
 	childSetCommitCallback("clickaction",						&LLSidepanelTaskInfo::onCommitClickAction,this);
 	childSetCommitCallback("search_check",						&LLSidepanelTaskInfo::onCommitIncludeInSearch,this);
+	
+	mDAPermModify = getChild<LLUICtrl>("perm_modify");
+	mDACreator = getChildView("Creator:");
+	mDACreatorName = getChild<LLUICtrl>("Creator Name");
+	mDAOwner = getChildView("Owner:");
+	mDAOwnerName = getChild<LLUICtrl>("Owner Name");
+	mDAGroup = getChildView("Group:");
+	mDAGroupName = getChild<LLUICtrl>("Group Name");
+	mDAButtonSetGroup = getChildView("button set group");
+	mDAObjectName = getChild<LLUICtrl>("Object Name");
+	mDAName = getChildView("Name:");
+	mDADescription = getChildView("Description:");
+	mDAObjectDescription = getChild<LLUICtrl>("Object Description");
+	mDAPermissions = getChildView("Permissions:");
+	mDACheckboxShareWithGroup = getChild<LLUICtrl>("checkbox share with group");
+	mDAButtonDeed = getChildView("button deed");
+	mDACheckboxAllowEveryoneMove = getChild<LLUICtrl>("checkbox allow everyone move");
+	mDACheckboxAllowEveryoneCopy = getChild<LLUICtrl>("checkbox allow everyone copy");
+	mDANextOwnerCan = getChildView("Next owner can:");
+	mDACheckboxNextOwnerCanModify = getChild<LLUICtrl>("checkbox next owner can modify");
+	mDACheckboxNextOwnerCanCopy = getChild<LLUICtrl>("checkbox next owner can copy");
+	mDACheckboxNextOwnerCanTransfer = getChild<LLUICtrl>("checkbox next owner can transfer");
+	mDACheckboxForSale = getChild<LLUICtrl>("checkbox for sale");
+	mDASearchCheck = getChild<LLUICtrl>("search_check");
+	mDAComboSaleType = getChild<LLComboBox>("sale type");
+	mDACost = getChild<LLUICtrl>("Cost");
+	mDAEditCost = getChild<LLUICtrl>("Edit Cost");
+	mDALabelClickAction = getChildView("label click action");
+	mDAComboClickAction = getChild<LLComboBox>("clickaction");
+	mDAB = getChildView("B:");
+	mDAO = getChildView("O:");
+	mDAG = getChildView("G:");
+	mDAE = getChildView("E:");
+	mDAN = getChildView("N:");
+	mDAF = getChildView("F:");
+	
 	return TRUE;
 }
 
@@ -138,81 +174,80 @@ BOOL LLSidepanelTaskInfo::postBuild()
 
 void LLSidepanelTaskInfo::disableAll()
 {
-	getChildView("perm_modify")->setEnabled(FALSE);
-	getChild<LLUICtrl>("perm_modify")->setValue(LLStringUtil::null);
-
-	getChildView("Creator:")->setEnabled(FALSE);
-	getChild<LLUICtrl>("Creator Name")->setValue(LLStringUtil::null);
-	getChildView("Creator Name")->setEnabled(FALSE);
-
-	getChildView("Owner:")->setEnabled(FALSE);
-	getChild<LLUICtrl>("Owner Name")->setValue(LLStringUtil::null);
-	getChildView("Owner Name")->setEnabled(FALSE);
-
-	getChildView("Group:")->setEnabled(FALSE);
-	getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null);
-	getChildView("Group Name")->setEnabled(FALSE);
-	getChildView("button set group")->setEnabled(FALSE);
-
-	getChild<LLUICtrl>("Object Name")->setValue(LLStringUtil::null);
-	getChildView("Object Name")->setEnabled(FALSE);
-	getChildView("Name:")->setEnabled(FALSE);
-	getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null);
-	getChildView("Group Name")->setEnabled(FALSE);
-	getChildView("Description:")->setEnabled(FALSE);
-	getChild<LLUICtrl>("Object Description")->setValue(LLStringUtil::null);
-	getChildView("Object Description")->setEnabled(FALSE);
-
-	getChildView("Permissions:")->setEnabled(FALSE);
+	mDAPermModify->setEnabled(FALSE);
+	mDAPermModify->setValue(LLStringUtil::null);
+
+	mDACreator->setEnabled(FALSE);
+	mDACreatorName->setValue(LLStringUtil::null);
+	mDACreatorName->setEnabled(FALSE);
+
+	mDAOwner->setEnabled(FALSE);
+	mDAOwnerName->setValue(LLStringUtil::null);
+	mDAOwnerName->setEnabled(FALSE);
+
+	mDAGroup->setEnabled(FALSE);
+	mDAGroupName->setValue(LLStringUtil::null);
+	mDAGroupName->setEnabled(FALSE);
+	mDAButtonSetGroup->setEnabled(FALSE);
+
+	mDAObjectName->setValue(LLStringUtil::null);
+	mDAObjectName->setEnabled(FALSE);
+	mDAName->setEnabled(FALSE);
+	mDAGroupName->setValue(LLStringUtil::null);
+	mDAGroupName->setEnabled(FALSE);
+	mDADescription->setEnabled(FALSE);
+	mDAObjectDescription->setValue(LLStringUtil::null);
+	mDAObjectDescription->setEnabled(FALSE);
+
+	mDAPermissions->setEnabled(FALSE);
 		
-	getChild<LLUICtrl>("checkbox share with group")->setValue(FALSE);
-	getChildView("checkbox share with group")->setEnabled(FALSE);
-	getChildView("button deed")->setEnabled(FALSE);
+	mDACheckboxShareWithGroup->setValue(FALSE);
+	mDACheckboxShareWithGroup->setEnabled(FALSE);
+	mDAButtonDeed->setEnabled(FALSE);
 
-	getChild<LLUICtrl>("checkbox allow everyone move")->setValue(FALSE);
-	getChildView("checkbox allow everyone move")->setEnabled(FALSE);
-	getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(FALSE);
-	getChildView("checkbox allow everyone copy")->setEnabled(FALSE);
+	mDACheckboxAllowEveryoneMove->setValue(FALSE);
+	mDACheckboxAllowEveryoneMove->setEnabled(FALSE);
+	mDACheckboxAllowEveryoneCopy->setValue(FALSE);
+	mDACheckboxAllowEveryoneCopy->setEnabled(FALSE);
 
 	//Next owner can:
-	getChildView("Next owner can:")->setEnabled(FALSE);
-	getChild<LLUICtrl>("checkbox next owner can modify")->setValue(FALSE);
-	getChildView("checkbox next owner can modify")->setEnabled(FALSE);
-	getChild<LLUICtrl>("checkbox next owner can copy")->setValue(FALSE);
-	getChildView("checkbox next owner can copy")->setEnabled(FALSE);
-	getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(FALSE);
-	getChildView("checkbox next owner can transfer")->setEnabled(FALSE);
+	mDANextOwnerCan->setEnabled(FALSE);
+	mDACheckboxNextOwnerCanModify->setValue(FALSE);
+	mDACheckboxNextOwnerCanModify->setEnabled(FALSE);
+	mDACheckboxNextOwnerCanCopy->setValue(FALSE);
+	mDACheckboxNextOwnerCanCopy->setEnabled(FALSE);
+	mDACheckboxNextOwnerCanTransfer->setValue(FALSE);
+	mDACheckboxNextOwnerCanTransfer->setEnabled(FALSE);
 
 	//checkbox for sale
-	getChild<LLUICtrl>("checkbox for sale")->setValue(FALSE);
-	getChildView("checkbox for sale")->setEnabled(FALSE);
+	mDACheckboxForSale->setValue(FALSE);
+	mDACheckboxForSale->setEnabled(FALSE);
 
 	//checkbox include in search
-	getChild<LLUICtrl>("search_check")->setValue(FALSE);
-	getChildView("search_check")->setEnabled(FALSE);
+	mDASearchCheck->setValue(FALSE);
+	mDASearchCheck->setEnabled(FALSE);
 		
-	LLComboBox*	combo_sale_type = getChild<LLComboBox>("sale type");
-	combo_sale_type->setValue(LLSaleInfo::FS_COPY);
-	combo_sale_type->setEnabled(FALSE);
+	mDAComboSaleType->setValue(LLSaleInfo::FS_COPY);
+	mDAComboSaleType->setEnabled(FALSE);
 		
-	getChildView("Cost")->setEnabled(FALSE);
-	getChild<LLUICtrl>("Cost")->setValue(getString("Cost Default"));
-	getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null);
-	getChildView("Edit Cost")->setEnabled(FALSE);
+	mDACost->setEnabled(FALSE);
+	mDACost->setValue(getString("Cost Default"));
+	mDAEditCost->setValue(LLStringUtil::null);
+	mDAEditCost->setEnabled(FALSE);
 		
-	getChildView("label click action")->setEnabled(FALSE);
-	LLComboBox*	combo_click_action = getChild<LLComboBox>("clickaction");
-	if (combo_click_action)
+	mDALabelClickAction->setEnabled(FALSE);
+	if (mDAComboClickAction)
 	{
-		combo_click_action->setEnabled(FALSE);
-		combo_click_action->clear();
+		mDAComboClickAction->setEnabled(FALSE);
+		mDAComboClickAction->clear();
 	}
-	getChildView("B:")->setVisible(								FALSE);
-	getChildView("O:")->setVisible(								FALSE);
-	getChildView("G:")->setVisible(								FALSE);
-	getChildView("E:")->setVisible(								FALSE);
-	getChildView("N:")->setVisible(								FALSE);
-	getChildView("F:")->setVisible(								FALSE);
+
+	mDAB->setVisible(FALSE);
+	mDAO->setVisible(FALSE);
+	mDAG->setVisible(FALSE);
+	mDAE->setVisible(FALSE);
+	mDAN->setVisible(FALSE);
+	mDAF->setVisible(FALSE);
 	
 	mOpenBtn->setEnabled(FALSE);
 	mPayBtn->setEnabled(FALSE);
diff --git a/indra/newview/llsidepaneltaskinfo.h b/indra/newview/llsidepaneltaskinfo.h
index 384bc479d6b64621dd3980a3110185fd3dfa6a1b..be0fee212727bc2bcd4b6969760b7bffbc30f038 100644
--- a/indra/newview/llsidepaneltaskinfo.h
+++ b/indra/newview/llsidepaneltaskinfo.h
@@ -37,8 +37,9 @@
 // Panel for permissions of an object.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-class LLNameBox;
 class LLCheckBoxCtrl;
+class LLComboBox;
+class LLNameBox;
 class LLViewerObject;
 
 class LLSidepanelTaskInfo : public LLSidepanelInventorySubpanel
@@ -118,6 +119,43 @@ class LLSidepanelTaskInfo : public LLSidepanelInventorySubpanel
 	LLPointer<LLViewerObject>	mObject;
 	LLObjectSelectionHandle		mObjectSelection;
 	static LLSidepanelTaskInfo* sActivePanel;
+	
+private:
+	// Pointers cached here to speed up the "disableAll" function which gets called on idle
+	LLUICtrl*	mDAPermModify;
+	LLView*		mDACreator;
+	LLUICtrl*	mDACreatorName;
+	LLView*		mDAOwner;
+	LLUICtrl*	mDAOwnerName;
+	LLView*		mDAGroup;
+	LLUICtrl*	mDAGroupName;
+	LLView*		mDAButtonSetGroup;
+	LLUICtrl*	mDAObjectName;
+	LLView*		mDAName;
+	LLView*		mDADescription;
+	LLUICtrl*	mDAObjectDescription;
+	LLView*		mDAPermissions;
+	LLUICtrl*	mDACheckboxShareWithGroup;
+	LLView*		mDAButtonDeed;
+	LLUICtrl*	mDACheckboxAllowEveryoneMove;
+	LLUICtrl*	mDACheckboxAllowEveryoneCopy;
+	LLView*		mDANextOwnerCan;
+	LLUICtrl*	mDACheckboxNextOwnerCanModify;
+	LLUICtrl*	mDACheckboxNextOwnerCanCopy;
+	LLUICtrl*	mDACheckboxNextOwnerCanTransfer;
+	LLUICtrl*	mDACheckboxForSale;
+	LLUICtrl*	mDASearchCheck;
+	LLComboBox*	mDAComboSaleType;
+	LLUICtrl*	mDACost;
+	LLUICtrl*	mDAEditCost;
+	LLView*		mDALabelClickAction;
+	LLComboBox*	mDAComboClickAction;
+	LLView*		mDAB;
+	LLView*		mDAO;
+	LLView*		mDAG;
+	LLView*		mDAE;
+	LLView*		mDAN;
+	LLView*		mDAF;
 };
 
 
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index 6c2b71dd0a0c539b1bb3755808dd3018f1389ad2..5d196a465f6bc3a9f4f5c2284ce95aa9752305f0 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -28,6 +28,10 @@
 
 #include "llspatialpartition.h"
 
+#include "llappviewer.h"
+#include "lltexturecache.h"
+#include "lltexturefetch.h"
+#include "llimageworker.h"
 #include "llviewerwindow.h"
 #include "llviewerobjectlist.h"
 #include "llvovolume.h"
@@ -48,6 +52,7 @@
 #include "llvolumemgr.h"
 #include "lltextureatlas.h"
 #include "llglslshader.h"
+#include "llviewershadermgr.h"
 
 static LLFastTimer::DeclareTimer FTM_FRUSTUM_CULL("Frustum Culling");
 static LLFastTimer::DeclareTimer FTM_CULL_REBOUND("Cull Rebound");
@@ -214,7 +219,7 @@ typedef enum
 //contact Runitai Linden for a copy of the SL object used to write this table
 //basically, you give the table a bitmask of the look-at vector to a node and it
 //gives you a triangle fan index array
-static U8 sOcclusionIndices[] =
+static U16 sOcclusionIndices[] =
 {
 	 //000
 		b111, b110, b010, b011, b001, b101, b100, b110,
@@ -251,7 +256,7 @@ U8* get_box_fan_indices_ptr(LLCamera* camera, const LLVector4a& center)
 
 	S32 cypher = center.greaterThan(origin).getGatheredBits() & 0x7;
 	
-	return sOcclusionIndices+cypher*8;
+	return (U8*) (sOcclusionIndices+cypher*8);
 }
 
 
@@ -259,9 +264,8 @@ static LLFastTimer::DeclareTimer FTM_BUILD_OCCLUSION("Build Occlusion");
 
 void LLSpatialGroup::buildOcclusion()
 {
-	if (mOcclusionVerts.isNull())
+	//if (mOcclusionVerts.isNull())
 	{
-
 		mOcclusionVerts = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX, 
 			LLVertexBuffer::sUseStreamDraw ? mBufferUsage : 0); //if GL has a hard time with VBOs, don't use them for occlusion culling.
 		mOcclusionVerts->allocateBuffer(8, 64, true);
@@ -321,7 +325,8 @@ void LLSpatialGroup::buildOcclusion()
 	}
 	
 	{
-		mOcclusionVerts->setBuffer(0);
+		mOcclusionVerts->flush();
+		LLVertexBuffer::unbind();
 	}
 
 	clearState(LLSpatialGroup::OCCLUSION_DIRTY);
@@ -721,7 +726,9 @@ void LLSpatialPartition::rebuildGeom(LLSpatialGroup* group)
 	if (vertex_count > 0 && index_count > 0)
 	{ //create vertex buffer containing volume geometry for this node
 		group->mBuilt = 1.f;
-		if (group->mVertexBuffer.isNull() || (group->mBufferUsage != group->mVertexBuffer->getUsage() && LLVertexBuffer::sEnableVBOs))
+		if (group->mVertexBuffer.isNull() ||
+			!group->mVertexBuffer->isWriteable() ||
+			(group->mBufferUsage != group->mVertexBuffer->getUsage() && LLVertexBuffer::sEnableVBOs))
 		{
 			group->mVertexBuffer = createVertexBuffer(mVertexDataMask, group->mBufferUsage);
 			group->mVertexBuffer->allocateBuffer(vertex_count, index_count, true);
@@ -1180,6 +1187,8 @@ void LLSpatialGroup::clearOcclusionState(U32 state, S32 mode)
 
 LLSpatialGroup::LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part) :
 	mState(0),
+	mGeometryBytes(0),
+	mSurfaceArea(0.f),
 	mBuilt(0.f),
 	mOctreeNode(node),
 	mSpatialPartition(part),
@@ -1220,6 +1229,7 @@ LLSpatialGroup::LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part) :
 	for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++)
 	{
 		mOcclusionQuery[i] = 0;
+		mOcclusionIssued[i] = 0;
 		mOcclusionState[i] = parent ? SG_STATE_INHERIT_MASK & parent->mOcclusionState[i] : 0;
 		mVisible[i] = 0;
 	}
@@ -1404,6 +1414,17 @@ void LLSpatialGroup::handleDestruction(const TreeNode* node)
 		}
 	}
 	
+	//clean up avatar attachment stats
+	LLSpatialBridge* bridge = mSpatialPartition->asBridge();
+	if (bridge)
+	{
+		if (bridge->mAvatar.notNull())
+		{
+			bridge->mAvatar->mAttachmentGeometryBytes -= mGeometryBytes;
+			bridge->mAvatar->mAttachmentSurfaceArea -= mSurfaceArea;
+		}
+	}
+
 	clearDrawMap();
 	mVertexBuffer = NULL;
 	mBufferMap.clear();
@@ -1542,6 +1563,8 @@ BOOL LLSpatialGroup::rebound()
 }
 
 static LLFastTimer::DeclareTimer FTM_OCCLUSION_READBACK("Readback Occlusion");
+static LLFastTimer::DeclareTimer FTM_OCCLUSION_WAIT("Wait");
+
 void LLSpatialGroup::checkOcclusion()
 {
 	if (LLPipeline::sUseOcclusion > 1)
@@ -1559,6 +1582,22 @@ void LLSpatialGroup::checkOcclusion()
 			if (mOcclusionQuery[LLViewerCamera::sCurCameraID])
 			{
 				glGetQueryObjectuivARB(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_AVAILABLE_ARB, &available);
+
+				if (mOcclusionIssued[LLViewerCamera::sCurCameraID] < gFrameCount)
+				{ //query was issued last frame, wait until it's available
+					S32 max_loop = 1024;
+					LLFastTimer t(FTM_OCCLUSION_WAIT);
+					while (!available && max_loop-- > 0)
+					{
+						F32 max_time = llmin(gFrameIntervalSeconds*10.f, 1.f);
+						//do some usefu work while we wait
+						LLAppViewer::getTextureCache()->update(max_time); // unpauses the texture cache thread
+						LLAppViewer::getImageDecodeThread()->update(max_time); // unpauses the image thread
+						LLAppViewer::getTextureFetch()->update(max_time); // unpauses the texture fetch thread
+						
+						glGetQueryObjectuivARB(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_AVAILABLE_ARB, &available);
+					}
+				}
 			}
 			else
 			{
@@ -1614,6 +1653,15 @@ void LLSpatialGroup::checkOcclusion()
 static LLFastTimer::DeclareTimer FTM_PUSH_OCCLUSION_VERTS("Push Occlusion");
 static LLFastTimer::DeclareTimer FTM_SET_OCCLUSION_STATE("Occlusion State");
 static LLFastTimer::DeclareTimer FTM_OCCLUSION_EARLY_FAIL("Occlusion Early Fail");
+static LLFastTimer::DeclareTimer FTM_OCCLUSION_ALLOCATE("Allocate");
+static LLFastTimer::DeclareTimer FTM_OCCLUSION_BUILD("Build");
+static LLFastTimer::DeclareTimer FTM_OCCLUSION_BEGIN_QUERY("Begin Query");
+static LLFastTimer::DeclareTimer FTM_OCCLUSION_END_QUERY("End Query");
+static LLFastTimer::DeclareTimer FTM_OCCLUSION_SET_BUFFER("Set Buffer");
+static LLFastTimer::DeclareTimer FTM_OCCLUSION_DRAW_WATER("Draw Water");
+static LLFastTimer::DeclareTimer FTM_OCCLUSION_DRAW("Draw");
+
+
 
 void LLSpatialGroup::doOcclusion(LLCamera* camera)
 {
@@ -1637,11 +1685,13 @@ void LLSpatialGroup::doOcclusion(LLCamera* camera)
 
 					if (!mOcclusionQuery[LLViewerCamera::sCurCameraID])
 					{
+						LLFastTimer t(FTM_OCCLUSION_ALLOCATE);
 						mOcclusionQuery[LLViewerCamera::sCurCameraID] = sQueryPool.allocate();
 					}
 
 					if (mOcclusionVerts.isNull() || isState(LLSpatialGroup::OCCLUSION_DIRTY))
 					{
+						LLFastTimer t(FTM_OCCLUSION_BUILD);
 						buildOcclusion();
 					}
 					
@@ -1666,12 +1716,24 @@ void LLSpatialGroup::doOcclusion(LLCamera* camera)
 
 					{
 						LLFastTimer t(FTM_PUSH_OCCLUSION_VERTS);
-						glBeginQueryARB(mode, mOcclusionQuery[LLViewerCamera::sCurCameraID]);					
+						
+						//store which frame this query was issued on
+						mOcclusionIssued[LLViewerCamera::sCurCameraID] = gFrameCount;
+
+						{
+							LLFastTimer t(FTM_OCCLUSION_BEGIN_QUERY);
+							glBeginQueryARB(mode, mOcclusionQuery[LLViewerCamera::sCurCameraID]);					
+						}
 					
-						mOcclusionVerts->setBuffer(LLVertexBuffer::MAP_VERTEX);
+						{
+							LLFastTimer t(FTM_OCCLUSION_SET_BUFFER);
+							mOcclusionVerts->setBuffer(LLVertexBuffer::MAP_VERTEX);
+						}
 
 						if (!use_depth_clamp && mSpatialPartition->mDrawableType == LLDrawPool::POOL_VOIDWATER)
 						{
+							LLFastTimer t(FTM_OCCLUSION_DRAW_WATER);
+
 							LLGLSquashToFarClip squash(glh_get_current_projection(), 1);
 							if (camera->getOrigin().isExactlyZero())
 							{ //origin is invalid, draw entire box
@@ -1685,6 +1747,7 @@ void LLSpatialGroup::doOcclusion(LLCamera* camera)
 						}
 						else
 						{
+							LLFastTimer t(FTM_OCCLUSION_DRAW);
 							if (camera->getOrigin().isExactlyZero())
 							{ //origin is invalid, draw entire box
 								mOcclusionVerts->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, 0);
@@ -1696,7 +1759,11 @@ void LLSpatialGroup::doOcclusion(LLCamera* camera)
 							}
 						}
 
-						glEndQueryARB(mode);
+
+						{
+							LLFastTimer t(FTM_OCCLUSION_END_QUERY);
+							glEndQueryARB(mode);
+						}
 					}
 				}
 
@@ -1713,7 +1780,7 @@ void LLSpatialGroup::doOcclusion(LLCamera* camera)
 //==============================================
 
 LLSpatialPartition::LLSpatialPartition(U32 data_mask, BOOL render_by_group, U32 buffer_usage)
-: mRenderByGroup(render_by_group)
+: mRenderByGroup(render_by_group), mBridge(NULL)
 {
 	LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION);
 	mOcclusionEnabled = TRUE;
@@ -2416,7 +2483,7 @@ void pushVerts(LLFace* face, U32 mask)
 
 	LLVertexBuffer* buffer = face->getVertexBuffer();
 
-	if (buffer)
+	if (buffer && (face->getGeomCount() >= 3))
 	{
 		buffer->setBuffer(mask);
 		U16 start = face->getGeomStart();
@@ -2441,8 +2508,7 @@ void pushVerts(LLVolume* volume)
 	for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i)
 	{
 		const LLVolumeFace& face = volume->getVolumeFace(i);
-		glVertexPointer(3, GL_FLOAT, 16, face.mPositions);
-		glDrawElements(GL_TRIANGLES, face.mNumIndices, GL_UNSIGNED_SHORT, face.mIndices);
+		LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mPositions, NULL, face.mNumIndices, face.mIndices);
 	}
 }
 
@@ -2451,7 +2517,7 @@ void pushBufferVerts(LLVertexBuffer* buffer, U32 mask)
 	if (buffer)
 	{
 		buffer->setBuffer(mask);
-		buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getRequestedVerts()-1, buffer->getRequestedIndices(), 0);
+		buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
 	}
 }
 
@@ -2508,7 +2574,7 @@ void pushVertsColorCoded(LLSpatialGroup* group, U32 mask)
 		{
 			params = *j;
 			LLRenderPass::applyModelMatrix(*params);
-			glColor4f(colors[col].mV[0], colors[col].mV[1], colors[col].mV[2], 0.5f);
+			gGL.diffuseColor4f(colors[col].mV[0], colors[col].mV[1], colors[col].mV[2], 0.5f);
 			params->mVertexBuffer->setBuffer(mask);
 			params->mVertexBuffer->drawRange(params->mParticle ? LLRender::POINTS : LLRender::TRIANGLES,
 				params->mStart, params->mEnd, params->mCount, params->mOffset);
@@ -2523,7 +2589,7 @@ void renderOctree(LLSpatialGroup* group)
 	//coded by buffer usage and activity
 	gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);
 	LLVector4 col;
-	/*if (group->mBuilt > 0.f)
+	if (group->mBuilt > 0.f)
 	{
 		group->mBuilt -= 2.f * gFrameIntervalSeconds;
 		if (group->mBufferUsage == GL_STATIC_DRAW_ARB)
@@ -2541,7 +2607,7 @@ void renderOctree(LLSpatialGroup* group)
 			LLGLDepthTest gl_depth(FALSE, FALSE);
 			glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
 
-			gGL.color4f(1,0,0,group->mBuilt);
+			gGL.diffuseColor4f(1,0,0,group->mBuilt);
 			gGL.flush();
 			glLineWidth(5.f);
 			drawBoxOutline(group->mObjectBounds[0], group->mObjectBounds[1]);
@@ -2553,9 +2619,9 @@ void renderOctree(LLSpatialGroup* group)
 				LLDrawable* drawable = *i;
 				if (!group->mSpatialPartition->isBridge())
 				{
-					glPushMatrix();
+					gGL.pushMatrix();
 					LLVector3 trans = drawable->getRegion()->getOriginAgent();
-					glTranslatef(trans.mV[0], trans.mV[1], trans.mV[2]);
+					gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]);
 				}
 				
 				for (S32 j = 0; j < drawable->getNumFaces(); j++)
@@ -2565,11 +2631,11 @@ void renderOctree(LLSpatialGroup* group)
 					{
 						if (gFrameTimeSeconds - face->mLastUpdateTime < 0.5f)
 						{
-							glColor4f(0, 1, 0, group->mBuilt);
+							gGL.diffuseColor4f(0, 1, 0, group->mBuilt);
 						}
 						else if (gFrameTimeSeconds - face->mLastMoveTime < 0.5f)
 						{
-							glColor4f(1, 0, 0, group->mBuilt);
+							gGL.diffuseColor4f(1, 0, 0, group->mBuilt);
 						}
 						else
 						{
@@ -2585,14 +2651,14 @@ void renderOctree(LLSpatialGroup* group)
 
 				if (!group->mSpatialPartition->isBridge())
 				{
-					glPopMatrix();
+					gGL.popMatrix();
 				}
 			}
 			glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-			gGL.color4f(1,1,1,1);
+			gGL.diffuseColor4f(1,1,1,1);
 		}
 	}
-	else*/
+	else
 	{
 		if (group->mBufferUsage == GL_STATIC_DRAW_ARB && !group->getData().empty() 
 			&& group->mSpatialPartition->mRenderByGroup)
@@ -2605,7 +2671,7 @@ void renderOctree(LLSpatialGroup* group)
 		}
 	}
 
-	gGL.color4fv(col.mV);
+	gGL.diffuseColor4fv(col.mV);
 	LLVector4a fudge;
 	fudge.splat(0.001f);
 	LLVector4a size = group->mObjectBounds[1];
@@ -2622,16 +2688,16 @@ void renderOctree(LLSpatialGroup* group)
 	//if (group->mBuilt <= 0.f)
 	{
 		//draw opaque outline
-		//gGL.color4f(col.mV[0], col.mV[1], col.mV[2], 1.f);
+		//gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], 1.f);
 		//drawBoxOutline(group->mObjectBounds[0], group->mObjectBounds[1]);
 
-		gGL.color4f(0,1,1,1);
+		gGL.diffuseColor4f(0,1,1,1);
 		drawBoxOutline(group->mBounds[0],group->mBounds[1]);
 		
 		//draw bounding box for draw info
 		/*if (group->mSpatialPartition->mRenderByGroup)
 		{
-			gGL.color4f(1.0f, 0.75f, 0.25f, 0.6f);
+			gGL.diffuseColor4f(1.0f, 0.75f, 0.25f, 0.6f);
 			for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i)
 			{
 				for (LLSpatialGroup::drawmap_elem_t::iterator j = i->second.begin(); j != i->second.end(); ++j)
@@ -2650,7 +2716,7 @@ void renderOctree(LLSpatialGroup* group)
 	}
 	
 //	LLSpatialGroup::OctreeNode* node = group->mOctreeNode;
-//	gGL.color4f(0,1,0,1);
+//	gGL.diffuseColor4f(0,1,0,1);
 //	drawBoxOutline(LLVector3(node->getCenter()), LLVector3(node->getSize()));
 }
 
@@ -2663,11 +2729,12 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)
 
 	BOOL render_objects = (!LLPipeline::sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) && group->isVisible() &&
 							!group->getData().empty();
+
 	if (render_objects)
 	{
 		LLGLDepthTest depth_under(GL_TRUE, GL_FALSE, GL_GREATER);
-		glColor4f(0, 0.5f, 0, 0.5f);
-		gGL.color4f(0, 0.5f, 0, 0.5f);
+		gGL.diffuseColor4f(0, 0.5f, 0, 0.5f);
+		gGL.diffuseColor4f(0, 0.5f, 0, 0.5f);
 		pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX);
 	}
 
@@ -2676,8 +2743,8 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)
 
 		if (render_objects)
 		{
-			glColor4f(0.f, 0.5f, 0.f,1.f);
-			gGL.color4f(0.f, 0.5f, 0.f, 1.f);
+			gGL.diffuseColor4f(0.f, 0.5f, 0.f,1.f);
+			gGL.diffuseColor4f(0.f, 0.5f, 0.f, 1.f);
 			pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX);
 		}
 
@@ -2685,8 +2752,8 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)
 
 		if (render_objects)
 		{
-			glColor4f(0.f, 0.75f, 0.f,0.5f);
-			gGL.color4f(0.f, 0.75f, 0.f, 0.5f);
+			gGL.diffuseColor4f(0.f, 0.75f, 0.f,0.5f);
+			gGL.diffuseColor4f(0.f, 0.75f, 0.f, 0.5f);
 			pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX);
 		}
 		/*else if (camera && group->mOcclusionVerts.notNull())
@@ -2694,11 +2761,11 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)
 			LLVertexBuffer::unbind();
 			group->mOcclusionVerts->setBuffer(LLVertexBuffer::MAP_VERTEX);
 			
-			glColor4f(1.0f, 0.f, 0.f, 0.5f);
+			gGL.diffuseColor4f(1.0f, 0.f, 0.f, 0.5f);
 			group->mOcclusionVerts->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, group->mBounds[0]));
 			glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
 			
-			glColor4f(1.0f, 1.f, 1.f, 1.0f);
+			gGL.diffuseColor4f(1.0f, 1.f, 1.f, 1.0f);
 			group->mOcclusionVerts->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, group->mBounds[0]));
 			glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
 		}*/
@@ -2707,7 +2774,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)
 
 void renderCrossHairs(LLVector3 position, F32 size, LLColor4 color)
 {
-	gGL.color4fv(color.mV);
+	gGL.diffuseColor4fv(color.mV);
 	gGL.begin(LLRender::LINES);
 	{
 		gGL.vertex3fv((position - LLVector3(size, 0.f, 0.f)).mV);
@@ -2731,23 +2798,23 @@ void renderUpdateType(LLDrawable* drawablep)
 	switch (vobj->getLastUpdateType())
 	{
 	case OUT_FULL:
-		glColor4f(0,1,0,0.5f);
+		gGL.diffuseColor4f(0,1,0,0.5f);
 		break;
 	case OUT_TERSE_IMPROVED:
-		glColor4f(0,1,1,0.5f);
+		gGL.diffuseColor4f(0,1,1,0.5f);
 		break;
 	case OUT_FULL_COMPRESSED:
 		if (vobj->getLastUpdateCached())
 		{
-			glColor4f(1,0,0,0.5f);
+			gGL.diffuseColor4f(1,0,0,0.5f);
 		}
 		else
 		{
-			glColor4f(1,1,0,0.5f);
+			gGL.diffuseColor4f(1,1,0,0.5f);
 		}
 		break;
 	case OUT_FULL_CACHED:
-		glColor4f(0,0,1,0.5f);
+		gGL.diffuseColor4f(0,0,1,0.5f);
 		break;
 	default:
 		llwarns << "Unknown update_type " << vobj->getLastUpdateType() << llendl;
@@ -2879,17 +2946,17 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE)
 	{
 		if (drawable->isSpatialBridge())
 		{
-			gGL.color4f(1,0.5f,0,1);
+			gGL.diffuseColor4f(1,0.5f,0,1);
 		}
 		else if (drawable->getVOVolume())
 		{
 			if (drawable->isRoot())
 			{
-				gGL.color4f(1,1,0,1);
+				gGL.diffuseColor4f(1,1,0,1);
 			}
 			else
 			{
-				gGL.color4f(0,1,0,1);
+				gGL.diffuseColor4f(0,1,0,1);
 			}
 		}
 		else if (drawable->getVObj())
@@ -2897,30 +2964,30 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE)
 			switch (drawable->getVObj()->getPCode())
 			{
 				case LLViewerObject::LL_VO_SURFACE_PATCH:
-						gGL.color4f(0,1,1,1);
+						gGL.diffuseColor4f(0,1,1,1);
 						break;
 				case LLViewerObject::LL_VO_CLOUDS:
 						// no longer used
 						break;
 				case LLViewerObject::LL_VO_PART_GROUP:
 				case LLViewerObject::LL_VO_HUD_PART_GROUP:
-						gGL.color4f(0,0,1,1);
+						gGL.diffuseColor4f(0,0,1,1);
 						break;
 				case LLViewerObject::LL_VO_VOID_WATER:
 				case LLViewerObject::LL_VO_WATER:
-						gGL.color4f(0,0.5f,1,1);
+						gGL.diffuseColor4f(0,0.5f,1,1);
 						break;
 				case LL_PCODE_LEGACY_TREE:
-						gGL.color4f(0,0.5f,0,1);
+						gGL.diffuseColor4f(0,0.5f,0,1);
 						break;
 				default:
-						gGL.color4f(1,0,1,1);
+						gGL.diffuseColor4f(1,0,1,1);
 						break;
 			}
 		}
 		else 
 		{
-			gGL.color4f(1,0,0,1);
+			gGL.diffuseColor4f(1,0,0,1);
 		}
 	}
 
@@ -2976,7 +3043,7 @@ void renderNormals(LLDrawable* drawablep)
 	{
 		LLVolume* volume = vol->getVolume();
 		gGL.pushMatrix();
-		glMultMatrixf((F32*) vol->getRelativeXform().mMatrix);
+		gGL.multMatrix((F32*) vol->getRelativeXform().mMatrix);
 		
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 
@@ -2986,16 +3053,15 @@ void renderNormals(LLDrawable* drawablep)
 		{
 			const LLVolumeFace& face = volume->getVolumeFace(i);
 
-			gGL.begin(LLRender::LINES);
-			
 			for (S32 j = 0; j < face.mNumVertices; ++j)
 			{
+				gGL.begin(LLRender::LINES);
 				LLVector4a n,p;
 				
 				n.setMul(face.mNormals[j], scale);
 				p.setAdd(face.mPositions[j], n);
 				
-				gGL.color4f(1,1,1,1);
+				gGL.diffuseColor4f(1,1,1,1);
 				gGL.vertex3fv(face.mPositions[j].getF32ptr());
 				gGL.vertex3fv(p.getF32ptr());
 				
@@ -3004,13 +3070,12 @@ void renderNormals(LLDrawable* drawablep)
 					n.setMul(face.mBinormals[j], scale);
 					p.setAdd(face.mPositions[j], n);
 				
-					gGL.color4f(0,1,1,1);
+					gGL.diffuseColor4f(0,1,1,1);
 					gGL.vertex3fv(face.mPositions[j].getF32ptr());
 					gGL.vertex3fv(p.getF32ptr());
 				}	
+				gGL.end();
 			}
-
-			gGL.end();
 		}
 
 		gGL.popMatrix();
@@ -3050,33 +3115,33 @@ void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color, LLCo
 	{		
 		if (!decomp->mBaseHullMesh.empty())
 		{
-			glColor4fv(color.mV);
+			gGL.diffuseColor4fv(color.mV);
 			LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mBaseHullMesh.mPositions, decomp->mBaseHullMesh.mNormals);
 		}
 		else
 		{
 			gMeshRepo.buildPhysicsMesh(*decomp);
-			gGL.color3f(0,1,1);
+			gGL.diffuseColor4f(0,1,1,1);
 			drawBoxOutline(center, size);
 		}
 
 	}
 	else
 	{
-		gGL.color3f(1,0,1);
+		gGL.diffuseColor3f(1,0,1);
 		drawBoxOutline(center, size);
 	}
 }
 
 void render_hull(LLModel::PhysicsMesh& mesh, const LLColor4& color, const LLColor4& line_color)
 {
-	glColor4fv(color.mV);
+	gGL.diffuseColor4fv(color.mV);
 	LLVertexBuffer::drawArrays(LLRender::TRIANGLES, mesh.mPositions, mesh.mNormals);
 	LLGLEnable offset(GL_POLYGON_OFFSET_LINE);
 	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
 	glPolygonOffset(3.f, 3.f);
 	glLineWidth(3.f);
-	glColor4fv(line_color.mV);
+	gGL.diffuseColor4fv(line_color.mV);
 	LLVertexBuffer::drawArrays(LLRender::TRIANGLES, mesh.mPositions, mesh.mNormals);
 	glLineWidth(1.f);
 	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
@@ -3130,7 +3195,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
 	LLVector3 size(0.25f,0.25f,0.25f);
 
 	gGL.pushMatrix();
-	glMultMatrixf((F32*) volume->getRelativeXform().mMatrix);
+	gGL.multMatrix((F32*) volume->getRelativeXform().mMatrix);
 		
 	if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::USER_MESH)
 	{
@@ -3158,11 +3223,11 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
 			else if (!decomp->mPhysicsShapeMesh.empty())
 			{ 
 				//decomp has physics mesh, render that mesh
-				glColor4fv(color.mV);
+				gGL.diffuseColor4fv(color.mV);
 				LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mPhysicsShapeMesh.mPositions, decomp->mPhysicsShapeMesh.mNormals);
 								
 				glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-				glColor4fv(line_color.mV);
+				gGL.diffuseColor4fv(line_color.mV);
 				LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mPhysicsShapeMesh.mPositions, decomp->mPhysicsShapeMesh.mNormals);
 				glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
 			}
@@ -3179,7 +3244,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
 		}
 		else
 		{	
-			gGL.color3f(1,1,0);
+			gGL.diffuseColor3f(1,1,0);
 			drawBoxOutline(center, size);
 		}
 	}
@@ -3190,7 +3255,6 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
 		{
 			renderMeshBaseHull(volume, data_mask, color, line_color);
 		}
-#if LL_WINDOWS 
 		else
 		{
 			LLVolumeParams volume_params = volume->getVolume()->getParams();
@@ -3288,27 +3352,26 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
 			
 				glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
 				
-				glColor4fv(line_color.mV);
+				gGL.diffuseColor4fv(line_color.mV);
 				LLVertexBuffer::unbind();
 
 				llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShader != 0);
-
-				glVertexPointer(3, GL_FLOAT, 16, phys_volume->mHullPoints);
-				glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices);
+							
+				LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices);
 				
-				glColor4fv(color.mV);
+				gGL.diffuseColor4fv(color.mV);
 				glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-				glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices);
+				LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices);
+				
 			}
 			else
 			{
-				gGL.color3f(1,0,1);
+				gGL.diffuseColor4f(1,0,1,1);
 				drawBoxOutline(center, size);
 			}
 
 			LLPrimitive::sVolumeManager->unrefVolume(phys_volume);
 		}
-#endif //LL_WINDOWS			
 	}
 	else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::BOX)
 	{
@@ -3317,12 +3380,12 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
 		LLVector3 vscale = volume->getScale()*2.f;
 		scale.set(scale[0]/vscale[0], scale[1]/vscale[1], scale[2]/vscale[2]);
 		
-		gGL.color4fv(color.mV);
+		gGL.diffuseColor4fv(color.mV);
 		drawBox(center, scale);
 	}
 	else if	(type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::SPHERE)
 	{
-		LLVolumeParams volume_params;
+		/*LLVolumeParams volume_params;
 		volume_params.setType( LL_PCODE_PROFILE_CIRCLE_HALF, LL_PCODE_PATH_CIRCLE );
 		volume_params.setBeginAndEndS( 0.f, 1.f );
 		volume_params.setBeginAndEndT( 0.f, 1.f );
@@ -3330,9 +3393,9 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
 		volume_params.setShear	( 0, 0 );
 		LLVolume* sphere = LLPrimitive::sVolumeManager->refVolume(volume_params, 3);
 		
-		glColor4fv(color.mV);
+		gGL.diffuseColor4fv(color.mV);
 		pushVerts(sphere);
-		LLPrimitive::sVolumeManager->unrefVolume(sphere);
+		LLPrimitive::sVolumeManager->unrefVolume(sphere);*/
 	}
 	else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::CYLINDER)
 	{
@@ -3344,7 +3407,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
 		volume_params.setShear	( 0, 0 );
 		LLVolume* cylinder = LLPrimitive::sVolumeManager->refVolume(volume_params, 3);
 		
-		glColor4fv(color.mV);
+		gGL.diffuseColor4fv(color.mV);
 		pushVerts(cylinder);
 		LLPrimitive::sVolumeManager->unrefVolume(cylinder);
 	}
@@ -3356,10 +3419,10 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
 		LLVolume* phys_volume = LLPrimitive::sVolumeManager->refVolume(volume_params, detail);
 		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
 		
-		glColor4fv(line_color.mV);
+		gGL.diffuseColor4fv(line_color.mV);
 		pushVerts(phys_volume);
 		
-		glColor4fv(color.mV);
+		gGL.diffuseColor4fv(color.mV);
 		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
 		pushVerts(phys_volume);
 		LLPrimitive::sVolumeManager->unrefVolume(phys_volume);
@@ -3377,16 +3440,17 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
 			llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShader != 0);
 			LLVertexBuffer::unbind();
 			glVertexPointer(3, GL_FLOAT, 16, phys_volume->mHullPoints);
-			glColor4fv(line_color.mV);
+			gGL.diffuseColor4fv(line_color.mV);
+			gGL.syncMatrices();
 			glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices);
 			
-			glColor4fv(color.mV);
+			gGL.diffuseColor4fv(color.mV);
 			glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
 			glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices);			
 		}
 		else
 		{
-			gGL.color3f(1,0,1);
+			gGL.diffuseColor3f(1,0,1);
 			drawBoxOutline(center, size);
 			gMeshRepo.buildHull(volume_params, detail);
 		}
@@ -3402,15 +3466,6 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
 	}
 
 	gGL.popMatrix();
-
-	/*{ //analytical shape, just push visual rep.
-		glColor3fv(color.mV);
-		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-		pushVerts(drawable, data_mask);
-		glColor4fv(color.mV);
-		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-		pushVerts(drawable, data_mask);
-	}*/
 }
 
 void renderPhysicsShapes(LLSpatialGroup* group)
@@ -3425,7 +3480,7 @@ void renderPhysicsShapes(LLSpatialGroup* group)
 			{
 				gGL.pushMatrix();
 				LLVector3 trans = drawable->getRegion()->getOriginAgent();
-				glTranslatef(trans.mV[0], trans.mV[1], trans.mV[2]);
+				gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]);
 				renderPhysicsShape(drawable, volume);
 				gGL.popMatrix();
 			}
@@ -3449,12 +3504,12 @@ void renderPhysicsShapes(LLSpatialGroup* group)
 						glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
 
 						buff->setBuffer(LLVertexBuffer::MAP_VERTEX);
-						glColor3f(0.2f, 0.5f, 0.3f);
-						buff->draw(LLRender::TRIANGLES, buff->getRequestedIndices(), 0);
+						gGL.diffuseColor3f(0.2f, 0.5f, 0.3f);
+						buff->draw(LLRender::TRIANGLES, buff->getNumIndices(), 0);
 									
-						glColor3f(0.2f, 1.f, 0.3f);
+						gGL.diffuseColor3f(0.2f, 1.f, 0.3f);
 						glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-						buff->draw(LLRender::TRIANGLES, buff->getRequestedIndices(), 0);
+						buff->draw(LLRender::TRIANGLES, buff->getNumIndices(), 0);
 					}
 				}
 			}
@@ -3491,11 +3546,11 @@ void renderTexturePriority(LLDrawable* drawable)
 			F32 t = vsize/sLastMaxTexPriority;
 			
 			LLVector4 col = lerp(cold, hot, t);
-			gGL.color4fv(col.mV);
+			gGL.diffuseColor4fv(col.mV);
 		}
 		//else
 		//{
-		//	gGL.color4f(1,0,1,1);
+		//	gGL.diffuseColor4f(1,0,1,1);
 		//}
 		
 		LLVector4a center;
@@ -3514,7 +3569,7 @@ void renderTexturePriority(LLDrawable* drawable)
 			LLVector4 col = lerp(boost_cold, boost_hot, t);
 			LLGLEnable blend_on(GL_BLEND);
 			gGL.blendFunc(GL_SRC_ALPHA, GL_ONE);
-			gGL.color4fv(col.mV);
+			gGL.diffuseColor4fv(col.mV);
 			drawBox(center, size);
 			gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 		}*/
@@ -3527,7 +3582,7 @@ void renderPoints(LLDrawable* drawablep)
 	if (drawablep->getNumFaces())
 	{
 		gGL.begin(LLRender::POINTS);
-		gGL.color3f(1,1,1);
+		gGL.diffuseColor3f(1,1,1);
 		for (S32 i = 0; i < drawablep->getNumFaces(); i++)
 		{
 			gGL.vertex3fv(drawablep->getFace(i)->mCenterLocal.mV);
@@ -3544,7 +3599,7 @@ void renderTextureAnim(LLDrawInfo* params)
 	}
 	
 	LLGLEnable blend(GL_BLEND);
-	glColor4f(1,1,0,0.5f);
+	gGL.diffuseColor4f(1,1,0,0.5f);
 	pushVerts(params, LLVertexBuffer::MAP_VERTEX);
 }
 
@@ -3552,7 +3607,7 @@ void renderBatchSize(LLDrawInfo* params)
 {
 	LLGLEnable offset(GL_POLYGON_OFFSET_FILL);
 	glPolygonOffset(-1.f, 1.f);
-	glColor3ubv((GLubyte*) &(params->mDebugColor));
+	gGL.diffuseColor4ubv((GLubyte*) &(params->mDebugColor));
 	pushVerts(params, LLVertexBuffer::MAP_VERTEX);
 }
 
@@ -3570,22 +3625,22 @@ void renderShadowFrusta(LLDrawInfo* params)
 
 	if (gPipeline.mShadowCamera[4].AABBInFrustum(center, size))
 	{
-		glColor3f(1,0,0);
+		gGL.diffuseColor3f(1,0,0);
 		pushVerts(params, LLVertexBuffer::MAP_VERTEX);
 	}
 	if (gPipeline.mShadowCamera[5].AABBInFrustum(center, size))
 	{
-		glColor3f(0,1,0);
+		gGL.diffuseColor3f(0,1,0);
 		pushVerts(params, LLVertexBuffer::MAP_VERTEX);
 	}
 	if (gPipeline.mShadowCamera[6].AABBInFrustum(center, size))
 	{
-		glColor3f(0,0,1);
+		gGL.diffuseColor3f(0,0,1);
 		pushVerts(params, LLVertexBuffer::MAP_VERTEX);
 	}
 	if (gPipeline.mShadowCamera[7].AABBInFrustum(center, size))
 	{
-		glColor3f(1,0,1);
+		gGL.diffuseColor3f(1,0,1);
 		pushVerts(params, LLVertexBuffer::MAP_VERTEX);
 	}
 
@@ -3603,7 +3658,7 @@ void renderLights(LLDrawable* drawablep)
 	if (drawablep->getNumFaces())
 	{
 		LLGLEnable blend(GL_BLEND);
-		glColor4f(0,1,1,0.5f);
+		gGL.diffuseColor4f(0,1,1,0.5f);
 
 		for (S32 i = 0; i < drawablep->getNumFaces(); i++)
 		{
@@ -3621,11 +3676,11 @@ void renderLights(LLDrawable* drawablep)
 
 		{
 			LLGLDepthTest depth(GL_FALSE, GL_TRUE);
-			gGL.color4f(1,1,1,1);
+			gGL.diffuseColor4f(1,1,1,1);
 			drawBoxOutline(pos, size);
 		}
 
-		gGL.color4f(1,1,0,1);
+		gGL.diffuseColor4f(1,1,0,1);
 		F32 rad = drawablep->getVOVolume()->getLightRadius();
 		drawBoxOutline(pos, LLVector4a(rad));
 	}
@@ -3650,13 +3705,13 @@ class LLRenderOctreeRaycast : public LLOctreeTriangleRayIntersect
 		
 		if (branch->getData().empty())
 		{
-			gGL.color3f(1.f,0.2f,0.f);
+			gGL.diffuseColor3f(1.f,0.2f,0.f);
 			center.set(branch->getCenter().getF32ptr());
 			size.set(branch->getSize().getF32ptr());
 		}
 		else
 		{
-			gGL.color3f(0.75f, 1.f, 0.f);
+			gGL.diffuseColor3f(0.75f, 1.f, 0.f);
 			center.set(vl->mBounds[0].getF32ptr());
 			size.set(vl->mBounds[1].getF32ptr());
 		}
@@ -3669,11 +3724,11 @@ class LLRenderOctreeRaycast : public LLOctreeTriangleRayIntersect
 
 			if (i == 1)
 			{
-				gGL.color4f(0,1,1,0.5f);
+				gGL.diffuseColor4f(0,1,1,0.5f);
 			}
 			else
 			{
-				gGL.color4f(0,0.5f,0.5f, 0.25f);
+				gGL.diffuseColor4f(0,0.5f,0.5f, 0.25f);
 				drawBoxOutline(center, size);
 			}
 			
@@ -3710,7 +3765,7 @@ void renderRaycast(LLDrawable* drawablep)
 	if (drawablep->getNumFaces())
 	{
 		LLGLEnable blend(GL_BLEND);
-		gGL.color4f(0,1,1,0.5f);
+		gGL.diffuseColor4f(0,1,1,0.5f);
 
 		if (drawablep->getVOVolume())
 		{
@@ -3735,14 +3790,10 @@ void renderRaycast(LLDrawable* drawablep)
 				for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i)
 				{
 					const LLVolumeFace& face = volume->getVolumeFace(i);
-					if (!face.mOctree)
-					{
-						((LLVolumeFace*) &face)->createOctree(); 
-					}
-
+					
 					gGL.pushMatrix();
-					glTranslatef(trans.mV[0], trans.mV[1], trans.mV[2]);					
-					glMultMatrixf((F32*) vobj->getRelativeXform().mMatrix);
+					gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]);					
+					gGL.multMatrix((F32*) vobj->getRelativeXform().mMatrix);
 
 					LLVector3 start, end;
 					if (transform)
@@ -3762,21 +3813,32 @@ void renderRaycast(LLDrawable* drawablep)
 					LLVector4a dir;
 					dir.setSub(enda, starta);
 
-					F32 t = 1.f;
-
-					LLRenderOctreeRaycast render(starta, dir, &t);
 					gGL.flush();
 					glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);				
 
 					{
 						//render face positions
 						LLVertexBuffer::unbind();
-						glColor4f(0,1,1,0.5f);
+						gGL.diffuseColor4f(0,1,1,0.5f);
 						glVertexPointer(3, GL_FLOAT, sizeof(LLVector4a), face.mPositions);
+						gGL.syncMatrices();
 						glDrawElements(GL_TRIANGLES, face.mNumIndices, GL_UNSIGNED_SHORT, face.mIndices);
 					}
-						
-					render.traverse(face.mOctree);
+					
+					if (!volume->isUnique())
+					{
+						F32 t = 1.f;
+
+						if (!face.mOctree)
+						{
+							((LLVolumeFace*) &face)->createOctree(); 
+						}
+
+						LLRenderOctreeRaycast render(starta, dir, &t);
+					
+						render.traverse(face.mOctree);
+					}
+
 					gGL.popMatrix();		
 					glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
 				}
@@ -3795,23 +3857,23 @@ void renderRaycast(LLDrawable* drawablep)
 		if (drawablep->getVObj() == gDebugRaycastObject)
 		{
 			// draw intersection point
-			glPushMatrix();
-			glLoadMatrixd(gGLModelView);
+			gGL.pushMatrix();
+			gGL.loadMatrix(gGLModelView);
 			LLVector3 translate = gDebugRaycastIntersection;
-			glTranslatef(translate.mV[0], translate.mV[1], translate.mV[2]);
+			gGL.translatef(translate.mV[0], translate.mV[1], translate.mV[2]);
 			LLCoordFrame orient;
 			orient.lookDir(gDebugRaycastNormal, gDebugRaycastBinormal);
 			LLMatrix4 rotation;
 			orient.getRotMatrixToParent(rotation);
-			glMultMatrixf((float*)rotation.mMatrix);
+			gGL.multMatrix((float*)rotation.mMatrix);
 			
-			gGL.color4f(1,0,0,0.5f);
+			gGL.diffuseColor4f(1,0,0,0.5f);
 			drawBox(LLVector3(0, 0, 0), LLVector3(0.1f, 0.022f, 0.022f));
-			gGL.color4f(0,1,0,0.5f);
+			gGL.diffuseColor4f(0,1,0,0.5f);
 			drawBox(LLVector3(0, 0, 0), LLVector3(0.021f, 0.1f, 0.021f));
-			gGL.color4f(0,0,1,0.5f);
+			gGL.diffuseColor4f(0,0,1,0.5f);
 			drawBox(LLVector3(0, 0, 0), LLVector3(0.02f, 0.02f, 0.1f));
-			glPopMatrix();
+			gGL.popMatrix();
 
 			// draw bounding box of prim
 			const LLVector4a* ext = drawablep->getSpatialExtents();
@@ -3824,7 +3886,7 @@ void renderRaycast(LLDrawable* drawablep)
 			size.mul(0.5f);
 
 			LLGLDepthTest depth(GL_FALSE, GL_TRUE);
-			gGL.color4f(0,0.5f,0.5f,1);
+			gGL.diffuseColor4f(0,0.5f,0.5f,1);
 			drawBoxOutline(pos, size);		
 		}
 	}
@@ -3886,14 +3948,14 @@ class LLOctreeRenderNonOccluded : public LLOctreeTraveler<LLDrawable>
 				group->rebuildMesh();
 
 				gGL.flush();
-				glPushMatrix();
+				gGL.pushMatrix();
 				gGLLastMatrix = NULL;
-				glLoadMatrixd(gGLModelView);
+				gGL.loadMatrix(gGLModelView);
 				renderVisibility(group, mCamera);
 				stop_glerror();
 				gGLLastMatrix = NULL;
-				glPopMatrix();
-				gGL.color4f(1,1,1,1);
+				gGL.popMatrix();
+				gGL.diffuseColor4f(1,1,1,1);
 			}
 		}
 	}
@@ -3917,7 +3979,7 @@ class LLOctreeRenderNonOccluded : public LLOctreeTraveler<LLDrawable>
 		{
 			if (!group->getData().empty())
 			{
-				gGL.color3f(0,0,1);
+				gGL.diffuseColor3f(0,0,1);
 				drawBoxOutline(group->mObjectBounds[0],
 								group->mObjectBounds[1]);
 			}
@@ -3926,7 +3988,7 @@ class LLOctreeRenderNonOccluded : public LLOctreeTraveler<LLDrawable>
 		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i)
 		{
 			LLDrawable* drawable = *i;
-						
+					
 			if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_BBOXES))
 			{
 				renderBoundingBox(drawable);			
@@ -3941,7 +4003,7 @@ class LLOctreeRenderNonOccluded : public LLOctreeTraveler<LLDrawable>
 			{
 				if (drawable->isState(LLDrawable::IN_REBUILD_Q2))
 				{
-					gGL.color4f(0.6f, 0.6f, 0.1f, 1.f);
+					gGL.diffuseColor4f(0.6f, 0.6f, 0.1f, 1.f);
 					const LLVector4a* ext = drawable->getSpatialExtents();
 					LLVector4a center;
 					center.setAdd(ext[0], ext[1]);
@@ -4234,6 +4296,11 @@ void LLSpatialPartition::renderDebug()
 		return;
 	}
 	
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		gDebugProgram.bind();
+	}
+
 	if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY))
 	{
 		//sLastMaxTexPriority = lerp(sLastMaxTexPriority, sCurMaxTexPriority, gFrameIntervalSeconds);
@@ -4262,11 +4329,16 @@ void LLSpatialPartition::renderDebug()
 
 	LLOctreeRenderNonOccluded render_debug(camera);
 	render_debug.traverse(mOctree);
+
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		gDebugProgram.unbind();
+	}
 }
 
 void LLSpatialGroup::drawObjectBox(LLColor4 col)
 {
-	gGL.color4fv(col.mV);
+	gGL.diffuseColor4fv(col.mV);
 	LLVector4a size;
 	size = mObjectBounds[1];
 	size.mul(1.01f);
@@ -4371,7 +4443,7 @@ class LLOctreeIntersect : public LLSpatialGroup::OctreeTraveler
 		LLVector3 local_start = mStart;
 		LLVector3 local_end = mEnd;
 
-		if (!gPipeline.hasRenderType(drawable->getRenderType()) || !drawable->isVisible())
+		if (!drawable || !gPipeline.hasRenderType(drawable->getRenderType()) || !drawable->isVisible())
 		{
 			return false;
 		}
diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h
index 11955540c62a870493bac0d2db70743db5cb31bc..6c14ecf4521ec5a1597d105e008533583e3bd7fc 100644
--- a/indra/newview/llspatialpartition.h
+++ b/indra/newview/llspatialpartition.h
@@ -93,7 +93,6 @@ class LLDrawInfo : public LLRefCount
 	LLPointer<LLViewerTexture>     mTexture;
 	std::vector<LLPointer<LLViewerTexture> > mTextureList;
 
-	LLColor4U mGlowColor;
 	S32 mDebugColor;
 	const LLMatrix4* mTextureMatrix;
 	const LLMatrix4* mModelMatrix;
@@ -397,6 +396,8 @@ class LLSpatialGroup : public LLOctreeListener<LLDrawable>
 
 	U32 mState;
 	U32 mOcclusionState[LLViewerCamera::NUM_CAMERAS];
+	U32 mOcclusionIssued[LLViewerCamera::NUM_CAMERAS];
+
 	S32 mLODHash;
 	static S32 sLODSeed;
 
@@ -404,6 +405,9 @@ class LLSpatialGroup : public LLOctreeListener<LLDrawable>
 	bridge_list_t mBridgeList;
 	buffer_map_t mBufferMap; //used by volume buffers to attempt to reuse vertex buffers
 
+	U32 mGeometryBytes; //used by volumes to track how many bytes of geometry data are in this node
+	F32 mSurfaceArea; //used by volumes to track estimated surface area of geometry in this node
+
 	F32 mBuilt;
 	OctreeNode* mOctreeNode;
 	LLSpatialPartition* mSpatialPartition;
@@ -473,8 +477,8 @@ class LLSpatialPartition: public LLGeometryManager
 	BOOL isVisible(const LLVector3& v);
 	bool isHUDPartition() ;
 	
-	virtual LLSpatialBridge* asBridge() { return NULL; }
-	virtual BOOL isBridge() { return asBridge() != NULL; }
+	LLSpatialBridge* asBridge() { return mBridge; }
+	BOOL isBridge() { return asBridge() != NULL; }
 
 	void renderPhysicsShapes();
 	void renderDebug();
@@ -486,6 +490,9 @@ class LLSpatialPartition: public LLGeometryManager
 
 public:
 	LLSpatialGroup::OctreeNode* mOctree;
+	LLSpatialBridge* mBridge; // NULL for non-LLSpatialBridge instances, otherwise, mBridge == this
+							// use a pointer instead of making "isBridge" and "asBridge" virtual so it's safe
+							// to call asBridge() from the destructor
 	BOOL mOcclusionEnabled; // if TRUE, occlusion culling is performed
 	BOOL mInfiniteFarClip; // if TRUE, frustum culling ignores far clip plane
 	U32 mBufferUsage;
@@ -510,8 +517,9 @@ class LLSpatialBridge : public LLDrawable, public LLSpatialPartition
 	
 	LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask);
 	
-	virtual BOOL isSpatialBridge() const		{ return TRUE; }
+	void destroyTree();
 
+	virtual BOOL isSpatialBridge() const		{ return TRUE; }
 	virtual void updateSpatialExtents();
 	virtual void updateBinRadius();
 	virtual void setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* results = NULL, BOOL for_select = FALSE);
@@ -522,11 +530,12 @@ class LLSpatialBridge : public LLDrawable, public LLSpatialPartition
 	virtual void shiftPos(const LLVector4a& vec);
 	virtual void cleanupReferences();
 	virtual LLSpatialPartition* asPartition()		{ return this; }
-	virtual LLSpatialBridge* asBridge()				{ return this; }
-	
+		
 	virtual LLCamera transformCamera(LLCamera& camera);
 	
 	LLDrawable* mDrawable;
+	LLPointer<LLVOAvatar> mAvatar;
+
 };
 
 class LLCullResult 
diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp
index c588bd8fb44e63a6c8dfcaa601512c16094c5d02..07d2f1ad6f98bb29a0c48d755949d6a8806f2cd2 100644
--- a/indra/newview/llspeakers.cpp
+++ b/indra/newview/llspeakers.cpp
@@ -272,6 +272,7 @@ LLPointer<LLSpeaker> LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::strin
 		speakerp->mStatus = status;
 		mSpeakers.insert(std::make_pair(speakerp->mID, speakerp));
 		mSpeakersSorted.push_back(speakerp);
+		LL_DEBUGS("Speakers") << "Added speaker " << id << llendl;
 		fireEvent(new LLSpeakerListChangeEvent(this, speakerp->mID), "add");
 	}
 	else
@@ -290,6 +291,10 @@ LLPointer<LLSpeaker> LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::strin
 				speakerp->lookupName();
 			}
 		}
+		else
+		{
+			LL_WARNS("Speakers") << "Speaker " << id << " not found" << llendl;
+		}
 	}
 
 	mSpeakerDelayRemover->unsetActionTimer(speakerp->mID);
@@ -354,6 +359,7 @@ void LLSpeakerMgr::update(BOOL resort_ok)
 			if (moderator_muted_voice != speakerp->mModeratorMutedVoice)
 			{
 				speakerp->mModeratorMutedVoice = moderator_muted_voice;
+				LL_DEBUGS("Speakers") << (speakerp->mModeratorMutedVoice? "Muted" : "Umuted") << " speaker " << speaker_id<< llendl;
 				speakerp->fireEvent(new LLSpeakerVoiceModerationEvent(speakerp));
 			}
 
@@ -484,6 +490,7 @@ bool LLSpeakerMgr::removeSpeaker(const LLUUID& speaker_id)
 		}
 	}
 
+	LL_DEBUGS("Speakers") << "Removed speaker " << speaker_id << llendl;
 	fireEvent(new LLSpeakerListChangeEvent(this, speaker_id), "remove");
 
 	update(TRUE);
@@ -595,7 +602,10 @@ void LLIMSpeakerMgr::setSpeakers(const LLSD& speakers)
 					speaker_it->second["mutes"]["text"];
 				// Fire event only if moderator changed
 				if ( is_moderator != speakerp->mIsModerator )
+				{
+					LL_DEBUGS("Speakers") << "Speaker " << agent_id << (is_moderator ? "is now" : "no longer is") << " a moderator" << llendl;
 					fireEvent(new LLSpeakerUpdateModeratorEvent(speakerp), "update_moderator");
+				}
 			}
 		}
 	}
@@ -665,7 +675,10 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update)
 					speakerp->mIsModerator = agent_info["is_moderator"];
 					// Fire event only if moderator changed
 					if ( is_moderator != speakerp->mIsModerator )
+					{
+						LL_DEBUGS("Speakers") << "Speaker " << agent_id << (is_moderator ? "is now" : "no longer is") << " a moderator" << llendl;
 						fireEvent(new LLSpeakerUpdateModeratorEvent(speakerp), "update_moderator");
+					}
 				}
 
 				if (agent_info.has("mutes"))
@@ -857,6 +870,7 @@ void LLActiveSpeakerMgr::updateSpeakerList()
 	// always populate from active voice channel
 	if (LLVoiceChannel::getCurrentVoiceChannel() != mVoiceChannel) //MA: seems this is always false
 	{
+		LL_DEBUGS("Speakers") << "Removed all speakers" << llendl;
 		fireEvent(new LLSpeakerListChangeEvent(this, LLUUID::null), "clear");
 		mSpeakers.clear();
 		mSpeakersSorted.clear();
diff --git a/indra/newview/llspeakers.h b/indra/newview/llspeakers.h
index 35f2ee7056235d9d12e1b77a0ff36b5fcbd70825..b9358cf37c0856b9681c28a11545f4be8840b227 100644
--- a/indra/newview/llspeakers.h
+++ b/indra/newview/llspeakers.h
@@ -208,6 +208,8 @@ class LLSpeakersDelayActionsStorage
 
 class LLSpeakerMgr : public LLOldEvents::LLObservable
 {
+	LOG_CLASS(LLSpeakerMgr);
+
 public:
 	LLSpeakerMgr(LLVoiceChannel* channelp);
 	virtual ~LLSpeakerMgr();
@@ -271,6 +273,8 @@ class LLSpeakerMgr : public LLOldEvents::LLObservable
 
 class LLIMSpeakerMgr : public LLSpeakerMgr
 {
+	LOG_CLASS(LLIMSpeakerMgr);
+
 public:
 	LLIMSpeakerMgr(LLVoiceChannel* channel);
 	
@@ -320,6 +324,8 @@ class LLIMSpeakerMgr : public LLSpeakerMgr
 
 class LLActiveSpeakerMgr : public LLSpeakerMgr, public LLSingleton<LLActiveSpeakerMgr>
 {
+	LOG_CLASS(LLActiveSpeakerMgr);
+
 public:
 	LLActiveSpeakerMgr();
 protected:
@@ -328,6 +334,7 @@ class LLActiveSpeakerMgr : public LLSpeakerMgr, public LLSingleton<LLActiveSpeak
 
 class LLLocalSpeakerMgr : public LLSpeakerMgr, public LLSingleton<LLLocalSpeakerMgr>
 {
+	LOG_CLASS(LLLocalSpeakerMgr);
 public:
 	LLLocalSpeakerMgr();
 	~LLLocalSpeakerMgr ();
diff --git a/indra/newview/llsprite.cpp b/indra/newview/llsprite.cpp
index 4bde2dfcab55160ec92b88633588ae6dec55c6f5..c3eb70f850c2a7622d5a2423b7e32908a2a850a9 100644
--- a/indra/newview/llsprite.cpp
+++ b/indra/newview/llsprite.cpp
@@ -243,7 +243,7 @@ void LLSprite::updateFace(LLFace &face)
 		*indicesp++ = 3 + index_offset;
 	}
 
-	face.getVertexBuffer()->setBuffer(0);
+	face.getVertexBuffer()->flush();
 	face.mCenterAgent = mPosition;
 }
 
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 66187f6b42852cba41eb232b3f952c7991b431fa..0ac8c1fe397d8b2fb0c6fd444a5b9e21cae561af 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -737,8 +737,11 @@ bool idle_startup()
 		// this startup phase more than once.
 		if (gLoginMenuBarView == NULL)
 		{
-		initialize_edit_menu();
+			display_startup();
+			initialize_edit_menu();
+			display_startup();
 			init_menus();
+			display_startup();
 		}
 
 		if (show_connect_box)
@@ -747,23 +750,28 @@ bool idle_startup()
 			// NOTE: Hits "Attempted getFields with no login view shown" warning, since we don't
 			// show the login view until login_show() is called below.  
 			if (gUserCredential.isNull())                                                                          
-			{                                                                                                      
+			{                                                  
+				display_startup();
 				gUserCredential = gLoginHandler.initializeLoginInfo();                 
+				display_startup();
 			}     
 			if (gHeadlessClient)
 			{
 				LL_WARNS("AppInit") << "Waiting at connection box in headless client.  Did you mean to add autologin params?" << LL_ENDL;
 			}
 			// Make sure the process dialog doesn't hide things
+			display_startup();
 			gViewerWindow->setShowProgress(FALSE);
-
+			display_startup();
 			// Show the login dialog
 			login_show();
+			display_startup();
 			// connect dialog is already shown, so fill in the names
 			if (gUserCredential.notNull())                                                                         
 			{                                                                                                      
 				LLPanelLogin::setFields( gUserCredential, gRememberPassword);                                  
 			}     
+			display_startup();
 			LLPanelLogin::giveFocus();
 
 			LLStartUp::setStartupState( STATE_LOGIN_WAIT );		// Wait for user input
@@ -774,14 +782,19 @@ bool idle_startup()
 			LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
 		}
 
+		display_startup();
 		gViewerWindow->setNormalControlsVisible( FALSE );	
+		display_startup();
 		gLoginMenuBarView->setVisible( TRUE );
+		display_startup();
 		gLoginMenuBarView->setEnabled( TRUE );
+		display_startup();
 		show_debug_menus();
+		display_startup();
 
 		// Hide the splash screen
 		LLSplashScreen::hide();
-
+		display_startup();
 		// Push our window frontmost
 		gViewerWindow->getWindow()->show();
 		display_startup();
@@ -790,7 +803,9 @@ bool idle_startup()
 		// first made visible.
 #ifdef _WIN32
 		MSG msg;
-		while( PeekMessage( &msg, /*All hWnds owned by this thread */ NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE ) );
+		while( PeekMessage( &msg, /*All hWnds owned by this thread */ NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE ) )
+		{ }
+		display_startup();
 #endif
 		timeout.reset();
 		return FALSE;
@@ -805,7 +820,7 @@ bool idle_startup()
 
 		// Don't do anything.  Wait for the login view to call the login_callback,
 		// which will push us to the next state.
-
+		display_startup();
 		// Sleep so we don't spin the CPU
 		ms_sleep(1);
 		return FALSE;
@@ -865,7 +880,6 @@ bool idle_startup()
 		LLFile::mkdir(gDirUtilp->getLindenUserDir());
 
 		// Set PerAccountSettingsFile to the default value.
-		std::string per_account_settings_file = LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount");
 		gSavedSettings.setString("PerAccountSettingsFile",
 			gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, 
 				LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount")));
@@ -1173,37 +1187,51 @@ bool idle_startup()
 
 		// Finish agent initialization.  (Requires gSavedSettings, builds camera)
 		gAgent.init();
+		display_startup();
 		gAgentCamera.init();
+		display_startup();
 		set_underclothes_menu_options();
+		display_startup();
 
 		// Since we connected, save off the settings so the user doesn't have to
 		// type the name/password again if we crash.
 		gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE);
 		LLUIColorTable::instance().saveUserSettings();
 
+		display_startup();
+
 		//
 		// Initialize classes w/graphics stuff.
 		//
 		gTextureList.doPrefetchImages();		
+		display_startup();
+
 		LLSurface::initClasses();
+		display_startup();
+
 
 		LLFace::initClass();
+		display_startup();
 
 		LLDrawable::initClass();
+		display_startup();
 
 		// init the shader managers
 		LLPostProcess::initClass();
+		display_startup();
 
 		LLViewerObject::initVOClasses();
+		display_startup();
 
 		// Initialize all our tools.  Must be done after saved settings loaded.
 		// NOTE: This also is where gToolMgr used to be instantiated before being turned into a singleton.
 		LLToolMgr::getInstance()->initTools();
+		display_startup();
 
 		// Pre-load floaters, like the world map, that are slow to spawn
 		// due to XML complexity.
 		gViewerWindow->initWorldUI();
-
+		
 		display_startup();
 
 		// This is where we used to initialize gWorldp. Original comment said:
@@ -1211,24 +1239,26 @@ bool idle_startup()
 
 		// User might have overridden far clip
 		LLWorld::getInstance()->setLandFarClip(gAgentCamera.mDrawDistance);
-
+		display_startup();
 		// Before we create the first region, we need to set the agent's mOriginGlobal
 		// This is necessary because creating objects before this is set will result in a
 		// bad mPositionAgent cache.
 
 		gAgent.initOriginGlobal(from_region_handle(gFirstSimHandle));
+		display_startup();
 
 		LLWorld::getInstance()->addRegion(gFirstSimHandle, gFirstSim);
+		display_startup();
 
 		LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(gFirstSimHandle);
 		LL_INFOS("AppInit") << "Adding initial simulator " << regionp->getOriginGlobal() << LL_ENDL;
 		
 		regionp->setSeedCapability(gFirstSimSeedCap);
 		LL_DEBUGS("AppInit") << "Waiting for seed grant ...." << LL_ENDL;
-		
+		display_startup();
 		// Set agent's initial region to be the one we just created.
 		gAgent.setRegion(regionp);
-
+		display_startup();
 		// Set agent's initial position, which will be read by LLVOAvatar when the avatar
 		// object is created.  I think this must be done after setting the region.  JC
 		gAgent.setPositionAgent(agent_start_position_region);
@@ -1248,6 +1278,7 @@ bool idle_startup()
 	{
 		LLStartUp::multimediaInit();
 		LLStartUp::setStartupState( STATE_FONT_INIT );
+		display_startup();
 		return FALSE;
 	}
 
@@ -1256,6 +1287,7 @@ bool idle_startup()
 	{
 		LLStartUp::fontInit();
 		LLStartUp::setStartupState( STATE_SEED_GRANTED_WAIT );
+		display_startup();
 		return FALSE;
 	}
 
@@ -1283,6 +1315,7 @@ bool idle_startup()
 				set_startup_status(0.4f, LLTrans::getString("LoginRequestSeedCapGrant"), gAgent.mMOTD);
 			}
 		}
+		display_startup();
 		return FALSE;
 	}
 
@@ -1293,7 +1326,9 @@ bool idle_startup()
 	//---------------------------------------------------------------------
 	if (STATE_SEED_CAP_GRANTED == LLStartUp::getStartupState())
 	{
+		display_startup();
 		update_texture_fetch();
+		display_startup();
 
 		if ( gViewerWindow != NULL)
 		{	// This isn't the first logon attempt, so show the UI
@@ -1301,12 +1336,15 @@ bool idle_startup()
 		}	
 		gLoginMenuBarView->setVisible( FALSE );
 		gLoginMenuBarView->setEnabled( FALSE );
+		display_startup();
 
 		// direct logging to the debug console's line buffer
 		LLError::logToFixedBuffer(gDebugView->mDebugConsolep);
+		display_startup();
 		
 		// set initial visibility of debug console
 		gDebugView->mDebugConsolep->setVisible(gSavedSettings.getBOOL("ShowDebugConsole"));
+		display_startup();
 
 		//
 		// Set message handlers
@@ -1315,22 +1353,28 @@ bool idle_startup()
 
 		// register callbacks for messages. . . do this after initial handshake to make sure that we don't catch any unwanted
 		register_viewer_callbacks(gMessageSystem);
+		display_startup();
 
 		// Debugging info parameters
 		gMessageSystem->setMaxMessageTime( 0.5f );			// Spam if decoding all msgs takes more than 500 ms
+		display_startup();
 
 		#ifndef	LL_RELEASE_FOR_DOWNLOAD
 			gMessageSystem->setTimeDecodes( TRUE );				// Time the decode of each msg
 			gMessageSystem->setTimeDecodesSpamThreshold( 0.05f );  // Spam if a single msg takes over 50ms to decode
 		#endif
+		display_startup();
 
 		gXferManager->registerCallbacks(gMessageSystem);
+		display_startup();
 
 		LLStartUp::initNameCache();
+		display_startup();
 
 		// update the voice settings *after* gCacheName initialization
 		// so that we can construct voice UI that relies on the name cache
 		LLVoiceClient::getInstance()->updateSettings();
+		display_startup();
 
 		//gCacheName is required for nearby chat history loading
 		//so I just moved nearby history loading a few states further
@@ -1339,12 +1383,14 @@ bool idle_startup()
 			LLNearbyChat* nearby_chat = LLNearbyChat::getInstance();
 			if (nearby_chat) nearby_chat->loadHistory();
 		}
+		display_startup();
 
 		// *Note: this is where gWorldMap used to be initialized.
 
 		// register null callbacks for audio until the audio system is initialized
 		gMessageSystem->setHandlerFuncFast(_PREHASH_SoundTrigger, null_message_callback, NULL);
 		gMessageSystem->setHandlerFuncFast(_PREHASH_AttachedSound, null_message_callback, NULL);
+		display_startup();
 
 		//reset statistics
 		LLViewerStats::getInstance()->resetStats();
@@ -1374,6 +1420,7 @@ bool idle_startup()
 		LLViewerCamera::getInstance()->setAspect(gViewerWindow->getWorldViewAspectRatio());
 		// Initialize FOV
 		LLViewerCamera::getInstance()->setDefaultFOV(gSavedSettings.getF32("CameraAngle")); 
+		display_startup();
 
 		// Move agent to starting location. The position handed to us by
 		// the space server is in global coordinates, but the agent frame
@@ -1384,6 +1431,7 @@ bool idle_startup()
 		gAgent.resetAxes(gAgentStartLookAt);
 		gAgentCamera.stopCameraAnimation();
 		gAgentCamera.resetCamera();
+		display_startup();
 
 		// Initialize global class data needed for surfaces (i.e. textures)
 		LL_DEBUGS("AppInit") << "Initializing sky..." << LL_ENDL;
@@ -1396,6 +1444,8 @@ bool idle_startup()
 		LLGLState::checkStates();
 		LLGLState::checkTextureChannels();
 
+		display_startup();
+
 		LL_DEBUGS("AppInit") << "Decoding images..." << LL_ENDL;
 		// For all images pre-loaded into viewer cache, decode them.
 		// Need to do this AFTER we init the sky
@@ -1409,6 +1459,8 @@ bool idle_startup()
 		}
 		LLStartUp::setStartupState( STATE_WORLD_WAIT );
 
+		display_startup();
+
 		// JC - Do this as late as possible to increase likelihood Purify
 		// will run.
 		LLMessageSystem* msg = gMessageSystem;
@@ -1436,6 +1488,7 @@ bool idle_startup()
 			NULL);
 
 		timeout.reset();
+		display_startup();
 
 		return FALSE;
 	}
@@ -1454,8 +1507,10 @@ bool idle_startup()
 		LLMessageSystem* msg = gMessageSystem;
 		while (msg->checkAllMessages(gFrameCount, gServicePump))
 		{
+			display_startup();
 		}
 		msg->processAcks();
+		display_startup();
 		return FALSE;
 	}
 
@@ -1466,6 +1521,7 @@ bool idle_startup()
 	{
 		LL_DEBUGS("AppInit") << "Connecting to region..." << LL_ENDL;
 		set_startup_status(0.60f, LLTrans::getString("LoginConnectingToRegion"), gAgent.mMOTD);
+		display_startup();
 		// register with the message system so it knows we're
 		// expecting this message
 		LLMessageSystem* msg = gMessageSystem;
@@ -1481,6 +1537,7 @@ bool idle_startup()
 			msg->newMessageFast(_PREHASH_EconomyDataRequest);
 			gAgent.sendReliableMessage();
 		}
+		display_startup();
 
 		// Create login effect
 		// But not on first login, because you can't see your avatar then
@@ -1495,6 +1552,7 @@ bool idle_startup()
 		LLStartUp::setStartupState( STATE_AGENT_WAIT );		// Go to STATE_AGENT_WAIT
 
 		timeout.reset();
+		display_startup();
 		return FALSE;
 	}
 
@@ -1519,14 +1577,17 @@ bool idle_startup()
 				LL_DEBUGS("AppInit") << "Awaiting AvatarInitComplete, got "
 				<< msg->getMessageName() << LL_ENDL;
 			}
+			display_startup();
 		}
 		msg->processAcks();
 
+		display_startup();
+
 		if (gAgentMovementCompleted)
 		{
 			LLStartUp::setStartupState( STATE_INVENTORY_SEND );
 		}
-
+		display_startup();
 		return FALSE;
 	}
 
@@ -1535,9 +1596,10 @@ bool idle_startup()
 	//---------------------------------------------------------------------
 	if (STATE_INVENTORY_SEND == LLStartUp::getStartupState())
 	{
+		display_startup();
 		// Inform simulator of our language preference
 		LLAgentLanguage::update();
-
+		display_startup();
 		// unpack thin inventory
 		LLSD response = LLLoginInstance::getInstance()->getResponse();
 		//bool dump_buffer = false;
@@ -1552,6 +1614,7 @@ bool idle_startup()
 				gInventory.setLibraryRootFolderID(id.asUUID());
 			}
 		}
+		display_startup();
  		
 		LLSD inv_lib_owner = response["inventory-lib-owner"];
 		if(inv_lib_owner.isDefined())
@@ -1563,6 +1626,7 @@ bool idle_startup()
 				gInventory.setLibraryOwnerID( LLUUID(id.asUUID()));
 			}
 		}
+		display_startup();
 
 		LLSD inv_skel_lib = response["inventory-skel-lib"];
  		if(inv_skel_lib.isDefined() && gInventory.getLibraryOwnerID().notNull())
@@ -1572,6 +1636,7 @@ bool idle_startup()
  				LL_WARNS("AppInit") << "Problem loading inventory-skel-lib" << LL_ENDL;
  			}
  		}
+		display_startup();
 
 		LLSD inv_skeleton = response["inventory-skeleton"];
  		if(inv_skeleton.isDefined())
@@ -1581,6 +1646,7 @@ bool idle_startup()
  				LL_WARNS("AppInit") << "Problem loading inventory-skel-targets" << LL_ENDL;
  			}
  		}
+		display_startup();
 
 		LLSD inv_basic = response["inventory-basic"];
  		if(inv_basic.isDefined())
@@ -1618,6 +1684,7 @@ bool idle_startup()
 				list[agent_id] = new LLRelationship(given_rights, has_rights, false);
 			}
 			LLAvatarTracker::instance().addBuddyList(list);
+			display_startup();
  		}
 
 		bool show_hud = false;
@@ -1645,6 +1712,8 @@ bool idle_startup()
 				//}
 			}
 		}
+		display_startup();
+
 		// Either we want to show tutorial because this is the first login
 		// to a Linden Help Island or the user quit with the tutorial
 		// visible.  JC
@@ -1652,22 +1721,26 @@ bool idle_startup()
 		{
 			LLFloaterReg::showInstance("hud", LLSD(), FALSE);
 		}
+		display_startup();
 
 		LLSD event_notifications = response["event_notifications"];
 		if(event_notifications.isDefined())
 		{
 			gEventNotifier.load(event_notifications);
 		}
+		display_startup();
 
 		LLSD classified_categories = response["classified_categories"];
 		if(classified_categories.isDefined())
 		{
 			LLClassifiedInfo::loadCategories(classified_categories);
 		}
+		display_startup();
 
 		// This method MUST be called before gInventory.findCategoryUUIDForType because of 
 		// gInventory.mIsAgentInvUsable is set to true in the gInventory.buildParentChildMap.
 		gInventory.buildParentChildMap();
+		display_startup();
 
 		//all categories loaded. lets create "My Favorites" category
 		gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE,true);
@@ -1681,24 +1754,26 @@ bool idle_startup()
 		LLAvatarTracker::instance().registerCallbacks(msg);
 		llinfos << " Landmark" << llendl;
 		LLLandmark::registerCallbacks(msg);
+		display_startup();
 
 		// request mute list
 		llinfos << "Requesting Mute List" << llendl;
 		LLMuteList::getInstance()->requestFromServer(gAgent.getID());
-
+		display_startup();
 		// Get L$ and ownership credit information
 		llinfos << "Requesting Money Balance" << llendl;
 		LLStatusBar::sendMoneyBalanceRequest();
-
+		display_startup();
 		// request all group information
 		llinfos << "Requesting Agent Data" << llendl;
 		gAgent.sendAgentDataUpdateRequest();
-
+		display_startup();
 		// Create the inventory views
 		llinfos << "Creating Inventory Views" << llendl;
 		LLFloaterReg::getInstance("inventory");
-
+		display_startup();
 		LLStartUp::setStartupState( STATE_MISC );
+		display_startup();
 		return FALSE;
 	}
 
@@ -1747,17 +1822,23 @@ bool idle_startup()
 			gSavedSettings.setBOOL("ShowStartLocation", TRUE);
 		}
 
+		display_startup();
+
 		if (gSavedSettings.getBOOL("HelpFloaterOpen"))
 		{
 			// show default topic
 			LLViewerHelp::instance().showTopic("");
 		}
 
+		display_startup();
+
 		// We're successfully logged in.
 		gSavedSettings.setBOOL("FirstLoginThisInstall", FALSE);
 
 		LLFloaterReg::showInitialVisibleInstances();
 
+		display_startup();
+
 		// based on the comments, we've successfully logged in so we can delete the 'forced'
 		// URL that the updater set in settings.ini (in a mostly paranoid fashion)
 		std::string nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" );
@@ -1771,8 +1852,10 @@ bool idle_startup()
 			LLUIColorTable::instance().saveUserSettings();
 		};
 
+		display_startup();
 		// JC: Initializing audio requests many sounds for download.
 		init_audio();
+		display_startup();
 
 		// JC: Initialize "active" gestures.  This may also trigger
 		// many gesture downloads, if this is the user's first
@@ -1810,6 +1893,7 @@ bool idle_startup()
 			LLGestureMgr::instance().startFetch();
 		}
 		gDisplaySwapBuffers = TRUE;
+		display_startup();
 
 		LLMessageSystem* msg = gMessageSystem;
 		msg->setHandlerFuncFast(_PREHASH_SoundTrigger,				process_sound_trigger);
@@ -1884,8 +1968,10 @@ bool idle_startup()
 			}
 		}
 
+		display_startup();
         //DEV-17797.  get null folder.  Any items found here moved to Lost and Found
         LLInventoryModelBackgroundFetch::instance().findLostItems();
+		display_startup();
 
 		LLStartUp::setStartupState( STATE_PRECACHE );
 		timeout.reset();
@@ -1894,6 +1980,7 @@ bool idle_startup()
 
 	if (STATE_PRECACHE == LLStartUp::getStartupState())
 	{
+		display_startup();
 		F32 timeout_frac = timeout.getElapsedTimeF32()/PRECACHING_DELAY;
 
 		// We now have an inventory skeleton, so if this is a user's first
@@ -1910,6 +1997,8 @@ bool idle_startup()
 			LLStartUp::loadInitialOutfit( sInitialOutfit, sInitialOutfitGender );
 		}
 
+		display_startup();
+
 		// wait precache-delay and for agent's avatar or a lot longer.
 		if(((timeout_frac > 1.f) && isAgentAvatarValid())
 		   || (timeout_frac > 3.f))
@@ -1923,11 +2012,6 @@ bool idle_startup()
 				LLTrans::getString("LoginPrecaching"),
 					gAgent.mMOTD);
 			display_startup();
-			if (!LLViewerShaderMgr::sInitialized)
-			{
-				LLViewerShaderMgr::sInitialized = TRUE;
-				LLViewerShaderMgr::instance()->setShaders();
-			}
 		}
 		
 		return TRUE;
@@ -1940,7 +2024,7 @@ bool idle_startup()
 		const F32 wearables_time = wearables_timer.getElapsedTimeF32();
 		const F32 MAX_WEARABLES_TIME = 10.f;
 
-		if (!gAgent.isGenderChosen())
+		if (!gAgent.isGenderChosen() && isAgentAvatarValid())
 		{
 			// No point in waiting for clothing, we don't even
 			// know what gender we are.  Pop a dialog to ask and
@@ -1956,6 +2040,8 @@ bool idle_startup()
 			return TRUE;
 		}
 		
+		display_startup();
+
 		if (wearables_time > MAX_WEARABLES_TIME)
 		{
 			LLNotificationsUtil::add("ClothingLoading");
@@ -1987,16 +2073,20 @@ bool idle_startup()
 			}
 		}
 
+		display_startup();
 		update_texture_fetch();
+		display_startup();
 		set_startup_status(0.9f + 0.1f * wearables_time / MAX_WEARABLES_TIME,
 						 LLTrans::getString("LoginDownloadingClothing").c_str(),
 						 gAgent.mMOTD.c_str());
+		display_startup();
 		return TRUE;
 	}
 
 	if (STATE_CLEANUP == LLStartUp::getStartupState())
 	{
 		set_startup_status(1.0, "", "");
+		display_startup();
 
 		// Let the map know about the inventory.
 		LLFloaterWorldMap* floater_world_map = LLFloaterWorldMap::getInstance();
@@ -2012,6 +2102,7 @@ bool idle_startup()
 		//gViewerWindow->revealIntroPanel();
 		gViewerWindow->setStartupComplete(); 
 		gViewerWindow->setProgressCancelButtonVisible(FALSE);
+		display_startup();
 
 		// We're not away from keyboard, even though login might have taken
 		// a while. JC
@@ -2047,6 +2138,7 @@ bool idle_startup()
 		// LLUserAuth::getInstance()->reset();
 
 		LLStartUp::setStartupState( STATE_STARTED );
+		display_startup();
 
 		// Unmute audio if desired and setup volumes.
 		// Unmute audio if desired and setup volumes.
@@ -2071,6 +2163,7 @@ bool idle_startup()
 		LLAgentPicksInfo::getInstance()->requestNumberOfPicks();
 
 		LLIMFloater::initIMFloater();
+		display_startup();
 
 		return TRUE;
 	}
@@ -2446,6 +2539,12 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
 		gender = SEX_FEMALE;
 	}
 
+	if (!isAgentAvatarValid())
+	{
+		llwarns << "Trying to load an initial outfit for an invalid agent avatar" << llendl;
+		return;
+	}
+
 	gAgentAvatarp->setSex(gender);
 
 	// try to find the outfit - if not there, create some default
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index 75db269bde97cbbdce0c0445e68b12a128152576..89240c982f57d28bad29551c72809a17fa60c02f 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -114,6 +114,7 @@ LLStatusBar::LLStatusBar(const LLRect& rect)
 	mTextTime(NULL),
 	mSGBandwidth(NULL),
 	mSGPacketLoss(NULL),
+	mBtnStats(NULL),
 	mBtnVolume(NULL),
 	mBoxBalance(NULL),
 	mBalance(0),
@@ -173,6 +174,8 @@ BOOL LLStatusBar::postBuild()
 
 	mBoxBalance = getChild<LLTextBox>("balance");
 	mBoxBalance->setClickedCallback( &LLStatusBar::onClickBalance, this );
+	
+	mBtnStats = getChildView("stat_btn");
 
 	mBtnVolume = getChild<LLButton>( "volume_btn" );
 	mBtnVolume->setClickedCallback( onClickVolume, this );
@@ -288,7 +291,7 @@ void LLStatusBar::refresh()
 
 	mSGBandwidth->setVisible(net_stats_visible);
 	mSGPacketLoss->setVisible(net_stats_visible);
-	getChildView("stat_btn")->setEnabled(net_stats_visible);
+	mBtnStats->setEnabled(net_stats_visible);
 
 	// update the master volume button state
 	bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute();
diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h
index 4ea3183d1820a4c606bbadb45e78ff64923bdd66..9d28e6c2bc581273fc5fb95fde6a3785e756ef0b 100644
--- a/indra/newview/llstatusbar.h
+++ b/indra/newview/llstatusbar.h
@@ -102,10 +102,11 @@ class LLStatusBar
 	LLStatGraph *mSGBandwidth;
 	LLStatGraph *mSGPacketLoss;
 
+	LLView		*mBtnStats;
 	LLButton	*mBtnVolume;
 	LLTextBox	*mBoxBalance;
 	LLButton	*mMediaToggle;
-	LLView*		mScriptOut;
+	LLView		*mScriptOut;
 	LLFrameTimer	mClockUpdateTimer;
 
 	S32				mBalance;
diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp
index 3aa6a3b7e5b7b428ffbd6e77ae6b55d91f2fab1f..0cb6c850122e88091e7d9f5047217b48e6a46dd5 100644
--- a/indra/newview/llsyswellwindow.cpp
+++ b/indra/newview/llsyswellwindow.cpp
@@ -159,6 +159,7 @@ void LLSysWellWindow::setVisible(BOOL visible)
 	LLTransientDockableFloater::setVisible(visible);
 
 	// update notification channel state	
+	initChannel(); // make sure the channel still exists
 	if(mChannel)
 	{
 		mChannel->updateShowToastsState();
@@ -598,6 +599,13 @@ LLIMWellWindow* LLIMWellWindow::getInstance(const LLSD& key /*= LLSD()*/)
 	return LLFloaterReg::getTypedInstance<LLIMWellWindow>("im_well_window", key);
 }
 
+
+// static
+LLIMWellWindow* LLIMWellWindow::findInstance(const LLSD& key /*= LLSD()*/)
+{
+	return LLFloaterReg::findTypedInstance<LLIMWellWindow>("im_well_window", key);
+}
+
 BOOL LLIMWellWindow::postBuild()
 {
 	BOOL rv = LLSysWellWindow::postBuild();
@@ -751,7 +759,10 @@ void LLIMWellWindow::removeObjectRow(const LLUUID& notification_id)
 {
 	if (mMessageList->removeItemByValue(notification_id))
 	{
-		mSysWellChiclet->updateWidget(isWindowEmpty());
+		if (mSysWellChiclet)
+		{
+			mSysWellChiclet->updateWidget(isWindowEmpty());
+		}
 	}
 	else
 	{
diff --git a/indra/newview/llsyswellwindow.h b/indra/newview/llsyswellwindow.h
index 52e53705059c2576bf6f779cfdf3c3f2eae7918b..272e9cfcb1248044eb9282a3d6dc41863fae7151 100644
--- a/indra/newview/llsyswellwindow.h
+++ b/indra/newview/llsyswellwindow.h
@@ -153,6 +153,7 @@ class LLIMWellWindow : public LLSysWellWindow, LLIMSessionObserver, LLInitClass<
 	~LLIMWellWindow();
 
 	static LLIMWellWindow* getInstance(const LLSD& key = LLSD());
+	static LLIMWellWindow* findInstance(const LLSD& key = LLSD());
 	static void initClass() { getInstance(); }
 
 	/*virtual*/ BOOL postBuild();
diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp
index e8abee2fb76c07d55ef61f92ca5642f3792d6010..6f6d5dbf122ea787f6d24f4065209104015ada5d 100644
--- a/indra/newview/lltexlayer.cpp
+++ b/indra/newview/lltexlayer.cpp
@@ -216,22 +216,22 @@ void LLTexLayerSetBuffer::cancelUpload()
 
 void LLTexLayerSetBuffer::pushProjection() const
 {
-	glMatrixMode(GL_PROJECTION);
+	gGL.matrixMode(LLRender::MM_PROJECTION);
 	gGL.pushMatrix();
-	glLoadIdentity();
-	glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
+	gGL.loadIdentity();
+	gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
 
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.pushMatrix();
-	glLoadIdentity();
+	gGL.loadIdentity();
 }
 
 void LLTexLayerSetBuffer::popProjection() const
 {
-	glMatrixMode(GL_PROJECTION);
+	gGL.matrixMode(LLRender::MM_PROJECTION);
 	gGL.popMatrix();
 
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.popMatrix();
 }
 
@@ -294,18 +294,22 @@ BOOL LLTexLayerSetBuffer::render()
 	const BOOL update_now = mNeedsUpdate && isReadyToUpdate();
 	
 	BOOL success = TRUE;
-
-	//hack to use fixed function when updating tex layer sets
-	bool no_ff = LLGLSLShader::sNoFixedFunction;
-	LLGLSLShader::sNoFixedFunction = false;
 	
+	bool use_shaders = LLGLSLShader::sNoFixedFunction;
+
+	if (use_shaders)
+	{
+		gAlphaMaskProgram.bind();
+		gAlphaMaskProgram.setMinimumAlpha(0.004f);
+	}
+
+	LLVertexBuffer::unbind();
+
 	// Composite the color data
 	LLGLSUIDefault gls_ui;
 	success &= mTexLayerSet->render( mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight );
 	gGL.flush();
 
-	LLGLSLShader::sNoFixedFunction = no_ff;
-	
 	if(upload_now)
 	{
 		if (!success)
@@ -335,6 +339,13 @@ BOOL LLTexLayerSetBuffer::render()
 		doUpdate();
 	}
 
+	if (use_shaders)
+	{
+		gAlphaMaskProgram.unbind();
+	}
+
+	LLVertexBuffer::unbind();
+	
 	// reset GL state
 	gGL.setColorMask(true, true);
 	gGL.setSceneBlendType(LLRender::BT_ALPHA);
@@ -924,6 +935,8 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
 		}
 	}
 
+	bool use_shaders = LLGLSLShader::sNoFixedFunction;
+
 	LLGLSUIDefault gls_ui;
 	LLGLDepthTest gls_depth(GL_FALSE, GL_FALSE);
 	gGL.setColorMask(true, true);
@@ -932,12 +945,20 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
 	{
 		gGL.flush();
 		LLGLDisable no_alpha(GL_ALPHA_TEST);
+		if (use_shaders)
+		{
+			gAlphaMaskProgram.setMinimumAlpha(0.0f);
+		}
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 		gGL.color4f( 0.f, 0.f, 0.f, 1.f );
 
 		gl_rect_2d_simple( width, height );
 
 		gGL.flush();
+		if (use_shaders)
+		{
+			gAlphaMaskProgram.setMinimumAlpha(0.004f);
+		}
 	}
 
 	if (mIsVisible)
@@ -964,6 +985,11 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
 
 		gGL.setSceneBlendType(LLRender::BT_REPLACE);
 		LLGLDisable no_alpha(GL_ALPHA_TEST);
+		if (use_shaders)
+		{
+			gAlphaMaskProgram.setMinimumAlpha(0.f);
+		}
+
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 		gGL.color4f( 0.f, 0.f, 0.f, 0.f );
 
@@ -971,7 +997,10 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
 		gGL.setSceneBlendType(LLRender::BT_ALPHA);
 
 		gGL.flush();
-
+		if (use_shaders)
+		{
+			gAlphaMaskProgram.setMinimumAlpha(0.004f);
+		}
 	}
 
 	return success;
@@ -1078,13 +1107,14 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height,
 {
 	const LLTexLayerSetInfo *info = getInfo();
 	
+	bool use_shaders = LLGLSLShader::sNoFixedFunction;
+
 	gGL.setColorMask(false, true);
 	gGL.setSceneBlendType(LLRender::BT_REPLACE);
 	
 	// (Optionally) replace alpha with a single component image from a tga file.
 	if (!info->mStaticAlphaFileName.empty())
 	{
-		LLGLSNoAlphaTest gls_no_alpha_test;
 		gGL.flush();
 		{
 			LLViewerTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(info->mStaticAlphaFileName, TRUE);
@@ -1103,12 +1133,20 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height,
 		// Set the alpha channel to one (clean up after previous blending)
 		gGL.flush();
 		LLGLDisable no_alpha(GL_ALPHA_TEST);
+		if (use_shaders)
+		{
+			gAlphaMaskProgram.setMinimumAlpha(0.f);
+		}
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 		gGL.color4f( 0.f, 0.f, 0.f, 1.f );
 		
 		gl_rect_2d_simple( width, height );
 		
 		gGL.flush();
+		if (use_shaders)
+		{
+			gAlphaMaskProgram.setMinimumAlpha(0.004f);
+		}
 	}
 	
 	// (Optional) Mask out part of the baked texture with alpha masks
@@ -1593,6 +1631,8 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height)
 	LLGLEnable color_mat(GL_COLOR_MATERIAL);
 	gPipeline.disableLights();
 
+	bool use_shaders = LLGLSLShader::sNoFixedFunction;
+
 	LLColor4 net_color;
 	BOOL color_specified = findNetColor(&net_color);
 	
@@ -1673,8 +1713,13 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height)
 			{
 				if( tex )
 				{
-					LLGLDisable alpha_test(getInfo()->mWriteAllChannels ? GL_ALPHA_TEST : 0);
-
+					bool no_alpha_test = getInfo()->mWriteAllChannels;
+					LLGLDisable alpha_test(no_alpha_test ? GL_ALPHA_TEST : 0);
+					if (use_shaders && no_alpha_test)
+					{
+						gAlphaMaskProgram.setMinimumAlpha(0.f);
+					}
+					
 					LLTexUnit::eTextureAddressMode old_mode = tex->getAddressMode();
 					
 					gGL.getTexUnit(0)->bind(tex, TRUE);
@@ -1684,6 +1729,11 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height)
 
 					gGL.getTexUnit(0)->setTextureAddressMode(old_mode);
 					gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+					if (use_shaders && no_alpha_test)
+					{
+						gAlphaMaskProgram.setMinimumAlpha(0.004f);
+					}
+					
 				}
 			}
 //			else
@@ -1716,9 +1766,17 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height)
 		color_specified )
 	{
 		LLGLDisable no_alpha(GL_ALPHA_TEST);
+		if (use_shaders)
+		{
+			gAlphaMaskProgram.setMinimumAlpha(0.f);
+		}
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 		gGL.color4fv( net_color.mV );
 		gl_rect_2d_simple( width, height );
+		if (use_shaders)
+		{
+			gAlphaMaskProgram.setMinimumAlpha(0.004f);
+		}
 	}
 
 	if( alpha_mask_specified || getInfo()->mWriteAllChannels )
@@ -1806,15 +1864,25 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height)
 
 	gGL.flush();
 	
+	bool use_shaders = LLGLSLShader::sNoFixedFunction;
+
 	if( !getInfo()->mStaticImageFileName.empty() )
 	{
 		LLViewerTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture( getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask );
 		if( tex )
 		{
 			LLGLSNoAlphaTest gls_no_alpha_test;
+			if (use_shaders)
+			{
+				gAlphaMaskProgram.setMinimumAlpha(0.f);
+			}
 			gGL.getTexUnit(0)->bind(tex, TRUE);
 			gl_rect_2d_simple_tex( width, height );
 			gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+			if (use_shaders)
+			{
+				gAlphaMaskProgram.setMinimumAlpha(0.004f);
+			}
 		}
 		else
 		{
@@ -1829,10 +1897,18 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height)
 			if (tex)
 			{
 				LLGLSNoAlphaTest gls_no_alpha_test;
+				if (use_shaders)
+				{
+					gAlphaMaskProgram.setMinimumAlpha(0.f);
+				}
 				gGL.getTexUnit(0)->bind(tex);
 				gl_rect_2d_simple_tex( width, height );
 				gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 				success = TRUE;
+				if (use_shaders)
+				{
+					gAlphaMaskProgram.setMinimumAlpha(0.004f);
+				}
 			}
 		}
 	}
@@ -1851,6 +1927,13 @@ BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
 
 	llassert( !mParamAlphaList.empty() );
 
+	bool use_shaders = LLGLSLShader::sNoFixedFunction;
+
+	if (use_shaders)
+	{
+		gAlphaMaskProgram.setMinimumAlpha(0.f);
+	}
+
 	gGL.setColorMask(false, true);
 
 	LLTexLayerParamAlpha* first_param = *mParamAlphaList.begin();
@@ -1888,7 +1971,6 @@ BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
 		if( tex && (tex->getComponents() == 4) )
 		{
 			LLGLSNoAlphaTest gls_no_alpha_test;
-
 			LLTexUnit::eTextureAddressMode old_mode = tex->getAddressMode();
 			
 			gGL.getTexUnit(0)->bind(tex, TRUE);
@@ -1927,6 +2009,10 @@ BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
 		gl_rect_2d_simple( width, height );
 	}
 
+	if (use_shaders)
+	{
+		gAlphaMaskProgram.setMinimumAlpha(0.004f);
+	}
 
 	LLGLSUIDefault gls_ui;
 
diff --git a/indra/newview/lltexlayer.h b/indra/newview/lltexlayer.h
index 85dadb213c55d777bdb2e329d677a43830d34f8d..4f43547dae5034117610fe9bd6274de7b1cc9a67 100644
--- a/indra/newview/lltexlayer.h
+++ b/indra/newview/lltexlayer.h
@@ -261,6 +261,8 @@ class LLTexLayerSetInfo
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 class LLTexLayerSetBuffer : public LLViewerDynamicTexture
 {
+	LOG_CLASS(LLTexLayerSetBuffer);
+
 public:
 	LLTexLayerSetBuffer(LLTexLayerSet* const owner, S32 width, S32 height);
 	virtual ~LLTexLayerSetBuffer();
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index e7a176f4f9fffbdc1b62fec273b5f475015f879d..8632890bbbdc7ad0c2aaac46fd38f0c888d566e0 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -760,7 +760,7 @@ LLTextureCache::~LLTextureCache()
 //////////////////////////////////////////////////////////////////////////////
 
 //virtual
-S32 LLTextureCache::update(U32 max_time_ms)
+S32 LLTextureCache::update(F32 max_time_ms)
 {
 	static LLFrameTimer timer ;
 	static const F32 MAX_TIME_INTERVAL = 300.f ; //seconds.
diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h
index 64e3a2658c38565f1b8f32253fdb50621ed90773..dd0cc9b4bd6147b519ab416ed3180508b22a7c95 100644
--- a/indra/newview/lltexturecache.h
+++ b/indra/newview/lltexturecache.h
@@ -101,7 +101,7 @@ class LLTextureCache : public LLWorkerThread
 	LLTextureCache(bool threaded);
 	~LLTextureCache();
 
-	/*virtual*/ S32 update(U32 max_time_ms);	
+	/*virtual*/ S32 update(F32 max_time_ms);	
 	
 	void purgeCache(ELLPath location);
 	void setReadOnly(BOOL read_only) ;
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index de22f2ae6b7f6fe3085363d7c6e8d76fa00bf782..ed9faa070601ea72801cee172df5fecdd9bd58fb 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -67,6 +67,9 @@
 #include "lluictrlfactory.h"
 #include "lltrans.h"
 
+#include "llradiogroup.h"
+#include "llfloaterreg.h"
+#include "lllocalbitmaps.h"
 
 static const S32 HPAD = 4;
 static const S32 VPAD = 4;
@@ -78,6 +81,8 @@ static const F32 CONTEXT_CONE_IN_ALPHA = 0.0f;
 static const F32 CONTEXT_CONE_OUT_ALPHA = 1.f;
 static const F32 CONTEXT_FADE_TIME = 0.08f;
 
+static const S32 LOCAL_TRACKING_ID_COLUMN = 1;
+
 //static const char CURRENT_IMAGE_NAME[] = "Current Texture";
 //static const char WHITE_IMAGE_NAME[] = "Blank Texture";
 //static const char NO_IMAGE_NAME[] = "None";
@@ -142,6 +147,12 @@ class LLFloaterTexturePicker : public LLFloater
 	static void		onApplyImmediateCheck(LLUICtrl* ctrl, void* userdata);
 		   void		onTextureSelect( const LLTextureEntry& te );
 
+	static void		onModeSelect(LLUICtrl* ctrl, void *userdata);
+	static void		onBtnAdd(void* userdata);
+	static void		onBtnRemove(void* userdata);
+	static void		onBtnUpload(void* userdata);
+	static void		onLocalScrollCommit(LLUICtrl* ctrl, void* userdata);
+
 protected:
 	LLPointer<LLViewerTexture> mTexturep;
 	LLTextureCtrl*		mOwner;
@@ -169,8 +180,10 @@ class LLFloaterTexturePicker : public LLFloater
 	BOOL				mNoCopyTextureSelected;
 	F32					mContextConeOpacity;
 	LLSaveFolderState	mSavedFolderState;
-
 	BOOL				mSelectedItemPinned;
+	
+	LLRadioGroup*		mModeSelector;
+	LLScrollListCtrl*	mLocalScrollCtrl;
 };
 
 LLFloaterTexturePicker::LLFloaterTexturePicker(	
@@ -437,6 +450,17 @@ BOOL LLFloaterTexturePicker::postBuild()
 		mInventoryPanel->setSelection(findItemID(mImageAssetID, FALSE), TAKE_FOCUS_NO);
 	}
 
+	mModeSelector = getChild<LLRadioGroup>("mode_selection");
+	mModeSelector->setCommitCallback(onModeSelect, this);
+	mModeSelector->setSelectedIndex(0, 0);
+
+	childSetAction("l_add_btn", LLFloaterTexturePicker::onBtnAdd, this);
+	childSetAction("l_rem_btn", LLFloaterTexturePicker::onBtnRemove, this);
+	childSetAction("l_upl_btn", LLFloaterTexturePicker::onBtnUpload, this);
+
+	mLocalScrollCtrl = getChild<LLScrollListCtrl>("l_name_list");
+	mLocalScrollCtrl->setCommitCallback(onLocalScrollCommit, this);
+	LLLocalBitmapMgr::feedScrollList(mLocalScrollCtrl);
 
 	mNoCopyTextureSelected = FALSE;
 
@@ -464,7 +488,6 @@ BOOL LLFloaterTexturePicker::postBuild()
 // virtual
 void LLFloaterTexturePicker::draw()
 {
-	S32 floater_header_size = getHeaderHeight();
 	if (mOwner)
 	{
 		// draw cone of context pointing back to texture swatch	
@@ -554,10 +577,7 @@ void LLFloaterTexturePicker::draw()
 		}
 
 		// Border
-		LLRect border( BORDER_PAD, 
-					   getRect().getHeight() - floater_header_size - BORDER_PAD, 
-					   ((getMinWidth() / 2) - TEXTURE_INVENTORY_PADDING - HPAD) - BORDER_PAD,
-					   BORDER_PAD + FOOTER_HEIGHT + (getRect().getHeight() - getMinHeight()));
+		LLRect border = getChildView("preview_widget")->getRect();
 		gl_rect_2d( border, LLColor4::black, FALSE );
 
 
@@ -748,7 +768,15 @@ void LLFloaterTexturePicker::onBtnSelect(void* userdata)
 	LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
 	if (self->mOwner)
 	{
-		self->mOwner->onFloaterCommit(LLTextureCtrl::TEXTURE_SELECT);
+		LLUUID local_id = LLUUID::null;
+
+		if (self->mLocalScrollCtrl->getVisible() && !self->mLocalScrollCtrl->getAllSelected().empty())
+		{
+			LLUUID temp_id = self->mLocalScrollCtrl->getFirstSelected()->getColumn(LOCAL_TRACKING_ID_COLUMN)->getValue().asUUID();
+			local_id = LLLocalBitmapMgr::getWorldID(temp_id);
+		}
+
+		self->mOwner->onFloaterCommit(LLTextureCtrl::TEXTURE_SELECT, local_id);
 	}
 	self->closeFloater();
 }
@@ -791,6 +819,112 @@ void LLFloaterTexturePicker::onSelectionChange(const std::deque<LLFolderViewItem
 	}
 }
 
+// static
+void LLFloaterTexturePicker::onModeSelect(LLUICtrl* ctrl, void *userdata)
+{
+	LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
+	bool mode = (self->mModeSelector->getSelectedIndex() == 0);
+
+	self->getChild<LLButton>("Default")->setVisible(mode);
+	self->getChild<LLButton>("Blank")->setVisible(mode);
+	self->getChild<LLButton>("None")->setVisible(mode);
+	self->getChild<LLButton>("Pipette")->setVisible(mode);
+	self->getChild<LLFilterEditor>("inventory search editor")->setVisible(mode);
+	self->getChild<LLInventoryPanel>("inventory panel")->setVisible(mode);
+
+	/*self->getChild<LLCheckBox>("show_folders_check")->setVisible(mode);
+	  no idea under which conditions the above is even shown, needs testing. */
+
+	self->getChild<LLButton>("l_add_btn")->setVisible(!mode);
+	self->getChild<LLButton>("l_rem_btn")->setVisible(!mode);
+	self->getChild<LLButton>("l_upl_btn")->setVisible(!mode);
+	self->getChild<LLScrollListCtrl>("l_name_list")->setVisible(!mode);
+}
+
+// static
+void LLFloaterTexturePicker::onBtnAdd(void* userdata)
+{
+	if (LLLocalBitmapMgr::addUnit() == true)
+	{
+		LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
+		LLLocalBitmapMgr::feedScrollList(self->mLocalScrollCtrl);
+	}
+}
+
+// static
+void LLFloaterTexturePicker::onBtnRemove(void* userdata)
+{
+	LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
+	std::vector<LLScrollListItem*> selected_items = self->mLocalScrollCtrl->getAllSelected();
+
+	if (!selected_items.empty())
+	{
+		for(std::vector<LLScrollListItem*>::iterator iter = selected_items.begin();
+			iter != selected_items.end(); iter++)
+		{
+			LLScrollListItem* list_item = *iter;
+			if (list_item)
+			{
+				LLUUID tracking_id = list_item->getColumn(LOCAL_TRACKING_ID_COLUMN)->getValue().asUUID();
+				LLLocalBitmapMgr::delUnit(tracking_id);
+			}
+		}
+
+		self->getChild<LLButton>("l_rem_btn")->setEnabled(false);
+		self->getChild<LLButton>("l_upl_btn")->setEnabled(false);
+		LLLocalBitmapMgr::feedScrollList(self->mLocalScrollCtrl);
+	}
+
+}
+
+// static
+void LLFloaterTexturePicker::onBtnUpload(void* userdata)
+{
+	LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
+	std::vector<LLScrollListItem*> selected_items = self->mLocalScrollCtrl->getAllSelected();
+
+	if (selected_items.empty())
+	{
+		return;
+	}
+
+	/* currently only allows uploading one by one, picks the first item from the selection list.  (not the vector!)
+	   in the future, it might be a good idea to check the vector size and if more than one units is selected - opt for multi-image upload. */
+	
+	LLUUID tracking_id = (LLUUID)self->mLocalScrollCtrl->getSelectedItemLabel(LOCAL_TRACKING_ID_COLUMN);
+	std::string filename = LLLocalBitmapMgr::getFilename(tracking_id);
+
+	if (!filename.empty())
+	{
+		LLFloaterReg::showInstance("upload_image", LLSD(filename));
+	}
+
+}
+
+//static
+void LLFloaterTexturePicker::onLocalScrollCommit(LLUICtrl* ctrl, void* userdata)
+{
+	LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
+	std::vector<LLScrollListItem*> selected_items = self->mLocalScrollCtrl->getAllSelected();
+	bool has_selection = !selected_items.empty();
+
+	self->getChild<LLButton>("l_rem_btn")->setEnabled(has_selection);
+	self->getChild<LLButton>("l_upl_btn")->setEnabled(has_selection && (selected_items.size() < 2));
+	/* since multiple-localbitmap upload is not implemented, upl button gets disabled if more than one is selected. */
+
+	if (has_selection)
+	{
+		LLUUID tracking_id = (LLUUID)self->mLocalScrollCtrl->getSelectedItemLabel(LOCAL_TRACKING_ID_COLUMN); 
+		LLUUID inworld_id = LLLocalBitmapMgr::getWorldID(tracking_id);
+		self->mOwner->setImageAssetID(inworld_id);
+
+		if (self->childGetValue("apply_immediate_check").asBoolean())
+		{
+			self->mOwner->onFloaterCommit(LLTextureCtrl::TEXTURE_CHANGE, inworld_id);
+		}
+	}
+}
+
 // static
 void LLFloaterTexturePicker::onShowFolders(LLUICtrl* ctrl, void *user_data)
 {
@@ -922,13 +1056,20 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p)
 	S32 image_top = getRect().getHeight();
 	S32 image_bottom = BTN_HEIGHT_SMALL;
 	S32 image_middle = (image_top + image_bottom) / 2;
-	S32 line_height = llround(LLFontGL::getFontSansSerifSmall()->getLineHeight());
+	S32 line_height = LLFontGL::getFontSansSerifSmall()->getLineHeight();
 
 	LLTextBox::Params tentative_label_p(p.multiselect_text);
 	tentative_label_p.name("Multiple");
 	tentative_label_p.rect(LLRect (0, image_middle + line_height / 2, getRect().getWidth(), image_middle - line_height / 2 ));
 	tentative_label_p.follows.flags(FOLLOWS_ALL);
 	mTentativeLabel = LLUICtrlFactory::create<LLTextBox> (tentative_label_p);
+
+	// It is no longer possible to associate a style with a textbox, so it has to be done in this fashion
+	LLStyle::Params style_params;
+	style_params.color = LLColor4::white;
+
+	mTentativeLabel->setText(LLTrans::getString("multiple_textures"), style_params);
+	mTentativeLabel->setHAlign(LLFontGL::HCENTER);
 	addChild( mTentativeLabel );
 
 	LLRect border_rect = getLocalRect();
@@ -1126,7 +1267,7 @@ void LLTextureCtrl::onFloaterClose()
 	mFloaterHandle.markDead();
 }
 
-void LLTextureCtrl::onFloaterCommit(ETexturePickOp op)
+void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLUUID id)
 {
 	LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
 
@@ -1139,14 +1280,24 @@ void LLTextureCtrl::onFloaterCommit(ETexturePickOp op)
 		// (i.e. op == TEXTURE_SELECT) or texture changes via DnD.
 		else if (mCommitOnSelection || op == TEXTURE_SELECT)
 			mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here?
-			
-		if( floaterp->isDirty() )
+
+		if(floaterp->isDirty() || id.notNull()) // mModelView->setDirty does not work.
 		{
 			setTentative( FALSE );
-			mImageItemID = floaterp->findItemID(floaterp->getAssetID(), FALSE);
-			lldebugs << "mImageItemID: " << mImageItemID << llendl;
-			mImageAssetID = floaterp->getAssetID();
-			lldebugs << "mImageAssetID: " << mImageAssetID << llendl;
+
+			if (id.notNull())
+			{
+				mImageItemID = id;
+				mImageAssetID = id;
+			}
+			else
+			{
+				mImageItemID = floaterp->findItemID(floaterp->getAssetID(), FALSE);
+				lldebugs << "mImageItemID: " << mImageItemID << llendl;
+				mImageAssetID = floaterp->getAssetID();
+				lldebugs << "mImageAssetID: " << mImageAssetID << llendl;
+			}
+
 			if (op == TEXTURE_SELECT && mOnSelectCallback)
 			{
 				mOnSelectCallback( this, LLSD() );
diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h
index b1312d641f64fe848d7e136be829db43576f43b0..3abe84dcc31a630ad2ea3c1903e37d9eb9d71c9c 100644
--- a/indra/newview/lltexturectrl.h
+++ b/indra/newview/lltexturectrl.h
@@ -157,7 +157,7 @@ class LLTextureCtrl
 	void			closeDependentFloater();
 
 	void			onFloaterClose();
-	void			onFloaterCommit(ETexturePickOp op);
+	void			onFloaterCommit(ETexturePickOp op, LLUUID id = LLUUID::null);
 
 	// This call is returned when a drag is detected. Your callback
 	// should return TRUE if the drag is acceptable.
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 56dfb61c4f8b2ae13ece3a423ebb0f870a0d9e5d..f18aa8b4e61b05cefaf821af67165f368855ec08 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -2204,7 +2204,7 @@ void LLTextureFetch::commonUpdate()
 
 // MAIN THREAD
 //virtual
-S32 LLTextureFetch::update(U32 max_time_ms)
+S32 LLTextureFetch::update(F32 max_time_ms)
 {
 	static LLCachedControl<F32> band_width(gSavedSettings,"ThrottleBandwidthKBPS");
 
diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h
index d101da1f4be1697e6221825a3c6cd72d8a7ca150..35df7d816f20b91e28b319c40c9767e1a428c7b6 100644
--- a/indra/newview/lltexturefetch.h
+++ b/indra/newview/lltexturefetch.h
@@ -55,7 +55,7 @@ class LLTextureFetch : public LLWorkerThread
 
 	class TFRequest;
 	
-	/*virtual*/ S32 update(U32 max_time_ms);	
+	/*virtual*/ S32 update(F32 max_time_ms);	
 	void shutDownTextureCacheThread() ; //called in the main thread after the TextureCacheThread shuts down.
 	void shutDownImageDecodeThread() ;  //called in the main thread after the ImageDecodeThread shuts down.
 
diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp
index 6547154bc481e879817ab4b02adfa2b45161a6e2..5b41a05f2aac01d5f66ad1fcf9b4c849c731e9c6 100644
--- a/indra/newview/lltextureview.cpp
+++ b/indra/newview/lltextureview.cpp
@@ -386,7 +386,7 @@ class LLAvatarTexBar : public LLView
 		Params()
 		:	texture_view("texture_view")
 		{
-			S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
+			S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
 			changeDefault(rect, LLRect(0,0,100,line_height * 4));
 		}
 	};
@@ -411,7 +411,7 @@ void LLAvatarTexBar::draw()
 	LLVOAvatarSelf* avatarp = gAgentAvatarp;
 	if (!avatarp) return;
 
-	const S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
+	const S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
 	const S32 v_offset = 0;
 	const S32 l_offset = 3;
 
@@ -485,7 +485,7 @@ class LLGLTexMemBar : public LLView
 		Params()
 		:	texture_view("texture_view")
 		{
-			S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
+			S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
 			changeDefault(rect, LLRect(0,0,100,line_height * 4));
 		}
 	};
@@ -512,7 +512,7 @@ void LLGLTexMemBar::draw()
 	F32 discard_bias = LLViewerTexture::sDesiredDiscardBias;
 	F32 cache_usage = (F32)BYTES_TO_MEGA_BYTES(LLAppViewer::getTextureCache()->getUsage()) ;
 	F32 cache_max_usage = (F32)BYTES_TO_MEGA_BYTES(LLAppViewer::getTextureCache()->getMaxUsage()) ;
-	S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
+	S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
 	S32 v_offset = (S32)((texture_bar_height + 2.2f) * mTextureView->mNumTextureBars + 2.0f);
 	F32 total_texture_downloaded = (F32)gTotalTextureBytes / (1024 * 1024);
 	F32 total_object_downloaded = (F32)gTotalObjectBytes / (1024 * 1024);
@@ -527,11 +527,12 @@ void LLGLTexMemBar::draw()
 	LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*6,
 											 text_color, LLFontGL::LEFT, LLFontGL::TOP);
 
-	text = llformat("GL Tot: %d/%d MB Bound: %d/%d MB Raw Tot: %d MB Bias: %.2f Cache: %.1f/%.1f MB Net Tot Tex: %.1f MB Tot Obj: %.1f MB Tot Htp: %d",
+	text = llformat("GL Tot: %d/%d MB Bound: %d/%d MB FBO: %d MB Raw Tot: %d MB Bias: %.2f Cache: %.1f/%.1f MB Net Tot Tex: %.1f MB Tot Obj: %.1f MB Tot Htp: %d",
 					total_mem,
 					max_total_mem,
 					bound_mem,
 					max_bound_mem,
+					LLRenderTarget::sBytesAllocated/(1024*1024),
 					LLImageRaw::sGlobalRawMemory >> 20,	discard_bias,
 					cache_usage, cache_max_usage, total_texture_downloaded, total_object_downloaded, total_http_requests);
 	//, cache_entries, cache_max_entries
@@ -571,7 +572,7 @@ void LLGLTexMemBar::draw()
 	color = (total_mem < llfloor(max_total_mem * texmem_lower_bound_scale)) ? LLColor4::green :
 		  	(total_mem < max_total_mem) ? LLColor4::yellow : LLColor4::red;
 	color[VALPHA] = .75f;
-	glColor4fv(color.mV);
+	gGL.diffuseColor4fv(color.mV);
 	
 	gl_rect_2d(left, top, right, bottom); // red/yellow/green
 
@@ -594,7 +595,7 @@ void LLGLTexMemBar::draw()
 	color = (bound_mem < llfloor(max_bound_mem * texmem_lower_bound_scale)) ? LLColor4::green :
 		  	(bound_mem < max_bound_mem) ? LLColor4::yellow : LLColor4::red;
 	color[VALPHA] = .75f;
-	glColor4fv(color.mV);
+	gGL.diffuseColor4fv(color.mV);
 
 	gl_rect_2d(left, top, right, bottom);
 #else
@@ -1096,7 +1097,7 @@ void LLTextureSizeView::drawTextureSizeGraph()
 {
 	if(mTextureSizeBar.size() == 0)
 	{
-		S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
+		S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
 		mTextureSizeBar.resize(LLImageGL::sTextureLoadedCounter.size()) ;
 		mTextureSizeBarRect.set(700, line_height * 2 + 400, 700 + mTextureSizeBar.size() * mTextureSizeBarWidth, line_height * 2) ;
 		
@@ -1139,7 +1140,7 @@ F32 LLTextureSizeView::drawTextureSizeDistributionGraph()
 		}
 	}
 
-	S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
+	S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
 	S32 left = mTextureSizeBarRect.mLeft ;
 	S32 bottom = mTextureSizeBarRect.mBottom ;
 	S32 right = mTextureSizeBarRect.mRight ;
@@ -1221,7 +1222,7 @@ void LLTextureSizeView::drawTextureCategoryGraph()
 {
 	if(mTextureSizeBar.size() == 0)
 	{
-		S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
+		S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
 		mTextureSizeBar.resize(LLViewerTexture::getTotalNumOfCategories()) ;
 		mTextureSizeBarRect.set(700, line_height * 2 + 400, 700 + mTextureSizeBar.size() * mTextureSizeBarWidth, line_height * 2) ;
 		
@@ -1266,7 +1267,7 @@ F32 LLTextureSizeView::drawTextureCategoryDistributionGraph()
 		}
 	}
 
-	S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
+	S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
 	S32 left = mTextureSizeBarRect.mLeft ;
 	S32 bottom = mTextureSizeBarRect.mBottom ;
 	S32 right = mTextureSizeBarRect.mRight ;
diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp
index e0b07ed408e9ab051656e9202effe2a9af3d3979..0eec7f0afd153f50cbdf9f76c7a175131e7a74c1 100644
--- a/indra/newview/lltoast.cpp
+++ b/indra/newview/lltoast.cpp
@@ -113,7 +113,8 @@ LLToast::LLToast(const LLToast::Params& p)
 	mHideBtnPressed(false),
 	mIsTip(p.is_tip),
 	mWrapperPanel(NULL),
-	mIsFading(false)
+	mIsFading(false),
+	mIsHovered(false)
 {
 	mTimer.reset(new LLToastLifeTimer(this, p.lifetime_secs));
 
@@ -122,8 +123,6 @@ LLToast::LLToast(const LLToast::Params& p)
 	setCanDrag(FALSE);
 
 	mWrapperPanel = getChild<LLPanel>("wrapper_panel");
-	mWrapperPanel->setMouseEnterCallback(boost::bind(&LLToast::onToastMouseEnter, this));
-	mWrapperPanel->setMouseLeaveCallback(boost::bind(&LLToast::onToastMouseLeave, this));
 
 	setBackgroundOpaque(TRUE); // *TODO: obsolete
 	updateTransparency();
@@ -137,13 +136,13 @@ LLToast::LLToast(const LLToast::Params& p)
 	{
 		mHideBtn = getChild<LLButton>("hide_btn");
 		mHideBtn->setClickedCallback(boost::bind(&LLToast::hide,this));
-		mHideBtn->setMouseEnterCallback(boost::bind(&LLToast::onToastMouseEnter, this));
-		mHideBtn->setMouseLeaveCallback(boost::bind(&LLToast::onToastMouseLeave, this));
 	}
 
 	// init callbacks if present
 	if(!p.on_delete_toast().empty())
+	{
 		mOnDeleteToastSignal.connect(p.on_delete_toast());
+	}
 }
 
 void LLToast::reshape(S32 width, S32 height, BOOL called_from_parent)
@@ -181,11 +180,14 @@ LLToast::~LLToast()
 //--------------------------------------------------------------------------
 void LLToast::hide()
 {
-	setVisible(FALSE);
-	setFading(false);
-	mTimer->stop();
-	mIsHidden = true;
-	mOnFadeSignal(this); 
+	if (!mIsHidden)
+	{
+		setVisible(FALSE);
+		setFading(false);
+		mTimer->stop();
+		mIsHidden = true;
+		mOnFadeSignal(this); 
+	}
 }
 
 void LLToast::onFocusLost()
@@ -216,6 +218,13 @@ void LLToast::setFadingTime(S32 seconds)
 	mToastFadingTime = seconds;
 }
 
+void LLToast::closeToast()
+{
+	mOnDeleteToastSignal(this);
+
+	closeFloater();
+}
+
 S32 LLToast::getTopPad()
 {
 	if(mWrapperPanel)
@@ -239,7 +248,9 @@ void LLToast::setCanFade(bool can_fade)
 { 
 	mCanFade = can_fade; 
 	if(!mCanFade)
+	{
 		mTimer->stop();
+	}
 }
 
 //--------------------------------------------------------------------------
@@ -295,9 +306,7 @@ void LLToast::reshapeToPanel()
 	if(!panel)
 		return;
 
-	LLRect panel_rect = panel->getRect();
-
-	panel_rect.setLeftTopAndSize(0, panel_rect.getHeight(), panel_rect.getWidth(), panel_rect.getHeight());
+	LLRect panel_rect = panel->getLocalRect();
 	panel->setShape(panel_rect);
 	
 	LLRect toast_rect = getRect();
@@ -378,8 +387,11 @@ void LLToast::setVisible(BOOL show)
 	}
 }
 
-void LLToast::onToastMouseEnter()
+void LLToast::updateHoveredState()
 {
+	S32 x, y;
+	LLUI::getMousePositionScreen(&x, &y);
+
 	LLRect panel_rc = mWrapperPanel->calcScreenRect();
 	LLRect button_rc;
 	if(mHideBtn)
@@ -387,56 +399,83 @@ void LLToast::onToastMouseEnter()
 		button_rc = mHideBtn->calcScreenRect();
 	}
 
-	S32 x, y;
-	LLUI::getMousePositionScreen(&x, &y);
-
-	if(panel_rc.pointInRect(x, y) || button_rc.pointInRect(x, y))
+	if (!panel_rc.pointInRect(x, y) && !button_rc.pointInRect(x, y))
 	{
-		mOnToastHoverSignal(this, MOUSE_ENTER);
-
-		updateTransparency();
+		// mouse is not over this toast
+		mIsHovered = false;
+	}
+	else
+	{
+		bool is_overlapped_by_other_floater = false;
 
-		//toasts fading is management by Screen Channel
+		const child_list_t* child_list = gFloaterView->getChildList();
 
-		sendChildToFront(mHideBtn);
-		if(mHideBtn && mHideBtn->getEnabled())
+		// find this toast in gFloaterView child list to check whether any floater
+		// with higher Z-order is visible under the mouse pointer overlapping this toast
+		child_list_const_reverse_iter_t r_iter = std::find(child_list->rbegin(), child_list->rend(), this);
+		if (r_iter != child_list->rend())
 		{
-			mHideBtn->setVisible(TRUE);
+			// skip this toast and proceed to views above in Z-order
+			for (++r_iter; r_iter != child_list->rend(); ++r_iter)
+			{
+				LLView* view = *r_iter;
+				is_overlapped_by_other_floater = view->isInVisibleChain() && view->calcScreenRect().pointInRect(x, y);
+				if (is_overlapped_by_other_floater)
+				{
+					break;
+				}
+			}
 		}
-		mToastMouseEnterSignal(this, getValue());
-	}
-}
 
-void LLToast::onToastMouseLeave()
-{
-	LLRect panel_rc = mWrapperPanel->calcScreenRect();
-	LLRect button_rc;
-	if(mHideBtn)
-	{
-		button_rc = mHideBtn->calcScreenRect();
+		mIsHovered = !is_overlapped_by_other_floater;
 	}
 
-	S32 x, y;
-	LLUI::getMousePositionScreen(&x, &y);
-
-	if( !panel_rc.pointInRect(x, y) && !button_rc.pointInRect(x, y))
-	{
-		mOnToastHoverSignal(this, MOUSE_LEAVE);
-
-		updateTransparency();
-
-		//toasts fading is management by Screen Channel
-
-		if(mHideBtn && mHideBtn->getEnabled())
+	LLToastLifeTimer* timer = getTimer();
+	
+	if (timer)
+	{	
+		// Started timer means the mouse had left the toast previously.
+		// If toast is hovered in the current frame we should handle
+		// a mouse enter event.
+		if(timer->getStarted() && mIsHovered)
 		{
-			if( mHideBtnPressed )
+			mOnToastHoverSignal(this, MOUSE_ENTER);
+			
+			updateTransparency();
+			
+			//toasts fading is management by Screen Channel
+			
+			sendChildToFront(mHideBtn);
+			if(mHideBtn && mHideBtn->getEnabled())
 			{
-				mHideBtnPressed = false;
-				return;
+				mHideBtn->setVisible(TRUE);
 			}
-			mHideBtn->setVisible(FALSE);		
+			
+			mToastMouseEnterSignal(this, getValue());
+		}
+		// Stopped timer means the mouse had entered the toast previously.
+		// If the toast is not hovered in the current frame we should handle
+		// a mouse leave event.
+		else if(!timer->getStarted() && !mIsHovered)
+		{
+			mOnToastHoverSignal(this, MOUSE_LEAVE);
+			
+			updateTransparency();
+			
+			//toasts fading is management by Screen Channel
+			
+			if(mHideBtn && mHideBtn->getEnabled())
+			{
+				if( mHideBtnPressed )
+				{
+					mHideBtnPressed = false;
+					return;
+				}
+				mHideBtn->setVisible(FALSE);
+			}
+			
+			mToastMouseLeaveSignal(this, getValue());
 		}
-		mToastMouseLeaveSignal(this, getValue());
 	}
 }
 
@@ -495,13 +534,6 @@ void LLNotificationsUI::LLToast::startTimer()
 	}
 }
 
-bool LLToast::isHovered()
-{
-	S32 x, y;
-	LLUI::getMousePositionScreen(&x, &y);
-	return mWrapperPanel->calcScreenRect().pointInRect(x, y);
-}
-
 //--------------------------------------------------------------------------
 
 BOOL LLToast::handleMouseDown(S32 x, S32 y, MASK mask)
@@ -536,3 +568,14 @@ S32	LLToast::notifyParent(const LLSD& info)
 
 	return LLModalDialog::notifyParent(info);
 }
+
+//static
+void LLToast::updateClass()
+{
+	for (LLInstanceTracker<LLToast>::instance_iter iter = LLInstanceTracker<LLToast>::beginInstances(); iter != LLInstanceTracker<LLToast>::endInstances(); ) 
+	{
+		LLToast& toast = *iter++;
+		
+		toast.updateHoveredState();
+	}
+}
diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h
index 242f786bf2e9dfbbd34d49111e7e93304adbaac4..e1d99b1bcba9afd2abde97820bf5a13b841e6443 100644
--- a/indra/newview/lltoast.h
+++ b/indra/newview/lltoast.h
@@ -27,7 +27,7 @@
 #ifndef LL_LLTOAST_H
 #define LL_LLTOAST_H
 
-
+#include "llinstancetracker.h"
 #include "llpanel.h"
 #include "llmodaldialog.h"
 #include "lleventtimer.h"
@@ -69,12 +69,13 @@ private :
  * Represents toast pop-up.
  * This is a parent view for all toast panels.
  */
-class LLToast : public LLModalDialog
+class LLToast : public LLModalDialog, public LLInstanceTracker<LLToast>
 {
 	friend class LLToastLifeTimer;
 public:
 	typedef boost::function<void (LLToast* toast)> toast_callback_t;
 	typedef boost::signals2::signal<void (LLToast* toast)> toast_signal_t;
+	typedef boost::signals2::signal<void (LLToast* toast, bool mouse_enter)> toast_hover_check_signal_t;
 
 	struct Params : public LLInitParam::Block<Params>
 	{
@@ -102,6 +103,8 @@ class LLToast : public LLModalDialog
 
 		Params();
 	};
+	
+	static void updateClass();
 
 	LLToast(const LLToast::Params& p);
 	virtual ~LLToast();
@@ -120,7 +123,7 @@ class LLToast : public LLModalDialog
 	/** Start lifetime/fading timer */
 	virtual void startTimer();
 
-	bool isHovered();
+	bool isHovered() { return mIsHovered; }
 
 	// Operating with toasts
 	// insert a panel to a toast
@@ -129,7 +132,7 @@ class LLToast : public LLModalDialog
 	void reshapeToPanel();
 
 	// get toast's panel
-	LLPanel* getPanel() { return mPanel; }
+	LLPanel* getPanel() const { return mPanel; }
 	// enable/disable Toast's Hide button
 	void setHideButtonEnabled(bool enabled);
 	//
@@ -153,6 +156,8 @@ class LLToast : public LLModalDialog
 
 	void setFadingTime(S32 seconds);
 
+	void closeToast();
+
 	/**
 	 * Returns padding between floater top and wrapper_panel top.
 	 * This padding should be taken into account when positioning or reshaping toasts
@@ -165,9 +170,9 @@ class LLToast : public LLModalDialog
 	// get information whether the notification corresponding to the toast is valid or not
 	bool isNotificationValid();
 	// get toast's Notification ID
-	const LLUUID getNotificationID() { return mNotificationID;}
+	const LLUUID getNotificationID() const { return mNotificationID;}
 	// get toast's Session ID
-	const LLUUID getSessionID() { return mSessionID;}
+	const LLUUID getSessionID() const { return mSessionID;}
 	//
 	void setCanFade(bool can_fade);
 	//
@@ -177,35 +182,25 @@ class LLToast : public LLModalDialog
 	// set whether this toast considered as hidden or not
 	void setIsHidden( bool is_toast_hidden ) { mIsHidden = is_toast_hidden; }
 
-	const LLNotificationPtr& getNotification() { return mNotification;}
+	const LLNotificationPtr& getNotification() const { return mNotification;}
 
 	// Registers signals/callbacks for events
-	toast_signal_t mOnFadeSignal;
-	toast_signal_t mOnDeleteToastSignal;
-	toast_signal_t mOnToastDestroyedSignal;
-	boost::signals2::connection setOnFadeCallback(toast_callback_t cb) { return mOnFadeSignal.connect(cb); }
-	boost::signals2::connection setOnToastDestroyedCallback(toast_callback_t cb) { return mOnToastDestroyedSignal.connect(cb); }
-
-	typedef boost::function<void (LLToast* toast, bool mouse_enter)> toast_hover_check_callback_t;
-	typedef boost::signals2::signal<void (LLToast* toast, bool mouse_enter)> toast_hover_check_signal_t;
-	toast_hover_check_signal_t mOnToastHoverSignal;	
-	boost::signals2::connection setOnToastHoverCallback(toast_hover_check_callback_t cb) { return mOnToastHoverSignal.connect(cb); }
+	boost::signals2::connection setOnFadeCallback(const toast_signal_t::slot_type& cb) { return mOnFadeSignal.connect(cb); }
+	boost::signals2::connection setOnToastDestroyedCallback(const toast_signal_t::slot_type& cb) { return mOnToastDestroyedSignal.connect(cb); }
+	boost::signals2::connection setOnToastHoverCallback(const toast_hover_check_signal_t::slot_type& cb) { return mOnToastHoverSignal.connect(cb); }
 
 	boost::signals2::connection setMouseEnterCallback( const commit_signal_t::slot_type& cb ) { return mToastMouseEnterSignal.connect(cb); };
 	boost::signals2::connection setMouseLeaveCallback( const commit_signal_t::slot_type& cb ) { return mToastMouseLeaveSignal.connect(cb); };
 
 	virtual S32	notifyParent(const LLSD& info);
 
-	LLHandle<LLToast> getHandle() { mHandle.bind(this); return mHandle; }
+	LLHandle<LLToast> getHandle() const { return getDerivedHandle<LLToast>(); }
 
 protected:
 	void updateTransparency();
 
 private:
-
-	void onToastMouseEnter();
-
-	void onToastMouseLeave();
+	void updateHoveredState();
 
 	void expire();
 
@@ -215,7 +210,7 @@ class LLToast : public LLModalDialog
 	LLUUID				mSessionID;
 	LLNotificationPtr	mNotification;
 
-	LLRootHandle<LLToast>	mHandle;
+	//LLRootHandle<LLToast>	mHandle;
 		
 	LLPanel* mWrapperPanel;
 
@@ -224,7 +219,7 @@ class LLToast : public LLModalDialog
 
 	F32			mToastLifetime; // in seconds
 	F32			mToastFadingTime; // in seconds
-
+	
 	LLPanel*		mPanel;
 	LLButton*		mHideBtn;
 
@@ -236,6 +231,12 @@ class LLToast : public LLModalDialog
 	bool		mIsHidden;  // this flag is TRUE when a toast has faded or was hidden with (x) button (EXT-1849)
 	bool		mIsTip;
 	bool		mIsFading;
+	bool		mIsHovered;
+
+	toast_signal_t mOnFadeSignal;
+	toast_signal_t mOnDeleteToastSignal;
+	toast_signal_t mOnToastDestroyedSignal;
+	toast_hover_check_signal_t mOnToastHoverSignal;
 
 	commit_signal_t mToastMouseEnterSignal;
 	commit_signal_t mToastMouseLeaveSignal;
diff --git a/indra/newview/lltoastalertpanel.cpp b/indra/newview/lltoastalertpanel.cpp
index 0f337825e92b14c5fc63d0042329d1383e1eddeb..8fef2ed6d1204151d0d46c25f3fcc85535312994 100644
--- a/indra/newview/lltoastalertpanel.cpp
+++ b/indra/newview/lltoastalertpanel.cpp
@@ -69,8 +69,22 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal
 		mLabel(notification->getName()),
 		mLineEditor(NULL)
 {
+	// EXP-1822
+	// save currently focused view, so that return focus to it
+	// on destroying this toast.
+	LLView* current_selection = dynamic_cast<LLView*>(gFocusMgr.getKeyboardFocus());
+	while(current_selection)
+	{
+		if (current_selection->isFocusRoot())
+		{
+			mPreviouslyFocusedView = current_selection->getHandle();
+			break;
+		}
+		current_selection = current_selection->getParent();
+	}
+
 	const LLFontGL* font = LLFontGL::getFontSansSerif();
-	const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f);
+	const S32 LINE_HEIGHT = font->getLineHeight();
 	const S32 EDITOR_HEIGHT = 20;
 
 	LLNotificationFormPtr form = mNotification->getForm();
@@ -365,7 +379,7 @@ bool LLToastAlertPanel::setCheckBox( const std::string& check_title, const std::
 	}
 
 	const LLFontGL* font =  mCheck->getFont();
-	const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f);
+	const S32 LINE_HEIGHT = font->getLineHeight();
 	
 	// Extend dialog for "check next time"
 	S32 max_msg_width = LLToastPanel::getRect().getWidth() - 2 * HPAD;
@@ -408,6 +422,13 @@ LLToastAlertPanel::~LLToastAlertPanel()
 {
 	LLTransientFloaterMgr::instance().removeControlView(
 			LLTransientFloaterMgr::GLOBAL, this);
+
+	// EXP-1822
+	// return focus to the previously focused view if the viewer is not exiting
+	if (mPreviouslyFocusedView.get() && !LLApp::isExiting())
+	{
+		mPreviouslyFocusedView.get()->setFocus(TRUE);
+	}
 }
 
 BOOL LLToastAlertPanel::hasTitleBar() const
diff --git a/indra/newview/lltoastalertpanel.h b/indra/newview/lltoastalertpanel.h
index 7b157f19bb10123af3c6c487496512ac5100b4e0..d1be5e018ead9eae01a34701e18eaef821f7726d 100644
--- a/indra/newview/lltoastalertpanel.h
+++ b/indra/newview/lltoastalertpanel.h
@@ -113,6 +113,7 @@ class LLToastAlertPanel
 	LLFrameTimer	mDefaultBtnTimer;
 	// For Dialogs that take a line as text as input:
 	LLLineEditor* mLineEditor;
+	LLHandle<LLView>	mPreviouslyFocusedView;
 
 };
 
diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp
index de305bf3d9d3de96586d68e4c8fb7845509577c4..a8060649ba6789d0870d3bf9117f2d6e045594a9 100644
--- a/indra/newview/lltoastnotifypanel.cpp
+++ b/indra/newview/lltoastnotifypanel.cpp
@@ -243,8 +243,8 @@ LLButton* LLToastNotifyPanel::createButton(const LLSD& form_element, BOOL is_opt
 	mBtnCallbackData.push_back(userdata);
 
 	LLButton::Params p;
-	bool is_ignore_btn = form_element["index"].asInteger() == -1;
-	const LLFontGL* font = is_ignore_btn ? sFontSmall: sFont; // for ignore button in script dialog
+	bool make_small_btn = form_element["index"].asInteger() == -1 || form_element["index"].asInteger() == -2;
+	const LLFontGL* font = make_small_btn ? sFontSmall: sFont; // for block and ignore buttons in script dialog
 	p.name(form_element["name"].asString());
 	p.label(form_element["text"].asString());
 	p.font(font);
@@ -264,7 +264,7 @@ LLButton* LLToastNotifyPanel::createButton(const LLSD& form_element, BOOL is_opt
 		p.rect.width = 1;
 		p.auto_resize = true;
 	}
-	else if (mIsScriptDialog && is_ignore_btn)
+	else if (mIsScriptDialog && make_small_btn)
 	{
 		// this is ignore button, make it smaller
 		p.rect.height = BTN_HEIGHT_SMALL;
diff --git a/indra/newview/lltoastpanel.cpp b/indra/newview/lltoastpanel.cpp
index fc69157a40841662f1d7f00eb4bc0f0cd93f8a6a..d2a4ce8745a27f655a2a11200d313aebd180a60d 100644
--- a/indra/newview/lltoastpanel.cpp
+++ b/indra/newview/lltoastpanel.cpp
@@ -68,7 +68,7 @@ void LLToastPanel::snapToMessageHeight(LLTextBase* message, S32 maxLineCount)
 	if (message->getVisible())
 	{
 		S32 heightDelta = 0;
-		S32 maxTextHeight = (S32)(message->getDefaultFont()->getLineHeight() * maxLineCount);
+		S32 maxTextHeight = message->getDefaultFont()->getLineHeight() * maxLineCount;
 
 		LLRect messageRect = message->getRect();
 		S32 oldTextHeight = messageRect.getHeight();
diff --git a/indra/newview/lltool.h b/indra/newview/lltool.h
index d3edabb48669c3f00888ce19f5195837f6f2364a..ecc435d84413e9373b27f16e9c0ca0c4c6753d65 100644
--- a/indra/newview/lltool.h
+++ b/indra/newview/lltool.h
@@ -68,7 +68,7 @@ class LLTool
 	virtual void	localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const
 							{ *screen_x = local_x; *screen_y = local_y;	}
 
-	virtual std::string getName() const	{ return mName; }
+	virtual const std::string& getName() const	{ return mName; }
 
 	// New virtual functions
 	virtual LLViewerObject*	getEditingObject()		{ return NULL; }
diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp
index 5ff0ccfeb218280d4db2f1b37d7330b2e4b41db8..81ad96f39e4f34b321ee0bb3a47b982e0a01e36c 100644
--- a/indra/newview/lltoolbarview.cpp
+++ b/indra/newview/lltoolbarview.cpp
@@ -73,7 +73,9 @@ LLToolBarView::ToolbarSet::ToolbarSet()
 LLToolBarView::LLToolBarView(const LLToolBarView::Params& p)
 :	LLUICtrl(p),
 	mDragStarted(false),
+	mShowToolbars(true),
 	mDragToolbarButton(NULL),
+	mDragItem(NULL),
 	mToolbarsLoaded(false)
 {
 	for (S32 i = 0; i < TOOLBAR_COUNT; i++)
@@ -530,6 +532,13 @@ void LLToolBarView::draw()
 		}
 	}
 	
+	for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
+	{
+		mToolbars[i]->getParent()->setVisible(mShowToolbars 
+											&& (mToolbars[i]->hasButtons() 
+											|| isToolDragged()));
+	}
+
 	// Draw drop zones if drop of a tool is active
 	if (isToolDragged())
 	{
@@ -571,7 +580,6 @@ BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp
 			uuid_vec_t cargo_ids;
 			types.push_back(DAD_WIDGET);
 			cargo_ids.push_back(uuid);
-			gClipboard.setSourceObject(uuid,LLAssetType::AT_WIDGET);
 			LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_VIEWER;
 			LLUUID srcID;
 			LLToolDragAndDrop::getInstance()->beginMultiDrag(types, cargo_ids, src, srcID);
@@ -654,12 +662,21 @@ void LLToolBarView::resetDragTool(LLToolBarButton* toolbarButton)
 	gToolBarView->mDragToolbarButton = toolbarButton;
 }
 
-void LLToolBarView::setToolBarsVisible(bool visible)
+// Provide a handle on a free standing inventory item containing references to the tool.
+// This might be used by Drag and Drop to move around references to tool items.
+LLInventoryObject* LLToolBarView::getDragItem()
 {
-	for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
+	if (mDragToolbarButton)
 	{
-		mToolbars[i]->getParent()->setVisible(visible);
+		LLUUID item_uuid = mDragToolbarButton->getCommandId().uuid();
+		mDragItem = new LLInventoryObject (item_uuid, LLUUID::null, LLAssetType::AT_WIDGET, "");
 	}
+	return mDragItem;
+}
+
+void LLToolBarView::setToolBarsVisible(bool visible)
+{
+	mShowToolbars = visible;
 }
 
 bool LLToolBarView::isModified() const
diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h
index b99e8bc28d69e7298f0465b2a988f9db03bf28fa..9c4194ebed1ce1c78a40f24bcd579d40f752e63f 100644
--- a/indra/newview/lltoolbarview.h
+++ b/indra/newview/lltoolbarview.h
@@ -31,6 +31,7 @@
 #include "lluictrl.h"
 #include "lltoolbar.h"
 #include "llcommandmanager.h"
+#include "llinventory.h"
 
 class LLUICtrlFactory;
 
@@ -106,6 +107,7 @@ class LLToolBarView : public LLUICtrl
 	static BOOL handleDragTool(S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type);
 	static BOOL handleDropTool(void* cargo_data, S32 x, S32 y, LLToolBar* toolbar);
 	static void resetDragTool(LLToolBarButton* toolbarButton);
+	LLInventoryObject* getDragItem();
 
 	bool isModified() const;
 	
@@ -129,6 +131,8 @@ class LLToolBarView : public LLUICtrl
 	
 	bool				mDragStarted;
 	LLToolBarButton*	mDragToolbarButton;
+	LLInventoryObject*	mDragItem;
+	bool				mShowToolbars;
 };
 
 extern LLToolBarView* gToolBarView;
diff --git a/indra/newview/lltoolbrush.cpp b/indra/newview/lltoolbrush.cpp
index 9782b90cf1b3f2233cf75c3072d4004c5491ea9a..aba43a971534def7c0b709438c1104522f0dd09c 100644
--- a/indra/newview/lltoolbrush.cpp
+++ b/indra/newview/lltoolbrush.cpp
@@ -507,12 +507,12 @@ void LLToolBrushLand::render()
 void LLToolBrushLand::renderOverlay(LLSurface& land, const LLVector3& pos_region,
 									const LLVector3& pos_world)
 {
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 	LLGLDepthTest mDepthTest(GL_TRUE);
-	glPushMatrix();
+	gGL.pushMatrix();
 	gGL.color4fv(OVERLAY_COLOR.mV);
-	glTranslatef(0.0f, 0.0f, 1.0f);
+	gGL.translatef(0.0f, 0.0f, 1.0f);
 	
 	S32 i = (S32) pos_region.mV[VX];
 	S32 j = (S32) pos_region.mV[VY];
@@ -566,7 +566,7 @@ void LLToolBrushLand::renderOverlay(LLSurface& land, const LLVector3& pos_region
 	}
 	gGL.end();
 
-	glPopMatrix();
+	gGL.popMatrix();
 }
 
 void LLToolBrushLand::determineAffectedRegions(region_list_t& regions,
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index 6910b8eced63a39ec0f48a1ec3633edc81f7f000..4f4eef0f3d5421dc8cec30ffbccebc1e7a816e63 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -48,6 +48,7 @@
 #include "llpreviewnotecard.h"
 #include "llrootview.h"
 #include "llselectmgr.h"
+#include "lltoolbarview.h"
 #include "lltoolmgr.h"
 #include "lltooltip.h"
 #include "lltrans.h"
@@ -282,6 +283,8 @@ void LLCategoryDropDescendentsObserver::done()
 }
 */
 
+S32 LLToolDragAndDrop::sOperationId = 0;
+
 LLToolDragAndDrop::DragAndDropEntry::DragAndDropEntry(dragOrDrop3dImpl f_none,
 													  dragOrDrop3dImpl f_self,
 													  dragOrDrop3dImpl f_avatar,
@@ -331,14 +334,15 @@ LLToolDragAndDrop::LLDragAndDropDictionary::LLDragAndDropDictionary()
 };
 
 LLToolDragAndDrop::LLToolDragAndDrop()
-:	 LLTool(std::string("draganddrop"), NULL),
-	 mDragStartX(0),
-	 mDragStartY(0),
-	 mSource(SOURCE_AGENT),
-	 mCursor(UI_CURSOR_NO),
-	 mLastAccept(ACCEPT_NO),
-	 mDrop(FALSE),
-	 mCurItemIndex(0)
+:	LLTool(std::string("draganddrop"), NULL),
+	mCargoCount(0),
+	mDragStartX(0),
+	mDragStartY(0),
+	mSource(SOURCE_AGENT),
+	mCursor(UI_CURSOR_NO),
+	mLastAccept(ACCEPT_NO),
+	mDrop(FALSE),
+	mCurItemIndex(0)
 {
 
 }
@@ -626,6 +630,8 @@ BOOL LLToolDragAndDrop::handleToolTip(S32 x, S32 y, MASK mask)
 void LLToolDragAndDrop::handleDeselect()
 {
 	mToolTipMsg.clear();
+
+	LLToolTipMgr::instance().blockToolTips();
 }
 
 // protected
@@ -642,6 +648,12 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
 
 	mToolTipMsg.clear();
 
+	// Increment the operation id for every drop
+	if (drop)
+	{
+		sOperationId++;
+	}
+
 	if (top_view)
 	{
 		handled = TRUE;
@@ -767,6 +779,21 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
 
 	if (!handled)
 	{
+		// Disallow drag and drop to 3D from the outbox
+		const LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false, false);
+		if (outbox_id.notNull())
+		{
+			for (S32 item_index = 0; item_index < (S32)mCargoIDs.size(); item_index++)
+			{
+				if (gInventory.isObjectDescendentOf(mCargoIDs[item_index], outbox_id))
+				{
+					*acceptance = ACCEPT_NO;
+					mToolTipMsg = LLTrans::getString("TooltipOutboxDragToWorld");
+					return;
+				}
+			}
+		}
+		
 		dragOrDrop3D( x, y, mask, drop, acceptance );
 	}
 }
@@ -865,7 +892,7 @@ void LLToolDragAndDrop::pick(const LLPickInfo& pick_info)
 			(U32)mLastAccept,
 			(U32)callMemberFunction(*this, 
 									LLDragAndDropDictionary::instance().get(dad_type, target))
-			(hit_obj, hit_face, pick_info.mKeyMask, FALSE));
+				(hit_obj, hit_face, pick_info.mKeyMask, FALSE));
 	}
 
 	if (mDrop && ((U32)mLastAccept >= ACCEPT_YES_COPY_SINGLE))
@@ -2502,7 +2529,7 @@ LLInventoryObject* LLToolDragAndDrop::locateInventory(
 	}
 	else if(mSource == SOURCE_VIEWER)
 	{
-		item = (LLViewerInventoryItem*)gClipboard.getSourceObject();
+		item = (LLViewerInventoryItem*)gToolBarView->getDragItem();
 	}
 	if(item) return item;
 	if(cat) return cat;
diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h
index 92f007a2518e21258872f24ca7dc1188ecd016d1..245c2a23e63b40d39325867d3b02351c9cc73e9c 100644
--- a/indra/newview/lltooldraganddrop.h
+++ b/indra/newview/lltooldraganddrop.h
@@ -87,6 +87,12 @@ class LLToolDragAndDrop : public LLTool, public LLSingleton<LLToolDragAndDrop>
 
 	boost::signals2::connection setEndDragCallback( const enddrag_signal_t::slot_type& cb ) { return mEndDragSignal.connect(cb); }
 
+	void setCargoCount(U32 count) { mCargoCount = count; }
+	void resetCargoCount() { mCargoCount = 0; }
+	U32 getCargoCount() const { return (mCargoCount > 0) ? mCargoCount : mCargoIDs.size(); }
+
+	static S32 getOperationId() { return sOperationId; }
+
 protected:
 	enum EDropTarget
 	{
@@ -115,6 +121,8 @@ class LLToolDragAndDrop : public LLTool, public LLSingleton<LLToolDragAndDrop>
 
 protected:
 
+	U32				mCargoCount;
+
 	S32				mDragStartX;
 	S32				mDragStartY;
 	
@@ -125,6 +133,8 @@ class LLToolDragAndDrop : public LLTool, public LLSingleton<LLToolDragAndDrop>
 	LLUUID mSourceID;
 	LLUUID mObjectID;
 
+	static S32		sOperationId;
+
 	LLVector3d		mLastCameraPos;
 	LLVector3d		mLastHitPos;
 
diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp
index 6bc7c6de11b8b22e58ab605d5a79a3d4bbd76028..ac01316462caa8b43c8e646f116cc3fcd9cb26d9 100644
--- a/indra/newview/lltoolmgr.cpp
+++ b/indra/newview/lltoolmgr.cpp
@@ -81,7 +81,7 @@ LLToolMgr::LLToolMgr()
 	// Not a panel, register these callbacks globally.
 	LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Active", boost::bind(&LLToolMgr::inEdit, this));
 	LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Enabled", boost::bind(&LLToolMgr::canEdit, this));
-	LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Build.Toggle", boost::bind(&LLToolMgr::toggleBuildMode, this));
+	LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Build.Toggle", boost::bind(&LLToolMgr::toggleBuildMode, this, _2));
 	
 	gToolNull = new LLTool(LLStringUtil::null);  // Does nothing
 	setCurrentTool(gToolNull);
@@ -245,8 +245,15 @@ bool LLToolMgr::canEdit()
 	return LLViewerParcelMgr::getInstance()->allowAgentBuild();
 }
 
-void LLToolMgr::toggleBuildMode()
+void LLToolMgr::toggleBuildMode(const LLSD& sdname)
 {
+	const std::string& param = sdname.asString();
+
+	if (param == "build" && !canEdit())
+	{
+		return;
+	}
+
 	LLFloaterReg::toggleInstanceOrBringToFront("build");
 
 	bool build_visible = LLFloaterReg::instanceVisible("build");
diff --git a/indra/newview/lltoolmgr.h b/indra/newview/lltoolmgr.h
index d489c4c829f2ad0706eda0345ab6d02a77824e74..12649cfba2d92e33482a98c54b6cb0620fc44b78 100644
--- a/indra/newview/lltoolmgr.h
+++ b/indra/newview/lltoolmgr.h
@@ -54,7 +54,7 @@ class LLToolMgr : public LLSingleton<LLToolMgr>
 
 	bool			inEdit();
 	bool			canEdit();
-	void			toggleBuildMode();
+	void			toggleBuildMode(const LLSD& sdname);
 	
 	/* Determines if we are in Build mode or not. */
 	bool			inBuildMode();
diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp
index 964b17d3a665b1bc1f3cadc4d12cb86a30db15d8..718201e381ad43dbea301b0618632dbb76da10ee 100644
--- a/indra/newview/lltoolmorph.cpp
+++ b/indra/newview/lltoolmorph.cpp
@@ -169,23 +169,28 @@ BOOL LLVisualParamHint::render()
 	gGL.pushUIMatrix();
 	gGL.loadUIIdentity();
 
-	glMatrixMode(GL_PROJECTION);
+	gGL.matrixMode(LLRender::MM_PROJECTION);
 	gGL.pushMatrix();
-	glLoadIdentity();
-	glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
+	gGL.loadIdentity();
+	gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
 
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.pushMatrix();
-	glLoadIdentity();
+	gGL.loadIdentity();
+
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		gUIProgram.bind();
+	}
 
 	LLGLSUIDefault gls_ui;
 	//LLGLState::verify(TRUE);
 	mBackgroundp->draw(0, 0, mFullWidth, mFullHeight);
 
-	glMatrixMode(GL_PROJECTION);
+	gGL.matrixMode(LLRender::MM_PROJECTION);
 	gGL.popMatrix();
 
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.popMatrix();
 
 	mNeedsUpdate = FALSE;
diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp
index efe9bb8da7cdeb27f0ea6c1c16959ee1f77a358c..bf1f8808a7028a43658683c8a195f8ede6aae07d 100644
--- a/indra/newview/lltracker.cpp
+++ b/indra/newview/lltracker.cpp
@@ -509,9 +509,10 @@ void LLTracker::renderBeacon(LLVector3d pos_global,
 	LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
 	
 	
-	glMatrixMode(GL_MODELVIEW);
-	glPushMatrix();
-		glTranslatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
+	gGL.pushMatrix();
+	{
+		gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
 		
 		draw_shockwave(1024.f, gRenderStartTime.getElapsedTimeF32(), 32, fogged_color);
 
@@ -563,9 +564,8 @@ void LLTracker::renderBeacon(LLVector3d pos_global,
 			
 			gGL.end();
 		}
-							
-		//gCylinder.render(1000);
-	glPopMatrix();
+	}
+	gGL.popMatrix();
 
 	std::string text;
 	text = llformat( "%.0f m", to_vec.magVec());
diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp
old mode 100644
new mode 100755
index 7eb54271f405eb8f96096ad99c3cd18f9b3aef95..f3d8de1904be0f2f1ccabdd0d806805806db13fa
--- a/indra/newview/lltranslate.cpp
+++ b/indra/newview/lltranslate.cpp
@@ -95,6 +95,12 @@ bool LLGoogleTranslationHandler::parseResponse(
 	return parseTranslation(root, translation, detected_lang);
 }
 
+// virtual
+bool LLGoogleTranslationHandler::isConfigured() const
+{
+	return !getAPIKey().empty();
+}
+
 // static
 void LLGoogleTranslationHandler::parseErrorResponse(
 	const Json::Value& root,
@@ -156,10 +162,10 @@ void LLBingTranslationHandler::getTranslateURL(
 	const std::string &text) const
 {
 	url = std::string("http://api.microsofttranslator.com/v2/Http.svc/Translate?appId=")
-		+ getAPIKey() + "&text=" + LLURI::escape(text) + "&to=" + to_lang;
+		+ getAPIKey() + "&text=" + LLURI::escape(text) + "&to=" + getAPILanguageCode(to_lang);
 	if (!from_lang.empty())
 	{
-		url += "&from=" + from_lang;
+		url += "&from=" + getAPILanguageCode(from_lang);
 	}
 }
 
@@ -218,12 +224,24 @@ bool LLBingTranslationHandler::parseResponse(
 	return true;
 }
 
+// virtual
+bool LLBingTranslationHandler::isConfigured() const
+{
+	return !getAPIKey().empty();
+}
+
 // static
 std::string LLBingTranslationHandler::getAPIKey()
 {
 	return gSavedSettings.getString("BingTranslateAPIKey");
 }
 
+// static
+std::string LLBingTranslationHandler::getAPILanguageCode(const std::string& lang)
+{
+	return lang == "zh" ? "zh-CHT" : lang; // treat Chinese as Traditional Chinese
+}
+
 LLTranslate::TranslationReceiver::TranslationReceiver(const std::string& from_lang, const std::string& to_lang)
 :	mFromLang(from_lang)
 ,	mToLang(to_lang)
@@ -331,6 +349,12 @@ std::string LLTranslate::getTranslateLanguage()
 	return language;
 }
 
+// static
+bool LLTranslate::isTranslationConfigured()
+{
+	return getPreferredHandler().isConfigured();
+}
+
 // static
 const LLTranslationAPIHandler& LLTranslate::getPreferredHandler()
 {
diff --git a/indra/newview/lltranslate.h b/indra/newview/lltranslate.h
old mode 100644
new mode 100755
index c2330daa8176628ca9a92cf560d10202d4823684..c58e1adb8ca031a9061c1aae15502fd455e9dc88
--- a/indra/newview/lltranslate.h
+++ b/indra/newview/lltranslate.h
@@ -89,6 +89,11 @@ class LLTranslationAPIHandler
 		std::string& detected_lang,
 		std::string& err_msg) const = 0;
 
+	/**
+	 * @return if the handler is configured to function properly
+	 */
+	virtual bool isConfigured() const = 0;
+
 	virtual ~LLTranslationAPIHandler() {}
 
 protected:
@@ -115,6 +120,7 @@ class LLGoogleTranslationHandler : public LLTranslationAPIHandler
 		std::string& translation,
 		std::string& detected_lang,
 		std::string& err_msg) const;
+	/*virtual*/ bool isConfigured() const;
 
 private:
 	static void parseErrorResponse(
@@ -148,8 +154,10 @@ class LLBingTranslationHandler : public LLTranslationAPIHandler
 		std::string& translation,
 		std::string& detected_lang,
 		std::string& err_msg) const;
+	/*virtual*/ bool isConfigured() const;
 private:
 	static std::string getAPIKey();
+	static std::string getAPILanguageCode(const std::string& lang);
 };
 
 /**
@@ -275,8 +283,17 @@ public :
 	 * @param key       Key to verify.
 	 */
 	static void verifyKey(KeyVerificationReceiverPtr& receiver, const std::string& key);
+
+	/**
+	 * @return translation target language
+	 */
 	static std::string getTranslateLanguage();
 
+	/**
+	 * @return true if translation is configured properly.
+	 */
+	static bool isTranslationConfigured();
+
 private:
 	static const LLTranslationAPIHandler& getPreferredHandler();
 	static const LLTranslationAPIHandler& getHandler(EService service);
diff --git a/indra/newview/lluploaddialog.cpp b/indra/newview/lluploaddialog.cpp
index df7c5be0d6d573ff74867fe184ff336f98600662..e59064c0743097ed8a790cce8bb8fe7cb436edf2 100644
--- a/indra/newview/lluploaddialog.cpp
+++ b/indra/newview/lluploaddialog.cpp
@@ -115,7 +115,7 @@ void LLUploadDialog::setMessage( const std::string& msg)
 		token = strtok( NULL, "\n" );
 	}
 
-	S32 line_height = S32( font->getLineHeight() + 0.99f );
+	S32 line_height = font->getLineHeight();
 	S32 dialog_width = max_msg_width + 2 * HPAD;
 	S32 dialog_height = line_height * msg_lines.size() + 2 * VPAD;
 
diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp
index f6d7ceeec366159488309eea2e1ac1a6ad0e5567..4240a38326369a61f1cbd17ab6c8583f837f92fe 100644
--- a/indra/newview/llurldispatcher.cpp
+++ b/indra/newview/llurldispatcher.cpp
@@ -167,9 +167,9 @@ bool LLURLDispatcherImpl::dispatchApp(const LLSLURL& slurl,
 // static
 bool LLURLDispatcherImpl::dispatchRegion(const LLSLURL& slurl, const std::string& nav_type, bool right_mouse)
 {
-  if(slurl.getType() != LLSLURL::LOCATION)
+	if(slurl.getType() != LLSLURL::LOCATION)
     {
-      return false;
+		return false;
     }
 	// Before we're logged in, need to update the startup screen
 	// to tell the user where they are going.
diff --git a/indra/newview/llurllineeditorctrl.cpp b/indra/newview/llurllineeditorctrl.cpp
index 56b5bbf9420685965a9562183f83314dda4b2951..cad57690421a4c0b51fb1403fb4f6305cb884525 100644
--- a/indra/newview/llurllineeditorctrl.cpp
+++ b/indra/newview/llurllineeditorctrl.cpp
@@ -89,5 +89,5 @@ void LLURLLineEditor::copyEscapedURLToClipboard()
 	else // human-readable location
 		text_to_copy = utf8str_to_wstring(unescaped_text);
 		
-	gClipboard.copyFromString( text_to_copy );
+	LLClipboard::instance().copyToClipboard(text_to_copy, 0, text_to_copy.size());
 }
diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp
index 36c8b42a5223eab5369e9d4b2bca9728da8bc03f..d042f6283086783baa01118b6f0a44ae69c3cb47 100644
--- a/indra/newview/llviewerassetstorage.cpp
+++ b/indra/newview/llviewerassetstorage.cpp
@@ -116,7 +116,7 @@ void LLViewerAssetStorage::storeAssetData(
 	F64 timeout)
 {
 	LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
-	llinfos << "LLViewerAssetStorage::storeAssetData (legacy) " << tid << ":" << LLAssetType::lookup(asset_type)
+	LL_DEBUGS("AssetStorage") << "LLViewerAssetStorage::storeAssetData (legacy) " << tid << ":" << LLAssetType::lookup(asset_type)
 			<< " ASSET_ID: " << asset_id << llendl;
 	
 	if (mUpstreamHost.isOk())
@@ -248,9 +248,9 @@ void LLViewerAssetStorage::storeAssetData(
 	}
 	
 	LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
-	llinfos << "LLViewerAssetStorage::storeAssetData (legacy)" << asset_id << ":" << LLAssetType::lookup(asset_type) << llendl;
+	LL_DEBUGS("AssetStorage") << "LLViewerAssetStorage::storeAssetData (legacy)" << asset_id << ":" << LLAssetType::lookup(asset_type) << llendl;
 
-	llinfos << "ASSET_ID: " << asset_id << llendl;
+	LL_DEBUGS("AssetStorage") << "ASSET_ID: " << asset_id << llendl;
 
 	S32 size = 0;
 	LLFILE* fp = LLFile::fopen(filename, "rb");
@@ -369,7 +369,7 @@ void LLViewerAssetStorage::_queueDataRequest(
 			tpvf.setAsset(uuid, atype);
 			tpvf.setCallback(downloadCompleteCallback, req);
 
-			llinfos << "Starting transfer for " << uuid << llendl;
+			LL_DEBUGS("AssetStorage") << "Starting transfer for " << uuid << llendl;
 			LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(mUpstreamHost, LLTCT_ASSET);
 			ttcp->requestTransfer(spa, tpvf, 100.f + (is_priority ? 1.f : 0.f));
 
diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp
index f7fa5690d69989061bdb8207fc5e9bd04822317a..2447f5dea8da6928d025839d4ca183a53321af3f 100644
--- a/indra/newview/llvieweraudio.cpp
+++ b/indra/newview/llvieweraudio.cpp
@@ -37,9 +37,226 @@
 #include "llvoiceclient.h"
 #include "llviewermedia.h"
 #include "llprogressview.h"
+#include "llcallbacklist.h"
+#include "llstartup.h"
+#include "llviewerparcelmgr.h"
+#include "llparcel.h"
 
 /////////////////////////////////////////////////////////
 
+LLViewerAudio::LLViewerAudio() :
+	mDone(true),
+	mFadeState(FADE_IDLE),
+	mFadeTime(),
+    mIdleListnerActive(false),
+	mForcedTeleportFade(false)
+{
+	mTeleportFailedConnection = LLViewerParcelMgr::getInstance()->
+		setTeleportFailedCallback(boost::bind(&LLViewerAudio::onTeleportFailed, this));
+}
+
+LLViewerAudio::~LLViewerAudio()
+{
+	mTeleportFailedConnection.disconnect();
+}
+
+void LLViewerAudio::registerIdleListener()
+{
+	if(mIdleListnerActive==false)
+	{
+		mIdleListnerActive = true;
+		doOnIdleRepeating(boost::bind(boost::bind(&LLViewerAudio::onIdleUpdate, this)));
+	}
+
+}
+
+void LLViewerAudio::startInternetStreamWithAutoFade(std::string streamURI)
+{
+	// Old and new stream are identical
+	if (mNextStreamURI == streamURI)
+	{
+		return;
+	}
+
+	// Record the URI we are going to be switching to	
+	mNextStreamURI = streamURI;
+
+	switch (mFadeState)
+	{
+		case FADE_IDLE:
+		// If a stream is playing fade it out first
+		if (!gAudiop->getInternetStreamURL().empty())
+		{
+			// The order of these tests is important, state FADE_OUT will be processed below
+			mFadeState = FADE_OUT;
+		}
+		// Otherwise the new stream can be faded in
+		else
+		{
+			mFadeState = FADE_IN;
+			gAudiop->startInternetStream(mNextStreamURI);
+			startFading();
+			registerIdleListener();
+			break;
+		}
+
+		case FADE_OUT:
+			startFading();
+			registerIdleListener();
+			break;
+
+		case FADE_IN:
+			registerIdleListener();
+			break;
+
+		default:
+			llwarns << "Unknown fading state: " << mFadeState << llendl;
+			break;
+	}
+}
+
+// A return of false from onIdleUpdate means it will be called again next idle update.
+// A return of true means we have finished with it and the callback will be deleted.
+bool LLViewerAudio::onIdleUpdate()
+{
+	bool fadeIsFinished = false;
+
+	// There is a delay in the login sequence between when the parcel information has
+	// arrived and the music stream is started and when the audio system is called to set
+	// initial volume levels.  This code extends the fade time so you hear a full fade in.
+	if ((LLStartUp::getStartupState() < STATE_STARTED))
+	{
+		stream_fade_timer.reset();
+		stream_fade_timer.setTimerExpirySec(mFadeTime);
+	}
+
+	if (mDone)
+	{
+		//  This should be a rare or never occurring state.
+		if (mFadeState == FADE_IDLE)
+		{
+			deregisterIdleListener();
+			fadeIsFinished = true; // Stop calling onIdleUpdate
+		}
+
+		// we have finished the current fade operation
+		if (mFadeState == FADE_OUT)
+		{
+			// Clear URI
+			gAudiop->startInternetStream(LLStringUtil::null);
+			gAudiop->stopInternetStream();
+				
+			if (!mNextStreamURI.empty())
+			{
+				mFadeState = FADE_IN;
+				gAudiop->startInternetStream(mNextStreamURI);
+				startFading();
+			}
+			else
+			{
+				mFadeState = FADE_IDLE;
+				deregisterIdleListener();
+				fadeIsFinished = true; // Stop calling onIdleUpdate
+			}
+		}
+		else if (mFadeState == FADE_IN)
+		{
+			if (mNextStreamURI != gAudiop->getInternetStreamURL())
+			{
+				mFadeState = FADE_OUT;
+				startFading();
+			}
+			else
+			{
+				mFadeState = FADE_IDLE;
+				deregisterIdleListener();
+				fadeIsFinished = true; // Stop calling onIdleUpdate
+			}
+		}
+	}
+
+	return fadeIsFinished;
+}
+
+void LLViewerAudio::stopInternetStreamWithAutoFade()
+{
+	mFadeState = FADE_IDLE;
+	mNextStreamURI = LLStringUtil::null;
+	mDone = true;
+
+	gAudiop->startInternetStream(LLStringUtil::null);
+	gAudiop->stopInternetStream();
+}
+
+void LLViewerAudio::startFading()
+{
+	const F32 AUDIO_MUSIC_FADE_IN_TIME = 3.0f;
+	const F32 AUDIO_MUSIC_FADE_OUT_TIME = 2.0f;
+	// This minimum fade time prevents divide by zero and negative times
+	const F32 AUDIO_MUSIC_MINIMUM_FADE_TIME = 0.01f;
+
+	if(mDone)
+	{
+		// The fade state here should only be one of FADE_IN or FADE_OUT, but, in case it is not,
+		// rather than check for both states assume a fade in and check for the fade out case.
+		mFadeTime = AUDIO_MUSIC_FADE_IN_TIME;
+		if (LLViewerAudio::getInstance()->getFadeState() == LLViewerAudio::FADE_OUT)
+		{
+			mFadeTime = AUDIO_MUSIC_FADE_OUT_TIME;
+		}
+
+		// Prevent invalid fade time
+		mFadeTime = llmax(mFadeTime, AUDIO_MUSIC_MINIMUM_FADE_TIME);
+
+		stream_fade_timer.reset();
+		stream_fade_timer.setTimerExpirySec(mFadeTime);
+		mDone = false;
+	}
+}
+
+F32 LLViewerAudio::getFadeVolume()
+{
+	F32 fade_volume = 1.0f;
+
+	if (stream_fade_timer.hasExpired())
+	{
+		mDone = true;
+		// If we have been fading out set volume to 0 until the next fade state occurs to prevent
+		// an audio transient.
+		if (LLViewerAudio::getInstance()->getFadeState() == LLViewerAudio::FADE_OUT)
+		{
+			fade_volume = 0.0f;
+		}
+	}
+
+	if (!mDone)
+	{
+		// Calculate how far we are into the fade time
+		fade_volume = stream_fade_timer.getElapsedTimeF32() / mFadeTime;
+		
+		if (LLViewerAudio::getInstance()->getFadeState() == LLViewerAudio::FADE_OUT)
+		{
+			// If we are not fading in then we are fading out, so invert the fade
+			// direction; start loud and move towards zero volume.
+			fade_volume = 1.0f - fade_volume;
+		}
+	}
+
+	return fade_volume;
+}
+
+void LLViewerAudio::onTeleportFailed()
+{
+	if (gAudiop)
+	{
+		LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+		if (parcel)
+		{
+			mNextStreamURI = parcel->getMusicURL();
+		}
+	}
+}
+
 void init_audio() 
 {
 	if (!gAudiop) 
@@ -142,12 +359,25 @@ void audio_update_volume(bool force_update)
 
 	// Streaming Music
 	if (gAudiop) 
-	{		
+	{
+		if (progress_view_visible  && !LLViewerAudio::getInstance()->getForcedTeleportFade())
+		{
+			LLViewerAudio::getInstance()->setForcedTeleportFade(true);
+			LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
+			LLViewerAudio::getInstance()->setNextStreamURI(LLStringUtil::null);
+		}
+
+		if (!progress_view_visible && LLViewerAudio::getInstance()->getForcedTeleportFade() == true)
+		{
+			LLViewerAudio::getInstance()->setForcedTeleportFade(false);
+		}
+
 		F32 music_volume = gSavedSettings.getF32("AudioLevelMusic");
 		BOOL music_muted = gSavedSettings.getBOOL("MuteMusic");
-		music_volume = mute_volume * master_volume * music_volume;
-		gAudiop->setInternetStreamGain ( music_muted || progress_view_visible ? 0.f : music_volume );
-	
+		F32 fade_volume = LLViewerAudio::getInstance()->getFadeVolume();
+
+		music_volume = mute_volume * master_volume * music_volume * fade_volume;
+		gAudiop->setInternetStreamGain (music_muted ? 0.f : music_volume);
 	}
 
 	// Streaming Media
diff --git a/indra/newview/llvieweraudio.h b/indra/newview/llvieweraudio.h
index e5916285fba26684ed391bd8c8507bee3e9fcc29..a3da9fc6b8c12844d0df7995ba0ab696f3d2f187 100644
--- a/indra/newview/llvieweraudio.h
+++ b/indra/newview/llvieweraudio.h
@@ -27,6 +27,9 @@
 #ifndef LL_VIEWERAUDIO_H
 #define LL_VIEWERAUDIO_H
 
+#include "llframetimer.h"
+#include "llsingleton.h"
+
 // comment out to turn off wind
 #define kAUDIO_ENABLE_WIND 
 //#define kAUDIO_ENABLE_WATER 1	// comment out to turn off water
@@ -38,4 +41,48 @@ void audio_update_volume(bool force_update = true);
 void audio_update_listener();
 void audio_update_wind(bool force_update = true);
 
+class LLViewerAudio : public LLSingleton<LLViewerAudio>
+{
+public:
+
+	enum EFadeState
+	{
+		FADE_IDLE,
+		FADE_IN,
+		FADE_OUT,
+	};
+
+	LLViewerAudio();
+	virtual ~LLViewerAudio();
+	
+	void startInternetStreamWithAutoFade(std::string streamURI);
+	void stopInternetStreamWithAutoFade();
+	
+	bool onIdleUpdate();
+
+	EFadeState getFadeState() { return mFadeState; }
+	bool isDone() { return mDone; };
+	F32 getFadeVolume();
+	bool getForcedTeleportFade() { return mForcedTeleportFade; };
+	void setForcedTeleportFade(bool fade) { mForcedTeleportFade = fade;} ;
+	void setNextStreamURI(std::string stream) { mNextStreamURI = stream; } ;
+
+private:
+
+	bool mDone;
+	F32 mFadeTime;
+	std::string mNextStreamURI;
+	EFadeState mFadeState;
+	LLFrameTimer stream_fade_timer;
+	bool mIdleListnerActive;
+	bool mForcedTeleportFade;
+	boost::signals2::connection	mTeleportFailedConnection;
+
+	void registerIdleListener();
+	void deregisterIdleListener() { mIdleListnerActive = false; };
+	void startFading();
+	void onTeleportFailed();
+
+};
+
 #endif //LL_VIEWER_H
diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp
index 7f7366dd3d9ec50b2cf857c28c80e2c05e0938e3..a437a8b3b53624fbfc657507db888792291a474e 100644
--- a/indra/newview/llviewercamera.cpp
+++ b/indra/newview/llviewercamera.cpp
@@ -218,8 +218,15 @@ void LLViewerCamera::calcProjection(const F32 far_distance) const
 void LLViewerCamera::updateFrustumPlanes(LLCamera& camera, BOOL ortho, BOOL zflip, BOOL no_hacks)
 {
 	GLint* viewport = (GLint*) gGLViewport;
-	GLdouble* model = gGLModelView;
-	GLdouble* proj = gGLProjection;
+	F64 model[16];
+	F64 proj[16];
+
+	for (U32 i = 0; i < 16; i++)
+	{
+		model[i] = (F64) gGLModelView[i];
+		proj[i] = (F64) gGLProjection[i];
+	}
+
 	GLdouble objX,objY,objZ;
 
 	LLVector3 frust[8];
@@ -325,8 +332,8 @@ void LLViewerCamera::setPerspective(BOOL for_selection,
 	aspect = getAspect();
 
 	// Load camera view matrix
-	glMatrixMode( GL_PROJECTION );
-	glLoadIdentity();
+	gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.loadIdentity();
 
 	glh::matrix4f proj_mat;
 
@@ -385,14 +392,14 @@ void LLViewerCamera::setPerspective(BOOL for_selection,
 
 	proj_mat *= gl_perspective(fov_y,aspect,z_near,z_far);
 
-	glLoadMatrixf(proj_mat.m);
+	gGL.loadMatrix(proj_mat.m);
 
 	for (U32 i = 0; i < 16; i++)
 	{
 		gGLProjection[i] = proj_mat.m[i];
 	}
 
-	glMatrixMode( GL_MODELVIEW );
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 
 	glh::matrix4f modelview((GLfloat*) OGL_TO_CFR_ROTATION);
 
@@ -402,7 +409,7 @@ void LLViewerCamera::setPerspective(BOOL for_selection,
 
 	modelview *= glh::matrix4f(ogl_matrix);
 	
-	glLoadMatrixf(modelview.m);
+	gGL.loadMatrix(modelview.m);
 	
 	if (for_selection && (width > 1 || height > 1))
 	{
@@ -420,7 +427,6 @@ void LLViewerCamera::setPerspective(BOOL for_selection,
 	if (!for_selection && mZoomFactor == 1.f)
 	{
 		// Save GL matrices for access elsewhere in code, especially project_world_to_screen
-		//glGetDoublev(GL_MODELVIEW_MATRIX, gGLModelView);
 		for (U32 i = 0; i < 16; i++)
 		{
 			gGLModelView[i] = modelview.m[i];
@@ -428,14 +434,6 @@ void LLViewerCamera::setPerspective(BOOL for_selection,
 	}
 
 	updateFrustumPlanes(*this);
-
-	/*if (gSavedSettings.getBOOL("CameraOffset"))
-	{
-		glMatrixMode(GL_PROJECTION);
-		glTranslatef(0,0,-50);
-		glRotatef(20.0,1,0,0);
-		glMatrixMode(GL_MODELVIEW);
-	}*/
 }
 
 
@@ -443,11 +441,20 @@ void LLViewerCamera::setPerspective(BOOL for_selection,
 // screen coordinates to the agent's region.
 void LLViewerCamera::projectScreenToPosAgent(const S32 screen_x, const S32 screen_y, LLVector3* pos_agent) const
 {
-
 	GLdouble x, y, z;
+
+	F64 mdlv[16];
+	F64 proj[16];
+
+	for (U32 i = 0; i < 16; i++)
+	{
+		mdlv[i] = (F64) gGLModelView[i];
+		proj[i] = (F64) gGLProjection[i];
+	}
+
 	gluUnProject(
 		GLdouble(screen_x), GLdouble(screen_y), 0.0,
-		gGLModelView, gGLProjection, (GLint*)gGLViewport,
+		mdlv, proj, (GLint*)gGLViewport,
 		&x,
 		&y,
 		&z );
@@ -484,8 +491,17 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord
 	viewport[2] = world_view_rect.getWidth();
 	viewport[3] = world_view_rect.getHeight();
 
+	F64 mdlv[16];
+	F64 proj[16];
+
+	for (U32 i = 0; i < 16; i++)
+	{
+		mdlv[i] = (F64) gGLModelView[i];
+		proj[i] = (F64) gGLProjection[i];
+	}
+
 	if (GL_TRUE == gluProject(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ],
-								gGLModelView, gGLProjection, (GLint*)viewport,
+								mdlv, proj, (GLint*)viewport,
 								&x, &y, &z))
 	{
 		// convert screen coordinates to virtual UI coordinates
@@ -587,9 +603,19 @@ BOOL LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent,
 	viewport[2] = world_view_rect.getWidth();
 	viewport[3] = world_view_rect.getHeight();
 	GLdouble	x, y, z;			// object's window coords, GL-style
+
+	F64 mdlv[16];
+	F64 proj[16];
+
+	for (U32 i = 0; i < 16; i++)
+	{
+		mdlv[i] = (F64) gGLModelView[i];
+		proj[i] = (F64) gGLProjection[i];
+	}
+
 	if (GL_TRUE == gluProject(pos_agent.mV[VX], pos_agent.mV[VY],
-							  pos_agent.mV[VZ], gGLModelView,
-							  gGLProjection, (GLint*)viewport,
+							  pos_agent.mV[VZ], mdlv,
+							  proj, (GLint*)viewport,
 							  &x, &y, &z))
 	{
 		x /= gViewerWindow->getDisplayScale().mV[VX];
diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h
index cc3395115ba567edccc7fa99546c580ab36765a6..184033de424bc6b1ea9d21536ba816971dc4985d 100644
--- a/indra/newview/llviewercamera.h
+++ b/indra/newview/llviewercamera.h
@@ -32,8 +32,8 @@
 #include "llstat.h"
 #include "lltimer.h"
 #include "m4math.h"
+#include "llcoord.h"
 
-class LLCoordGL;
 class LLViewerObject;
 
 // This rotation matrix moves the default OpenGL reference frame 
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 967e26be0ceef439be1dbd84f5ef0244b76dc863..ab45aae5cc982517e0fd518ef8f57835eb2afe8e 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -118,12 +118,6 @@ static bool handleSetShaderChanged(const LLSD& newvalue)
 	gBumpImageList.destroyGL();
 	gBumpImageList.restoreGL();
 
-	// Changing shader also changes the terrain detail to high, reflect that change here
-	if (newvalue.asBoolean())
-	{
-		// shaders enabled, set terrain detail to high
-		gSavedSettings.setS32("RenderTerrainDetail", 1);
-	}
 	// else, leave terrain detail as is
 	LLViewerShaderMgr::instance()->setShaders();
 	return true;
@@ -187,17 +181,12 @@ static bool handleReleaseGLBufferChanged(const LLSD& newvalue)
 	return true;
 }
 
-static bool handleFSAASamplesChanged(const LLSD& newvalue)
+static bool handleLUTBufferChanged(const LLSD& newvalue)
 {
 	if (gPipeline.isInit())
 	{
-		gPipeline.releaseGLBuffers();
-		gPipeline.createGLBuffers();
-
-		if (LLPipeline::sRenderDeferred)
-		{
-			LLViewerShaderMgr::instance()->setShaders();
-		}
+		gPipeline.releaseLUTBuffers();
+		gPipeline.createLUTBuffers();
 	}
 	return true;
 }
@@ -403,6 +392,7 @@ static bool handleRenderDeferredChanged(const LLSD& newvalue)
 	LLRenderTarget::sUseFBO = newvalue.asBoolean();
 	if (gPipeline.isInit())
 	{
+		LLPipeline::refreshCachedSettings();
 		gPipeline.updateRenderDeferred();
 		gPipeline.releaseGLBuffers();
 		gPipeline.createGLBuffers();
@@ -472,12 +462,6 @@ bool handleEffectColorChanged(const LLSD& newvalue)
 	return true;
 }
 
-bool handleVectorizeChanged(const LLSD& newvalue)
-{
-	LLViewerJointMesh::updateVectorize();
-	return true;
-}
-
 bool handleHighResSnapshotChanged(const LLSD& newvalue)
 {
 	// High Res Snapshot active, must uncheck RenderUIInSnapshot
@@ -588,21 +572,20 @@ void settings_setup_listeners()
 	gSavedSettings.getControl("OctreeMaxNodeCapacity")->getSignal()->connect(boost::bind(&handleRepartition, _2));
 	gSavedSettings.getControl("OctreeAlphaDistanceFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2));
 	gSavedSettings.getControl("OctreeAttachmentSizeFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2));
-	gSavedSettings.getControl("RenderMaxTextureIndex")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
+	gSavedSettings.getControl("RenderMaxTextureIndex")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
 	gSavedSettings.getControl("RenderUseTriStrips")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
-	gSavedSettings.getControl("RenderAnimateTrees")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
 	gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
 	gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
 	gSavedSettings.getControl("RenderUIBuffer")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
-	gSavedSettings.getControl("RenderSpecularResX")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
-	gSavedSettings.getControl("RenderSpecularResY")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
-	gSavedSettings.getControl("RenderSpecularExponent")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
-	gSavedSettings.getControl("RenderFSAASamples")->getSignal()->connect(boost::bind(&handleFSAASamplesChanged, _2));
+	gSavedSettings.getControl("RenderDepthOfField")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
+	gSavedSettings.getControl("RenderFSAASamples")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
+	gSavedSettings.getControl("RenderSpecularResX")->getSignal()->connect(boost::bind(&handleLUTBufferChanged, _2));
+	gSavedSettings.getControl("RenderSpecularResY")->getSignal()->connect(boost::bind(&handleLUTBufferChanged, _2));
+	gSavedSettings.getControl("RenderSpecularExponent")->getSignal()->connect(boost::bind(&handleLUTBufferChanged, _2));
 	gSavedSettings.getControl("RenderAnisotropic")->getSignal()->connect(boost::bind(&handleAnisotropicChanged, _2));
 	gSavedSettings.getControl("RenderShadowResolutionScale")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
 	gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
 	gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
-	gSavedSettings.getControl("EnableRippleWater")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
 	gSavedSettings.getControl("RenderGlowResolutionPow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
 	gSavedSettings.getControl("RenderAvatarCloth")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
 	gSavedSettings.getControl("WindLightUseAtmosShaders")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
@@ -633,7 +616,6 @@ void settings_setup_listeners()
 	gSavedSettings.getControl("RenderDeferred")->getSignal()->connect(boost::bind(&handleRenderDeferredChanged, _2));
 	gSavedSettings.getControl("RenderShadowDetail")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
 	gSavedSettings.getControl("RenderDeferredSSAO")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
-	gSavedSettings.getControl("RenderDeferredGI")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
 	gSavedSettings.getControl("RenderPerformanceTest")->getSignal()->connect(boost::bind(&handleRenderPerfTestChanged, _2));
 	gSavedSettings.getControl("TextureMemory")->getSignal()->connect(boost::bind(&handleVideoMemoryChanged, _2));
 	gSavedSettings.getControl("AuditTexture")->getSignal()->connect(boost::bind(&handleAuditTextureChanged, _2));
@@ -658,6 +640,7 @@ void settings_setup_listeners()
 	gSavedSettings.getControl("MuteAmbient")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
 	gSavedSettings.getControl("MuteUI")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
 	gSavedSettings.getControl("RenderVBOEnable")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
+	gSavedSettings.getControl("RenderUseVAO")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
 	gSavedSettings.getControl("RenderVBOMappingDisable")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
 	gSavedSettings.getControl("RenderUseStreamVBO")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
 	gSavedSettings.getControl("RenderPreferStreamDraw")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
@@ -712,10 +695,6 @@ void settings_setup_listeners()
 	gSavedSettings.getControl("UserLogFile")->getSignal()->connect(boost::bind(&handleLogFileChanged, _2));
 	gSavedSettings.getControl("RenderHideGroupTitle")->getSignal()->connect(boost::bind(handleHideGroupTitleChanged, _2));
 	gSavedSettings.getControl("HighResSnapshot")->getSignal()->connect(boost::bind(handleHighResSnapshotChanged, _2));
-	gSavedSettings.getControl("VectorizePerfTest")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _2));
-	gSavedSettings.getControl("VectorizeEnable")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _2));
-	gSavedSettings.getControl("VectorizeProcessor")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _2));
-	gSavedSettings.getControl("VectorizeSkin")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _2));
 	gSavedSettings.getControl("EnableVoiceChat")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
 	gSavedSettings.getControl("PTTCurrentlyEnabled")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
 	gSavedSettings.getControl("PushToTalkButton")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index d6512207aebe3db0c5150792ffb247a3fdd78d34..0adb187dd20411e21274e4fe5309498831ba678f 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -124,7 +124,8 @@ void display_startup()
 
 	// Update images?
 	//gImageList.updateImages(0.01f);
-	
+	LLTexUnit::sWhiteTexture = LLViewerFetchedTexture::sWhiteImagep->getTexName();
+
 	LLGLSDefault gls_default;
 
 	// Required for HTML update in login screen
@@ -212,6 +213,10 @@ static LLFastTimer::DeclareTimer FTM_RENDER("Render", true);
 static LLFastTimer::DeclareTimer FTM_UPDATE_SKY("Update Sky");
 static LLFastTimer::DeclareTimer FTM_UPDATE_TEXTURES("Update Textures");
 static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE("Update Images");
+static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_CLASS("Class");
+static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_BUMP("Bump");
+static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_LIST("List");
+static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_DELETE("Delete");
 
 // Paint the display!
 void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
@@ -224,6 +229,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 		gGL.flush();
 		glClear(GL_COLOR_BUFFER_BIT);
 		gViewerWindow->getWindow()->swapBuffers();
+		LLPipeline::refreshCachedSettings();
 		gPipeline.resizeScreenTexture();
 		gResizeScreenTexture = FALSE;
 		gWindowResized = FALSE;
@@ -254,6 +260,9 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 
 	gPipeline.disableLights();
 	
+	//reset vertex buffers if needed
+	gPipeline.doResetVertexBuffers();
+
 	stop_glerror();
 
 	// Don't draw if the window is hidden or minimized.
@@ -523,10 +532,9 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 	// Note that these are not the same as GL defaults...
 
 	stop_glerror();
-	F32 one[4] =	{1.f, 1.f, 1.f, 1.f};
-	glLightModelfv (GL_LIGHT_MODEL_AMBIENT,one);
+	gGL.setAmbientLightColor(LLColor4::white);
 	stop_glerror();
-		
+			
 	/////////////////////////////////////
 	//
 	// Render
@@ -612,11 +620,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 		LLDrawable::incrementVisible();
 
 		LLSpatialGroup::sNoDelete = TRUE;
-		LLPipeline::sUseOcclusion = 
-				(!gUseWireframe
-				&& LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion") 
-				&& gSavedSettings.getBOOL("UseOcclusion") 
-				&& gGLManager.mHasOcclusionQuery) ? 2 : 0;
 		LLTexUnit::sWhiteTexture = LLViewerFetchedTexture::sWhiteImagep->getTexName();
 
 		/*if (LLPipeline::sUseOcclusion && LLPipeline::sRenderDeferred)
@@ -624,12 +627,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 			LLPipeline::sUseOcclusion = 3;
 		}*/
 
-		LLPipeline::sAutoMaskAlphaDeferred = gSavedSettings.getBOOL("RenderAutoMaskAlphaDeferred");
-		LLPipeline::sAutoMaskAlphaNonDeferred = gSavedSettings.getBOOL("RenderAutoMaskAlphaNonDeferred");
-		LLPipeline::sUseFarClip = gSavedSettings.getBOOL("RenderUseFarClip");
-		LLVOAvatar::sMaxVisible = (U32)gSavedSettings.getS32("RenderAvatarMaxVisible");
-		LLPipeline::sDelayVBUpdate = gSavedSettings.getBOOL("RenderDelayVBUpdate");
-
 		S32 occlusion = LLPipeline::sUseOcclusion;
 		if (gDepthDirty)
 		{ //depth buffer is invalid, don't overwrite occlusion state
@@ -657,10 +654,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 		
 		{ 
 			LLMemType mt_ds(LLMemType::MTYPE_DISPLAY_SWAP);
-			{
- 				LLFastTimer ftm(FTM_CLIENT_COPY);
-				LLVertexBuffer::clientCopy(0.016);
-			}
 
 			if (gResizeScreenTexture)
 			{
@@ -701,10 +694,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 
 				glh_set_current_projection(proj);
 				glh_set_current_modelview(mod);
-				glMatrixMode(GL_PROJECTION);
-				glLoadMatrixf(proj.m);
-				glMatrixMode(GL_MODELVIEW);
-				glLoadMatrixf(mod.m);
+				gGL.matrixMode(LLRender::MM_PROJECTION);
+				gGL.loadMatrix(proj.m);
+				gGL.matrixMode(LLRender::MM_MODELVIEW);
+				gGL.loadMatrix(mod.m);
 				gViewerWindow->setup3DViewport();
 
 				LLGLState::checkStates();
@@ -724,6 +717,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 			LLAppViewer::instance()->pingMainloopTimeout("Display:Imagery");
 			gPipeline.generateWaterReflection(*LLViewerCamera::getInstance());
 			gPipeline.generateHighlight(*LLViewerCamera::getInstance());
+			gPipeline.renderPhysicsDisplay();
 		}
 
 		LLGLState::checkStates();
@@ -742,18 +736,31 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 			LLMemType mt_iu(LLMemType::MTYPE_DISPLAY_IMAGE_UPDATE);
 			LLFastTimer t(FTM_IMAGE_UPDATE);
 			
-			LLViewerTexture::updateClass(LLViewerCamera::getInstance()->getVelocityStat()->getMean(),
-										LLViewerCamera::getInstance()->getAngularVelocityStat()->getMean());
+			{
+				LLFastTimer t(FTM_IMAGE_UPDATE_CLASS);
+				LLViewerTexture::updateClass(LLViewerCamera::getInstance()->getVelocityStat()->getMean(),
+											LLViewerCamera::getInstance()->getAngularVelocityStat()->getMean());
+			}
 
-			gBumpImageList.updateImages();  // must be called before gTextureList version so that it's textures are thrown out first.
+			
+			{
+				LLFastTimer t(FTM_IMAGE_UPDATE_BUMP);
+				gBumpImageList.updateImages();  // must be called before gTextureList version so that it's textures are thrown out first.
+			}
 
-			F32 max_image_decode_time = 0.050f*gFrameIntervalSeconds; // 50 ms/second decode time
-			max_image_decode_time = llclamp(max_image_decode_time, 0.002f, 0.005f ); // min 2ms/frame, max 5ms/frame)
-			gTextureList.updateImages(max_image_decode_time);
+			{
+				LLFastTimer t(FTM_IMAGE_UPDATE_LIST);
+				F32 max_image_decode_time = 0.050f*gFrameIntervalSeconds; // 50 ms/second decode time
+				max_image_decode_time = llclamp(max_image_decode_time, 0.002f, 0.005f ); // min 2ms/frame, max 5ms/frame)
+				gTextureList.updateImages(max_image_decode_time);
+			}
 
-			//remove dead textures from GL
-			LLImageGL::deleteDeadTextures();
-			stop_glerror();
+			{
+				LLFastTimer t(FTM_IMAGE_UPDATE_DELETE);
+				//remove dead textures from GL
+				LLImageGL::deleteDeadTextures();
+				stop_glerror();
+			}
 		}
 
 		LLGLState::checkStates();
@@ -812,13 +819,13 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 		//// assumes frontmost floater with focus is opaque
 		//if (frontmost_floaterp && gFocusMgr.childHasKeyboardFocus(frontmost_floaterp))
 		//{
-		//	glMatrixMode(GL_MODELVIEW);
-		//	glPushMatrix();
+		//	gGL.matrixMode(LLRender::MM_MODELVIEW);
+		//	gGL.pushMatrix();
 		//	{
 		//		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 
 		//		glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
-		//		glLoadIdentity();
+		//		gGL.loadIdentity();
 
 		//		LLRect floater_rect = frontmost_floaterp->calcScreenRect();
 		//		// deflate by one pixel so rounding errors don't occlude outside of floater extents
@@ -828,8 +835,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 		//								(F32)floater_rect.mRight / (F32)gViewerWindow->getWindowWidthScaled(),
 		//								(F32)floater_rect.mBottom / (F32)gViewerWindow->getWindowHeightScaled());
 		//		floater_3d_rect.translate(-0.5f, -0.5f);
-		//		glTranslatef(0.f, 0.f, -LLViewerCamera::getInstance()->getNear());
-		//		glScalef(LLViewerCamera::getInstance()->getNear() * LLViewerCamera::getInstance()->getAspect() / sinf(LLViewerCamera::getInstance()->getView()), LLViewerCamera::getInstance()->getNear() / sinf(LLViewerCamera::getInstance()->getView()), 1.f);
+		//		gGL.translatef(0.f, 0.f, -LLViewerCamera::getInstance()->getNear());
+		//		gGL.scalef(LLViewerCamera::getInstance()->getNear() * LLViewerCamera::getInstance()->getAspect() / sinf(LLViewerCamera::getInstance()->getView()), LLViewerCamera::getInstance()->getNear() / sinf(LLViewerCamera::getInstance()->getView()), 1.f);
 		//		gGL.color4fv(LLColor4::white.mV);
 		//		gGL.begin(LLVertexBuffer::QUADS);
 		//		{
@@ -841,11 +848,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 		//		gGL.end();
 		//		glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
 		//	}
-		//	glPopMatrix();
+		//	gGL.popMatrix();
 		//}
 
 		LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE;
-		LLPipeline::refreshRenderDeferred();
 		
 		LLGLState::checkStates();
 		LLGLState::checkClientArrays();
@@ -865,6 +871,11 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 			else
 			{
 				gPipeline.mScreen.bindTarget();
+				if (LLPipeline::sUnderWaterRender && !gPipeline.canUseWindLightShaders())
+				{
+					const LLColor4 &col = LLDrawPoolWater::sWaterFogColor;
+					glClearColor(col.mV[0], col.mV[1], col.mV[2], 0.f);
+				}
 				gPipeline.mScreen.clear();
 			}
 			
@@ -978,10 +989,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 void render_hud_attachments()
 {
 	LLMemType mt_ra(LLMemType::MTYPE_DISPLAY_RENDER_ATTACHMENTS);
-	glMatrixMode(GL_PROJECTION);
-	glPushMatrix();
-	glMatrixMode(GL_MODELVIEW);
-	glPushMatrix();
+	gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.pushMatrix();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
+	gGL.pushMatrix();
 		
 	glh::matrix4f current_proj = glh_get_current_projection();
 	glh::matrix4f current_mod = glh_get_current_modelview();
@@ -1067,10 +1078,10 @@ void render_hud_attachments()
 		}
 		LLPipeline::sUseOcclusion = use_occlusion;
 	}
-	glMatrixMode(GL_PROJECTION);
-	glPopMatrix();
-	glMatrixMode(GL_MODELVIEW);
-	glPopMatrix();
+	gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.popMatrix();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
+	gGL.popMatrix();
 	
 	glh_set_current_projection(current_proj);
 	glh_set_current_modelview(current_mod);
@@ -1153,12 +1164,12 @@ BOOL setup_hud_matrices(const LLRect& screen_region)
 	if (!result) return result;
 	
 	// set up transform to keep HUD objects in front of camera
-	glMatrixMode(GL_PROJECTION);
-	glLoadMatrixf(proj.m);
+	gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.loadMatrix(proj.m);
 	glh_set_current_projection(proj);
 	
-	glMatrixMode(GL_MODELVIEW);
-	glLoadMatrixf(model.m);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
+	gGL.loadMatrix(model.m);
 	glh_set_current_modelview(model);
 	return TRUE;
 }
@@ -1174,8 +1185,8 @@ void render_ui(F32 zoom_factor, int subfield)
 
 	if (!gSnapshot)
 	{
-		glPushMatrix();
-		glLoadMatrixd(gGLLastModelView);
+		gGL.pushMatrix();
+		gGL.loadMatrix(gGLLastModelView);
 		glh_set_current_modelview(glh_copy_matrix(gGLLastModelView));
 	}
 	
@@ -1231,7 +1242,7 @@ void render_ui(F32 zoom_factor, int subfield)
 	if (!gSnapshot)
 	{
 		glh_set_current_modelview(saved_view);
-		glPopMatrix();
+		gGL.popMatrix();
 	}
 
 	if (gDisplaySwapBuffers)
@@ -1304,10 +1315,10 @@ void draw_axes()
 		gGL.vertex3f(0.0f, 0.0f, 40.0f);
 	gGL.end();
 	// Some coordinate axes
-	glPushMatrix();
-		glTranslatef( v.mV[VX], v.mV[VY], v.mV[VZ] );
+	gGL.pushMatrix();
+		gGL.translatef( v.mV[VX], v.mV[VY], v.mV[VZ] );
 		renderCoordinateAxes();
-	glPopMatrix();
+	gGL.popMatrix();
 }
 
 void render_ui_3d()
@@ -1329,14 +1340,19 @@ void render_ui_3d()
 
 	// Debugging stuff goes before the UI.
 
+	stop_glerror();
+	
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		gUIProgram.bind();
+	}
+
 	// Coordinate axes
 	if (gSavedSettings.getBOOL("ShowAxes"))
 	{
 		draw_axes();
 	}
 
-	stop_glerror();
-		
 	gViewerWindow->renderSelections(FALSE, FALSE, TRUE); // Non HUD call in render_hud_elements
 	stop_glerror();
 }
@@ -1377,10 +1393,10 @@ void render_ui_2d()
 		gGL.pushMatrix();
 		S32 half_width = (gViewerWindow->getWorldViewWidthScaled() / 2);
 		S32 half_height = (gViewerWindow->getWorldViewHeightScaled() / 2);
-		glScalef(LLUI::sGLScaleFactor.mV[0], LLUI::sGLScaleFactor.mV[1], 1.f);
-		glTranslatef((F32)half_width, (F32)half_height, 0.f);
+		gGL.scalef(LLUI::sGLScaleFactor.mV[0], LLUI::sGLScaleFactor.mV[1], 1.f);
+		gGL.translatef((F32)half_width, (F32)half_height, 0.f);
 		F32 zoom = gAgentCamera.mHUDCurZoom;
-		glScalef(zoom,zoom,1.f);
+		gGL.scalef(zoom,zoom,1.f);
 		gGL.color4fv(LLColor4::white.mV);
 		gl_rect_2d(-half_width, half_height, half_width, -half_height, FALSE);
 		gGL.popMatrix();
@@ -1459,6 +1475,11 @@ void render_ui_2d()
 
 void render_disconnected_background()
 {
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		gUIProgram.bind();
+	}
+
 	gGL.color4f(1,1,1,1);
 	if (!gDisconnectedImagep && gDisconnected)
 	{
@@ -1512,22 +1533,28 @@ void render_disconnected_background()
 	{
 		LLGLSUIDefault gls_ui;
 		gViewerWindow->setup2DRender();
-		glPushMatrix();
+		gGL.pushMatrix();
 		{
 			// scale ui to reflect UIScaleFactor
 			// this can't be done in setup2DRender because it requires a
 			// pushMatrix/popMatrix pair
 			const LLVector2& display_scale = gViewerWindow->getDisplayScale();
-			glScalef(display_scale.mV[VX], display_scale.mV[VY], 1.f);
+			gGL.scalef(display_scale.mV[VX], display_scale.mV[VY], 1.f);
 
 			gGL.getTexUnit(0)->bind(gDisconnectedImagep);
 			gGL.color4f(1.f, 1.f, 1.f, 1.f);
 			gl_rect_2d_simple_tex(width, height);
 			gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 		}
-		glPopMatrix();
+		gGL.popMatrix();
 	}
 	gGL.flush();
+
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		gUIProgram.unbind();
+	}
+
 }
 
 void display_cleanup()
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index 273bf822bcf532c109503b87a1f3b8fd3888c10f..7fdaac68c8753b048e3f36e3a163cfb67e4f3e64 100644
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -35,7 +35,6 @@
 #include "llcallfloater.h"
 #include "llfasttimerview.h"
 #include "llfloaterabout.h"
-#include "llfloateranimpreview.h"
 #include "llfloaterauction.h"
 #include "llfloateravatar.h"
 #include "llfloateravatarpicker.h"
@@ -49,6 +48,7 @@
 #include "llfloaterbuyland.h"
 #include "llfloaterbulkpermission.h"
 #include "llfloaterbump.h"
+#include "llfloaterbvhpreview.h"
 #include "llfloatercamera.h"
 #include "llfloaterdeleteenvpreset.h"
 #include "llfloaterdisplayname.h"
@@ -65,6 +65,7 @@
 #include "llfloaterhardwaresettings.h"
 #include "llfloaterhelpbrowser.h"
 #include "llfloaterwebcontent.h"
+#include "llfloaterwebprofile.h"
 #include "llfloatermediasettings.h"
 #include "llfloaterhud.h"
 #include "llfloaterimagepreview.h"
@@ -82,6 +83,7 @@
 #include "llfloaternotificationsconsole.h"
 #include "llfloaterobjectweights.h"
 #include "llfloateropenobject.h"
+#include "llfloateroutbox.h"
 #include "llfloaterpay.h"
 #include "llfloaterperms.h"
 #include "llfloaterpostprocess.h"
@@ -237,6 +239,7 @@ void LLViewerFloaterReg::registerFloaters()
 
 	LLFloaterReg::add("object_weights", "floater_object_weights.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterObjectWeights>);
 	LLFloaterReg::add("openobject", "floater_openobject.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterOpenObject>);
+	LLFloaterReg::add("outbox", "floater_merchant_outbox.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterOutbox>);
 	LLFloaterReg::add("outgoing_call", "floater_outgoing_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLOutgoingCallDialog>);
 	LLFloaterPayUtil::registerFloater();
 
@@ -285,23 +288,26 @@ void LLViewerFloaterReg::registerFloaters()
 	LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNotRunQueue>);
 	LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSnapshot>);
 	LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSearch>);
-	LLFloaterReg::add("profile", "floater_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create);	
+	LLFloaterReg::add("my_profile", "floater_my_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create);
+	LLFloaterReg::add("profile", "floater_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create);
 	LLFloaterReg::add("how_to", "floater_how_to.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create);	
 
 	
 	LLFloaterUIPreviewUtil::registerFloater();
-	LLFloaterReg::add("upload_anim", "floater_animation_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAnimPreview>, "upload");
+	LLFloaterReg::add("upload_anim_bvh", "floater_animation_bvh_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBvhPreview>, "upload");
+	LLFloaterReg::add("upload_anim_anim", "floater_animation_anim_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAnimPreview>, "upload");
 	LLFloaterReg::add("upload_image", "floater_image_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterImagePreview>, "upload");
-	LLFloaterReg::add("upload_sound", "floater_sound_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSoundPreview>, "upload");
 	LLFloaterReg::add("upload_model", "floater_model_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterModelPreview>, "upload");
 	LLFloaterReg::add("upload_model_wizard", "floater_model_wizard.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterModelWizard>);
+	LLFloaterReg::add("upload_script", "floater_script_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptPreview>, "upload");
+	LLFloaterReg::add("upload_sound", "floater_sound_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSoundPreview>, "upload");
 
 	LLFloaterReg::add("voice_controls", "floater_voice_controls.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLCallFloater>);
 	LLFloaterReg::add("voice_effect", "floater_voice_effect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterVoiceEffect>);
 
 	LLFloaterReg::add("web_content", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create);	
 	LLFloaterReg::add("whitelist_entry", "floater_whitelist_entry.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWhiteListEntry>);	
-	LLFloaterWindowSizeUtil::registerFloater();
+	LLFloaterReg::add("window_size", "floater_window_size.xml", &LLFloaterReg::build<LLFloaterWindowSize>);
 	LLFloaterReg::add("world_map", "floater_world_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWorldMap>);	
 
 	// *NOTE: Please keep these alphabetized for easier merges
diff --git a/indra/newview/llviewerfoldertype.cpp b/indra/newview/llviewerfoldertype.cpp
index 91012223930cf21e251179a94d5f9b393882f4d6..a179b61cffc78c7c61ade5cd39935c2ffa079588 100644
--- a/indra/newview/llviewerfoldertype.cpp
+++ b/indra/newview/llviewerfoldertype.cpp
@@ -40,6 +40,7 @@ struct ViewerFolderEntry : public LLDictionaryEntry
 					  const std::string &icon_name_open,	// name of the folder icon
 					  const std::string &icon_name_closed,
 					  BOOL is_quiet,						// folder doesn't need a UI update when changed
+					  bool hide_if_empty,					// folder not shown if empty
 					  const std::string &dictionary_name = empty_string // no reverse lookup needed on non-ensembles, so in most cases just leave this blank
 		) 
 		:
@@ -47,7 +48,8 @@ struct ViewerFolderEntry : public LLDictionaryEntry
 		mNewCategoryName(new_category_name),
 		mIconNameOpen(icon_name_open),
 		mIconNameClosed(icon_name_closed),
-		mIsQuiet(is_quiet)
+		mIsQuiet(is_quiet),
+		mHideIfEmpty(hide_if_empty)
 	{
 		mAllowedNames.clear();
 	}
@@ -66,7 +68,8 @@ struct ViewerFolderEntry : public LLDictionaryEntry
 		*/
 		mIconNameOpen("Inv_FolderOpen"), mIconNameClosed("Inv_FolderClosed"),
 		mNewCategoryName(new_category_name),
-		mIsQuiet(FALSE)
+		mIsQuiet(FALSE),
+		mHideIfEmpty(false)
 	{
 		const std::string delims (",");
 		LLStringUtilBase<char>::getTokens(allowed_names, mAllowedNames, delims);
@@ -91,6 +94,7 @@ struct ViewerFolderEntry : public LLDictionaryEntry
 	typedef std::vector<std::string> name_vec_t;
 	name_vec_t mAllowedNames;
 	BOOL mIsQuiet;
+	bool mHideIfEmpty;
 };
 
 class LLViewerFolderDictionary : public LLSingleton<LLViewerFolderDictionary>,
@@ -104,43 +108,43 @@ class LLViewerFolderDictionary : public LLSingleton<LLViewerFolderDictionary>,
 
 LLViewerFolderDictionary::LLViewerFolderDictionary()
 {
-	//       													    	  NEW CATEGORY NAME         FOLDER OPEN             FOLDER CLOSED          QUIET?
-	//      												  		     |-------------------------|-----------------------|----------------------|-----------|
-	addEntry(LLFolderType::FT_TEXTURE, 				new ViewerFolderEntry("Textures",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE));
-	addEntry(LLFolderType::FT_SOUND, 				new ViewerFolderEntry("Sounds",					"Inv_SysOpen",			"Inv_SysClosed",		FALSE));
-	addEntry(LLFolderType::FT_CALLINGCARD, 			new ViewerFolderEntry("Calling Cards",			"Inv_SysOpen",			"Inv_SysClosed",		FALSE));
-	addEntry(LLFolderType::FT_LANDMARK, 			new ViewerFolderEntry("Landmarks",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE));
-	addEntry(LLFolderType::FT_CLOTHING, 			new ViewerFolderEntry("Clothing",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE));
-	addEntry(LLFolderType::FT_OBJECT, 				new ViewerFolderEntry("Objects",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE));
-	addEntry(LLFolderType::FT_NOTECARD, 			new ViewerFolderEntry("Notecards",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE));
-	addEntry(LLFolderType::FT_ROOT_INVENTORY, 		new ViewerFolderEntry("My Inventory",			"Inv_SysOpen",			"Inv_SysClosed",		FALSE));
-	addEntry(LLFolderType::FT_LSL_TEXT, 			new ViewerFolderEntry("Scripts",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE));
-	addEntry(LLFolderType::FT_BODYPART, 			new ViewerFolderEntry("Body Parts",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE));
-	addEntry(LLFolderType::FT_TRASH, 				new ViewerFolderEntry("Trash",					"Inv_TrashOpen",		"Inv_TrashClosed",		TRUE));
-	addEntry(LLFolderType::FT_SNAPSHOT_CATEGORY, 	new ViewerFolderEntry("Photo Album",			"Inv_SysOpen",			"Inv_SysClosed",		FALSE));
-	addEntry(LLFolderType::FT_LOST_AND_FOUND, 		new ViewerFolderEntry("Lost And Found",	   		"Inv_LostOpen",			"Inv_LostClosed",		TRUE));
-	addEntry(LLFolderType::FT_ANIMATION, 			new ViewerFolderEntry("Animations",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE));
-	addEntry(LLFolderType::FT_GESTURE, 				new ViewerFolderEntry("Gestures",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE));
-	addEntry(LLFolderType::FT_FAVORITE, 			new ViewerFolderEntry("Favorites",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE));
+	//       													    	  NEW CATEGORY NAME         FOLDER OPEN             FOLDER CLOSED          QUIET?      HIDE IF EMPTY?
+	//      												  		     |-------------------------|-----------------------|----------------------|-----------|--------------|
+	addEntry(LLFolderType::FT_TEXTURE, 				new ViewerFolderEntry("Textures",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
+	addEntry(LLFolderType::FT_SOUND, 				new ViewerFolderEntry("Sounds",					"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
+	addEntry(LLFolderType::FT_CALLINGCARD, 			new ViewerFolderEntry("Calling Cards",			"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
+	addEntry(LLFolderType::FT_LANDMARK, 			new ViewerFolderEntry("Landmarks",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
+	addEntry(LLFolderType::FT_CLOTHING, 			new ViewerFolderEntry("Clothing",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
+	addEntry(LLFolderType::FT_OBJECT, 				new ViewerFolderEntry("Objects",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
+	addEntry(LLFolderType::FT_NOTECARD, 			new ViewerFolderEntry("Notecards",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
+	addEntry(LLFolderType::FT_ROOT_INVENTORY, 		new ViewerFolderEntry("My Inventory",			"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     false));
+	addEntry(LLFolderType::FT_LSL_TEXT, 			new ViewerFolderEntry("Scripts",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
+	addEntry(LLFolderType::FT_BODYPART, 			new ViewerFolderEntry("Body Parts",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
+	addEntry(LLFolderType::FT_TRASH, 				new ViewerFolderEntry("Trash",					"Inv_TrashOpen",		"Inv_TrashClosed",		TRUE,      false));
+	addEntry(LLFolderType::FT_SNAPSHOT_CATEGORY, 	new ViewerFolderEntry("Photo Album",			"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
+	addEntry(LLFolderType::FT_LOST_AND_FOUND, 		new ViewerFolderEntry("Lost And Found",	   		"Inv_LostOpen",			"Inv_LostClosed",		TRUE,      true));
+	addEntry(LLFolderType::FT_ANIMATION, 			new ViewerFolderEntry("Animations",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
+	addEntry(LLFolderType::FT_GESTURE, 				new ViewerFolderEntry("Gestures",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
+	addEntry(LLFolderType::FT_FAVORITE, 			new ViewerFolderEntry("Favorites",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
 
-	addEntry(LLFolderType::FT_CURRENT_OUTFIT, 		new ViewerFolderEntry("Current Outfit",			"Inv_SysOpen",			"Inv_SysClosed",		TRUE));
-	addEntry(LLFolderType::FT_OUTFIT, 				new ViewerFolderEntry("New Outfit",				"Inv_LookFolderOpen",	"Inv_LookFolderClosed",	TRUE));
-	addEntry(LLFolderType::FT_MY_OUTFITS, 			new ViewerFolderEntry("My Outfits",				"Inv_SysOpen",			"Inv_SysClosed",		TRUE));
-	addEntry(LLFolderType::FT_MESH, 				new ViewerFolderEntry("Meshes",					"Inv_SysOpen",			"Inv_SysClosed",		FALSE));
+	addEntry(LLFolderType::FT_CURRENT_OUTFIT, 		new ViewerFolderEntry("Current Outfit",			"Inv_SysOpen",			"Inv_SysClosed",		TRUE,      false));
+	addEntry(LLFolderType::FT_OUTFIT, 				new ViewerFolderEntry("New Outfit",				"Inv_LookFolderOpen",	"Inv_LookFolderClosed",	TRUE,      true));
+	addEntry(LLFolderType::FT_MY_OUTFITS, 			new ViewerFolderEntry("My Outfits",				"Inv_SysOpen",			"Inv_SysClosed",		TRUE,      true));
+	addEntry(LLFolderType::FT_MESH, 				new ViewerFolderEntry("Meshes",					"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
 	
-	addEntry(LLFolderType::FT_INBOX, 				new ViewerFolderEntry("Inbox",					"Inv_SysOpen",			"Inv_SysClosed",		FALSE));
-	addEntry(LLFolderType::FT_OUTBOX, 				new ViewerFolderEntry("Outbox",					"Inv_SysOpen",			"Inv_SysClosed",		FALSE));
+	addEntry(LLFolderType::FT_INBOX, 				new ViewerFolderEntry("Inbox",					"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
+	addEntry(LLFolderType::FT_OUTBOX, 				new ViewerFolderEntry("Outbox",					"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
 
-	addEntry(LLFolderType::FT_BASIC_ROOT, 			new ViewerFolderEntry("Basic Root",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE));
+	addEntry(LLFolderType::FT_BASIC_ROOT, 			new ViewerFolderEntry("Basic Root",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
 		 
-	addEntry(LLFolderType::FT_NONE, 				new ViewerFolderEntry("New Folder",				"Inv_FolderOpen",		"Inv_FolderClosed",		FALSE, "default"));
+	addEntry(LLFolderType::FT_NONE, 				new ViewerFolderEntry("New Folder",				"Inv_FolderOpen",		"Inv_FolderClosed",		FALSE,     false, "default"));
 
 #if SUPPORT_ENSEMBLES
 	initEnsemblesFromFile();
 #else
 	for (U32 type = (U32)LLFolderType::FT_ENSEMBLE_START; type <= (U32)LLFolderType::FT_ENSEMBLE_END; ++type)
 	{
-		addEntry((LLFolderType::EType)type, 		new ViewerFolderEntry("New Folder",				"Inv_FolderOpen",		"Inv_FolderClosed",		FALSE));
+		addEntry((LLFolderType::EType)type, 		new ViewerFolderEntry("New Folder",				"Inv_FolderOpen",		"Inv_FolderClosed",		FALSE,     false));
 	}	
 #endif
 }
@@ -259,6 +263,15 @@ BOOL LLViewerFolderType::lookupIsQuietType(LLFolderType::EType folder_type)
 	return FALSE;
 }
 
+bool LLViewerFolderType::lookupIsHiddenIfEmpty(LLFolderType::EType folder_type)
+{
+	const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type);
+	if (entry)
+	{
+		return entry->mHideIfEmpty;
+	}
+	return false;
+}
 
 const std::string &LLViewerFolderType::lookupNewCategoryName(LLFolderType::EType folder_type)
 {
diff --git a/indra/newview/llviewerfoldertype.h b/indra/newview/llviewerfoldertype.h
index f5938de619b3e70ebf2537ad7ad98fbd2e40835b..13d5a8fbbdf192cf67d8116de88a011c1057c384 100644
--- a/indra/newview/llviewerfoldertype.h
+++ b/indra/newview/llviewerfoldertype.h
@@ -40,6 +40,7 @@ class LLViewerFolderType : public LLFolderType
 
 	static const std::string&   lookupIconName(EType folder_type, BOOL is_open = FALSE); // folder icon name
 	static BOOL					lookupIsQuietType(EType folder_type); // folder doesn't require UI update when changes have occured
+	static bool					lookupIsHiddenIfEmpty(EType folder_type); // folder is not displayed if empty
 	static const std::string&	lookupNewCategoryName(EType folder_type); // default name when creating new category
 	static LLFolderType::EType	lookupTypeFromNewCategoryName(const std::string& name); // default name when creating new category
 
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 163581ea7fe7a0bed135b968919293f45f762d39..45ca23cdfe2d3b19b49dd1f1410d99902731a57b 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -436,11 +436,6 @@ void LLViewerInventoryItem::fetchFromServer(void) const
 			gAgent.sendReliableMessage();
 		}
 	}
-	else
-	{
-		// *FIX: this can be removed after a bit.
-		llwarns << "request to fetch complete item" << llendl;
-	}
 }
 
 // virtual
@@ -1462,6 +1457,7 @@ const std::string& LLViewerInventoryItem::getName() const
 class LLFavoritesOrderStorage : public LLSingleton<LLFavoritesOrderStorage>
 	, public LLDestroyClass<LLFavoritesOrderStorage>
 {
+	LOG_CLASS(LLFavoritesOrderStorage);
 public:
 	/**
 	 * Sets sort index for specified with LLUUID favorite landmark
@@ -1620,10 +1616,18 @@ void LLFavoritesOrderStorage::load()
 void LLFavoritesOrderStorage::saveFavoritesSLURLs()
 {
 	// Do not change the file if we are not logged in yet.
-	if (!LLLoginInstance::getInstance()->authSuccess()) return;
+	if (!LLLoginInstance::getInstance()->authSuccess())
+	{
+		llwarns << "Cannot save favorites: not logged in" << llendl;
+		return;
+	}
 	
 	std::string user_dir = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "");
-	if (user_dir.empty()) return;
+	if (user_dir.empty())
+	{
+		llwarns << "Cannot save favorites: empty user dir name" << llendl;
+		return;
+	}
 
 	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
 	llifstream in_file;
@@ -1649,13 +1653,19 @@ void LLFavoritesOrderStorage::saveFavoritesSLURLs()
 		slurls_map_t::iterator slurl_iter = mSLURLs.find(value["asset_id"]);
 		if (slurl_iter != mSLURLs.end())
 		{
+			lldebugs << "Saving favorite: idx=" << (*it)->getSortField() << ", SLURL=" <<  slurl_iter->second << ", value=" << value << llendl;
 			value["slurl"] = slurl_iter->second;
 			user_llsd[(*it)->getSortField()] = value;
 		}
+		else
+		{
+			llwarns << "Not saving favorite " << value["name"] << ": no matching SLURL" << llendl;
+		}
 	}
 
 	LLAvatarName av_name;
 	LLAvatarNameCache::get( gAgentID, &av_name );
+	lldebugs << "Saved favorites for " << av_name.getLegacyName() << llendl;
 	fav_llsd[av_name.getLegacyName()] = user_llsd;
 
 	llofstream file;
@@ -1674,6 +1684,7 @@ void LLFavoritesOrderStorage::removeFavoritesRecordOfUser()
 
 	LLAvatarName av_name;
 	LLAvatarNameCache::get( gAgentID, &av_name );
+	lldebugs << "Removed favorites for " << av_name.getLegacyName() << llendl;
 	if (fav_llsd.has(av_name.getLegacyName()))
 	{
 		fav_llsd.erase(av_name.getLegacyName());
@@ -1706,6 +1717,7 @@ void LLFavoritesOrderStorage::onLandmarkLoaded(const LLUUID& asset_id, LLLandmar
 
 void LLFavoritesOrderStorage::storeFavoriteSLURL(const LLUUID& asset_id, std::string& slurl)
 {
+	lldebugs << "Saving landmark SLURL: " << slurl << llendl;
 	mSLURLs[asset_id] = slurl;
 }
 
diff --git a/indra/newview/llviewerjoint.cpp b/indra/newview/llviewerjoint.cpp
index baf85d68848ea60cce2fa8cbbaad3a32a30123bf..a907f102f87f55a4680224c1d522b024b0577158 100644
--- a/indra/newview/llviewerjoint.cpp
+++ b/indra/newview/llviewerjoint.cpp
@@ -126,7 +126,7 @@ void LLViewerJoint::setValid( BOOL valid, BOOL recursive )
 // 	//----------------------------------------------------------------
 // 	// push matrix stack
 // 	//----------------------------------------------------------------
-// 	glPushMatrix();
+// 	gGL.pushMatrix();
 
 // 	//----------------------------------------------------------------
 // 	// render the bone to my parent
@@ -140,8 +140,8 @@ void LLViewerJoint::setValid( BOOL valid, BOOL recursive )
 // 	// offset to joint position and 
 // 	// rotate to our orientation
 // 	//----------------------------------------------------------------
-// 	glLoadIdentity();
-// 	glMultMatrixf( &getWorldMatrix().mMatrix[0][0] );
+// 	gGL.loadIdentity();
+// 	gGL.multMatrix( &getWorldMatrix().mMatrix[0][0] );
 
 // 	//----------------------------------------------------------------
 // 	// render joint axes
@@ -233,7 +233,7 @@ void LLViewerJoint::setValid( BOOL valid, BOOL recursive )
 // 	//----------------------------------------------------------------
 // 	// pop matrix stack
 // 	//----------------------------------------------------------------
-// 	glPopMatrix();
+// 	gGL.popMatrix();
 // }
 
 
@@ -346,7 +346,7 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy )
 // 	F32 boneSize = 0.02f;
 
 // 	// rotate to point to child (bone direction)
-// 	glPushMatrix();
+// 	gGL.pushMatrix();
 
 // 	LLVector3 boneX = getPosition();
 // 	F32 length = boneX.normVec();
@@ -362,7 +362,7 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy )
 // 	rotateMat.setFwdRow( boneX );
 // 	rotateMat.setLeftRow( boneY );
 // 	rotateMat.setUpRow( boneZ );
-// 	glMultMatrixf( &rotateMat.mMatrix[0][0] );
+// 	gGL.multMatrix( &rotateMat.mMatrix[0][0] );
 
 // 	// render the bone
 // 	gGL.color3f( 0.5f, 0.5f, 0.0f );
@@ -388,7 +388,7 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy )
 // 	gGL.end();
 
 // 	// restore matrix
-// 	glPopMatrix();
+// 	gGL.popMatrix();
 // }
 
 //--------------------------------------------------------------------
@@ -541,9 +541,9 @@ void LLViewerJointCollisionVolume::renderCollision()
 	updateWorldMatrix();
 	
 	gGL.pushMatrix();
-	glMultMatrixf( &mXform.getWorldMatrix().mMatrix[0][0] );
+	gGL.multMatrix( &mXform.getWorldMatrix().mMatrix[0][0] );
 
-	gGL.color3f( 0.f, 0.f, 1.f );
+	gGL.diffuseColor3f( 0.f, 0.f, 1.f );
 	
 	gGL.begin(LLRender::LINES);
 	
diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp
index 77c8bb032949d7bd9b9f0bd94252b0e2e0ba3f8a..e052e373931e81044340f01d32d53bee68a09696 100644
--- a/indra/newview/llviewerjointmesh.cpp
+++ b/indra/newview/llviewerjointmesh.cpp
@@ -63,7 +63,6 @@ extern PFNGLWEIGHTFVARBPROC glWeightfvARB;
 extern PFNGLVERTEXBLENDARBPROC glVertexBlendARB;
 #endif
 
-static LLPointer<LLVertexBuffer> sRenderBuffer = NULL;
 static const U32 sRenderMask = LLVertexBuffer::MAP_VERTEX |
 							   LLVertexBuffer::MAP_NORMAL |
 							   LLVertexBuffer::MAP_TEXCOORD0;
@@ -459,7 +458,10 @@ void LLViewerJointMesh::uploadJointMatrices()
 			}
 		}
 		stop_glerror();
-		glUniform4fvARB(gAvatarMatrixParam, 45, mat);
+		if (LLGLSLShader::sCurBoundShaderPtr)
+		{
+			LLGLSLShader::sCurBoundShaderPtr->uniform4fv(LLViewerShaderMgr::AVATAR_MATRIX, 45, mat);
+		}
 		stop_glerror();
 	}
 	else
@@ -512,7 +514,8 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
 {
 	if (!mValid || !mMesh || !mFace || !mVisible || 
 		!mFace->getVertexBuffer() ||
-		mMesh->getNumFaces() == 0) 
+		mMesh->getNumFaces() == 0 ||
+		(LLGLSLShader::sNoFixedFunction && LLGLSLShader::sCurBoundShaderPtr == NULL))
 	{
 		return 0;
 	}
@@ -527,13 +530,13 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
 	// setup current color
 	//----------------------------------------------------------------
 	if (is_dummy)
-		glColor4fv(LLVOAvatar::getDummyColor().mV);
+		gGL.diffuseColor4fv(LLVOAvatar::getDummyColor().mV);
 	else
-		glColor4fv(mColor.mV);
+		gGL.diffuseColor4fv(mColor.mV);
 
 	stop_glerror();
 	
-	LLGLSSpecular specular(LLColor4(1.f,1.f,1.f,1.f), mFace->getPool()->getVertexShaderLevel() > 0 ? 0.f : mShiny);
+	LLGLSSpecular specular(LLColor4(1.f,1.f,1.f,1.f), (mFace->getPool()->getVertexShaderLevel() > 0 || LLGLSLShader::sNoFixedFunction) ? 0.f : mShiny);
 
 	//----------------------------------------------------------------
 	// setup current texture
@@ -547,11 +550,11 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
 
 		if (mIsTransparent)
 		{
-			glColor4f(1.f, 1.f, 1.f, 1.f);
+			gGL.diffuseColor4f(1.f, 1.f, 1.f, 1.f);
 		}
 		else
 		{
-			glColor4f(0.7f, 0.6f, 0.3f, 1.f);
+			gGL.diffuseColor4f(0.7f, 0.6f, 0.3f, 1.f);
 			gGL.getTexUnit(diffuse_channel)->setTextureColorBlend(LLTexUnit::TBO_LERP_TEX_ALPHA, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR);
 		}
 	}
@@ -582,13 +585,16 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
 		gGL.getTexUnit(diffuse_channel)->bind(LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT));
 	}
 	
-	mFace->getVertexBuffer()->setBuffer(sRenderMask);
+	
+	U32 mask = sRenderMask;
 
 	U32 start = mMesh->mFaceVertexOffset;
 	U32 end = start + mMesh->mFaceVertexCount - 1;
 	U32 count = mMesh->mFaceIndexCount;
 	U32 offset = mMesh->mFaceIndexOffset;
 
+	LLVertexBuffer* buff = mFace->getVertexBuffer();
+
 	if (mMesh->hasWeights())
 	{
 		if ((mFace->getPool()->getVertexShaderLevel() > 0))
@@ -597,17 +603,24 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
 			{
 				uploadJointMatrices();
 			}
+			mask = mask | LLVertexBuffer::MAP_WEIGHT;
+			if (mFace->getPool()->getVertexShaderLevel() > 1)
+			{
+				mask = mask | LLVertexBuffer::MAP_CLOTHWEIGHT;
+			}
 		}
 		
-		mFace->getVertexBuffer()->drawRange(LLRender::TRIANGLES, start, end, count, offset);
+		buff->setBuffer(mask);
+		buff->drawRange(LLRender::TRIANGLES, start, end, count, offset);
 	}
 	else
 	{
-		glPushMatrix();
+		gGL.pushMatrix();
 		LLMatrix4 jointToWorld = getWorldMatrix();
-		glMultMatrixf((GLfloat*)jointToWorld.mMatrix);
-		mFace->getVertexBuffer()->drawRange(LLRender::TRIANGLES, start, end, count, offset);
-		glPopMatrix();
+		gGL.multMatrix((GLfloat*)jointToWorld.mMatrix);
+		buff->setBuffer(mask);
+		buff->drawRange(LLRender::TRIANGLES, start, end, count, offset);
+		gGL.popMatrix();
 	}
 	gPipeline.addTrianglesDrawn(count);
 
@@ -692,9 +705,9 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w
 
 		if (num_verts)
 		{
-			face->getGeometryAvatar(verticesp, normalsp, tex_coordsp, vertex_weightsp, clothing_weightsp);
 			face->getVertexBuffer()->getIndexStrider(indicesp);
-
+			face->getGeometryAvatar(verticesp, normalsp, tex_coordsp, vertex_weightsp, clothing_weightsp);
+			
 			verticesp += mMesh->mFaceVertexOffset;
 			normalsp += mMesh->mFaceVertexOffset;
 			
@@ -752,7 +765,7 @@ BOOL LLViewerJointMesh::updateLOD(F32 pixel_area, BOOL activate)
 }
 
 // static
-void LLViewerJointMesh::updateGeometryOriginal(LLFace *mFace, LLPolyMesh *mMesh)
+void LLViewerJointMesh::updateGeometry(LLFace *mFace, LLPolyMesh *mMesh)
 {
 	LLStrider<LLVector3> o_vertices;
 	LLStrider<LLVector3> o_normals;
@@ -803,64 +816,7 @@ void LLViewerJointMesh::updateGeometryOriginal(LLFace *mFace, LLPolyMesh *mMesh)
 		}
 	}
 
-	buffer->setBuffer(0);
-}
-
-const U32 UPDATE_GEOMETRY_CALL_MASK			= 0x1FFF; // 8K samples before overflow
-const U32 UPDATE_GEOMETRY_CALL_OVERFLOW		= ~UPDATE_GEOMETRY_CALL_MASK;
-static bool sUpdateGeometryCallPointer		= false;
-static F64 sUpdateGeometryGlobalTime		= 0.0 ;
-static F64 sUpdateGeometryElapsedTime		= 0.0 ;
-static F64 sUpdateGeometryElapsedTimeOff	= 0.0 ;
-static F64 sUpdateGeometryElapsedTimeOn		= 0.0 ;
-static F64 sUpdateGeometryRunAvgOff[10];
-static F64 sUpdateGeometryRunAvgOn[10];
-static U32 sUpdateGeometryRunCount			= 0 ;
-static U32 sUpdateGeometryCalls				= 0 ;
-static U32 sUpdateGeometryLastProcessor		= 0 ;
-static BOOL sVectorizePerfTest 				= FALSE;
-static U32 sVectorizeProcessor 				= 0;
-
-//static
-void (*LLViewerJointMesh::sUpdateGeometryFunc)(LLFace* face, LLPolyMesh* mesh);
-
-//static
-void LLViewerJointMesh::updateVectorize()
-{
-	sVectorizePerfTest = gSavedSettings.getBOOL("VectorizePerfTest");
-	sVectorizeProcessor = gSavedSettings.getU32("VectorizeProcessor");
-	BOOL vectorizeEnable = gSavedSettings.getBOOL("VectorizeEnable");
-	BOOL vectorizeSkin = gSavedSettings.getBOOL("VectorizeSkin");
-
-	std::string vp;
-	switch(sVectorizeProcessor)
-	{
-		case 2: vp = "SSE2"; break;					// *TODO: replace the magic #s
-		case 1: vp = "SSE"; break;
-		default: vp = "COMPILER DEFAULT"; break;
-	}
-	LL_INFOS("AppInit") << "Vectorization         : " << ( vectorizeEnable ? "ENABLED" : "DISABLED" ) << LL_ENDL ;
-	LL_INFOS("AppInit") << "Vector Processor      : " << vp << LL_ENDL ;
-	LL_INFOS("AppInit") << "Vectorized Skinning   : " << ( vectorizeSkin ? "ENABLED" : "DISABLED" ) << LL_ENDL ;
-	if(vectorizeEnable && vectorizeSkin)
-	{
-		switch(sVectorizeProcessor)
-		{
-			case 2:
-				sUpdateGeometryFunc = &updateGeometrySSE2;
-				break;
-			case 1:
-				sUpdateGeometryFunc = &updateGeometrySSE;
-				break;
-			default:
-				sUpdateGeometryFunc = &updateGeometryVectorized;
-				break;
-		}
-	}
-	else
-	{
-		sUpdateGeometryFunc = &updateGeometryOriginal;
-	}
+	buffer->flush();
 }
 
 void LLViewerJointMesh::updateJointGeometry()
@@ -875,129 +831,8 @@ void LLViewerJointMesh::updateJointGeometry()
 		return;
 	}
 
-	if (!sVectorizePerfTest)
-	{
-		// Once we've measured performance, just run the specified
-		// code version.
-		if(sUpdateGeometryFunc == updateGeometryOriginal)
-			uploadJointMatrices();
-		sUpdateGeometryFunc(mFace, mMesh);
-	}
-	else
-	{
-		// At startup, measure the amount of time in skinning and choose
-		// the fastest one.
-		LLTimer ug_timer ;
-		
-		if (sUpdateGeometryCallPointer)
-		{
-			if(sUpdateGeometryFunc == updateGeometryOriginal)
-				uploadJointMatrices();
-			// call accelerated version for this processor
-			sUpdateGeometryFunc(mFace, mMesh);
-		}
-		else
-		{
-			uploadJointMatrices();
-			updateGeometryOriginal(mFace, mMesh);
-		}
-	
-		sUpdateGeometryElapsedTime += ug_timer.getElapsedTimeF64();
-		++sUpdateGeometryCalls;
-		if(0 != (sUpdateGeometryCalls & UPDATE_GEOMETRY_CALL_OVERFLOW))
-		{
-			F64 time_since_app_start = ug_timer.getElapsedSeconds();
-			if(sUpdateGeometryGlobalTime == 0.0 
-				|| sUpdateGeometryLastProcessor != sVectorizeProcessor)
-			{
-				sUpdateGeometryGlobalTime		= time_since_app_start;
-				sUpdateGeometryElapsedTime		= 0;
-				sUpdateGeometryCalls			= 0;
-				sUpdateGeometryRunCount			= 0;
-				sUpdateGeometryLastProcessor	= sVectorizeProcessor;
-				sUpdateGeometryCallPointer		= false;
-				return;
-			}
-			F64 percent_time_in_function = 
-				( sUpdateGeometryElapsedTime * 100.0 ) / ( time_since_app_start - sUpdateGeometryGlobalTime ) ;
-			sUpdateGeometryGlobalTime = time_since_app_start;
-			if (!sUpdateGeometryCallPointer)
-			{
-				// First set of run data is with vectorization off.
-				sUpdateGeometryCallPointer = true;
-				llinfos << "profile (avg of " << sUpdateGeometryCalls << " samples) = "
-					<< "vectorize off " << percent_time_in_function
-					<< "% of time with "
-					<< (sUpdateGeometryElapsedTime / (F64)sUpdateGeometryCalls)
-					<< " seconds per call "
-					<< llendl;
-				sUpdateGeometryRunAvgOff[sUpdateGeometryRunCount] = percent_time_in_function;
-				sUpdateGeometryElapsedTimeOff += sUpdateGeometryElapsedTime;
-				sUpdateGeometryCalls = 0;
-			}
-			else
-			{
-				// Second set of run data is with vectorization on.
-				sUpdateGeometryCallPointer = false;
-				llinfos << "profile (avg of " << sUpdateGeometryCalls << " samples) = "
-					<< "VEC on " << percent_time_in_function
-					<< "% of time with "
-					<< (sUpdateGeometryElapsedTime / (F64)sUpdateGeometryCalls)
-					<< " seconds per call "
-					<< llendl;
-				sUpdateGeometryRunAvgOn[sUpdateGeometryRunCount] = percent_time_in_function ;
-				sUpdateGeometryElapsedTimeOn += sUpdateGeometryElapsedTime;
-
-				sUpdateGeometryCalls = 0;
-				sUpdateGeometryRunCount++;
-				F64 a = 0.0, b = 0.0;
-				for(U32 i = 0; i<sUpdateGeometryRunCount; i++)
-				{
-					a += sUpdateGeometryRunAvgOff[i];
-					b += sUpdateGeometryRunAvgOn[i];
-				}
-				a /= sUpdateGeometryRunCount;
-				b /= sUpdateGeometryRunCount;
-				F64 perf_boost = ( sUpdateGeometryElapsedTimeOff - sUpdateGeometryElapsedTimeOn ) / sUpdateGeometryElapsedTimeOn;
-				llinfos << "run averages (" << (F64)sUpdateGeometryRunCount
-					<< "/10) vectorize off " << a
-					<< "% : vectorize type " << sVectorizeProcessor
-					<< " " << b
-					<< "% : performance boost " 
-					<< perf_boost * 100.0
-					<< "%"
-					<< llendl ;
-				if(sUpdateGeometryRunCount == 10)
-				{
-					// In case user runs test again, force reset of data on
-					// next run.
-					sUpdateGeometryGlobalTime = 0.0;
-
-					// We have data now on which version is faster.  Switch to that
-					// code and save the data for next run.
-					gSavedSettings.setBOOL("VectorizePerfTest", FALSE);
-
-					if (perf_boost > 0.0)
-					{
-						llinfos << "Vectorization improves avatar skinning performance, "
-							<< "keeping on for future runs."
-							<< llendl;
-						gSavedSettings.setBOOL("VectorizeSkin", TRUE);
-					}
-					else
-					{
-						// SIMD decreases performance, fall back to original code
-						llinfos << "Vectorization decreases avatar skinning performance, "
-							<< "switching back to original code."
-							<< llendl;
-
-						gSavedSettings.setBOOL("VectorizeSkin", FALSE);
-					}
-				}
-			}
-			sUpdateGeometryElapsedTime = 0.0f;
-		}
-	}
+	uploadJointMatrices();
+	updateGeometry(mFace, mMesh);
 }
 
 void LLViewerJointMesh::dump()
diff --git a/indra/newview/llviewerjointmesh.h b/indra/newview/llviewerjointmesh.h
index cab1205d61803c63081ac5eec61956ca90a4eb1f..0191f0cae8f8a6b06719f6ad6dab44746cd39157 100644
--- a/indra/newview/llviewerjointmesh.h
+++ b/indra/newview/llviewerjointmesh.h
@@ -143,23 +143,10 @@ class LLViewerJointMesh : public LLViewerJoint
 
 	/*virtual*/ BOOL isAnimatable() const { return FALSE; }
 	
-	static void updateVectorize(); // Update globals when settings variables change
-	
 private:
-	// Avatar vertex skinning is a significant performance issue on computers
-	// with avatar vertex programs turned off (for example, most Macs).  We
-	// therefore have custom versions that use SIMD instructions.
-	//
-	// These functions require compiler options for SSE2, SSE, or neither, and
-	// hence are contained in separate individual .cpp files.  JC
-	static void updateGeometryOriginal(LLFace* face, LLPolyMesh* mesh);
-	// generic vector code, used for Altivec
-	static void updateGeometryVectorized(LLFace* face, LLPolyMesh* mesh);
-	static void updateGeometrySSE(LLFace* face, LLPolyMesh* mesh);
-	static void updateGeometrySSE2(LLFace* face, LLPolyMesh* mesh);
-
-	// Use a fuction pointer to indicate which version we are running.
-	static void (*sUpdateGeometryFunc)(LLFace* face, LLPolyMesh* mesh);
+
+	//copy mesh into given face's vertex buffer, applying current animation pose
+	static void updateGeometry(LLFace* face, LLPolyMesh* mesh);
 
 private:
 	// Allocate skin data
diff --git a/indra/newview/llviewerjointmesh_sse.cpp b/indra/newview/llviewerjointmesh_sse.cpp
deleted file mode 100644
index 400b49d04602a58cba668a69362d5dc3cb9c1da1..0000000000000000000000000000000000000000
--- a/indra/newview/llviewerjointmesh_sse.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/** 
- * @file llviewerjointmesh_sse.cpp
- * @brief SSE vectorized joint skinning code, only used when video card does
- * not support avatar vertex programs.
- *
- * *NOTE: Disabled on Windows builds. See llv4math.h for details.
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-//-----------------------------------------------------------------------------
-// Header Files
-//-----------------------------------------------------------------------------
-
-#include "llviewerprecompiledheaders.h"
-
-#include "llviewerjointmesh.h"
-
-// project includes
-#include "llface.h"
-#include "llpolymesh.h"
-
-// library includes
-#include "lldarray.h"
-#include "llv4math.h"		// for LL_VECTORIZE
-#include "llv4matrix3.h"
-#include "llv4matrix4.h"
-#include "v3math.h"
-
-
-#if LL_VECTORIZE
-
-inline void matrix_translate(LLV4Matrix4& m, const LLMatrix4* w, const LLVector3& j)
-{
-	m.mV[VX] = _mm_loadu_ps(w->mMatrix[VX]);
-	m.mV[VY] = _mm_loadu_ps(w->mMatrix[VY]);
-	m.mV[VZ] = _mm_loadu_ps(w->mMatrix[VZ]);
-	m.mV[VW] = _mm_loadu_ps(w->mMatrix[VW]);
-	m.mV[VW] = _mm_add_ps(m.mV[VW], _mm_mul_ps(_mm_set1_ps(j.mV[VX]), m.mV[VX])); // ( ax * vx ) + vw
-	m.mV[VW] = _mm_add_ps(m.mV[VW], _mm_mul_ps(_mm_set1_ps(j.mV[VY]), m.mV[VY]));
-	m.mV[VW] = _mm_add_ps(m.mV[VW], _mm_mul_ps(_mm_set1_ps(j.mV[VZ]), m.mV[VZ]));
-}
-
-// static
-void LLViewerJointMesh::updateGeometrySSE(LLFace *face, LLPolyMesh *mesh)
-{
-	// This cannot be a file-level static because it will be initialized
-	// before main() using SSE code, which will crash on non-SSE processors.
-	static LLV4Matrix4	sJointMat[32];
-	LLDynamicArray<LLJointRenderData*>& joint_data = mesh->getReferenceMesh()->mJointRenderData;
-
-	//upload joint pivots/matrices
-	for(S32 j = 0, jend = joint_data.count(); j < jend ; ++j )
-	{
-		matrix_translate(sJointMat[j], joint_data[j]->mWorldMatrix,
-			joint_data[j]->mSkinJoint ?
-				joint_data[j]->mSkinJoint->mRootToJointSkinOffset
-				: joint_data[j+1]->mSkinJoint->mRootToParentJointSkinOffset);
-	}
-
-	F32					weight		= F32_MAX;
-	LLV4Matrix4			blend_mat;
-
-	LLStrider<LLVector3> o_vertices;
-	LLStrider<LLVector3> o_normals;
-
-	LLVertexBuffer *buffer = face->getVertexBuffer();
-	buffer->getVertexStrider(o_vertices,  mesh->mFaceVertexOffset);
-	buffer->getNormalStrider(o_normals,   mesh->mFaceVertexOffset);
-
-	const F32*			weights			= mesh->getWeights();
-	const LLVector3*	coords			= (const LLVector3*)mesh->getCoords();
-	const LLVector3*	normals			= (const LLVector3*)mesh->getNormals();
-	for (U32 index = 0, index_end = mesh->getNumVertices(); index < index_end; ++index)
-	{
-		if( weight != weights[index])
-		{
-			S32 joint = llfloor(weight = weights[index]);
-			blend_mat.lerp(sJointMat[joint], sJointMat[joint+1], weight - joint);
-		}
-		blend_mat.multiply(coords[index], o_vertices[index]);
-		((LLV4Matrix3)blend_mat).multiply(normals[index], o_normals[index]);
-	}
-
-	buffer->setBuffer(0);
-}
-
-#else
-
-void LLViewerJointMesh::updateGeometrySSE(LLFace *face, LLPolyMesh *mesh)
-{
-	LLViewerJointMesh::updateGeometryVectorized(face, mesh);
-}
-
-#endif
diff --git a/indra/newview/llviewerjointmesh_sse2.cpp b/indra/newview/llviewerjointmesh_sse2.cpp
deleted file mode 100644
index c2296dd56964dd52ac06e3035c6c552a9969a0f7..0000000000000000000000000000000000000000
--- a/indra/newview/llviewerjointmesh_sse2.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/** 
- * @file llviewerjointmesh_sse2.cpp
- * @brief SSE vectorized joint skinning code, only used when video card does
- * not support avatar vertex programs.
- *
- * *NOTE: Disabled on Windows builds. See llv4math.h for details.
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-// Visual Studio required settings for this file:
-// Precompiled Headers OFF
-// Code Generation: SSE2
-
-//-----------------------------------------------------------------------------
-// Header Files
-//-----------------------------------------------------------------------------
-
-#include "llviewerprecompiledheaders.h"
-
-#include "llviewerjointmesh.h"
-
-// project includes
-#include "llface.h"
-#include "llpolymesh.h"
-
-// library includes
-#include "lldarray.h"
-#include "llstrider.h"
-#include "llv4math.h"		// for LL_VECTORIZE
-#include "llv4matrix3.h"
-#include "llv4matrix4.h"
-#include "m4math.h"
-#include "v3math.h"
-
-
-#if LL_VECTORIZE
-
-
-inline void matrix_translate(LLV4Matrix4& m, const LLMatrix4* w, const LLVector3& j)
-{
-	m.mV[VX] = _mm_loadu_ps(w->mMatrix[VX]);
-	m.mV[VY] = _mm_loadu_ps(w->mMatrix[VY]);
-	m.mV[VZ] = _mm_loadu_ps(w->mMatrix[VZ]);
-	m.mV[VW] = _mm_loadu_ps(w->mMatrix[VW]);
-	m.mV[VW] = _mm_add_ps(m.mV[VW], _mm_mul_ps(_mm_set1_ps(j.mV[VX]), m.mV[VX])); // ( ax * vx ) + vw
-	m.mV[VW] = _mm_add_ps(m.mV[VW], _mm_mul_ps(_mm_set1_ps(j.mV[VY]), m.mV[VY]));
-	m.mV[VW] = _mm_add_ps(m.mV[VW], _mm_mul_ps(_mm_set1_ps(j.mV[VZ]), m.mV[VZ]));
-}
-
-// static
-void LLViewerJointMesh::updateGeometrySSE2(LLFace *face, LLPolyMesh *mesh)
-{
-	// This cannot be a file-level static because it will be initialized
-	// before main() using SSE code, which will crash on non-SSE processors.
-	static LLV4Matrix4	sJointMat[32];
-	LLDynamicArray<LLJointRenderData*>& joint_data = mesh->getReferenceMesh()->mJointRenderData;
-
-	//upload joint pivots/matrices
-	for(S32 j = 0, jend = joint_data.count(); j < jend ; ++j )
-	{
-		matrix_translate(sJointMat[j], joint_data[j]->mWorldMatrix,
-			joint_data[j]->mSkinJoint ?
-				joint_data[j]->mSkinJoint->mRootToJointSkinOffset
-				: joint_data[j+1]->mSkinJoint->mRootToParentJointSkinOffset);
-	}
-
-	F32					weight		= F32_MAX;
-	LLV4Matrix4			blend_mat;
-
-	LLStrider<LLVector3> o_vertices;
-	LLStrider<LLVector3> o_normals;
-
-	LLVertexBuffer *buffer = face->getVertexBuffer();
-	buffer->getVertexStrider(o_vertices,  mesh->mFaceVertexOffset);
-	buffer->getNormalStrider(o_normals,   mesh->mFaceVertexOffset);
-
-	const F32*			weights			= mesh->getWeights();
-	const LLVector3*	coords			= (const LLVector3*)mesh->getCoords();
-	const LLVector3*	normals			= (const LLVector3*)mesh->getNormals();
-	for (U32 index = 0, index_end = mesh->getNumVertices(); index < index_end; ++index)
-	{
-		if( weight != weights[index])
-		{
-			S32 joint = llfloor(weight = weights[index]);
-			blend_mat.lerp(sJointMat[joint], sJointMat[joint+1], weight - joint);
-		}
-		blend_mat.multiply(coords[index], o_vertices[index]);
-		((LLV4Matrix3)blend_mat).multiply(normals[index], o_normals[index]);
-	}
-	
-	//setBuffer(0) called in LLVOAvatar::renderSkinned
-}
-
-#else
-
-void LLViewerJointMesh::updateGeometrySSE2(LLFace *face, LLPolyMesh *mesh)
-{
-	LLViewerJointMesh::updateGeometryVectorized(face, mesh);
-}
-
-#endif
diff --git a/indra/newview/llviewerjointmesh_vec.cpp b/indra/newview/llviewerjointmesh_vec.cpp
deleted file mode 100644
index 6600d01d171072cc52b5b8b626cae8f2d35f2036..0000000000000000000000000000000000000000
--- a/indra/newview/llviewerjointmesh_vec.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/** 
- * @file llviewerjointmesh_vec.cpp
- * @brief Compiler-generated vectorized joint skinning code, works well on
- * Altivec processors (PowerPC Mac)
- *
- * *NOTE: See llv4math.h for notes on SSE/Altivec vector code.
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-//-----------------------------------------------------------------------------
-// Header Files
-//-----------------------------------------------------------------------------
-#include "llviewerprecompiledheaders.h"
-
-#include "llviewerjointmesh.h"
-
-#include "llface.h"
-#include "llpolymesh.h"
-#include "llv4math.h"
-#include "llv4matrix3.h"
-#include "llv4matrix4.h"
-
-// Generic vectorized code, uses compiler defaults, works well for Altivec
-// on PowerPC.
-
-// static
-void LLViewerJointMesh::updateGeometryVectorized(LLFace *face, LLPolyMesh *mesh)
-{
-#if 0
-	static LLV4Matrix4	sJointMat[32];
-	LLDynamicArray<LLJointRenderData*>& joint_data = mesh->getReferenceMesh()->mJointRenderData;
-	S32 j, joint_num, joint_end = joint_data.count();
-	LLV4Vector3 pivot;
-
-	//upload joint pivots/matrices
-	for(j = joint_num = 0; joint_num < joint_end ; ++joint_num )
-	{
-		LLSkinJoint *sj;
-		const LLMatrix4 *	wm = joint_data[joint_num]->mWorldMatrix;
-		if (NULL == (sj = joint_data[joint_num]->mSkinJoint))
-		{
-				sj = joint_data[++joint_num]->mSkinJoint;
-				((LLV4Matrix3)(sJointMat[j] = *wm)).multiply(sj->mRootToParentJointSkinOffset, pivot);
-				sJointMat[j++].translate(pivot);
-				wm = joint_data[joint_num]->mWorldMatrix;
-		}
-		((LLV4Matrix3)(sJointMat[j] = *wm)).multiply(sj->mRootToJointSkinOffset, pivot);
-		sJointMat[j++].translate(pivot);
-	}
-
-	F32					weight		= F32_MAX;
-	LLV4Matrix4			blend_mat;
-
-	LLStrider<LLVector3> o_vertices;
-	LLStrider<LLVector3> o_normals;
-
-	LLVertexBuffer *buffer = face->mVertexBuffer;
-	buffer->getVertexStrider(o_vertices,  mesh->mFaceVertexOffset);
-	buffer->getNormalStrider(o_normals,   mesh->mFaceVertexOffset);
-
-	const F32*			weights			= mesh->getWeights();
-	const LLVector3*	coords			= mesh->getCoords();
-	const LLVector3*	normals			= mesh->getNormals();
-	for (U32 index = 0, index_end = mesh->getNumVertices(); index < index_end; ++index)
-	{
-		if( weight != weights[index])
-		{
-			S32 joint = llfloor(weight = weights[index]);
-			blend_mat.lerp(sJointMat[joint], sJointMat[joint+1], weight - joint);
-		}
-		blend_mat.multiply(coords[index], o_vertices[index]);
-		((LLV4Matrix3)blend_mat).multiply(normals[index], o_normals[index]);
-	}
-
-	buffer->setBuffer(0);
-#endif
-}
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 67c8a4b902ddc678cceb02d2c7ed1914abe3bf0a..1eb4bedfaf9b47114be4f6c85a0962d7a61eef32 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -26,48 +26,50 @@
 
 #include "llviewerprecompiledheaders.h"
 
+#include "llviewermedia.h"
+
 #include "llagent.h"
 #include "llagentcamera.h"
-#include "llviewermedia.h"
-#include "llviewermediafocus.h"
-#include "llmimetypes.h"
+#include "llappviewer.h"
+#include "llaudioengine.h"  // for gAudiop
+#include "llcallbacklist.h"
+#include "lldir.h"
+#include "lldiriterator.h"
+#include "llevent.h"		// LLSimpleListener
+#include "llfilepicker.h"
+#include "llfloaterwebcontent.h"	// for handling window close requests and geometry change requests in media browser windows.
+#include "llfocusmgr.h"
+#include "llkeyboard.h"
+#include "lllogininstance.h"
+#include "llmarketplacefunctions.h"
 #include "llmediaentry.h"
+#include "llmimetypes.h"
+#include "llmutelist.h"
+#include "llnotifications.h"
+#include "llnotificationsutil.h"
+#include "llpanelprofile.h"
+#include "llparcel.h"
+#include "llpluginclassmedia.h"
+#include "llplugincookiestore.h"
+#include "llurldispatcher.h"
+#include "lluuid.h"
 #include "llversioninfo.h"
+#include "llviewermediafocus.h"
 #include "llviewercontrol.h"
-#include "llviewertexture.h"
+#include "llviewernetwork.h"
 #include "llviewerparcelmedia.h"
 #include "llviewerparcelmgr.h"
+#include "llviewerregion.h"
+#include "llviewertexture.h"
 #include "llviewertexturelist.h"
-#include "llvovolume.h"
-#include "llpluginclassmedia.h"
-#include "llplugincookiestore.h"
 #include "llviewerwindow.h"
-#include "llfocusmgr.h"
-#include "llcallbacklist.h"
-#include "llparcel.h"
-#include "llaudioengine.h"  // for gAudiop
-#include "llurldispatcher.h"
 #include "llvoavatar.h"
 #include "llvoavatarself.h"
-#include "llviewerregion.h"
+#include "llvovolume.h"
 #include "llwebprofile.h"
 #include "llwebsharing.h"	// For LLWebSharing::setOpenIDCookie(), *TODO: find a better way to do this!
-#include "llfilepicker.h"
-#include "llnotifications.h"
-#include "lldir.h"
-#include "lldiriterator.h"
-#include "llevent.h"		// LLSimpleListener
-#include "llnotificationsutil.h"
-#include "lluuid.h"
-#include "llkeyboard.h"
-#include "llmutelist.h"
-#include "llpanelprofile.h"
-#include "llappviewer.h"
-#include "lllogininstance.h" 
-//#include "llfirstuse.h"
-#include "llviewernetwork.h"
 #include "llwindow.h"
-
+#include "llvieweraudio.h"
 
 #include "llfloaterwebcontent.h"	// for handling window close requests and geometry change requests in media browser windows.
 
@@ -385,7 +387,6 @@ class LLViewerMediaMuteListObserver : public LLMuteListObserver
 
 static LLViewerMediaMuteListObserver sViewerMediaMuteListObserver;
 static bool sViewerMediaMuteListObserverInitialized = false;
-static bool sInWorldMediaDisabled = false;
 
 
 //////////////////////////////////////////////////////////////////////////////////////////
@@ -650,20 +651,6 @@ void LLViewerMedia::muteListChanged()
 	}
 }
 
-//////////////////////////////////////////////////////////////////////////////////////////
-// static
-void LLViewerMedia::setInWorldMediaDisabled(bool disabled)
-{
-	sInWorldMediaDisabled = disabled;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// static
-bool LLViewerMedia::getInWorldMediaDisabled()
-{
-	return sInWorldMediaDisabled;
-}
-
 //////////////////////////////////////////////////////////////////////////////////////////
 // static
 bool LLViewerMedia::isInterestingEnough(const LLVOVolume *object, const F64 &object_interest)
@@ -786,6 +773,12 @@ static bool proximity_comparitor(const LLViewerMediaImpl* i1, const LLViewerMedi
 }
 
 static LLFastTimer::DeclareTimer FTM_MEDIA_UPDATE("Update Media");
+static LLFastTimer::DeclareTimer FTM_MEDIA_SPARE_IDLE("Spare Idle");
+static LLFastTimer::DeclareTimer FTM_MEDIA_UPDATE_INTEREST("Update/Interest");
+static LLFastTimer::DeclareTimer FTM_MEDIA_SORT("Sort");
+static LLFastTimer::DeclareTimer FTM_MEDIA_SORT2("Sort 2");
+static LLFastTimer::DeclareTimer FTM_MEDIA_MISC("Misc");
+
 
 //////////////////////////////////////////////////////////////////////////////////////////
 // static
@@ -810,21 +803,28 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
 	impl_list::iterator iter = sViewerMediaImplList.begin();
 	impl_list::iterator end = sViewerMediaImplList.end();
 
-	for(; iter != end;)
 	{
-		LLViewerMediaImpl* pimpl = *iter++;
-		pimpl->update();
-		pimpl->calculateInterest();
+		LLFastTimer t(FTM_MEDIA_UPDATE_INTEREST);
+		for(; iter != end;)
+		{
+			LLViewerMediaImpl* pimpl = *iter++;
+			pimpl->update();
+			pimpl->calculateInterest();
+		}
 	}
 	
 	// Let the spare media source actually launch
 	if(sSpareBrowserMediaSource)
 	{
+		LLFastTimer t(FTM_MEDIA_SPARE_IDLE);
 		sSpareBrowserMediaSource->idle();
 	}
 		
-	// Sort the static instance list using our interest criteria
-	sViewerMediaImplList.sort(priorityComparitor);
+	{
+		LLFastTimer t(FTM_MEDIA_SORT);
+		// Sort the static instance list using our interest criteria
+		sViewerMediaImplList.sort(priorityComparitor);
+	}
 
 	// Go through the list again and adjust according to priority.
 	iter = sViewerMediaImplList.begin();
@@ -852,147 +852,150 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
 	// max_instances must be set high enough to allow the various instances used in the UI (for the help browser, search, etc.) to be loaded.
 	// If max_normal + max_low is less than max_instances, things will tend to get unloaded instead of being set to slideshow.
 	
-	for(; iter != end; iter++)
 	{
-		LLViewerMediaImpl* pimpl = *iter;
+		LLFastTimer t(FTM_MEDIA_MISC);
+		for(; iter != end; iter++)
+		{
+			LLViewerMediaImpl* pimpl = *iter;
 		
-		LLPluginClassMedia::EPriority new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
+			LLPluginClassMedia::EPriority new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
 
-		if(pimpl->isForcedUnloaded() || (impl_count_total >= (int)max_instances))
-		{
-			// Never load muted or failed impls.
-			// Hard limit on the number of instances that will be loaded at one time
-			new_priority = LLPluginClassMedia::PRIORITY_UNLOADED;
-		}
-		else if(!pimpl->getVisible())
-		{
-			new_priority = LLPluginClassMedia::PRIORITY_HIDDEN;
-		}
-		else if(pimpl->hasFocus())
-		{
-			new_priority = LLPluginClassMedia::PRIORITY_HIGH;
-			impl_count_interest_normal++;	// count this against the count of "normal" instances for priority purposes
-		}
-		else if(pimpl->getUsedInUI())
-		{
-			new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
-			impl_count_interest_normal++;
-		}
-		else if(pimpl->isParcelMedia())
-		{
-			new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
-			impl_count_interest_normal++;
-		}
-		else
-		{
-			// Look at interest and CPU usage for instances that aren't in any of the above states.
-			
-			// Heuristic -- if the media texture's approximate screen area is less than 1/4 of the native area of the texture,
-			// turn it down to low instead of normal.  This may downsample for plugins that support it.
-			bool media_is_small = false;
-			F64 approximate_interest = pimpl->getApproximateTextureInterest();
-			if(approximate_interest == 0.0f)
+			if(pimpl->isForcedUnloaded() || (impl_count_total >= (int)max_instances))
 			{
-				// this media has no current size, which probably means it's not loaded.
-				media_is_small = true;
+				// Never load muted or failed impls.
+				// Hard limit on the number of instances that will be loaded at one time
+				new_priority = LLPluginClassMedia::PRIORITY_UNLOADED;
 			}
-			else if(pimpl->getInterest() < (approximate_interest / 4))
+			else if(!pimpl->getVisible())
 			{
-				media_is_small = true;
+				new_priority = LLPluginClassMedia::PRIORITY_HIDDEN;
 			}
-			
-			if(pimpl->getInterest() == 0.0f)
+			else if(pimpl->hasFocus())
 			{
-				// This media is completely invisible, due to being outside the view frustrum or out of range.
-				new_priority = LLPluginClassMedia::PRIORITY_HIDDEN;
+				new_priority = LLPluginClassMedia::PRIORITY_HIGH;
+				impl_count_interest_normal++;	// count this against the count of "normal" instances for priority purposes
 			}
-			else if(check_cpu_usage && (total_cpu > max_cpu))
+			else if(pimpl->getUsedInUI())
 			{
-				// Higher priority plugins have already used up the CPU budget.  Set remaining ones to slideshow priority.
-				new_priority = LLPluginClassMedia::PRIORITY_SLIDESHOW;
+				new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
+				impl_count_interest_normal++;
 			}
-			else if((impl_count_interest_normal < (int)max_normal) && !media_is_small)
+			else if(pimpl->isParcelMedia())
 			{
-				// Up to max_normal inworld get normal priority
 				new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
 				impl_count_interest_normal++;
 			}
-			else if (impl_count_interest_low + impl_count_interest_normal < (int)max_low + (int)max_normal)
+			else
 			{
-				// The next max_low inworld get turned down
-				new_priority = LLPluginClassMedia::PRIORITY_LOW;
-				impl_count_interest_low++;
-				
-				// Set the low priority size for downsampling to approximately the size the texture is displayed at.
+				// Look at interest and CPU usage for instances that aren't in any of the above states.
+			
+				// Heuristic -- if the media texture's approximate screen area is less than 1/4 of the native area of the texture,
+				// turn it down to low instead of normal.  This may downsample for plugins that support it.
+				bool media_is_small = false;
+				F64 approximate_interest = pimpl->getApproximateTextureInterest();
+				if(approximate_interest == 0.0f)
 				{
-					F32 approximate_interest_dimension = (F32) sqrt(pimpl->getInterest());
+					// this media has no current size, which probably means it's not loaded.
+					media_is_small = true;
+				}
+				else if(pimpl->getInterest() < (approximate_interest / 4))
+				{
+					media_is_small = true;
+				}
+			
+				if(pimpl->getInterest() == 0.0f)
+				{
+					// This media is completely invisible, due to being outside the view frustrum or out of range.
+					new_priority = LLPluginClassMedia::PRIORITY_HIDDEN;
+				}
+				else if(check_cpu_usage && (total_cpu > max_cpu))
+				{
+					// Higher priority plugins have already used up the CPU budget.  Set remaining ones to slideshow priority.
+					new_priority = LLPluginClassMedia::PRIORITY_SLIDESHOW;
+				}
+				else if((impl_count_interest_normal < (int)max_normal) && !media_is_small)
+				{
+					// Up to max_normal inworld get normal priority
+					new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
+					impl_count_interest_normal++;
+				}
+				else if (impl_count_interest_low + impl_count_interest_normal < (int)max_low + (int)max_normal)
+				{
+					// The next max_low inworld get turned down
+					new_priority = LLPluginClassMedia::PRIORITY_LOW;
+					impl_count_interest_low++;
+				
+					// Set the low priority size for downsampling to approximately the size the texture is displayed at.
+					{
+						F32 approximate_interest_dimension = (F32) sqrt(pimpl->getInterest());
 					
-					pimpl->setLowPrioritySizeLimit(llround(approximate_interest_dimension));
+						pimpl->setLowPrioritySizeLimit(llround(approximate_interest_dimension));
+					}
+				}
+				else
+				{
+					// Any additional impls (up to max_instances) get very infrequent time
+					new_priority = LLPluginClassMedia::PRIORITY_SLIDESHOW;
 				}
 			}
-			else
-			{
-				// Any additional impls (up to max_instances) get very infrequent time
-				new_priority = LLPluginClassMedia::PRIORITY_SLIDESHOW;
-			}
-		}
 		
-		if(!pimpl->getUsedInUI() && (new_priority != LLPluginClassMedia::PRIORITY_UNLOADED))
-		{
-			// This is a loadable inworld impl -- the last one in the list in this class defines the lowest loadable interest.
-			lowest_interest_loadable = pimpl;
+			if(!pimpl->getUsedInUI() && (new_priority != LLPluginClassMedia::PRIORITY_UNLOADED))
+			{
+				// This is a loadable inworld impl -- the last one in the list in this class defines the lowest loadable interest.
+				lowest_interest_loadable = pimpl;
 			
-			impl_count_total++;
-		}
+				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;
-		}
+			// 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;
+			}
 		
-		if(!inworld_media_enabled)
-		{
-			// If inworld media is locked out, force all inworld media to stay unloaded.
-			if(!pimpl->getUsedInUI())
+			if(!inworld_media_enabled)
 			{
-				new_priority = LLPluginClassMedia::PRIORITY_UNLOADED;
+				// If inworld media is locked out, force all inworld media to stay unloaded.
+				if(!pimpl->getUsedInUI())
+				{
+					new_priority = LLPluginClassMedia::PRIORITY_UNLOADED;
+				}
 			}
-		}
-		// update the audio stream here as well
-		if( !inworld_audio_enabled)
-		{
-			if(LLViewerMedia::isParcelAudioPlaying() && gAudiop && LLViewerMedia::hasParcelAudio())
+			// update the audio stream here as well
+			if( !inworld_audio_enabled)
 			{
-				gAudiop->stopInternetStream();
+				if(LLViewerMedia::isParcelAudioPlaying() && gAudiop && LLViewerMedia::hasParcelAudio())
+				{
+					LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade();
+				}
 			}
-		}
-		pimpl->setPriority(new_priority);
+			pimpl->setPriority(new_priority);
 		
-		if(pimpl->getUsedInUI())
-		{
-			// Any impls used in the UI should not be in the proximity list.
-			pimpl->mProximity = -1;
-		}
-		else
-		{
-			proximity_order.push_back(pimpl);
-		}
+			if(pimpl->getUsedInUI())
+			{
+				// Any impls used in the UI should not be in the proximity list.
+				pimpl->mProximity = -1;
+			}
+			else
+			{
+				proximity_order.push_back(pimpl);
+			}
 
-		total_cpu += pimpl->getCPUUsage();
+			total_cpu += pimpl->getCPUUsage();
 		
-		if (!pimpl->getUsedInUI() && pimpl->hasMedia())
-		{
-			sAnyMediaShowing = true;
-		}
+			if (!pimpl->getUsedInUI() && pimpl->hasMedia())
+			{
+				sAnyMediaShowing = true;
+			}
 
+		}
 	}
 
 	// Re-calculate this every time.
@@ -1018,6 +1021,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
 	}
 	else
 	{
+		LLFastTimer t(FTM_MEDIA_SORT2);
 		// Use a distance-based sort for proximity values.  
 		std::stable_sort(proximity_order.begin(), proximity_order.end(), proximity_comparitor);
 	}
@@ -1073,13 +1077,24 @@ void LLViewerMedia::setAllMediaEnabled(bool val)
 			gAudiop && 
 			LLViewerMedia::hasParcelAudio())
 		{
-			gAudiop->startInternetStream(LLViewerMedia::getParcelAudioURL());
+			if (LLAudioEngine::AUDIO_PAUSED == gAudiop->isInternetStreamPlaying())
+			{
+				// 'false' means unpause
+				gAudiop->pauseInternetStream(false);
+			}
+			else
+			{
+				LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLViewerMedia::getParcelAudioURL());
+			}
 		}
 	}
 	else {
 		// This actually unloads the impl, as opposed to "stop"ping the media
 		LLViewerParcelMedia::stop();
-		if (gAudiop) gAudiop->stopInternetStream();
+		if (gAudiop)
+		{
+			LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade();
+		}
 	}
 }
 
@@ -1370,75 +1385,11 @@ void LLViewerMedia::removeCookie(const std::string &name, const std::string &dom
 }
 
 
-// This is defined in two files but I don't want to create a dependence between this and llsidepanelinventory
-// just to be able to temporarily disable the outbox.
-#define ENABLE_INVENTORY_DISPLAY_OUTBOX		0	// keep in sync with ENABLE_MERCHANT_OUTBOX_PANEL, ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU
-
-class LLInventoryUserStatusResponder : public LLHTTPClient::Responder
-{
-public:
-	LLInventoryUserStatusResponder()
-		: LLCurl::Responder()
-	{
-	}
-
-	void completed(U32 status, const std::string& reason, const LLSD& content)
-	{
-		if (isGoodStatus(status))
-		{
-			std::string merchantStatus = content[gAgent.getID().getString()].asString();
-			llinfos << "Marketplace merchant status: " << merchantStatus << llendl;
-
-			// Save the merchant status before turning on the display
-			gSavedSettings.setString("InventoryMarketplaceUserStatus", merchantStatus);
-
-			// Complete success
-			gSavedSettings.setBOOL("InventoryDisplayInbox", true);
-
-#if ENABLE_INVENTORY_DISPLAY_OUTBOX
-			gSavedSettings.setBOOL("InventoryDisplayOutbox", true);
-#endif
-		}
-		else if (status == 401)
-		{
-			// API is available for use but OpenID authorization failed
-			gSavedSettings.setBOOL("InventoryDisplayInbox", true);
-		}
-		else
-		{
-			// API in unavailable
-			llinfos << "Marketplace API is unavailable -- Inbox may be disabled, status = " << status << ", reason = " << reason << llendl;
-		}
-	}
-};
-
-
-void doOnetimeEarlyHTTPRequests()
-{
-	std::string url = "https://marketplace.secondlife.com/";
-
-	if (!LLGridManager::getInstance()->isInProductionGrid())
-	{
-		std::string gridLabel = LLGridManager::getInstance()->getGridLabel();
-		url = llformat("https://marketplace.%s.lindenlab.com/", utf8str_tolower(gridLabel).c_str());
-
-		// TEMP for Jim's pdp
-		//url = "http://pdp24.lindenlab.com:3000/";
-	}
-	
-	url += "api/1/users/";
-	url += gAgent.getID().getString();
-	url += "/user_status";
-
-	llinfos << "http get: " << url << llendl;
-	LLHTTPClient::get(url, new LLInventoryUserStatusResponder(), LLViewerMedia::getHeaders());
-}
-
-
 LLSD LLViewerMedia::getHeaders()
 {
 	LLSD headers = LLSD::emptyMap();
 	headers["Accept"] = "*/*";
+	headers["Content-Type"] = "application/xml";
 	headers["Cookie"] = sOpenIDCookie;
 	headers["User-Agent"] = getCurrentUserAgent();
 
@@ -1493,9 +1444,6 @@ void LLViewerMedia::setOpenIDCookie()
 		LLHTTPClient::get(profile_url,  
 			new LLViewerMediaWebProfileResponder(raw_profile_url.getAuthority()),
 			headers);
-
-		// FUI: No longer perform the user_status query
-		//doOnetimeEarlyHTTPRequests();
 	}
 }
 
@@ -1605,7 +1553,6 @@ LLPluginClassMedia* LLViewerMedia::getSpareBrowserMediaSource()
 
 bool LLViewerMedia::hasInWorldMedia()
 {
-	if (sInWorldMediaDisabled) return false;
 	impl_list::iterator iter = sViewerMediaImplList.begin();
 	impl_list::iterator end = sViewerMediaImplList.end();
 	// This should be quick, because there should be very few non-in-world-media impls
@@ -1869,7 +1816,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
 	
 	if(plugin_basename.empty())
 	{
-		LL_WARNS("Media") << "Couldn't find plugin for media type " << media_type << LL_ENDL;
+		LL_WARNS_ONCE("Media") << "Couldn't find plugin for media type " << media_type << LL_ENDL;
 	}
 	else
 	{
@@ -1895,11 +1842,11 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
 		llstat s;
 		if(LLFile::stat(launcher_name, &s))
 		{
-			LL_WARNS("Media") << "Couldn't find launcher at " << launcher_name << LL_ENDL;
+			LL_WARNS_ONCE("Media") << "Couldn't find launcher at " << launcher_name << LL_ENDL;
 		}
 		else if(LLFile::stat(plugin_name, &s))
 		{
-			LL_WARNS("Media") << "Couldn't find plugin at " << plugin_name << LL_ENDL;
+			LL_WARNS_ONCE("Media") << "Couldn't find plugin at " << plugin_name << LL_ENDL;
 		}
 		else
 		{
@@ -1938,7 +1885,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
 		}
 	}
 	
-	LL_WARNS("Plugin") << "plugin intialization failed for mime type: " << media_type << LL_ENDL;
+	LL_WARNS_ONCE("Plugin") << "plugin initialization failed for mime type: " << media_type << LL_ENDL;
 	LLSD args;
 	args["MIME_TYPE"] = media_type;
 	LLNotificationsUtil::add("NoPlugin", args);
@@ -2538,7 +2485,7 @@ void LLViewerMediaImpl::updateJavascriptObject()
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
-std::string LLViewerMediaImpl::getName() const 
+const std::string& LLViewerMediaImpl::getName() const 
 { 
 	if (mMediaSource)
 	{
@@ -2800,8 +2747,14 @@ bool LLViewerMediaImpl::canNavigateBack()
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
+static LLFastTimer::DeclareTimer FTM_MEDIA_DO_UPDATE("Do Update");
+static LLFastTimer::DeclareTimer FTM_MEDIA_GET_DATA("Get Data");
+static LLFastTimer::DeclareTimer FTM_MEDIA_SET_SUBIMAGE("Set Subimage");
+
+
 void LLViewerMediaImpl::update()
 {
+	LLFastTimer t(FTM_MEDIA_DO_UPDATE);
 	if(mMediaSource == NULL)
 	{
 		if(mPriority == LLPluginClassMedia::PRIORITY_UNLOADED)
@@ -2901,20 +2854,27 @@ void LLViewerMediaImpl::update()
 			if(width > 0 && height > 0)
 			{
 
-				U8* data = mMediaSource->getBitsData();
+				U8* data = NULL;
+				{
+					LLFastTimer t(FTM_MEDIA_GET_DATA);
+					data = mMediaSource->getBitsData();
+				}
 
 				// Offset the pixels pointer to match x_pos and y_pos
 				data += ( x_pos * mMediaSource->getTextureDepth() * mMediaSource->getBitsWidth() );
 				data += ( y_pos * mMediaSource->getTextureDepth() );
 				
-				placeholder_image->setSubImage(
-						data, 
-						mMediaSource->getBitsWidth(), 
-						mMediaSource->getBitsHeight(),
-						x_pos, 
-						y_pos, 
-						width, 
-						height);
+				{
+					LLFastTimer t(FTM_MEDIA_SET_SUBIMAGE);
+					placeholder_image->setSubImage(
+							data, 
+							mMediaSource->getBitsWidth(), 
+							mMediaSource->getBitsHeight(),
+							x_pos, 
+							y_pos, 
+							width, 
+							height);
+				}
 
 			}
 			
@@ -3131,15 +3091,6 @@ bool LLViewerMediaImpl::isForcedUnloaded() const
 		return true;
 	}
 	
-	if(sInWorldMediaDisabled)
-	{
-		// When inworld media is disabled, all instances that aren't marked as "used in UI" will not be loaded.
-		if(!mUsedInUI)
-		{
-			return true;
-		}
-	}
-	
 	// If this media's class is not supposed to be shown, unload
 	if (!shouldShowBasedOnClass())
 	{
@@ -3485,8 +3436,11 @@ BOOL LLViewerMediaImpl::isUpdated()
 	return mIsUpdated ;
 }
 
+static LLFastTimer::DeclareTimer FTM_MEDIA_CALCULATE_INTEREST("Calculate Interest");
+
 void LLViewerMediaImpl::calculateInterest()
 {
+	LLFastTimer t(FTM_MEDIA_CALCULATE_INTEREST);
 	LLViewerMediaTexture* texture = LLViewerTextureManager::findMediaTexture( mTextureId );
 	
 	if(texture != NULL)
@@ -3804,12 +3758,22 @@ bool LLViewerMediaImpl::shouldShowBasedOnClass() const
 	
 	// If it is attached to an avatar and the pref is off, we shouldn't show it
 	if (attached_to_another_avatar)
-		return gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_ON_OTHERS_SETTING);
-	
+	{
+		static LLCachedControl<bool> show_media_on_others(gSavedSettings, LLViewerMedia::SHOW_MEDIA_ON_OTHERS_SETTING);
+		return show_media_on_others;
+	}
 	if (inside_parcel)
-		return gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_WITHIN_PARCEL_SETTING);
+	{
+		static LLCachedControl<bool> show_media_within_parcel(gSavedSettings, LLViewerMedia::SHOW_MEDIA_WITHIN_PARCEL_SETTING);
+
+		return show_media_within_parcel;
+	}
 	else 
-		return gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING);
+	{
+		static LLCachedControl<bool> show_media_outside_parcel(gSavedSettings, LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING);
+
+		return show_media_outside_parcel;
+	}
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h
index 3db9f0b4e000251e8ed97d3889e8fe709a64b269..fff5b3fc089211ac9693295cf90e1ac2a78326e2 100644
--- a/indra/newview/llviewermedia.h
+++ b/indra/newview/llviewermedia.h
@@ -112,9 +112,6 @@ class LLViewerMedia
 	
 	static F32 getVolume();	
 	static void muteListChanged();
-	static void setInWorldMediaDisabled(bool disabled);
-	static bool getInWorldMediaDisabled();
-	
 	static bool isInterestingEnough(const LLVOVolume* object, const F64 &object_interest);
 	
 	// Returns the priority-sorted list of all media impls.
@@ -318,7 +315,7 @@ class LLViewerMediaImpl
 	/*virtual*/ BOOL	handleToolTip(S32 x, S32 y, MASK mask) { return FALSE; };
 	/*virtual*/ BOOL	handleMiddleMouseDown(S32 x, S32 y, MASK mask) { return FALSE; };
 	/*virtual*/ BOOL	handleMiddleMouseUp(S32 x, S32 y, MASK mask) {return FALSE; };
-	/*virtual*/ std::string getName() const;
+	/*virtual*/ const std::string& getName() const;
 
 	/*virtual*/ void	screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const {};
 	/*virtual*/ void	localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const {};
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 22d95563d86d78f206ccdfe1c988ff46aa367e5c..7481414b5c49771772f91844ba70798f06125183 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -25,6 +25,11 @@
  */
 
 #include "llviewerprecompiledheaders.h"
+
+#ifdef INCLUDE_VLD
+#include "vld.h"
+#endif
+
 #include "llviewermenu.h" 
 
 // linden library includes
@@ -76,7 +81,6 @@
 #include "llinventoryfunctions.h"
 #include "llpanellogin.h"
 #include "llpanelblockedlist.h"
-#include "llmenucommands.h"
 #include "llmoveview.h"
 #include "llparcel.h"
 #include "llrootview.h"
@@ -215,7 +219,7 @@ void near_sit_down_point(BOOL success, void *);
 
 
 void velocity_interpolate( void* );
-
+void handle_visual_leak_detector_toggle(void*);
 void handle_rebake_textures(void*);
 BOOL check_admin_override(void*);
 void handle_admin_override_toggle(void*);
@@ -948,6 +952,10 @@ U32 info_display_from_string(std::string info_display)
 	{
 		return LLPipeline::RENDER_DEBUG_COMPOSITION;
 	}
+	else if ("attachment bytes" == info_display)
+	{
+		return LLPipeline::RENDER_DEBUG_ATTACHMENT_BYTES;
+	}
 	else if ("glow" == info_display)
 	{
 		return LLPipeline::RENDER_DEBUG_GLOW;
@@ -1038,26 +1046,6 @@ class LLAdvancedCheckRandomizeFramerate : public view_listener_t
 	}
 };
 
-void run_vectorize_perf_test(void *)
-{
-	gSavedSettings.setBOOL("VectorizePerfTest", TRUE);
-}
-
-
-////////////////////////////////
-// RUN Vectorized Perform Test//
-////////////////////////////////
-
-
-class LLAdvancedVectorizePerfTest : public view_listener_t
-{
-	bool handleEvent(const LLSD& userdata)
-	{
-		run_vectorize_perf_test(NULL);
-		return true;
-	}
-};
-
 ///////////////////////////
 //// PERIODIC SLOW FRAME //
 ///////////////////////////
@@ -2035,6 +2023,15 @@ class LLAdvancedToggleViewAdminOptions : public view_listener_t
 	}
 };
 
+class LLAdvancedToggleVisualLeakDetector : public view_listener_t
+{
+	bool handleEvent(const LLSD& userdata)
+	{
+		handle_visual_leak_detector_toggle(NULL);
+		return true;
+	}
+};
+
 class LLAdvancedCheckViewAdminOptions : public view_listener_t
 {
 	bool handleEvent(const LLSD& userdata)
@@ -2224,6 +2221,30 @@ class LLAdvancedEnableToggleHackedGodmode : public view_listener_t
 //// Advanced menu
 ////-------------------------------------------------------------------
 
+
+//////////////////
+// DEVELOP MENU //
+//////////////////
+
+class LLDevelopCheckLoggingLevel : public view_listener_t
+{
+	bool handleEvent(const LLSD& userdata)
+	{
+		U32 level = userdata.asInteger();
+		return (static_cast<LLError::ELevel>(level) == LLError::getDefaultLevel());
+	}
+};
+
+class LLDevelopSetLoggingLevel : public view_listener_t
+{
+	bool handleEvent(const LLSD& userdata)
+	{
+		U32 level = userdata.asInteger();
+		LLError::setDefaultLevel(static_cast<LLError::ELevel>(level));
+		return true;
+	}
+};
+
 //////////////////
 // ADMIN MENU   //
 //////////////////
@@ -2783,8 +2804,31 @@ bool enable_object_mute()
 	else
 	{
 		// Just a regular object
-		return LLSelectMgr::getInstance()->getSelection()->
-			contains( object, SELECT_ALL_TES );
+		return LLSelectMgr::getInstance()->getSelection()->contains( object, SELECT_ALL_TES ) &&
+			   !LLMuteList::getInstance()->isMuted(object->getID());
+	}
+}
+
+bool enable_object_unmute()
+{
+	LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+	if (!object) return false;
+
+	LLVOAvatar* avatar = find_avatar_from_object(object); 
+	if (avatar)
+	{
+		// It's an avatar
+		LLNameValue *lastname = avatar->getNVPair("LastName");
+		bool is_linden =
+			lastname && !LLStringUtil::compareStrings(lastname->getString(), "Linden");
+		bool is_self = avatar->isSelf();
+		return !is_linden && !is_self;
+	}
+	else
+	{
+		// Just a regular object
+		return LLSelectMgr::getInstance()->getSelection()->contains( object, SELECT_ALL_TES ) &&
+			   LLMuteList::getInstance()->isMuted(object->getID());;
 	}
 }
 
@@ -3122,7 +3166,7 @@ void handle_avatar_eject(const LLSD& avatar_id)
 
 bool my_profile_visible()
 {
-	LLFloater* floaterp = LLFloaterReg::findInstance("profile", LLSD().with("id", gAgent.getID()));
+	LLFloater* floaterp = LLAvatarActions::getProfileFloater(gAgentID);
 	return floaterp && floaterp->isInVisibleChain();
 }
 
@@ -3414,6 +3458,35 @@ void handle_admin_override_toggle(void*)
 	show_debug_menus();
 }
 
+void handle_visual_leak_detector_toggle(void*)
+{
+	static bool vld_enabled = false;
+
+	if ( vld_enabled )
+	{
+#ifdef INCLUDE_VLD
+		// only works for debug builds (hard coded into vld.h)
+#ifdef _DEBUG
+		// start with Visual Leak Detector turned off
+		VLDDisable();
+#endif // _DEBUG
+#endif // INCLUDE_VLD
+		vld_enabled = false;
+	}
+	else
+	{
+#ifdef INCLUDE_VLD
+		// only works for debug builds (hard coded into vld.h)
+	#ifdef _DEBUG
+		// start with Visual Leak Detector turned off
+		VLDEnable();
+	#endif // _DEBUG
+#endif // INCLUDE_VLD
+
+		vld_enabled = true;
+	};
+}
+
 void handle_god_mode(void*)
 {
 	gAgent.requestEnterGodMode();
@@ -6483,31 +6556,37 @@ class LLToolsSelectedScriptAction : public view_listener_t
 		std::string action = userdata.asString();
 		bool mono = false;
 		std::string msg, name;
+		std::string title;
 		if (action == "compile mono")
 		{
 			name = "compile_queue";
 			mono = true;
 			msg = "Recompile";
+			title = LLTrans::getString("CompileQueueTitle");
 		}
 		if (action == "compile lsl")
 		{
 			name = "compile_queue";
 			msg = "Recompile";
+			title = LLTrans::getString("CompileQueueTitle");
 		}
 		else if (action == "reset")
 		{
 			name = "reset_queue";
 			msg = "Reset";
+			title = LLTrans::getString("ResetQueueTitle");
 		}
 		else if (action == "start")
 		{
 			name = "start_queue";
 			msg = "SetRunning";
+			title = LLTrans::getString("RunQueueTitle");
 		}
 		else if (action == "stop")
 		{
 			name = "stop_queue";
 			msg = "SetRunningNot";
+			title = LLTrans::getString("NotRunQueueTitle");
 		}
 		LLUUID id; id.generate();
 		
@@ -6516,6 +6595,7 @@ class LLToolsSelectedScriptAction : public view_listener_t
 		{
 			queue->setMono(mono);
 			queue_actions(queue, msg);
+			queue->setTitle(title);
 		}
 		else
 		{
@@ -7251,12 +7331,6 @@ class LLToolsUseSelectionForGrid : public view_listener_t
 		} func;
 		LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func);
 		LLSelectMgr::getInstance()->setGridMode(GRID_MODE_REF_OBJECT);
-
-		LLFloaterBuildOptions* build_options_floater = LLFloaterReg::getTypedInstance<LLFloaterBuildOptions>("build_options");
-		if (build_options_floater && build_options_floater->getVisible())
-		{
-			build_options_floater->setGridMode(GRID_MODE_REF_OBJECT);
-		}
 		return true;
 	}
 };
@@ -7701,7 +7775,14 @@ class LLWorldEnvSettings : public view_listener_t
 		}
 		else
 		{
-			LLEnvManagerNew::instance().setUseDayCycle(LLEnvManagerNew::instance().getDayCycleName());
+			LLEnvManagerNew &envmgr = LLEnvManagerNew::instance();
+			// reset all environmental settings to track the region defaults, make this reset 'sticky' like the other sun settings.
+			bool use_fixed_sky = false;
+			bool use_region_settings = true;
+			envmgr.setUserPrefs(envmgr.getWaterPresetName(),
+					    envmgr.getSkyPresetName(),
+					    envmgr.getDayCycleName(),
+					    use_fixed_sky, use_region_settings);
 		}
 
 		return true;
@@ -7803,24 +7884,6 @@ class LLWorldPostProcess : public view_listener_t
 	}
 };
 
-class LLWorldToggleMovementControls : public view_listener_t
-{
-	bool handleEvent(const LLSD& userdata)
-	{
-		LLFloaterReg::toggleInstanceOrBringToFront("moveview");
-		return true;
-	}
-};
-
-class LLWorldToggleCameraControls : public view_listener_t
-{
-	bool handleEvent(const LLSD& userdata)
-	{
-		LLFloaterReg::toggleInstanceOrBringToFront("camera");
-		return true;
-	}
-};
-
 void handle_flush_name_caches()
 {
 	// Toggle display names on and off to flush
@@ -7976,6 +8039,11 @@ void initialize_menus()
 	// Agent
 	commit.add("Agent.toggleFlying", boost::bind(&LLAgent::toggleFlying));
 	enable.add("Agent.enableFlying", boost::bind(&LLAgent::enableFlying));
+	commit.add("Agent.PressMicrophone", boost::bind(&LLAgent::pressMicrophone, _2));
+	commit.add("Agent.ReleaseMicrophone", boost::bind(&LLAgent::releaseMicrophone, _2));
+	commit.add("Agent.ToggleMicrophone", boost::bind(&LLAgent::toggleMicrophone, _2));
+	enable.add("Agent.IsMicrophoneOn", boost::bind(&LLAgent::isMicrophoneOn, _2));
+	enable.add("Agent.IsActionAllowed", boost::bind(&LLAgent::isActionAllowed, _2));
 
 	// File menu
 	init_menu_file();
@@ -8018,7 +8086,6 @@ void initialize_menus()
 	view_listener_t::addMenu(new LLAdvancedAgentFlyingInfo(), "Agent.getFlying");
 	
 	// World menu
-	commit.add("World.Chat", boost::bind(&handle_chat, (void*)NULL));
 	view_listener_t::addMenu(new LLWorldAlwaysRun(), "World.AlwaysRun");
 	view_listener_t::addMenu(new LLWorldCreateLandmark(), "World.CreateLandmark");
 	view_listener_t::addMenu(new LLWorldPlaceProfile(), "World.PlaceProfile");
@@ -8039,9 +8106,6 @@ void initialize_menus()
 	view_listener_t::addMenu(new LLWorldEnableEnvPreset(), "World.EnableEnvPreset");
 	view_listener_t::addMenu(new LLWorldPostProcess(), "World.PostProcess");
 
-	view_listener_t::addMenu(new LLWorldToggleMovementControls(), "World.Toggle.MovementControls");
-	view_listener_t::addMenu(new LLWorldToggleCameraControls(), "World.Toggle.CameraControls");
-
 	// Tools menu
 	view_listener_t::addMenu(new LLToolsSelectTool(), "Tools.SelectTool");
 	view_listener_t::addMenu(new LLToolsSelectOnlyMyObjects(), "Tools.SelectOnlyMyObjects");
@@ -8117,7 +8181,6 @@ void initialize_menus()
 	view_listener_t::addMenu(new LLAdvancedCheckRandomizeFramerate(), "Advanced.CheckRandomizeFramerate");
 	view_listener_t::addMenu(new LLAdvancedTogglePeriodicSlowFrame(), "Advanced.TogglePeriodicSlowFrame");
 	view_listener_t::addMenu(new LLAdvancedCheckPeriodicSlowFrame(), "Advanced.CheckPeriodicSlowFrame");
-	view_listener_t::addMenu(new LLAdvancedVectorizePerfTest(), "Advanced.VectorizePerfTest");
 	view_listener_t::addMenu(new LLAdvancedToggleFrameTest(), "Advanced.ToggleFrameTest");
 	view_listener_t::addMenu(new LLAdvancedCheckFrameTest(), "Advanced.CheckFrameTest");
 	view_listener_t::addMenu(new LLAdvancedHandleAttachedLightParticles(), "Advanced.HandleAttachedLightParticles");
@@ -8224,9 +8287,14 @@ void initialize_menus()
 	view_listener_t::addMenu(new LLAdvancedEnableViewAdminOptions(), "Advanced.EnableViewAdminOptions");
 	view_listener_t::addMenu(new LLAdvancedToggleViewAdminOptions(), "Advanced.ToggleViewAdminOptions");
 	view_listener_t::addMenu(new LLAdvancedCheckViewAdminOptions(), "Advanced.CheckViewAdminOptions");
+	view_listener_t::addMenu(new LLAdvancedToggleVisualLeakDetector(), "Advanced.ToggleVisualLeakDetector");
+
 	view_listener_t::addMenu(new LLAdvancedRequestAdminStatus(), "Advanced.RequestAdminStatus");
 	view_listener_t::addMenu(new LLAdvancedLeaveAdminStatus(), "Advanced.LeaveAdminStatus");
 
+	// Develop >Set logging level
+	view_listener_t::addMenu(new LLDevelopCheckLoggingLevel(), "Develop.CheckLoggingLevel");
+	view_listener_t::addMenu(new LLDevelopSetLoggingLevel(), "Develop.SetLoggingLevel");
 
 	// Admin >Object
 	view_listener_t::addMenu(new LLAdminForceTakeCopy(), "Admin.ForceTakeCopy");
@@ -8313,6 +8381,7 @@ void initialize_menus()
 
 	enable.add("Avatar.EnableMute", boost::bind(&enable_object_mute));
 	enable.add("Object.EnableMute", boost::bind(&enable_object_mute));
+	enable.add("Object.EnableUnmute", boost::bind(&enable_object_unmute));
 	enable.add("Object.EnableBuy", boost::bind(&enable_buy_object));
 	commit.add("Object.ZoomIn", boost::bind(&handle_look_at_selection, "zoom"));
 
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index 7e830e14bf2b0d8ea5d4b9ea10003dc58e334478..dc2ea4bd1f48d98be0cd2655b5c6538b9f2bae0a 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -183,7 +183,7 @@ void LLFilePickerThread::clearDead()
 #if LL_WINDOWS
 static std::string SOUND_EXTENSIONS = "wav";
 static std::string IMAGE_EXTENSIONS = "tga bmp jpg jpeg png";
-static std::string ANIM_EXTENSIONS =  "bvh";
+static std::string ANIM_EXTENSIONS =  "bvh anim";
 #ifdef _CORY_TESTING
 static std::string GEOMETRY_EXTENSIONS = "slg";
 #endif
@@ -385,7 +385,14 @@ class LLFileUploadAnim : public view_listener_t
 		const std::string filename = upload_pick((void*)LLFilePicker::FFLOAD_ANIM);
 		if (!filename.empty())
 		{
-			LLFloaterReg::showInstance("upload_anim", LLSD(filename));
+			if (filename.rfind(".anim") != std::string::npos)
+			{
+				LLFloaterReg::showInstance("upload_anim_anim", LLSD(filename));
+			}
+			else
+			{
+				LLFloaterReg::showInstance("upload_anim_bvh", LLSD(filename));
+			}
 		}
 		return true;
 	}
@@ -527,8 +534,22 @@ class LLFileTakeSnapshotToDisk : public view_listener_t
 									   FALSE))
 		{
 			gViewerWindow->playSnapshotAnimAndSound();
-			
-			LLPointer<LLImageFormatted> formatted = new LLImagePNG;
+			LLPointer<LLImageFormatted> formatted;
+			LLFloaterSnapshot::ESnapshotFormat fmt = (LLFloaterSnapshot::ESnapshotFormat) gSavedSettings.getS32("SnapshotFormat");
+			switch (fmt)
+			{
+			case LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG:
+				formatted = new LLImageJPEG(gSavedSettings.getS32("SnapshotQuality"));
+				break;
+			default:
+				llwarns << "Unknown local snapshot format: " << fmt << llendl;
+			case LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG:
+				formatted = new LLImagePNG;
+				break;
+			case LLFloaterSnapshot::SNAPSHOT_FORMAT_BMP:
+				formatted = new LLImageBMP;
+				break;
+			}
 			formatted->enableOverSize() ;
 			formatted->encode(raw, 0);
 			formatted->disableOverSize() ;
@@ -785,6 +806,11 @@ LLUUID upload_new_resource(
 		upload_error(error_message, "DoNotSupportBulkAnimationUpload", filename, args);
 		return LLUUID();
 	}
+	else if (exten == "anim")
+	{
+		asset_type = LLAssetType::AT_ANIMATION;
+		filename = src_filename;
+	}
 	else
 	{
 		// Unknown extension
@@ -949,11 +975,12 @@ void upload_done_callback(
 			args["REASON"] = std::string(LLAssetStorage::getErrorString(result));
 			LLNotificationsUtil::add("CannotUploadReason", args);
 		}
+
+		delete data;
+		data = NULL;
 	}
 
 	LLUploadDialog::modalUploadFinished();
-	delete data;
-	data = NULL;
 
 	// *NOTE: This is a pretty big hack. What this does is check the
 	// file picker if there are any more pending uploads. If so,
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
old mode 100644
new mode 100755
index dca5cdd06dc44e1b1cb0da3104c9fac101693830..854e2bea5264e3a687a4001595dbd26c4ce00dae
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -135,6 +135,7 @@ extern BOOL gDebugClicks;
 
 // function prototypes
 bool check_offer_throttle(const std::string& from_name, bool check_only);
+bool check_asset_previewable(const LLAssetType::EType asset_type);
 static void process_money_balance_reply_extended(LLMessageSystem* msg);
 
 //inventory offer throttle globals
@@ -155,7 +156,8 @@ const std::string SCRIPT_QUESTIONS[SCRIPT_PERMISSION_EOF] =
 		"AddAndRemoveJoints",
 		"ChangePermissions",
 		"TrackYourCamera",
-		"ControlYourCamera"
+		"ControlYourCamera",
+		"TeleportYourAgent"
 	};
 
 const BOOL SCRIPT_QUESTION_IS_CAUTION[SCRIPT_PERMISSION_EOF] = 
@@ -170,7 +172,8 @@ const BOOL SCRIPT_QUESTION_IS_CAUTION[SCRIPT_PERMISSION_EOF] =
 	FALSE,	// AddAndRemoveJoints
 	FALSE,	// ChangePermissions
 	FALSE,	// TrackYourCamera,
-	FALSE	// ControlYourCamera
+	FALSE,	// ControlYourCamera
+	FALSE	// TeleportYourAgent
 };
 
 bool friendship_offer_callback(const LLSD& notification, const LLSD& response)
@@ -1064,7 +1067,9 @@ class LLDiscardAgentOffer : public LLInventoryFetchItemsObserver
 		// If we now try to remove the inventory item, it will cause a nested
 		// notifyObservers() call, which won't work.
 		// So defer moving the item to trash until viewer gets idle (in a moment).
-		LLAppViewer::instance()->addOnIdleCallback(boost::bind(&LLInventoryModel::removeItem, &gInventory, mObjectID));
+		// Use removeObject() rather than removeItem() because at this level,
+		// the object could be either an item or a folder.
+		LLAppViewer::instance()->addOnIdleCallback(boost::bind(&LLInventoryModel::removeObject, &gInventory, mObjectID));
 		gInventory.removeObserver(this);
 		delete this;
 	}
@@ -1147,7 +1152,18 @@ bool check_offer_throttle(const std::string& from_name, bool check_only)
 		}
 	}
 }
- 
+
+// Return "true" if we have a preview method for that asset type, "false" otherwise
+bool check_asset_previewable(const LLAssetType::EType asset_type)
+{
+	return	(asset_type == LLAssetType::AT_NOTECARD)  || 
+			(asset_type == LLAssetType::AT_LANDMARK)  ||
+			(asset_type == LLAssetType::AT_TEXTURE)   ||
+			(asset_type == LLAssetType::AT_ANIMATION) ||
+			(asset_type == LLAssetType::AT_SCRIPT)    ||
+			(asset_type == LLAssetType::AT_SOUND);
+}
+
 void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_name)
 {
 	for (uuid_vec_t::const_iterator obj_iter = objects.begin();
@@ -1171,7 +1187,7 @@ void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_nam
 
 		// Either an inventory item or a category.
 		const LLInventoryItem* item = dynamic_cast<const LLInventoryItem*>(obj);
-		if (item)
+		if (item && check_asset_previewable(asset_type))
 		{
 			////////////////////////////////////////////////////////////////////////////////
 			// Special handling for various types.
@@ -1246,6 +1262,7 @@ void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_nam
 						LLFloaterReg::showInstance("preview_sound", LLSD(obj_id), take_focus);
 						break;
 					default:
+						LL_DEBUGS("Messaging") << "No preview method for previewable asset type : " << LLAssetType::lookupHumanReadable(asset_type)  << LL_ENDL;
 						break;
 				}
 			}
@@ -2235,6 +2252,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 	{
         name = LLTrans::getString("Unnamed");
 	}
+
+	// Preserve the unaltered name for use in group notice mute checking.
+	std::string original_name = name;
+
 	// IDEVO convert new-style "Resident" names for display
 	name = clean_name_from_im(name, dialog);
 
@@ -2356,8 +2377,15 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL;
 
 			bool mute_im = is_muted;
-			if(accept_im_from_only_friend&&!is_friend)
+			if (accept_im_from_only_friend && !is_friend)
 			{
+				if (!gIMMgr->isNonFriendSessionNotified(session_id))
+				{
+					std::string message = LLTrans::getString("IM_unblock_only_groups_friends");
+					gIMMgr->addMessage(session_id, from_id, name, message);
+					gIMMgr->addNotifiedNonFriendSessionID(session_id);
+				}
+
 				mute_im = true;
 			}
 			if (!mute_im || is_linden) 
@@ -2441,6 +2469,26 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 				break;
 			}
 
+			// The group notice packet does not have an AgentID.  Obtain one from the name cache.
+			// If last name is "Resident" strip it out so the cache name lookup works.
+			U32 index = original_name.find(" Resident");
+			if (index != std::string::npos)
+			{
+				original_name = original_name.substr(0, index);
+			}
+			std::string legacy_name = gCacheName->buildLegacyName(original_name);
+			LLUUID agent_id;
+			gCacheName->getUUID(legacy_name, agent_id);
+
+			if (agent_id.isNull())
+			{
+				LL_WARNS("Messaging") << "buildLegacyName returned null while processing " << original_name << LL_ENDL;
+			}
+			else if (LLMuteList::getInstance()->isMuted(agent_id))
+			{
+				break;
+			}
+
 			notice_bin_bucket = (struct notice_bucket_full_t*) &binary_bucket[0];
 			U8 has_inventory = notice_bin_bucket->header.has_inventory;
 			U8 asset_type = notice_bin_bucket->header.asset_type;
@@ -3638,6 +3686,9 @@ void process_teleport_finish(LLMessageSystem* msg, void**)
 	gCacheName->setUpstream(sim);
 */
 
+	// Make sure we're standing
+	gAgent.standUp();
+
 	// now, use the circuit info to tell simulator about us!
 	LL_INFOS("Messaging") << "process_teleport_finish() Enabling "
 			<< sim_host << " with code " << msg->mOurCircuitCode << LL_ENDL;
@@ -5203,6 +5254,7 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg)
 	BOOL is_dest_group = FALSE;
     S32 amount = 0;
     std::string item_description;
+	BOOL success = FALSE;
 
     msg->getS32("TransactionInfo", "TransactionType", transaction_type);
     msg->getUUID("TransactionInfo", "SourceID", source_id);
@@ -5211,6 +5263,7 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg)
 	msg->getBOOL("TransactionInfo", "IsDestGroup", is_dest_group);
     msg->getS32("TransactionInfo", "Amount", amount);
     msg->getString("TransactionInfo", "ItemDescription", item_description);
+	msg->getBOOL("MoneyData", "TransactionSuccess", success);
     LL_INFOS("Money") << "MoneyBalanceReply source " << source_id 
 		<< " dest " << dest_id
 		<< " type " << transaction_type
@@ -5272,28 +5325,32 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg)
 		{
 			if (dest_id.notNull())
 			{
-				message = LLTrans::getString("you_paid_ldollars", args);
+				message = success ? LLTrans::getString("you_paid_ldollars", args) :
+									LLTrans::getString("you_paid_failure_ldollars", args);
 			}
 			else
 			{
 				// transaction fee to the system, eg, to create a group
-				message = LLTrans::getString("you_paid_ldollars_no_name", args);
+				message = success ? LLTrans::getString("you_paid_ldollars_no_name", args) :
+									LLTrans::getString("you_paid_failure_ldollars_no_name", args);
 			}
 		}
 		else
 		{
 			if (dest_id.notNull())
 			{
-				message = LLTrans::getString("you_paid_ldollars_no_reason", args);
+				message = success ? LLTrans::getString("you_paid_ldollars_no_reason", args) :
+									LLTrans::getString("you_paid_failure_ldollars_no_reason", args);
 			}
 			else
 			{
 				// no target, no reason, you just paid money
-				message = LLTrans::getString("you_paid_ldollars_no_info", args);
+				message = success ? LLTrans::getString("you_paid_ldollars_no_info", args) :
+									LLTrans::getString("you_paid_failure_ldollars_no_info", args);
 			}
 		}
 		final_args["MESSAGE"] = message;
-		notification = "PaymentSent";
+		notification = success ? "PaymentSent" : "PaymentFailure";
 	}
 	else {
 		// ...someone paid you
@@ -5783,6 +5840,16 @@ bool script_question_cb(const LLSD& notification, const LLSD& response)
 	S32 orig = notification["payload"]["questions"].asInteger();
 	S32 new_questions = orig;
 
+	if (response["Details"])
+	{
+		// respawn notification...
+		LLNotificationsUtil::add(notification["name"], notification["substitutions"], notification["payload"]);
+
+		// ...with description on top
+		LLNotificationsUtil::add("DebitPermissionDetails");
+		return false;
+	}
+
 	// check whether permissions were granted or denied
 	BOOL allowed = TRUE;
 	// the "yes/accept" button is the first button in the template, making it button 0
@@ -5840,14 +5907,6 @@ bool script_question_cb(const LLSD& notification, const LLSD& response)
 				gSavedSettings.getString("NotificationChannelUUID")), OfferMatcher(item_id));
 	}
 
-	if (response["Details"])
-	{
-		// respawn notification...
-		LLNotificationsUtil::add(notification["name"], notification["substitutions"], notification["payload"]);
-
-		// ...with description on top
-		LLNotificationsUtil::add("DebitPermissionDetails");
-	}
 	return false;
 }
 static LLNotificationFunctorRegistration script_question_cb_reg_1("ScriptQuestion", script_question_cb);
@@ -6790,12 +6849,14 @@ void process_covenant_reply(LLMessageSystem* msg, void**)
 
 	LLPanelEstateCovenant::updateEstateName(estate_name);
 	LLPanelLandCovenant::updateEstateName(estate_name);
+	LLPanelEstateInfo::updateEstateName(estate_name);
 	LLFloaterBuyLand::updateEstateName(estate_name);
 
 	std::string owner_name =
 		LLSLURL("agent", estate_owner_id, "inspect").getSLURLString();
 	LLPanelEstateCovenant::updateEstateOwnerName(owner_name);
 	LLPanelLandCovenant::updateEstateOwnerName(owner_name);
+	LLPanelEstateInfo::updateEstateOwnerName(owner_name);
 	LLFloaterBuyLand::updateEstateOwnerName(owner_name);
 
 	LLPanelPlaceProfile* panel = LLFloaterSidePanelContainer::getPanel<LLPanelPlaceProfile>("places", "panel_place_profile");
diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h
index d8acd99953844cb18ead8aca25b722a99e6ed67e..46bfb2dad06f614dd4c609e298392794e928404c 100644
--- a/indra/newview/llviewermessage.h
+++ b/indra/newview/llviewermessage.h
@@ -35,6 +35,7 @@
 #include "message.h"
 #include "stdenums.h"
 #include "llnotifications.h"
+#include "llextendedstatus.h"
 
 //
 // Forward declarations
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
old mode 100755
new mode 100644
index d81e67bfe24c5759e40aca409b94eda7e9b099d1..cd300accb7f74070ea0f940d7d7d459912393d25
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -143,7 +143,10 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco
 			}
 			else 
 			{
-				gAgentAvatarp->updateRegion(regionp);
+				if (isAgentAvatarValid())
+				{
+					gAgentAvatarp->updateRegion(regionp);
+				}
 			}
 			res = gAgentAvatarp;
 		}
@@ -874,6 +877,13 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
 	LLMemType mt(LLMemType::MTYPE_OBJECT);
 	U32 retval = 0x0;
 	
+	// If region is removed from the list it is also deleted.
+	if (!LLWorld::instance().isRegionListed(mRegionp))
+	{
+		llwarns << "Updating object in an invalid region" << llendl;
+		return retval;
+	}
+
 	// Coordinates of objects on simulators are region-local.
 	U64 region_handle;
 	mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle);
@@ -3219,12 +3229,12 @@ F32 LLViewerObject::getLinksetPhysicsCost()
 	return mLinksetPhysicsCost;
 }
 
-F32 LLViewerObject::getStreamingCost(S32* bytes, S32* visible_bytes)
+F32 LLViewerObject::getStreamingCost(S32* bytes, S32* visible_bytes, F32* unscaled_value) const
 {
 	return 0.f;
 }
 
-U32 LLViewerObject::getTriangleCount()
+U32 LLViewerObject::getTriangleCount(S32* vcount) const
 {
 	return 0;
 }
@@ -3475,7 +3485,8 @@ LLNameValue *LLViewerObject::getNVPair(const std::string& name) const
 
 void LLViewerObject::updatePositionCaches() const
 {
-	if(mRegionp)
+	// If region is removed from the list it is also deleted.
+	if(mRegionp && LLWorld::instance().isRegionListed(mRegionp))
 	{
 		if (!isRoot())
 		{
@@ -3492,7 +3503,8 @@ void LLViewerObject::updatePositionCaches() const
 
 const LLVector3d LLViewerObject::getPositionGlobal() const
 {	
-	if(mRegionp)
+	// If region is removed from the list it is also deleted.
+	if(mRegionp && LLWorld::instance().isRegionListed(mRegionp))
 	{
 		LLVector3d position_global = mRegionp->getPosGlobalFromRegion(getPositionRegion());
 
@@ -3511,7 +3523,8 @@ const LLVector3d LLViewerObject::getPositionGlobal() const
 
 const LLVector3 &LLViewerObject::getPositionAgent() const
 {
-	if (mRegionp)
+	// If region is removed from the list it is also deleted.
+	if(mRegionp && LLWorld::instance().isRegionListed(mRegionp))
 	{
 		if (mDrawable.notNull() && (!mDrawable->isRoot() && getParent()))
 		{
@@ -5520,11 +5533,12 @@ void LLViewerObject::dirtyMesh()
 {
 	if (mDrawable)
 	{
-		LLSpatialGroup* group = mDrawable->getSpatialGroup();
+		gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
+		/*LLSpatialGroup* group = mDrawable->getSpatialGroup();
 		if (group)
 		{
 			group->dirtyMesh();
-		}
+		}*/
 	}
 }
 
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index 53e951e483f0fa05a90bc7cce55b67ad1d947ac7..c8152e1539db7e447b8c5664e7d2f349802f733d 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -1,4 +1,4 @@
-/** 
+/**
  * @file llviewerobject.h
  * @brief Description of LLViewerObject class, which is the base class for most objects in the viewer.
  *
@@ -340,8 +340,8 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate
 	
 	virtual void setScale(const LLVector3 &scale, BOOL damped = FALSE);
 
-	virtual F32 getStreamingCost(S32* bytes = NULL, S32* visible_bytes = NULL);
-	virtual U32 getTriangleCount();
+	virtual F32 getStreamingCost(S32* bytes = NULL, S32* visible_bytes = NULL, F32* unscaled_value = NULL) const;
+	virtual U32 getTriangleCount(S32* vcount = NULL) const;
 	virtual U32 getHighLODTriangleCount();
 
 	void setObjectCost(F32 cost);
@@ -811,7 +811,7 @@ class LLAlphaObject : public LLViewerObject
 
 	virtual F32 getPartSize(S32 idx);
 	virtual void getGeometry(S32 idx,
-								LLStrider<LLVector3>& verticesp,
+								LLStrider<LLVector4a>& verticesp,
 								LLStrider<LLVector3>& normalsp, 
 								LLStrider<LLVector2>& texcoordsp,
 								LLStrider<LLColor4U>& colorsp, 
diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index d6002e7320fa9335e7c83cbfceff4d7b5b0dfd4f..9db784101d9c3dd8e0aabd8fb927d8f435a0418d 100644
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -67,6 +67,7 @@
 #include "llworld.h"
 #include "roles_constants.h"
 #include "llweb.h"
+#include "llvieweraudio.h"
 
 const F32 PARCEL_COLLISION_DRAW_SECS = 1.f;
 
@@ -1457,6 +1458,8 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 
 	S32		other_clean_time = 0;
 
+	LLViewerParcelMgr& parcel_mgr = LLViewerParcelMgr::instance();
+
 	msg->getS32Fast(_PREHASH_ParcelData, _PREHASH_RequestResult, request_result );
 	msg->getS32Fast(_PREHASH_ParcelData, _PREHASH_SequenceID, sequence_id );
 
@@ -1472,31 +1475,31 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 	if (sequence_id == SELECTED_PARCEL_SEQ_ID)
 	{
 		// ...selected parcels report this sequence id
-		LLViewerParcelMgr::getInstance()->mRequestResult = PARCEL_RESULT_SUCCESS;
-		parcel = LLViewerParcelMgr::getInstance()->mCurrentParcel;
+		parcel_mgr.mRequestResult = PARCEL_RESULT_SUCCESS;
+		parcel = parcel_mgr.mCurrentParcel;
 	}
 	else if (sequence_id == HOVERED_PARCEL_SEQ_ID)
 	{
-		LLViewerParcelMgr::getInstance()->mHoverRequestResult = PARCEL_RESULT_SUCCESS;
-		parcel = LLViewerParcelMgr::getInstance()->mHoverParcel;
+		parcel_mgr.mHoverRequestResult = PARCEL_RESULT_SUCCESS;
+		parcel = parcel_mgr.mHoverParcel;
 	}
 	else if (sequence_id == COLLISION_NOT_IN_GROUP_PARCEL_SEQ_ID ||
 			 sequence_id == COLLISION_NOT_ON_LIST_PARCEL_SEQ_ID ||
 			 sequence_id == COLLISION_BANNED_PARCEL_SEQ_ID)
 	{
-		LLViewerParcelMgr::getInstance()->mHoverRequestResult = PARCEL_RESULT_SUCCESS;
-		parcel = LLViewerParcelMgr::getInstance()->mCollisionParcel;
+		parcel_mgr.mHoverRequestResult = PARCEL_RESULT_SUCCESS;
+		parcel = parcel_mgr.mCollisionParcel;
 	}
-	else if (sequence_id == 0 || sequence_id > LLViewerParcelMgr::getInstance()->mAgentParcelSequenceID)
+	else if (sequence_id == 0 || sequence_id > parcel_mgr.mAgentParcelSequenceID)
 	{
 		// new agent parcel
-		LLViewerParcelMgr::getInstance()->mAgentParcelSequenceID = sequence_id;
-		parcel = LLViewerParcelMgr::getInstance()->mAgentParcel;
+		parcel_mgr.mAgentParcelSequenceID = sequence_id;
+		parcel = parcel_mgr.mAgentParcel;
 	}
 	else
 	{
 		llinfos << "out of order agent parcel sequence id " << sequence_id
-			<< " last good " << LLViewerParcelMgr::getInstance()->mAgentParcelSequenceID
+			<< " last good " << parcel_mgr.mAgentParcelSequenceID
 			<< llendl;
 		return;
 	}
@@ -1567,15 +1570,15 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 		parcel->setRegionDenyAgeUnverifiedOverride(region_deny_age_unverified_override);
 		parcel->unpackMessage(msg);
 
-		if (parcel == LLViewerParcelMgr::getInstance()->mAgentParcel)
+		if (parcel == parcel_mgr.mAgentParcel)
 		{
-			S32 bitmap_size =	LLViewerParcelMgr::getInstance()->mParcelsPerEdge
-								* LLViewerParcelMgr::getInstance()->mParcelsPerEdge
+			S32 bitmap_size =	parcel_mgr.mParcelsPerEdge
+								* parcel_mgr.mParcelsPerEdge
 								/ 8;
 			U8* bitmap = new U8[ bitmap_size ];
 			msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, bitmap, bitmap_size);
 
-			LLViewerParcelMgr::getInstance()->writeAgentParcelFromBitmap(bitmap);
+			parcel_mgr.writeAgentParcelFromBitmap(bitmap);
 			delete[] bitmap;
 
 			// Let interesting parties know about agent parcel change.
@@ -1595,11 +1598,11 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 	if (sequence_id == SELECTED_PARCEL_SEQ_ID)
 	{
 		// Update selected counts
-		LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mSelectedSelfCount = self_count;
-		LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mSelectedOtherCount = other_count;
-		LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mSelectedPublicCount = public_count;
+		parcel_mgr.mCurrentParcelSelection->mSelectedSelfCount = self_count;
+		parcel_mgr.mCurrentParcelSelection->mSelectedOtherCount = other_count;
+		parcel_mgr.mCurrentParcelSelection->mSelectedPublicCount = public_count;
 
-		LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mSelectedMultipleOwners =
+		parcel_mgr.mCurrentParcelSelection->mSelectedMultipleOwners =
 							(request_result == PARCEL_RESULT_MULTIPLE);
 
 		// Select the whole parcel
@@ -1610,67 +1613,67 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 			{
 				// don't muck with the westsouth and eastnorth.
 				// just highlight it
-				LLVector3 west_south = region->getPosRegionFromGlobal(LLViewerParcelMgr::getInstance()->mWestSouth);
-				LLVector3 east_north = region->getPosRegionFromGlobal(LLViewerParcelMgr::getInstance()->mEastNorth);
+				LLVector3 west_south = region->getPosRegionFromGlobal(parcel_mgr.mWestSouth);
+				LLVector3 east_north = region->getPosRegionFromGlobal(parcel_mgr.mEastNorth);
 
-				LLViewerParcelMgr::getInstance()->resetSegments(LLViewerParcelMgr::getInstance()->mHighlightSegments);
-				LLViewerParcelMgr::getInstance()->writeHighlightSegments(
+				parcel_mgr.resetSegments(parcel_mgr.mHighlightSegments);
+				parcel_mgr.writeHighlightSegments(
 								west_south.mV[VX],
 								west_south.mV[VY],
 								east_north.mV[VX],
 								east_north.mV[VY] );
-				LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mWholeParcelSelected = FALSE;
+				parcel_mgr.mCurrentParcelSelection->mWholeParcelSelected = FALSE;
 			}
 			else if (0 == local_id)
 			{
 				// this is public land, just highlight the selection
-				LLViewerParcelMgr::getInstance()->mWestSouth = region->getPosGlobalFromRegion( aabb_min );
-				LLViewerParcelMgr::getInstance()->mEastNorth = region->getPosGlobalFromRegion( aabb_max );
+				parcel_mgr.mWestSouth = region->getPosGlobalFromRegion( aabb_min );
+				parcel_mgr.mEastNorth = region->getPosGlobalFromRegion( aabb_max );
 
-				LLViewerParcelMgr::getInstance()->resetSegments(LLViewerParcelMgr::getInstance()->mHighlightSegments);
-				LLViewerParcelMgr::getInstance()->writeHighlightSegments(
+				parcel_mgr.resetSegments(parcel_mgr.mHighlightSegments);
+				parcel_mgr.writeHighlightSegments(
 								aabb_min.mV[VX],
 								aabb_min.mV[VY],
 								aabb_max.mV[VX],
 								aabb_max.mV[VY] );
-				LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mWholeParcelSelected = TRUE;
+				parcel_mgr.mCurrentParcelSelection->mWholeParcelSelected = TRUE;
 			}
 			else
 			{
-				LLViewerParcelMgr::getInstance()->mWestSouth = region->getPosGlobalFromRegion( aabb_min );
-				LLViewerParcelMgr::getInstance()->mEastNorth = region->getPosGlobalFromRegion( aabb_max );
+				parcel_mgr.mWestSouth = region->getPosGlobalFromRegion( aabb_min );
+				parcel_mgr.mEastNorth = region->getPosGlobalFromRegion( aabb_max );
 
 				// Owned land, highlight the boundaries
-				S32 bitmap_size =	LLViewerParcelMgr::getInstance()->mParcelsPerEdge
-									* LLViewerParcelMgr::getInstance()->mParcelsPerEdge
+				S32 bitmap_size =	parcel_mgr.mParcelsPerEdge
+									* parcel_mgr.mParcelsPerEdge
 									/ 8;
 				U8* bitmap = new U8[ bitmap_size ];
 				msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, bitmap, bitmap_size);
 
-				LLViewerParcelMgr::getInstance()->resetSegments(LLViewerParcelMgr::getInstance()->mHighlightSegments);
-				LLViewerParcelMgr::getInstance()->writeSegmentsFromBitmap( bitmap, LLViewerParcelMgr::getInstance()->mHighlightSegments );
+				parcel_mgr.resetSegments(parcel_mgr.mHighlightSegments);
+				parcel_mgr.writeSegmentsFromBitmap( bitmap, parcel_mgr.mHighlightSegments );
 
 				delete[] bitmap;
 				bitmap = NULL;
 
-				LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mWholeParcelSelected = TRUE;
+				parcel_mgr.mCurrentParcelSelection->mWholeParcelSelected = TRUE;
 			}
 
 			// Request access list information for this land
-			LLViewerParcelMgr::getInstance()->sendParcelAccessListRequest(AL_ACCESS | AL_BAN);
+			parcel_mgr.sendParcelAccessListRequest(AL_ACCESS | AL_BAN);
 
 			// Request the media url filter list for this land
-			LLViewerParcelMgr::getInstance()->requestParcelMediaURLFilter();
+			parcel_mgr.requestParcelMediaURLFilter();
 
 			// Request dwell for this land, if it's not public land.
-			LLViewerParcelMgr::getInstance()->mSelectedDwell = DWELL_NAN;
+			parcel_mgr.mSelectedDwell = DWELL_NAN;
 			if (0 != local_id)
 			{
-				LLViewerParcelMgr::getInstance()->sendParcelDwellRequest();
+				parcel_mgr.sendParcelDwellRequest();
 			}
 
-			LLViewerParcelMgr::getInstance()->mSelected = TRUE;
-			LLViewerParcelMgr::getInstance()->notifyObservers();
+			parcel_mgr.mSelected = TRUE;
+			parcel_mgr.notifyObservers();
 		}
 	}
 	else if (sequence_id == COLLISION_NOT_IN_GROUP_PARCEL_SEQ_ID ||
@@ -1678,32 +1681,32 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 			 sequence_id == COLLISION_BANNED_PARCEL_SEQ_ID)
 	{
 		// We're about to collide with this parcel
-		LLViewerParcelMgr::getInstance()->mRenderCollision = TRUE;
-		LLViewerParcelMgr::getInstance()->mCollisionTimer.reset();
+		parcel_mgr.mRenderCollision = TRUE;
+		parcel_mgr.mCollisionTimer.reset();
 
 		// Differentiate this parcel if we are banned from it.
 		if (sequence_id == COLLISION_BANNED_PARCEL_SEQ_ID)
 		{
-			LLViewerParcelMgr::getInstance()->mCollisionBanned = BA_BANNED;
+			parcel_mgr.mCollisionBanned = BA_BANNED;
 		}
 		else if (sequence_id == COLLISION_NOT_IN_GROUP_PARCEL_SEQ_ID)
 		{
-			LLViewerParcelMgr::getInstance()->mCollisionBanned = BA_NOT_IN_GROUP;
+			parcel_mgr.mCollisionBanned = BA_NOT_IN_GROUP;
 		}
 		else 
 		{
-			LLViewerParcelMgr::getInstance()->mCollisionBanned = BA_NOT_ON_LIST;
+			parcel_mgr.mCollisionBanned = BA_NOT_ON_LIST;
 
 		}
 
-		S32 bitmap_size =	LLViewerParcelMgr::getInstance()->mParcelsPerEdge
-							* LLViewerParcelMgr::getInstance()->mParcelsPerEdge
+		S32 bitmap_size =	parcel_mgr.mParcelsPerEdge
+							* parcel_mgr.mParcelsPerEdge
 							/ 8;
 		U8* bitmap = new U8[ bitmap_size ];
 		msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, bitmap, bitmap_size);
 
-		LLViewerParcelMgr::getInstance()->resetSegments(LLViewerParcelMgr::getInstance()->mCollisionSegments);
-		LLViewerParcelMgr::getInstance()->writeSegmentsFromBitmap( bitmap, LLViewerParcelMgr::getInstance()->mCollisionSegments );
+		parcel_mgr.resetSegments(parcel_mgr.mCollisionSegments);
+		parcel_mgr.writeSegmentsFromBitmap( bitmap, parcel_mgr.mCollisionSegments );
 
 		delete[] bitmap;
 		bitmap = NULL;
@@ -1714,18 +1717,21 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 		LLViewerRegion *region = LLWorld::getInstance()->getRegion( msg->getSender() );
 		if (region)
 		{
-			LLViewerParcelMgr::getInstance()->mHoverWestSouth = region->getPosGlobalFromRegion( aabb_min );
-			LLViewerParcelMgr::getInstance()->mHoverEastNorth = region->getPosGlobalFromRegion( aabb_max );
+			parcel_mgr.mHoverWestSouth = region->getPosGlobalFromRegion( aabb_min );
+			parcel_mgr.mHoverEastNorth = region->getPosGlobalFromRegion( aabb_max );
 		}
 		else
 		{
-			LLViewerParcelMgr::getInstance()->mHoverWestSouth.clearVec();
-			LLViewerParcelMgr::getInstance()->mHoverEastNorth.clearVec();
+			parcel_mgr.mHoverWestSouth.clearVec();
+			parcel_mgr.mHoverEastNorth.clearVec();
 		}
 	}
 	else
 	{
-		// look for music.
+		// Check for video
+		LLViewerParcelMedia::update(parcel);
+
+		// Then check for music
 		if (gAudiop)
 		{
 			if (parcel)
@@ -1736,46 +1742,34 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 				std::string music_url = music_url_raw;
 				LLStringUtil::trim(music_url);
 
-				// On entering a new parcel, stop the last stream if the
-				// new parcel has a different music url.  (Empty URL counts
-				// as different.)
-				const std::string& stream_url = gAudiop->getInternetStreamURL();
-
-				if (music_url.empty() || music_url != stream_url)
+				// If there is a new music URL and it's valid, play it.
+				if (music_url.size() > 12)
 				{
-					// URL is different from one currently playing.
-					gAudiop->stopInternetStream();
-
-					// If there is a new music URL and it's valid, play it.
-					if (music_url.size() > 12)
+					if (music_url.substr(0,7) == "http://")
 					{
-						if (music_url.substr(0,7) == "http://")
-						{
-							optionally_start_music(music_url);
-						}
-						else
-						{
-							llinfos << "Stopping parcel music (invalid audio stream URL)" << llendl;
-							// clears the URL 
-							gAudiop->startInternetStream(LLStringUtil::null); 
-						}
+						optionally_start_music(music_url);
 					}
-					else if (!gAudiop->getInternetStreamURL().empty())
+					else
 					{
-						llinfos << "Stopping parcel music (parcel stream URL is empty)" << llendl;
-						gAudiop->startInternetStream(LLStringUtil::null);
+						llinfos << "Stopping parcel music (invalid audio stream URL)" << llendl;
+						// clears the URL 
+						// null value causes fade out
+						LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
 					}
 				}
+				else if (!gAudiop->getInternetStreamURL().empty())
+				{
+					llinfos << "Stopping parcel music (parcel stream URL is empty)" << llendl;
+					// null value causes fade out
+					LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
+				}
 			}
 			else
 			{
 				// Public land has no music
-				gAudiop->stopInternetStream();
+				LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade();
 			}
 		}//if gAudiop
-
-		// now check for video
-		LLViewerParcelMedia::update( parcel );
 	};
 }
 
@@ -1794,7 +1788,11 @@ void optionally_start_music(const std::string& music_url)
 			 gSavedSettings.getBOOL("MediaTentativeAutoPlay")))
 		{
 			llinfos << "Starting parcel music " << music_url << llendl;
-			gAudiop->startInternetStream(music_url);
+			LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(music_url);
+		}
+		else
+		{
+			LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
 		}
 	}
 }
diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp
index e619b89f9b98216ff956fd57b2b03222a83cd545..a0cf2fc803634023f0a9f33dc989a8fa9195b210 100644
--- a/indra/newview/llviewerparceloverlay.cpp
+++ b/indra/newview/llviewerparceloverlay.cpp
@@ -884,14 +884,14 @@ S32 LLViewerParcelOverlay::renderPropertyLines	()
 	// Always fudge a little vertically.
 	pull_toward_camera.mV[VZ] += 0.01f;
 
-	glMatrixMode( GL_MODELVIEW );
-	glPushMatrix();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
+	gGL.pushMatrix();
 
 	// Move to appropriate region coords
 	LLVector3 origin = mRegion->getOriginAgent();
-	glTranslatef( origin.mV[VX], origin.mV[VY], origin.mV[VZ] );
+	gGL.translatef( origin.mV[VX], origin.mV[VY], origin.mV[VZ] );
 
-	glTranslatef(pull_toward_camera.mV[VX], pull_toward_camera.mV[VY],
+	gGL.translatef(pull_toward_camera.mV[VX], pull_toward_camera.mV[VY],
 		pull_toward_camera.mV[VZ]);
 
 	// Include +1 because vertices are fenceposts.
@@ -990,7 +990,7 @@ S32 LLViewerParcelOverlay::renderPropertyLines	()
 		
 	}
 
-	glPopMatrix();
+	gGL.popMatrix();
 
 	return drawn;
 }
diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h
index 12f6a0dd1c663cf2079a469a7733ea4c903dd1bd..f738b84bb9a140c058b313891be86b9a17fe55a5 100644
--- a/indra/newview/llviewerprecompiledheaders.h
+++ b/indra/newview/llviewerprecompiledheaders.h
@@ -124,4 +124,7 @@
 // Library includes from llmessage project
 #include "llcachename.h"
 
+// Library includes from llxuixml
+#include "llinitparam.h"
+
 #endif
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index ed943964f9ae61df12cbe58424b05a6c7b5632e1..e3cb985ddb3a35bab24412d0d2a6f5d20f9613b0 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -1493,6 +1493,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
 	capabilityNames.append("AvatarPickerSearch");
 	capabilityNames.append("ChatSessionRequest");
 	capabilityNames.append("CopyInventoryFromNotecard");
+	capabilityNames.append("CreateInventoryCategory");
 	capabilityNames.append("DispatchRegionInfo");
 	capabilityNames.append("EstateChangeInfo");
 	capabilityNames.append("EventQueueGet");
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 36106752a260338bcfc3c651cd161465152f7279..10c61c01d5c17e671dd318c7a5fb7b7fc1dcca56 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -32,6 +32,7 @@
 
 #include "llfile.h"
 #include "llviewerwindow.h"
+#include "llwindow.h"
 #include "llviewercontrol.h"
 #include "pipeline.h"
 #include "llworld.h"
@@ -58,6 +59,7 @@ using std::make_pair;
 using std::string;
 
 BOOL				LLViewerShaderMgr::sInitialized = FALSE;
+bool				LLViewerShaderMgr::sSkipReload = false;
 
 LLVector4			gShinyOrigin;
 
@@ -65,15 +67,23 @@ LLVector4			gShinyOrigin;
 LLGLSLShader	gOcclusionProgram;
 LLGLSLShader	gCustomAlphaProgram;
 LLGLSLShader	gGlowCombineProgram;
+LLGLSLShader	gSplatTextureRectProgram;
+LLGLSLShader	gGlowCombineFXAAProgram;
 LLGLSLShader	gTwoTextureAddProgram;
+LLGLSLShader	gOneTextureNoColorProgram;
+LLGLSLShader	gDebugProgram;
+LLGLSLShader	gAlphaMaskProgram;
 
 //object shaders
 LLGLSLShader		gObjectSimpleProgram;
+LLGLSLShader		gObjectPreviewProgram;
 LLGLSLShader		gObjectSimpleWaterProgram;
 LLGLSLShader		gObjectSimpleAlphaMaskProgram;
 LLGLSLShader		gObjectSimpleWaterAlphaMaskProgram;
 LLGLSLShader		gObjectFullbrightProgram;
 LLGLSLShader		gObjectFullbrightWaterProgram;
+LLGLSLShader		gObjectEmissiveProgram;
+LLGLSLShader		gObjectEmissiveWaterProgram;
 LLGLSLShader		gObjectFullbrightAlphaMaskProgram;
 LLGLSLShader		gObjectFullbrightWaterAlphaMaskProgram;
 LLGLSLShader		gObjectFullbrightShinyProgram;
@@ -81,13 +91,23 @@ LLGLSLShader		gObjectFullbrightShinyWaterProgram;
 LLGLSLShader		gObjectShinyProgram;
 LLGLSLShader		gObjectShinyWaterProgram;
 LLGLSLShader		gObjectBumpProgram;
+LLGLSLShader		gTreeProgram;
+LLGLSLShader		gTreeWaterProgram;
+LLGLSLShader		gObjectFullbrightNoColorProgram;
+LLGLSLShader		gObjectFullbrightNoColorWaterProgram;
 
 LLGLSLShader		gObjectSimpleNonIndexedProgram;
+LLGLSLShader		gObjectSimpleNonIndexedTexGenProgram;
+LLGLSLShader		gObjectSimpleNonIndexedTexGenWaterProgram;
 LLGLSLShader		gObjectSimpleNonIndexedWaterProgram;
 LLGLSLShader		gObjectAlphaMaskNonIndexedProgram;
 LLGLSLShader		gObjectAlphaMaskNonIndexedWaterProgram;
+LLGLSLShader		gObjectAlphaMaskNoColorProgram;
+LLGLSLShader		gObjectAlphaMaskNoColorWaterProgram;
 LLGLSLShader		gObjectFullbrightNonIndexedProgram;
 LLGLSLShader		gObjectFullbrightNonIndexedWaterProgram;
+LLGLSLShader		gObjectEmissiveNonIndexedProgram;
+LLGLSLShader		gObjectEmissiveNonIndexedWaterProgram;
 LLGLSLShader		gObjectFullbrightShinyNonIndexedProgram;
 LLGLSLShader		gObjectFullbrightShinyNonIndexedWaterProgram;
 LLGLSLShader		gObjectShinyNonIndexedProgram;
@@ -96,11 +116,13 @@ LLGLSLShader		gObjectShinyNonIndexedWaterProgram;
 //object hardware skinning shaders
 LLGLSLShader		gSkinnedObjectSimpleProgram;
 LLGLSLShader		gSkinnedObjectFullbrightProgram;
+LLGLSLShader		gSkinnedObjectEmissiveProgram;
 LLGLSLShader		gSkinnedObjectFullbrightShinyProgram;
 LLGLSLShader		gSkinnedObjectShinySimpleProgram;
 
 LLGLSLShader		gSkinnedObjectSimpleWaterProgram;
 LLGLSLShader		gSkinnedObjectFullbrightWaterProgram;
+LLGLSLShader		gSkinnedObjectEmissiveWaterProgram;
 LLGLSLShader		gSkinnedObjectFullbrightShinyWaterProgram;
 LLGLSLShader		gSkinnedObjectShinySimpleWaterProgram;
 
@@ -124,6 +146,7 @@ LLGLSLShader		gImpostorProgram;
 LLGLSLShader			gWLSkyProgram;
 LLGLSLShader			gWLCloudProgram;
 
+
 // Effects Shaders
 LLGLSLShader			gGlowProgram;
 LLGLSLShader			gGlowExtractProgram;
@@ -132,18 +155,19 @@ LLGLSLShader			gPostNightVisionProgram;
 
 // Deferred rendering shaders
 LLGLSLShader			gDeferredImpostorProgram;
-LLGLSLShader			gDeferredEdgeProgram;
 LLGLSLShader			gDeferredWaterProgram;
 LLGLSLShader			gDeferredDiffuseProgram;
 LLGLSLShader			gDeferredDiffuseAlphaMaskProgram;
 LLGLSLShader			gDeferredNonIndexedDiffuseProgram;
 LLGLSLShader			gDeferredNonIndexedDiffuseAlphaMaskProgram;
+LLGLSLShader			gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram;
 LLGLSLShader			gDeferredSkinnedDiffuseProgram;
 LLGLSLShader			gDeferredSkinnedBumpProgram;
 LLGLSLShader			gDeferredSkinnedAlphaProgram;
 LLGLSLShader			gDeferredBumpProgram;
 LLGLSLShader			gDeferredTerrainProgram;
 LLGLSLShader			gDeferredTreeProgram;
+LLGLSLShader			gDeferredTreeShadowProgram;
 LLGLSLShader			gDeferredAvatarProgram;
 LLGLSLShader			gDeferredAvatarAlphaProgram;
 LLGLSLShader			gDeferredLightProgram;
@@ -160,25 +184,23 @@ LLGLSLShader			gDeferredAttachmentShadowProgram;
 LLGLSLShader			gDeferredAlphaProgram;
 LLGLSLShader			gDeferredAvatarEyesProgram;
 LLGLSLShader			gDeferredFullbrightProgram;
-LLGLSLShader			gDeferredGIProgram;
-LLGLSLShader			gDeferredGIFinalProgram;
-LLGLSLShader			gDeferredPostGIProgram;
+LLGLSLShader			gDeferredEmissiveProgram;
 LLGLSLShader			gDeferredPostProgram;
+LLGLSLShader			gDeferredCoFProgram;
+LLGLSLShader			gDeferredDoFCombineProgram;
+LLGLSLShader			gFXAAProgram;
 LLGLSLShader			gDeferredPostNoDoFProgram;
 LLGLSLShader			gDeferredWLSkyProgram;
 LLGLSLShader			gDeferredWLCloudProgram;
 LLGLSLShader			gDeferredStarProgram;
-LLGLSLShader			gLuminanceGatherProgram;
-
-
-//current avatar shader parameter pointer
-GLint				gAvatarMatrixParam;
+LLGLSLShader			gNormalMapGenProgram;
 
 LLViewerShaderMgr::LLViewerShaderMgr() :
 	mVertexShaderLevel(SHADER_COUNT, 0),
 	mMaxAvatarShaderLevel(0)
 {	
 	/// Make sure WL Sky is the first program
+	//ONLY shaders that need WL Param management should be added here
 	mShaderList.push_back(&gWLSkyProgram);
 	mShaderList.push_back(&gWLCloudProgram);
 	mShaderList.push_back(&gAvatarProgram);
@@ -187,33 +209,42 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
 	mShaderList.push_back(&gWaterProgram);
 	mShaderList.push_back(&gAvatarEyeballProgram); 
 	mShaderList.push_back(&gObjectSimpleProgram);
+	mShaderList.push_back(&gObjectPreviewProgram);
 	mShaderList.push_back(&gImpostorProgram);
+	mShaderList.push_back(&gObjectFullbrightNoColorProgram);
+	mShaderList.push_back(&gObjectFullbrightNoColorWaterProgram);
 	mShaderList.push_back(&gObjectSimpleAlphaMaskProgram);
 	mShaderList.push_back(&gObjectBumpProgram);
-	mShaderList.push_back(&gUIProgram);
-	mShaderList.push_back(&gCustomAlphaProgram);
-	mShaderList.push_back(&gGlowCombineProgram);
-	mShaderList.push_back(&gTwoTextureAddProgram);
-	mShaderList.push_back(&gSolidColorProgram);
-	mShaderList.push_back(&gOcclusionProgram);
+	mShaderList.push_back(&gObjectEmissiveProgram);
+	mShaderList.push_back(&gObjectEmissiveWaterProgram);
 	mShaderList.push_back(&gObjectFullbrightProgram);
 	mShaderList.push_back(&gObjectFullbrightAlphaMaskProgram);
 	mShaderList.push_back(&gObjectFullbrightShinyProgram);
 	mShaderList.push_back(&gObjectFullbrightShinyWaterProgram);
 	mShaderList.push_back(&gObjectSimpleNonIndexedProgram);
+	mShaderList.push_back(&gObjectSimpleNonIndexedTexGenProgram);
+	mShaderList.push_back(&gObjectSimpleNonIndexedTexGenWaterProgram);
 	mShaderList.push_back(&gObjectSimpleNonIndexedWaterProgram);
 	mShaderList.push_back(&gObjectAlphaMaskNonIndexedProgram);
 	mShaderList.push_back(&gObjectAlphaMaskNonIndexedWaterProgram);
+	mShaderList.push_back(&gObjectAlphaMaskNoColorProgram);
+	mShaderList.push_back(&gObjectAlphaMaskNoColorWaterProgram);
+	mShaderList.push_back(&gTreeProgram);
+	mShaderList.push_back(&gTreeWaterProgram);
 	mShaderList.push_back(&gObjectFullbrightNonIndexedProgram);
 	mShaderList.push_back(&gObjectFullbrightNonIndexedWaterProgram);
+	mShaderList.push_back(&gObjectEmissiveNonIndexedProgram);
+	mShaderList.push_back(&gObjectEmissiveNonIndexedWaterProgram);
 	mShaderList.push_back(&gObjectFullbrightShinyNonIndexedProgram);
 	mShaderList.push_back(&gObjectFullbrightShinyNonIndexedWaterProgram);
 	mShaderList.push_back(&gSkinnedObjectSimpleProgram);
 	mShaderList.push_back(&gSkinnedObjectFullbrightProgram);
+	mShaderList.push_back(&gSkinnedObjectEmissiveProgram);
 	mShaderList.push_back(&gSkinnedObjectFullbrightShinyProgram);
 	mShaderList.push_back(&gSkinnedObjectShinySimpleProgram);
 	mShaderList.push_back(&gSkinnedObjectSimpleWaterProgram);
 	mShaderList.push_back(&gSkinnedObjectFullbrightWaterProgram);
+	mShaderList.push_back(&gSkinnedObjectEmissiveWaterProgram);
 	mShaderList.push_back(&gSkinnedObjectFullbrightShinyWaterProgram);
 	mShaderList.push_back(&gSkinnedObjectShinySimpleWaterProgram);
 	mShaderList.push_back(&gTerrainProgram);
@@ -227,24 +258,16 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
 	mShaderList.push_back(&gObjectShinyNonIndexedWaterProgram);
 	mShaderList.push_back(&gUnderWaterProgram);
 	mShaderList.push_back(&gDeferredSunProgram);
-	mShaderList.push_back(&gDeferredBlurLightProgram);
 	mShaderList.push_back(&gDeferredSoftenProgram);
-	mShaderList.push_back(&gDeferredLightProgram);
-	mShaderList.push_back(&gDeferredMultiLightProgram);
 	mShaderList.push_back(&gDeferredAlphaProgram);
 	mShaderList.push_back(&gDeferredSkinnedAlphaProgram);
 	mShaderList.push_back(&gDeferredFullbrightProgram);
+	mShaderList.push_back(&gDeferredEmissiveProgram);
 	mShaderList.push_back(&gDeferredAvatarEyesProgram);
-	mShaderList.push_back(&gDeferredPostGIProgram);
-	mShaderList.push_back(&gDeferredEdgeProgram);
-	mShaderList.push_back(&gDeferredPostProgram);
-	mShaderList.push_back(&gDeferredGIProgram);
-	mShaderList.push_back(&gDeferredGIFinalProgram);
 	mShaderList.push_back(&gDeferredWaterProgram);
 	mShaderList.push_back(&gDeferredAvatarAlphaProgram);
 	mShaderList.push_back(&gDeferredWLSkyProgram);
 	mShaderList.push_back(&gDeferredWLCloudProgram);
-	mShaderList.push_back(&gDeferredStarProgram);
 }
 
 LLViewerShaderMgr::~LLViewerShaderMgr()
@@ -268,80 +291,13 @@ void LLViewerShaderMgr::initAttribsAndUniforms(void)
 {
 	if (mReservedAttribs.empty())
 	{
-		mReservedAttribs.push_back("materialColor");
-		mReservedAttribs.push_back("specularColor");
-		mReservedAttribs.push_back("binormal");
-		mReservedAttribs.push_back("object_weight");
-
-		mAvatarAttribs.reserve(5);
-		mAvatarAttribs.push_back("weight");
-		mAvatarAttribs.push_back("clothing");
-		mAvatarAttribs.push_back("gWindDir");
-		mAvatarAttribs.push_back("gSinWaveParams");
-		mAvatarAttribs.push_back("gGravity");
+		LLShaderMgr::initAttribsAndUniforms();
 
 		mAvatarUniforms.push_back("matrixPalette");
+		mAvatarUniforms.push_back("gWindDir");
+		mAvatarUniforms.push_back("gSinWaveParams");
+		mAvatarUniforms.push_back("gGravity");
 
-		mReservedUniforms.reserve(24);
-		mReservedUniforms.push_back("diffuseMap");
-		mReservedUniforms.push_back("specularMap");
-		mReservedUniforms.push_back("bumpMap");
-		mReservedUniforms.push_back("environmentMap");
-		mReservedUniforms.push_back("cloude_noise_texture");
-		mReservedUniforms.push_back("fullbright");
-		mReservedUniforms.push_back("lightnorm");
-		mReservedUniforms.push_back("sunlight_color");
-		mReservedUniforms.push_back("ambient");
-		mReservedUniforms.push_back("blue_horizon");
-		mReservedUniforms.push_back("blue_density");
-		mReservedUniforms.push_back("haze_horizon");
-		mReservedUniforms.push_back("haze_density");
-		mReservedUniforms.push_back("cloud_shadow");
-		mReservedUniforms.push_back("density_multiplier");
-		mReservedUniforms.push_back("distance_multiplier");
-		mReservedUniforms.push_back("max_y");
-		mReservedUniforms.push_back("glow");
-		mReservedUniforms.push_back("cloud_color");
-		mReservedUniforms.push_back("cloud_pos_density1");
-		mReservedUniforms.push_back("cloud_pos_density2");
-		mReservedUniforms.push_back("cloud_scale");
-		mReservedUniforms.push_back("gamma");
-		mReservedUniforms.push_back("scene_light_strength");
-
-		mReservedUniforms.push_back("depthMap");
-		mReservedUniforms.push_back("shadowMap0");
-		mReservedUniforms.push_back("shadowMap1");
-		mReservedUniforms.push_back("shadowMap2");
-		mReservedUniforms.push_back("shadowMap3");
-		mReservedUniforms.push_back("shadowMap4");
-		mReservedUniforms.push_back("shadowMap5");
-
-		mReservedUniforms.push_back("normalMap");
-		mReservedUniforms.push_back("positionMap");
-		mReservedUniforms.push_back("diffuseRect");
-		mReservedUniforms.push_back("specularRect");
-		mReservedUniforms.push_back("noiseMap");
-		mReservedUniforms.push_back("lightFunc");
-		mReservedUniforms.push_back("lightMap");
-		mReservedUniforms.push_back("luminanceMap");
-		mReservedUniforms.push_back("giLightMap");
-		mReservedUniforms.push_back("giMip");
-		mReservedUniforms.push_back("edgeMap");
-		mReservedUniforms.push_back("bloomMap");
-		mReservedUniforms.push_back("sunLightMap");
-		mReservedUniforms.push_back("localLightMap");
-		mReservedUniforms.push_back("projectionMap");
-		mReservedUniforms.push_back("diffuseGIMap");
-		mReservedUniforms.push_back("specularGIMap");
-		mReservedUniforms.push_back("normalGIMap");
-		mReservedUniforms.push_back("minpGIMap");
-		mReservedUniforms.push_back("maxpGIMap");
-		mReservedUniforms.push_back("depthGIMap");
-		mReservedUniforms.push_back("lastDiffuseGIMap");
-		mReservedUniforms.push_back("lastNormalGIMap");
-		mReservedUniforms.push_back("lastMinpGIMap");
-		mReservedUniforms.push_back("lastMaxpGIMap");
-					
 		mWLUniforms.push_back("camPosLocal");
 
 		mTerrainUniforms.reserve(5);
@@ -397,17 +353,35 @@ void LLViewerShaderMgr::setShaders()
 	//setShaders might be called redundantly by gSavedSettings, so return on reentrance
 	static bool reentrance = false;
 	
-	if (!gPipeline.mInitialized || !sInitialized || reentrance)
+	if (!gPipeline.mInitialized || !sInitialized || reentrance || sSkipReload)
 	{
 		return;
 	}
 
-	//setup preprocessor definitions
-	LLShaderMgr::instance()->mDefinitions["samples"] = llformat("%d", gGLManager.getNumFBOFSAASamples(gSavedSettings.getU32("RenderFSAASamples")));
-	LLShaderMgr::instance()->mDefinitions["NUM_TEX_UNITS"] = llformat("%d", gGLManager.mNumTextureImageUnits);
+	LLGLSLShader::sIndexedTextureChannels = llmax(llmin(gGLManager.mNumTextureImageUnits, (S32) gSavedSettings.getU32("RenderMaxTextureIndex")), 1);
+
+	//NEVER use more than 16 texture channels (work around for prevalent driver bug)
+	LLGLSLShader::sIndexedTextureChannels = llmin(LLGLSLShader::sIndexedTextureChannels, 16);
+
+	if (gGLManager.mGLSLVersionMajor < 1 ||
+		(gGLManager.mGLSLVersionMajor == 1 && gGLManager.mGLSLVersionMinor <= 20))
+	{ //NEVER use indexed texture rendering when GLSL version is 1.20 or earlier
+		LLGLSLShader::sIndexedTextureChannels = 1;
+	}
 
 	reentrance = true;
 
+	if (LLRender::sGLCoreProfile)
+	{  
+		if (!gSavedSettings.getBOOL("VertexShaderEnable"))
+		{ //vertex shaders MUST be enabled to use core profile
+			gSavedSettings.setBOOL("VertexShaderEnable", TRUE);
+		}
+	}
+	
+	//setup preprocessor definitions
+	LLShaderMgr::instance()->mDefinitions["NUM_TEX_UNITS"] = llformat("%d", gGLManager.mNumTextureImageUnits);
+	
 	// Make sure the compiled shader map is cleared before we recompile shaders.
 	mShaderObjects.clear();
 	
@@ -439,6 +413,8 @@ void LLViewerShaderMgr::setShaders()
 
 	// Shaders
 	LL_INFOS("ShaderLoading") << "\n~~~~~~~~~~~~~~~~~~\n Loading Shaders:\n~~~~~~~~~~~~~~~~~~" << LL_ENDL;
+	LL_INFOS("ShaderLoading") << llformat("Using GLSL %d.%d", gGLManager.mGLSLVersionMajor, gGLManager.mGLSLVersionMinor) << llendl;
+
 	for (S32 i = 0; i < SHADER_COUNT; i++)
 	{
 		mVertexShaderLevel[i] = 0;
@@ -446,7 +422,9 @@ void LLViewerShaderMgr::setShaders()
 	mMaxAvatarShaderLevel = 0;
 
 	LLGLSLShader::sNoFixedFunction = false;
+	LLVertexBuffer::unbind();
 	if (LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable") 
+		&& (gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 10)
 		&& gSavedSettings.getBOOL("VertexShaderEnable"))
 	{
 		//using shaders, disable fixed function
@@ -466,15 +444,8 @@ void LLViewerShaderMgr::setShaders()
 			gSavedSettings.getBOOL("WindLightUseAtmosShaders"))
 		{
 			if (gSavedSettings.getS32("RenderShadowDetail") > 0)
-			{
-				if (gSavedSettings.getBOOL("RenderDeferredGI"))
-				{ //shadows + gi
-					deferred_class = 3;
-				}
-				else
-				{ //shadows
-					deferred_class = 2;
-				}
+			{ //shadows
+				deferred_class = 2;
 			}
 			else
 			{ //no shadows
@@ -497,11 +468,7 @@ void LLViewerShaderMgr::setShaders()
 			wl_class = 1;
 		}
 
-		if(!gSavedSettings.getBOOL("EnableRippleWater"))
-		{
-			water_class = 0;
-		}
-
+		
 		// Trigger a full rebuild of the fallback skybox / cubemap if we've toggled windlight shaders
 		if (mVertexShaderLevel[SHADER_WINDLIGHT] != wl_class && gSky.mVOSkyp.notNull())
 		{
@@ -633,13 +600,21 @@ void LLViewerShaderMgr::setShaders()
 void LLViewerShaderMgr::unloadShaders()
 {
 	gOcclusionProgram.unload();
+	gDebugProgram.unload();
+	gAlphaMaskProgram.unload();
 	gUIProgram.unload();
 	gCustomAlphaProgram.unload();
 	gGlowCombineProgram.unload();
+	gSplatTextureRectProgram.unload();
+	gGlowCombineFXAAProgram.unload();
 	gTwoTextureAddProgram.unload();
+	gOneTextureNoColorProgram.unload();
 	gSolidColorProgram.unload();
 
+	gObjectFullbrightNoColorProgram.unload();
+	gObjectFullbrightNoColorWaterProgram.unload();
 	gObjectSimpleProgram.unload();
+	gObjectPreviewProgram.unload();
 	gImpostorProgram.unload();
 	gObjectSimpleAlphaMaskProgram.unload();
 	gObjectBumpProgram.unload();
@@ -647,6 +622,8 @@ void LLViewerShaderMgr::unloadShaders()
 	gObjectSimpleWaterAlphaMaskProgram.unload();
 	gObjectFullbrightProgram.unload();
 	gObjectFullbrightWaterProgram.unload();
+	gObjectEmissiveProgram.unload();
+	gObjectEmissiveWaterProgram.unload();
 	gObjectFullbrightAlphaMaskProgram.unload();
 	gObjectFullbrightWaterAlphaMaskProgram.unload();
 
@@ -656,11 +633,19 @@ void LLViewerShaderMgr::unloadShaders()
 	gObjectShinyWaterProgram.unload();
 
 	gObjectSimpleNonIndexedProgram.unload();
+	gObjectSimpleNonIndexedTexGenProgram.unload();
+	gObjectSimpleNonIndexedTexGenWaterProgram.unload();
 	gObjectSimpleNonIndexedWaterProgram.unload();
 	gObjectAlphaMaskNonIndexedProgram.unload();
 	gObjectAlphaMaskNonIndexedWaterProgram.unload();
+	gObjectAlphaMaskNoColorProgram.unload();
+	gObjectAlphaMaskNoColorWaterProgram.unload();
 	gObjectFullbrightNonIndexedProgram.unload();
 	gObjectFullbrightNonIndexedWaterProgram.unload();
+	gObjectEmissiveNonIndexedProgram.unload();
+	gObjectEmissiveNonIndexedWaterProgram.unload();
+	gTreeProgram.unload();
+	gTreeWaterProgram.unload();
 
 	gObjectShinyNonIndexedProgram.unload();
 	gObjectFullbrightShinyNonIndexedProgram.unload();
@@ -669,11 +654,13 @@ void LLViewerShaderMgr::unloadShaders()
 
 	gSkinnedObjectSimpleProgram.unload();
 	gSkinnedObjectFullbrightProgram.unload();
+	gSkinnedObjectEmissiveProgram.unload();
 	gSkinnedObjectFullbrightShinyProgram.unload();
 	gSkinnedObjectShinySimpleProgram.unload();
 	
 	gSkinnedObjectSimpleWaterProgram.unload();
 	gSkinnedObjectFullbrightWaterProgram.unload();
+	gSkinnedObjectEmissiveWaterProgram.unload();
 	gSkinnedObjectFullbrightShinyWaterProgram.unload();
 	gSkinnedObjectShinySimpleWaterProgram.unload();
 	
@@ -699,6 +686,7 @@ void LLViewerShaderMgr::unloadShaders()
 	gDeferredDiffuseProgram.unload();
 	gDeferredDiffuseAlphaMaskProgram.unload();
 	gDeferredNonIndexedDiffuseAlphaMaskProgram.unload();
+	gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.unload();
 	gDeferredNonIndexedDiffuseProgram.unload();
 	gDeferredSkinnedDiffuseProgram.unload();
 	gDeferredSkinnedBumpProgram.unload();
@@ -750,8 +738,8 @@ BOOL LLViewerShaderMgr::loadBasicShaders()
 	// (in order of shader function call depth for reference purposes, deepest level first)
 
 	vector< pair<string, S32> > shaders;
-	shaders.reserve(10);
 	shaders.push_back( make_pair( "windlight/atmosphericsVarsV.glsl",		mVertexShaderLevel[SHADER_WINDLIGHT] ) );
+	shaders.push_back( make_pair( "windlight/atmosphericsVarsWaterV.glsl",	mVertexShaderLevel[SHADER_WINDLIGHT] ) );
 	shaders.push_back( make_pair( "windlight/atmosphericsHelpersV.glsl",	mVertexShaderLevel[SHADER_WINDLIGHT] ) );
 	shaders.push_back( make_pair( "lighting/lightFuncV.glsl",				mVertexShaderLevel[SHADER_LIGHTING] ) );
 	shaders.push_back( make_pair( "lighting/sumLightsV.glsl",				sum_lights_class ) );
@@ -762,6 +750,11 @@ BOOL LLViewerShaderMgr::loadBasicShaders()
 	shaders.push_back( make_pair( "windlight/atmosphericsV.glsl",			mVertexShaderLevel[SHADER_WINDLIGHT] ) );
 	shaders.push_back( make_pair( "avatar/avatarSkinV.glsl",				1 ) );
 	shaders.push_back( make_pair( "avatar/objectSkinV.glsl",				1 ) );
+	if (gGLManager.mGLSLVersionMajor >= 2 || gGLManager.mGLSLVersionMinor >= 30)
+	{
+		shaders.push_back( make_pair( "objects/indexedTextureV.glsl",			1 ) );
+	}
+	shaders.push_back( make_pair( "objects/nonindexedTextureV.glsl",		1 ) );
 
 	// We no longer have to bind the shaders to global glhandles, they are automatically added to a map now.
 	for (U32 i = 0; i < shaders.size(); i++)
@@ -777,16 +770,16 @@ BOOL LLViewerShaderMgr::loadBasicShaders()
 	// (in order of shader function call depth for reference purposes, deepest level first)
 
 	shaders.clear();
-	shaders.reserve(13);
-	S32 ch = gGLManager.mNumTextureImageUnits-1;
+	S32 ch = 1;
 
-	if (gGLManager.mGLVersion < 3.1f)
-	{ //force to 1 texture index channel for old drivers
-		ch = 1;
+	if (gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 30)
+	{ //use indexed texture rendering for GLSL >= 1.30
+		ch = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
 	}
 
 	std::vector<S32> index_channels;
 	index_channels.push_back(-1);	 shaders.push_back( make_pair( "windlight/atmosphericsVarsF.glsl",		mVertexShaderLevel[SHADER_WINDLIGHT] ) );
+	index_channels.push_back(-1);	 shaders.push_back( make_pair( "windlight/atmosphericsVarsWaterF.glsl",		mVertexShaderLevel[SHADER_WINDLIGHT] ) );
 	index_channels.push_back(-1);	 shaders.push_back( make_pair( "windlight/gammaF.glsl",					mVertexShaderLevel[SHADER_WINDLIGHT]) );
 	index_channels.push_back(-1);	 shaders.push_back( make_pair( "windlight/atmosphericsF.glsl",			mVertexShaderLevel[SHADER_WINDLIGHT] ) );
 	index_channels.push_back(-1);	 shaders.push_back( make_pair( "windlight/transportF.glsl",				mVertexShaderLevel[SHADER_WINDLIGHT] ) );	
@@ -844,6 +837,8 @@ BOOL LLViewerShaderMgr::loadShadersEnvironment()
 		gTerrainProgram.mFeatures.calculatesLighting = true;
 		gTerrainProgram.mFeatures.calculatesAtmospherics = true;
 		gTerrainProgram.mFeatures.hasAtmospherics = true;
+		gTerrainProgram.mFeatures.mIndexedTextureChannels = 0;
+		gTerrainProgram.mFeatures.disableTextureIndex = true;
 		gTerrainProgram.mFeatures.hasGamma = true;
 		gTerrainProgram.mShaderFiles.clear();
 		gTerrainProgram.mShaderFiles.push_back(make_pair("environment/terrainV.glsl", GL_VERTEX_SHADER_ARB));
@@ -912,6 +907,8 @@ BOOL LLViewerShaderMgr::loadShadersWater()
 		gTerrainWaterProgram.mFeatures.calculatesAtmospherics = true;
 		gTerrainWaterProgram.mFeatures.hasAtmospherics = true;
 		gTerrainWaterProgram.mFeatures.hasWaterFog = true;
+		gTerrainWaterProgram.mFeatures.mIndexedTextureChannels = 0;
+		gTerrainWaterProgram.mFeatures.disableTextureIndex = true;
 		gTerrainWaterProgram.mShaderFiles.clear();
 		gTerrainWaterProgram.mShaderFiles.push_back(make_pair("environment/terrainV.glsl", GL_VERTEX_SHADER_ARB));
 		gTerrainWaterProgram.mShaderFiles.push_back(make_pair("environment/terrainWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
@@ -950,9 +947,6 @@ BOOL LLViewerShaderMgr::loadShadersEffects()
 {
 	BOOL success = TRUE;
 
-	U32 samples = gGLManager.getNumFBOFSAASamples(gSavedSettings.getU32("RenderFSAASamples"));
-	bool multisample = samples > 1 && LLPipeline::sRenderDeferred && gGLManager.mHasTextureMultisample;
-
 	if (mVertexShaderLevel[SHADER_EFFECT] == 0)
 	{
 		gGlowProgram.unload();
@@ -978,21 +972,10 @@ BOOL LLViewerShaderMgr::loadShadersEffects()
 	
 	if (success)
 	{
-		std::string fragment;
-
-		if (multisample)
-		{
-			fragment = "effects/glowExtractMSF.glsl";
-		}
-		else
-		{
-			fragment = "effects/glowExtractF.glsl";
-		}
-
 		gGlowExtractProgram.mName = "Glow Extract Shader (Post)";
 		gGlowExtractProgram.mShaderFiles.clear();
 		gGlowExtractProgram.mShaderFiles.push_back(make_pair("effects/glowExtractV.glsl", GL_VERTEX_SHADER_ARB));
-		gGlowExtractProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB));
+		gGlowExtractProgram.mShaderFiles.push_back(make_pair("effects/glowExtractF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gGlowExtractProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT];
 		success = gGlowExtractProgram.createShader(NULL, &mGlowExtractUniforms);
 		if (!success)
@@ -1001,51 +984,6 @@ BOOL LLViewerShaderMgr::loadShadersEffects()
 		}
 	}
 	
-#if 0
-	// disabling loading of postprocess shaders until we fix
-	// ATI sampler2DRect compatibility.
-	
-	//load Color Filter Shader
-	if (success)
-	{
-		vector<string> shaderUniforms;
-		shaderUniforms.reserve(7);
-		shaderUniforms.push_back("RenderTexture");
-		shaderUniforms.push_back("gamma");
-		shaderUniforms.push_back("brightness");
-		shaderUniforms.push_back("contrast");
-		shaderUniforms.push_back("contrastBase");
-		shaderUniforms.push_back("saturation");
-		shaderUniforms.push_back("lumWeights");
-
-		gPostColorFilterProgram.mName = "Color Filter Shader (Post)";
-		gPostColorFilterProgram.mShaderFiles.clear();
-		gPostColorFilterProgram.mShaderFiles.push_back(make_pair("effects/colorFilterF.glsl", GL_FRAGMENT_SHADER_ARB));
-		gPostColorFilterProgram.mShaderFiles.push_back(make_pair("effects/drawQuadV.glsl", GL_VERTEX_SHADER_ARB));
-		gPostColorFilterProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT];
-		success = gPostColorFilterProgram.createShader(NULL, &shaderUniforms);
-	}
-
-	//load Night Vision Shader
-	if (success)
-	{
-		vector<string> shaderUniforms;
-		shaderUniforms.reserve(5);
-		shaderUniforms.push_back("RenderTexture");
-		shaderUniforms.push_back("NoiseTexture");
-		shaderUniforms.push_back("brightMult");
-		shaderUniforms.push_back("noiseStrength");
-		shaderUniforms.push_back("lumWeights");
-
-		gPostNightVisionProgram.mName = "Night Vision Shader (Post)";
-		gPostNightVisionProgram.mShaderFiles.clear();
-		gPostNightVisionProgram.mShaderFiles.push_back(make_pair("effects/nightVisionF.glsl", GL_FRAGMENT_SHADER_ARB));
-		gPostNightVisionProgram.mShaderFiles.push_back(make_pair("effects/drawQuadV.glsl", GL_VERTEX_SHADER_ARB));
-		gPostNightVisionProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT];
-		success = gPostNightVisionProgram.createShader(NULL, &shaderUniforms);
-	}
-	#endif
-
 	return success;
 
 }
@@ -1055,9 +993,11 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 	if (mVertexShaderLevel[SHADER_DEFERRED] == 0)
 	{
 		gDeferredTreeProgram.unload();
+		gDeferredTreeShadowProgram.unload();
 		gDeferredDiffuseProgram.unload();
 		gDeferredDiffuseAlphaMaskProgram.unload();
 		gDeferredNonIndexedDiffuseAlphaMaskProgram.unload();
+		gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.unload();
 		gDeferredNonIndexedDiffuseProgram.unload();
 		gDeferredSkinnedDiffuseProgram.unload();
 		gDeferredSkinnedBumpProgram.unload();
@@ -1080,34 +1020,29 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 		gDeferredAvatarAlphaProgram.unload();
 		gDeferredAlphaProgram.unload();
 		gDeferredFullbrightProgram.unload();
+		gDeferredEmissiveProgram.unload();
 		gDeferredAvatarEyesProgram.unload();
-		gDeferredPostGIProgram.unload();		
-		gDeferredEdgeProgram.unload();		
 		gDeferredPostProgram.unload();		
-		gLuminanceGatherProgram.unload();
-		gDeferredGIProgram.unload();
-		gDeferredGIFinalProgram.unload();
+		gDeferredCoFProgram.unload();		
+		gDeferredDoFCombineProgram.unload();
+		gFXAAProgram.unload();
 		gDeferredWaterProgram.unload();
 		gDeferredWLSkyProgram.unload();
 		gDeferredWLCloudProgram.unload();
 		gDeferredStarProgram.unload();
+		gNormalMapGenProgram.unload();
 		return TRUE;
 	}
 
-	mVertexShaderLevel[SHADER_AVATAR] = 1;
-
 	BOOL success = TRUE;
 
-	U32 samples = gGLManager.getNumFBOFSAASamples(gSavedSettings.getU32("RenderFSAASamples"));
-	bool multisample = samples > 1 && gGLManager.mHasTextureMultisample;
-
 	if (success)
 	{
 		gDeferredDiffuseProgram.mName = "Deferred Diffuse Shader";
 		gDeferredDiffuseProgram.mShaderFiles.clear();
 		gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER_ARB));
 		gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseIndexedF.glsl", GL_FRAGMENT_SHADER_ARB));
-		gDeferredDiffuseProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits;
+		gDeferredDiffuseProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
 		gDeferredDiffuseProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
 		success = gDeferredDiffuseProgram.createShader(NULL, NULL);
 	}
@@ -1118,7 +1053,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 		gDeferredDiffuseAlphaMaskProgram.mShaderFiles.clear();
 		gDeferredDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER_ARB));
 		gDeferredDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskIndexedF.glsl", GL_FRAGMENT_SHADER_ARB));
-		gDeferredDiffuseAlphaMaskProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits;
+		gDeferredDiffuseAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
 		gDeferredDiffuseAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
 		success = gDeferredDiffuseAlphaMaskProgram.createShader(NULL, NULL);
 	}
@@ -1132,6 +1067,16 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 		gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
 		success = gDeferredNonIndexedDiffuseAlphaMaskProgram.createShader(NULL, NULL);
 	}
+	
+	if (success)
+	{
+		gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mName = "Deferred Diffuse Non-Indexed Alpha Mask Shader";
+		gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.clear();
+		gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseNoColorV.glsl", GL_VERTEX_SHADER_ARB));
+		gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskNoColorF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+		success = gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.createShader(NULL, NULL);
+	}
 
 	if (success)
 	{
@@ -1169,18 +1114,25 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 	if (success)
 	{
 		gDeferredSkinnedAlphaProgram.mName = "Deferred Skinned Alpha Shader";
+		gDeferredSkinnedAlphaProgram.mFeatures.atmosphericHelpers = true;
 		gDeferredSkinnedAlphaProgram.mFeatures.hasObjectSkinning = true;
-		gDeferredSkinnedAlphaProgram.mFeatures.calculatesLighting = true;
 		gDeferredSkinnedAlphaProgram.mFeatures.calculatesAtmospherics = true;
 		gDeferredSkinnedAlphaProgram.mFeatures.hasGamma = true;
 		gDeferredSkinnedAlphaProgram.mFeatures.hasAtmospherics = true;
-		gDeferredSkinnedAlphaProgram.mFeatures.hasLighting = true;
+		gDeferredSkinnedAlphaProgram.mFeatures.calculatesLighting = false;
+		gDeferredSkinnedAlphaProgram.mFeatures.hasLighting = false;
+		gDeferredSkinnedAlphaProgram.mFeatures.isAlphaLighting = true;
 		gDeferredSkinnedAlphaProgram.mFeatures.disableTextureIndex = true;
 		gDeferredSkinnedAlphaProgram.mShaderFiles.clear();
 		gDeferredSkinnedAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaSkinnedV.glsl", GL_VERTEX_SHADER_ARB));
 		gDeferredSkinnedAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaNonIndexedF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gDeferredSkinnedAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+		
 		success = gDeferredSkinnedAlphaProgram.createShader(NULL, NULL);
+		
+		// Hack to include uniforms for lighting without linking in lighting file
+		gDeferredSkinnedAlphaProgram.mFeatures.calculatesLighting = true;
+		gDeferredSkinnedAlphaProgram.mFeatures.hasLighting = true;
 	}
 
 	if (success)
@@ -1203,6 +1155,16 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 		success = gDeferredTreeProgram.createShader(NULL, NULL);
 	}
 
+	if (success)
+	{
+		gDeferredTreeShadowProgram.mName = "Deferred Tree Shadow Shader";
+		gDeferredTreeShadowProgram.mShaderFiles.clear();
+		gDeferredTreeShadowProgram.mShaderFiles.push_back(make_pair("deferred/treeShadowV.glsl", GL_VERTEX_SHADER_ARB));
+		gDeferredTreeShadowProgram.mShaderFiles.push_back(make_pair("deferred/treeShadowF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gDeferredTreeShadowProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+		success = gDeferredTreeShadowProgram.createShader(NULL, NULL);
+	}
+
 	if (success)
 	{
 		gDeferredImpostorProgram.mName = "Deferred Impostor Shader";
@@ -1214,84 +1176,41 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 	}
 
 	if (success)
-	{
-		std::string fragment;
-
-		if (multisample)
-		{
-			fragment = "deferred/pointLightMSF.glsl";
-		}
-		else
-		{
-			fragment = "deferred/pointLightF.glsl";
-		}
-
+	{		
 		gDeferredLightProgram.mName = "Deferred Light Shader";
 		gDeferredLightProgram.mShaderFiles.clear();
 		gDeferredLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER_ARB));
-		gDeferredLightProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB));
+		gDeferredLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gDeferredLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
 		success = gDeferredLightProgram.createShader(NULL, NULL);
 	}
 
 	if (success)
 	{
-		std::string fragment;
-		if (multisample)
-		{
-			fragment = "deferred/multiPointLightMSF.glsl";
-		}
-		else
-		{
-			fragment = "deferred/multiPointLightF.glsl";
-		}
-
 		gDeferredMultiLightProgram.mName = "Deferred MultiLight Shader";
 		gDeferredMultiLightProgram.mShaderFiles.clear();
 		gDeferredMultiLightProgram.mShaderFiles.push_back(make_pair("deferred/multiPointLightV.glsl", GL_VERTEX_SHADER_ARB));
-		gDeferredMultiLightProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB));
+		gDeferredMultiLightProgram.mShaderFiles.push_back(make_pair("deferred/multiPointLightF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gDeferredMultiLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
 		success = gDeferredMultiLightProgram.createShader(NULL, NULL);
 	}
 
 	if (success)
 	{
-		std::string fragment;
-
-		if (multisample)
-		{
-			fragment = "deferred/spotLightMSF.glsl";
-		}
-		else
-		{
-			fragment = "deferred/multiSpotLightF.glsl";
-		}
-
 		gDeferredSpotLightProgram.mName = "Deferred SpotLight Shader";
 		gDeferredSpotLightProgram.mShaderFiles.clear();
 		gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER_ARB));
-		gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB));
+		gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/multiSpotLightF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gDeferredSpotLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
 		success = gDeferredSpotLightProgram.createShader(NULL, NULL);
 	}
 
 	if (success)
 	{
-		std::string fragment;
-
-		if (multisample)
-		{
-			fragment = "deferred/multiSpotLightMSF.glsl";
-		}
-		else
-		{
-			fragment = "deferred/multiSpotLightF.glsl";
-		}
-
 		gDeferredMultiSpotLightProgram.mName = "Deferred MultiSpotLight Shader";
 		gDeferredMultiSpotLightProgram.mShaderFiles.clear();
 		gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER_ARB));
-		gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB));
+		gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/multiSpotLightF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gDeferredMultiSpotLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
 		success = gDeferredMultiSpotLightProgram.createShader(NULL, NULL);
 	}
@@ -1299,33 +1218,24 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 	if (success)
 	{
 		std::string fragment;
+		std::string vertex = "deferred/sunLightV.glsl";
 
 		if (gSavedSettings.getBOOL("RenderDeferredSSAO"))
 		{
-			if (multisample)
-			{
-				fragment = "deferred/sunLightSSAOMSF.glsl";
-			}
-			else
-			{
-				fragment = "deferred/sunLightSSAOF.glsl";
-			}
+			fragment = "deferred/sunLightSSAOF.glsl";
 		}
 		else
 		{
-			if (multisample)
-			{
-				fragment = "deferred/sunLightMSF.glsl";
-			}
-			else
-			{
-				fragment = "deferred/sunLightF.glsl";
+			fragment = "deferred/sunLightF.glsl";
+			if (mVertexShaderLevel[SHADER_DEFERRED] == 1)
+			{ //no shadows, no SSAO, no frag coord
+				vertex = "deferred/sunLightNoFragCoordV.glsl";
 			}
 		}
 
 		gDeferredSunProgram.mName = "Deferred Sun Shader";
 		gDeferredSunProgram.mShaderFiles.clear();
-		gDeferredSunProgram.mShaderFiles.push_back(make_pair("deferred/sunLightV.glsl", GL_VERTEX_SHADER_ARB));
+		gDeferredSunProgram.mShaderFiles.push_back(make_pair(vertex, GL_VERTEX_SHADER_ARB));
 		gDeferredSunProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB));
 		gDeferredSunProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
 		success = gDeferredSunProgram.createShader(NULL, NULL);
@@ -1333,21 +1243,10 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 
 	if (success)
 	{
-		std::string fragment;
-
-		if (multisample)
-		{
-			fragment = "deferred/blurLightMSF.glsl";
-		}
-		else
-		{
-			fragment = "deferred/blurLightF.glsl";
-		}
-
 		gDeferredBlurLightProgram.mName = "Deferred Blur Light Shader";
 		gDeferredBlurLightProgram.mShaderFiles.clear();
 		gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair("deferred/blurLightV.glsl", GL_VERTEX_SHADER_ARB));
-		gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB));
+		gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair("deferred/blurLightF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gDeferredBlurLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
 		success = gDeferredBlurLightProgram.createShader(NULL, NULL);
 	}
@@ -1355,26 +1254,33 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 	if (success)
 	{
 		gDeferredAlphaProgram.mName = "Deferred Alpha Shader";
-		gDeferredAlphaProgram.mFeatures.calculatesLighting = true;
+		gDeferredAlphaProgram.mFeatures.atmosphericHelpers = true;
+		gDeferredAlphaProgram.mFeatures.calculatesLighting = false;
 		gDeferredAlphaProgram.mFeatures.calculatesAtmospherics = true;
 		gDeferredAlphaProgram.mFeatures.hasGamma = true;
 		gDeferredAlphaProgram.mFeatures.hasAtmospherics = true;
-		gDeferredAlphaProgram.mFeatures.hasLighting = true;
+		gDeferredAlphaProgram.mFeatures.hasLighting = false;
+		gDeferredAlphaProgram.mFeatures.isAlphaLighting = true;
 		gDeferredAlphaProgram.mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels
 		if (mVertexShaderLevel[SHADER_DEFERRED] < 1)
 		{
-			gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits;
+			gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
 		}
 		else
 		{ //shave off some texture units for shadow maps
-			gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits - 6;
+			gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels - 6, 1);
 		}
 			
 		gDeferredAlphaProgram.mShaderFiles.clear();
 		gDeferredAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaV.glsl", GL_VERTEX_SHADER_ARB));
 		gDeferredAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gDeferredAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+
 		success = gDeferredAlphaProgram.createShader(NULL, NULL);
+
+		// Hack
+		gDeferredAlphaProgram.mFeatures.calculatesLighting = true;
+		gDeferredAlphaProgram.mFeatures.hasLighting = true;
 	}
 
 	if (success)
@@ -1397,7 +1303,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 		gDeferredFullbrightProgram.mFeatures.calculatesAtmospherics = true;
 		gDeferredFullbrightProgram.mFeatures.hasGamma = true;
 		gDeferredFullbrightProgram.mFeatures.hasTransport = true;
-		gDeferredFullbrightProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits;
+		gDeferredFullbrightProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
 		gDeferredFullbrightProgram.mShaderFiles.clear();
 		gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER_ARB));
 		gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB));
@@ -1405,6 +1311,20 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 		success = gDeferredFullbrightProgram.createShader(NULL, NULL);
 	}
 
+	if (success)
+	{
+		gDeferredEmissiveProgram.mName = "Deferred Emissive Shader";
+		gDeferredEmissiveProgram.mFeatures.calculatesAtmospherics = true;
+		gDeferredEmissiveProgram.mFeatures.hasGamma = true;
+		gDeferredEmissiveProgram.mFeatures.hasTransport = true;
+		gDeferredEmissiveProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
+		gDeferredEmissiveProgram.mShaderFiles.clear();
+		gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveV.glsl", GL_VERTEX_SHADER_ARB));
+		gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gDeferredEmissiveProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+		success = gDeferredEmissiveProgram.createShader(NULL, NULL);
+	}
+
 	if (success)
 	{
 		// load water shader
@@ -1421,21 +1341,10 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 
 	if (success)
 	{
-		std::string fragment;
-
-		if (multisample)
-		{
-			fragment = "deferred/softenLightMSF.glsl";
-		}
-		else
-		{
-			fragment = "deferred/softenLightF.glsl";
-		}
-
 		gDeferredSoftenProgram.mName = "Deferred Soften Shader";
 		gDeferredSoftenProgram.mShaderFiles.clear();
 		gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightV.glsl", GL_VERTEX_SHADER_ARB));
-		gDeferredSoftenProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB));
+		gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightF.glsl", GL_FRAGMENT_SHADER_ARB));
 
 		gDeferredSoftenProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
 
@@ -1460,6 +1369,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 	if (success)
 	{
 		gDeferredShadowAlphaMaskProgram.mName = "Deferred Shadow Alpha Mask Shader";
+		gDeferredShadowAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
 		gDeferredShadowAlphaMaskProgram.mShaderFiles.clear();
 		gDeferredShadowAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskV.glsl", GL_VERTEX_SHADER_ARB));
 		gDeferredShadowAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskF.glsl", GL_FRAGMENT_SHADER_ARB));
@@ -1475,7 +1385,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 		gDeferredAvatarShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarShadowV.glsl", GL_VERTEX_SHADER_ARB));
 		gDeferredAvatarShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarShadowF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gDeferredAvatarShadowProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
-		success = gDeferredAvatarShadowProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+		success = gDeferredAvatarShadowProgram.createShader(NULL, &mAvatarUniforms);
 	}
 
 	if (success)
@@ -1507,62 +1417,78 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 		gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarV.glsl", GL_VERTEX_SHADER_ARB));
 		gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gDeferredAvatarProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
-		success = gDeferredAvatarProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+		success = gDeferredAvatarProgram.createShader(NULL, &mAvatarUniforms);
 	}
 
 	if (success)
 	{
 		gDeferredAvatarAlphaProgram.mName = "Avatar Alpha Shader";
+		gDeferredAvatarAlphaProgram.mFeatures.atmosphericHelpers = true;
 		gDeferredAvatarAlphaProgram.mFeatures.hasSkinning = true;
-		gDeferredAvatarAlphaProgram.mFeatures.calculatesLighting = true;
+		gDeferredAvatarAlphaProgram.mFeatures.calculatesLighting = false;
 		gDeferredAvatarAlphaProgram.mFeatures.calculatesAtmospherics = true;
 		gDeferredAvatarAlphaProgram.mFeatures.hasGamma = true;
 		gDeferredAvatarAlphaProgram.mFeatures.hasAtmospherics = true;
-		gDeferredAvatarAlphaProgram.mFeatures.hasLighting = true;
+		gDeferredAvatarAlphaProgram.mFeatures.hasLighting = false;
+		gDeferredAvatarAlphaProgram.mFeatures.isAlphaLighting = true;
 		gDeferredAvatarAlphaProgram.mFeatures.disableTextureIndex = true;
 		gDeferredAvatarAlphaProgram.mShaderFiles.clear();
-		gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaV.glsl", GL_VERTEX_SHADER_ARB));
-		gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaNonIndexedF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaNoColorV.glsl", GL_VERTEX_SHADER_ARB));
+		gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaNonIndexedNoColorF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gDeferredAvatarAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
-		success = gDeferredAvatarAlphaProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+
+		success = gDeferredAvatarAlphaProgram.createShader(NULL, &mAvatarUniforms);
+
+		gDeferredAvatarAlphaProgram.mFeatures.calculatesLighting = true;
+		gDeferredAvatarAlphaProgram.mFeatures.hasLighting = true;
 	}
 
 	if (success)
 	{
-		std::string fragment;
-		if (multisample)
-		{
-			fragment = "deferred/postDeferredMSF.glsl";
-		}
-		else
-		{
-			fragment = "deferred/postDeferredF.glsl";
-		}
+		gFXAAProgram.mName = "FXAA Shader";
+		gFXAAProgram.mShaderFiles.clear();
+		gFXAAProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredV.glsl", GL_VERTEX_SHADER_ARB));
+		gFXAAProgram.mShaderFiles.push_back(make_pair("deferred/fxaaF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gFXAAProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+		success = gFXAAProgram.createShader(NULL, NULL);
+	}
 
+	if (success)
+	{
 		gDeferredPostProgram.mName = "Deferred Post Shader";
 		gDeferredPostProgram.mShaderFiles.clear();
-		gDeferredPostProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredV.glsl", GL_VERTEX_SHADER_ARB));
-		gDeferredPostProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB));
+		gDeferredPostProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER_ARB));
+		gDeferredPostProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gDeferredPostProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
 		success = gDeferredPostProgram.createShader(NULL, NULL);
 	}
 
 	if (success)
 	{
-		std::string fragment;
-		if (multisample)
-		{
-			fragment = "deferred/postDeferredNoDoFMSF.glsl";
-		}
-		else
-		{
-			fragment = "deferred/postDeferredNoDoFF.glsl";
-		}
+		gDeferredCoFProgram.mName = "Deferred CoF Shader";
+		gDeferredCoFProgram.mShaderFiles.clear();
+		gDeferredCoFProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER_ARB));
+		gDeferredCoFProgram.mShaderFiles.push_back(make_pair("deferred/cofF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gDeferredCoFProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+		success = gDeferredCoFProgram.createShader(NULL, NULL);
+	}
 
+	if (success)
+	{
+		gDeferredDoFCombineProgram.mName = "Deferred DoFCombine Shader";
+		gDeferredDoFCombineProgram.mShaderFiles.clear();
+		gDeferredDoFCombineProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER_ARB));
+		gDeferredDoFCombineProgram.mShaderFiles.push_back(make_pair("deferred/dofCombineF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gDeferredDoFCombineProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+		success = gDeferredDoFCombineProgram.createShader(NULL, NULL);
+	}
+
+	if (success)
+	{
 		gDeferredPostNoDoFProgram.mName = "Deferred Post Shader";
 		gDeferredPostNoDoFProgram.mShaderFiles.clear();
-		gDeferredPostNoDoFProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredV.glsl", GL_VERTEX_SHADER_ARB));
-		gDeferredPostNoDoFProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB));
+		gDeferredPostNoDoFProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER_ARB));
+		gDeferredPostNoDoFProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoDoFF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gDeferredPostNoDoFProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
 		success = gDeferredPostNoDoFProgram.createShader(NULL, NULL);
 	}
@@ -1601,70 +1527,15 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 		success = gDeferredStarProgram.createShader(NULL, &mWLUniforms);
 	}
 
-	if (mVertexShaderLevel[SHADER_DEFERRED] > 1)
-	{
-		if (success)
-		{
-			std::string fragment;
-			if (multisample)
-			{
-				fragment = "deferred/edgeMSF.glsl";
-			}
-			else
-			{
-				fragment = "deferred/edgeF.glsl";
-			}
-
-			gDeferredEdgeProgram.mName = "Deferred Edge Shader";
-			gDeferredEdgeProgram.mShaderFiles.clear();
-			gDeferredEdgeProgram.mShaderFiles.push_back(make_pair("deferred/edgeV.glsl", GL_VERTEX_SHADER_ARB));
-			gDeferredEdgeProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB));
-			gDeferredEdgeProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
-			success = gDeferredEdgeProgram.createShader(NULL, NULL);
-		}
-	}
-
-	if (mVertexShaderLevel[SHADER_DEFERRED] > 2)
+	if (success)
 	{
-		if (success)
-		{
-			gDeferredPostGIProgram.mName = "Deferred Post GI Shader";
-			gDeferredPostGIProgram.mShaderFiles.clear();
-			gDeferredPostGIProgram.mShaderFiles.push_back(make_pair("deferred/postgiV.glsl", GL_VERTEX_SHADER_ARB));
-			gDeferredPostGIProgram.mShaderFiles.push_back(make_pair("deferred/postgiF.glsl", GL_FRAGMENT_SHADER_ARB));
-			gDeferredPostGIProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
-			success = gDeferredPostGIProgram.createShader(NULL, NULL);
-		}
-
-		if (success)
-		{
-			gDeferredGIProgram.mName = "Deferred GI Shader";
-			gDeferredGIProgram.mShaderFiles.clear();
-			gDeferredGIProgram.mShaderFiles.push_back(make_pair("deferred/giV.glsl", GL_VERTEX_SHADER_ARB));
-			gDeferredGIProgram.mShaderFiles.push_back(make_pair("deferred/giF.glsl", GL_FRAGMENT_SHADER_ARB));
-			gDeferredGIProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
-			success = gDeferredGIProgram.createShader(NULL, NULL);
-		}
-
-		if (success)
-		{
-			gDeferredGIFinalProgram.mName = "Deferred GI Final Shader";
-			gDeferredGIFinalProgram.mShaderFiles.clear();
-			gDeferredGIFinalProgram.mShaderFiles.push_back(make_pair("deferred/giFinalV.glsl", GL_VERTEX_SHADER_ARB));
-			gDeferredGIFinalProgram.mShaderFiles.push_back(make_pair("deferred/giFinalF.glsl", GL_FRAGMENT_SHADER_ARB));
-			gDeferredGIFinalProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
-			success = gDeferredGIFinalProgram.createShader(NULL, NULL);
-		}
-
-		if (success)
-		{
-			gLuminanceGatherProgram.mName = "Luminance Gather Shader";
-			gLuminanceGatherProgram.mShaderFiles.clear();
-			gLuminanceGatherProgram.mShaderFiles.push_back(make_pair("deferred/luminanceV.glsl", GL_VERTEX_SHADER_ARB));
-			gLuminanceGatherProgram.mShaderFiles.push_back(make_pair("deferred/luminanceF.glsl", GL_FRAGMENT_SHADER_ARB));
-			gLuminanceGatherProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
-			success = gLuminanceGatherProgram.createShader(NULL, NULL);
-		}
+		gNormalMapGenProgram.mName = "Normal Map Generation Program";
+		gNormalMapGenProgram.mShaderFiles.clear();
+		gNormalMapGenProgram.mShaderFiles.push_back(make_pair("deferred/normgenV.glsl", GL_VERTEX_SHADER_ARB));
+		gNormalMapGenProgram.mShaderFiles.push_back(make_pair("deferred/normgenF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gNormalMapGenProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+		gNormalMapGenProgram.mShaderGroup = LLGLSLShader::SG_SKY;
+		success = gNormalMapGenProgram.createShader(NULL, NULL);
 	}
 
 	return success;
@@ -1680,12 +1551,17 @@ BOOL LLViewerShaderMgr::loadShadersObject()
 		gObjectFullbrightShinyProgram.unload();
 		gObjectFullbrightShinyWaterProgram.unload();
 		gObjectShinyWaterProgram.unload();
+		gObjectFullbrightNoColorProgram.unload();
+		gObjectFullbrightNoColorWaterProgram.unload();
 		gObjectSimpleProgram.unload();
+		gObjectPreviewProgram.unload();
 		gImpostorProgram.unload();
 		gObjectSimpleAlphaMaskProgram.unload();
 		gObjectBumpProgram.unload();
 		gObjectSimpleWaterProgram.unload();
 		gObjectSimpleWaterAlphaMaskProgram.unload();
+		gObjectEmissiveProgram.unload();
+		gObjectEmissiveWaterProgram.unload();
 		gObjectFullbrightProgram.unload();
 		gObjectFullbrightAlphaMaskProgram.unload();
 		gObjectFullbrightWaterProgram.unload();
@@ -1694,20 +1570,29 @@ BOOL LLViewerShaderMgr::loadShadersObject()
 		gObjectFullbrightShinyNonIndexedProgram.unload();
 		gObjectFullbrightShinyNonIndexedWaterProgram.unload();
 		gObjectShinyNonIndexedWaterProgram.unload();
-		gObjectSimpleNonIndexedProgram.unload();
+		gObjectSimpleNonIndexedTexGenProgram.unload();
+		gObjectSimpleNonIndexedTexGenWaterProgram.unload();
 		gObjectSimpleNonIndexedWaterProgram.unload();
 		gObjectAlphaMaskNonIndexedProgram.unload();
 		gObjectAlphaMaskNonIndexedWaterProgram.unload();
+		gObjectAlphaMaskNoColorProgram.unload();
+		gObjectAlphaMaskNoColorWaterProgram.unload();
 		gObjectFullbrightNonIndexedProgram.unload();
 		gObjectFullbrightNonIndexedWaterProgram.unload();
+		gObjectEmissiveNonIndexedProgram.unload();
+		gObjectEmissiveNonIndexedWaterProgram.unload();
 		gSkinnedObjectSimpleProgram.unload();
 		gSkinnedObjectFullbrightProgram.unload();
+		gSkinnedObjectEmissiveProgram.unload();
 		gSkinnedObjectFullbrightShinyProgram.unload();
 		gSkinnedObjectShinySimpleProgram.unload();
 		gSkinnedObjectSimpleWaterProgram.unload();
 		gSkinnedObjectFullbrightWaterProgram.unload();
+		gSkinnedObjectEmissiveWaterProgram.unload();
 		gSkinnedObjectFullbrightShinyWaterProgram.unload();
 		gSkinnedObjectShinySimpleWaterProgram.unload();
+		gTreeProgram.unload();
+		gTreeWaterProgram.unload();
 	
 		return TRUE;
 	}
@@ -1728,6 +1613,23 @@ BOOL LLViewerShaderMgr::loadShadersObject()
 		success = gObjectSimpleNonIndexedProgram.createShader(NULL, NULL);
 	}
 	
+	if (success)
+	{
+		gObjectSimpleNonIndexedTexGenProgram.mName = "Non indexed tex-gen Shader";
+		gObjectSimpleNonIndexedTexGenProgram.mFeatures.calculatesLighting = true;
+		gObjectSimpleNonIndexedTexGenProgram.mFeatures.calculatesAtmospherics = true;
+		gObjectSimpleNonIndexedTexGenProgram.mFeatures.hasGamma = true;
+		gObjectSimpleNonIndexedTexGenProgram.mFeatures.hasAtmospherics = true;
+		gObjectSimpleNonIndexedTexGenProgram.mFeatures.hasLighting = true;
+		gObjectSimpleNonIndexedTexGenProgram.mFeatures.disableTextureIndex = true;
+		gObjectSimpleNonIndexedTexGenProgram.mShaderFiles.clear();
+		gObjectSimpleNonIndexedTexGenProgram.mShaderFiles.push_back(make_pair("objects/simpleTexGenV.glsl", GL_VERTEX_SHADER_ARB));
+		gObjectSimpleNonIndexedTexGenProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gObjectSimpleNonIndexedTexGenProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+		success = gObjectSimpleNonIndexedTexGenProgram.createShader(NULL, NULL);
+	}
+	
+
 	if (success)
 	{
 		gObjectSimpleNonIndexedWaterProgram.mName = "Non indexed Water Shader";
@@ -1745,6 +1647,23 @@ BOOL LLViewerShaderMgr::loadShadersObject()
 		success = gObjectSimpleNonIndexedWaterProgram.createShader(NULL, NULL);
 	}
 
+	if (success)
+	{
+		gObjectSimpleNonIndexedTexGenWaterProgram.mName = "Non indexed tex-gen Water Shader";
+		gObjectSimpleNonIndexedTexGenWaterProgram.mFeatures.calculatesLighting = true;
+		gObjectSimpleNonIndexedTexGenWaterProgram.mFeatures.calculatesAtmospherics = true;
+		gObjectSimpleNonIndexedTexGenWaterProgram.mFeatures.hasWaterFog = true;
+		gObjectSimpleNonIndexedTexGenWaterProgram.mFeatures.hasAtmospherics = true;
+		gObjectSimpleNonIndexedTexGenWaterProgram.mFeatures.hasLighting = true;
+		gObjectSimpleNonIndexedTexGenWaterProgram.mFeatures.disableTextureIndex = true;
+		gObjectSimpleNonIndexedTexGenWaterProgram.mShaderFiles.clear();
+		gObjectSimpleNonIndexedTexGenWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleTexGenV.glsl", GL_VERTEX_SHADER_ARB));
+		gObjectSimpleNonIndexedTexGenWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gObjectSimpleNonIndexedTexGenWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+		gObjectSimpleNonIndexedTexGenWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+		success = gObjectSimpleNonIndexedTexGenWaterProgram.createShader(NULL, NULL);
+	}
+
 	if (success)
 	{
 		gObjectAlphaMaskNonIndexedProgram.mName = "Non indexed alpha mask Shader";
@@ -1756,7 +1675,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
 		gObjectAlphaMaskNonIndexedProgram.mFeatures.disableTextureIndex = true;
 		gObjectAlphaMaskNonIndexedProgram.mFeatures.hasAlphaMask = true;
 		gObjectAlphaMaskNonIndexedProgram.mShaderFiles.clear();
-		gObjectAlphaMaskNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
+		gObjectAlphaMaskNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/simpleNonIndexedV.glsl", GL_VERTEX_SHADER_ARB));
 		gObjectAlphaMaskNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gObjectAlphaMaskNonIndexedProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
 		success = gObjectAlphaMaskNonIndexedProgram.createShader(NULL, NULL);
@@ -1773,13 +1692,83 @@ BOOL LLViewerShaderMgr::loadShadersObject()
 		gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.disableTextureIndex = true;
 		gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.hasAlphaMask = true;
 		gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.clear();
-		gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
+		gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleNonIndexedV.glsl", GL_VERTEX_SHADER_ARB));
 		gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gObjectAlphaMaskNonIndexedWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
 		gObjectAlphaMaskNonIndexedWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
 		success = gObjectAlphaMaskNonIndexedWaterProgram.createShader(NULL, NULL);
 	}
 
+	if (success)
+	{
+		gObjectAlphaMaskNoColorProgram.mName = "No color alpha mask Shader";
+		gObjectAlphaMaskNoColorProgram.mFeatures.calculatesLighting = true;
+		gObjectAlphaMaskNoColorProgram.mFeatures.calculatesAtmospherics = true;
+		gObjectAlphaMaskNoColorProgram.mFeatures.hasGamma = true;
+		gObjectAlphaMaskNoColorProgram.mFeatures.hasAtmospherics = true;
+		gObjectAlphaMaskNoColorProgram.mFeatures.hasLighting = true;
+		gObjectAlphaMaskNoColorProgram.mFeatures.disableTextureIndex = true;
+		gObjectAlphaMaskNoColorProgram.mFeatures.hasAlphaMask = true;
+		gObjectAlphaMaskNoColorProgram.mShaderFiles.clear();
+		gObjectAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("objects/simpleNoColorV.glsl", GL_VERTEX_SHADER_ARB));
+		gObjectAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gObjectAlphaMaskNoColorProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+		success = gObjectAlphaMaskNoColorProgram.createShader(NULL, NULL);
+	}
+	
+	if (success)
+	{
+		gObjectAlphaMaskNoColorWaterProgram.mName = "No color alpha mask Water Shader";
+		gObjectAlphaMaskNoColorWaterProgram.mFeatures.calculatesLighting = true;
+		gObjectAlphaMaskNoColorWaterProgram.mFeatures.calculatesAtmospherics = true;
+		gObjectAlphaMaskNoColorWaterProgram.mFeatures.hasWaterFog = true;
+		gObjectAlphaMaskNoColorWaterProgram.mFeatures.hasAtmospherics = true;
+		gObjectAlphaMaskNoColorWaterProgram.mFeatures.hasLighting = true;
+		gObjectAlphaMaskNoColorWaterProgram.mFeatures.disableTextureIndex = true;
+		gObjectAlphaMaskNoColorWaterProgram.mFeatures.hasAlphaMask = true;
+		gObjectAlphaMaskNoColorWaterProgram.mShaderFiles.clear();
+		gObjectAlphaMaskNoColorWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleNoColorV.glsl", GL_VERTEX_SHADER_ARB));
+		gObjectAlphaMaskNoColorWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gObjectAlphaMaskNoColorWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+		gObjectAlphaMaskNoColorWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+		success = gObjectAlphaMaskNoColorWaterProgram.createShader(NULL, NULL);
+	}
+
+	if (success)
+	{
+		gTreeProgram.mName = "Tree Shader";
+		gTreeProgram.mFeatures.calculatesLighting = true;
+		gTreeProgram.mFeatures.calculatesAtmospherics = true;
+		gTreeProgram.mFeatures.hasGamma = true;
+		gTreeProgram.mFeatures.hasAtmospherics = true;
+		gTreeProgram.mFeatures.hasLighting = true;
+		gTreeProgram.mFeatures.disableTextureIndex = true;
+		gTreeProgram.mFeatures.hasAlphaMask = true;
+		gTreeProgram.mShaderFiles.clear();
+		gTreeProgram.mShaderFiles.push_back(make_pair("objects/treeV.glsl", GL_VERTEX_SHADER_ARB));
+		gTreeProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gTreeProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+		success = gTreeProgram.createShader(NULL, NULL);
+	}
+	
+	if (success)
+	{
+		gTreeWaterProgram.mName = "Tree Water Shader";
+		gTreeWaterProgram.mFeatures.calculatesLighting = true;
+		gTreeWaterProgram.mFeatures.calculatesAtmospherics = true;
+		gTreeWaterProgram.mFeatures.hasWaterFog = true;
+		gTreeWaterProgram.mFeatures.hasAtmospherics = true;
+		gTreeWaterProgram.mFeatures.hasLighting = true;
+		gTreeWaterProgram.mFeatures.disableTextureIndex = true;
+		gTreeWaterProgram.mFeatures.hasAlphaMask = true;
+		gTreeWaterProgram.mShaderFiles.clear();
+		gTreeWaterProgram.mShaderFiles.push_back(make_pair("objects/treeV.glsl", GL_VERTEX_SHADER_ARB));
+		gTreeWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gTreeWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+		gTreeWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+		success = gTreeWaterProgram.createShader(NULL, NULL);
+	}
+
 	if (success)
 	{
 		gObjectFullbrightNonIndexedProgram.mName = "Non Indexed Fullbright Shader";
@@ -1811,6 +1800,68 @@ BOOL LLViewerShaderMgr::loadShadersObject()
 		success = gObjectFullbrightNonIndexedWaterProgram.createShader(NULL, NULL);
 	}
 
+	if (success)
+	{
+		gObjectEmissiveNonIndexedProgram.mName = "Non Indexed Emissive Shader";
+		gObjectEmissiveNonIndexedProgram.mFeatures.calculatesAtmospherics = true;
+		gObjectEmissiveNonIndexedProgram.mFeatures.hasGamma = true;
+		gObjectEmissiveNonIndexedProgram.mFeatures.hasTransport = true;
+		gObjectEmissiveNonIndexedProgram.mFeatures.isFullbright = true;
+		gObjectEmissiveNonIndexedProgram.mFeatures.disableTextureIndex = true;
+		gObjectEmissiveNonIndexedProgram.mShaderFiles.clear();
+		gObjectEmissiveNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/emissiveV.glsl", GL_VERTEX_SHADER_ARB));
+		gObjectEmissiveNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gObjectEmissiveNonIndexedProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+		success = gObjectEmissiveNonIndexedProgram.createShader(NULL, NULL);
+	}
+
+	if (success)
+	{
+		gObjectEmissiveNonIndexedWaterProgram.mName = "Non Indexed Emissive Water Shader";
+		gObjectEmissiveNonIndexedWaterProgram.mFeatures.calculatesAtmospherics = true;
+		gObjectEmissiveNonIndexedWaterProgram.mFeatures.isFullbright = true;
+		gObjectEmissiveNonIndexedWaterProgram.mFeatures.hasWaterFog = true;		
+		gObjectEmissiveNonIndexedWaterProgram.mFeatures.hasTransport = true;
+		gObjectEmissiveNonIndexedWaterProgram.mFeatures.disableTextureIndex = true;
+		gObjectEmissiveNonIndexedWaterProgram.mShaderFiles.clear();
+		gObjectEmissiveNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/emissiveV.glsl", GL_VERTEX_SHADER_ARB));
+		gObjectEmissiveNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gObjectEmissiveNonIndexedWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+		gObjectEmissiveNonIndexedWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+		success = gObjectEmissiveNonIndexedWaterProgram.createShader(NULL, NULL);
+	}
+
+	if (success)
+	{
+		gObjectFullbrightNoColorProgram.mName = "Non Indexed no color Fullbright Shader";
+		gObjectFullbrightNoColorProgram.mFeatures.calculatesAtmospherics = true;
+		gObjectFullbrightNoColorProgram.mFeatures.hasGamma = true;
+		gObjectFullbrightNoColorProgram.mFeatures.hasTransport = true;
+		gObjectFullbrightNoColorProgram.mFeatures.isFullbright = true;
+		gObjectFullbrightNoColorProgram.mFeatures.disableTextureIndex = true;
+		gObjectFullbrightNoColorProgram.mShaderFiles.clear();
+		gObjectFullbrightNoColorProgram.mShaderFiles.push_back(make_pair("objects/fullbrightNoColorV.glsl", GL_VERTEX_SHADER_ARB));
+		gObjectFullbrightNoColorProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gObjectFullbrightNoColorProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+		success = gObjectFullbrightNoColorProgram.createShader(NULL, NULL);
+	}
+
+	if (success)
+	{
+		gObjectFullbrightNoColorWaterProgram.mName = "Non Indexed no color Fullbright Water Shader";
+		gObjectFullbrightNoColorWaterProgram.mFeatures.calculatesAtmospherics = true;
+		gObjectFullbrightNoColorWaterProgram.mFeatures.isFullbright = true;
+		gObjectFullbrightNoColorWaterProgram.mFeatures.hasWaterFog = true;		
+		gObjectFullbrightNoColorWaterProgram.mFeatures.hasTransport = true;
+		gObjectFullbrightNoColorWaterProgram.mFeatures.disableTextureIndex = true;
+		gObjectFullbrightNoColorWaterProgram.mShaderFiles.clear();
+		gObjectFullbrightNoColorWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightNoColorV.glsl", GL_VERTEX_SHADER_ARB));
+		gObjectFullbrightNoColorWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gObjectFullbrightNoColorWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+		gObjectFullbrightNoColorWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+		success = gObjectFullbrightNoColorWaterProgram.createShader(NULL, NULL);
+	}
+
 	if (success)
 	{
 		gObjectShinyNonIndexedProgram.mName = "Non Indexed Shiny Shader";
@@ -1889,6 +1940,23 @@ BOOL LLViewerShaderMgr::loadShadersObject()
 		success = gImpostorProgram.createShader(NULL, NULL);
 	}
 
+	if (success)
+	{
+		gObjectPreviewProgram.mName = "Simple Shader";
+		gObjectPreviewProgram.mFeatures.calculatesLighting = true;
+		gObjectPreviewProgram.mFeatures.calculatesAtmospherics = true;
+		gObjectPreviewProgram.mFeatures.hasGamma = true;
+		gObjectPreviewProgram.mFeatures.hasAtmospherics = true;
+		gObjectPreviewProgram.mFeatures.hasLighting = true;
+		gObjectPreviewProgram.mFeatures.mIndexedTextureChannels = 0;
+		gObjectPreviewProgram.mFeatures.disableTextureIndex = true;
+		gObjectPreviewProgram.mShaderFiles.clear();
+		gObjectPreviewProgram.mShaderFiles.push_back(make_pair("objects/previewV.glsl", GL_VERTEX_SHADER_ARB));
+		gObjectPreviewProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gObjectPreviewProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+		success = gObjectPreviewProgram.createShader(NULL, NULL);
+	}
+
 	if (success)
 	{
 		gObjectSimpleProgram.mName = "Simple Shader";
@@ -1907,19 +1975,19 @@ BOOL LLViewerShaderMgr::loadShadersObject()
 
 	if (success)
 	{
-		gObjectSimpleAlphaMaskProgram.mName = "Simple Alpha Mask Shader";
-		gObjectSimpleAlphaMaskProgram.mFeatures.calculatesLighting = true;
-		gObjectSimpleAlphaMaskProgram.mFeatures.calculatesAtmospherics = true;
-		gObjectSimpleAlphaMaskProgram.mFeatures.hasGamma = true;
-		gObjectSimpleAlphaMaskProgram.mFeatures.hasAtmospherics = true;
-		gObjectSimpleAlphaMaskProgram.mFeatures.hasLighting = true;
-		gObjectSimpleAlphaMaskProgram.mFeatures.hasAlphaMask = true;
-		gObjectSimpleAlphaMaskProgram.mFeatures.mIndexedTextureChannels = 0;
-		gObjectSimpleAlphaMaskProgram.mShaderFiles.clear();
-		gObjectSimpleAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
-		gObjectSimpleAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
-		gObjectSimpleAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
-		success = gObjectSimpleAlphaMaskProgram.createShader(NULL, NULL);
+		gObjectSimpleWaterProgram.mName = "Simple Water Shader";
+		gObjectSimpleWaterProgram.mFeatures.calculatesLighting = true;
+		gObjectSimpleWaterProgram.mFeatures.calculatesAtmospherics = true;
+		gObjectSimpleWaterProgram.mFeatures.hasWaterFog = true;
+		gObjectSimpleWaterProgram.mFeatures.hasAtmospherics = true;
+		gObjectSimpleWaterProgram.mFeatures.hasLighting = true;
+		gObjectSimpleWaterProgram.mFeatures.mIndexedTextureChannels = 0;
+		gObjectSimpleWaterProgram.mShaderFiles.clear();
+		gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
+		gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gObjectSimpleWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+		gObjectSimpleWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+		success = gObjectSimpleWaterProgram.createShader(NULL, NULL);
 	}
 	
 	if (success)
@@ -1936,25 +2004,34 @@ BOOL LLViewerShaderMgr::loadShadersObject()
 		gObjectBumpProgram.mShaderFiles.push_back(make_pair("objects/bumpF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gObjectBumpProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
 		success = gObjectBumpProgram.createShader(NULL, NULL);
+
+		if (success)
+		{ //lldrawpoolbump assumes "texture0" has channel 0 and "texture1" has channel 1
+			gObjectBumpProgram.bind();
+			gObjectBumpProgram.uniform1i("texture0", 0);
+			gObjectBumpProgram.uniform1i("texture1", 1);
+			gObjectBumpProgram.unbind();
+		}
 	}
 	
+	
 	if (success)
 	{
-		gObjectSimpleWaterProgram.mName = "Simple Water Shader";
-		gObjectSimpleWaterProgram.mFeatures.calculatesLighting = true;
-		gObjectSimpleWaterProgram.mFeatures.calculatesAtmospherics = true;
-		gObjectSimpleWaterProgram.mFeatures.hasWaterFog = true;
-		gObjectSimpleWaterProgram.mFeatures.hasAtmospherics = true;
-		gObjectSimpleWaterProgram.mFeatures.hasLighting = true;
-		gObjectSimpleWaterProgram.mFeatures.mIndexedTextureChannels = 0;
-		gObjectSimpleWaterProgram.mShaderFiles.clear();
-		gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
-		gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
-		gObjectSimpleWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
-		gObjectSimpleWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
-		success = gObjectSimpleWaterProgram.createShader(NULL, NULL);
+		gObjectSimpleAlphaMaskProgram.mName = "Simple Alpha Mask Shader";
+		gObjectSimpleAlphaMaskProgram.mFeatures.calculatesLighting = true;
+		gObjectSimpleAlphaMaskProgram.mFeatures.calculatesAtmospherics = true;
+		gObjectSimpleAlphaMaskProgram.mFeatures.hasGamma = true;
+		gObjectSimpleAlphaMaskProgram.mFeatures.hasAtmospherics = true;
+		gObjectSimpleAlphaMaskProgram.mFeatures.hasLighting = true;
+		gObjectSimpleAlphaMaskProgram.mFeatures.hasAlphaMask = true;
+		gObjectSimpleAlphaMaskProgram.mFeatures.mIndexedTextureChannels = 0;
+		gObjectSimpleAlphaMaskProgram.mShaderFiles.clear();
+		gObjectSimpleAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
+		gObjectSimpleAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gObjectSimpleAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+		success = gObjectSimpleAlphaMaskProgram.createShader(NULL, NULL);
 	}
-	
+
 	if (success)
 	{
 		gObjectSimpleWaterAlphaMaskProgram.mName = "Simple Water Alpha Mask Shader";
@@ -2004,6 +2081,37 @@ BOOL LLViewerShaderMgr::loadShadersObject()
 		success = gObjectFullbrightWaterProgram.createShader(NULL, NULL);
 	}
 
+	if (success)
+	{
+		gObjectEmissiveProgram.mName = "Emissive Shader";
+		gObjectEmissiveProgram.mFeatures.calculatesAtmospherics = true;
+		gObjectEmissiveProgram.mFeatures.hasGamma = true;
+		gObjectEmissiveProgram.mFeatures.hasTransport = true;
+		gObjectEmissiveProgram.mFeatures.isFullbright = true;
+		gObjectEmissiveProgram.mFeatures.mIndexedTextureChannels = 0;
+		gObjectEmissiveProgram.mShaderFiles.clear();
+		gObjectEmissiveProgram.mShaderFiles.push_back(make_pair("objects/emissiveV.glsl", GL_VERTEX_SHADER_ARB));
+		gObjectEmissiveProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gObjectEmissiveProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+		success = gObjectEmissiveProgram.createShader(NULL, NULL);
+	}
+
+	if (success)
+	{
+		gObjectEmissiveWaterProgram.mName = "Emissive Water Shader";
+		gObjectEmissiveWaterProgram.mFeatures.calculatesAtmospherics = true;
+		gObjectEmissiveWaterProgram.mFeatures.isFullbright = true;
+		gObjectEmissiveWaterProgram.mFeatures.hasWaterFog = true;		
+		gObjectEmissiveWaterProgram.mFeatures.hasTransport = true;
+		gObjectEmissiveWaterProgram.mFeatures.mIndexedTextureChannels = 0;
+		gObjectEmissiveWaterProgram.mShaderFiles.clear();
+		gObjectEmissiveWaterProgram.mShaderFiles.push_back(make_pair("objects/emissiveV.glsl", GL_VERTEX_SHADER_ARB));
+		gObjectEmissiveWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gObjectEmissiveWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+		gObjectEmissiveWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+		success = gObjectEmissiveWaterProgram.createShader(NULL, NULL);
+	}
+
 	if (success)
 	{
 		gObjectFullbrightAlphaMaskProgram.mName = "Fullbright Alpha Mask Shader";
@@ -2139,6 +2247,39 @@ BOOL LLViewerShaderMgr::loadShadersObject()
 			success = gSkinnedObjectFullbrightProgram.createShader(NULL, NULL);
 		}
 
+		if (success)
+		{
+			gSkinnedObjectEmissiveProgram.mName = "Skinned Emissive Shader";
+			gSkinnedObjectEmissiveProgram.mFeatures.calculatesAtmospherics = true;
+			gSkinnedObjectEmissiveProgram.mFeatures.hasGamma = true;
+			gSkinnedObjectEmissiveProgram.mFeatures.hasTransport = true;
+			gSkinnedObjectEmissiveProgram.mFeatures.isFullbright = true;
+			gSkinnedObjectEmissiveProgram.mFeatures.hasObjectSkinning = true;
+			gSkinnedObjectEmissiveProgram.mFeatures.disableTextureIndex = true;
+			gSkinnedObjectEmissiveProgram.mShaderFiles.clear();
+			gSkinnedObjectEmissiveProgram.mShaderFiles.push_back(make_pair("objects/emissiveSkinnedV.glsl", GL_VERTEX_SHADER_ARB));
+			gSkinnedObjectEmissiveProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB));
+			gSkinnedObjectEmissiveProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+			success = gSkinnedObjectEmissiveProgram.createShader(NULL, NULL);
+		}
+
+		if (success)
+		{
+			gSkinnedObjectEmissiveWaterProgram.mName = "Skinned Emissive Water Shader";
+			gSkinnedObjectEmissiveWaterProgram.mFeatures.calculatesAtmospherics = true;
+			gSkinnedObjectEmissiveWaterProgram.mFeatures.hasGamma = true;
+			gSkinnedObjectEmissiveWaterProgram.mFeatures.hasTransport = true;
+			gSkinnedObjectEmissiveWaterProgram.mFeatures.isFullbright = true;
+			gSkinnedObjectEmissiveWaterProgram.mFeatures.hasObjectSkinning = true;
+			gSkinnedObjectEmissiveWaterProgram.mFeatures.disableTextureIndex = true;
+			gSkinnedObjectEmissiveWaterProgram.mFeatures.hasWaterFog = true;
+			gSkinnedObjectEmissiveWaterProgram.mShaderFiles.clear();
+			gSkinnedObjectEmissiveWaterProgram.mShaderFiles.push_back(make_pair("objects/emissiveSkinnedV.glsl", GL_VERTEX_SHADER_ARB));
+			gSkinnedObjectEmissiveWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+			gSkinnedObjectEmissiveWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+			success = gSkinnedObjectEmissiveWaterProgram.createShader(NULL, NULL);
+		}
+
 		if (success)
 		{
 			gSkinnedObjectFullbrightShinyProgram.mName = "Skinned Fullbright Shiny Shader";
@@ -2287,7 +2428,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar()
 		gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarV.glsl", GL_VERTEX_SHADER_ARB));
 		gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gAvatarProgram.mShaderLevel = mVertexShaderLevel[SHADER_AVATAR];
-		success = gAvatarProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+		success = gAvatarProgram.createShader(NULL, &mAvatarUniforms);
 			
 		if (success)
 		{
@@ -2306,7 +2447,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar()
 			// Note: no cloth under water:
 			gAvatarWaterProgram.mShaderLevel = llmin(mVertexShaderLevel[SHADER_AVATAR], 1);	
 			gAvatarWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;				
-			success = gAvatarWaterProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+			success = gAvatarWaterProgram.createShader(NULL, &mAvatarUniforms);
 		}
 
 		/// Keep track of avatar levels
@@ -2325,7 +2466,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar()
 		gAvatarPickProgram.mShaderFiles.push_back(make_pair("avatar/pickAvatarV.glsl", GL_VERTEX_SHADER_ARB));
 		gAvatarPickProgram.mShaderFiles.push_back(make_pair("avatar/pickAvatarF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gAvatarPickProgram.mShaderLevel = mVertexShaderLevel[SHADER_AVATAR];
-		success = gAvatarPickProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+		success = gAvatarPickProgram.createShader(NULL, &mAvatarUniforms);
 	}
 
 	if (success)
@@ -2396,6 +2537,22 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
 		success = gCustomAlphaProgram.createShader(NULL, NULL);
 	}
 
+	if (success)
+	{
+		gSplatTextureRectProgram.mName = "Splat Texture Rect Shader";
+		gSplatTextureRectProgram.mShaderFiles.clear();
+		gSplatTextureRectProgram.mShaderFiles.push_back(make_pair("interface/splattexturerectV.glsl", GL_VERTEX_SHADER_ARB));
+		gSplatTextureRectProgram.mShaderFiles.push_back(make_pair("interface/splattexturerectF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gSplatTextureRectProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
+		success = gSplatTextureRectProgram.createShader(NULL, NULL);
+		if (success)
+		{
+			gSplatTextureRectProgram.bind();
+			gSplatTextureRectProgram.uniform1i("screenMap", 0);
+			gSplatTextureRectProgram.unbind();
+		}
+	}
+
 	if (success)
 	{
 		gGlowCombineProgram.mName = "Glow Combine Shader";
@@ -2413,6 +2570,24 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
 		}
 	}
 
+	if (success)
+	{
+		gGlowCombineFXAAProgram.mName = "Glow CombineFXAA Shader";
+		gGlowCombineFXAAProgram.mShaderFiles.clear();
+		gGlowCombineFXAAProgram.mShaderFiles.push_back(make_pair("interface/glowcombineFXAAV.glsl", GL_VERTEX_SHADER_ARB));
+		gGlowCombineFXAAProgram.mShaderFiles.push_back(make_pair("interface/glowcombineFXAAF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gGlowCombineFXAAProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
+		success = gGlowCombineFXAAProgram.createShader(NULL, NULL);
+		if (success)
+		{
+			gGlowCombineFXAAProgram.bind();
+			gGlowCombineFXAAProgram.uniform1i("glowMap", 0);
+			gGlowCombineFXAAProgram.uniform1i("screenMap", 1);
+			gGlowCombineFXAAProgram.unbind();
+		}
+	}
+
+
 	if (success)
 	{
 		gTwoTextureAddProgram.mName = "Two Texture Add Shader";
@@ -2429,6 +2604,21 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
 		}
 	}
 
+	if (success)
+	{
+		gOneTextureNoColorProgram.mName = "One Texture No Color Shader";
+		gOneTextureNoColorProgram.mShaderFiles.clear();
+		gOneTextureNoColorProgram.mShaderFiles.push_back(make_pair("interface/onetexturenocolorV.glsl", GL_VERTEX_SHADER_ARB));
+		gOneTextureNoColorProgram.mShaderFiles.push_back(make_pair("interface/onetexturenocolorF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gOneTextureNoColorProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
+		success = gOneTextureNoColorProgram.createShader(NULL, NULL);
+		if (success)
+		{
+			gOneTextureNoColorProgram.bind();
+			gOneTextureNoColorProgram.uniform1i("tex0", 0);
+		}
+	}
+
 	if (success)
 	{
 		gSolidColorProgram.mName = "Solid Color Shader";
@@ -2455,6 +2645,26 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
 		success = gOcclusionProgram.createShader(NULL, NULL);
 	}
 
+	if (success)
+	{
+		gDebugProgram.mName = "Debug Shader";
+		gDebugProgram.mShaderFiles.clear();
+		gDebugProgram.mShaderFiles.push_back(make_pair("interface/debugV.glsl", GL_VERTEX_SHADER_ARB));
+		gDebugProgram.mShaderFiles.push_back(make_pair("interface/debugF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gDebugProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
+		success = gDebugProgram.createShader(NULL, NULL);
+	}
+
+	if (success)
+	{
+		gAlphaMaskProgram.mName = "Alpha Mask Shader";
+		gAlphaMaskProgram.mShaderFiles.clear();
+		gAlphaMaskProgram.mShaderFiles.push_back(make_pair("interface/alphamaskV.glsl", GL_VERTEX_SHADER_ARB));
+		gAlphaMaskProgram.mShaderFiles.push_back(make_pair("interface/alphamaskF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
+		success = gAlphaMaskProgram.createShader(NULL, NULL);
+	}
+
 	if( !success )
 	{
 		mVertexShaderLevel[SHADER_INTERFACE] = 0;
diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h
index d4040f11e1ffcf7344213ff0353309f3618bb626..95eb551bf1ba6837f1c8e98762ae3863f41a99ec 100644
--- a/indra/newview/llviewershadermgr.h
+++ b/indra/newview/llviewershadermgr.h
@@ -33,6 +33,7 @@ class LLViewerShaderMgr: public LLShaderMgr
 {
 public:
 	static BOOL sInitialized;
+	static bool sSkipReload;
 
 	LLViewerShaderMgr();
 	/* virtual */ ~LLViewerShaderMgr();
@@ -71,76 +72,6 @@ class LLViewerShaderMgr: public LLShaderMgr
 		SHADER_COUNT
 	};
 
-	typedef enum 
-	{
-		MATERIAL_COLOR = 0,
-		SPECULAR_COLOR,
-		BINORMAL,
-		OBJECT_WEIGHT,
-		END_RESERVED_ATTRIBS
-	} eGLSLReservedAttribs;
-	
-	typedef enum
-	{
-		DIFFUSE_MAP = 0,
-		SPECULAR_MAP,
-		BUMP_MAP,
-		ENVIRONMENT_MAP,
-		CLOUD_NOISE_MAP,
-		FULLBRIGHT,
-		LIGHTNORM,
-		SUNLIGHT_COLOR,
-		AMBIENT,
-		BLUE_HORIZON,
-		BLUE_DENSITY,
-		HAZE_HORIZON,
-		HAZE_DENSITY,
-		CLOUD_SHADOW,
-		DENSITY_MULTIPLIER,
-		DISTANCE_MULTIPLIER,
-		MAX_Y,
-		GLOW,
-		CLOUD_COLOR,
-		CLOUD_POS_DENSITY1,
-		CLOUD_POS_DENSITY2,
-		CLOUD_SCALE,
-		GAMMA,
-		SCENE_LIGHT_STRENGTH,
-		DEFERRED_DEPTH,
-		DEFERRED_SHADOW0,
-		DEFERRED_SHADOW1,
-		DEFERRED_SHADOW2,
-		DEFERRED_SHADOW3,
-		DEFERRED_SHADOW4,
-		DEFERRED_SHADOW5,
-		DEFERRED_NORMAL,
-		DEFERRED_POSITION,
-		DEFERRED_DIFFUSE,
-		DEFERRED_SPECULAR,
-		DEFERRED_NOISE,
-		DEFERRED_LIGHTFUNC,
-		DEFERRED_LIGHT,
-		DEFERRED_LUMINANCE,
-		DEFERRED_GI_LIGHT,
-		DEFERRED_GI_MIP,
-		DEFERRED_EDGE,
-		DEFERRED_BLOOM,
-		DEFERRED_SUN_LIGHT,
-		DEFERRED_LOCAL_LIGHT,
-		DEFERRED_PROJECTION,
-		DEFERRED_GI_DIFFUSE,
-		DEFERRED_GI_SPECULAR,
-		DEFERRED_GI_NORMAL,
-		DEFERRED_GI_MIN_POS,
-		DEFERRED_GI_MAX_POS,
-		DEFERRED_GI_DEPTH,
-		DEFERRED_GI_LAST_DIFFUSE,
-		DEFERRED_GI_LAST_NORMAL,
-		DEFERRED_GI_LAST_MIN_POS,
-		DEFERRED_GI_LAST_MAX_POS,
-		END_RESERVED_UNIFORMS
-	} eGLSLReservedUniforms;
-
 	typedef enum
 	{
 		SHINY_ORIGIN = END_RESERVED_UNIFORMS
@@ -186,16 +117,10 @@ class LLViewerShaderMgr: public LLShaderMgr
 
 	typedef enum
 	{
-		AVATAR_WEIGHT = END_RESERVED_ATTRIBS,
-		AVATAR_CLOTHING,
+		AVATAR_MATRIX = END_RESERVED_UNIFORMS,
 		AVATAR_WIND,
 		AVATAR_SINWAVE,
-		AVATAR_GRAVITY
-	} eAvatarAttribs;
-
-	typedef enum
-	{
-		AVATAR_MATRIX = END_RESERVED_UNIFORMS
+		AVATAR_GRAVITY,
 	} eAvatarUniforms;
 
 	// simple model of forward iterator
@@ -265,9 +190,6 @@ class LLViewerShaderMgr: public LLShaderMgr
 
 	std::vector<std::string> mGlowExtractUniforms;
 
-	//avatar shader parameter tables
-	std::vector<std::string> mAvatarAttribs;
-
 	std::vector<std::string> mAvatarUniforms;
 
 	// the list of shaders we need to propagate parameters to.
@@ -291,26 +213,45 @@ extern LLVector4			gShinyOrigin;
 extern LLGLSLShader			gOcclusionProgram;
 extern LLGLSLShader			gCustomAlphaProgram;
 extern LLGLSLShader			gGlowCombineProgram;
+extern LLGLSLShader			gSplatTextureRectProgram;
+extern LLGLSLShader			gGlowCombineFXAAProgram;
+extern LLGLSLShader			gDebugProgram;
+extern LLGLSLShader			gAlphaMaskProgram;
 
 //output tex0[tc0] + tex1[tc1]
 extern LLGLSLShader			gTwoTextureAddProgram;
-								
+						
+extern LLGLSLShader			gOneTextureNoColorProgram;
+
 //object shaders
 extern LLGLSLShader			gObjectSimpleProgram;
+extern LLGLSLShader			gObjectPreviewProgram;
 extern LLGLSLShader			gObjectSimpleAlphaMaskProgram;
 extern LLGLSLShader			gObjectSimpleWaterProgram;
 extern LLGLSLShader			gObjectSimpleWaterAlphaMaskProgram;
 extern LLGLSLShader			gObjectSimpleNonIndexedProgram;
+extern LLGLSLShader			gObjectSimpleNonIndexedTexGenProgram;
+extern LLGLSLShader			gObjectSimpleNonIndexedTexGenWaterProgram;
 extern LLGLSLShader			gObjectSimpleNonIndexedWaterProgram;
 extern LLGLSLShader			gObjectAlphaMaskNonIndexedProgram;
 extern LLGLSLShader			gObjectAlphaMaskNonIndexedWaterProgram;
+extern LLGLSLShader			gObjectAlphaMaskNoColorProgram;
+extern LLGLSLShader			gObjectAlphaMaskNoColorWaterProgram;
 extern LLGLSLShader			gObjectFullbrightProgram;
 extern LLGLSLShader			gObjectFullbrightWaterProgram;
+extern LLGLSLShader			gObjectFullbrightNoColorProgram;
+extern LLGLSLShader			gObjectFullbrightNoColorWaterProgram;
+extern LLGLSLShader			gObjectEmissiveProgram;
+extern LLGLSLShader			gObjectEmissiveWaterProgram;
 extern LLGLSLShader			gObjectFullbrightAlphaMaskProgram;
 extern LLGLSLShader			gObjectFullbrightWaterAlphaMaskProgram;
 extern LLGLSLShader			gObjectFullbrightNonIndexedProgram;
 extern LLGLSLShader			gObjectFullbrightNonIndexedWaterProgram;
+extern LLGLSLShader			gObjectEmissiveNonIndexedProgram;
+extern LLGLSLShader			gObjectEmissiveNonIndexedWaterProgram;
 extern LLGLSLShader			gObjectBumpProgram;
+extern LLGLSLShader			gTreeProgram;
+extern LLGLSLShader			gTreeWaterProgram;
 
 extern LLGLSLShader			gObjectSimpleLODProgram;
 extern LLGLSLShader			gObjectFullbrightLODProgram;
@@ -327,11 +268,13 @@ extern LLGLSLShader			gObjectShinyNonIndexedWaterProgram;
 
 extern LLGLSLShader			gSkinnedObjectSimpleProgram;
 extern LLGLSLShader			gSkinnedObjectFullbrightProgram;
+extern LLGLSLShader			gSkinnedObjectEmissiveProgram;
 extern LLGLSLShader			gSkinnedObjectFullbrightShinyProgram;
 extern LLGLSLShader			gSkinnedObjectShinySimpleProgram;
 
 extern LLGLSLShader			gSkinnedObjectSimpleWaterProgram;
 extern LLGLSLShader			gSkinnedObjectFullbrightWaterProgram;
+extern LLGLSLShader			gSkinnedObjectEmissiveWaterProgram;
 extern LLGLSLShader			gSkinnedObjectFullbrightShinyWaterProgram;
 extern LLGLSLShader			gSkinnedObjectShinySimpleWaterProgram;
 
@@ -363,11 +306,11 @@ extern LLGLSLShader			gPostNightVisionProgram;
 
 // Deferred rendering shaders
 extern LLGLSLShader			gDeferredImpostorProgram;
-extern LLGLSLShader			gDeferredEdgeProgram;
 extern LLGLSLShader			gDeferredWaterProgram;
 extern LLGLSLShader			gDeferredDiffuseProgram;
 extern LLGLSLShader			gDeferredDiffuseAlphaMaskProgram;
 extern LLGLSLShader			gDeferredNonIndexedDiffuseAlphaMaskProgram;
+extern LLGLSLShader			gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram;
 extern LLGLSLShader			gDeferredNonIndexedDiffuseProgram;
 extern LLGLSLShader			gDeferredSkinnedDiffuseProgram;
 extern LLGLSLShader			gDeferredSkinnedBumpProgram;
@@ -375,34 +318,32 @@ extern LLGLSLShader			gDeferredSkinnedAlphaProgram;
 extern LLGLSLShader			gDeferredBumpProgram;
 extern LLGLSLShader			gDeferredTerrainProgram;
 extern LLGLSLShader			gDeferredTreeProgram;
+extern LLGLSLShader			gDeferredTreeShadowProgram;
 extern LLGLSLShader			gDeferredLightProgram;
 extern LLGLSLShader			gDeferredMultiLightProgram;
 extern LLGLSLShader			gDeferredSpotLightProgram;
 extern LLGLSLShader			gDeferredMultiSpotLightProgram;
 extern LLGLSLShader			gDeferredSunProgram;
-extern LLGLSLShader			gDeferredGIProgram;
-extern LLGLSLShader			gDeferredGIFinalProgram;
 extern LLGLSLShader			gDeferredBlurLightProgram;
 extern LLGLSLShader			gDeferredAvatarProgram;
 extern LLGLSLShader			gDeferredSoftenProgram;
 extern LLGLSLShader			gDeferredShadowProgram;
 extern LLGLSLShader			gDeferredShadowAlphaMaskProgram;
-extern LLGLSLShader			gDeferredPostGIProgram;
 extern LLGLSLShader			gDeferredPostProgram;
+extern LLGLSLShader			gDeferredCoFProgram;
+extern LLGLSLShader			gDeferredDoFCombineProgram;
+extern LLGLSLShader			gFXAAProgram;
 extern LLGLSLShader			gDeferredPostNoDoFProgram;
 extern LLGLSLShader			gDeferredAvatarShadowProgram;
 extern LLGLSLShader			gDeferredAttachmentShadowProgram;
 extern LLGLSLShader			gDeferredAlphaProgram;
 extern LLGLSLShader			gDeferredFullbrightProgram;
+extern LLGLSLShader			gDeferredEmissiveProgram;
 extern LLGLSLShader			gDeferredAvatarEyesProgram;
 extern LLGLSLShader			gDeferredAvatarAlphaProgram;
 extern LLGLSLShader			gDeferredWLSkyProgram;
 extern LLGLSLShader			gDeferredWLCloudProgram;
 extern LLGLSLShader			gDeferredStarProgram;
-extern LLGLSLShader			gLuminanceGatherProgram;
-
-//current avatar shader parameter pointer
-extern GLint				gAvatarMatrixParam;
-
+extern LLGLSLShader			gNormalMapGenProgram;
 
 #endif
diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp
index b41ed00f17c6da7bf62053b6476878c16ebdff2c..99102309a16fdd0fcdd3cdfa23929dcce44aa54a 100644
--- a/indra/newview/llviewertexteditor.cpp
+++ b/indra/newview/llviewertexteditor.cpp
@@ -187,7 +187,7 @@ class LLEmbeddedItemSegment : public LLTextSegment
 		else
 		{
 			width = EMBEDDED_ITEM_LABEL_PADDING + mImage->getWidth() + mStyle->getFont()->getWidth(mLabel.c_str());
-			height = llmax(mImage->getHeight(), llceil(mStyle->getFont()->getLineHeight()));
+			height = llmax(mImage->getHeight(), mStyle->getFont()->getLineHeight());
 		}
 		return false;
 	}
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 786e2b73b176b6bcb2d82acf35ad7d8a344585af..61236edc86e0e46ed4ef4c7ca2ebc0484c760a32 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -417,11 +417,24 @@ const S32 min_non_tex_system_mem = (128<<20); // 128 MB
 F32 texmem_lower_bound_scale = 0.85f;
 F32 texmem_middle_bound_scale = 0.925f;
 
+static LLFastTimer::DeclareTimer FTM_TEXTURE_MEMORY_CHECK("Memory Check");
+
 //static 
 bool LLViewerTexture::isMemoryForTextureLow()
 {
-	const static S32 MIN_FREE_TEXTURE_MEMORY = 5 ; //MB
-	const static S32 MIN_FREE_MAIN_MEMORy = 100 ; //MB
+	const F32 WAIT_TIME = 1.0f ; //second
+	static LLFrameTimer timer ;
+
+	if(timer.getElapsedTimeF32() < WAIT_TIME) //call this once per second.
+	{
+		return false;
+	}
+	timer.reset() ;
+
+	LLFastTimer t(FTM_TEXTURE_MEMORY_CHECK);
+
+	const S32 MIN_FREE_TEXTURE_MEMORY = 5 ; //MB
+	const S32 MIN_FREE_MAIN_MEMORy = 100 ; //MB	
 
 	bool low_mem = false ;
 	if (gGLManager.mHasATIMemInfo)
@@ -433,6 +446,15 @@ bool LLViewerTexture::isMemoryForTextureLow()
 		{
 			low_mem = true ;
 		}
+
+		if(!low_mem) //check main memory, only works for windows.
+		{
+			LLMemory::updateMemoryInfo() ;
+			if(LLMemory::getAvailableMemKB() / 1024 < MIN_FREE_MAIN_MEMORy)
+			{
+				low_mem = true ;
+			}
+		}
 	}
 #if 0  //ignore nVidia cards
 	else if (gGLManager.mHasNVXMemInfo)
@@ -445,20 +467,14 @@ bool LLViewerTexture::isMemoryForTextureLow()
 			low_mem = true ;
 		}
 	}
-#endif
-
-	if(!low_mem) //check main memory, only works for windows.
-	{
-		LLMemory::updateMemoryInfo() ;
-		if(LLMemory::getAvailableMemKB() / 1024 < MIN_FREE_MAIN_MEMORy)
-		{
-			low_mem = true ;
-		}
-	}
+#endif	
 
 	return low_mem ;
 }
 
+static LLFastTimer::DeclareTimer FTM_TEXTURE_UPDATE_MEDIA("Media");
+static LLFastTimer::DeclareTimer FTM_TEXTURE_UPDATE_TEST("Test");
+
 //static
 void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity)
 {
@@ -467,9 +483,14 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity
 	LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
 	if (tester)
 	{
+		LLFastTimer t(FTM_TEXTURE_UPDATE_TEST);
 		tester->update() ;
 	}
-	LLViewerMediaTexture::updateClass() ;
+
+	{
+		LLFastTimer t(FTM_TEXTURE_UPDATE_MEDIA);
+		LLViewerMediaTexture::updateClass() ;
+	}
 
 	sBoundTextureMemoryInBytes = LLImageGL::sBoundTextureMemoryInBytes;//in bytes
 	sTotalTextureMemoryInBytes = LLImageGL::sGlobalTextureMemoryInBytes;//in bytes
@@ -2269,6 +2290,7 @@ void LLViewerFetchedTexture::unpauseLoadedCallbacks(const LLLoadedCallbackEntry:
 		}
 	}
 	mPauseLoadedCallBacks = FALSE ;
+	mLastCallBackActiveTime = sCurrentTime ;
 	if(need_raw)
 	{
 		mSaveRawImage = TRUE ;
@@ -2308,13 +2330,18 @@ void LLViewerFetchedTexture::pauseLoadedCallbacks(const LLLoadedCallbackEntry::s
 
 bool LLViewerFetchedTexture::doLoadedCallbacks()
 {
-	static const F32 MAX_INACTIVE_TIME = 120.f ; //seconds
+	static const F32 MAX_INACTIVE_TIME = 900.f ; //seconds
 
 	if (mNeedsCreateTexture)
 	{
 		return false;
 	}
-	if(sCurrentTime - mLastCallBackActiveTime > MAX_INACTIVE_TIME)
+	if(mPauseLoadedCallBacks)
+	{
+		destroyRawImage();
+		return false; //paused
+	}	
+	if(sCurrentTime - mLastCallBackActiveTime > MAX_INACTIVE_TIME && !mIsFetching)
 	{
 		clearCallbackEntryList() ; //remove all callbacks.
 		return false ;
@@ -2337,12 +2364,8 @@ bool LLViewerFetchedTexture::doLoadedCallbacks()
 
 		// Remove ourself from the global list of textures with callbacks
 		gTextureList.mCallbackList.erase(this);
-	}
-	if(mPauseLoadedCallBacks)
-	{
-		destroyRawImage();
-		return res; //paused
-	}
+		return false ;
+	}	
 
 	S32 gl_discard = getDiscardLevel();
 
@@ -2604,7 +2627,11 @@ bool LLViewerFetchedTexture::needsToSaveRawImage()
 
 void LLViewerFetchedTexture::destroyRawImage()
 {	
-	if (mAuxRawImage.notNull()) sAuxCount--;
+	if (mAuxRawImage.notNull())
+	{
+		sAuxCount--;
+		mAuxRawImage = NULL;
+	}
 
 	if (mRawImage.notNull()) 
 	{
@@ -2618,12 +2645,12 @@ void LLViewerFetchedTexture::destroyRawImage()
 			}		
 			setCachedRawImage() ;
 		}
+		
+		mRawImage = NULL;
+	
+		mIsRawImageValid = FALSE;
+		mRawDiscardLevel = INVALID_DISCARD_LEVEL;
 	}
-
-	mRawImage = NULL;
-	mAuxRawImage = NULL;
-	mIsRawImageValid = FALSE;
-	mRawDiscardLevel = INVALID_DISCARD_LEVEL;
 }
 
 //use the mCachedRawImage to (re)generate the gl texture.
@@ -3136,8 +3163,13 @@ void LLViewerLODTexture::processTextureStats()
 		S32 current_discard = getDiscardLevel();
 		if (sDesiredDiscardBias > 0.0f && mBoostLevel < LLViewerTexture::BOOST_SCULPTED && current_discard >= 0)
 		{
+			if(desired_discard_bias_max <= sDesiredDiscardBias && !mForceToSaveRawImage)
+			{
+				//needs to release texture memory urgently
+				scaleDown() ;
+			}
 			// Limit the amount of GL memory bound each frame
-			if ( BYTES_TO_MEGA_BYTES(sBoundTextureMemoryInBytes) > sMaxBoundTextureMemInMegaBytes * texmem_middle_bound_scale &&
+			else if ( BYTES_TO_MEGA_BYTES(sBoundTextureMemoryInBytes) > sMaxBoundTextureMemInMegaBytes * texmem_middle_bound_scale &&
 				(!getBoundRecently() || mDesiredDiscardLevel >= mCachedRawDiscardLevel))
 			{
 				scaleDown() ;
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index a48572f7925af19947e10e7575e383aefd613551..089f45ca899ae58eea2c7f36a0b4f81bd8d351ed 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -534,6 +534,7 @@ void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image)
 	S32 count = mImageList.erase(image) ;
 	if(count != 1) 
 	{
+		llinfos << image->getID() << llendl ;
 		llerrs << "Error happens when remove image from mImageList: " << count << llendl ;
 	}
       
@@ -588,6 +589,11 @@ void LLViewerTextureList::dirtyImage(LLViewerFetchedTexture *image)
 
 ////////////////////////////////////////////////////////////////////////////
 static LLFastTimer::DeclareTimer FTM_IMAGE_MARK_DIRTY("Dirty Images");
+static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_PRIORITIES("Prioritize");
+static LLFastTimer::DeclareTimer FTM_IMAGE_CALLBACKS("Callbacks");
+static LLFastTimer::DeclareTimer FTM_IMAGE_FETCH("Fetch");
+static LLFastTimer::DeclareTimer FTM_IMAGE_CREATE("Create");
+static LLFastTimer::DeclareTimer FTM_IMAGE_STATS("Stats");
 
 void LLViewerTextureList::updateImages(F32 max_time)
 {
@@ -599,14 +605,25 @@ void LLViewerTextureList::updateImages(F32 max_time)
 	LLViewerStats::getInstance()->mGLBoundMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageGL::sBoundTextureMemoryInBytes));
 	LLViewerStats::getInstance()->mRawMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageRaw::sGlobalRawMemory));
 	LLViewerStats::getInstance()->mFormattedMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageFormatted::sGlobalFormattedMemory));
-	
-	updateImagesDecodePriorities();
+
+
+	{
+		LLFastTimer t(FTM_IMAGE_UPDATE_PRIORITIES);
+		updateImagesDecodePriorities();
+	}
 
 	F32 total_max_time = max_time;
-	max_time -= updateImagesFetchTextures(max_time);
+
+	{
+		LLFastTimer t(FTM_IMAGE_FETCH);
+		max_time -= updateImagesFetchTextures(max_time);
+	}
 	
-	max_time = llmax(max_time, total_max_time*.50f); // at least 50% of max_time
-	max_time -= updateImagesCreateTextures(max_time);
+	{
+		LLFastTimer t(FTM_IMAGE_CREATE);
+		max_time = llmax(max_time, total_max_time*.50f); // at least 50% of max_time
+		max_time -= updateImagesCreateTextures(max_time);
+	}
 	
 	if (!mDirtyTextureList.empty())
 	{
@@ -614,24 +631,32 @@ void LLViewerTextureList::updateImages(F32 max_time)
 		gPipeline.dirtyPoolObjectTextures(mDirtyTextureList);
 		mDirtyTextureList.clear();
 	}
-	bool didone = false;
-	for (image_list_t::iterator iter = mCallbackList.begin();
-		iter != mCallbackList.end(); )
+
 	{
-		//trigger loaded callbacks on local textures immediately
-		LLViewerFetchedTexture* image = *iter++;
-		if (!image->getUrl().empty())
+		LLFastTimer t(FTM_IMAGE_CALLBACKS);
+		bool didone = false;
+		for (image_list_t::iterator iter = mCallbackList.begin();
+			iter != mCallbackList.end(); )
 		{
-			// Do stuff to handle callbacks, update priorities, etc.
-			didone = image->doLoadedCallbacks();
-		}
-		else if (!didone)
-		{
-			// Do stuff to handle callbacks, update priorities, etc.
-			didone = image->doLoadedCallbacks();
+			//trigger loaded callbacks on local textures immediately
+			LLViewerFetchedTexture* image = *iter++;
+			if (!image->getUrl().empty())
+			{
+				// Do stuff to handle callbacks, update priorities, etc.
+				didone = image->doLoadedCallbacks();
+			}
+			else if (!didone)
+			{
+				// Do stuff to handle callbacks, update priorities, etc.
+				didone = image->doLoadedCallbacks();
+			}
 		}
 	}
-	updateImagesUpdateStats();
+
+	{
+		LLFastTimer t(FTM_IMAGE_STATS);
+		updateImagesUpdateStats();
+	}
 }
 
 void LLViewerTextureList::updateImagesDecodePriorities()
@@ -749,7 +774,6 @@ void LLViewerTextureList::updateImagesDecodePriorities()
  return type_from_host;
  }
  */
-static LLFastTimer::DeclareTimer FTM_IMAGE_CREATE("Create Images");
 
 F32 LLViewerTextureList::updateImagesCreateTextures(F32 max_time)
 {
@@ -759,8 +783,7 @@ F32 LLViewerTextureList::updateImagesCreateTextures(F32 max_time)
 	// Create GL textures for all textures that need them (images which have been
 	// decoded, but haven't been pushed into GL).
 	//
-	LLFastTimer t(FTM_IMAGE_CREATE);
-	
+		
 	LLTimer create_timer;
 	image_list_t::iterator enditer = mCreateTextureList.begin();
 	for (image_list_t::iterator iter = mCreateTextureList.begin();
@@ -897,6 +920,8 @@ void LLViewerTextureList::decodeAllImages(F32 max_time)
 		image_list.push_back(imagep);
 		imagep->setInImageList(FALSE) ;
 	}
+
+	llassert_always(image_list.size() == mImageList.size()) ;
 	mImageList.clear();
 	for (std::vector<LLPointer<LLViewerFetchedTexture> >::iterator iter = image_list.begin();
 		 iter != image_list.end(); ++iter)
diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h
index e0a362596d196a8f33c60f09a9259df7daaabbf2..b386c73d2a5ef876229f504ca26f884a721ded4b 100644
--- a/indra/newview/llviewertexturelist.h
+++ b/indra/newview/llviewertexturelist.h
@@ -65,6 +65,7 @@ class LLViewerTextureList
 
 	friend class LLTextureView;
 	friend class LLViewerTextureManager;
+	friend class LLLocalBitmap;
 	
 public:
 	static BOOL createUploadFile(const std::string& filename, const std::string& out_filename, const U8 codec);
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
old mode 100644
new mode 100755
index cf21ac4e5d6bfe7a2011c214829e8b0aa2969927..ecd76f5495edc4611be211c95c91d263e8b447f4
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -27,9 +27,6 @@
 #include "llviewerprecompiledheaders.h"
 #include "llviewerwindow.h"
 
-#if LL_WINDOWS
-#pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally
-#endif
 
 // system library includes
 #include <stdio.h>
@@ -49,7 +46,6 @@
 #include "llviewquery.h"
 #include "llxmltree.h"
 #include "llslurl.h"
-//#include "llviewercamera.h"
 #include "llrender.h"
 
 #include "llvoiceclient.h"	// for push-to-talk button handling
@@ -130,6 +126,7 @@
 #include "llmorphview.h"
 #include "llmoveview.h"
 #include "llnavigationbar.h"
+#include "llpaneltopinfobar.h"
 #include "llpopupview.h"
 #include "llpreviewtexture.h"
 #include "llprogressview.h"
@@ -489,6 +486,7 @@ class LLDebugText
 			{
 				F32 cost = 0.f;
 				S32 count = 0;
+				S32 vcount = 0;
 				S32 object_count = 0;
 				S32 total_bytes = 0;
 				S32 visible_bytes = 0;
@@ -510,7 +508,9 @@ class LLDebugText
 								S32 bytes = 0;	
 								S32 visible = 0;
 								cost += object->getStreamingCost(&bytes, &visible);
-								count += object->getTriangleCount();
+								S32 vt = 0;
+								count += object->getTriangleCount(&vt);
+								vcount += vt;
 								total_bytes += bytes;
 								visible_bytes += visible;
 							}
@@ -521,20 +521,20 @@ class LLDebugText
 				{
 					label = "Selection";
 					cost = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectStreamingCost(&total_bytes, &visible_bytes);
-					count = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectTriangleCount();
+					count = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectTriangleCount(&vcount);
 					object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();
 				}
 					
 				addText(xpos,ypos, llformat("%s streaming cost: %.1f", label, cost));
 				ypos += y_inc;
 
-				addText(xpos, ypos, llformat("    %.3f KTris, %.1f/%.1f KB, %d objects",
-										count/1000.f, visible_bytes/1024.f, total_bytes/1024.f, object_count));
+				addText(xpos, ypos, llformat("    %.3f KTris, %.3f KVerts, %.1f/%.1f KB, %d objects",
+										count/1000.f, vcount/1000.f, visible_bytes/1024.f, total_bytes/1024.f, object_count));
 				ypos += y_inc;
 			
 			}
 
-			addText(xpos, ypos, llformat("%d MB Vertex Data", LLVertexBuffer::sAllocatedBytes/(1024*1024)));
+			addText(xpos, ypos, llformat("%d MB Vertex Data (%d MB Pooled)", LLVertexBuffer::sAllocatedBytes/(1024*1024), LLVBOPool::sBytesPooled/(1024*1024)));
 			ypos += y_inc;
 
 			addText(xpos, ypos, llformat("%d Vertex Buffers", LLVertexBuffer::sGLCount));
@@ -609,7 +609,9 @@ class LLDebugText
 				
 				addText(xpos, ypos, llformat("%d/%d Mesh HTTP Requests/Retries", LLMeshRepository::sHTTPRequestCount,
 					LLMeshRepository::sHTTPRetryCount));
-				
+				ypos += y_inc;
+
+				addText(xpos, ypos, llformat("%d/%d Mesh LOD Pending/Processing", LLMeshRepository::sLODPending, LLMeshRepository::sLODProcessing));
 				ypos += y_inc;
 
 				addText(xpos, ypos, llformat("%.3f/%.3f MB Mesh Cache Read/Write ", LLMeshRepository::sCacheBytesRead/(1024.f*1024.f), LLMeshRepository::sCacheBytesWritten/(1024.f*1024.f)));
@@ -737,37 +739,6 @@ class LLDebugText
 			}
 		}				
 
-		//temporary hack to give feedback on mesh upload progress
-		if (!gMeshRepo.mUploads.empty())
-		{
-			for (std::vector<LLMeshUploadThread*>::iterator iter = gMeshRepo.mUploads.begin(); 
-				iter != gMeshRepo.mUploads.end(); ++iter)
-			{
-				LLMeshUploadThread* thread = *iter;
-
-				addText(xpos, ypos, llformat("Mesh Uploads: %d", 
-								thread->mPendingUploads));
-				ypos += y_inc;
-			}
-		}
-
-		if (!gMeshRepo.mPendingRequests.empty() ||
-			!gMeshRepo.mThread->mHeaderReqQ.empty() ||
-			!gMeshRepo.mThread->mLODReqQ.empty())
-		{
-			LLMutexLock lock(gMeshRepo.mThread->mMutex);
-			S32 pending = (S32) gMeshRepo.mPendingRequests.size();
-			S32 header = (S32) gMeshRepo.mThread->mHeaderReqQ.size();
-			S32 lod = (S32) gMeshRepo.mThread->mLODReqQ.size();
-
-			addText(xpos, ypos, llformat ("Mesh Queue - %d pending (%d:%d header | %d:%d LOD)", 
-												pending,
-												LLMeshRepoThread::sActiveHeaderRequests, header,
-												LLMeshRepoThread::sActiveLODRequests, lod));
-
-			ypos += y_inc;
-		}
-		
 		if (gSavedSettings.getBOOL("DebugShowTextureInfo"))
 		{
 			LLViewerObject* objectp = NULL ;
@@ -838,6 +809,20 @@ void LLViewerWindow::updateDebugText()
 // LLViewerWindow
 //
 
+LLViewerWindow::Params::Params()
+:	title("title"),
+	name("name"),
+	x("x"),
+	y("y"),
+	width("width"),
+	height("height"),
+	min_width("min_width"),
+	min_height("min_height"),
+	fullscreen("fullscreen", false),
+	ignore_pixel_depth("ignore_pixel_depth", false)
+{}
+
+
 BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window,  LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down)
 {
 	const char* buttonname = "";
@@ -1219,7 +1204,8 @@ void LLViewerWindow::handleMouseMove(LLWindow *window,  LLCoordGL pos, MASK mask
 
 	mWindow->showCursorFromMouseMove();
 
-	if (gAwayTimer.getElapsedTimeF32() > LLAgent::MIN_AFK_TIME)
+	if (gAwayTimer.getElapsedTimeF32() > LLAgent::MIN_AFK_TIME
+		&& !gDisconnected)
 	{
 		gAgent.clearAFK();
 	}
@@ -1531,18 +1517,13 @@ std::string LLViewerWindow::translateString(const char* tag,
 //
 // Classes
 //
-LLViewerWindow::LLViewerWindow(
-	const std::string& title, const std::string& name,
-	S32 x, S32 y,
-	S32 width, S32 height,
-	BOOL fullscreen, BOOL ignore_pixel_depth) // fullscreen is no longer used
-	:
-	mWindow(NULL),
+LLViewerWindow::LLViewerWindow(const Params& p)
+:	mWindow(NULL),
 	mActive(true),
 	mUIVisible(true),
-	mWindowRectRaw(0, height, width, 0),
-	mWindowRectScaled(0, height, width, 0),
-	mWorldViewRectRaw(0, height, width, 0),
+	mWindowRectRaw(0, p.height, p.width, 0),
+	mWindowRectScaled(0, p.height, p.width, 0),
+	mWorldViewRectRaw(0, p.height, p.width, 0),
 	mLeftMouseDown(FALSE),
 	mMiddleMouseDown(FALSE),
 	mRightMouseDown(FALSE),
@@ -1555,14 +1536,14 @@ LLViewerWindow::LLViewerWindow(
 	mResDirty(false),
 	mStatesDirty(false),
 	mCurrResolutionIndex(0),
+	mProgressView(NULL)
+{
 	// gKeyboard is still NULL, so it doesn't do LLWindowListener any good to
 	// pass its value right now. Instead, pass it a nullary function that
 	// will, when we later need it, return the value of gKeyboard.
 	// boost::lambda::var() constructs such a functor on the fly.
-	mWindowListener(new LLWindowListener(this, boost::lambda::var(gKeyboard))),
-	mViewerWindowListener(new LLViewerWindowListener(this)),
-	mProgressView(NULL)
-{
+	mWindowListener.reset(new LLWindowListener(this, boost::lambda::var(gKeyboard)));
+	mViewerWindowListener.reset(new LLViewerWindowListener(this));
 	LLNotificationChannel::buildChannel("VW_alerts", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alert"));
 	LLNotificationChannel::buildChannel("VW_alertmodal", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alertmodal"));
 
@@ -1578,14 +1559,20 @@ LLViewerWindow::LLViewerWindow(
 
 	// create window
 	mWindow = LLWindowManager::createWindow(this,
-		title, name, x, y, width, height, 0,
-		fullscreen, 
+		p.title, p.name, p.x, p.y, p.width, p.height, 0,
+		p.fullscreen, 
 		gHeadlessClient,
 		gSavedSettings.getBOOL("DisableVerticalSync"),
 		!gHeadlessClient,
-		ignore_pixel_depth,
+		p.ignore_pixel_depth,
 		gSavedSettings.getBOOL("RenderDeferred") ? 0 : gSavedSettings.getU32("RenderFSAASamples")); //don't use window level anti-aliasing if FBOs are enabled
 
+	if (!LLViewerShaderMgr::sInitialized)
+	{ //immediately initialize shaders
+		LLViewerShaderMgr::sInitialized = TRUE;
+		LLViewerShaderMgr::instance()->setShaders();
+	}
+
 	if (NULL == mWindow)
 	{
 		LLSplashScreen::update(LLTrans::getString("StartupRequireDriverUpdate"));
@@ -1610,10 +1597,12 @@ LLViewerWindow::LLViewerWindow(
 		LL_WARNS("Window") << " Someone took over my signal/exception handler (post createWindow)!" << LL_ENDL;
 	}
 
+	const bool do_not_enforce = false;
+	mWindow->setMinSize(p.min_width, p.min_height, do_not_enforce);  // root view not set 
 	LLCoordScreen scr;
     mWindow->getSize(&scr);
 
-    if(fullscreen && ( scr.mX!=width || scr.mY!=height))
+    if(p.fullscreen && ( scr.mX!=p.width || scr.mY!=p.height))
     {
 		llwarns << "Fullscreen has forced us in to a different resolution now using "<<scr.mX<<" x "<<scr.mY<<llendl;
 		gSavedSettings.setS32("FullScreenWidth",scr.mX);
@@ -1722,32 +1711,30 @@ LLViewerWindow::LLViewerWindow(
 void LLViewerWindow::initGLDefaults()
 {
 	gGL.setSceneBlendType(LLRender::BT_ALPHA);
-	glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
 
-	F32 ambient[4] = {0.f,0.f,0.f,0.f };
-	F32 diffuse[4] = {1.f,1.f,1.f,1.f };
-	glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,ambient);
-	glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,diffuse);
-	
-	glPixelStorei(GL_PACK_ALIGNMENT,1);
-	glPixelStorei(GL_UNPACK_ALIGNMENT,1);
+	if (!LLGLSLShader::sNoFixedFunction)
+	{ //initialize fixed function state
+		glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
 
-	gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
+		glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,LLColor4::black.mV);
+		glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,LLColor4::white.mV);
 
-	// lights for objects
-	glShadeModel( GL_SMOOTH );
+		// lights for objects
+		glShadeModel( GL_SMOOTH );
 
-	glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient);
-	
-	gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
+		gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
+		gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
+	}
 
+	glPixelStorei(GL_PACK_ALIGNMENT,1);
+	glPixelStorei(GL_UNPACK_ALIGNMENT,1);
+
+	gGL.setAmbientLightColor(LLColor4::black);
+		
 	glCullFace(GL_BACK);
 
 	// RN: Need this for translation and stretch manip.
-	gCone.prerender();
 	gBox.prerender();
-	gSphere.prerender();
-	gCylinder.prerender();
 }
 
 struct MainPanel : public LLPanel
@@ -1969,34 +1956,43 @@ void LLViewerWindow::shutdownViews()
 	// clean up warning logger
 	LLError::removeRecorder(RecordToChatConsole::getInstance());
 
+	llinfos << "Warning logger is cleaned." << llendl ;
+
 	delete mDebugText;
 	mDebugText = NULL;
 	
+	llinfos << "DebugText deleted." << llendl ;
+
 	// Cleanup global views
 	if (gMorphView)
 	{
 		gMorphView->setVisible(FALSE);
 	}
-
+	llinfos << "Global views cleaned." << llendl ;
+	
 	// DEV-40930: Clear sModalStack. Otherwise, any LLModalDialog left open
 	// will crump with LL_ERRS.
 	LLModalDialog::shutdownModals();
-	
+	llinfos << "LLModalDialog shut down." << llendl; 
+
 	// destroy the nav bar, not currently part of gViewerWindow
 	// *TODO: Make LLNavigationBar part of gViewerWindow
 	if (LLNavigationBar::instanceExists())
 	{
 		delete LLNavigationBar::getInstance();
 	}
-
+	llinfos << "LLNavigationBar destroyed." << llendl ;
+	
 	// destroy menus after instantiating navbar above, as it needs
 	// access to gMenuHolder
 	cleanup_menus();
-
+	llinfos << "menus destroyed." << llendl ;
+	
 	// Delete all child views.
 	delete mRootView;
 	mRootView = NULL;
-
+	llinfos << "RootView deleted." << llendl ;
+	
 	// Automatically deleted as children of mRootView.  Fix the globals.
 	gStatusBar = NULL;
 	gIMMgr = NULL;
@@ -2021,6 +2017,12 @@ void LLViewerWindow::shutdownGL()
 	gSky.cleanup();
 	stop_glerror();
 
+	llinfos << "Cleaning up pipeline" << llendl;
+	gPipeline.cleanup();
+	stop_glerror();
+
+	//MUST clean up pipeline before cleaning up wearables
+	llinfos << "Cleaning up wearables" << llendl;
 	LLWearableList::instance().cleanup() ;
 
 	gTextureList.shutdown();
@@ -2031,10 +2033,6 @@ void LLViewerWindow::shutdownGL()
 
 	LLWorldMapView::cleanupTextures();
 
-	llinfos << "Cleaning up pipeline" << llendl;
-	gPipeline.cleanup();
-	stop_glerror();
-
 	LLViewerTextureManager::cleanup() ;
 	LLImageGL::cleanupClass() ;
 
@@ -2153,20 +2151,29 @@ void LLViewerWindow::reshape(S32 width, S32 height)
 		sendShapeToSim();
 
 		// store new settings for the mode we are in, regardless
-		// Only save size if not maximized
 		BOOL maximized = mWindow->getMaximized();
 		gSavedSettings.setBOOL("WindowMaximized", maximized);
 
-		LLCoordScreen window_size;
-		if (!maximized
-			&& mWindow->getSize(&window_size))
+		if (!maximized)
 		{
-			gSavedSettings.setS32("WindowWidth", window_size.mX);
-			gSavedSettings.setS32("WindowHeight", window_size.mY);
+			U32 min_window_width=gSavedSettings.getU32("MinWindowWidth");
+			U32 min_window_height=gSavedSettings.getU32("MinWindowHeight");
+			// tell the OS specific window code about min window size
+			mWindow->setMinSize(min_window_width, min_window_height);
+
+			LLCoordScreen window_rect;
+			if (mWindow->getSize(&window_rect))
+			{
+			// Only save size if not maximized
+				gSavedSettings.setU32("WindowWidth", window_rect.mX);
+				gSavedSettings.setU32("WindowHeight", window_rect.mY);
+			}
 		}
 
 		LLViewerStats::getInstance()->setStat(LLViewerStats::ST_WINDOW_WIDTH, (F64)width);
 		LLViewerStats::getInstance()->setStat(LLViewerStats::ST_WINDOW_HEIGHT, (F64)height);
+
+		LLLayoutStack::updateClass();
 	}
 }
 
@@ -2252,6 +2259,10 @@ void LLViewerWindow::drawDebugText()
 	gGL.color4f(1,1,1,1);
 	gGL.pushMatrix();
 	gGL.pushUIMatrix();
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		gUIProgram.bind();
+	}
 	{
 		// scale view by UI global scale factor and aspect ratio correction factor
 		gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
@@ -2261,6 +2272,10 @@ void LLViewerWindow::drawDebugText()
 	gGL.popMatrix();
 
 	gGL.flush();
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		gUIProgram.unbind();
+	}
 }
 
 void LLViewerWindow::draw()
@@ -2275,9 +2290,9 @@ void LLViewerWindow::draw()
 
 	LLUI::setLineWidth(1.f);
 	// Reset any left-over transforms
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	
-	glLoadIdentity();
+	gGL.loadIdentity();
 
 	//S32 screen_x, screen_y;
 
@@ -2292,7 +2307,7 @@ void LLViewerWindow::draw()
 		// draw timecode block
 		std::string text;
 
-		glLoadIdentity();
+		gGL.loadIdentity();
 
 		microsecondsToTimecodeString(gFrameTime,text);
 		const LLFontGL* font = LLFontGL::getFontSansSerif();
@@ -2328,10 +2343,10 @@ void LLViewerWindow::draw()
 			int pos_y = sub_region / llceil(zoom_factor);
 			int pos_x = sub_region - (pos_y*llceil(zoom_factor));
 			// offset for this tile
-			glTranslatef((F32)getWindowWidthScaled() * -(F32)pos_x, 
+			gGL.translatef((F32)getWindowWidthScaled() * -(F32)pos_x, 
 						(F32)getWindowHeightScaled() * -(F32)pos_y, 
 						0.f);
-			glScalef(zoom_factor, zoom_factor, 1.f);
+			gGL.scalef(zoom_factor, zoom_factor, 1.f);
 			LLUI::sGLScaleFactor *= zoom_factor;
 		}
 
@@ -2360,9 +2375,9 @@ void LLViewerWindow::draw()
 			S32 screen_x, screen_y;
 			top_ctrl->localPointToScreen(0, 0, &screen_x, &screen_y);
 
-			glMatrixMode(GL_MODELVIEW);
+			gGL.matrixMode(LLRender::MM_MODELVIEW);
 			LLUI::pushMatrix();
-			LLUI::translate( (F32) screen_x, (F32) screen_y, 0.f);
+			LLUI::translate( (F32) screen_x, (F32) screen_y);
 			top_ctrl->draw();	
 			LLUI::popMatrix();
 		}
@@ -3170,12 +3185,6 @@ void LLViewerWindow::updateLayout()
 		//gMenuBarView->setItemVisible("BuildTools", gFloaterTools->getVisible());
 	}
 
-	LLFloaterBuildOptions* build_options_floater = LLFloaterReg::findTypedInstance<LLFloaterBuildOptions>("build_options");
-	if (build_options_floater && build_options_floater->getVisible())
-	{
-		build_options_floater->updateGridMode();
-	}
-
 	// Always update console
 	if(gConsole)
 	{
@@ -3420,17 +3429,17 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
 			LLBBox hud_bbox = gAgentAvatarp->getHUDBBox();
 
 			// set up transform to encompass bounding box of HUD
-			glMatrixMode(GL_PROJECTION);
-			glPushMatrix();
-			glLoadIdentity();
+			gGL.matrixMode(LLRender::MM_PROJECTION);
+			gGL.pushMatrix();
+			gGL.loadIdentity();
 			F32 depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f);
-			glOrtho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth);
+			gGL.ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth);
 			
-			glMatrixMode(GL_MODELVIEW);
-			glPushMatrix();
-			glLoadIdentity();
-			glLoadMatrixf(OGL_TO_CFR_ROTATION);		// Load Cory's favorite reference frame
-			glTranslatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f);
+			gGL.matrixMode(LLRender::MM_MODELVIEW);
+			gGL.pushMatrix();
+			gGL.loadIdentity();
+			gGL.loadMatrix(OGL_TO_CFR_ROTATION);		// Load Cory's favorite reference frame
+			gGL.translatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f);
 		}
 
 		// Render light for editing
@@ -3440,12 +3449,12 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
 			LLGLEnable gls_blend(GL_BLEND);
 			LLGLEnable gls_cull(GL_CULL_FACE);
 			LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
-			glMatrixMode(GL_MODELVIEW);
-			glPushMatrix();
+			gGL.matrixMode(LLRender::MM_MODELVIEW);
+			gGL.pushMatrix();
 			if (selection->getSelectType() == SELECT_TYPE_HUD)
 			{
 				F32 zoom = gAgentCamera.mHUDCurZoom;
-				glScalef(zoom, zoom, zoom);
+				gGL.scalef(zoom, zoom, zoom);
 			}
 
 			struct f : public LLSelectedObjectFunctor
@@ -3456,33 +3465,33 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
 					if (drawable && drawable->isLight())
 					{
 						LLVOVolume* vovolume = drawable->getVOVolume();
-						glPushMatrix();
+						gGL.pushMatrix();
 
 						LLVector3 center = drawable->getPositionAgent();
-						glTranslatef(center[0], center[1], center[2]);
+						gGL.translatef(center[0], center[1], center[2]);
 						F32 scale = vovolume->getLightRadius();
-						glScalef(scale, scale, scale);
+						gGL.scalef(scale, scale, scale);
 
 						LLColor4 color(vovolume->getLightColor(), .5f);
-						glColor4fv(color.mV);
+						gGL.color4fv(color.mV);
 					
-						F32 pixel_area = 100000.f;
+						//F32 pixel_area = 100000.f;
 						// Render Outside
-						gSphere.render(pixel_area);
+						gSphere.render();
 
 						// Render Inside
 						glCullFace(GL_FRONT);
-						gSphere.render(pixel_area);
+						gSphere.render();
 						glCullFace(GL_BACK);
 					
-						glPopMatrix();
+						gGL.popMatrix();
 					}
 					return true;
 				}
 			} func;
 			LLSelectMgr::getInstance()->getSelection()->applyToObjects(&func);
 			
-			glPopMatrix();
+			gGL.popMatrix();
 		}				
 		
 		// NOTE: The average position for the axis arrows of the selected objects should
@@ -3545,11 +3554,11 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
 			}
 			if (selection->getSelectType() == SELECT_TYPE_HUD && selection->getObjectCount())
 			{
-				glMatrixMode(GL_PROJECTION);
-				glPopMatrix();
+				gGL.matrixMode(LLRender::MM_PROJECTION);
+				gGL.popMatrix();
 
-				glMatrixMode(GL_MODELVIEW);
-				glPopMatrix();
+				gGL.matrixMode(LLRender::MM_MODELVIEW);
+				gGL.popMatrix();
 				stop_glerror();
 			}
 		}
@@ -4089,24 +4098,14 @@ void LLViewerWindow::resetSnapshotLoc()
 	sSnapshotDir.clear();
 }
 
-static S32 BORDERHEIGHT = 0;
-static S32 BORDERWIDTH = 0;
-
 // static
 void LLViewerWindow::movieSize(S32 new_width, S32 new_height)
 {
-	LLCoordScreen size;
+	LLCoordWindow size;
+	LLCoordWindow new_size(new_width, new_height);
 	gViewerWindow->getWindow()->getSize(&size);
-	if (  (size.mX != new_width + BORDERWIDTH)
-		||(size.mY != new_height + BORDERHEIGHT))
-	{
-		// use actual display dimensions, not virtual UI dimensions
-		S32 x = gViewerWindow->getWindowWidthRaw();
-		S32 y = gViewerWindow->getWindowHeightRaw();
-		BORDERWIDTH = size.mX - x;
-		BORDERHEIGHT = size.mY- y;
-		LLCoordScreen new_size(new_width + BORDERWIDTH, 
-							   new_height + BORDERHEIGHT);
+	if ( size != new_size )
+	{
 		gViewerWindow->getWindow()->setSize(new_size);
 	}
 }
@@ -4665,10 +4664,7 @@ void LLViewerWindow::stopGL(BOOL save_state)
 			gPipeline.destroyGL();
 		}
 		
-		gCone.cleanupGL();
 		gBox.cleanupGL();
-		gSphere.cleanupGL();
-		gCylinder.cleanupGL();
 		
 		if(gPostProcess)
 		{
@@ -4742,6 +4738,9 @@ void LLViewerWindow::initFonts(F32 zoom_factor)
 {
 	LLFontGL::destroyAllGL();
 	// Initialize with possibly different zoom factor
+
+	LLFontManager::initClass();
+
 	LLFontGL::initClass( gSavedSettings.getF32("FontScreenDPI"),
 								mDisplayScale.mV[VX] * zoom_factor,
 								mDisplayScale.mV[VY] * zoom_factor,
@@ -5010,8 +5009,8 @@ void LLViewerWindow::setUIVisibility(bool visible)
 		gToolBarView->setToolBarsVisible(visible);
 	}
 
-	mRootView->getChildView("topinfo_bar_container")->setVisible(visible);
-	mRootView->getChildView("nav_bar_container")->setVisible(visible);
+	LLNavigationBar::getInstance()->setVisible(visible ? gSavedSettings.getBOOL("ShowNavbarNavigationPanel") : FALSE);
+	LLPanelTopInfoBar::getInstance()->setVisible(visible? gSavedSettings.getBOOL("ShowMiniLocationPanel") : FALSE);
 	mRootView->getChildView("status_bar_container")->setVisible(visible);
 }
 
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index 0cb7f82b58572f013b523ecec5e0945f704bc8e9..6efcaeaf18add8c01ba20c0d8912547e4c8edb0d 100644
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -44,6 +44,7 @@
 #include "llstat.h"
 #include "llmousehandler.h"
 #include "llhandle.h"
+#include "llinitparam.h"
 
 #include <boost/function.hpp>
 #include <boost/signals2.hpp>
@@ -133,7 +134,23 @@ class LLViewerWindow : public LLWindowCallbacks
 	//
 	// CREATORS
 	//
-	LLViewerWindow(const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, BOOL fullscreen, BOOL ignore_pixel_depth);
+	struct Params : public LLInitParam::Block<Params>
+	{
+		Mandatory<std::string>		title,
+									name;
+		Mandatory<S32>				x,
+									y,
+									width,
+									height,
+									min_width,
+									min_height;
+		Optional<bool>				fullscreen,
+									ignore_pixel_depth;
+
+		Params();
+	};
+
+	LLViewerWindow(const Params& p);
 	virtual ~LLViewerWindow();
 
 	void			shutdownViews();
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index bdab250b49c5db324149bdb17a1bcae838e3ec05..a7a4281860da8b1e5de1f67397f70dda29a98227 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -149,10 +149,6 @@ const F32 PELVIS_LAG_WALKING	= 0.4f;	// ...while walking
 const F32 PELVIS_LAG_MOUSELOOK = 0.15f;
 const F32 MOUSELOOK_PELVIS_FOLLOW_FACTOR = 0.5f;
 const F32 PELVIS_LAG_WHEN_FOLLOW_CAM_IS_ON = 0.0001f; // not zero! - something gets divided by this!
-
-const F32 PELVIS_ROT_THRESHOLD_SLOW = 60.0f;	// amount of deviation allowed between
-const F32 PELVIS_ROT_THRESHOLD_FAST = 2.0f;	// the pelvis and the view direction
-											// when moving fast & slow
 const F32 TORSO_NOISE_AMOUNT = 1.0f;	// Amount of deviation from up-axis, in degrees
 const F32 TORSO_NOISE_SPEED = 0.2f;	// Time scale factor on torso noise.
 
@@ -651,6 +647,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
 	LLViewerObject(id, pcode, regionp),
 	mIsDummy(FALSE),
 	mSpecialRenderMode(0),
+	mAttachmentGeometryBytes(0),
+	mAttachmentSurfaceArea(0.f),
 	mTurning(FALSE),
 	mPelvisToFoot(0.f),
 	mLastSkeletonSerialNum( 0 ),
@@ -690,7 +688,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
 	mFullyLoadedInitialized(FALSE),
 	mSupportsAlphaLayers(FALSE),
 	mLoadedCallbacksPaused(FALSE),
-	mHasPelvisOffset( FALSE )
+	mHasPelvisOffset( FALSE ),
+	mRenderUnloadedAvatar(LLCachedControl<bool>(gSavedSettings, "RenderUnloadedAvatar"))
 {
 	LLMemType mt(LLMemType::MTYPE_AVATAR);
 	//VTResume();  // VTune
@@ -2117,8 +2116,8 @@ void LLVOAvatar::updateMeshData()
 			}
 			else
 			{
-				if (buff->getRequestedIndices() == num_indices &&
-					buff->getRequestedVerts() == num_vertices)
+				if (buff->getNumIndices() == num_indices &&
+					buff->getNumVerts() == num_vertices)
 				{
 					terse_update = true;
 				}
@@ -2138,11 +2137,19 @@ void LLVOAvatar::updateMeshData()
 
 			for(S32 k = j ; k < part_index ; k++)
 			{
-				mMeshLOD[k]->updateFaceData(facep, mAdjustedPixelArea, k == MESH_ID_HAIR, terse_update);
+				bool rigid = false;
+				if (k == MESH_ID_EYEBALL_LEFT ||
+					k == MESH_ID_EYEBALL_RIGHT)
+				{ //eyeballs can't have terse updates since they're never rendered with
+					//the hardware skinning shader
+					rigid = true;
+				}
+				
+				mMeshLOD[k]->updateFaceData(facep, mAdjustedPixelArea, k == MESH_ID_HAIR, terse_update && !rigid);
 			}
 
 			stop_glerror();
-			buff->setBuffer(0);
+			buff->flush();
 
 			if(!f_num)
 			{
@@ -3354,6 +3361,16 @@ void LLVOAvatar::slamPosition()
 	mRoot.updateWorldMatrixChildren();
 }
 
+bool LLVOAvatar::isVisuallyMuted() const
+{
+	static LLCachedControl<U32> max_attachment_bytes(gSavedSettings, "RenderAutoMuteByteLimit");
+	static LLCachedControl<F32> max_attachment_area(gSavedSettings, "RenderAutoMuteSurfaceAreaLimit");
+	
+	return LLMuteList::getInstance()->isMuted(getID()) ||
+			(mAttachmentGeometryBytes > max_attachment_bytes && max_attachment_bytes > 0) ||
+			(mAttachmentSurfaceArea > max_attachment_area && max_attachment_area > 0.f);
+}
+
 //------------------------------------------------------------------------
 // updateCharacter()
 // called on both your avatar and other avatars
@@ -3413,15 +3430,16 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
 	// the rest should only be done occasionally for far away avatars
 	//--------------------------------------------------------------------
 
-	if (visible && !isSelf() && !mIsDummy && sUseImpostors && !mNeedsAnimUpdate && !sFreezeCounter)
+	if (visible && (!isSelf() || isVisuallyMuted()) && !mIsDummy && sUseImpostors && !mNeedsAnimUpdate && !sFreezeCounter)
 	{
 		const LLVector4a* ext = mDrawable->getSpatialExtents();
 		LLVector4a size;
 		size.setSub(ext[1],ext[0]);
 		F32 mag = size.getLength3().getF32()*0.5f;
 
+		
 		F32 impostor_area = 256.f*512.f*(8.125f - LLVOAvatar::sLODFactor*8.f);
-		if (LLMuteList::getInstance()->isMuted(getID()))
+		if (isVisuallyMuted())
 		{ // muted avatars update at 16 hz
 			mUpdatePeriod = 16;
 		}
@@ -3452,6 +3470,11 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
 
 		visible = (LLDrawable::getCurrentFrame()+mID.mData[0])%mUpdatePeriod == 0 ? TRUE : FALSE;
 	}
+	else
+	{
+		mUpdatePeriod = 1;
+	}
+
 
 	// don't early out for your own avatar, as we rely on your animations playing reliably
 	// for example, the "turn around" animation when entering customize avatar needs to trigger
@@ -3630,7 +3653,11 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
 			BOOL self_in_mouselook = isSelf() && gAgentCamera.cameraMouselook();
 
 			LLVector3 pelvisDir( mRoot.getWorldMatrix().getFwdRow4().mV );
-			F32 pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, PELVIS_ROT_THRESHOLD_SLOW, PELVIS_ROT_THRESHOLD_FAST);
+
+			static LLCachedControl<F32> s_pelvis_rot_threshold_slow(gSavedSettings, "AvatarRotateThresholdSlow");
+			static LLCachedControl<F32> s_pelvis_rot_threshold_fast(gSavedSettings, "AvatarRotateThresholdFast");
+
+			F32 pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, s_pelvis_rot_threshold_slow, s_pelvis_rot_threshold_fast);
 						
 			if (self_in_mouselook)
 			{
@@ -4135,7 +4162,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
 			LLVertexBuffer* vb = mDrawable->getFace(0)->getVertexBuffer();
 			if (vb)
 			{
-				vb->setBuffer(0);
+				vb->flush();
 			}
 		}
 	}
@@ -5007,7 +5034,7 @@ void LLVOAvatar::addDebugText(const std::string& text)
 //-----------------------------------------------------------------------------
 // getID()
 //-----------------------------------------------------------------------------
-const LLUUID& LLVOAvatar::getID()
+const LLUUID& LLVOAvatar::getID() const
 {
 	return mID;
 }
@@ -5405,18 +5432,6 @@ BOOL LLVOAvatar::loadAvatar()
 		}
 	}
 
-	// Uncomment to enable avatar_lad.xml debugging. 
-	std::ofstream file;
-	file.open("avatar_lad.log");
-	for( LLViewerVisualParam* param = (LLViewerVisualParam*) getFirstVisualParam(); 
-	param;
-	param = (LLViewerVisualParam*) getNextVisualParam() )
-	{
-		param->getInfo()->toStream(file);
-		file << std::endl;
-	}
-
-	file.close();
 	
 	return TRUE;
 }
@@ -6485,10 +6500,7 @@ BOOL LLVOAvatar::processFullyLoadedChange(bool loading)
 
 BOOL LLVOAvatar::isFullyLoaded() const
 {
-	if (gSavedSettings.getBOOL("RenderUnloadedAvatar"))
-		return TRUE;
-	else
-		return mFullyLoaded;
+	return (mRenderUnloadedAvatar || mFullyLoaded);
 }
 
 bool LLVOAvatar::isTooComplex() const
@@ -7525,12 +7537,16 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id )
 void LLVOAvatar::dumpArchetypeXML( void* )
 {
 	LLAPRFile outfile;
-	outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,"new archetype.xml"), LL_APR_WB );
-	apr_file_t* file = outfile.getFileHandle() ;
+	outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,"new archetype.xml"), LL_APR_WB );
+	apr_file_t* file = outfile.getFileHandle();
 	if (!file)
 	{
 		return;
 	}
+	else
+	{
+		llinfos << "xmlfile write handle obtained : " << gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,"new archetype.xml") << llendl;
+	}
 
 	apr_file_printf( file, "<?xml version=\"1.0\" encoding=\"US-ASCII\" standalone=\"yes\"?>\n" );
 	apr_file_printf( file, "<linden_genepool version=\"1.0\">\n" );
@@ -7570,6 +7586,11 @@ void LLVOAvatar::dumpArchetypeXML( void* )
 	}
 	apr_file_printf( file, "\t</archetype>\n" );
 	apr_file_printf( file, "\n</linden_genepool>\n" );
+	//explictly close the file if it is still open which it should be
+	if (file)
+	{
+		outfile.close();
+	}
 }
 
 
@@ -8289,7 +8310,7 @@ void LLVOAvatar::updateImpostors()
 
 BOOL LLVOAvatar::isImpostor() const
 {
-	return (sUseImpostors && mUpdatePeriod >= IMPOSTOR_PERIOD) ? TRUE : FALSE;
+	return (isVisuallyMuted() || (sUseImpostors && mUpdatePeriod >= IMPOSTOR_PERIOD)) ? TRUE : FALSE;
 }
 
 
@@ -8335,10 +8356,15 @@ void LLVOAvatar::getImpostorValues(LLVector4a* extents, LLVector3& angle, F32& d
 void LLVOAvatar::idleUpdateRenderCost()
 {
 	static const U32 ARC_BODY_PART_COST = 200;
-	static const U32 ARC_LIMIT = 2048;
+	static const U32 ARC_LIMIT = 20000;
 
 	static std::set<LLUUID> all_textures;
 
+	if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_ATTACHMENT_BYTES))
+	{ //set debug text to attachment geometry bytes here so render cost will override
+		setDebugText(llformat("%.1f KB, %.2f m^2", mAttachmentGeometryBytes/1024.f, mAttachmentSurfaceArea));
+	}
+
 	if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHAME))
 	{
 		return;
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index e53b8e3f4bf731ce9adc47621c106519a56b694e..6a4e09593c1dc22335efb0f65feb263089c63a2a 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -40,6 +40,7 @@
 #include "lldrawpoolalpha.h"
 #include "llviewerobject.h"
 #include "llcharacter.h"
+#include "llcontrol.h"
 #include "llviewerjointmesh.h"
 #include "llviewerjointattachment.h"
 #include "llrendertarget.h"
@@ -77,6 +78,8 @@ class LLVOAvatar :
 	public LLCharacter,
 	public boost::signals2::trackable
 {
+	LOG_CLASS(LLVOAvatar);
+
 public:
 	friend class LLVOAvatarSelf;
 protected:
@@ -182,7 +185,7 @@ class LLVOAvatar :
 	void					resetSpecificJointPosition( const std::string& name );
 	
 	virtual const char*		getAnimationPrefix() { return "avatar"; }
-	virtual const LLUUID&   getID();
+	virtual const LLUUID&   getID() const;
 	virtual LLVector3		getVolumePos(S32 joint_index, LLVector3& volume_offset);
 	virtual LLJoint*		findCollisionVolume(U32 volume_id);
 	virtual S32				getCollisionVolumeID(std::string &name);
@@ -379,6 +382,8 @@ class LLVOAvatar :
 
 public:
 	U32 		renderImpostor(LLColor4U color = LLColor4U(255,255,255,255), S32 diffuse_channel = 0);
+	bool		isVisuallyMuted() const;
+
 	U32 		renderRigid();
 	U32 		renderSkinned(EAvatarRenderPass pass);
 	F32			getLastSkinTime() { return mLastSkinTime; }
@@ -390,6 +395,9 @@ class LLVOAvatar :
 	static void	restoreGL();
 	BOOL 		mIsDummy; // for special views
 	S32			mSpecialRenderMode; // special lighting
+	U32			mAttachmentGeometryBytes; //number of bytes in attached geometry
+	F32			mAttachmentSurfaceArea; //estimated surface area of attachments
+
 private:
 	bool		shouldAlphaMask();
 
@@ -450,6 +458,8 @@ class LLVOAvatar :
 	F32			mImpostorDistance;
 	F32			mImpostorPixelArea;
 	LLVector3	mLastAnimExtents[2];  
+	
+	LLCachedControl<bool> mRenderUnloadedAvatar;
 
 	//--------------------------------------------------------------------
 	// Wind rippling in clothes
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 59883e0bb19be9867331c0a0c9194a5603d2dd10..f063653cc5555ab84f3ee05f2317e5a1d00b67b0 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -66,10 +66,11 @@
 
 #include <boost/lexical_cast.hpp>
 
-LLVOAvatarSelf *gAgentAvatarp = NULL;
+LLPointer<LLVOAvatarSelf> gAgentAvatarp = NULL;
+
 BOOL isAgentAvatarValid()
 {
-	return (gAgentAvatarp &&
+	return (gAgentAvatarp.notNull() &&
 			(gAgentAvatarp->getRegion() != NULL) &&
 			(!gAgentAvatarp->isDead()));
 }
@@ -365,9 +366,9 @@ BOOL LLVOAvatarSelf::buildMenus()
 						item_params.label = sub_piemenu_name;
 					}
 					item_params.name =(item_params.label );
-					item_params.on_click.function_name = "Attachment.Detach";
+					item_params.on_click.function_name = "Attachment.DetachFromPoint";
 					item_params.on_click.parameter = iter->first;
-					item_params.on_enable.function_name = "Attachment.EnableDetach";
+					item_params.on_enable.function_name = "Attachment.PointFilled";
 					item_params.on_enable.parameter = iter->first;
 					LLMenuItemCallGL* item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
 
@@ -1574,7 +1575,7 @@ void LLVOAvatarSelf::invalidateAll()
 	{
 		invalidateComposite(mBakedTextureDatas[i].mTexLayerSet, TRUE);
 	}
-	mDebugSelfLoadTimer.reset();
+	//mDebugSelfLoadTimer.reset();
 }
 
 //-----------------------------------------------------------------------------
@@ -1896,11 +1897,13 @@ BOOL LLVOAvatarSelf::getIsCloud()
 		gAgentWearables.getWearableCount(LLWearableType::WT_EYES) == 0 ||
 		gAgentWearables.getWearableCount(LLWearableType::WT_SKIN) == 0)	
 	{
+		lldebugs << "No body parts" << llendl;
 		return TRUE;
 	}
 
 	if (!isTextureDefined(TEX_HAIR, 0))
 	{
+		lldebugs << "No hair texture" << llendl;
 		return TRUE;
 	}
 
@@ -1909,12 +1912,14 @@ BOOL LLVOAvatarSelf::getIsCloud()
 		if (!isLocalTextureDataAvailable(mBakedTextureDatas[BAKED_LOWER].mTexLayerSet) &&
 			(!isTextureDefined(TEX_LOWER_BAKED, 0)))
 		{
+			lldebugs << "Lower textures not baked" << llendl;
 			return TRUE;
 		}
 
 		if (!isLocalTextureDataAvailable(mBakedTextureDatas[BAKED_UPPER].mTexLayerSet) &&
 			(!isTextureDefined(TEX_UPPER_BAKED, 0)))
 		{
+			lldebugs << "Upper textures not baked" << llendl;
 			return TRUE;
 		}
 
@@ -1931,10 +1936,12 @@ BOOL LLVOAvatarSelf::getIsCloud()
 			const LLViewerTexture* baked_img = getImage( texture_data.mTextureIndex, 0 );
 			if (!baked_img || !baked_img->hasGLTexture())
 			{
+				lldebugs << "Texture at index " << i << " (texture index is " << texture_data.mTextureIndex << ") is not loaded" << llendl;
 				return TRUE;
 			}
 		}
 
+		lldebugs << "Avatar de-clouded" << llendl;
 	}
 	return FALSE;
 }
@@ -2258,6 +2265,7 @@ void LLVOAvatarSelf::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid )
 	}
 }
 
+// FIXME: This is never called. Something may be broken.
 void LLVOAvatarSelf::outputRezDiagnostics() const
 {
 	if(!gSavedSettings.getBOOL("DebugAvatarLocalTexLoadedTime"))
@@ -2315,6 +2323,18 @@ void LLVOAvatarSelf::outputRezDiagnostics() const
 	}
 }
 
+void LLVOAvatarSelf::outputRezTiming(const std::string& msg) const
+{
+	LL_DEBUGS("Avatar Rez")
+		<< llformat("%s. Time from avatar creation: %.2f", msg.c_str(), mDebugSelfLoadTimer.getElapsedTimeF32())
+		<< llendl;
+}
+
+void LLVOAvatarSelf::reportAvatarRezTime() const
+{
+	// TODO: report mDebugSelfLoadTimer.getElapsedTimeF32() somehow.
+}
+
 //-----------------------------------------------------------------------------
 // setCachedBakedTexture()
 // A baked texture id was received from a cache query, make it active
@@ -2558,7 +2578,7 @@ void LLVOAvatarSelf::deleteScratchTextures()
 			LLImageGL::decTextureCounter(tex_size, 1, LLViewerTexture::AVATAR_SCRATCH_TEX) ;
 			total_tex_size -= tex_size ;
 		}
-		if( sScratchTexNames.checkData( GL_LUMINANCE_ALPHA ) )
+		if( sScratchTexNames.checkData( LLRender::sGLCoreProfile ? GL_RG : GL_LUMINANCE_ALPHA ) )
 		{
 			LLImageGL::decTextureCounter(tex_size, 2, LLViewerTexture::AVATAR_SCRATCH_TEX) ;
 			total_tex_size -= 2 * tex_size ;
@@ -2600,89 +2620,6 @@ void LLVOAvatarSelf::deleteScratchTextures()
 	}
 }
 
-BOOL LLVOAvatarSelf::bindScratchTexture( LLGLenum format )
-{
-	U32 texture_bytes = 0;
-	S32 components = 0; 
-	GLuint gl_name = getScratchTexName( format, components, &texture_bytes );
-	if( gl_name )
-	{
-		gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, gl_name);
-		stop_glerror();
-
-		F32* last_bind_time = sScratchTexLastBindTime.getIfThere( format );
-		if( last_bind_time )
-		{
-			if( *last_bind_time != LLImageGL::sLastFrameTime )
-			{
-				*last_bind_time = LLImageGL::sLastFrameTime;
-				LLImageGL::updateBoundTexMem(texture_bytes, components, LLViewerTexture::AVATAR_SCRATCH_TEX) ;
-			}
-		}
-		else
-		{
-			LLImageGL::updateBoundTexMem(texture_bytes, components, LLViewerTexture::AVATAR_SCRATCH_TEX) ;
-			sScratchTexLastBindTime.addData( format, new F32(LLImageGL::sLastFrameTime) );
-		}
-		return TRUE;
-	}
-	return FALSE;
-}
-
-LLGLuint LLVOAvatarSelf::getScratchTexName( LLGLenum format, S32& components, U32* texture_bytes )
-{	
-	GLenum internal_format;
-	switch( format )
-	{
-		case GL_LUMINANCE:			components = 1; internal_format = GL_LUMINANCE8;		break;
-		case GL_ALPHA:				components = 1; internal_format = GL_ALPHA8;			break;
-		case GL_LUMINANCE_ALPHA:	components = 2; internal_format = GL_LUMINANCE8_ALPHA8;	break;
-		case GL_RGB:				components = 3; internal_format = GL_RGB8;				break;
-		case GL_RGBA:				components = 4; internal_format = GL_RGBA8;				break;
-		default:	llassert(0);	components = 4; internal_format = GL_RGBA8;				break;
-	}
-
-	*texture_bytes = components * SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT;
-	
-	if( sScratchTexNames.checkData( format ) )
-	{
-		return *( sScratchTexNames.getData( format ) );
-	}
-
-	LLGLSUIDefault gls_ui;
-
-	U32 name = 0;
-	LLImageGL::generateTextures(1, &name );
-	stop_glerror();
-
-	gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, name);
-	stop_glerror();
-
-	LLImageGL::setManualImage(
-		GL_TEXTURE_2D, 0, internal_format, 
-		SCRATCH_TEX_WIDTH, SCRATCH_TEX_HEIGHT,
-		format, GL_UNSIGNED_BYTE, NULL );
-	stop_glerror();
-
-	gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
-	gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
-	stop_glerror();
-
-	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-	stop_glerror();
-
-	sScratchTexNames.addData( format, new LLGLuint( name ) );
-
-	sScratchTexBytes += *texture_bytes;
-	LLImageGL::sGlobalTextureMemoryInBytes += *texture_bytes;
-
-	if(gAuditTexture)
-	{
-		LLImageGL::incTextureCounter(SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT, components, LLViewerTexture::AVATAR_SCRATCH_TEX) ;
-	}
-	return name;
-}
-
 // static 
 void LLVOAvatarSelf::dumpScratchTextureByteCount()
 {
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index 51f06dee5f5246e3572e1e434c6b8baecaeb14f5..655fb3a012a03832aee569f8456738c17ee495e6 100644
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -41,6 +41,7 @@ struct LocalTextureData;
 class LLVOAvatarSelf :
 	public LLVOAvatar
 {
+	LOG_CLASS(LLVOAvatarSelf);
 
 /********************************************************************************
  **                                                                            **
@@ -249,10 +250,7 @@ class LLVOAvatarSelf :
 	// Scratch textures (used for compositing)
 	//--------------------------------------------------------------------
 public:
-	BOOL			bindScratchTexture(LLGLenum format);
 	static void		deleteScratchTextures();
-protected:
-	LLGLuint		getScratchTexName(LLGLenum format, S32& components, U32* texture_bytes);
 private:
 	static S32 		sScratchTexBytes;
 	static LLMap< LLGLenum, LLGLuint*> sScratchTexNames;
@@ -361,6 +359,8 @@ class LLVOAvatarSelf :
 	void 					debugWearablesLoaded() { mDebugTimeWearablesLoaded = mDebugSelfLoadTimer.getElapsedTimeF32(); }
 	void 					debugAvatarVisible() { mDebugTimeAvatarVisible = mDebugSelfLoadTimer.getElapsedTimeF32(); }
 	void 					outputRezDiagnostics() const;
+	void					outputRezTiming(const std::string& msg) const;
+	void					reportAvatarRezTime() 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);
 
@@ -383,7 +383,7 @@ class LLVOAvatarSelf :
 
 };
 
-extern LLVOAvatarSelf *gAgentAvatarp;
+extern LLPointer<LLVOAvatarSelf> gAgentAvatarp;
 
 BOOL isAgentAvatarValid();
 
diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp
index 32822e11816fe67772964bcefa5451c33d835e18..8a79d564d3a3dfd7dfdbe65958e0559c51713804 100644
--- a/indra/newview/llvograss.cpp
+++ b/indra/newview/llvograss.cpp
@@ -464,7 +464,7 @@ void LLVOGrass::plantBlades()
 }
 
 void LLVOGrass::getGeometry(S32 idx,
-								LLStrider<LLVector3>& verticesp,
+								LLStrider<LLVector4a>& verticesp,
 								LLStrider<LLVector3>& normalsp, 
 								LLStrider<LLVector2>& texcoordsp,
 								LLStrider<LLColor4U>& colorsp, 
@@ -516,21 +516,24 @@ void LLVOGrass::getGeometry(S32 idx,
 		position.mV[0]  = mPosition.mV[VX] + x + xf;
 		position.mV[1]  = mPosition.mV[VY] + y + yf;
 		position.mV[2]  = mRegionp->getLand().resolveHeightRegion(position);
-		*verticesp++    = v1 = position + mRegionp->getOriginAgent();
-		*verticesp++    = v1;
+		v1 = position + mRegionp->getOriginAgent();
+		(*verticesp++).load3(v1.mV);
+		(*verticesp++).load3(v1.mV);
 
 
 		position.mV[0] += dzx;
 		position.mV[1] += dzy;
 		position.mV[2] += blade_height;
-		*verticesp++    = v2 = position + mRegionp->getOriginAgent();
-		*verticesp++    = v2;
+		v2 = position + mRegionp->getOriginAgent();
+		(*verticesp++).load3(v2.mV);
+		(*verticesp++).load3(v2.mV);
 
 		position.mV[0]  = mPosition.mV[VX] + x - xf;
 		position.mV[1]  = mPosition.mV[VY] + y - xf;
 		position.mV[2]  = mRegionp->getLand().resolveHeightRegion(position);
-		*verticesp++    = v3 = position + mRegionp->getOriginAgent();
-		*verticesp++    = v3;
+		v3 = position + mRegionp->getOriginAgent();
+		(*verticesp++).load3(v3.mV);
+		(*verticesp++).load3(v3.mV);
 
 		LLVector3 normal1 = (v1-v2) % (v2-v3);
 		normal1.mV[VZ] = 0.75f;
@@ -541,8 +544,9 @@ void LLVOGrass::getGeometry(S32 idx,
 		position.mV[0] += dzx;
 		position.mV[1] += dzy;
 		position.mV[2] += blade_height;
-		*verticesp++    = v1 = position + mRegionp->getOriginAgent();
-		*verticesp++    = v1;
+		v1 = position + mRegionp->getOriginAgent();
+		(*verticesp++).load3(v1.mV);
+		(*verticesp++).load3(v1.mV);
 
 		*(normalsp++)   = normal1;
 		*(normalsp++)   = normal2;
diff --git a/indra/newview/llvograss.h b/indra/newview/llvograss.h
index c262fdcc798ccc922f3cb3903485b7d4fa10d65b..00a59facf742658131024510d544e499c6fa362e 100644
--- a/indra/newview/llvograss.h
+++ b/indra/newview/llvograss.h
@@ -59,7 +59,7 @@ class LLVOGrass : public LLAlphaObject
 	/*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
 	/*virtual*/ BOOL		updateGeometry(LLDrawable *drawable);
 	/*virtual*/ void		getGeometry(S32 idx,
-								LLStrider<LLVector3>& verticesp,
+								LLStrider<LLVector4a>& verticesp,
 								LLStrider<LLVector3>& normalsp, 
 								LLStrider<LLVector2>& texcoordsp,
 								LLStrider<LLColor4U>& colorsp, 
diff --git a/indra/newview/llvoground.cpp b/indra/newview/llvoground.cpp
index ce256fdedf47371272a636bd6a931441f6f88b2b..0060f81ab5043f5235b6b1fd0ae03e868c9a515a 100644
--- a/indra/newview/llvoground.cpp
+++ b/indra/newview/llvoground.cpp
@@ -162,7 +162,7 @@ BOOL LLVOGround::updateGeometry(LLDrawable *drawable)
 	*(texCoordsp++) = LLVector2(0.f, 1.f);
 	*(texCoordsp++) = LLVector2(0.5f, 0.5f);
 	
-	face->getVertexBuffer()->setBuffer(0);
+	face->getVertexBuffer()->flush();
 	LLPipeline::sCompiles++;
 	return TRUE;
 }
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 8ecf4a80b78e2a472719021e7c41efbc9f24dd26..df1d3f2955730da098c2eb413ce31ac898aa2822 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -61,7 +61,6 @@
 #include "llviewerwindow.h"
 #include "llviewercamera.h"
 
-#include "llfloaterfriends.h"  //VIVOX, inorder to refresh communicate panel
 #include "llviewernetwork.h"
 #include "llnotificationsutil.h"
 
@@ -7020,7 +7019,6 @@ void LLVivoxVoiceClient::captureBufferPlayStopSendMessage()
 
 LLVivoxProtocolParser::LLVivoxProtocolParser()
 {
-	parser = NULL;
 	parser = XML_ParserCreate(NULL);
 	
 	reset();
diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp
index a4b0910c926c0abb839fcc7f4d097e43077cfccf..5c10a80b07380af65c80c7e7f57bd713261d0972 100644
--- a/indra/newview/llvopartgroup.cpp
+++ b/indra/newview/llvopartgroup.cpp
@@ -274,7 +274,7 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable)
 }
 
 void LLVOPartGroup::getGeometry(S32 idx,
-								LLStrider<LLVector3>& verticesp,
+								LLStrider<LLVector4a>& verticesp,
 								LLStrider<LLVector3>& normalsp, 
 								LLStrider<LLVector2>& texcoordsp,
 								LLStrider<LLColor4U>& colorsp, 
@@ -290,37 +290,54 @@ void LLVOPartGroup::getGeometry(S32 idx,
 	U32 vert_offset = mDrawable->getFace(idx)->getGeomIndex();
 
 	
-	LLVector3 part_pos_agent(part.mPosAgent);
-	LLVector3 camera_agent = getCameraPosition(); 
-	LLVector3 at = part_pos_agent - camera_agent;
-	LLVector3 up;
-	LLVector3 right;
-
-	right = at % LLVector3(0.f, 0.f, 1.f);
-	right.normalize();
-	up = right % at;
-	up.normalize();
+	LLVector4a part_pos_agent;
+	part_pos_agent.load3(part.mPosAgent.mV);
+	LLVector4a camera_agent;
+	camera_agent.load3(getCameraPosition().mV); 
+	LLVector4a at;
+	at.setSub(part_pos_agent, camera_agent);
+	LLVector4a up(0, 0, 1);
+	LLVector4a right;
+
+	right.setCross3(at, up);
+	right.normalize3fast();
+	up.setCross3(right, at);
+	up.normalize3fast();
 
 	if (part.mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK)
 	{
-		LLVector3 normvel = part.mVelocity;
-		normvel.normalize();
+		LLVector4a normvel;
+		normvel.load3(part.mVelocity.mV);
+		normvel.normalize3fast();
 		LLVector2 up_fracs;
-		up_fracs.mV[0] = normvel*right;
-		up_fracs.mV[1] = normvel*up;
+		up_fracs.mV[0] = normvel.dot3(right).getF32();
+		up_fracs.mV[1] = normvel.dot3(up).getF32();
 		up_fracs.normalize();
-		LLVector3 new_up;
-		LLVector3 new_right;
-		new_up = up_fracs.mV[0] * right + up_fracs.mV[1]*up;
-		new_right = up_fracs.mV[1] * right - up_fracs.mV[0]*up;
+		LLVector4a new_up;
+		LLVector4a new_right;
+
+		//new_up = up_fracs.mV[0] * right + up_fracs.mV[1]*up;
+		LLVector4a t = right;
+		t.mul(up_fracs.mV[0]);
+		new_up = up;
+		new_up.mul(up_fracs.mV[1]);
+		new_up.add(t);
+
+		//new_right = up_fracs.mV[1] * right - up_fracs.mV[0]*up;
+		t = right;
+		t.mul(up_fracs.mV[1]);
+		new_right = up;
+		new_right.mul(up_fracs.mV[0]);
+		t.sub(new_right);
+
 		up = new_up;
-		right = new_right;
-		up.normalize();
-		right.normalize();
+		right = t;
+		up.normalize3fast();
+		right.normalize3fast();
 	}
 
-	right *= 0.5f*part.mScale.mV[0];
-	up *= 0.5f*part.mScale.mV[1];
+	right.mul(0.5f*part.mScale.mV[0]);
+	up.mul(0.5f*part.mScale.mV[1]);
 
 
 	LLVector3 normal = -LLViewerCamera::getInstance()->getXAxis();
@@ -329,14 +346,25 @@ void LLVOPartGroup::getGeometry(S32 idx,
 	// this works because there is actually a 4th float stored after the vertex position which is used as a texture index
 	// also, somebody please VECTORIZE THIS
 
-	verticesp->mV[3] = 0.f;
-	*verticesp++ = part_pos_agent + up - right;
-	verticesp->mV[3] = 0.f;
-	*verticesp++ = part_pos_agent - up - right;
-	verticesp->mV[3] = 0.f;
-	*verticesp++ = part_pos_agent + up + right;
-	verticesp->mV[3] = 0.f;
-	*verticesp++ = part_pos_agent - up + right;
+	LLVector4a ppapu;
+	LLVector4a ppamu;
+
+	ppapu.setAdd(part_pos_agent, up);
+	ppamu.setSub(part_pos_agent, up);
+
+	verticesp->setSub(ppapu, right);
+	(*verticesp++).getF32ptr()[3] = 0.f;
+	verticesp->setSub(ppamu, right);
+	(*verticesp++).getF32ptr()[3] = 0.f;
+	verticesp->setAdd(ppapu, right);
+	(*verticesp++).getF32ptr()[3] = 0.f;
+	verticesp->setAdd(ppamu, right);
+	(*verticesp++).getF32ptr()[3] = 0.f;
+
+	//*verticesp++ = part_pos_agent + up - right;
+	//*verticesp++ = part_pos_agent - up - right;
+	//*verticesp++ = part_pos_agent + up + right;
+	//*verticesp++ = part_pos_agent - up + right;
 
 	*colorsp++ = part.mColor;
 	*colorsp++ = part.mColor;
@@ -453,7 +481,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)
 	LLVertexBuffer* buffer = group->mVertexBuffer;
 
 	LLStrider<U16> indicesp;
-	LLStrider<LLVector3> verticesp;
+	LLStrider<LLVector4a> verticesp;
 	LLStrider<LLVector3> normalsp;
 	LLStrider<LLVector2> texcoordsp;
 	LLStrider<LLColor4U> colorsp;
@@ -513,7 +541,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)
 		}
 	}
 
-	buffer->setBuffer(0);
+	buffer->flush();
 	mFaceList.clear();
 }
 
diff --git a/indra/newview/llvopartgroup.h b/indra/newview/llvopartgroup.h
index 4db893b4ef7f47580409446876fd30d386ebf5b6..e58fed86d969ff10d55bf800d3d3bdc1ee306ac4 100644
--- a/indra/newview/llvopartgroup.h
+++ b/indra/newview/llvopartgroup.h
@@ -60,7 +60,7 @@ class LLVOPartGroup : public LLAlphaObject
 	/*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
 	/*virtual*/ BOOL        updateGeometry(LLDrawable *drawable);
 				void		getGeometry(S32 idx,
-								LLStrider<LLVector3>& verticesp,
+								LLStrider<LLVector4a>& verticesp,
 								LLStrider<LLVector3>& normalsp, 
 								LLStrider<LLVector2>& texcoordsp,
 								LLStrider<LLColor4U>& colorsp, 
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index ef21e7373e48a0e51890ef919a12d9a56183182a..312034022ea33a4fbed264e9ca4b64a48f8e5d4c 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -342,7 +342,7 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
 	blue_density = LLColor3();
 	blue_horizon = LLColor3();
 	haze_density = 0.f;
-	haze_horizon = LLColor3();
+	haze_horizon = 1.f;
 	density_multiplier = 0.f;
 	max_y = 0.f;
 	glow = LLColor3();
@@ -651,17 +651,17 @@ void LLVOSky::initAtmospherics(void)
 	sunlight_color = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("sunlight_color", error));
 	ambient = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("ambient", error));
 	//lightnorm = LLWLParamManager::getInstance()->mCurParams.getVector("lightnorm", error);
-	gamma = LLWLParamManager::getInstance()->mCurParams.getVector("gamma", error)[0];
+	gamma = LLWLParamManager::getInstance()->mCurParams.getFloat("gamma", error);
 	blue_density = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("blue_density", error));
 	blue_horizon = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("blue_horizon", error));
-	haze_density = LLWLParamManager::getInstance()->mCurParams.getVector("haze_density", error)[0];
-	haze_horizon = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("haze_horizon", error));
-	density_multiplier = LLWLParamManager::getInstance()->mCurParams.getVector("density_multiplier", error)[0];
-	max_y = LLWLParamManager::getInstance()->mCurParams.getVector("max_y", error)[0];
+	haze_density = LLWLParamManager::getInstance()->mCurParams.getFloat("haze_density", error);
+	haze_horizon = LLWLParamManager::getInstance()->mCurParams.getFloat("haze_horizon", error);
+	density_multiplier = LLWLParamManager::getInstance()->mCurParams.getFloat("density_multiplier", error);
+	max_y = LLWLParamManager::getInstance()->mCurParams.getFloat("max_y", error);
 	glow = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("glow", error));
-	cloud_shadow = LLWLParamManager::getInstance()->mCurParams.getVector("cloud_shadow", error)[0];
+	cloud_shadow = LLWLParamManager::getInstance()->mCurParams.getFloat("cloud_shadow", error);
 	cloud_color = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("cloud_color", error));
-	cloud_scale = LLWLParamManager::getInstance()->mCurParams.getVector("cloud_scale", error)[0];
+	cloud_scale = LLWLParamManager::getInstance()->mCurParams.getFloat("cloud_scale", error);
 	cloud_pos_density1 = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("cloud_pos_density1", error));
 	cloud_pos_density2 = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("cloud_pos_density2", error));
 
@@ -825,7 +825,7 @@ void LLVOSky::calcSkyColorWLVert(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLCo
 
 	// Haze color above cloud
 	vary_HazeColor = (blue_horizon * blue_weight * (sunlight + ambient)
-				+ componentMult(haze_horizon.mV[0] * haze_weight, sunlight * temp2.mV[0] + ambient)
+				+ componentMult(haze_horizon * haze_weight, sunlight * temp2.mV[0] + ambient)
 			 );	
 
 	// Increase ambient when there are more clouds
@@ -836,7 +836,7 @@ void LLVOSky::calcSkyColorWLVert(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLCo
 
 	// Haze color below cloud
 	LLColor3 additiveColorBelowCloud = (blue_horizon * blue_weight * (sunlight + tmpAmbient)
-				+ componentMult(haze_horizon.mV[0] * haze_weight, sunlight * temp2.mV[0] + tmpAmbient)
+				+ componentMult(haze_horizon * haze_weight, sunlight * temp2.mV[0] + tmpAmbient)
 			 );	
 
 	// Final atmosphere additive
@@ -1002,7 +1002,7 @@ void LLVOSky::calcAtmospherics(void)
 		//haze color
 		vary_HazeColor =
 			(blue_horizon * blue_weight * (sunlight*(1.f - cloud_shadow) + tmpAmbient)	
-			+ componentMult(haze_horizon.mV[0] * haze_weight, sunlight*(1.f - cloud_shadow) * temp2.mV[0] + tmpAmbient)
+			+ componentMult(haze_horizon * haze_weight, sunlight*(1.f - cloud_shadow) * temp2.mV[0] + tmpAmbient)
 				 );	
 
 		//brightness of surface both sunlight and ambient
@@ -1267,7 +1267,7 @@ void LLVOSky::updateDummyVertexBuffer()
 	LLStrider<LLVector3> vertices ;
 	mFace[FACE_DUMMY]->getVertexBuffer()->getVertexStrider(vertices,  0);
 	*vertices = mCameraPosAgent ;
-	mFace[FACE_DUMMY]->getVertexBuffer()->setBuffer(0) ;
+	mFace[FACE_DUMMY]->getVertexBuffer()->flush();
 }
 //----------------------------------
 //end of fake vertex buffer updating
@@ -1351,7 +1351,7 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable)
 			*indicesp++ = index_offset + 3;
 			*indicesp++ = index_offset + 2;
 
-			buff->setBuffer(0);
+			buff->flush();
 		}
 	}
 
@@ -1516,7 +1516,7 @@ BOOL LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 f, cons
 	*indicesp++ = index_offset + 2;
 	*indicesp++ = index_offset + 3;
 
-	facep->getVertexBuffer()->setBuffer(0);
+	facep->getVertexBuffer()->flush();
 
 	if (is_sun)
 	{
@@ -2030,7 +2030,7 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H,
 		}
 	}
 
-	face->getVertexBuffer()->setBuffer(0);
+	face->getVertexBuffer()->flush();
 }
 
 
@@ -2040,9 +2040,12 @@ void LLVOSky::updateFog(const F32 distance)
 {
 	if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FOG))
 	{
-		glFogf(GL_FOG_DENSITY, 0);
-		glFogfv(GL_FOG_COLOR, (F32 *) &LLColor4::white.mV);
-		glFogf(GL_FOG_END, 1000000.f);
+		if (!LLGLSLShader::sNoFixedFunction)
+		{
+			glFogf(GL_FOG_DENSITY, 0);
+			glFogfv(GL_FOG_COLOR, (F32 *) &LLColor4::white.mV);
+			glFogf(GL_FOG_END, 1000000.f);
+		}
 		return;
 	}
 
@@ -2112,7 +2115,10 @@ void LLVOSky::updateFog(const F32 distance)
 	if (camera_height > water_height)
 	{
 		LLColor4 fog(render_fog_color);
-		glFogfv(GL_FOG_COLOR, fog.mV);
+		if (!LLGLSLShader::sNoFixedFunction)
+		{
+			glFogfv(GL_FOG_COLOR, fog.mV);
+		}
 		mGLFogCol = fog;
 
 		if (hide_clip_plane)
@@ -2120,13 +2126,19 @@ void LLVOSky::updateFog(const F32 distance)
 			// For now, set the density to extend to the cull distance.
 			const F32 f_log = 2.14596602628934723963618357029f; // sqrt(fabs(log(0.01f)))
 			fog_density = f_log/fog_distance;
-			glFogi(GL_FOG_MODE, GL_EXP2);
+			if (!LLGLSLShader::sNoFixedFunction)
+			{
+				glFogi(GL_FOG_MODE, GL_EXP2);
+			}
 		}
 		else
 		{
 			const F32 f_log = 4.6051701859880913680359829093687f; // fabs(log(0.01f))
 			fog_density = (f_log)/fog_distance;
-			glFogi(GL_FOG_MODE, GL_EXP);
+			if (!LLGLSLShader::sNoFixedFunction)
+			{
+				glFogi(GL_FOG_MODE, GL_EXP);
+			}
 		}
 	}
 	else
@@ -2146,23 +2158,29 @@ void LLVOSky::updateFog(const F32 distance)
 		fogCol.setAlpha(1);
 
 		// set the gl fog color
-		glFogfv(GL_FOG_COLOR, (F32 *) &fogCol.mV);
 		mGLFogCol = fogCol;
 
 		// set the density based on what the shaders use
 		fog_density = water_fog_density * gSavedSettings.getF32("WaterGLFogDensityScale");
-		glFogi(GL_FOG_MODE, GL_EXP2);
+
+		if (!LLGLSLShader::sNoFixedFunction)
+		{
+			glFogfv(GL_FOG_COLOR, (F32 *) &fogCol.mV);
+			glFogi(GL_FOG_MODE, GL_EXP2);
+		}
 	}
 
 	mFogColor = sky_fog_color;
 	mFogColor.setAlpha(1);
-	LLGLSFog gls_fog;
+	LLDrawPoolWater::sWaterFogEnd = fog_distance*2.2f;
 
-	glFogf(GL_FOG_END, fog_distance*2.2f);
-
-	glFogf(GL_FOG_DENSITY, fog_density);
-
-	glHint(GL_FOG_HINT, GL_NICEST);
+	if (!LLGLSLShader::sNoFixedFunction)
+	{
+		LLGLSFog gls_fog;
+		glFogf(GL_FOG_END, fog_distance*2.2f);
+		glFogf(GL_FOG_DENSITY, fog_density);
+		glHint(GL_FOG_HINT, GL_NICEST);
+	}
 	stop_glerror();
 }
 
diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h
index d3a42583eaa41e4923bc23982f064ad111524602..6e6898d80a1a3807fca8989bd3d35d4cc22dbbd8 100644
--- a/indra/newview/llvosky.h
+++ b/indra/newview/llvosky.h
@@ -410,7 +410,7 @@ class LLVOSky : public LLStaticViewerObject
 	LLColor3 blue_density;
 	LLColor3 blue_horizon;
 	F32 haze_density;
-	LLColor3 haze_horizon;
+	F32 haze_horizon;
 	F32 density_multiplier;
 	F32 max_y;
 	LLColor3 glow;
diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp
index 510525259f4c9a6f64fee619aafb1785880adf12..bf6158eeafff8ade246ff261820a1806bcfc62cd 100644
--- a/indra/newview/llvosurfacepatch.cpp
+++ b/indra/newview/llvosurfacepatch.cpp
@@ -57,9 +57,15 @@ class LLVertexBufferTerrain : public LLVertexBuffer
 	};
 
 	// virtual
-	void setupVertexBuffer(U32 data_mask) const
+	void setupVertexBuffer(U32 data_mask)
 	{	
-		U8* base = useVBOs() ? (U8*) mAlignedOffset : mMappedData;
+		if (LLGLSLShader::sNoFixedFunction)
+		{ //just use default if shaders are in play
+			LLVertexBuffer::setupVertexBuffer(data_mask & ~(MAP_TEXCOORD2 | MAP_TEXCOORD3));
+			return;
+		}
+
+		volatile U8* base = useVBOs() ? (U8*) mAlignedOffset : mMappedData;
 
 		//assume tex coords 2 and 3 are present
 		U32 type_mask = mTypeMask | MAP_TEXCOORD2 | MAP_TEXCOORD3;
@@ -106,20 +112,6 @@ class LLVertexBufferTerrain : public LLVertexBuffer
 			glColorPointer(4, GL_UNSIGNED_BYTE, LLVertexBuffer::sTypeSize[TYPE_COLOR], (void*)(base + mOffsets[TYPE_COLOR]));
 		}
 		
-		if (data_mask & MAP_WEIGHT)
-		{
-			glVertexAttribPointerARB(1, 1, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], (void*)(base + mOffsets[TYPE_WEIGHT]));
-		}
-
-		if (data_mask & MAP_WEIGHT4 && sWeight4Loc != -1)
-		{
-			glVertexAttribPointerARB(sWeight4Loc, 4, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], (void*)(base+mOffsets[TYPE_WEIGHT4]));
-		}
-
-		if (data_mask & MAP_CLOTHWEIGHT)
-		{
-			glVertexAttribPointerARB(4, 4, GL_FLOAT, TRUE,  LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]));
-		}
 		if (data_mask & MAP_VERTEX)
 		{
 			glVertexPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0));
@@ -325,7 +317,6 @@ BOOL LLVOSurfacePatch::updateLOD()
 
 void LLVOSurfacePatch::getGeometry(LLStrider<LLVector3> &verticesp,
 								LLStrider<LLVector3> &normalsp,
-								LLStrider<LLColor4U> &colorsp,
 								LLStrider<LLVector2> &texCoords0p,
 								LLStrider<LLVector2> &texCoords1p,
 								LLStrider<U16> &indicesp)
@@ -337,7 +328,6 @@ void LLVOSurfacePatch::getGeometry(LLStrider<LLVector3> &verticesp,
 	updateMainGeometry(facep, 
 					verticesp,
 					normalsp,
-					colorsp,
 					texCoords0p,
 					texCoords1p,
 					indicesp,
@@ -345,7 +335,6 @@ void LLVOSurfacePatch::getGeometry(LLStrider<LLVector3> &verticesp,
 	updateNorthGeometry(facep, 
 						verticesp,
 						normalsp,
-						colorsp,
 						texCoords0p,
 						texCoords1p,
 						indicesp,
@@ -353,7 +342,6 @@ void LLVOSurfacePatch::getGeometry(LLStrider<LLVector3> &verticesp,
 	updateEastGeometry(facep, 
 						verticesp,
 						normalsp,
-						colorsp,
 						texCoords0p,
 						texCoords1p,
 						indicesp,
@@ -363,7 +351,6 @@ void LLVOSurfacePatch::getGeometry(LLStrider<LLVector3> &verticesp,
 void LLVOSurfacePatch::updateMainGeometry(LLFace *facep,
 										LLStrider<LLVector3> &verticesp,
 										LLStrider<LLVector3> &normalsp,
-										LLStrider<LLColor4U> &colorsp,
 										LLStrider<LLVector2> &texCoords0p,
 										LLStrider<LLVector2> &texCoords1p,
 										LLStrider<U16> &indicesp,
@@ -404,7 +391,6 @@ void LLVOSurfacePatch::updateMainGeometry(LLFace *facep,
 				x = i * render_stride;
 				y = j * render_stride;
 				mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
-				*colorsp++ = LLColor4U::white;
 				verticesp++;
 				normalsp++;
 				texCoords0p++;
@@ -469,7 +455,6 @@ void LLVOSurfacePatch::updateMainGeometry(LLFace *facep,
 void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep,
 										LLStrider<LLVector3> &verticesp,
 										LLStrider<LLVector3> &normalsp,
-										LLStrider<LLColor4U> &colorsp,
 										LLStrider<LLVector2> &texCoords0p,
 										LLStrider<LLVector2> &texCoords1p,
 										LLStrider<U16> &indicesp,
@@ -507,7 +492,6 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep,
 			y = 16 - render_stride;
 
 			mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
-			*colorsp++ = LLColor4U::white;
 			verticesp++;
 			normalsp++;
 			texCoords0p++;
@@ -523,7 +507,6 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep,
 			mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
 			verticesp++;
 			normalsp++;
-			*colorsp++ = LLColor4U::white;
 			texCoords0p++;
 			texCoords1p++;
 			vertex_count++;
@@ -562,7 +545,6 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep,
 			mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
 			verticesp++;
 			normalsp++;
-			*colorsp++ = LLColor4U::white;
 			texCoords0p++;
 			texCoords1p++;
 			vertex_count++;
@@ -577,7 +559,6 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep,
 			mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
 			verticesp++;
 			normalsp++;
-			*colorsp++ = LLColor4U::white;
 			texCoords0p++;
 			texCoords1p++;
 			vertex_count++;
@@ -621,7 +602,6 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep,
 			y = 16 - render_stride;
 
 			mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
-			*colorsp++ = LLColor4U::white;
 			verticesp++;
 			normalsp++;
 			texCoords0p++;
@@ -638,7 +618,6 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep,
 			mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
 			verticesp++;
 			normalsp++;
-			*colorsp++ = LLColor4U::white;
 			texCoords0p++;
 			texCoords1p++;
 			vertex_count++;
@@ -676,7 +655,6 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep,
 void LLVOSurfacePatch::updateEastGeometry(LLFace *facep,
 										  LLStrider<LLVector3> &verticesp,
 										  LLStrider<LLVector3> &normalsp,
-										  LLStrider<LLColor4U> &colorsp,
 										  LLStrider<LLVector2> &texCoords0p,
 										  LLStrider<LLVector2> &texCoords1p,
 										  LLStrider<U16> &indicesp,
@@ -710,7 +688,6 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep,
 			mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
 			verticesp++;
 			normalsp++;
-			*colorsp++ = LLColor4U::white;
 			texCoords0p++;
 			texCoords1p++;
 		}
@@ -723,7 +700,6 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep,
 			mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
 			verticesp++;
 			normalsp++;
-			*colorsp++ = LLColor4U::white;
 			texCoords0p++;
 			texCoords1p++;
 		}
@@ -761,7 +737,6 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep,
 			mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
 			verticesp++;
 			normalsp++;
-			*colorsp++ = LLColor4U::white;
 			texCoords0p++;
 			texCoords1p++;
 		}
@@ -774,7 +749,6 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep,
 			mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
 			verticesp++;
 			normalsp++;
-			*colorsp++ = LLColor4U::white;
 			texCoords0p++;
 			texCoords1p++;
 		}
@@ -818,7 +792,6 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep,
 			mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
 			verticesp++;
 			normalsp++;
-			*colorsp++ = LLColor4U::white;
 			texCoords0p++;
 			texCoords1p++;
 		}
@@ -831,7 +804,6 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep,
 			mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
 			verticesp++;
 			normalsp++;
-			*colorsp++ = LLColor4U::white;
 			texCoords0p++;
 			texCoords1p++;
 		}
@@ -1063,6 +1035,8 @@ void LLVOSurfacePatch::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newM
 {
 	LLVector3 posAgent = getPositionAgent();
 	LLVector3 scale = getScale();
+	//make z-axis scale at least 1 to avoid shadow artifacts on totally flat land
+	scale.mV[VZ] = llmax(scale.mV[VZ], 1.f);
 	newMin.load3( (posAgent-scale*0.5f).mV); // Changing to 2.f makes the culling a -little- better, but still wrong
 	newMax.load3( (posAgent+scale*0.5f).mV);
 	LLVector4a pos;
@@ -1102,14 +1076,12 @@ void LLTerrainPartition::getGeometry(LLSpatialGroup* group)
 	LLStrider<LLVector3> normals;
 	LLStrider<LLVector2> texcoords2;
 	LLStrider<LLVector2> texcoords;
-	LLStrider<LLColor4U> colors;
 	LLStrider<U16> indices;
 
 	llassert_always(buffer->getVertexStrider(vertices));
 	llassert_always(buffer->getNormalStrider(normals));
 	llassert_always(buffer->getTexCoord0Strider(texcoords));
 	llassert_always(buffer->getTexCoord1Strider(texcoords2));
-	llassert_always(buffer->getColorStrider(colors));
 	llassert_always(buffer->getIndexStrider(indices));
 
 	U32 indices_index = 0;
@@ -1124,13 +1096,13 @@ void LLTerrainPartition::getGeometry(LLSpatialGroup* group)
 		facep->setVertexBuffer(buffer);
 
 		LLVOSurfacePatch* patchp = (LLVOSurfacePatch*) facep->getViewerObject();
-		patchp->getGeometry(vertices, normals, colors, texcoords, texcoords2, indices);
+		patchp->getGeometry(vertices, normals, texcoords, texcoords2, indices);
 
 		indices_index += facep->getIndicesCount();
 		index_offset += facep->getGeomCount();
 	}
 
-	buffer->setBuffer(0);
+	buffer->flush();
 	mFaceList.clear();
 }
 
diff --git a/indra/newview/llvosurfacepatch.h b/indra/newview/llvosurfacepatch.h
index 8e75ff2e6e8be6b1c692b130ea171e6f97b64f15..a15878368e4c515ede7f3ed1c90f9a1c3b2680cd 100644
--- a/indra/newview/llvosurfacepatch.h
+++ b/indra/newview/llvosurfacepatch.h
@@ -44,8 +44,7 @@ class LLVOSurfacePatch : public LLStaticViewerObject
 		VERTEX_DATA_MASK =	(1 << LLVertexBuffer::TYPE_VERTEX) |
 							(1 << LLVertexBuffer::TYPE_NORMAL) |
 							(1 << LLVertexBuffer::TYPE_TEXCOORD0) |
-							(1 << LLVertexBuffer::TYPE_TEXCOORD1) |
-							(1 << LLVertexBuffer::TYPE_COLOR) 
+							(1 << LLVertexBuffer::TYPE_TEXCOORD1)
 	};
 
 	LLVOSurfacePatch(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
@@ -64,7 +63,6 @@ class LLVOSurfacePatch : public LLStaticViewerObject
 	/*virtual*/ void		updateFaceSize(S32 idx);
 	void getGeometry(LLStrider<LLVector3> &verticesp,
 								LLStrider<LLVector3> &normalsp,
-								LLStrider<LLColor4U> &colorsp,
 								LLStrider<LLVector2> &texCoords0p,
 								LLStrider<LLVector2> &texCoords1p,
 								LLStrider<U16> &indicesp);
@@ -116,7 +114,6 @@ class LLVOSurfacePatch : public LLStaticViewerObject
 	void updateMainGeometry(LLFace *facep,
 					   LLStrider<LLVector3> &verticesp,
 					   LLStrider<LLVector3> &normalsp,
-					   LLStrider<LLColor4U> &colorsp,
 					   LLStrider<LLVector2> &texCoords0p,
 					   LLStrider<LLVector2> &texCoords1p,
 					   LLStrider<U16> &indicesp,
@@ -124,7 +121,6 @@ class LLVOSurfacePatch : public LLStaticViewerObject
 	void updateNorthGeometry(LLFace *facep,
 					   LLStrider<LLVector3> &verticesp,
 					   LLStrider<LLVector3> &normalsp,
-					   LLStrider<LLColor4U> &colorsp,
 					   LLStrider<LLVector2> &texCoords0p,
 					   LLStrider<LLVector2> &texCoords1p,
 					   LLStrider<U16> &indicesp,
@@ -132,7 +128,6 @@ class LLVOSurfacePatch : public LLStaticViewerObject
 	void updateEastGeometry(LLFace *facep,
 					   LLStrider<LLVector3> &verticesp,
 					   LLStrider<LLVector3> &normalsp,
-					   LLStrider<LLColor4U> &colorsp,
 					   LLStrider<LLVector2> &texCoords0p,
 					   LLStrider<LLVector2> &texCoords1p,
 					   LLStrider<U16> &indicesp,
diff --git a/indra/newview/llvotextbubble.cpp b/indra/newview/llvotextbubble.cpp
deleted file mode 100644
index a92172fe2306ee662a233490a7533d21a6e0628f..0000000000000000000000000000000000000000
--- a/indra/newview/llvotextbubble.cpp
+++ /dev/null
@@ -1,272 +0,0 @@
-/** 
- * @file llvotextbubble.cpp
- * @brief Viewer-object text bubble.
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#include "llviewerprecompiledheaders.h"
-
-#include "llvotextbubble.h"
-
-#include "imageids.h"
-#include "llviewercontrol.h"
-#include "llprimitive.h"
-#include "llrendersphere.h"
-
-#include "llbox.h"
-#include "lldrawable.h"
-#include "llface.h"
-#include "llviewertexturelist.h"
-#include "llvolume.h"
-#include "pipeline.h"
-#include "llvector4a.h"
-#include "llviewerregion.h"
-
-LLVOTextBubble::LLVOTextBubble(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
-:	LLAlphaObject(id, pcode, regionp)
-{
-	setScale(LLVector3(1.5f, 1.5f, 0.25f));
-	mbCanSelect = FALSE;
-	mLOD = MIN_LOD;
-	mVolumeChanged = TRUE;
-	setVelocity(LLVector3(0.f, 0.f, 0.75f));
-	LLVolumeParams volume_params;
-	volume_params.setType(LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_LINE);
-	volume_params.setBeginAndEndS(0.f, 1.f);
-	volume_params.setBeginAndEndT(0.f, 1.f);
-	volume_params.setRatio(0.25f, 0.25f);
-	volume_params.setShear(0.f, 0.f);
-	setVolume(volume_params, 0);
-	mColor = LLColor4(1.0f, 0.0f, 0.0f, 1.f);
-	S32 i;
-	for (i = 0; i < getNumTEs(); i++)
-	{
-		setTEColor(i, mColor);
-		setTETexture(i, LLUUID(IMG_DEFAULT));
-	}
-}
-
-
-LLVOTextBubble::~LLVOTextBubble()
-{
-}
-
-
-BOOL LLVOTextBubble::isActive() const
-{
-	return TRUE;
-}
-
-BOOL LLVOTextBubble::idleUpdate(LLAgent &agent, LLWorld	&world, const F64 &time)
-{
-	static LLFastTimer::DeclareTimer ftm("Text Bubble");
-	LLFastTimer t(ftm);
-
-	F32 dt = mUpdateTimer.getElapsedTimeF32();
-	// Die after a few seconds.
-	if (dt > 1.5f)
-	{
-		return FALSE;
-	}
-
-	LLViewerObject::idleUpdate(agent, world, time);
-
-	setScale(0.5f * (1.f+dt) * LLVector3(1.5f, 1.5f, 0.5f));
-
-	F32 alpha = 0.35f*dt;
-
-	LLColor4 color = mColor;
-	color.mV[VALPHA] -= alpha;
-	if (color.mV[VALPHA] <= 0.05f)
-	{
-		return FALSE;
-	}
-	S32 i;
-	for (i = 0; i < getNumTEs(); i++)
-	{
-		setTEColor(i, color);
-		setTEFullbright(i, TRUE);
-	}
-
-	gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE);
-	return TRUE;
-}
-
-
-void LLVOTextBubble::updateTextures()
-{
-	// Update the image levels of all textures...
-
-	for (U32 i = 0; i < getNumTEs(); i++)
-	{
-		const LLTextureEntry *te = getTE(i);
-		F32 texel_area_ratio = fabs(te->mScaleS * te->mScaleT);
-		texel_area_ratio = llclamp(texel_area_ratio, .125f, 16.f);
-		LLViewerTexture *imagep = getTEImage(i);
-		if (imagep)
-		{
-			imagep->addTextureStats(mPixelArea / texel_area_ratio);
-		}
-	}
-}
-
-
-LLDrawable *LLVOTextBubble::createDrawable(LLPipeline *pipeline)
-{
-	pipeline->allocDrawable(this);
-	mDrawable->setLit(FALSE);
-	mDrawable->setRenderType(LLPipeline::RENDER_TYPE_VOLUME);
-	
-	for (U32 i = 0; i < getNumTEs(); i++)
-	{
-		LLViewerTexture *imagep;
-		const LLTextureEntry *texture_entry = getTE(i);
-		imagep = LLViewerTextureManager::getFetchedTexture(texture_entry->getID());
-
-		mDrawable->addFace((LLFacePool*) NULL, imagep);
-	}
-
-	return mDrawable;
-}
-
-// virtual
-BOOL LLVOTextBubble::setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume)
-{
-	if (LLPrimitive::setVolume(volume_params, mLOD))
-	{
-		if (mDrawable)
-		{
-			gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE);
-			mVolumeChanged = TRUE;
-		}
-		return TRUE;
-	}
-	return FALSE;
-}
-
-
-BOOL LLVOTextBubble::updateLOD()
-{
-	return FALSE;
-}
-
-BOOL LLVOTextBubble::updateGeometry(LLDrawable *drawable)
-{
- 	if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_VOLUME)))
-		return TRUE;
-	
-	if (mVolumeChanged)
-	{
-		LLVolumeParams volume_params = getVolume()->getParams();
-		setVolume(volume_params, 0);
-
-		LLPipeline::sCompiles++;
-
-		drawable->setNumFaces(getVolume()->getNumFaces(), drawable->getFace(0)->getPool(), getTEImage(0));
-	}
-
-	LLMatrix4 identity4;
-	LLMatrix3 identity3;
-	for (S32 i = 0; i < drawable->getNumFaces(); i++)
-	{
-		LLFace *face = drawable->getFace(i);
-		face->setTEOffset(i);
-		face->setTexture(LLViewerFetchedTexture::sSmokeImagep);
-		face->setState(LLFace::FULLBRIGHT);
-	}
-
-	mVolumeChanged = FALSE;
-
-	mDrawable->movePartition();
-	return TRUE;
-}
-
-void LLVOTextBubble::updateFaceSize(S32 idx)
-{
-	LLFace* face = mDrawable->getFace(idx);
-	
-	if (idx == 0 || idx == 2)
-	{
-		face->setSize(0,0);
-	}
-	else
-	{
-		const LLVolumeFace& vol_face = getVolume()->getVolumeFace(idx);
-		face->setSize(vol_face.mNumVertices, vol_face.mNumIndices);
-	}
-}
-
-void LLVOTextBubble::getGeometry(S32 idx,
-								LLStrider<LLVector3>& verticesp,
-								LLStrider<LLVector3>& normalsp, 
-								LLStrider<LLVector2>& texcoordsp,
-								LLStrider<LLColor4U>& colorsp, 
-								LLStrider<U16>& indicesp) 
-{
-	if (idx == 0 || idx == 2)
-	{
-		return;
-	}
-
-	const LLVolumeFace& face = getVolume()->getVolumeFace(idx);
-	
-	LLVector4a pos;
-	pos.load3(getPositionAgent().mV);
-
-	LLVector4a scale;
-	scale.load3(getScale().mV);
-
-	LLColor4U color = LLColor4U(getTE(idx)->getColor());
-	U32 offset = mDrawable->getFace(idx)->getGeomIndex();
-	
-	LLVector4a* dst_pos = (LLVector4a*) verticesp.get();
-	LLVector4a* src_pos = (LLVector4a*) face.mPositions;
-	
-	LLVector4a* dst_norm = (LLVector4a*) normalsp.get();
-	LLVector4a* src_norm  = (LLVector4a*) face.mNormals;
-	
-	LLVector2* dst_tc = (LLVector2*) texcoordsp.get();
-	LLVector2* src_tc = (LLVector2*) face.mTexCoords;
-
-	LLVector4a::memcpyNonAliased16((F32*) dst_norm, (F32*) src_norm, face.mNumVertices*4*sizeof(F32));
-	LLVector4a::memcpyNonAliased16((F32*) dst_tc, (F32*) src_tc, face.mNumVertices*2*sizeof(F32));
-	
-	
-	for (U32 i = 0; i < face.mNumVertices; i++)
-	{
-		LLVector4a t;
-		t.setMul(src_pos[i], scale);
-		dst_pos[i].setAdd(t, pos);
-		*colorsp++ = color;
-	}
-	
-	for (U32 i = 0; i < face.mNumIndices; i++)
-	{
-		*indicesp++ = face.mIndices[i] + offset;
-	}
-}
-
-U32 LLVOTextBubble::getPartitionType() const
-{ 
-	return LLViewerRegion::PARTITION_PARTICLE; 
-}
diff --git a/indra/newview/llvotextbubble.h b/indra/newview/llvotextbubble.h
deleted file mode 100644
index 9c39929711b1275e1c91eb90fc38faa05cbe4996..0000000000000000000000000000000000000000
--- a/indra/newview/llvotextbubble.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/** 
- * @file llvotextbubble.h
- * @brief Description of LLVORock class, which a derivation of LLViewerObject
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLVOTEXTBUBBLE_H
-#define LL_LLVOTEXTBUBBLE_H
-
-#include "llviewerobject.h"
-#include "llframetimer.h"
-
-class LLVOTextBubble : public LLAlphaObject
-{
-public:
-	LLVOTextBubble(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
-
-	/*virtual*/ BOOL    isActive() const; // Whether this object needs to do an idleUpdate.
-	/*virtual*/ BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
-
-	/*virtual*/ void updateTextures();
-	/*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
-	/*virtual*/ BOOL		updateGeometry(LLDrawable *drawable);
-	/*virtual*/ BOOL		updateLOD();
-	/*virtual*/ void		updateFaceSize(S32 idx);
-	
-	/*virtual*/ void		getGeometry(S32 idx,
-								LLStrider<LLVector3>& verticesp,
-								LLStrider<LLVector3>& normalsp, 
-								LLStrider<LLVector2>& texcoordsp,
-								LLStrider<LLColor4U>& colorsp, 
-								LLStrider<U16>& indicesp);
-
-	virtual U32 getPartitionType() const;
-
-	LLColor4 mColor;
-	S32 mLOD;
-	BOOL mVolumeChanged;
-
-protected:
-	~LLVOTextBubble();
-	BOOL setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false);
-	LLFrameTimer mUpdateTimer;
-};
-
-#endif // LL_VO_TEXT_BUBBLE
diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp
index 890861df71fa2bfe79afc48848dc47bf7ea0d822..4564207da4d4d2becc4b82aedb3e82e82a7acf47 100644
--- a/indra/newview/llvotree.cpp
+++ b/indra/newview/llvotree.cpp
@@ -341,45 +341,11 @@ U32 LLVOTree::processUpdateMessage(LLMessageSystem *mesgsys,
 
 BOOL LLVOTree::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
 {
-	const U16 FRAMES_PER_WIND_UPDATE = 20;				//  How many frames between wind update per tree
-	const F32 TREE_WIND_SENSITIVITY = 0.005f;
-	const F32 TREE_TRUNK_STIFFNESS = 0.1f;
-
  	if (mDead || !(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_TREE)))
 	{
 		return TRUE;
 	}
 	
-	if (gSavedSettings.getBOOL("RenderAnimateTrees"))
-	{
-		F32 mass_inv; 
-
-		//  For all tree objects, update the trunk bending with the current wind 
-		//  Walk sprite list in order away from viewer 
-		if (!(mFrameCount % FRAMES_PER_WIND_UPDATE)) 
-		{
-			//  If needed, Get latest wind for this tree
-			mWind = mRegionp->mWind.getVelocity(getPositionRegion());
-		}
-		mFrameCount++;
-
-		mass_inv = 1.f/(5.f + mDepth*mBranches*0.2f);
-		mTrunkVel += (mWind * mass_inv * TREE_WIND_SENSITIVITY);		//  Pull in direction of wind
-		mTrunkVel -= (mTrunkBend * mass_inv * TREE_TRUNK_STIFFNESS);		//  Restoring force in direction of trunk 	
-		mTrunkBend += mTrunkVel;
-		mTrunkVel *= 0.99f;									//  Add damping
-
-		if (mTrunkBend.length() > 1.f)
-		{
-			mTrunkBend.normalize();
-		}
-
-		if (mTrunkVel.length() > 1.f)
-		{
-			mTrunkVel.normalize();
-		}
-	}
-
 	S32 trunk_LOD = sMAX_NUM_TREE_LOD_LEVELS ;
 	F32 app_angle = getAppAngle()*LLVOTree::sTreeFactor;
 
@@ -392,39 +358,36 @@ BOOL LLVOTree::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
 		}
 	} 
 
-	if (!gSavedSettings.getBOOL("RenderAnimateTrees"))
+	if (mReferenceBuffer.isNull())
 	{
-		if (mReferenceBuffer.isNull())
-		{
-			gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, TRUE);
-		}
-		else if (trunk_LOD != mTrunkLOD)
+		gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, TRUE);
+	}
+	else if (trunk_LOD != mTrunkLOD)
+	{
+		gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, FALSE);
+	}
+	else
+	{
+		// we're not animating but we may *still* need to
+		// regenerate the mesh if we moved, since position
+		// and rotation are baked into the mesh.
+		// *TODO: I don't know what's so special about trees
+		// that they don't get REBUILD_POSITION automatically
+		// at a higher level.
+		const LLVector3 &this_position = getPositionAgent();
+		if (this_position != mLastPosition)
 		{
-			gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, FALSE);
+			gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION);
+			mLastPosition = this_position;
 		}
 		else
 		{
-			// we're not animating but we may *still* need to
-			// regenerate the mesh if we moved, since position
-			// and rotation are baked into the mesh.
-			// *TODO: I don't know what's so special about trees
-			// that they don't get REBUILD_POSITION automatically
-			// at a higher level.
-			const LLVector3 &this_position = getPositionAgent();
-			if (this_position != mLastPosition)
+			const LLQuaternion &this_rotation = getRotation();
+			
+			if (this_rotation != mLastRotation)
 			{
 				gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION);
-				mLastPosition = this_position;
-			}
-			else
-			{
-				const LLQuaternion &this_rotation = getRotation();
-				
-				if (this_rotation != mLastRotation)
-				{
-					gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION);
-					mLastRotation = this_rotation;
-				}
+				mLastRotation = this_rotation;
 			}
 		}
 	}
@@ -559,7 +522,7 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
 			max_vertices += sLODVertexCount[lod];
 		}
 
-		mReferenceBuffer = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK, gSavedSettings.getBOOL("RenderAnimateTrees") ? GL_STATIC_DRAW_ARB : 0);
+		mReferenceBuffer = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK, 0);
 		mReferenceBuffer->allocateBuffer(max_vertices, max_indices, TRUE);
 
 		LLStrider<LLVector3> vertices;
@@ -858,20 +821,13 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
 			slices /= 2; 
 		}
 
-		mReferenceBuffer->setBuffer(0);
+		mReferenceBuffer->flush();
 		llassert(vertex_count == max_vertices);
 		llassert(index_count == max_indices);
 	}
 
-	if (gSavedSettings.getBOOL("RenderAnimateTrees"))
-	{
-		mDrawable->getFace(0)->setVertexBuffer(mReferenceBuffer);
-	}
-	else
-	{
-		//generate tree mesh
-		updateMesh();
-	}
+	//generate tree mesh
+	updateMesh();
 	
 	return TRUE;
 }
@@ -882,7 +838,7 @@ void LLVOTree::updateMesh()
 	
 	// Translate to tree base  HACK - adjustment in Z plants tree underground
 	const LLVector3 &pos_agent = getPositionAgent();
-	//glTranslatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f);
+	//gGL.translatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f);
 	LLMatrix4 trans_mat;
 	trans_mat.setTranslation(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f);
 	trans_mat *= matrix;
@@ -940,8 +896,8 @@ void LLVOTree::updateMesh()
 
 	genBranchPipeline(vertices, normals, tex_coords, indices, idx_offset, scale_mat, mTrunkLOD, stop_depth, mDepth, mTrunkDepth, 1.0, mTwist, droop, mBranches, alpha);
 	
-	mReferenceBuffer->setBuffer(0);
-	buff->setBuffer(0);
+	mReferenceBuffer->flush();
+	buff->flush();
 }
 
 void LLVOTree::appendMesh(LLStrider<LLVector3>& vertices, 
@@ -1158,7 +1114,8 @@ U32 LLVOTree::drawBranchPipeline(LLMatrix4& matrix, U16* indicesp, S32 trunk_LOD
 				scale_mat.mMatrix[2][2] = scale*length;
 				scale_mat *= matrix;
 
-				glLoadMatrixf((F32*) scale_mat.mMatrix);
+				gGL.loadMatrix((F32*) scale_mat.mMatrix);
+				gGL.syncMatrices();
  				glDrawElements(GL_TRIANGLES, sLODIndexCount[trunk_LOD], GL_UNSIGNED_SHORT, indicesp + sLODIndexOffset[trunk_LOD]);
 				gPipeline.addTrianglesDrawn(LEAF_INDICES);
 				stop_glerror();
@@ -1208,7 +1165,8 @@ U32 LLVOTree::drawBranchPipeline(LLMatrix4& matrix, U16* indicesp, S32 trunk_LOD
 				scale_mat *= matrix;
 
 			
-				glLoadMatrixf((F32*) scale_mat.mMatrix);
+				gGL.loadMatrix((F32*) scale_mat.mMatrix);
+				gGL.syncMatrices();
 				glDrawElements(GL_TRIANGLES, LEAF_INDICES, GL_UNSIGNED_SHORT, indicesp);
 				gPipeline.addTrianglesDrawn(LEAF_INDICES);							
 				stop_glerror();
@@ -1229,19 +1187,20 @@ U32 LLVOTree::drawBranchPipeline(LLMatrix4& matrix, U16* indicesp, S32 trunk_LOD
 
 		scale_mat *= matrix;
 	
-		glMatrixMode(GL_TEXTURE);
-		glTranslatef(0.0, -0.5, 0.0);
-		glMatrixMode(GL_MODELVIEW);
+		gGL.matrixMode(LLRender::MM_TEXTURE);
+		gGL.translatef(0.0, -0.5, 0.0);
+		gGL.matrixMode(LLRender::MM_MODELVIEW);
 					
-		glLoadMatrixf((F32*) scale_mat.mMatrix);
+		gGL.loadMatrix((F32*) scale_mat.mMatrix);
+		gGL.syncMatrices();
 		glDrawElements(GL_TRIANGLES, LEAF_INDICES, GL_UNSIGNED_SHORT, indicesp);
 		gPipeline.addTrianglesDrawn(LEAF_INDICES);
 		stop_glerror();
 		ret += LEAF_INDICES;
 
-		glMatrixMode(GL_TEXTURE);
-		glLoadIdentity();
-		glMatrixMode(GL_MODELVIEW);
+		gGL.matrixMode(LLRender::MM_TEXTURE);
+		gGL.loadIdentity();
+		gGL.matrixMode(LLRender::MM_MODELVIEW);
 	}
 
 	return ret;
diff --git a/indra/newview/llvotree.h b/indra/newview/llvotree.h
index 1e1deede2640e7cfabe9b576e3aec396de680e17..0554935539e6fb078f032c1630f4d9d29923a096 100644
--- a/indra/newview/llvotree.h
+++ b/indra/newview/llvotree.h
@@ -152,7 +152,6 @@ class LLVOTree : public LLViewerObject
 	friend class LLDrawPoolTree;
 protected:
 	LLVector3		mTrunkBend;		// Accumulated wind (used for blowing trees)
-	LLVector3		mTrunkVel;		// 
 	LLVector3		mWind;
 
 	LLPointer<LLVertexBuffer> mReferenceBuffer; //reference geometry for generating tree mesh
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
old mode 100755
new mode 100644
index 380d63c77b977ce713c188cb315628383e219fa1..e7c35d8220f66be60b0b8ce661bc34898c8eb95c
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3266,13 +3266,13 @@ void LLVOVolume::updateRenderComplexity()
 	mRenderComplexity_current = 0;
 }
 
-U32 LLVOVolume::getTriangleCount() const
+U32 LLVOVolume::getTriangleCount(S32* vcount) const
 {
 	U32 count = 0;
 	LLVolume* volume = getVolume();
 	if (volume)
 	{
-		count = volume->getNumTriangles();
+		count = volume->getNumTriangles(vcount);
 	}
 
 	return count;
@@ -3976,8 +3976,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
 		}
 	}
 	
-	U8 glow = (U8) (facep->getTextureEntry()->getGlow() * 255);
-
 	if (idx >= 0 && 
 		draw_vec[idx]->mVertexBuffer == facep->getVertexBuffer() &&
 		draw_vec[idx]->mEnd == facep->getGeomIndex()-1 &&
@@ -3986,7 +3984,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
 		draw_vec[idx]->mEnd - draw_vec[idx]->mStart + facep->getGeomCount() <= (U32) gGLManager.mGLMaxVertexRange &&
 		draw_vec[idx]->mCount + facep->getIndicesCount() <= (U32) gGLManager.mGLMaxIndexRange &&
 #endif
-		draw_vec[idx]->mGlowColor.mV[3] == glow &&
 		draw_vec[idx]->mFullbright == fullbright &&
 		draw_vec[idx]->mBump == bump &&
 		draw_vec[idx]->mTextureMatrix == tex_mat &&
@@ -4018,7 +4015,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
 		draw_vec.push_back(draw_info);
 		draw_info->mTextureMatrix = tex_mat;
 		draw_info->mModelMatrix = model_mat;
-		draw_info->mGlowColor.setVec(0,0,0,glow);
 		if (type == LLRenderPass::PASS_ALPHA)
 		{ //for alpha sorting
 			facep->setDrawInfo(draw_info);
@@ -4101,6 +4097,32 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
 
 	LLFastTimer ftm2(FTM_REBUILD_VOLUME_VB);
 
+	LLVOAvatar* pAvatarVO = NULL;
+
+	LLSpatialBridge* bridge = group->mSpatialPartition->asBridge();
+	if (bridge)
+	{
+		if (bridge->mAvatar.isNull())
+		{
+			LLViewerObject* vobj = bridge->mDrawable->getVObj();
+			if (vobj)
+			{
+				bridge->mAvatar = vobj->getAvatar();
+			}
+		}
+
+		pAvatarVO = bridge->mAvatar;
+	}
+
+	if (pAvatarVO)
+	{
+		pAvatarVO->mAttachmentGeometryBytes -= group->mGeometryBytes;
+		pAvatarVO->mAttachmentSurfaceArea -= group->mSurfaceArea;
+	}
+
+	group->mGeometryBytes = 0;
+	group->mSurfaceArea = 0;
+	
 	group->clearDrawMap();
 
 	mFaceList.clear();
@@ -4118,6 +4140,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
 
 	U32 cur_total = 0;
 
+	bool emissive = false;
+
 	//get all the faces into a list
 	for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter)
 	{
@@ -4135,12 +4159,24 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
 
 		LLVOVolume* vobj = drawablep->getVOVolume();
 
+		if (!vobj)
+		{
+			continue;
+		}
+
 		if (vobj->isMesh() &&
 			(vobj->getVolume() && !vobj->getVolume()->isMeshAssetLoaded() || !gMeshRepo.meshRezEnabled()))
 		{
 			continue;
 		}
 
+		LLVolume* volume = vobj->getVolume();
+		if (volume)
+		{
+			const LLVector3& scale = vobj->getScale();
+			group->mSurfaceArea += volume->getSurfaceArea() * llmax(llmax(scale.mV[0], scale.mV[1]), scale.mV[2]);
+		}
+
 		llassert_always(vobj);
 		vobj->updateTextureVirtualSize(true);
 		vobj->preRebuild();
@@ -4185,7 +4221,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
 				//Determine if we've received skininfo that contains an
 				//alternate bind matrix - if it does then apply the translational component
 				//to the joints of the avatar.
-				LLVOAvatar* pAvatarVO = vobj->getAvatar();
 				bool pelvisGotSet = false;
 
 				if ( pAvatarVO )
@@ -4255,13 +4290,16 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
 
 					if (type == LLDrawPool::POOL_ALPHA)
 					{
-						if (te->getFullbright())
-						{
-							pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA);
-						}
-						else
+						if (te->getColor().mV[3] > 0.f)
 						{
-							pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_ALPHA);
+							if (te->getFullbright())
+							{
+								pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA);
+							}
+							else
+							{
+								pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_ALPHA);
+							}
 						}
 					}
 					else if (te->getShiny())
@@ -4330,6 +4368,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
 				}
 			}
 
+
 			if (cur_total > max_total || facep->getIndicesCount() <= 0 || facep->getGeomCount() <= 0)
 			{
 				facep->clearVertexBuffer();
@@ -4343,6 +4382,11 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
 				const LLTextureEntry* te = facep->getTextureEntry();
 				LLViewerTexture* tex = facep->getTexture();
 
+				if (te->getGlow() >= 1.f/255.f)
+				{
+					emissive = true;
+				}
+
 				if (facep->isState(LLFace::TEXTURE_ANIM))
 				{
 					if (!vobj->mTexAnimMode)
@@ -4388,7 +4432,10 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
 					}
 					else
 					{
-						drawablep->setState(LLDrawable::HAS_ALPHA);
+						if (te->getColor().mV[3] > 0.f)
+						{ //only treat as alpha in the pipeline if < 100% transparent
+							drawablep->setState(LLDrawable::HAS_ALPHA);
+						}
 						alpha_faces.push_back(facep);
 					}
 				}
@@ -4459,6 +4506,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
 	U32 bump_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR;
 	U32 fullbright_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR;
 
+	if (emissive)
+	{ //emissive faces are present, include emissive byte to preserve batching
+		simple_mask = simple_mask | LLVertexBuffer::MAP_EMISSIVE;
+		alpha_mask = alpha_mask | LLVertexBuffer::MAP_EMISSIVE;
+		bump_mask = bump_mask | LLVertexBuffer::MAP_EMISSIVE;
+		fullbright_mask = fullbright_mask | LLVertexBuffer::MAP_EMISSIVE;
+	}
+
 	bool batch_textures = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1;
 
 	if (batch_textures)
@@ -4498,6 +4553,12 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
 	}
 
 	mFaceList.clear();
+
+	if (pAvatarVO)
+	{
+		pAvatarVO->mAttachmentGeometryBytes += group->mGeometryBytes;
+		pAvatarVO->mAttachmentSurfaceArea += group->mSurfaceArea;
+	}
 }
 
 static LLFastTimer::DeclareTimer FTM_VOLUME_GEOM("Volume Geometry");
@@ -4551,7 +4612,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
 		
 		for (std::set<LLVertexBuffer*>::iterator iter = mapped_buffers.begin(); iter != mapped_buffers.end(); ++iter)
 		{
-			(*iter)->setBuffer(0);
+			(*iter)->flush();
 		}
 
 		// don't forget alpha
@@ -4559,7 +4620,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
 		   !group->mVertexBuffer.isNull() && 
 		   group->mVertexBuffer->isLocked())
 		{
-			group->mVertexBuffer->setBuffer(0);
+			group->mVertexBuffer->flush();
 		}
 
 		//if not all buffers are unmapped
@@ -4575,7 +4636,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
 					LLVertexBuffer* buff = face->getVertexBuffer();
 					if (face && buff && buff->isLocked())
 					{
-						buff->setBuffer(0) ;
+						buff->flush();
 					}
 				}
 			} 
@@ -4602,10 +4663,6 @@ struct CompareBatchBreakerModified
 		{
 			return lte->getFullbright() < rte->getFullbright();
 		}
-		else  if (lte->getGlow() != rte->getGlow())
-		{
-			return lte->getGlow() < rte->getGlow();
-		}
 		else
 		{
 			return lhs->getTexture() < rhs->getTexture();
@@ -4616,6 +4673,19 @@ struct CompareBatchBreakerModified
 
 void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::vector<LLFace*>& faces, BOOL distance_sort, BOOL batch_textures)
 {
+	U32 buffer_usage = group->mBufferUsage;
+	
+#if LL_DARWIN
+	// HACK from Leslie:
+	// Disable VBO usage for alpha on Mac OS X because it kills the framerate
+	// due to implicit calls to glTexSubImage that are beyond our control.
+	// (this works because the only calls here that sort by distance are alpha)
+	if (distance_sort)
+	{
+		buffer_usage = 0x0;
+	}
+#endif
+	
 	//calculate maximum number of vertices to store in a single buffer
 	U32 max_vertices = (gSavedSettings.getS32("RenderMaxVBOSize")*1024)/LLVertexBuffer::calcVertexSize(group->mSpatialPartition->mVertexDataMask);
 	max_vertices = llmin(max_vertices, (U32) 65535);
@@ -4644,11 +4714,11 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
 		buffer_index = -1;
 	}
 
-	S32 texture_index_channels = gGLManager.mNumTextureImageUnits-1; //always reserve one for shiny for now just for simplicity
+	S32 texture_index_channels = 1;
 	
-	if (gGLManager.mGLVersion < 3.1f)
+	if (gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 30)
 	{
-		texture_index_channels = 1;
+		texture_index_channels = LLGLSLShader::sIndexedTextureChannels-1; //always reserve one for shiny for now just for simplicity;
 	}
 
 	if (LLPipeline::sRenderDeferred && distance_sort)
@@ -4658,6 +4728,8 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
 
 	texture_index_channels = llmin(texture_index_channels, (S32) gSavedSettings.getU32("RenderMaxTextureIndex"));
 	
+	//NEVER use more than 16 texture index channels (workaround for prevalent driver bug)
+	texture_index_channels = llmin(texture_index_channels, 16);
 
 	while (face_iter != faces.end())
 	{
@@ -4783,29 +4855,30 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
 	
 		//create/delete/resize vertex buffer if needed
 		LLVertexBuffer* buffer = NULL;
-		LLSpatialGroup::buffer_texture_map_t::iterator found_iter = group->mBufferMap[mask].find(*face_iter);
+
+		{ //try to find a buffer to reuse
+			LLSpatialGroup::buffer_texture_map_t::iterator found_iter = group->mBufferMap[mask].find(*face_iter);
 		
-		if (found_iter != group->mBufferMap[mask].end())
-		{
-			if ((U32) buffer_index < found_iter->second.size())
+			if (found_iter != group->mBufferMap[mask].end())
 			{
-				buffer = found_iter->second[buffer_index];
+				if ((U32) buffer_index < found_iter->second.size())
+				{
+					buffer = found_iter->second[buffer_index];
+				}
 			}
 		}
 						
-		if (!buffer)
+		if (!buffer || !buffer->isWriteable())
 		{ //create new buffer if needed
-			buffer = createVertexBuffer(mask, 
-											group->mBufferUsage);
+			buffer = createVertexBuffer(mask, buffer_usage);
 			buffer->allocateBuffer(geom_count, index_count, TRUE);
 		}
 		else 
 		{ //resize pre-existing buffer
-			if (LLVertexBuffer::sEnableVBOs && buffer->getUsage() != group->mBufferUsage ||
+			if (LLVertexBuffer::sEnableVBOs && buffer->getUsage() != buffer_usage ||
 				buffer->getTypeMask() != mask)
 			{
-				buffer = createVertexBuffer(mask, 
-											group->mBufferUsage);
+				buffer = createVertexBuffer(mask, buffer_usage);
 				buffer->allocateBuffer(geom_count, index_count, TRUE);
 			}
 			else
@@ -4814,6 +4887,9 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
 			}
 		}
 
+		group->mGeometryBytes += buffer->getSize() + buffer->getIndicesSize();
+
+
 		buffer_map[mask][*face_iter].push_back(buffer);
 
 		//add face geometry
@@ -4863,6 +4939,11 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
 				fullbright = TRUE;
 			}
 
+			if (hud_group)
+			{ //all hud attachments are fullbright
+				fullbright = TRUE;
+			}
+
 			const LLTextureEntry* te = facep->getTextureEntry();
 			tex = facep->getTexture();
 
@@ -4871,7 +4952,11 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
 			if (is_alpha)
 			{
 				// can we safely treat this as an alpha mask?
-				if (facep->canRenderAsMask())
+				if (facep->getFaceColor().mV[3] <= 0.f)
+				{ //100% transparent, don't render unless we're highlighting transparent
+					registerFace(group, facep, LLRenderPass::PASS_ALPHA_INVISIBLE);
+				}
+				else if (facep->canRenderAsMask())
 				{
 					if (te->getFullbright() || LLPipeline::sNoAlpha)
 					{
@@ -4886,14 +4971,8 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
 				{
 					registerFace(group, facep, LLRenderPass::PASS_ALPHA);
 				}
-
-				if (LLPipeline::sRenderDeferred)
-				{
-					registerFace(group, facep, LLRenderPass::PASS_ALPHA_SHADOW);
-				}
 			}
 			else if (gPipeline.canUseVertexShaders()
-				&& group->mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_HUD 
 				&& LLPipeline::sRenderBump 
 				&& te->getShiny())
 			{ //shiny
@@ -4958,9 +5037,12 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
 					}
 				}
 				
-				//not sure why this is here -- shiny HUD attachments maybe?  -- davep 5/11/2010
-				if (!is_alpha && te->getShiny() && LLPipeline::sRenderBump)
-				{
+				
+				if (!gPipeline.canUseVertexShaders() && 
+					!is_alpha && 
+					te->getShiny() && 
+					LLPipeline::sRenderBump)
+				{ //shiny as an extra pass when shaders are disabled
 					registerFace(group, facep, LLRenderPass::PASS_SHINY);
 				}
 			}
@@ -4985,7 +5067,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
 			++face_iter;
 		}
 
-		buffer->setBuffer(0);
+		buffer->flush();
 	}
 
 	group->mBufferMap[mask].clear();
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index b6347526eeed3659c7544ad697e3a1f05f440467..3cf434dc260a917e7a1db1f7225a4ab86157331d 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -131,9 +131,10 @@ class LLVOVolume : public LLViewerObject
 	/*virtual*/	const LLMatrix4	getRenderMatrix() const;
 				typedef std::map<LLUUID, S32> texture_cost_t;
 				U32 	getRenderCost(texture_cost_t &textures) const;
-	/*virtual*/	F32		getStreamingCost(S32* bytes = NULL, S32* visible_bytes = NULL, F32* unscaled_value = NULL) const;
+				F32		getStreamingCost(S32* bytes, S32* visible_bytes, F32* unscaled_value) const;
+	/*virtual*/	F32		getStreamingCost(S32* bytes = NULL, S32* visible_bytes = NULL) { return getStreamingCost(bytes, visible_bytes, NULL); }
 
-	/*virtual*/ U32		getTriangleCount() const;
+	/*virtual*/ U32		getTriangleCount(S32* vcount = NULL) const;
 	/*virtual*/ U32		getHighLODTriangleCount();
 	/*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, 
 										  S32 face = -1,                        // which face to check, -1 = ALL_SIDES
diff --git a/indra/newview/llvowater.cpp b/indra/newview/llvowater.cpp
index e70ac0a2e747600e753a26b59617e02cd6b0886a..cd7815794444869bfa417251a8605f30ef7276a4 100644
--- a/indra/newview/llvowater.cpp
+++ b/indra/newview/llvowater.cpp
@@ -160,14 +160,14 @@ BOOL LLVOWater::updateGeometry(LLDrawable *drawable)
 	static const unsigned int vertices_per_quad = 4;
 	static const unsigned int indices_per_quad = 6;
 
-	const S32 size = gSavedSettings.getBOOL("RenderTransparentWater") ? 16 : 1;
+	const S32 size = gSavedSettings.getBOOL("RenderTransparentWater") && LLGLSLShader::sNoFixedFunction ? 16 : 1;
 
 	const S32 num_quads = size * size;
 	face->setSize(vertices_per_quad * num_quads,
 				  indices_per_quad * num_quads);
 	
 	LLVertexBuffer* buff = face->getVertexBuffer();
-	if (!buff)
+	if (!buff || !buff->isWriteable())
 	{
 		buff = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK, GL_DYNAMIC_DRAW_ARB);
 		buff->allocateBuffer(face->getGeomCount(), face->getIndicesCount(), TRUE);
@@ -197,6 +197,13 @@ BOOL LLVOWater::updateGeometry(LLDrawable *drawable)
 
 	F32 size_inv = 1.f / size;
 
+	F32 z_fudge = 0.f;
+
+	if (getIsEdgePatch())
+	{ //bump edge patches down 10 cm to prevent aliasing along edges
+		z_fudge = -0.1f;
+	}
+
 	for (y = 0; y < size; y++)
 	{
 		for (x = 0; x < size; x++)
@@ -205,6 +212,7 @@ BOOL LLVOWater::updateGeometry(LLDrawable *drawable)
 			position_agent = getPositionAgent() - getScale() * 0.5f;
 			position_agent.mV[VX] += (x + 0.5f) * step_x;
 			position_agent.mV[VY] += (y + 0.5f) * step_y;
+			position_agent.mV[VZ] += z_fudge;
 
 			*verticesp++  = position_agent - right + up;
 			*verticesp++  = position_agent - right - up;
@@ -231,7 +239,7 @@ BOOL LLVOWater::updateGeometry(LLDrawable *drawable)
 		}
 	}
 	
-	buff->setBuffer(0);
+	buff->flush();
 
 	mDrawable->movePartition();
 	LLPipeline::sCompiles++;
diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp
index 7b1c7254832b74fc911713ed8d69b52a5d677822..afd902201bcfbfc1ff20c2579fd9ca1e547e30e0 100644
--- a/indra/newview/llvowlsky.cpp
+++ b/indra/newview/llvowlsky.cpp
@@ -326,7 +326,7 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
 
 		buildFanBuffer(vertices, texCoords, indices);
 
-		mFanVerts->setBuffer(0);
+		mFanVerts->flush();
 	}
 
 	{
@@ -349,6 +349,9 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
 
 		mStripsVerts.resize(strips_segments, NULL);
 
+		LLTimer timer;
+		timer.start();
+
 		for (U32 i = 0; i < strips_segments ;++i)
 		{
 			LLVertexBuffer * segment = new LLVertexBuffer(LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK, GL_STATIC_DRAW_ARB);
@@ -388,8 +391,10 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
 			buildStripsBuffer(begin_stack, end_stack,  vertices, texCoords, indices);
 
 			// and unlock the buffer
-			segment->setBuffer(0);
+			segment->flush();
 		}
+	
+		llinfos << "completed in " << llformat("%.2f", timer.getElapsedTimeF32()) << "seconds" << llendl;
 	}
 #else
 	mStripsVerts = new LLVertexBuffer(LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK, GL_STATIC_DRAW_ARB);
@@ -468,7 +473,7 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
 		}
 	}
 
-	mStripsVerts->setBuffer(0);
+	mStripsVerts->flush();
 #endif
 
 	updateStarColors();
@@ -485,7 +490,7 @@ void LLVOWLSky::drawStars(void)
 	if (mStarsVerts.notNull())
 	{
 		mStarsVerts->setBuffer(LLDrawPoolWLSky::STAR_VERTEX_DATA_MASK);
-		mStarsVerts->drawArrays(LLRender::QUADS, 0, getStarsNumVerts()*4);
+		mStarsVerts->drawArrays(LLRender::TRIANGLES, 0, getStarsNumVerts()*4);
 	}
 }
 
@@ -511,13 +516,14 @@ void LLVOWLSky::drawDome(void)
 
 		strips_segment->drawRange(
 			LLRender::TRIANGLE_STRIP, 
-			0, strips_segment->getRequestedVerts()-1, strips_segment->getRequestedIndices(), 
+			0, strips_segment->getNumVerts()-1, strips_segment->getNumIndices(), 
 			0);
-		gPipeline.addTrianglesDrawn(strips_segment->getRequestedIndices(), LLRender::TRIANGLE_STRIP);
+		gPipeline.addTrianglesDrawn(strips_segment->getNumIndices(), LLRender::TRIANGLE_STRIP);
 	}
 
 #else
 	mStripsVerts->setBuffer(data_mask);
+	gGL.syncMatrices();
 	glDrawRangeElements(
 		GL_TRIANGLES,
 		0, mStripsVerts->getNumVerts()-1, mStripsVerts->getNumIndices(),
@@ -768,10 +774,10 @@ BOOL LLVOWLSky::updateStarGeometry(LLDrawable *drawable)
 	LLStrider<LLColor4U> colorsp;
 	LLStrider<LLVector2> texcoordsp;
 
-	if (mStarsVerts.isNull())
+	if (mStarsVerts.isNull() || !mStarsVerts->isWriteable())
 	{
 		mStarsVerts = new LLVertexBuffer(LLDrawPoolWLSky::STAR_VERTEX_DATA_MASK, GL_DYNAMIC_DRAW);
-		mStarsVerts->allocateBuffer(getStarsNumVerts()*4, 0, TRUE);
+		mStarsVerts->allocateBuffer(getStarsNumVerts()*6, 0, TRUE);
 	}
  
 	BOOL success = mStarsVerts->getVertexStrider(verticesp)
@@ -806,19 +812,25 @@ BOOL LLVOWLSky::updateStarGeometry(LLDrawable *drawable)
 		*(verticesp++)  = mStarVertices[vtx];
 		*(verticesp++) = mStarVertices[vtx]+left;
 		*(verticesp++) = mStarVertices[vtx]+left+up;
+		*(verticesp++) = mStarVertices[vtx]+left;
+		*(verticesp++) = mStarVertices[vtx]+left+up;
 		*(verticesp++) = mStarVertices[vtx]+up;
 
 		*(texcoordsp++) = LLVector2(0,0);
 		*(texcoordsp++) = LLVector2(0,1);
 		*(texcoordsp++) = LLVector2(1,1);
+		*(texcoordsp++) = LLVector2(0,1);
+		*(texcoordsp++) = LLVector2(1,1);
 		*(texcoordsp++) = LLVector2(1,0);
 
 		*(colorsp++)    = LLColor4U(mStarColors[vtx]);
 		*(colorsp++)    = LLColor4U(mStarColors[vtx]);
 		*(colorsp++)    = LLColor4U(mStarColors[vtx]);
 		*(colorsp++)    = LLColor4U(mStarColors[vtx]);
+		*(colorsp++)    = LLColor4U(mStarColors[vtx]);
+		*(colorsp++)    = LLColor4U(mStarColors[vtx]);
 	}
 
-	mStarsVerts->setBuffer(0);
+	mStarsVerts->flush();
 	return TRUE;
 }
diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp
index 1a98d4c6c25e6043e947ae43758a60f688b9a3e6..e38611233486a25385695bfea34cf5f420eb3608 100644
--- a/indra/newview/llwaterparammanager.cpp
+++ b/indra/newview/llwaterparammanager.cpp
@@ -190,10 +190,11 @@ void LLWaterParamManager::updateShaderUniforms(LLGLSLShader * shader)
 		shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, LLWLParamManager::getInstance()->getRotatedLightDir().mV);
 		shader->uniform3fv("camPosLocal", 1, LLViewerCamera::getInstance()->getOrigin().mV);
 		shader->uniform4fv("waterFogColor", 1, LLDrawPoolWater::sWaterFogColor.mV);
+		shader->uniform1f("waterFogEnd", LLDrawPoolWater::sWaterFogEnd);
 		shader->uniform4fv("waterPlane", 1, mWaterPlane.mV);
 		shader->uniform1f("waterFogDensity", getFogDensity());
 		shader->uniform1f("waterFogKS", mWaterFogKS);
-		shader->uniform4f("distance_multiplier", 0, 0, 0, 0);
+		shader->uniform1f("distance_multiplier", 0);
 	}
 }
 
diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp
index d8aa0b7d5c6aadfa33dba63f17fb590bb3c2b6db..402504933cd9e3ea8e4e5fdb5ccb5da7f94cceeb 100644
--- a/indra/newview/llwearable.cpp
+++ b/indra/newview/llwearable.cpp
@@ -221,7 +221,7 @@ void LLWearable::createVisualParams()
 		param->resetDrivenParams();
 		if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false))
 		{
-			if( !param->linkDrivenParams(boost::bind(avatar_function,gAgentAvatarp,_1 ), true))
+			if( !param->linkDrivenParams(boost::bind(avatar_function,gAgentAvatarp.get(),_1 ), true))
 			{
 				llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl;
 				continue;
@@ -810,6 +810,20 @@ const LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index) const
 	return NULL;
 }
 
+std::vector<LLLocalTextureObject*> LLWearable::getLocalTextureListSeq()
+{
+	std::vector<LLLocalTextureObject*> result;
+
+	for(te_map_t::const_iterator iter = mTEMap.begin();
+		iter != mTEMap.end(); iter++)
+	{
+		LLLocalTextureObject* lto = iter->second;
+		result.push_back(lto);
+	}
+
+	return result;
+}
+
 void LLWearable::setLocalTextureObject(S32 index, LLLocalTextureObject &lto)
 {
 	if( mTEMap.find(index) != mTEMap.end() )
diff --git a/indra/newview/llwearable.h b/indra/newview/llwearable.h
index fd614ade64b5b3c46d712df76d3c8b381aac3d25..3d8c53a755c3a17efe810d10d272b224f0d750f8 100644
--- a/indra/newview/llwearable.h
+++ b/indra/newview/llwearable.h
@@ -106,6 +106,7 @@ class LLWearable
 
 	LLLocalTextureObject* getLocalTextureObject(S32 index);
 	const LLLocalTextureObject* getLocalTextureObject(S32 index) const;
+	std::vector<LLLocalTextureObject*> getLocalTextureListSeq();
 
 	void				setLocalTextureObject(S32 index, LLLocalTextureObject &lto);
 	void				addVisualParam(LLVisualParam *param);
diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp
index ddbcdfc3f7a2d35f4182f0208b20a0a681091621..6f6411ce3cc5337a841b7ba573cef9da803ae76d 100644
--- a/indra/newview/llwearablelist.cpp
+++ b/indra/newview/llwearablelist.cpp
@@ -63,7 +63,7 @@ struct LLWearableArrivedData
 
 LLWearableList::~LLWearableList()
 {
-	llassert_always(mList.empty()) ;
+	cleanup();
 }
 
 void LLWearableList::cleanup() 
diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp
index 55608a059f96e3fd39e205cbcef99f296b27d25b..49d9d44d74995b46d8c26b1cfc873ede63d9fbba 100644
--- a/indra/newview/llwlparammanager.cpp
+++ b/indra/newview/llwlparammanager.cpp
@@ -64,7 +64,6 @@
 LLWLParamManager::LLWLParamManager() :
 
 	//set the defaults for the controls
-	// index is from sWLUniforms in pipeline.cpp line 979
 
 	/// Sun Delta Terrain tweak variables.
 	mSunDeltaYaw(180.0f),
@@ -72,10 +71,10 @@ LLWLParamManager::LLWLParamManager() :
 	mWLGamma(1.0f, "gamma"),
 
 	mBlueHorizon(0.25f, 0.25f, 1.0f, 1.0f, "blue_horizon", "WLBlueHorizon"),
-	mHazeDensity(1.0f, 1.0f, 1.0f, 0.5f, "haze_density"),
+	mHazeDensity(1.0f, "haze_density"),
 	mBlueDensity(0.25f, 0.25f, 0.25f, 1.0f, "blue_density", "WLBlueDensity"),
 	mDensityMult(1.0f, "density_multiplier", 1000),
-	mHazeHorizon(1.0f, 1.0f, 1.0f, 0.5f, "haze_horizon"),
+	mHazeHorizon(1.0f, "haze_horizon"),
 	mMaxAlt(4000.0f, "max_y"),
 
 	// Lighting
diff --git a/indra/newview/llwlparammanager.h b/indra/newview/llwlparammanager.h
index bc984b9126a0bb524af12851b0ef37d31764283f..72422500fcc8ebd48df45051a2c8d41b5998d2cc 100644
--- a/indra/newview/llwlparammanager.h
+++ b/indra/newview/llwlparammanager.h
@@ -102,9 +102,8 @@ struct WLFloatControl {
 	{
 	}
 
-	inline WLFloatControl & operator = (LLVector4 const & val) {
-		x = val.mV[0];
-
+	inline WLFloatControl & operator = (F32 val) {
+		x = val;
 		return *this;
 	}
 
@@ -340,10 +339,10 @@ class LLWLParamManager : public LLSingleton<LLWLParamManager>
 	
 	/// Atmospherics
 	WLColorControl mBlueHorizon;
-	WLColorControl mHazeDensity;
+	WLFloatControl mHazeDensity;
 	WLColorControl mBlueDensity;
 	WLFloatControl mDensityMult;
-	WLColorControl mHazeHorizon;
+	WLFloatControl mHazeHorizon;
 	WLFloatControl mMaxAlt;
 
 	/// Lighting
diff --git a/indra/newview/llwlparamset.cpp b/indra/newview/llwlparamset.cpp
index 02d914a8124f5c06b0667deea1b54ba5813e9da9..b04d30db5522a43071b84eafedc35c94fb2a8165 100644
--- a/indra/newview/llwlparamset.cpp
+++ b/indra/newview/llwlparamset.cpp
@@ -41,85 +41,90 @@
 LLWLParamSet::LLWLParamSet(void) :
 	mName("Unnamed Preset"),
 	mCloudScrollXOffset(0.f), mCloudScrollYOffset(0.f)	
-{
-/* REMOVE or init the LLSD
-	const std::map<std::string, LLVector4>::value_type hardcodedPreset[] = {
-		std::make_pair("lightnorm",				LLVector4(0.f, 0.707f, -0.707f, 0.f)),
-		std::make_pair("sunlight_color",		LLVector4(0.6f, 0.6f, 2.83f, 2.27f)),
-		std::make_pair("ambient",				LLVector4(0.27f, 0.33f, 0.44f, 1.19f)),
-		std::make_pair("blue_horizon",			LLVector4(0.3f, 0.4f, 0.9f, 1.f)),
-		std::make_pair("blue_density",			LLVector4(0.3f, 0.4f, 0.8f, 1.f)),
-		std::make_pair("haze_horizon",			LLVector4(0.6f, 0.6f, 0.6f, 1.f)),
-		std::make_pair("haze_density",			LLVector4(0.3f, 0.3f, 0.3f, 1.f)),
-		std::make_pair("cloud_shadow",			LLVector4(0.f, 0.f, 0.f, 0.f)),
-		std::make_pair("density_multiplier",	LLVector4(0.001f, 0.001f, 0.001f, 0.001f)),
-		std::make_pair("distance_multiplier",	LLVector4(1.f, 1.f, 1.f, 1.f)),
-		std::make_pair("max_y",					LLVector4(600.f, 600.f, 600.f, 0.f)),
-		std::make_pair("glow",					LLVector4(15.f, 0.001f, -0.03125f, 0.f)),
-		std::make_pair("cloud_color",			LLVector4(0.0f, 0.0f, 0.0f, 0.0f)),
-		std::make_pair("cloud_pos_density1",	LLVector4(0.f, 0.f, 0.f, 1.f)),
-		std::make_pair("cloud_pos_density2",	LLVector4(0.f, 0.f, 0.f, 1.f)),
-		std::make_pair("cloud_scale",			LLVector4(0.42f, 0.f, 0.f, 1.f)),
-		std::make_pair("gamma",					LLVector4(2.0f, 2.0f, 2.0f, 0.0f)),
-	};
-	std::map<std::string, LLVector4>::value_type const * endHardcodedPreset = 
-		hardcodedPreset + LL_ARRAY_SIZE(hardcodedPreset);
-
-	mParamValues.insert(hardcodedPreset, endHardcodedPreset);
-*/
-}
+{}
+
+static LLFastTimer::DeclareTimer FTM_WL_PARAM_UPDATE("WL Param Update");
 
 void LLWLParamSet::update(LLGLSLShader * shader) const 
 {	
+	LLFastTimer t(FTM_WL_PARAM_UPDATE);
+
 	for(LLSD::map_const_iterator i = mParamValues.beginMap();
 		i != mParamValues.endMap();
 		++i)
 	{
 		const std::string& param = i->first;
 		
-		if(	param == "star_brightness" || param == "preset_num" || param == "sun_angle" ||
+		if (param == "star_brightness" || param == "preset_num" || param == "sun_angle" ||
 			param == "east_angle" || param == "enable_cloud_scroll" ||
 			param == "cloud_scroll_rate" || param == "lightnorm" ) 
 		{
 			continue;
 		}
 		
-		if(param == "cloud_pos_density1") 
+		if (param == "cloud_pos_density1")
 		{
 			LLVector4 val;
 			val.mV[0] = F32(i->second[0].asReal()) + mCloudScrollXOffset;
 			val.mV[1] = F32(i->second[1].asReal()) + mCloudScrollYOffset;
 			val.mV[2] = (F32) i->second[2].asReal();
 			val.mV[3] = (F32) i->second[3].asReal();
-			
-			shader->uniform4fv(param, 1, val.mV);	
-		} 
+
+			stop_glerror();
+			shader->uniform4fv(param, 1, val.mV);
+			stop_glerror();
+		}
+		else if (param == "cloud_scale" || param == "cloud_shadow" ||
+				 param == "density_multiplier" || param == "distance_multiplier" ||
+				 param == "haze_density" || param == "haze_horizon" ||
+				 param == "max_y" )
+		{
+			F32 val = (F32) i->second[0].asReal();
+
+			stop_glerror();
+			shader->uniform1f(param, val);
+			stop_glerror();
+		}
 		else // param is the uniform name
 		{
-			LLVector4 val;
-			
 			// handle all the different cases
-			if(i->second.isArray() && i->second.size() == 4) 
+			if (i->second.isArray() && i->second.size() == 4)
 			{
+				LLVector4 val;
+
 				val.mV[0] = (F32) i->second[0].asReal();
 				val.mV[1] = (F32) i->second[1].asReal();
 				val.mV[2] = (F32) i->second[2].asReal();
 				val.mV[3] = (F32) i->second[3].asReal();															
+
+				stop_glerror();
+				shader->uniform4fv(param, 1, val.mV);
+				stop_glerror();
 			} 
-			else if(i->second.isReal()) 
+			else if (i->second.isReal())
 			{
-				val.mV[0] = (F32) i->second.asReal();
+				F32 val = (F32) i->second.asReal();
+
+				stop_glerror();
+				shader->uniform1f(param, val);
+				stop_glerror();
 			} 
-			else if(i->second.isInteger()) 
+			else if (i->second.isInteger())
 			{
-				val.mV[0] = (F32) i->second.asReal();
+				S32 val = (S32) i->second.asInteger();
+
+				stop_glerror();
+				shader->uniform1i(param, val);
+				stop_glerror();
 			} 
-			else if(i->second.isBoolean())
+			else if (i->second.isBoolean())
 			{
-				val.mV[0] = i->second.asBoolean();
+				S32 val = (i->second.asBoolean() ? 1 : 0);
+
+				stop_glerror();
+				shader->uniform1i(param, val);
+				stop_glerror();
 			}
-			
-			shader->uniform4fv(param, 1, val.mV);
 		}
 	}
 }
@@ -140,7 +145,8 @@ void LLWLParamSet::set(const std::string& paramName, float x)
 	}
 }
 
-void LLWLParamSet::set(const std::string& paramName, float x, float y) {
+void LLWLParamSet::set(const std::string& paramName, float x, float y)
+{
 	mParamValues[paramName][0] = x;
 	mParamValues[paramName][1] = y;
 }
@@ -186,7 +192,6 @@ void LLWLParamSet::set(const std::string& paramName, const LLColor4 & val)
 
 LLVector4 LLWLParamSet::getVector(const std::string& paramName, bool& error) 
 {
-	
 	// test to see if right type
 	LLSD cur_val = mParamValues.get(paramName);
 	if (!cur_val.isArray()) 
@@ -207,7 +212,6 @@ LLVector4 LLWLParamSet::getVector(const std::string& paramName, bool& error)
 
 F32 LLWLParamSet::getFloat(const std::string& paramName, bool& error) 
 {
-	
 	// test to see if right type
 	LLSD cur_val = mParamValues.get(paramName);
 	if (cur_val.isArray() && cur_val.size() != 0) 
@@ -226,8 +230,6 @@ F32 LLWLParamSet::getFloat(const std::string& paramName, bool& error)
 	return 0;
 }
 
-
-
 void LLWLParamSet::setSunAngle(float val) 
 {
 	// keep range 0 - 2pi
@@ -255,7 +257,6 @@ void LLWLParamSet::setEastAngle(float val)
 	mParamValues["east_angle"] = val;
 }
 
-
 void LLWLParamSet::mix(LLWLParamSet& src, LLWLParamSet& dest, F32 weight)
 {
 	// set up the iterators
@@ -274,7 +275,6 @@ void LLWLParamSet::mix(LLWLParamSet& src, LLWLParamSet& dest, F32 weight)
 	// Iterate through values
 	for(LLSD::map_iterator iter = mParamValues.beginMap(); iter != mParamValues.endMap(); ++iter)
 	{
-
 		// If param exists in both src and dest, set the holder variables, otherwise skip
 		if(src.mParamValues.has(iter->first) && dest.mParamValues.has(iter->first))
 		{
diff --git a/indra/newview/llwlparamset.h b/indra/newview/llwlparamset.h
index 3c44ed3bb8dbb564b29d02be071e56c59c9df196..b087119dd503371151d2713908cc18b1385d46c5 100644
--- a/indra/newview/llwlparamset.h
+++ b/indra/newview/llwlparamset.h
@@ -110,7 +110,7 @@ class LLWLParamSet {
 	/// \param error		A flag to set if it's not the proper return type
 	LLVector4 getVector(const std::string& paramName, bool& error);
 
-	/// Get an integer parameter
+	/// Get a float parameter
 	/// \param paramName	The name of the parameter to set.
 	/// \param error		A flag to set if it's not the proper return type	
 	F32 getFloat(const std::string& paramName, bool& error);
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index a7ae456f3ce76923d8da794595e505afd7b462f3..3d971e738e328a5ef9d8e2c6c5c2ad87f8a13768 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -589,22 +589,22 @@ void LLWorld::updateVisibilities()
 {
 	F32 cur_far_clip = LLViewerCamera::getInstance()->getFar();
 
-	LLViewerCamera::getInstance()->setFar(mLandFarClip);
-
-	F32 diagonal_squared = F_SQRT2 * F_SQRT2 * mWidth * mWidth;
-	// Go through the culled list and check for visible regions
+	// Go through the culled list and check for visible regions (region is visible if land is visible)
 	for (region_list_t::iterator iter = mCulledRegionList.begin();
 		 iter != mCulledRegionList.end(); )
 	{
 		region_list_t::iterator curiter = iter++;
 		LLViewerRegion* regionp = *curiter;
-		F32 height = regionp->getLand().getMaxZ() - regionp->getLand().getMinZ();
-		F32 radius = 0.5f*(F32) sqrt(height * height + diagonal_squared);
-		if (!regionp->getLand().hasZData()
-			|| LLViewerCamera::getInstance()->sphereInFrustum(regionp->getCenterAgent(), radius))
+		
+		LLSpatialPartition* part = regionp->getSpatialPartition(LLViewerRegion::PARTITION_TERRAIN);
+		if (part)
 		{
-			mCulledRegionList.erase(curiter);
-			mVisibleRegionList.push_back(regionp);
+			LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0);
+			if (LLViewerCamera::getInstance()->AABBInFrustum(group->mBounds[0], group->mBounds[1]))
+			{
+				mCulledRegionList.erase(curiter);
+				mVisibleRegionList.push_back(regionp);
+			}
 		}
 	}
 	
@@ -619,17 +619,20 @@ void LLWorld::updateVisibilities()
 			continue;
 		}
 
-		F32 height = regionp->getLand().getMaxZ() - regionp->getLand().getMinZ();
-		F32 radius = 0.5f*(F32) sqrt(height * height + diagonal_squared);
-		if (LLViewerCamera::getInstance()->sphereInFrustum(regionp->getCenterAgent(), radius))
-		{
-			regionp->calculateCameraDistance();
-			regionp->getLand().updatePatchVisibilities(gAgent);
-		}
-		else
+		LLSpatialPartition* part = regionp->getSpatialPartition(LLViewerRegion::PARTITION_TERRAIN);
+		if (part)
 		{
-			mVisibleRegionList.erase(curiter);
-			mCulledRegionList.push_back(regionp);
+			LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0);
+			if (LLViewerCamera::getInstance()->AABBInFrustum(group->mBounds[0], group->mBounds[1]))
+			{
+				regionp->calculateCameraDistance();
+				regionp->getLand().updatePatchVisibilities(gAgent);
+			}
+			else
+			{
+				mVisibleRegionList.erase(curiter);
+				mCulledRegionList.push_back(regionp);
+			}
 		}
 	}
 
@@ -815,14 +818,11 @@ void LLWorld::updateWaterObjects()
 	max_x = (S32)region_x + range;
 	max_y = (S32)region_y + range;
 
-	F32 height = 0.f;
-	
 	for (region_list_t::iterator iter = mRegionList.begin();
 		 iter != mRegionList.end(); ++iter)
 	{
 		LLViewerRegion* regionp = *iter;
 		LLVOWater* waterp = regionp->getLand().getWaterObj();
-		height += regionp->getWaterHeight();
 		if (waterp)
 		{
 			gObjectList.updateActive(waterp);
@@ -839,6 +839,7 @@ void LLWorld::updateWaterObjects()
 
 	// Now, get a list of the holes
 	S32 x, y;
+	F32 water_height = gAgent.getRegion()->getWaterHeight() + 256.f;
 	for (x = min_x; x <= max_x; x += rwidth)
 	{
 		for (y = min_y; y <= max_y; y += rwidth)
@@ -850,7 +851,7 @@ void LLWorld::updateWaterObjects()
 				waterp->setUseTexture(FALSE);
 				waterp->setPositionGlobal(LLVector3d(x + rwidth/2,
 													 y + rwidth/2,
-													 256.f+DEFAULT_WATER_HEIGHT));
+													 water_height));
 				waterp->setScale(LLVector3((F32)rwidth, (F32)rwidth, 512.f));
 				gPipeline.createObject(waterp);
 				mHoleWaterObjects.push_back(waterp);
@@ -907,8 +908,7 @@ void LLWorld::updateWaterObjects()
 		}
 
 		waterp->setRegion(gAgent.getRegion());
-		LLVector3d water_pos(water_center_x, water_center_y, 
-			DEFAULT_WATER_HEIGHT+256.f);
+		LLVector3d water_pos(water_center_x, water_center_y, water_height) ;
 		LLVector3 water_scale((F32) dim[0], (F32) dim[1], 512.f);
 
 		//stretch out to horizon
@@ -1161,24 +1161,13 @@ void send_agent_resume()
 
 static LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3d& region_origin)
 {
-	LLVector3d pos_global;
-	LLVector3 pos_local;
-	U8 bits;
-
-	bits = compact_local & 0xFF;
-	pos_local.mV[VZ] = F32(bits) * 4.f;
-	compact_local >>= 8;
+	LLVector3d pos_local;
 
-	bits = compact_local & 0xFF;
-	pos_local.mV[VY] = (F32)bits;
-	compact_local >>= 8;
+	pos_local.mdV[VZ] = (compact_local & 0xFFU) * 4;
+	pos_local.mdV[VY] = (compact_local >> 8) & 0xFFU;
+	pos_local.mdV[VX] = (compact_local >> 16) & 0xFFU;
 
-	bits = compact_local & 0xFF;
-	pos_local.mV[VX] = (F32)bits;
-
-	pos_global.setVec( pos_local );
-	pos_global += region_origin;
-	return pos_global;
+	return region_origin + pos_local;
 }
 
 void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positions, const LLVector3d& relative_to, F32 radius) const
@@ -1199,22 +1188,22 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi
 		iter != LLCharacter::sInstances.end(); ++iter)
 	{
 		LLVOAvatar* pVOAvatar = (LLVOAvatar*) *iter;
-		if(!pVOAvatar->isDead() && !pVOAvatar->isSelf())
+
+		if (!pVOAvatar->isDead() && !pVOAvatar->isSelf())
 		{
+			LLVector3d pos_global = pVOAvatar->getPositionGlobal();
 			LLUUID uuid = pVOAvatar->getID();
-			if(!uuid.isNull())
+
+			if (!uuid.isNull()
+				&& dist_vec_squared(pos_global, relative_to) <= radius_squared)
 			{
-				LLVector3d pos_global = pVOAvatar->getPositionGlobal();
-				if(dist_vec_squared(pos_global, relative_to) <= radius_squared)
+				if(positions != NULL)
 				{
-					if(positions != NULL)
-					{
-						positions->push_back(pos_global);
-					}
-					if(avatar_ids !=NULL)
-					{
-						avatar_ids->push_back(uuid);
-					}
+					positions->push_back(pos_global);
+				}
+				if(avatar_ids !=NULL)
+				{
+					avatar_ids->push_back(uuid);
 				}
 			}
 		}
@@ -1233,9 +1222,9 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi
 			{
 				LLUUID uuid = regionp->mMapAvatarIDs.get(i);
 				// if this avatar doesn't already exist in the list, add it
-				if(uuid.notNull() && avatar_ids!=NULL && std::find(avatar_ids->begin(), avatar_ids->end(), uuid) == avatar_ids->end())
+				if(uuid.notNull() && avatar_ids != NULL && std::find(avatar_ids->begin(), avatar_ids->end(), uuid) == avatar_ids->end())
 				{
-					if(positions != NULL)
+					if (positions != NULL)
 					{
 						positions->push_back(pos_global);
 					}
@@ -1246,6 +1235,11 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi
 	}
 }
 
+bool LLWorld::isRegionListed(const LLViewerRegion* region) const
+{
+	region_list_t::const_iterator it = find(mRegionList.begin(), mRegionList.end(), region);
+	return it != mRegionList.end();
+}
 
 LLHTTPRegistration<LLEstablishAgentCommunication>
 	gHTTPRegistrationEstablishAgentCommunication(
diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h
index d8ab4bc5080e4b6833ba1b593307ccf34525eb05..f350009d100c09f6d10f4b0cc4f1014716f88995 100644
--- a/indra/newview/llworld.h
+++ b/indra/newview/llworld.h
@@ -157,6 +157,11 @@ class LLWorld : public LLSingleton<LLWorld>
 		std::vector<LLVector3d>* positions = NULL, 
 		const LLVector3d& relative_to = LLVector3d(), F32 radius = FLT_MAX) const;
 
+	// Returns 'true' if the region is in mRegionList,
+	// 'false' if the region has been removed due to region change
+	// or if the circuit to this simulator had been lost.
+	bool isRegionListed(const LLViewerRegion* region) const;
+
 private:
 	region_list_t	mActiveRegionList;
 	region_list_t	mRegionList;
diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index e99657cd224dce796cf89b691666e301934a325d..a3ccf87cfc9540dcabafdb9d0858d6d473b0ad3d 100644
--- a/indra/newview/llworldmapview.cpp
+++ b/indra/newview/llworldmapview.cpp
@@ -77,6 +77,7 @@ LLUIImagePtr LLWorldMapView::sAvatarYouLargeImage = NULL;
 LLUIImagePtr LLWorldMapView::sAvatarLevelImage = NULL;
 LLUIImagePtr LLWorldMapView::sAvatarAboveImage = NULL;
 LLUIImagePtr LLWorldMapView::sAvatarBelowImage = NULL;
+LLUIImagePtr LLWorldMapView::sAvatarUnknownImage = NULL;
 
 LLUIImagePtr LLWorldMapView::sTelehubImage = NULL;
 LLUIImagePtr LLWorldMapView::sInfohubImage = NULL;
@@ -120,6 +121,7 @@ void LLWorldMapView::initClass()
 	sAvatarLevelImage =		LLUI::getUIImage("map_avatar_32.tga");
 	sAvatarAboveImage =		LLUI::getUIImage("map_avatar_above_32.tga");
 	sAvatarBelowImage =		LLUI::getUIImage("map_avatar_below_32.tga");
+	sAvatarUnknownImage =	LLUI::getUIImage("map_avatar_unknown_32.tga");
 
 	sHomeImage =			LLUI::getUIImage("map_home.tga");
 	sTelehubImage = 		LLUI::getUIImage("map_telehub.tga");
@@ -149,6 +151,7 @@ void LLWorldMapView::cleanupClass()
 	sAvatarLevelImage = NULL;
 	sAvatarAboveImage = NULL;
 	sAvatarBelowImage = NULL;
+	sAvatarUnknownImage = NULL;
 
 	sTelehubImage = NULL;
 	sInfohubImage = NULL;
@@ -314,7 +317,7 @@ void LLWorldMapView::draw()
 	{
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 
-		glMatrixMode(GL_MODELVIEW);
+		gGL.matrixMode(LLRender::MM_MODELVIEW);
 
 		// Clear the background alpha to 0
 		gGL.flush();
@@ -513,7 +516,7 @@ void LLWorldMapView::draw()
 					 TRUE,
 					 "You are here",
 					 "",
-					 llround(LLFontGL::getFontSansSerifSmall()->getLineHeight())); // offset vertically by one line, to avoid overlap with target tracking
+					 LLFontGL::getFontSansSerifSmall()->getLineHeight()); // offset vertically by one line, to avoid overlap with target tracking
 	}
 
 	// Draw the current agent viewing angle
@@ -992,7 +995,7 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4&
 	const S32 TEXT_PADDING = DEFAULT_TRACKING_ARROW_SIZE + 2;
 	S32 half_text_width = llfloor(font->getWidthF32(label) * 0.5f);
 	text_x = llclamp(text_x, half_text_width + TEXT_PADDING, getRect().getWidth() - half_text_width - TEXT_PADDING);
-	text_y = llclamp(text_y + vert_offset, TEXT_PADDING + vert_offset, getRect().getHeight() - llround(font->getLineHeight()) - TEXT_PADDING - vert_offset);
+	text_y = llclamp(text_y + vert_offset, TEXT_PADDING + vert_offset, getRect().getHeight() - font->getLineHeight() - TEXT_PADDING - vert_offset);
 
 	if (label != "")
 	{
@@ -1005,7 +1008,7 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4&
 
 		if (tooltip != "")
 		{
-			text_y -= (S32)font->getLineHeight();
+			text_y -= font->getLineHeight();
 
 			font->renderUTF8(
 				tooltip, 0,
@@ -1147,17 +1150,25 @@ void LLWorldMapView::drawAvatar(F32 x_pixels,
 								F32 y_pixels,
 								const LLColor4& color,
 								F32 relative_z,
-								F32 dot_radius)
+								F32 dot_radius,
+								bool unknown_relative_z)
 {
 	const F32 HEIGHT_THRESHOLD = 7.f;
 	LLUIImagePtr dot_image = sAvatarLevelImage;
-	if(relative_z < -HEIGHT_THRESHOLD) 
+	if (unknown_relative_z)
 	{
-		dot_image = sAvatarBelowImage; 
+		dot_image = sAvatarUnknownImage;
 	}
-	else if(relative_z > HEIGHT_THRESHOLD) 
-	{ 
-		dot_image = sAvatarAboveImage;
+	else
+	{
+		if(relative_z < -HEIGHT_THRESHOLD)
+		{
+			dot_image = sAvatarBelowImage; 
+		}
+		else if(relative_z > HEIGHT_THRESHOLD) 
+		{ 
+			dot_image = sAvatarAboveImage;
+		}
 	}
 	S32 dot_width = llround(dot_radius * 2.f);
 	dot_image->draw(llround(x_pixels - dot_radius),
@@ -1203,7 +1214,7 @@ void LLWorldMapView::drawIconName(F32 x_pixels,
 		LLFontGL::NORMAL, 
 		LLFontGL::DROP_SHADOW);
 
-	text_y -= llround(LLFontGL::getFontSansSerif()->getLineHeight());
+	text_y -= LLFontGL::getFontSansSerif()->getLineHeight();
 
 	// render text
 	LLFontGL::getFontSansSerif()->renderUTF8(second_line, 0,
@@ -1307,7 +1318,7 @@ void LLWorldMapView::drawTrackingCircle( const LLRect& rect, S32 x, S32 y, const
 		end_theta -= angle_adjust_y;
 	}
 
-	glMatrixMode(GL_MODELVIEW);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.pushMatrix();
 	gGL.translatef((F32)x, (F32)y, 0.f);
 	gl_washer_segment_2d(inner_radius, outer_radius, start_theta, end_theta, 40, color, color);
diff --git a/indra/newview/llworldmapview.h b/indra/newview/llworldmapview.h
index 9ab53b1ba387e6e81932014f87cf51daf9a080a7..a2a6dc53fb5cabd412f0fcfecedefef27c0ca1f3 100644
--- a/indra/newview/llworldmapview.h
+++ b/indra/newview/llworldmapview.h
@@ -112,7 +112,8 @@ class LLWorldMapView : public LLPanel
 								F32 y_pixels, 
 								const LLColor4& color,
 								F32 relative_z = 0.f,
-								F32 dot_radius = 3.f);
+								F32 dot_radius = 3.f,
+								bool reached_max_z = false);
 	static void		drawIconName(F32 x_pixels, 
 									F32 y_pixels, 
 									const LLColor4& color,
@@ -138,6 +139,7 @@ class LLWorldMapView : public LLPanel
 	static LLUIImagePtr	sAvatarLevelImage;
 	static LLUIImagePtr	sAvatarAboveImage;
 	static LLUIImagePtr	sAvatarBelowImage;
+	static LLUIImagePtr	sAvatarUnknownImage;
 
 	static LLUIImagePtr	sTelehubImage;
 	static LLUIImagePtr	sInfohubImage;
diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp
index f483ba5af8d5089c6d0ee3127dd30da9d64f0b48..0da70d398b06ca0b35e50a7c40cc737b3efa1491 100644
--- a/indra/newview/llxmlrpctransaction.cpp
+++ b/indra/newview/llxmlrpctransaction.cpp
@@ -305,6 +305,15 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip)
 	{
 		mCurlRequest = new LLCurlEasyRequest();
 	}
+	if(!mCurlRequest->isValid())
+	{
+		llwarns << "mCurlRequest is invalid." << llendl ;
+
+		delete mCurlRequest ;
+		mCurlRequest = NULL ;
+		return ;
+	}
+
 	mErrorCert = NULL;
 
 //	mCurlRequest->setopt(CURLOPT_VERBOSE, 1); // useful for debugging
@@ -357,10 +366,20 @@ LLXMLRPCTransaction::Impl::~Impl()
 	}
 	
 	delete mCurlRequest;
+	mCurlRequest = NULL ;
 }
 
 bool LLXMLRPCTransaction::Impl::process()
 {
+	if(!mCurlRequest || !mCurlRequest->isValid())
+	{
+		llwarns << "transaction failed." << llendl ;
+
+		delete mCurlRequest ;
+		mCurlRequest = NULL ;
+		return true ; //failed, quit.
+	}
+
 	switch(mStatus)
 	{
 		case LLXMLRPCTransaction::StatusComplete:
@@ -382,19 +401,11 @@ bool LLXMLRPCTransaction::Impl::process()
 			// continue onward
 		}
 	}
-	
-	//const F32 MAX_PROCESSING_TIME = 0.05f;
-	//LLTimer timer;
-
-	mCurlRequest->perform();
-
-	/*while (mCurlRequest->perform() > 0)
+		
+	if(!mCurlRequest->wait())
 	{
-		if (timer.getElapsedTimeF32() >= MAX_PROCESSING_TIME)
-		{
-			return false;
-		}
-	}*/
+		return false ;
+	}
 
 	while(1)
 	{
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 93354e65797e6e6f4c8e19790a077ed6ea451016..ab994c71cbdf87cc7182dc7da89f09d91a10bdaa 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -106,26 +106,6 @@
 #include "llnotifications.h"
 
 
-void check_stack_depth(S32 stack_depth)
-{
-	if (gDebugGL || gDebugSession)
-	{
-		GLint depth;
-		glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &depth);
-		if (depth != stack_depth)
-		{
-			if (gDebugSession)
-			{
-				ll_fail("GL matrix stack corrupted.");
-			}
-			else
-			{
-				llerrs << "GL matrix stack corrupted!" << llendl;
-			}
-		}
-	}
-}
-	
 #ifdef _DEBUG
 // Debug indices is disabled for now for debug performance - djs 4/24/02
 //#define DEBUG_INDICES
@@ -133,13 +113,88 @@ void check_stack_depth(S32 stack_depth)
 //#define DEBUG_INDICES
 #endif
 
+//cached settings
+BOOL LLPipeline::RenderAvatarVP;
+BOOL LLPipeline::VertexShaderEnable;
+BOOL LLPipeline::WindLightUseAtmosShaders;
+BOOL LLPipeline::RenderDeferred;
+F32 LLPipeline::RenderDeferredSunWash;
+U32 LLPipeline::RenderFSAASamples;
+U32 LLPipeline::RenderResolutionDivisor;
+BOOL LLPipeline::RenderUIBuffer;
+S32 LLPipeline::RenderShadowDetail;
+BOOL LLPipeline::RenderDeferredSSAO;
+F32 LLPipeline::RenderShadowResolutionScale;
+BOOL LLPipeline::RenderLocalLights;
+BOOL LLPipeline::RenderDelayCreation;
+BOOL LLPipeline::RenderAnimateRes;
+BOOL LLPipeline::FreezeTime;
+S32 LLPipeline::DebugBeaconLineWidth;
+F32 LLPipeline::RenderHighlightBrightness;
+LLColor4 LLPipeline::RenderHighlightColor;
+F32 LLPipeline::RenderHighlightThickness;
+BOOL LLPipeline::RenderSpotLightsInNondeferred;
+LLColor4 LLPipeline::PreviewAmbientColor;
+LLColor4 LLPipeline::PreviewDiffuse0;
+LLColor4 LLPipeline::PreviewSpecular0;
+LLColor4 LLPipeline::PreviewDiffuse1;
+LLColor4 LLPipeline::PreviewSpecular1;
+LLColor4 LLPipeline::PreviewDiffuse2;
+LLColor4 LLPipeline::PreviewSpecular2;
+LLVector3 LLPipeline::PreviewDirection0;
+LLVector3 LLPipeline::PreviewDirection1;
+LLVector3 LLPipeline::PreviewDirection2;
+F32 LLPipeline::RenderGlowMinLuminance;
+F32 LLPipeline::RenderGlowMaxExtractAlpha;
+F32 LLPipeline::RenderGlowWarmthAmount;
+LLVector3 LLPipeline::RenderGlowLumWeights;
+LLVector3 LLPipeline::RenderGlowWarmthWeights;
+S32 LLPipeline::RenderGlowResolutionPow;
+S32 LLPipeline::RenderGlowIterations;
+F32 LLPipeline::RenderGlowWidth;
+F32 LLPipeline::RenderGlowStrength;
+BOOL LLPipeline::RenderDepthOfField;
+F32 LLPipeline::CameraFocusTransitionTime;
+F32 LLPipeline::CameraFNumber;
+F32 LLPipeline::CameraFocalLength;
+F32 LLPipeline::CameraFieldOfView;
+F32 LLPipeline::RenderShadowNoise;
+F32 LLPipeline::RenderShadowBlurSize;
+F32 LLPipeline::RenderSSAOScale;
+U32 LLPipeline::RenderSSAOMaxScale;
+F32 LLPipeline::RenderSSAOFactor;
+LLVector3 LLPipeline::RenderSSAOEffect;
+F32 LLPipeline::RenderShadowOffsetError;
+F32 LLPipeline::RenderShadowBiasError;
+F32 LLPipeline::RenderShadowOffset;
+F32 LLPipeline::RenderShadowBias;
+F32 LLPipeline::RenderSpotShadowOffset;
+F32 LLPipeline::RenderSpotShadowBias;
+F32 LLPipeline::RenderEdgeDepthCutoff;
+F32 LLPipeline::RenderEdgeNormCutoff;
+LLVector3 LLPipeline::RenderShadowGaussian;
+F32 LLPipeline::RenderShadowBlurDistFactor;
+BOOL LLPipeline::RenderDeferredAtmospheric;
+S32 LLPipeline::RenderReflectionDetail;
+F32 LLPipeline::RenderHighlightFadeTime;
+LLVector3 LLPipeline::RenderShadowClipPlanes;
+LLVector3 LLPipeline::RenderShadowOrthoClipPlanes;
+LLVector3 LLPipeline::RenderShadowNearDist;
+F32 LLPipeline::RenderFarClip;
+LLVector3 LLPipeline::RenderShadowSplitExponent;
+F32 LLPipeline::RenderShadowErrorCutoff;
+F32 LLPipeline::RenderShadowFOVCutoff;
+BOOL LLPipeline::CameraOffset;
+F32 LLPipeline::CameraMaxCoF;
+F32 LLPipeline::CameraDoFResScale;
+
 const F32 BACKLIGHT_DAY_MAGNITUDE_AVATAR = 0.2f;
 const F32 BACKLIGHT_NIGHT_MAGNITUDE_AVATAR = 0.1f;
 const F32 BACKLIGHT_DAY_MAGNITUDE_OBJECT = 0.1f;
 const F32 BACKLIGHT_NIGHT_MAGNITUDE_OBJECT = 0.08f;
 const S32 MAX_OFFSCREEN_GEOMETRY_CHANGES_PER_FRAME = 10;
 const U32 REFLECTION_MAP_RES = 128;
-
+const U32 DEFERRED_VB_MASK = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1;
 // Max number of occluders to search for. JC
 const S32 MAX_OCCLUDER_COUNT = 2;
 
@@ -148,10 +203,6 @@ extern S32 gBoxFrame;
 extern BOOL gDisplaySwapBuffers;
 extern BOOL gDebugGL;
 
-// hack counter for rendering a fixed number of frames after toggling
-// fullscreen to work around DEV-5361
-static S32 sDelayedVBOEnable = 0;
-
 BOOL	gAvatarBacklight = FALSE;
 
 BOOL	gDebugPipeline = FALSE;
@@ -211,23 +262,12 @@ std::string gPoolNames[] =
 
 void drawBox(const LLVector3& c, const LLVector3& r);
 void drawBoxOutline(const LLVector3& pos, const LLVector3& size);
+U32 nhpo2(U32 v);
 
-U32 nhpo2(U32 v) 
-{
-	U32 r = 1;
-	while (r < v) {
-		r *= 2;
-	}
-	return r;
-}
-
-glh::matrix4f glh_copy_matrix(GLdouble* src)
+glh::matrix4f glh_copy_matrix(F32* src)
 {
 	glh::matrix4f ret;
-	for (U32 i = 0; i < 16; i++)
-	{
-		ret.m[i] = (F32) src[i];
-	}
+	ret.set_value(src);
 	return ret;
 }
 
@@ -251,7 +291,7 @@ glh::matrix4f glh_get_last_projection()
 	return glh_copy_matrix(gGLLastProjection);
 }
 
-void glh_copy_matrix(const glh::matrix4f& src, GLdouble* dst)
+void glh_copy_matrix(const glh::matrix4f& src, F32* dst)
 {
 	for (U32 i = 0; i < 16; i++)
 	{
@@ -367,6 +407,7 @@ LLPipeline::LLPipeline() :
 	mOldRenderDebugMask(0),
 	mGroupQ1Locked(false),
 	mGroupQ2Locked(false),
+	mResetVertexBuffers(false),
 	mLastRebuildPool(NULL),
 	mAlphaPool(NULL),
 	mSkyPool(NULL),
@@ -394,11 +435,14 @@ void LLPipeline::init()
 {
 	LLMemType mt(LLMemType::MTYPE_PIPELINE_INIT);
 
+	refreshCachedSettings();
+
 	gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity");
 	sDynamicLOD = gSavedSettings.getBOOL("RenderDynamicLOD");
 	sRenderBump = gSavedSettings.getBOOL("RenderObjectBump");
 	sUseTriStrips = gSavedSettings.getBOOL("RenderUseTriStrips");
 	LLVertexBuffer::sUseStreamDraw = gSavedSettings.getBOOL("RenderUseStreamVBO");
+	LLVertexBuffer::sUseVAO = gSavedSettings.getBOOL("RenderUseVAO");
 	LLVertexBuffer::sPreferStreamDraw = gSavedSettings.getBOOL("RenderPreferStreamDraw");
 	sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights");
 	sRenderAttachedParticles = gSavedSettings.getBOOL("RenderAttachedParticles");
@@ -459,7 +503,95 @@ void LLPipeline::init()
 		mSpotLightFade[i] = 1.f;
 	}
 
+	mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK, 0);
+	mDeferredVB->allocateBuffer(8, 0, true);
 	setLightingDetail(-1);
+	
+	//
+	// Update all settings to trigger a cached settings refresh
+	//
+
+	gSavedSettings.getControl("RenderAutoMaskAlphaDeferred")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderAutoMaskAlphaNonDeferred")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderUseFarClip")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderAvatarMaxVisible")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderDelayVBUpdate")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	
+	gSavedSettings.getControl("UseOcclusion")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	
+	gSavedSettings.getControl("VertexShaderEnable")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderAvatarVP")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("WindLightUseAtmosShaders")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderDeferred")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderDeferredSunWash")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderFSAASamples")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderResolutionDivisor")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderUIBuffer")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowDetail")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderDeferredSSAO")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowResolutionScale")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderLocalLights")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderDelayCreation")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderAnimateRes")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("FreezeTime")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("DebugBeaconLineWidth")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderHighlightBrightness")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderHighlightColor")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderHighlightThickness")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderSpotLightsInNondeferred")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("PreviewAmbientColor")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("PreviewDiffuse0")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("PreviewSpecular0")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("PreviewDiffuse1")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("PreviewSpecular1")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("PreviewDiffuse2")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("PreviewSpecular2")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("PreviewDirection0")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("PreviewDirection1")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("PreviewDirection2")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderGlowMinLuminance")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderGlowMaxExtractAlpha")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderGlowWarmthAmount")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderGlowLumWeights")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderGlowWarmthWeights")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderGlowResolutionPow")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderGlowIterations")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderGlowWidth")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderGlowStrength")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderDepthOfField")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("CameraFocusTransitionTime")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("CameraFNumber")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("CameraFocalLength")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("CameraFieldOfView")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowNoise")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowBlurSize")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderSSAOScale")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderSSAOMaxScale")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderSSAOFactor")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderSSAOEffect")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowOffsetError")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowBiasError")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowOffset")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowBias")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderSpotShadowOffset")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderSpotShadowBias")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderEdgeDepthCutoff")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderEdgeNormCutoff")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowGaussian")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowBlurDistFactor")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderDeferredAtmospheric")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderReflectionDetail")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderHighlightFadeTime")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowClipPlanes")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowOrthoClipPlanes")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowNearDist")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderFarClip")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowSplitExponent")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowErrorCutoff")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowFOVCutoff")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("CameraOffset")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("CameraMaxCoF")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("CameraDoFResScale")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
 }
 
 LLPipeline::~LLPipeline()
@@ -537,6 +669,8 @@ void LLPipeline::cleanup()
 	mMovedBridge.clear();
 
 	mInitialized = FALSE;
+
+	mDeferredVB = NULL;
 }
 
 //============================================================================
@@ -555,8 +689,6 @@ void LLPipeline::destroyGL()
 
 	if (LLVertexBuffer::sEnableVBOs)
 	{
-		// render 30 frames after switching to work around DEV-5361
-		sDelayedVBOEnable = 30;
 		LLVertexBuffer::sEnableVBOs = FALSE;
 	}
 }
@@ -606,12 +738,8 @@ void LLPipeline::allocatePhysicsBuffer()
 
 void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY)
 {
-	U32 samples = gGLManager.getNumFBOFSAASamples(gSavedSettings.getU32("RenderFSAASamples"));
-
-	if (gGLManager.mIsATI)
-	{ //ATI doesn't like the way we use multisample texture
-		samples = 0;
-	}
+	refreshCachedSettings();
+	U32 samples = RenderFSAASamples;
 
 	//try to allocate screen buffers at requested resolution and samples
 	// - on failure, shrink number of samples and try again
@@ -632,6 +760,8 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY)
 			releaseScreenBuffers();
 		}
 
+		samples = 0;
+
 		//reduce resolution
 		while (resY > 0 && resX > 0)
 		{
@@ -657,11 +787,13 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY)
 
 bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
 {
+	refreshCachedSettings();
+
 	// remember these dimensions
 	mScreenWidth = resX;
 	mScreenHeight = resY;
 	
-	U32 res_mod = gSavedSettings.getU32("RenderResolutionDivisor");
+	U32 res_mod = RenderResolutionDivisor;
 
 	if (res_mod > 1 && res_mod < resX && res_mod < resY)
 	{
@@ -669,7 +801,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
 		resY /= res_mod;
 	}
 
-	if (gSavedSettings.getBOOL("RenderUIBuffer"))
+	if (RenderUIBuffer)
 	{
 		if (!mUIScreen.allocate(resX,resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE))
 		{
@@ -679,79 +811,44 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
 
 	if (LLPipeline::sRenderDeferred)
 	{
-		S32 shadow_detail = gSavedSettings.getS32("RenderShadowDetail");
-		BOOL ssao = gSavedSettings.getBOOL("RenderDeferredSSAO");
-		bool gi = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_DEFERRED);
+		// Set this flag in case we crash while resizing window or allocating space for deferred rendering targets
+		gSavedSettings.setBOOL("RenderInitError", TRUE);
+		gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE );
 
+		S32 shadow_detail = RenderShadowDetail;
+		BOOL ssao = RenderDeferredSSAO;
+		
 		//allocate deferred rendering color buffers
 		if (!mDeferredScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
 		if (!mDeferredDepth.allocate(resX, resY, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
 		if (!addDeferredAttachments(mDeferredScreen)) return false;
 	
 		if (!mScreen.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
-		
-#if LL_DARWIN
-		// As of OS X 10.6.7, Apple doesn't support multiple color formats in a single FBO
-		if (!mEdgeMap.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
-#else
-		if (!mEdgeMap.allocate(resX, resY, GL_ALPHA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
-#endif
-
-		if (shadow_detail > 0 || ssao)
-		{ //only need mDeferredLight[0] for shadows OR ssao
-			if (!mDeferredLight[0].allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
-		}
-		else
+		if (samples > 0)
 		{
-			mDeferredLight[0].release();
-		}
-
-		if (ssao)
-		{ //only need mDeferredLight[1] for ssao
-			if (!mDeferredLight[1].allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, false)) return false;
+			if (!mFXAABuffer.allocate(nhpo2(resX), nhpo2(resY), GL_RGBA, FALSE, FALSE, LLTexUnit::TT_TEXTURE, FALSE, samples)) return false;
 		}
 		else
 		{
-			mDeferredLight[1].release();
+			mFXAABuffer.release();
 		}
-
-		if (gi)
-		{ //only need mDeferredLight[2] and mGIMapPost for gi
-			if (!mDeferredLight[2].allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, false)) return false;
-			for (U32 i = 0; i < 2; i++)
-			{
-#if LL_DARWIN
-				// As of OS X 10.6.7, Apple doesn't support multiple color formats in a single FBO
-				if (!mGIMapPost[i].allocate(resX,resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE)) return false;
-#else
-				if (!mGIMapPost[i].allocate(resX,resY, GL_RGB, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE)) return false;
-#endif
-			}
+		
+		if (shadow_detail > 0 || ssao || RenderDepthOfField || samples > 0)
+		{ //only need mDeferredLight for shadows OR ssao OR dof OR fxaa
+			if (!mDeferredLight.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
 		}
 		else
 		{
-			mDeferredLight[2].release();
-		
-			for (U32 i = 0; i < 2; i++)
-			{
-				mGIMapPost[i].release();
-			}
+			mDeferredLight.release();
 		}
 
-		F32 scale = gSavedSettings.getF32("RenderShadowResolutionScale");
-
-#if LL_DARWIN
-		U32 shadow_fmt = 0;
-#else
-		//HACK: make alpha masking work on ATI depth shadows (work around for ATI driver bug)
-		U32 shadow_fmt = gGLManager.mIsATI ? GL_ALPHA : 0;
-#endif
+		F32 scale = RenderShadowResolutionScale;
 
 		if (shadow_detail > 0)
 		{ //allocate 4 sun shadow maps
 			for (U32 i = 0; i < 4; i++)
 			{
-				if (!mShadow[i].allocate(U32(resX*scale),U32(resY*scale), shadow_fmt, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE)) return false;
+				if (!mShadow[i].allocate(U32(resX*scale),U32(resY*scale), 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE)) return false;
 			}
 		}
 		else
@@ -769,7 +866,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
 		{ //allocate two spot shadow maps
 			for (U32 i = 4; i < 6; i++)
 			{
-				if (!mShadow[i].allocate(width, height, shadow_fmt, TRUE, FALSE)) return false;
+				if (!mShadow[i].allocate(width, height, 0, TRUE, FALSE)) return false;
 			}
 		}
 		else
@@ -780,30 +877,23 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
 			}
 		}
 
-		width = nhpo2(resX)/2;
-		height = nhpo2(resY)/2;
-		if (!mLuminanceMap.allocate(width,height, GL_RGBA, FALSE, FALSE)) return false;
+		// don't disable shaders on next session
+		gSavedSettings.setBOOL("RenderInitError", FALSE);
+		gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE );
 	}
 	else
 	{
-		for (U32 i = 0; i < 3; i++)
-		{ 
-			mDeferredLight[i].release();
-		}
-		for (U32 i = 0; i < 2; i++)
-		{
-			mGIMapPost[i].release();
-		}
+		mDeferredLight.release();
+				
 		for (U32 i = 0; i < 6; i++)
 		{
 			mShadow[i].release();
 		}
+		mFXAABuffer.release();
 		mScreen.release();
 		mDeferredScreen.release(); //make sure to release any render targets that share a depth buffer with mDeferredScreen first
 		mDeferredDepth.release();
-		mEdgeMap.release();
-		mLuminanceMap.release();
-		
+						
 		if (!mScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;		
 	}
 	
@@ -822,12 +912,12 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
 //static
 void LLPipeline::updateRenderDeferred()
 {
-	BOOL deferred = ((gSavedSettings.getBOOL("RenderDeferred") && 
+	BOOL deferred = ((RenderDeferred && 
 					 LLRenderTarget::sUseFBO &&
-					 LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") &&
-					 gSavedSettings.getBOOL("VertexShaderEnable") && 
-					 gSavedSettings.getBOOL("RenderAvatarVP") &&
-					 gSavedSettings.getBOOL("WindLightUseAtmosShaders")) ? TRUE : FALSE) &&
+					 LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") &&	 
+					 VertexShaderEnable && 
+					 RenderAvatarVP &&
+					 WindLightUseAtmosShaders) ? TRUE : FALSE) &&
 					!gUseWireframe;
 
 	sRenderDeferred = deferred;	
@@ -838,8 +928,94 @@ void LLPipeline::updateRenderDeferred()
 }
 
 //static
-void LLPipeline::refreshRenderDeferred()
-{
+void LLPipeline::refreshCachedSettings()
+{
+	LLPipeline::sAutoMaskAlphaDeferred = gSavedSettings.getBOOL("RenderAutoMaskAlphaDeferred");
+	LLPipeline::sAutoMaskAlphaNonDeferred = gSavedSettings.getBOOL("RenderAutoMaskAlphaNonDeferred");
+	LLPipeline::sUseFarClip = gSavedSettings.getBOOL("RenderUseFarClip");
+	LLVOAvatar::sMaxVisible = (U32)gSavedSettings.getS32("RenderAvatarMaxVisible");
+	LLPipeline::sDelayVBUpdate = gSavedSettings.getBOOL("RenderDelayVBUpdate");
+
+	LLPipeline::sUseOcclusion = 
+			(!gUseWireframe
+			&& LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion") 
+			&& gSavedSettings.getBOOL("UseOcclusion") 
+			&& gGLManager.mHasOcclusionQuery) ? 2 : 0;
+	
+	VertexShaderEnable = gSavedSettings.getBOOL("VertexShaderEnable");
+	RenderAvatarVP = gSavedSettings.getBOOL("RenderAvatarVP");
+	WindLightUseAtmosShaders = gSavedSettings.getBOOL("WindLightUseAtmosShaders");
+	RenderDeferred = gSavedSettings.getBOOL("RenderDeferred");
+	RenderDeferredSunWash = gSavedSettings.getF32("RenderDeferredSunWash");
+	RenderFSAASamples = gSavedSettings.getU32("RenderFSAASamples");
+	RenderResolutionDivisor = gSavedSettings.getU32("RenderResolutionDivisor");
+	RenderUIBuffer = gSavedSettings.getBOOL("RenderUIBuffer");
+	RenderShadowDetail = gSavedSettings.getS32("RenderShadowDetail");
+	RenderDeferredSSAO = gSavedSettings.getBOOL("RenderDeferredSSAO");
+	RenderShadowResolutionScale = gSavedSettings.getF32("RenderShadowResolutionScale");
+	RenderLocalLights = gSavedSettings.getBOOL("RenderLocalLights");
+	RenderDelayCreation = gSavedSettings.getBOOL("RenderDelayCreation");
+	RenderAnimateRes = gSavedSettings.getBOOL("RenderAnimateRes");
+	FreezeTime = gSavedSettings.getBOOL("FreezeTime");
+	DebugBeaconLineWidth = gSavedSettings.getS32("DebugBeaconLineWidth");
+	RenderHighlightBrightness = gSavedSettings.getF32("RenderHighlightBrightness");
+	RenderHighlightColor = gSavedSettings.getColor4("RenderHighlightColor");
+	RenderHighlightThickness = gSavedSettings.getF32("RenderHighlightThickness");
+	RenderSpotLightsInNondeferred = gSavedSettings.getBOOL("RenderSpotLightsInNondeferred");
+	PreviewAmbientColor = gSavedSettings.getColor4("PreviewAmbientColor");
+	PreviewDiffuse0 = gSavedSettings.getColor4("PreviewDiffuse0");
+	PreviewSpecular0 = gSavedSettings.getColor4("PreviewSpecular0");
+	PreviewDiffuse1 = gSavedSettings.getColor4("PreviewDiffuse1");
+	PreviewSpecular1 = gSavedSettings.getColor4("PreviewSpecular1");
+	PreviewDiffuse2 = gSavedSettings.getColor4("PreviewDiffuse2");
+	PreviewSpecular2 = gSavedSettings.getColor4("PreviewSpecular2");
+	PreviewDirection0 = gSavedSettings.getVector3("PreviewDirection0");
+	PreviewDirection1 = gSavedSettings.getVector3("PreviewDirection1");
+	PreviewDirection2 = gSavedSettings.getVector3("PreviewDirection2");
+	RenderGlowMinLuminance = gSavedSettings.getF32("RenderGlowMinLuminance");
+	RenderGlowMaxExtractAlpha = gSavedSettings.getF32("RenderGlowMaxExtractAlpha");
+	RenderGlowWarmthAmount = gSavedSettings.getF32("RenderGlowWarmthAmount");
+	RenderGlowLumWeights = gSavedSettings.getVector3("RenderGlowLumWeights");
+	RenderGlowWarmthWeights = gSavedSettings.getVector3("RenderGlowWarmthWeights");
+	RenderGlowResolutionPow = gSavedSettings.getS32("RenderGlowResolutionPow");
+	RenderGlowIterations = gSavedSettings.getS32("RenderGlowIterations");
+	RenderGlowWidth = gSavedSettings.getF32("RenderGlowWidth");
+	RenderGlowStrength = gSavedSettings.getF32("RenderGlowStrength");
+	RenderDepthOfField = gSavedSettings.getBOOL("RenderDepthOfField");
+	CameraFocusTransitionTime = gSavedSettings.getF32("CameraFocusTransitionTime");
+	CameraFNumber = gSavedSettings.getF32("CameraFNumber");
+	CameraFocalLength = gSavedSettings.getF32("CameraFocalLength");
+	CameraFieldOfView = gSavedSettings.getF32("CameraFieldOfView");
+	RenderShadowNoise = gSavedSettings.getF32("RenderShadowNoise");
+	RenderShadowBlurSize = gSavedSettings.getF32("RenderShadowBlurSize");
+	RenderSSAOScale = gSavedSettings.getF32("RenderSSAOScale");
+	RenderSSAOMaxScale = gSavedSettings.getU32("RenderSSAOMaxScale");
+	RenderSSAOFactor = gSavedSettings.getF32("RenderSSAOFactor");
+	RenderSSAOEffect = gSavedSettings.getVector3("RenderSSAOEffect");
+	RenderShadowOffsetError = gSavedSettings.getF32("RenderShadowOffsetError");
+	RenderShadowBiasError = gSavedSettings.getF32("RenderShadowBiasError");
+	RenderShadowOffset = gSavedSettings.getF32("RenderShadowOffset");
+	RenderShadowBias = gSavedSettings.getF32("RenderShadowBias");
+	RenderSpotShadowOffset = gSavedSettings.getF32("RenderSpotShadowOffset");
+	RenderSpotShadowBias = gSavedSettings.getF32("RenderSpotShadowBias");
+	RenderEdgeDepthCutoff = gSavedSettings.getF32("RenderEdgeDepthCutoff");
+	RenderEdgeNormCutoff = gSavedSettings.getF32("RenderEdgeNormCutoff");
+	RenderShadowGaussian = gSavedSettings.getVector3("RenderShadowGaussian");
+	RenderShadowBlurDistFactor = gSavedSettings.getF32("RenderShadowBlurDistFactor");
+	RenderDeferredAtmospheric = gSavedSettings.getBOOL("RenderDeferredAtmospheric");
+	RenderReflectionDetail = gSavedSettings.getS32("RenderReflectionDetail");
+	RenderHighlightFadeTime = gSavedSettings.getF32("RenderHighlightFadeTime");
+	RenderShadowClipPlanes = gSavedSettings.getVector3("RenderShadowClipPlanes");
+	RenderShadowOrthoClipPlanes = gSavedSettings.getVector3("RenderShadowOrthoClipPlanes");
+	RenderShadowNearDist = gSavedSettings.getVector3("RenderShadowNearDist");
+	RenderFarClip = gSavedSettings.getF32("RenderFarClip");
+	RenderShadowSplitExponent = gSavedSettings.getVector3("RenderShadowSplitExponent");
+	RenderShadowErrorCutoff = gSavedSettings.getF32("RenderShadowErrorCutoff");
+	RenderShadowFOVCutoff = gSavedSettings.getF32("RenderShadowFOVCutoff");
+	CameraOffset = gSavedSettings.getBOOL("CameraOffset");
+	CameraMaxCoF = gSavedSettings.getF32("CameraMaxCoF");
+	CameraDoFResScale = gSavedSettings.getF32("CameraDoFResScale");
+	
 	updateRenderDeferred();
 }
 
@@ -859,11 +1035,7 @@ void LLPipeline::releaseGLBuffers()
 		mTrueNoiseMap = 0;
 	}
 
-	if (mLightFunc)
-	{
-		LLImageGL::deleteTextures(1, &mLightFunc);
-		mLightFunc = 0;
-	}
+	releaseLUTBuffers();
 
 	mWaterRef.release();
 	mWaterDis.release();
@@ -879,25 +1051,27 @@ void LLPipeline::releaseGLBuffers()
 	LLVOAvatar::resetImpostors();
 }
 
+void LLPipeline::releaseLUTBuffers()
+{
+	if (mLightFunc)
+	{
+		LLImageGL::deleteTextures(1, &mLightFunc);
+		mLightFunc = 0;
+	}
+}
+
 void LLPipeline::releaseScreenBuffers()
 {
 	mUIScreen.release();
 	mScreen.release();
+	mFXAABuffer.release();
 	mPhysicsDisplay.release();
 	mDeferredScreen.release();
 	mDeferredDepth.release();
-	for (U32 i = 0; i < 3; i++)
-	{
-		mDeferredLight[i].release();
-	}
-
-	mEdgeMap.release();
-	mGIMap.release();
-	mGIMapPost[0].release();
-	mGIMapPost[1].release();
-	mHighlight.release();
-	mLuminanceMap.release();
+	mDeferredLight.release();
 	
+	mHighlight.release();
+		
 	for (U32 i = 0; i < 6; i++)
 	{
 		mShadow[i].release();
@@ -907,6 +1081,7 @@ void LLPipeline::releaseScreenBuffers()
 
 void LLPipeline::createGLBuffers()
 {
+	stop_glerror();
 	LLMemType mt_cb(LLMemType::MTYPE_PIPELINE_CREATE_BUFFERS);
 	assertInitialized();
 
@@ -914,10 +1089,11 @@ void LLPipeline::createGLBuffers()
 
 	if (LLPipeline::sWaterReflections)
 	{ //water reflection texture
-		U32 res = (U32) gSavedSettings.getS32("RenderWaterRefResolution");
+		U32 res = (U32) llmax(gSavedSettings.getS32("RenderWaterRefResolution"), 512);
 			
 		mWaterRef.allocate(res,res,GL_RGBA,TRUE,FALSE);
-		mWaterDis.allocate(res,res,GL_RGBA,TRUE,FALSE);
+		//always use FBO for mWaterDis so it can be used for avatar texture bakes
+		mWaterDis.allocate(res,res,GL_RGBA,TRUE,FALSE,LLTexUnit::TT_TEXTURE, true);
 	}
 
 	mHighlight.allocate(256,256,GL_RGBA, FALSE, FALSE);
@@ -979,56 +1155,69 @@ void LLPipeline::createGLBuffers()
 			gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
 		}
 
+		createLUTBuffers();
+	}
+
+	gBumpImageList.restoreGL();
+}
+
+void LLPipeline::createLUTBuffers()
+{
+	if (sRenderDeferred)
+	{
 		if (!mLightFunc)
 		{
 			U32 lightResX = gSavedSettings.getU32("RenderSpecularResX");
 			U32 lightResY = gSavedSettings.getU32("RenderSpecularResY");
-			U8* lg = new U8[lightResX*lightResY];
-
+			U8* ls = new U8[lightResX*lightResY];
+			F32 specExp = gSavedSettings.getF32("RenderSpecularExponent");
+            // Calculate the (normalized) Blinn-Phong specular lookup texture.
 			for (U32 y = 0; y < lightResY; ++y)
 			{
 				for (U32 x = 0; x < lightResX; ++x)
 				{
-					//spec func
+					ls[y*lightResX+x] = 0;
 					F32 sa = (F32) x/(lightResX-1);
 					F32 spec = (F32) y/(lightResY-1);
-					//lg[y*lightResX+x] = (U8) (powf(sa, 128.f*spec*spec)*255);
-
-					//F32 sp = acosf(sa)/(1.f-spec);
-
-					sa = powf(sa, gSavedSettings.getF32("RenderSpecularExponent"));
-					F32 a = acosf(sa*0.25f+0.75f);
-					F32 m = llmax(0.5f-spec*0.5f, 0.001f);
-					F32 t2 = tanf(a)/m;
-					t2 *= t2;
-
-					F32 c4a = (3.f+4.f*cosf(2.f*a)+cosf(4.f*a))/8.f;
-					F32 bd = 1.f/(4.f*m*m*c4a)*powf(F_E, -t2);
-
-					lg[y*lightResX+x] = (U8) (llclamp(bd, 0.f, 1.f)*255);
+					F32 n = spec * spec * specExp;
+					
+					// Nothing special here.  Just your typical blinn-phong term.
+					spec = powf(sa, n);
+					
+					// Apply our normalization function.
+					// Note: This is the full equation that applies the full normalization curve, not an approximation.
+					// This is fine, given we only need to create our LUT once per buffer initialization.
+					// The only trade off is we have a really low dynamic range.
+					// This means we have to account for things not being able to exceed 0 to 1 in our shaders.
+					spec *= (((n + 2) * (n + 4)) / (8 * F_PI * (powf(2, -n/2) + n)));
+					
+					// Always sample at a 1.0/2.2 curve.
+					// This "Gamma corrects" our specular term, boosting our lower exponent reflections.
+					spec = powf(spec, 1.f/2.2f);
+					
+					// Easy fix for our dynamic range problem: divide by 6 here, multiply by 6 in our shaders.
+					// This allows for our specular term to exceed a value of 1 in our shaders.
+					// This is something that can be important for energy conserving specular models where higher exponents can result in highlights that exceed a range of 0 to 1.
+					// Technically, we could just use an R16F texture, but driver support for R16F textures can be somewhat spotty at times.
+					// This works remarkably well for higher specular exponents, though banding can sometimes be seen on lower exponents.
+					// Combined with a bit of noise and trilinear filtering, the banding is hardly noticable.
+					ls[y*lightResX+x] = (U8)(llclamp(spec * (1.f / 6), 0.f, 1.f) * 255);
 				}
 			}
-
+			
 			LLImageGL::generateTextures(1, &mLightFunc);
 			gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mLightFunc);
-			LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_ALPHA, lightResX, lightResY, GL_ALPHA, GL_UNSIGNED_BYTE, lg);
+			LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_R8, lightResX, lightResY, GL_RED, GL_UNSIGNED_BYTE, ls);
 			gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
 			gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_TRILINEAR);
-
-			delete [] lg;
-		}
-
-		if (gSavedSettings.getBOOL("RenderDeferredGI"))
-		{
-			mGIMap.allocate(512,512,GL_RGBA, TRUE, FALSE);
-			addDeferredAttachments(mGIMap);
+			
+			delete [] ls;
 		}
 	}
-
-	gBumpImageList.restoreGL();
 }
 
-void LLPipeline::restoreGL() 
+
+void LLPipeline::restoreGL()
 {
 	LLMemType mt_cb(LLMemType::MTYPE_PIPELINE_RESTORE_GL);
 	assertInitialized();
@@ -1056,10 +1245,12 @@ void LLPipeline::restoreGL()
 
 BOOL LLPipeline::canUseVertexShaders()
 {
+	static const std::string vertex_shader_enable_feature_string = "VertexShaderEnable";
+
 	if (sDisableShaders ||
 		!gGLManager.mHasVertexShader ||
 		!gGLManager.mHasFragmentShader ||
-		!LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable") ||
+		!LLFeatureManager::getInstance()->isFeatureAvailable(vertex_shader_enable_feature_string) ||
 		(assertInitialized() && mVertexShadersLoaded != 1) )
 	{
 		return FALSE;
@@ -1123,10 +1314,11 @@ S32 LLPipeline::getMaxLightingDetail() const
 S32 LLPipeline::setLightingDetail(S32 level)
 {
 	LLMemType mt_ld(LLMemType::MTYPE_PIPELINE_LIGHTING_DETAIL);
+	refreshCachedSettings();
 
 	if (level < 0)
 	{
-		if (gSavedSettings.getBOOL("RenderLocalLights"))
+		if (RenderLocalLights)
 		{
 			level = 1;
 		}
@@ -1447,7 +1639,7 @@ U32 LLPipeline::addObject(LLViewerObject *vobj)
 {
 	LLMemType mt_ao(LLMemType::MTYPE_PIPELINE_ADD_OBJECT);
 
-	if (gSavedSettings.getBOOL("RenderDelayCreation"))
+	if (RenderDelayCreation)
 	{
 		mCreateQ.push_back(vobj);
 	}
@@ -1510,7 +1702,7 @@ void LLPipeline::createObject(LLViewerObject* vobj)
 
 	markRebuild(drawablep, LLDrawable::REBUILD_ALL, TRUE);
 
-	if (drawablep->getVOVolume() && gSavedSettings.getBOOL("RenderAnimateRes"))
+	if (drawablep->getVOVolume() && RenderAnimateRes)
 	{
 		// fun animated res
 		drawablep->updateXform(TRUE);
@@ -1549,7 +1741,7 @@ void LLPipeline::resetFrameStats()
 //external functions for asynchronous updating
 void LLPipeline::updateMoveDampedAsync(LLDrawable* drawablep)
 {
-	if (gSavedSettings.getBOOL("FreezeTime"))
+	if (FreezeTime)
 	{
 		return;
 	}
@@ -1579,7 +1771,7 @@ void LLPipeline::updateMoveDampedAsync(LLDrawable* drawablep)
 
 void LLPipeline::updateMoveNormalAsync(LLDrawable* drawablep)
 {
-	if (gSavedSettings.getBOOL("FreezeTime"))
+	if (FreezeTime)
 	{
 		return;
 	}
@@ -1636,7 +1828,7 @@ void LLPipeline::updateMove()
 	LLFastTimer t(FTM_UPDATE_MOVE);
 	LLMemType mt_um(LLMemType::MTYPE_PIPELINE_UPDATE_MOVE);
 
-	if (gSavedSettings.getBOOL("FreezeTime"))
+	if (FreezeTime)
 	{
 		return;
 	}
@@ -2009,13 +2201,13 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
 		gGL.setColorMask(false, false);
 	}
 
-	glMatrixMode(GL_PROJECTION);
-	glPushMatrix();
-	glLoadMatrixd(gGLLastProjection);
-	glMatrixMode(GL_MODELVIEW);
-	glPushMatrix();
+	gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.pushMatrix();
+	gGL.loadMatrix(gGLLastProjection);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
+	gGL.pushMatrix();
 	gGLLastMatrix = NULL;
-	glLoadMatrixd(gGLLastModelView);
+	gGL.loadMatrix(gGLLastModelView);
 
 
 	LLVertexBuffer::unbind();
@@ -2120,10 +2312,10 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
 	}
 	
 	
-	glMatrixMode(GL_PROJECTION);
-	glPopMatrix();
-	glMatrixMode(GL_MODELVIEW);
-	glPopMatrix();
+	gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.popMatrix();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
+	gGL.popMatrix();
 
 	if (sUseOcclusion > 1)
 	{
@@ -2359,15 +2551,6 @@ void LLPipeline::updateGeom(F32 max_dtime)
 
 	assertInitialized();
 
-	if (sDelayedVBOEnable > 0)
-	{
-		if (--sDelayedVBOEnable <= 0)
-		{
-			resetVertexBuffers();
-			LLVertexBuffer::sEnableVBOs = TRUE;
-		}
-	}
-
 	// notify various object types to reset internal cost metrics, etc.
 	// for now, only LLVOVolume does this to throttle LOD changes
 	LLVOVolume::preUpdateGeom();
@@ -2761,6 +2944,11 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
 			{
 				markVisible(*i, camera);
 			}
+
+			if (!sDelayVBUpdate)
+			{ //rebuild mesh as soon as we know it's visible
+				group->rebuildMesh();
+			}
 		}
 	}
 
@@ -2811,6 +2999,11 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
 		{
 			group->setVisible();
 			stateSort(group, camera);
+
+			if (!sDelayVBUpdate)
+			{ //rebuild mesh as soon as we know it's visible
+				group->rebuildMesh();
+			}
 		}
 	}
 	
@@ -2826,11 +3019,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
 			}
 		}
 	}
-	{
-		LLFastTimer ftm(FTM_CLIENT_COPY);
-		LLVertexBuffer::clientCopy();
-	}
-	
+		
 	postSort(camera);	
 }
 
@@ -2986,7 +3175,7 @@ void renderScriptedBeacons(LLDrawable* drawablep)
 	{
 		if (gPipeline.sRenderBeacons)
 		{
-			gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth"));
+			gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), LLPipeline::DebugBeaconLineWidth);
 		}
 
 		if (gPipeline.sRenderHighlight)
@@ -3012,7 +3201,7 @@ void renderScriptedTouchBeacons(LLDrawable* drawablep)
 	{
 		if (gPipeline.sRenderBeacons)
 		{
-			gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth"));
+			gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), LLPipeline::DebugBeaconLineWidth);
 		}
 
 		if (gPipeline.sRenderHighlight)
@@ -3037,7 +3226,7 @@ void renderPhysicalBeacons(LLDrawable* drawablep)
 	{
 		if (gPipeline.sRenderBeacons)
 		{
-			gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(0.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth"));
+			gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(0.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), LLPipeline::DebugBeaconLineWidth);
 		}
 
 		if (gPipeline.sRenderHighlight)
@@ -3073,7 +3262,7 @@ void renderMOAPBeacons(LLDrawable* drawablep)
 	{
 		if (gPipeline.sRenderBeacons)
 		{
-			gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 1.f, 1.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth"));
+			gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 1.f, 1.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), LLPipeline::DebugBeaconLineWidth);
 		}
 
 		if (gPipeline.sRenderHighlight)
@@ -3098,7 +3287,7 @@ void renderParticleBeacons(LLDrawable* drawablep)
 		if (gPipeline.sRenderBeacons)
 		{
 			LLColor4 light_blue(0.5f, 0.5f, 1.f, 0.5f);
-			gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", light_blue, LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth"));
+			gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", light_blue, LLColor4(1.f, 1.f, 1.f, 0.5f), LLPipeline::DebugBeaconLineWidth);
 		}
 
 		if (gPipeline.sRenderHighlight)
@@ -3243,19 +3432,6 @@ void LLPipeline::postSort(LLCamera& camera)
 		
 	if (!sShadowRender)
 	{
-		//sort by texture or bump map
-		for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; ++i)
-		{
-			if (i == LLRenderPass::PASS_BUMP)
-			{
-				std::sort(sCull->beginRenderMap(i), sCull->endRenderMap(i), LLDrawInfo::CompareBump());
-			}
-			else 
-			{
-				std::sort(sCull->beginRenderMap(i), sCull->endRenderMap(i), LLDrawInfo::CompareTexturePtrMatrix());
-			}	
-		}
-
 		std::sort(sCull->beginAlphaGroups(), sCull->endAlphaGroups(), LLSpatialGroup::CompareDepthGreater());
 	}
 	llpushcallstacks ;
@@ -3304,7 +3480,7 @@ void LLPipeline::postSort(LLCamera& camera)
 				if (gPipeline.sRenderBeacons)
 				{
 					//pos += LLVector3(0.f, 0.f, 0.2f);
-					gObjectList.addDebugBeacon(pos, "", LLColor4(1.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth"));
+					gObjectList.addDebugBeacon(pos, "", LLColor4(1.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), DebugBeaconLineWidth);
 				}
 			}
 			// now deal with highlights for all those seeable sound sources
@@ -3369,7 +3545,7 @@ void render_hud_elements()
 
 	if (!LLPipeline::sReflectionRender && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
 	{
-		LLGLEnable multisample(gSavedSettings.getU32("RenderFSAASamples") > 0 ? GL_MULTISAMPLE_ARB : 0);
+		LLGLEnable multisample(LLPipeline::RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
 		gViewerWindow->renderSelections(FALSE, FALSE, FALSE); // For HUD version in render_ui_3d()
 	
 		// Draw the tracking overlays
@@ -3441,10 +3617,10 @@ void LLPipeline::renderHighlights()
 		//gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);
 
 		gGL.pushMatrix();
-		glLoadIdentity();
-		glMatrixMode(GL_PROJECTION);
+		gGL.loadIdentity();
+		gGL.matrixMode(LLRender::MM_PROJECTION);
 		gGL.pushMatrix();
-		glLoadIdentity();
+		gGL.loadIdentity();
 
 		gGL.getTexUnit(0)->bind(&mHighlight);
 
@@ -3456,9 +3632,9 @@ void LLPipeline::renderHighlights()
 
 		gGL.begin(LLRender::TRIANGLES);
 				
-		F32 scale = gSavedSettings.getF32("RenderHighlightBrightness");
-		LLColor4 color = gSavedSettings.getColor4("RenderHighlightColor");
-		F32 thickness = gSavedSettings.getF32("RenderHighlightThickness");
+		F32 scale = RenderHighlightBrightness;
+		LLColor4 color = RenderHighlightColor;
+		F32 thickness = RenderHighlightThickness;
 
 		for (S32 pass = 0; pass < 2; ++pass)
 		{
@@ -3504,7 +3680,7 @@ void LLPipeline::renderHighlights()
 		gGL.end();
 
 		gGL.popMatrix();
-		glMatrixMode(GL_MODELVIEW);
+		gGL.matrixMode(LLRender::MM_MODELVIEW);
 		gGL.popMatrix();
 		
 		//gGL.setSceneBlendType(LLRender::BT_ALPHA);
@@ -3513,7 +3689,7 @@ void LLPipeline::renderHighlights()
 	if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
 	{
 		gHighlightProgram.bind();
-		gHighlightProgram.vertexAttrib4f(LLViewerShaderMgr::MATERIAL_COLOR,1,1,1,0.5f);
+		gGL.diffuseColor4f(1,1,1,0.5f);
 	}
 	
 	if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED))
@@ -3543,10 +3719,7 @@ void LLPipeline::renderHighlights()
 	{
 		// Paint 'em red!
 		color.setVec(1.f, 0.f, 0.f, 0.5f);
-		if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
-		{
-			gHighlightProgram.vertexAttrib4f(LLViewerShaderMgr::MATERIAL_COLOR,1,0,0,0.5f);
-		}
+		
 		int count = mHighlightFaces.size();
 		for (S32 i = 0; i < count; i++)
 		{
@@ -3575,8 +3748,8 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
 
 	assertInitialized();
 
-	F64 saved_modelview[16];
-	F64 saved_projection[16];
+	F32 saved_modelview[16];
+	F32 saved_projection[16];
 
 	//HACK: preserve/restore matrices around HUD render
 	if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD))
@@ -3588,13 +3761,6 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
 		}
 	}
 
-	S32 stack_depth = 0;
-
-	if (gDebugGL)
-	{
-		glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &stack_depth);
-	}
-
 	///////////////////////////////////////////
 	//
 	// Sync and verify GL state
@@ -3620,12 +3786,13 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
 	LLAppViewer::instance()->pingMainloopTimeout("Pipeline:ForceVBO");
 	
 	// Initialize lots of GL state to "safe" values
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity();
-	glMatrixMode(GL_MODELVIEW);
+	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+	gGL.matrixMode(LLRender::MM_TEXTURE);
+	gGL.loadIdentity();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
 
 	LLGLSPipeline gls_pipeline;
-	LLGLEnable multisample(gSavedSettings.getU32("RenderFSAASamples") > 0 ? GL_MULTISAMPLE_ARB : 0);
+	LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
 
 	LLGLState gls_color_material(GL_COLOR_MATERIAL, mLightingDetail < 2);
 				
@@ -3691,7 +3858,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
 			{
 				occlude = FALSE;
 				gGLLastMatrix = NULL;
-				glLoadMatrixd(gGLModelView);
+				gGL.loadMatrix(gGLModelView);
 				LLGLSLShader::bindNoShader();
 				doOcclusion(camera);
 			}
@@ -3702,7 +3869,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
 				LLFastTimer t(FTM_POOLRENDER);
 
 				gGLLastMatrix = NULL;
-				glLoadMatrixd(gGLModelView);
+				gGL.loadMatrix(gGLModelView);
 			
 				for( S32 i = 0; i < poolp->getNumPasses(); i++ )
 				{
@@ -3722,7 +3889,6 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
 					LLVertexBuffer::unbind();
 					if (gDebugGL)
 					{
-						check_stack_depth(stack_depth);
 						std::string msg = llformat("pass %d", i);
 						LLGLState::checkStates(msg);
 						//LLGLState::checkTextureChannels(msg);
@@ -3751,13 +3917,13 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
 		LLVertexBuffer::unbind();
 			
 		gGLLastMatrix = NULL;
-		glLoadMatrixd(gGLModelView);
+		gGL.loadMatrix(gGLModelView);
 
 		if (occlude)
 		{
 			occlude = FALSE;
 			gGLLastMatrix = NULL;
-			glLoadMatrixd(gGLModelView);
+			gGL.loadMatrix(gGLModelView);
 			LLGLSLShader::bindNoShader();
 			doOcclusion(camera);
 		}
@@ -3851,7 +4017,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)
 		}
 	}
 
-	LLGLEnable multisample(gSavedSettings.getU32("RenderFSAASamples") > 0 ? GL_MULTISAMPLE_ARB : 0);
+	LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
 
 	LLVertexBuffer::unbind();
 
@@ -3877,7 +4043,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)
 			LLFastTimer t(FTM_POOLRENDER);
 
 			gGLLastMatrix = NULL;
-			glLoadMatrixd(gGLModelView);
+			gGL.loadMatrix(gGLModelView);
 		
 			for( S32 i = 0; i < poolp->getNumDeferredPasses(); i++ )
 			{
@@ -3898,12 +4064,6 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)
 
 				if (gDebugGL || gDebugPipeline)
 				{
-					GLint depth;
-					glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &depth);
-					if (depth > 3)
-					{
-						llerrs << "GL matrix stack corrupted!" << llendl;
-					}
 					LLGLState::checkStates();
 				}
 			}
@@ -3925,7 +4085,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)
 	}
 
 	gGLLastMatrix = NULL;
-	glLoadMatrixd(gGLModelView);
+	gGL.loadMatrix(gGLModelView);
 
 	gGL.setColorMask(true, false);
 }
@@ -3938,7 +4098,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
 
 	LLGLEnable cull(GL_CULL_FACE);
 
-	LLGLEnable multisample(gSavedSettings.getU32("RenderFSAASamples") > 0 ? GL_MULTISAMPLE_ARB : 0);
+	LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
 
 	calcNearbyLights(camera);
 	setupHWLights(NULL);
@@ -3958,7 +4118,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
 		{
 			occlude = FALSE;
 			gGLLastMatrix = NULL;
-			glLoadMatrixd(gGLModelView);
+			gGL.loadMatrix(gGLModelView);
 			LLGLSLShader::bindNoShader();
 			doOcclusion(camera);
 			gGL.setColorMask(true, false);
@@ -3970,7 +4130,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
 			LLFastTimer t(FTM_POOLRENDER);
 
 			gGLLastMatrix = NULL;
-			glLoadMatrixd(gGLModelView);
+			gGL.loadMatrix(gGLModelView);
 		
 			for( S32 i = 0; i < poolp->getNumPostDeferredPasses(); i++ )
 			{
@@ -3991,12 +4151,6 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
 
 				if (gDebugGL || gDebugPipeline)
 				{
-					GLint depth;
-					glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &depth);
-					if (depth > 3)
-					{
-						llerrs << "GL matrix stack corrupted!" << llendl;
-					}
 					LLGLState::checkStates();
 				}
 			}
@@ -4018,17 +4172,17 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
 	}
 
 	gGLLastMatrix = NULL;
-	glLoadMatrixd(gGLModelView);
+	gGL.loadMatrix(gGLModelView);
 
 	if (occlude)
 	{
 		occlude = FALSE;
 		gGLLastMatrix = NULL;
-		glLoadMatrixd(gGLModelView);
+		gGL.loadMatrix(gGLModelView);
 		LLGLSLShader::bindNoShader();
 		doOcclusion(camera);
 		gGLLastMatrix = NULL;
-		glLoadMatrixd(gGLModelView);
+		gGL.loadMatrix(gGLModelView);
 	}
 }
 
@@ -4052,8 +4206,10 @@ void LLPipeline::renderGeomShadow(LLCamera& camera)
 		pool_set_t::iterator iter2 = iter1;
 		if (hasRenderType(poolp->getType()) && poolp->getNumShadowPasses() > 0)
 		{
+			poolp->prerender() ;
+
 			gGLLastMatrix = NULL;
-			glLoadMatrixd(gGLModelView);
+			gGL.loadMatrix(gGLModelView);
 		
 			for( S32 i = 0; i < poolp->getNumShadowPasses(); i++ )
 			{
@@ -4092,7 +4248,7 @@ void LLPipeline::renderGeomShadow(LLCamera& camera)
 	}
 
 	gGLLastMatrix = NULL;
-	glLoadMatrixd(gGLModelView);
+	gGL.loadMatrix(gGLModelView);
 }
 
 
@@ -4139,6 +4295,11 @@ void LLPipeline::renderPhysicsDisplay()
 
 	gGL.setColorMask(true, false);
 
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		gDebugProgram.bind();
+	}
+
 	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 			iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 	{
@@ -4161,15 +4322,20 @@ void LLPipeline::renderPhysicsDisplay()
 		LLSpatialBridge* bridge = *i;
 		if (!bridge->isDead() && hasRenderType(bridge->mDrawableType))
 		{
-			glPushMatrix();
-			glMultMatrixf((F32*)bridge->mDrawable->getRenderMatrix().mMatrix);
+			gGL.pushMatrix();
+			gGL.multMatrix((F32*)bridge->mDrawable->getRenderMatrix().mMatrix);
 			bridge->renderPhysicsShapes();
-			glPopMatrix();
+			gGL.popMatrix();
 		}
 	}
 
-
 	gGL.flush();
+
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		gDebugProgram.unbind();
+	}
+
 	mPhysicsDisplay.flush();
 }
 
@@ -4183,13 +4349,21 @@ void LLPipeline::renderDebug()
 	gGL.color4f(1,1,1,1);
 
 	gGLLastMatrix = NULL;
-	glLoadMatrixd(gGLModelView);
+	gGL.loadMatrix(gGLModelView);
 	gGL.setColorMask(true, false);
 
 	bool hud_only = hasRenderType(LLPipeline::RENDER_TYPE_HUD);
 
+	
 	if (!hud_only && !mDebugBlips.empty())
 	{ //render debug blips
+		if (LLGLSLShader::sNoFixedFunction)
+		{
+			gUIProgram.bind();
+		}
+
+		gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep, true);
+
 		glPointSize(8.f);
 		LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
 
@@ -4243,13 +4417,18 @@ void LLPipeline::renderDebug()
 		LLSpatialBridge* bridge = *i;
 		if (!bridge->isDead() && hasRenderType(bridge->mDrawableType))
 		{
-			glPushMatrix();
-			glMultMatrixf((F32*)bridge->mDrawable->getRenderMatrix().mMatrix);
+			gGL.pushMatrix();
+			gGL.multMatrix((F32*)bridge->mDrawable->getRenderMatrix().mMatrix);
 			bridge->renderDebug();
-			glPopMatrix();
+			gGL.popMatrix();
 		}
 	}
 
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		gUIProgram.bind();
+	}
+
 	if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
 	{
 		LLVertexBuffer::unbind();
@@ -4434,7 +4613,7 @@ void LLPipeline::renderDebug()
 		gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep);
 		
 		gGL.pushMatrix();
-		glLoadMatrixd(gGLModelView);
+		gGL.loadMatrix(gGLModelView);
 		gGLLastMatrix = NULL;
 
 		for (LLSpatialGroup::sg_vector_t::iterator iter = mGroupQ2.begin(); iter != mGroupQ2.end(); ++iter)
@@ -4455,7 +4634,7 @@ void LLPipeline::renderDebug()
 			if (bridge)
 			{
 				gGL.pushMatrix();
-				glMultMatrixf((F32*)bridge->mDrawable->getRenderMatrix().mMatrix);
+				gGL.multMatrix((F32*)bridge->mDrawable->getRenderMatrix().mMatrix);
 			}
 
 			F32 alpha = llclamp((F32) (size-count)/size, 0.f, 1.f);
@@ -4479,8 +4658,10 @@ void LLPipeline::renderDebug()
 	}
 
 	gGL.flush();
-
-	gPipeline.renderPhysicsDisplay();
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		gUIProgram.unbind();
+	}
 }
 
 void LLPipeline::rebuildPools()
@@ -5029,10 +5210,14 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)
 void LLPipeline::setupHWLights(LLDrawPool* pool)
 {
 	assertInitialized();
-
+	
 	// Ambient
-	LLColor4 ambient = gSky.getTotalAmbientColor();
-	glLightModelfv(GL_LIGHT_MODEL_AMBIENT,ambient.mV);
+	if (!LLGLSLShader::sNoFixedFunction)
+	{
+		gGL.syncMatrices();
+		LLColor4 ambient = gSky.getTotalAmbientColor();
+		gGL.setAmbientLightColor(ambient);
+	}
 
 	// Light 0 = Sun or Moon (All objects)
 	{
@@ -5133,7 +5318,8 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
 			light_state->setConstantAttenuation(0.f);
 			if (sRenderDeferred)
 			{
-				light_state->setLinearAttenuation(light_radius*1.5f);
+				F32 size = light_radius*1.5f;
+				light_state->setLinearAttenuation(size*size);
 				light_state->setQuadraticAttenuation(light->getLightFalloff()*0.5f+1.f);
 			}
 			else
@@ -5142,8 +5328,9 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
 				light_state->setQuadraticAttenuation(0.f);
 			}
 			
+
 			if (light->isLightSpotlight() // directional (spot-)light
-			    && (LLPipeline::sRenderDeferred || gSavedSettings.getBOOL("RenderSpotLightsInNondeferred"))) // these are only rendered as GL spotlights if we're in deferred rendering mode *or* the setting forces them on
+			    && (LLPipeline::sRenderDeferred || RenderSpotLightsInNondeferred)) // these are only rendered as GL spotlights if we're in deferred rendering mode *or* the setting forces them on
 			{
 				LLVector3 spotparams = light->getSpotLightParams();
 				LLQuaternion quat = light->getRenderRotation();
@@ -5154,7 +5341,8 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
 				light_state->setSpotCutoff(90.f);
 				light_state->setSpotExponent(2.f);
 	
-				light_state->setSpecular(LLColor4::black);
+				const LLColor4 specular(0.f, 0.f, 0.f, 0.f);
+				light_state->setSpecular(specular);
 			}
 			else // omnidirectional (point) light
 			{
@@ -5210,7 +5398,11 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
 	}
 
 	// Init GL state
-	glDisable(GL_LIGHTING);
+	if (!LLGLSLShader::sNoFixedFunction)
+	{
+		glDisable(GL_LIGHTING);
+	}
+
 	for (S32 i = 0; i < 8; ++i)
 	{
 		gGL.getLight(i)->disable();
@@ -5231,7 +5423,10 @@ void LLPipeline::enableLights(U32 mask)
 		stop_glerror();
 		if (!mLightMask)
 		{
-			glEnable(GL_LIGHTING);
+			if (!LLGLSLShader::sNoFixedFunction)
+			{
+				glEnable(GL_LIGHTING);
+			}
 		}
 		if (mask)
 		{
@@ -5254,13 +5449,16 @@ void LLPipeline::enableLights(U32 mask)
 		}
 		else
 		{
-			glDisable(GL_LIGHTING);
+			if (!LLGLSLShader::sNoFixedFunction)
+			{
+				glDisable(GL_LIGHTING);
+			}
 		}
-		stop_glerror();
 		mLightMask = mask;
-		LLColor4 ambient = gSky.getTotalAmbientColor();
-		glLightModelfv(GL_LIGHT_MODEL_AMBIENT,ambient.mV);
 		stop_glerror();
+
+		LLColor4 ambient = gSky.getTotalAmbientColor();
+		gGL.setAmbientLightColor(ambient);
 	}
 }
 
@@ -5309,21 +5507,24 @@ void LLPipeline::enableLightsPreview()
 {
 	disableLights();
 
-	glEnable(GL_LIGHTING);
-	LLColor4 ambient = gSavedSettings.getColor4("PreviewAmbientColor");
-	glLightModelfv(GL_LIGHT_MODEL_AMBIENT,ambient.mV);
+	if (!LLGLSLShader::sNoFixedFunction)
+	{
+		glEnable(GL_LIGHTING);
+	}
 
+	LLColor4 ambient = PreviewAmbientColor;
+	gGL.setAmbientLightColor(ambient);
 
-	LLColor4 diffuse0 = gSavedSettings.getColor4("PreviewDiffuse0");
-	LLColor4 specular0 = gSavedSettings.getColor4("PreviewSpecular0");
-	LLColor4 diffuse1 = gSavedSettings.getColor4("PreviewDiffuse1");
-	LLColor4 specular1 = gSavedSettings.getColor4("PreviewSpecular1");
-	LLColor4 diffuse2 = gSavedSettings.getColor4("PreviewDiffuse2");
-	LLColor4 specular2 = gSavedSettings.getColor4("PreviewSpecular2");
+	LLColor4 diffuse0 = PreviewDiffuse0;
+	LLColor4 specular0 = PreviewSpecular0;
+	LLColor4 diffuse1 = PreviewDiffuse1;
+	LLColor4 specular1 = PreviewSpecular1;
+	LLColor4 diffuse2 = PreviewDiffuse2;
+	LLColor4 specular2 = PreviewSpecular2;
 
-	LLVector3 dir0 = gSavedSettings.getVector3("PreviewDirection0");
-	LLVector3 dir1 = gSavedSettings.getVector3("PreviewDirection1");
-	LLVector3 dir2 = gSavedSettings.getVector3("PreviewDirection2");
+	LLVector3 dir0 = PreviewDirection0;
+	LLVector3 dir1 = PreviewDirection1;
+	LLVector3 dir2 = PreviewDirection2;
 
 	dir0.normVec();
 	dir1.normVec();
@@ -5370,7 +5571,7 @@ void LLPipeline::enableLightsAvatarEdit(const LLColor4& color)
 	setupAvatarLights(TRUE);
 	enableLights(mask);
 
-	glLightModelfv(GL_LIGHT_MODEL_AMBIENT,color.mV);
+	gGL.setAmbientLightColor(color);
 }
 
 void LLPipeline::enableLightsFullbright(const LLColor4& color)
@@ -5379,7 +5580,7 @@ void LLPipeline::enableLightsFullbright(const LLColor4& color)
 	U32 mask = 0x1000; // Non-0 mask, set ambient
 	enableLights(mask);
 
-	glLightModelfv(GL_LIGHT_MODEL_AMBIENT,color.mV);
+	gGL.setAmbientLightColor(color);
 }
 
 void LLPipeline::disableLights()
@@ -6003,7 +6204,7 @@ LLSpatialPartition* LLPipeline::getSpatialPartition(LLViewerObject* vobj)
 
 void LLPipeline::resetVertexBuffers(LLDrawable* drawable)
 {
-	if (!drawable || drawable->isDead())
+	if (!drawable)
 	{
 		return;
 	}
@@ -6016,7 +6217,19 @@ void LLPipeline::resetVertexBuffers(LLDrawable* drawable)
 }
 
 void LLPipeline::resetVertexBuffers()
-{	
+{
+	mResetVertexBuffers = true;
+}
+
+void LLPipeline::doResetVertexBuffers()
+{
+	if (!mResetVertexBuffers)
+	{
+		return;
+	}
+	
+	mResetVertexBuffers = false;
+
 	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 			iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 	{
@@ -6035,25 +6248,14 @@ void LLPipeline::resetVertexBuffers()
 
 	gSky.resetVertexBuffers();
 
-	if (LLVertexBuffer::sGLCount > 0)
-	{
-		LLVertexBuffer::cleanupClass();
-	}
-
+	LLVertexBuffer::cleanupClass();
+	
 	//delete all name pool caches
 	LLGLNamePool::cleanupPools();
 
 	if (LLVertexBuffer::sGLCount > 0)
 	{
-		llwarns << "VBO wipe failed." << llendl;
-	}
-
-	if (!LLVertexBuffer::sStreamIBOPool.mNameList.empty() ||
-		!LLVertexBuffer::sStreamVBOPool.mNameList.empty() ||
-		!LLVertexBuffer::sDynamicIBOPool.mNameList.empty() ||
-		!LLVertexBuffer::sDynamicVBOPool.mNameList.empty())
-	{
-		llwarns << "VBO name pool cleanup failed." << llendl;
+		llwarns << "VBO wipe failed -- " << LLVertexBuffer::sGLCount << " buffers remaining." << llendl;
 	}
 
 	LLVertexBuffer::unbind();	
@@ -6061,22 +6263,25 @@ void LLPipeline::resetVertexBuffers()
 	sRenderBump = gSavedSettings.getBOOL("RenderObjectBump");
 	sUseTriStrips = gSavedSettings.getBOOL("RenderUseTriStrips");
 	LLVertexBuffer::sUseStreamDraw = gSavedSettings.getBOOL("RenderUseStreamVBO");
+	LLVertexBuffer::sUseVAO = gSavedSettings.getBOOL("RenderUseVAO");
 	LLVertexBuffer::sPreferStreamDraw = gSavedSettings.getBOOL("RenderPreferStreamDraw");
 	LLVertexBuffer::sEnableVBOs = gSavedSettings.getBOOL("RenderVBOEnable");
 	LLVertexBuffer::sDisableVBOMapping = LLVertexBuffer::sEnableVBOs && gSavedSettings.getBOOL("RenderVBOMappingDisable") ;
 	sBakeSunlight = gSavedSettings.getBOOL("RenderBakeSunlight");
 	sNoAlpha = gSavedSettings.getBOOL("RenderNoAlpha");
 	LLPipeline::sTextureBindTest = gSavedSettings.getBOOL("RenderDebugTextureBind");
+
+	LLVertexBuffer::initClass(LLVertexBuffer::sEnableVBOs, LLVertexBuffer::sDisableVBOMapping);
 }
 
-void LLPipeline::renderObjects(U32 type, U32 mask, BOOL texture)
+void LLPipeline::renderObjects(U32 type, U32 mask, BOOL texture, BOOL batch_texture)
 {
 	LLMemType mt_ro(LLMemType::MTYPE_PIPELINE_RENDER_OBJECTS);
 	assertInitialized();
-	glLoadMatrixd(gGLModelView);
+	gGL.loadMatrix(gGLModelView);
 	gGLLastMatrix = NULL;
-	mSimplePool->pushBatches(type, mask);
-	glLoadMatrixd(gGLModelView);
+	mSimplePool->pushBatches(type, mask, texture, batch_texture);
+	gGL.loadMatrix(gGLModelView);
 	gGLLastMatrix = NULL;		
 }
 
@@ -6085,25 +6290,25 @@ void apply_cube_face_rotation(U32 face)
 	switch (face)
 	{
 		case 0: 
-			glRotatef(90.f, 0, 1, 0);
-			glRotatef(180.f, 1, 0, 0);
+			gGL.rotatef(90.f, 0, 1, 0);
+			gGL.rotatef(180.f, 1, 0, 0);
 		break;
 		case 2: 
-			glRotatef(-90.f, 1, 0, 0);
+			gGL.rotatef(-90.f, 1, 0, 0);
 		break;
 		case 4:
-			glRotatef(180.f, 0, 1, 0);
-			glRotatef(180.f, 0, 0, 1);
+			gGL.rotatef(180.f, 0, 1, 0);
+			gGL.rotatef(180.f, 0, 0, 1);
 		break;
 		case 1: 
-			glRotatef(-90.f, 0, 1, 0);
-			glRotatef(180.f, 1, 0, 0);
+			gGL.rotatef(-90.f, 0, 1, 0);
+			gGL.rotatef(180.f, 1, 0, 0);
 		break;
 		case 3:
-			glRotatef(90, 1, 0, 0);
+			gGL.rotatef(90, 1, 0, 0);
 		break;
 		case 5: 
-			glRotatef(180, 0, 0, 1);
+			gGL.rotatef(180, 0, 0, 1);
 		break;
 	}
 }
@@ -6146,8 +6351,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
 {
 	LLMemType mt_ru(LLMemType::MTYPE_PIPELINE_RENDER_BLOOM);
 	if (!(gPipeline.canUseVertexShaders() &&
-		sRenderGlow) ||
-		(!sRenderDeferred && hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES)))
+		sRenderGlow))
 	{
 		return;
 	}
@@ -6163,16 +6367,9 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
 		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
 	}
 
-	U32 res_mod = gSavedSettings.getU32("RenderResolutionDivisor");
-
 	LLVector2 tc1(0,0);
-	LLVector2 tc2((F32) gViewerWindow->getWorldViewWidthRaw()*2,
-				  (F32) gViewerWindow->getWorldViewHeightRaw()*2);
-
-	if (res_mod > 1)
-	{
-		tc2 /= (F32) res_mod;
-	}
+	LLVector2 tc2((F32) mScreen.getWidth()*2,
+				  (F32) mScreen.getHeight()*2);
 
 	LLFastTimer ftm(FTM_RENDER_BLOOM);
 	gGL.color4f(1,1,1,1);
@@ -6182,12 +6379,12 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
 	
 	enableLightsFullbright(LLColor4(1,1,1,1));
 
-	glMatrixMode(GL_PROJECTION);
-	glPushMatrix();
-	glLoadIdentity();
-	glMatrixMode(GL_MODELVIEW);
-	glPushMatrix();
-	glLoadIdentity();
+	gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.pushMatrix();
+	gGL.loadIdentity();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
+	gGL.pushMatrix();
+	gGL.loadIdentity();
 
 	LLGLDisable test(GL_ALPHA_TEST);
 
@@ -6202,16 +6399,18 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
 		}
 		
 		gGlowExtractProgram.bind();
-		F32 minLum = llmax(gSavedSettings.getF32("RenderGlowMinLuminance"), 0.0f);
-		F32 maxAlpha = gSavedSettings.getF32("RenderGlowMaxExtractAlpha");		
-		F32 warmthAmount = gSavedSettings.getF32("RenderGlowWarmthAmount");	
-		LLVector3 lumWeights = gSavedSettings.getVector3("RenderGlowLumWeights");
-		LLVector3 warmthWeights = gSavedSettings.getVector3("RenderGlowWarmthWeights");
-		gGlowExtractProgram.uniform1f("minLuminance", minLum);
-		gGlowExtractProgram.uniform1f("maxExtractAlpha", maxAlpha);
-		gGlowExtractProgram.uniform3f("lumWeights", lumWeights.mV[0], lumWeights.mV[1], lumWeights.mV[2]);
-		gGlowExtractProgram.uniform3f("warmthWeights", warmthWeights.mV[0], warmthWeights.mV[1], warmthWeights.mV[2]);
-		gGlowExtractProgram.uniform1f("warmthAmount", warmthAmount);
+		F32 minLum = llmax((F32) RenderGlowMinLuminance, 0.0f);
+		F32 maxAlpha = RenderGlowMaxExtractAlpha;		
+		F32 warmthAmount = RenderGlowWarmthAmount;	
+		LLVector3 lumWeights = RenderGlowLumWeights;
+		LLVector3 warmthWeights = RenderGlowWarmthWeights;
+
+
+		gGlowExtractProgram.uniform1f(LLShaderMgr::GLOW_MIN_LUMINANCE, minLum);
+		gGlowExtractProgram.uniform1f(LLShaderMgr::GLOW_MAX_EXTRACT_ALPHA, maxAlpha);
+		gGlowExtractProgram.uniform3f(LLShaderMgr::GLOW_LUM_WEIGHTS, lumWeights.mV[0], lumWeights.mV[1], lumWeights.mV[2]);
+		gGlowExtractProgram.uniform3f(LLShaderMgr::GLOW_WARMTH_WEIGHTS, warmthWeights.mV[0], warmthWeights.mV[1], warmthWeights.mV[2]);
+		gGlowExtractProgram.uniform1f(LLShaderMgr::GLOW_WARMTH_AMOUNT, warmthAmount);
 		LLGLEnable blend_on(GL_BLEND);
 		LLGLEnable test(GL_ALPHA_TEST);
 		
@@ -6242,22 +6441,22 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
 	tc2.setVec(2,2);
 
 	// power of two between 1 and 1024
-	U32 glowResPow = gSavedSettings.getS32("RenderGlowResolutionPow");
+	U32 glowResPow = RenderGlowResolutionPow;
 	const U32 glow_res = llmax(1, 
 		llmin(1024, 1 << glowResPow));
 
-	S32 kernel = gSavedSettings.getS32("RenderGlowIterations")*2;
-	F32 delta = gSavedSettings.getF32("RenderGlowWidth") / glow_res;
+	S32 kernel = RenderGlowIterations*2;
+	F32 delta = RenderGlowWidth / glow_res;
 	// Use half the glow width if we have the res set to less than 9 so that it looks
 	// almost the same in either case.
 	if (glowResPow < 9)
 	{
 		delta *= 0.5f;
 	}
-	F32 strength = gSavedSettings.getF32("RenderGlowStrength");
+	F32 strength = RenderGlowStrength;
 
 	gGlowProgram.bind();
-	gGlowProgram.uniform1f("glowStrength", strength);
+	gGlowProgram.uniform1f(LLShaderMgr::GLOW_STRENGTH, strength);
 
 	for (S32 i = 0; i < kernel; i++)
 	{
@@ -6278,11 +6477,11 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
 
 		if (i%2 == 0)
 		{
-			gGlowProgram.uniform2f("glowDelta", delta, 0);
+			gGlowProgram.uniform2f(LLShaderMgr::GLOW_DELTA, delta, 0);
 		}
 		else
 		{
-			gGlowProgram.uniform2f("glowDelta", 0, delta);
+			gGlowProgram.uniform2f(LLShaderMgr::GLOW_DELTA, 0, delta);
 		}
 
 		gGL.begin(LLRender::TRIANGLE_STRIP);
@@ -6314,8 +6513,8 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
 	gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight();
 	glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
 
-	tc2.setVec((F32) gViewerWindow->getWorldViewWidthRaw(),
-			(F32) gViewerWindow->getWorldViewHeightRaw());
+	tc2.setVec((F32) mScreen.getWidth(),
+			(F32) mScreen.getHeight());
 
 	gGL.flush();
 	
@@ -6323,28 +6522,22 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
 
 	if (LLPipeline::sRenderDeferred)
 	{
-		bool dof_enabled = !LLViewerCamera::getInstance()->cameraUnderWater();
 
-		LLGLSLShader* shader = &gDeferredPostProgram;
-		if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_DEFERRED) > 2)
-		{
-			shader = &gDeferredGIFinalProgram;
-			dof_enabled = false;
-		}
-		else if (!dof_enabled || LLToolMgr::getInstance()->inBuildMode() || !gSavedSettings.getBOOL("RenderDepthOfField"))
-		{ //squish focal length when in build mode (or if DoF is disabled) so DoF doesn't make editing objects difficult
-			shader = &gDeferredPostNoDoFProgram;
-			dof_enabled = false;
-		}
-		
-		
-		LLGLDisable blend(GL_BLEND);
-		bindDeferredShader(*shader);
+		bool dof_enabled = !LLViewerCamera::getInstance()->cameraUnderWater() &&
+							!LLToolMgr::getInstance()->inBuildMode() &&
+							RenderDepthOfField;
+
 
+		bool multisample = RenderFSAASamples > 1 && mFXAABuffer.isComplete();
+
+		gViewerWindow->setup3DViewport();
+				
 		if (dof_enabled)
 		{
-			//depth of field focal plane calculations
+			LLGLSLShader* shader = &gDeferredPostProgram;
+			LLGLDisable blend(GL_BLEND);
 
+			//depth of field focal plane calculations
 			static F32 current_distance = 16.f;
 			static F32 start_distance = 16.f;
 			static F32 transition_time = 1.f;
@@ -6374,8 +6567,8 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
 				else if (gAgentCamera.cameraMouselook())
 				{ //focus on point under mouselook crosshairs
 					gViewerWindow->cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE,
-												  NULL,
-												  &focus_point);
+													NULL,
+													&focus_point);
 				}
 				else
 				{
@@ -6406,7 +6599,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
 			}
 			else if (transition_time < 1.f)
 			{ //currently in a transition, continue interpolating
-				transition_time += 1.f/gSavedSettings.getF32("CameraFocusTransitionTime")*gFrameIntervalSeconds;
+				transition_time += 1.f/CameraFocusTransitionTime*gFrameIntervalSeconds;
 				transition_time = llmin(transition_time, 1.f);
 
 				F32 t = cosf(transition_time*F_PI+F_PI)*0.5f+0.5f;
@@ -6419,12 +6612,12 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
 
 			//convert to mm
 			F32 subject_distance = current_distance*1000.f;
-			F32 fnumber = gSavedSettings.getF32("CameraFNumber");
-			F32 default_focal_length = gSavedSettings.getF32("CameraFocalLength");
+			F32 fnumber = CameraFNumber;
+			F32 default_focal_length = CameraFocalLength;
 
 			F32 fov = LLViewerCamera::getInstance()->getView();
 		
-			const F32 default_fov = gSavedSettings.getF32("CameraFieldOfView") * F_PI/180.f;
+			const F32 default_fov = CameraFieldOfView * F_PI/180.f;
 			//const F32 default_aspect_ratio = gSavedSettings.getF32("CameraAspectRatio");
 		
 			//F32 aspect_ratio = (F32) mScreen.getWidth()/(F32)mScreen.getHeight();
@@ -6447,44 +6640,231 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
 			blur_constant /= 1000.f; //convert to meters for shader
 			F32 magnification = focal_length/(subject_distance-focal_length);
 
-			shader->uniform1f("focal_distance", -subject_distance/1000.f);
-			shader->uniform1f("blur_constant", blur_constant);
-			shader->uniform1f("tan_pixel_angle", tanf(1.f/LLDrawable::sCurPixelAngle));
-			shader->uniform1f("magnification", magnification);
-		}
+			{ //build diffuse+bloom+CoF
+				mDeferredLight.bindTarget();
+				shader = &gDeferredCoFProgram;
 
-		S32 channel = shader->enableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, mScreen.getUsage());
-		if (channel > -1)
-		{
-			mScreen.bindTexture(0, channel);
-		}
-		//channel = shader->enableTexture(LLViewerShaderMgr::DEFERRED_DEPTH, LLTexUnit::TT_RECT_TEXTURE);
-		//if (channel > -1)
-		//{
-			//gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
-		//}
+				bindDeferredShader(*shader);
 
-		gGL.begin(LLRender::TRIANGLE_STRIP);
-		gGL.texCoord2f(tc1.mV[0], tc1.mV[1]);
-		gGL.vertex2f(-1,-1);
+				S32 channel = shader->enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mScreen.getUsage());
+				if (channel > -1)
+				{
+					mScreen.bindTexture(0, channel);
+				}
+
+				shader->uniform1f(LLShaderMgr::DOF_FOCAL_DISTANCE, -subject_distance/1000.f);
+				shader->uniform1f(LLShaderMgr::DOF_BLUR_CONSTANT, blur_constant);
+				shader->uniform1f(LLShaderMgr::DOF_TAN_PIXEL_ANGLE, tanf(1.f/LLDrawable::sCurPixelAngle));
+				shader->uniform1f(LLShaderMgr::DOF_MAGNIFICATION, magnification);
+				shader->uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
+				shader->uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
+
+				gGL.begin(LLRender::TRIANGLE_STRIP);
+				gGL.texCoord2f(tc1.mV[0], tc1.mV[1]);
+				gGL.vertex2f(-1,-1);
 		
-		gGL.texCoord2f(tc1.mV[0], tc2.mV[1]);
-		gGL.vertex2f(-1,3);
+				gGL.texCoord2f(tc1.mV[0], tc2.mV[1]);
+				gGL.vertex2f(-1,3);
 		
-		gGL.texCoord2f(tc2.mV[0], tc1.mV[1]);
-		gGL.vertex2f(3,-1);
+				gGL.texCoord2f(tc2.mV[0], tc1.mV[1]);
+				gGL.vertex2f(3,-1);
 		
-		gGL.end();
+				gGL.end();
 
-		unbindDeferredShader(*shader);
-	}
-	else
-	{
-		if (res_mod > 1)
+				unbindDeferredShader(*shader);
+				mDeferredLight.flush();
+			}
+
+			U32 dof_width = (U32) (mScreen.getWidth()*CameraDoFResScale);
+			U32 dof_height = (U32) (mScreen.getHeight()*CameraDoFResScale);
+			
+			{ //perform DoF sampling at half-res (preserve alpha channel)
+				mScreen.bindTarget();
+				glViewport(0,0, dof_width, dof_height);
+				gGL.setColorMask(true, false);
+
+				shader = &gDeferredPostProgram;
+				bindDeferredShader(*shader);
+				S32 channel = shader->enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mDeferredLight.getUsage());
+				if (channel > -1)
+				{
+					mDeferredLight.bindTexture(0, channel);
+				}
+
+				shader->uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
+				shader->uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
+				
+				gGL.begin(LLRender::TRIANGLE_STRIP);
+				gGL.texCoord2f(tc1.mV[0], tc1.mV[1]);
+				gGL.vertex2f(-1,-1);
+		
+				gGL.texCoord2f(tc1.mV[0], tc2.mV[1]);
+				gGL.vertex2f(-1,3);
+		
+				gGL.texCoord2f(tc2.mV[0], tc1.mV[1]);
+				gGL.vertex2f(3,-1);
+		
+				gGL.end();
+
+				unbindDeferredShader(*shader);
+				mScreen.flush();
+				gGL.setColorMask(true, true);
+			}
+	
+			{ //combine result based on alpha
+				if (multisample)
+				{
+					mDeferredLight.bindTarget();
+					glViewport(0, 0, mDeferredScreen.getWidth(), mDeferredScreen.getHeight());
+				}
+				else
+				{
+					gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
+					gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
+					gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth();
+					gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight();
+					glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
+				}
+
+				shader = &gDeferredDoFCombineProgram;
+				bindDeferredShader(*shader);
+				
+				S32 channel = shader->enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mScreen.getUsage());
+				if (channel > -1)
+				{
+					mScreen.bindTexture(0, channel);
+					gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
+				}
+
+				shader->uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
+				shader->uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
+				shader->uniform1f(LLShaderMgr::DOF_WIDTH, dof_width-1);
+				shader->uniform1f(LLShaderMgr::DOF_HEIGHT, dof_height-1);
+
+				gGL.begin(LLRender::TRIANGLE_STRIP);
+				gGL.texCoord2f(tc1.mV[0], tc1.mV[1]);
+				gGL.vertex2f(-1,-1);
+		
+				gGL.texCoord2f(tc1.mV[0], tc2.mV[1]);
+				gGL.vertex2f(-1,3);
+		
+				gGL.texCoord2f(tc2.mV[0], tc1.mV[1]);
+				gGL.vertex2f(3,-1);
+		
+				gGL.end();
+
+				unbindDeferredShader(*shader);
+
+				if (multisample)
+				{
+					mDeferredLight.flush();
+				}
+			}
+		}
+		else
 		{
-			tc2 /= (F32) res_mod;
+			if (multisample)
+			{
+				mDeferredLight.bindTarget();
+			}
+			LLGLSLShader* shader = &gDeferredPostNoDoFProgram;
+			
+			bindDeferredShader(*shader);
+							
+			S32 channel = shader->enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mScreen.getUsage());
+			if (channel > -1)
+			{
+				mScreen.bindTexture(0, channel);
+			}
+
+			gGL.begin(LLRender::TRIANGLE_STRIP);
+			gGL.texCoord2f(tc1.mV[0], tc1.mV[1]);
+			gGL.vertex2f(-1,-1);
+		
+			gGL.texCoord2f(tc1.mV[0], tc2.mV[1]);
+			gGL.vertex2f(-1,3);
+		
+			gGL.texCoord2f(tc2.mV[0], tc1.mV[1]);
+			gGL.vertex2f(3,-1);
+		
+			gGL.end();
+
+			unbindDeferredShader(*shader);
+
+			if (multisample)
+			{
+				mDeferredLight.flush();
+			}
 		}
 
+		if (multisample)
+		{
+			//bake out texture2D with RGBL for FXAA shader
+			mFXAABuffer.bindTarget();
+			
+			S32 width = mScreen.getWidth();
+			S32 height = mScreen.getHeight();
+			glViewport(0, 0, width, height);
+
+			LLGLSLShader* shader = &gGlowCombineFXAAProgram;
+
+			shader->bind();
+			shader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, width, height);
+
+			S32 channel = shader->enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mDeferredLight.getUsage());
+			if (channel > -1)
+			{
+				mDeferredLight.bindTexture(0, channel);
+			}
+						
+			gGL.begin(LLRender::TRIANGLE_STRIP);
+			gGL.vertex2f(-1,-1);
+			gGL.vertex2f(-1,3);
+			gGL.vertex2f(3,-1);
+			gGL.end();
+
+			gGL.flush();
+
+			shader->disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mDeferredLight.getUsage());
+			shader->unbind();
+			
+			mFXAABuffer.flush();
+
+			shader = &gFXAAProgram;
+			shader->bind();
+
+			channel = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP, mFXAABuffer.getUsage());
+			if (channel > -1)
+			{
+				mFXAABuffer.bindTexture(0, channel);
+				gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
+			}
+			
+			gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
+			gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
+			gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth();
+			gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight();
+			glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
+
+			F32 scale_x = (F32) width/mFXAABuffer.getWidth();
+			F32 scale_y = (F32) height/mFXAABuffer.getHeight();
+			shader->uniform2f(LLShaderMgr::FXAA_TC_SCALE, scale_x, scale_y);
+			shader->uniform2f(LLShaderMgr::FXAA_RCP_SCREEN_RES, 1.f/width*scale_x, 1.f/height*scale_y);
+			shader->uniform4f(LLShaderMgr::FXAA_RCP_FRAME_OPT, -0.5f/width*scale_x, -0.5f/height*scale_y, 0.5f/width*scale_x, 0.5f/height*scale_y);
+			shader->uniform4f(LLShaderMgr::FXAA_RCP_FRAME_OPT2, -2.f/width*scale_x, -2.f/height*scale_y, 2.f/width*scale_x, 2.f/height*scale_y);
+			
+			gGL.begin(LLRender::TRIANGLE_STRIP);
+			gGL.vertex2f(-1,-1);
+			gGL.vertex2f(-1,3);
+			gGL.vertex2f(3,-1);
+			gGL.end();
+
+			gGL.flush();
+			shader->unbind();
+		}
+	}
+	else
+	{
 		U32 mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1;
 		LLPointer<LLVertexBuffer> buff = new LLVertexBuffer(mask, 0);
 		buff->allocateBuffer(3,0,TRUE);
@@ -6509,7 +6889,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
 		v[1] = LLVector3(-1,3,0);
 		v[2] = LLVector3(3,-1,0);
 				
-		buff->setBuffer(0);
+		buff->flush();
 
 		LLGLDisable blend(GL_BLEND);
 
@@ -6528,7 +6908,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
 		gGL.getTexUnit(0)->bind(&mGlow[1]);
 		gGL.getTexUnit(1)->bind(&mScreen);
 		
-		LLGLEnable multisample(gSavedSettings.getU32("RenderFSAASamples") > 0 ? GL_MULTISAMPLE_ARB : 0);
+		LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
 		
 		buff->setBuffer(mask);
 		buff->drawArrays(LLRender::TRIANGLE_STRIP, 0, 3);
@@ -6548,19 +6928,13 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
 		
 	}
 
-	if (LLRenderTarget::sUseFBO)
-	{ //copy depth buffer from mScreen to framebuffer
-		LLRenderTarget::copyContentsToFramebuffer(mScreen, 0, 0, mScreen.getWidth(), mScreen.getHeight(), 
-			0, 0, mScreen.getWidth(), mScreen.getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST);
-	}
-	
 	gGL.setSceneBlendType(LLRender::BT_ALPHA);
 
 	if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES))
 	{
 		if (LLGLSLShader::sNoFixedFunction)
 		{
-			gUIProgram.bind();
+			gSplatTextureRectProgram.bind();
 		}
 
 		gGL.setColorMask(true, false);
@@ -6574,7 +6948,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
 
 		gGL.getTexUnit(0)->bind(&mPhysicsDisplay);
 
-		gGL.begin(LLRender::TRIANGLE_STRIP);
+		gGL.begin(LLRender::TRIANGLES);
 		gGL.texCoord2f(tc1.mV[0], tc1.mV[1]);
 		gGL.vertex2f(-1,-1);
 		
@@ -6589,15 +6963,22 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
 
 		if (LLGLSLShader::sNoFixedFunction)
 		{
-			gUIProgram.unbind();
+			gSplatTextureRectProgram.unbind();
 		}
+	}
 
+	
+	if (LLRenderTarget::sUseFBO)
+	{ //copy depth buffer from mScreen to framebuffer
+		LLRenderTarget::copyContentsToFramebuffer(mScreen, 0, 0, mScreen.getWidth(), mScreen.getHeight(), 
+			0, 0, mScreen.getWidth(), mScreen.getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST);
 	}
+	
 
-	glMatrixMode(GL_PROJECTION);
-	glPopMatrix();
-	glMatrixMode(GL_MODELVIEW);
-	glPopMatrix();
+	gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.popMatrix();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
+	gGL.popMatrix();
 
 	LLVertexBuffer::unbind();
 
@@ -6608,7 +6989,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
 
 static LLFastTimer::DeclareTimer FTM_BIND_DEFERRED("Bind Deferred");
 
-void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRenderTarget* gi_source, LLRenderTarget* last_gi_post, U32 noise_map)
+void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 noise_map)
 {
 	LLFastTimer t(FTM_BIND_DEFERRED);
 
@@ -6619,146 +7000,28 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRen
 
 	shader.bind();
 	S32 channel = 0;
-	channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, mDeferredScreen.getUsage());
+	channel = shader.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mDeferredScreen.getUsage());
 	if (channel > -1)
 	{
 		mDeferredScreen.bindTexture(0,channel);
 		gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
 	}
 
-	channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_SPECULAR, mDeferredScreen.getUsage());
+	channel = shader.enableTexture(LLShaderMgr::DEFERRED_SPECULAR, mDeferredScreen.getUsage());
 	if (channel > -1)
 	{
 		mDeferredScreen.bindTexture(1, channel);
 		gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
 	}
 
-	channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_NORMAL, mDeferredScreen.getUsage());
+	channel = shader.enableTexture(LLShaderMgr::DEFERRED_NORMAL, mDeferredScreen.getUsage());
 	if (channel > -1)
 	{
 		mDeferredScreen.bindTexture(2, channel);
 		gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
 	}
 
-	if (gi_source)
-	{
-		BOOL has_gi = FALSE;
-		channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_DIFFUSE);
-		if (channel > -1)
-		{
-			has_gi = TRUE;
-			gi_source->bindTexture(0, channel);
-			gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
-		}
-		
-		channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_SPECULAR);
-		if (channel > -1)
-		{
-			has_gi = TRUE;
-			gi_source->bindTexture(1, channel);
-			gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
-		}
-		
-		channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_NORMAL);
-		if (channel > -1)
-		{
-			has_gi = TRUE;
-			gi_source->bindTexture(2, channel);
-			gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
-		}
-		
-		channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_MIN_POS);
-		if (channel > -1)
-		{
-			has_gi = TRUE;
-			gi_source->bindTexture(1, channel);
-			gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
-		}
-		
-		channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_MAX_POS);
-		if (channel > -1)
-		{
-			has_gi = TRUE;
-			gi_source->bindTexture(3, channel);
-			gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
-		}
-		
-		channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_LAST_DIFFUSE);
-		if (channel > -1)
-		{
-			has_gi = TRUE;
-			last_gi_post->bindTexture(0, channel);
-			gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
-		}
-		
-		channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_LAST_NORMAL);
-		if (channel > -1)
-		{
-			has_gi = TRUE;
-			last_gi_post->bindTexture(2, channel);
-			gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
-		}
-		
-		channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_LAST_MAX_POS);
-		if (channel > -1)
-		{
-			has_gi = TRUE;
-			last_gi_post->bindTexture(1, channel);
-			gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
-		}
-		
-		channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_LAST_MIN_POS);
-		if (channel > -1)
-		{
-			has_gi = TRUE;
-			last_gi_post->bindTexture(3, channel);
-			gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
-		}
-		
-		channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_DEPTH);
-		if (channel > -1)
-		{
-			has_gi = TRUE;
-			gGL.getTexUnit(channel)->bind(gi_source, TRUE);
-			gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
-			stop_glerror();
-			
-			glTexParameteri(LLTexUnit::getInternalType(mGIMap.getUsage()), GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE);		
-			glTexParameteri(LLTexUnit::getInternalType(mGIMap.getUsage()), GL_DEPTH_TEXTURE_MODE_ARB, GL_ALPHA);		
-
-			stop_glerror();
-		}
-
-		if (has_gi)
-		{
-			F32 range_x = llmin(mGIRange.mV[0], 1.f);
-			F32 range_y = llmin(mGIRange.mV[1], 1.f);
-
-			LLVector2 scale(range_x,range_y);
-
-			LLVector2 kern[25];
-
-			for (S32 i = 0; i < 5; ++i)
-			{
-				for (S32 j = 0; j < 5; ++j)
-				{
-					S32 idx = i*5+j;
-					kern[idx].mV[0] = (i-2)*0.5f;
-					kern[idx].mV[1] = (j-2)*0.5f;
-					kern[idx].scaleVec(scale);
-				}
-			}
-
-			shader.uniform2fv("gi_kern", 25, (F32*) kern);
-			shader.uniformMatrix4fv("gi_mat", 1, FALSE, mGIMatrix.m);
-			shader.uniformMatrix4fv("gi_mat_proj", 1, FALSE, mGIMatrixProj.m);
-			shader.uniformMatrix4fv("gi_inv_proj", 1, FALSE, mGIInvProj.m);
-			shader.uniformMatrix4fv("gi_norm_mat", 1, FALSE, mGINormalMatrix.m);
-		}
-	}
-	stop_glerror();
-
-	channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_DEPTH, mDeferredDepth.getUsage());
+	channel = shader.enableTexture(LLShaderMgr::DEFERRED_DEPTH, mDeferredDepth.getUsage());
 	if (channel > -1)
 	{
 		gGL.getTexUnit(channel)->bind(&mDeferredDepth, TRUE);
@@ -6772,21 +7035,21 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRen
 		glh::matrix4f projection = glh_get_current_projection();
 		glh::matrix4f inv_proj = projection.inverse();
 		
-		shader.uniformMatrix4fv("inv_proj", 1, FALSE, inv_proj.m);
-		shader.uniform4f("viewport", (F32) gGLViewport[0],
+		shader.uniformMatrix4fv(LLShaderMgr::INVERSE_PROJECTION_MATRIX, 1, FALSE, inv_proj.m);
+		shader.uniform4f(LLShaderMgr::VIEWPORT, (F32) gGLViewport[0],
 									(F32) gGLViewport[1],
 									(F32) gGLViewport[2],
 									(F32) gGLViewport[3]);
 	}
 
-	channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_NOISE);
+	channel = shader.enableTexture(LLShaderMgr::DEFERRED_NOISE);
 	if (channel > -1)
 	{
 		gGL.getTexUnit(channel)->bindManual(LLTexUnit::TT_TEXTURE, noise_map);
 		gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
 	}
 
-	channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_LIGHTFUNC);
+	channel = shader.enableTexture(LLShaderMgr::DEFERRED_LIGHTFUNC);
 	if (channel > -1)
 	{
 		gGL.getTexUnit(channel)->bindManual(LLTexUnit::TT_TEXTURE, mLightFunc);
@@ -6794,60 +7057,31 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRen
 
 	stop_glerror();
 
-	channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_LIGHT, mDeferredLight[light_index].getUsage());
+	channel = shader.enableTexture(LLShaderMgr::DEFERRED_LIGHT, mDeferredLight.getUsage());
 	if (channel > -1)
 	{
-		mDeferredLight[light_index].bindTexture(0, channel);
+		if (light_index > 0)
+		{
+			mScreen.bindTexture(0, channel);
+		}
+		else
+		{
+			mDeferredLight.bindTexture(0, channel);
+		}
 		gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
 	}
 
-	channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_LUMINANCE);
-	if (channel > -1)
-	{
-		gGL.getTexUnit(channel)->bindManual(LLTexUnit::TT_TEXTURE, mLuminanceMap.getTexture(), true);
-		gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_TRILINEAR);
-	}
-
-	channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_BLOOM);
+	channel = shader.enableTexture(LLShaderMgr::DEFERRED_BLOOM);
 	if (channel > -1)
 	{
 		mGlow[1].bindTexture(0, channel);
 	}
 
-	channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_LIGHT, LLTexUnit::TT_RECT_TEXTURE);
-	if (channel > -1)
-	{
-		gi_source->bindTexture(0, channel);
-		gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
-	}
-
-	channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_EDGE, LLTexUnit::TT_RECT_TEXTURE);
-	if (channel > -1)
-	{
-		mEdgeMap.bindTexture(0, channel);
-		gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
-	}
-
-	channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_SUN_LIGHT, LLTexUnit::TT_RECT_TEXTURE);
-	if (channel > -1)
-	{
-		mDeferredLight[1].bindTexture(0, channel);
-		gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
-	}
-
-	channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_LOCAL_LIGHT, LLTexUnit::TT_RECT_TEXTURE);
-	if (channel > -1)
-	{
-		mDeferredLight[2].bindTexture(0, channel);
-		gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
-	}
-
-
 	stop_glerror();
 
 	for (U32 i = 0; i < 4; i++)
 	{
-		channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_SHADOW0+i, LLTexUnit::TT_RECT_TEXTURE);
+		channel = shader.enableTexture(LLShaderMgr::DEFERRED_SHADOW0+i, LLTexUnit::TT_RECT_TEXTURE);
 		stop_glerror();
 		if (channel > -1)
 		{
@@ -6865,7 +7099,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRen
 
 	for (U32 i = 4; i < 6; i++)
 	{
-		channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_SHADOW0+i);
+		channel = shader.enableTexture(LLShaderMgr::DEFERRED_SHADOW0+i);
 		stop_glerror();
 		if (channel > -1)
 		{
@@ -6894,12 +7128,11 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRen
 		mat[i+80] = mSunShadowMatrix[5].m[i];
 	}
 
-	shader.uniformMatrix4fv("shadow_matrix[0]", 6, FALSE, mat);
-	shader.uniformMatrix4fv("shadow_matrix", 6, FALSE, mat);
+	shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_SHADOW_MATRIX, 6, FALSE, mat);
 
 	stop_glerror();
 
-	channel = shader.enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
+	channel = shader.enableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
 	if (channel > -1)
 	{
 		LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
@@ -6907,31 +7140,29 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRen
 		{
 			cube_map->enable(channel);
 			cube_map->bind();
-			F64* m = gGLModelView;
-
-			
+			F32* m = gGLModelView;
+						
 			F32 mat[] = { m[0], m[1], m[2],
 						  m[4], m[5], m[6],
 						  m[8], m[9], m[10] };
 		
-			shader.uniform3fv("env_mat[0]", 3, mat);
-			shader.uniform3fv("env_mat", 3, mat);
+			shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_ENV_MAT, 1, TRUE, mat);
 		}
 	}
 
-	shader.uniform4fv("shadow_clip", 1, mSunClipPlanes.mV);
-	shader.uniform1f("sun_wash", gSavedSettings.getF32("RenderDeferredSunWash"));
-	shader.uniform1f("shadow_noise", gSavedSettings.getF32("RenderShadowNoise"));
-	shader.uniform1f("blur_size", gSavedSettings.getF32("RenderShadowBlurSize"));
+	shader.uniform4fv(LLShaderMgr::DEFERRED_SHADOW_CLIP, 1, mSunClipPlanes.mV);
+	shader.uniform1f(LLShaderMgr::DEFERRED_SUN_WASH, RenderDeferredSunWash);
+	shader.uniform1f(LLShaderMgr::DEFERRED_SHADOW_NOISE, RenderShadowNoise);
+	shader.uniform1f(LLShaderMgr::DEFERRED_BLUR_SIZE, RenderShadowBlurSize);
 
-	shader.uniform1f("ssao_radius", gSavedSettings.getF32("RenderSSAOScale"));
-	shader.uniform1f("ssao_max_radius", gSavedSettings.getU32("RenderSSAOMaxScale"));
+	shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_RADIUS, RenderSSAOScale);
+	shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_MAX_RADIUS, RenderSSAOMaxScale);
 
-	F32 ssao_factor = gSavedSettings.getF32("RenderSSAOFactor");
-	shader.uniform1f("ssao_factor", ssao_factor);
-	shader.uniform1f("ssao_factor_inv", 1.0/ssao_factor);
+	F32 ssao_factor = RenderSSAOFactor;
+	shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR, ssao_factor);
+	shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR_INV, 1.0/ssao_factor);
 
-	LLVector3 ssao_effect = gSavedSettings.getVector3("RenderSSAOEffect");
+	LLVector3 ssao_effect = RenderSSAOEffect;
 	F32 matrix_diag = (ssao_effect[0] + 2.0*ssao_effect[1])/3.0;
 	F32 matrix_nondiag = (ssao_effect[0] - ssao_effect[1])/3.0;
 	// This matrix scales (proj of color onto <1/rt(3),1/rt(3),1/rt(3)>) by
@@ -6939,35 +7170,23 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRen
 	F32 ssao_effect_mat[] = {	matrix_diag, matrix_nondiag, matrix_nondiag,
 								matrix_nondiag, matrix_diag, matrix_nondiag,
 								matrix_nondiag, matrix_nondiag, matrix_diag};
-	shader.uniformMatrix3fv("ssao_effect_mat", 1, GL_FALSE, ssao_effect_mat);
-
-	F32 shadow_offset_error = 1.f + gSavedSettings.getF32("RenderShadowOffsetError") * fabsf(LLViewerCamera::getInstance()->getOrigin().mV[2]);
-	F32 shadow_bias_error = 1.f + gSavedSettings.getF32("RenderShadowBiasError") * fabsf(LLViewerCamera::getInstance()->getOrigin().mV[2]);
-
-	shader.uniform2f("screen_res", mDeferredScreen.getWidth(), mDeferredScreen.getHeight());
-	shader.uniform1f("near_clip", LLViewerCamera::getInstance()->getNear()*2.f);
-	shader.uniform1f ("shadow_offset", gSavedSettings.getF32("RenderShadowOffset")*shadow_offset_error);
-	shader.uniform1f("shadow_bias", gSavedSettings.getF32("RenderShadowBias")*shadow_bias_error);
-	shader.uniform1f ("spot_shadow_offset", gSavedSettings.getF32("RenderSpotShadowOffset"));
-	shader.uniform1f("spot_shadow_bias", gSavedSettings.getF32("RenderSpotShadowBias"));	
-
-	shader.uniform1f("lum_scale", gSavedSettings.getF32("RenderLuminanceScale"));
-	shader.uniform1f("sun_lum_scale", gSavedSettings.getF32("RenderSunLuminanceScale"));
-	shader.uniform1f("sun_lum_offset", gSavedSettings.getF32("RenderSunLuminanceOffset"));
-	shader.uniform1f("lum_lod", gSavedSettings.getF32("RenderLuminanceDetail"));
-	shader.uniform1f("gi_range", gSavedSettings.getF32("RenderGIRange"));
-	shader.uniform1f("gi_brightness", gSavedSettings.getF32("RenderGIBrightness"));
-	shader.uniform1f("gi_luminance", gSavedSettings.getF32("RenderGILuminance"));
-	shader.uniform1f("gi_edge_weight", gSavedSettings.getF32("RenderGIBlurEdgeWeight"));
-	shader.uniform1f("gi_blur_brightness", gSavedSettings.getF32("RenderGIBlurBrightness"));
-	shader.uniform1f("gi_sample_width", mGILightRadius);
-	shader.uniform1f("gi_noise", gSavedSettings.getF32("RenderGINoise"));
-	shader.uniform1f("gi_attenuation", gSavedSettings.getF32("RenderGIAttenuation"));
-	shader.uniform1f("gi_ambiance", gSavedSettings.getF32("RenderGIAmbiance"));
-	shader.uniform2f("shadow_res", mShadow[0].getWidth(), mShadow[0].getHeight());
-	shader.uniform2f("proj_shadow_res", mShadow[4].getWidth(), mShadow[4].getHeight());
-	shader.uniform1f("depth_cutoff", gSavedSettings.getF32("RenderEdgeDepthCutoff"));
-	shader.uniform1f("norm_cutoff", gSavedSettings.getF32("RenderEdgeNormCutoff"));
+	shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_SSAO_EFFECT_MAT, 1, GL_FALSE, ssao_effect_mat);
+
+	F32 shadow_offset_error = 1.f + RenderShadowOffsetError * fabsf(LLViewerCamera::getInstance()->getOrigin().mV[2]);
+	F32 shadow_bias_error = 1.f + RenderShadowBiasError * fabsf(LLViewerCamera::getInstance()->getOrigin().mV[2]);
+
+	shader.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, mDeferredScreen.getWidth(), mDeferredScreen.getHeight());
+	shader.uniform1f(LLShaderMgr::DEFERRED_NEAR_CLIP, LLViewerCamera::getInstance()->getNear()*2.f);
+	shader.uniform1f (LLShaderMgr::DEFERRED_SHADOW_OFFSET, RenderShadowOffset*shadow_offset_error);
+	shader.uniform1f(LLShaderMgr::DEFERRED_SHADOW_BIAS, RenderShadowBias*shadow_bias_error);
+	shader.uniform1f(LLShaderMgr::DEFERRED_SPOT_SHADOW_OFFSET, RenderSpotShadowOffset);
+	shader.uniform1f(LLShaderMgr::DEFERRED_SPOT_SHADOW_BIAS, RenderSpotShadowBias);	
+
+	shader.uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, mTransformedSunDir.mV);
+	shader.uniform2f(LLShaderMgr::DEFERRED_SHADOW_RES, mShadow[0].getWidth(), mShadow[0].getHeight());
+	shader.uniform2f(LLShaderMgr::DEFERRED_PROJ_SHADOW_RES, mShadow[4].getWidth(), mShadow[4].getHeight());
+	shader.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff);
+	shader.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff);
 	
 
 	if (shader.getUniformLocation("norm_mat") >= 0)
@@ -7006,7 +7225,7 @@ void LLPipeline::renderDeferredLighting()
 							0, 0, mDeferredDepth.getWidth(), mDeferredDepth.getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST);	
 		}
 
-		LLGLEnable multisample(gSavedSettings.getU32("RenderFSAASamples") > 0 ? GL_MULTISAMPLE_ARB : 0);
+		LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
 
 		if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD))
 		{
@@ -7028,38 +7247,40 @@ void LLPipeline::renderDeferredLighting()
 
 		glh::matrix4f mat = glh_copy_matrix(gGLModelView);
 
-		F32 vert[] = 
-		{
-			-1,1,
-			-1,-3,
-			3,1,
-		};
-		glVertexPointer(2, GL_FLOAT, 0, vert);
-		glColor3f(1,1,1);
+		LLStrider<LLVector3> vert; 
+		mDeferredVB->getVertexStrider(vert);
+		LLStrider<LLVector2> tc0;
+		LLStrider<LLVector2> tc1;
+		mDeferredVB->getTexCoord0Strider(tc0);
+		mDeferredVB->getTexCoord1Strider(tc1);
 
+		vert[0].set(-1,1,0);
+		vert[1].set(-1,-3,0);
+		vert[2].set(3,1,0);
+		
 		{
 			setupHWLights(NULL); //to set mSunDir;
 			LLVector4 dir(mSunDir, 0.f);
 			glh::vec4f tc(dir.mV);
 			mat.mult_matrix_vec(tc);
-			glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], 0);
+			mTransformedSunDir.set(tc.v);
 		}
 
-		glPushMatrix();
-		glLoadIdentity();
-		glMatrixMode(GL_PROJECTION);
-		glPushMatrix();
-		glLoadIdentity();
+		gGL.pushMatrix();
+		gGL.loadIdentity();
+		gGL.matrixMode(LLRender::MM_PROJECTION);
+		gGL.pushMatrix();
+		gGL.loadIdentity();
 
-		if (gSavedSettings.getBOOL("RenderDeferredSSAO") || gSavedSettings.getS32("RenderShadowDetail") > 0)
+		if (RenderDeferredSSAO || RenderShadowDetail > 0)
 		{
-			mDeferredLight[0].bindTarget();
+			mDeferredLight.bindTarget();
 			{ //paint shadow/SSAO light map (direct lighting lightmap)
 				LLFastTimer ftm(FTM_SUN_SHADOW);
 				bindDeferredShader(gDeferredSunProgram, 0);
-
+				mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
 				glClearColor(1,1,1,1);
-				mDeferredLight[0].clear(GL_COLOR_BUFFER_BIT);
+				mDeferredLight.clear(GL_COLOR_BUFFER_BIT);
 				glClearColor(0,0,0,0);
 
 				glh::matrix4f inv_trans = glh_get_current_modelview().inverse().transpose();
@@ -7082,141 +7303,36 @@ void LLPipeline::renderDeferredLighting()
 				}
 
 				gDeferredSunProgram.uniform3fv("offset", slice, offset);
-				gDeferredSunProgram.uniform2f("screenRes", mDeferredLight[0].getWidth(), mDeferredLight[0].getHeight());
+				gDeferredSunProgram.uniform2f("screenRes", mDeferredLight.getWidth(), mDeferredLight.getHeight());
 				
 				{
 					LLGLDisable blend(GL_BLEND);
 					LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS);
 					stop_glerror();
-					glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+					mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
 					stop_glerror();
 				}
 				
 				unbindDeferredShader(gDeferredSunProgram);
 			}
-			mDeferredLight[0].flush();
+			mDeferredLight.flush();
 		}
 		
-		{ //global illumination specific block (still experimental)
-			if (gSavedSettings.getBOOL("RenderDeferredBlurLight") &&
-			    gSavedSettings.getBOOL("RenderDeferredGI"))
-			{
-				LLFastTimer ftm(FTM_EDGE_DETECTION);
-				//generate edge map
-				LLGLDisable blend(GL_BLEND);
-				LLGLDisable test(GL_ALPHA_TEST);
-				LLGLDepthTest depth(GL_FALSE);
-				LLGLDisable stencil(GL_STENCIL_TEST);
-
-				{
-					gDeferredEdgeProgram.bind();
-					mEdgeMap.bindTarget();
-					bindDeferredShader(gDeferredEdgeProgram);
-					glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
-					unbindDeferredShader(gDeferredEdgeProgram);
-					mEdgeMap.flush();
-				}
-			}
-
-			if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_DEFERRED) > 2)
-			{
-				{ //get luminance map from previous frame's light map
-					LLGLEnable blend(GL_BLEND);
-					LLGLDisable test(GL_ALPHA_TEST);
-					LLGLDepthTest depth(GL_FALSE);
-					LLGLDisable stencil(GL_STENCIL_TEST);
-
-					//static F32 fade = 1.f;
-
-					{
-						gGL.setSceneBlendType(LLRender::BT_ALPHA);
-						gLuminanceGatherProgram.bind();
-						gLuminanceGatherProgram.uniform2f("screen_res", mDeferredLight[0].getWidth(), mDeferredLight[0].getHeight());
-						mLuminanceMap.bindTarget();
-						bindDeferredShader(gLuminanceGatherProgram);
-						glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
-						unbindDeferredShader(gLuminanceGatherProgram);
-						mLuminanceMap.flush();
-						gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mLuminanceMap.getTexture(), true);
-						gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_TRILINEAR);
-						glGenerateMipmap(GL_TEXTURE_2D);
-					}
-				}
-
-				{ //paint noisy GI map (bounce lighting lightmap)
-					LLFastTimer ftm(FTM_GI_TRACE);
-					LLGLDisable blend(GL_BLEND);
-					LLGLDepthTest depth(GL_FALSE);
-					LLGLDisable test(GL_ALPHA_TEST);
-
-					mGIMapPost[0].bindTarget();
-
-					bindDeferredShader(gDeferredGIProgram, 0, &mGIMap, 0, mTrueNoiseMap);
-					glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
-					unbindDeferredShader(gDeferredGIProgram);
-					mGIMapPost[0].flush();
-				}
-
-				U32 pass_count = 0;
-				if (gSavedSettings.getBOOL("RenderDeferredBlurLight"))
-				{
-					pass_count = llclamp(gSavedSettings.getU32("RenderGIBlurPasses"), (U32) 1, (U32) 128);
-				}
-
-				for (U32 i = 0; i < pass_count; ++i)
-				{ //gather/soften indirect lighting map
-					LLFastTimer ftm(FTM_GI_GATHER);
-					bindDeferredShader(gDeferredPostGIProgram, 0, &mGIMapPost[0], NULL, mTrueNoiseMap);
-					F32 blur_size = gSavedSettings.getF32("RenderGIBlurSize")/((F32) i * gSavedSettings.getF32("RenderGIBlurIncrement")+1.f);
-					gDeferredPostGIProgram.uniform2f("delta", 1.f, 0.f);
-					gDeferredPostGIProgram.uniform1f("kern_scale", blur_size);
-					gDeferredPostGIProgram.uniform1f("gi_blur_brightness", gSavedSettings.getF32("RenderGIBlurBrightness"));
-				
-					mGIMapPost[1].bindTarget();
-					{
-						LLGLDisable blend(GL_BLEND);
-						LLGLDepthTest depth(GL_FALSE);
-						stop_glerror();
-						glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
-						stop_glerror();
-					}
-					
-					mGIMapPost[1].flush();
-					unbindDeferredShader(gDeferredPostGIProgram);
-					bindDeferredShader(gDeferredPostGIProgram, 0, &mGIMapPost[1], NULL, mTrueNoiseMap);
-					mGIMapPost[0].bindTarget();
-
-					gDeferredPostGIProgram.uniform2f("delta", 0.f, 1.f);
-
-					{
-						LLGLDisable blend(GL_BLEND);
-						LLGLDepthTest depth(GL_FALSE);
-						stop_glerror();
-						glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-						stop_glerror();
-					}
-					mGIMapPost[0].flush();
-					unbindDeferredShader(gDeferredPostGIProgram);
-				}
-			}
-		}
-
-		if (gSavedSettings.getBOOL("RenderDeferredSSAO"))
+		if (RenderDeferredSSAO)
 		{ //soften direct lighting lightmap
 			LLFastTimer ftm(FTM_SOFTEN_SHADOW);
 			//blur lightmap
-			mDeferredLight[1].bindTarget();
-
+			mScreen.bindTarget();
 			glClearColor(1,1,1,1);
-			mDeferredLight[1].clear(GL_COLOR_BUFFER_BIT);
+			mScreen.clear(GL_COLOR_BUFFER_BIT);
 			glClearColor(0,0,0,0);
 			
 			bindDeferredShader(gDeferredBlurLightProgram);
-
-			LLVector3 go = gSavedSettings.getVector3("RenderShadowGaussian");
+			mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+			LLVector3 go = RenderShadowGaussian;
 			const U32 kern_length = 4;
-			F32 blur_size = gSavedSettings.getF32("RenderShadowBlurSize");
-			F32 dist_factor = gSavedSettings.getF32("RenderShadowBlurDistFactor");
+			F32 blur_size = RenderShadowBlurSize;
+			F32 dist_factor = RenderShadowBlurDistFactor;
 
 			// sample symmetrically with the middle sample falling exactly on 0.0
 			F32 x = 0.f;
@@ -7240,15 +7356,16 @@ void LLPipeline::renderDeferredLighting()
 				LLGLDisable blend(GL_BLEND);
 				LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS);
 				stop_glerror();
-				glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+				mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
 				stop_glerror();
 			}
 			
-			mDeferredLight[1].flush();
+			mScreen.flush();
 			unbindDeferredShader(gDeferredBlurLightProgram);
 
 			bindDeferredShader(gDeferredBlurLightProgram, 1);
-			mDeferredLight[0].bindTarget();
+			mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+			mDeferredLight.bindTarget();
 
 			gDeferredBlurLightProgram.uniform2f("delta", 0.f, 1.f);
 
@@ -7256,69 +7373,59 @@ void LLPipeline::renderDeferredLighting()
 				LLGLDisable blend(GL_BLEND);
 				LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS);
 				stop_glerror();
-				glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+				mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
 				stop_glerror();
 			}
-			mDeferredLight[0].flush();
+			mDeferredLight.flush();
 			unbindDeferredShader(gDeferredBlurLightProgram);
 		}
 
 		stop_glerror();
-		glPopMatrix();
+		gGL.popMatrix();
 		stop_glerror();
-		glMatrixMode(GL_MODELVIEW);
+		gGL.matrixMode(LLRender::MM_MODELVIEW);
 		stop_glerror();
-		glPopMatrix();
+		gGL.popMatrix();
 		stop_glerror();
 
 		//copy depth and stencil from deferred screen
 		//mScreen.copyContents(mDeferredScreen, 0, 0, mDeferredScreen.getWidth(), mDeferredScreen.getHeight(),
 		//					0, 0, mScreen.getWidth(), mScreen.getHeight(), GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_NEAREST);
 
-		if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_DEFERRED) > 2)
-		{
-			mDeferredLight[1].bindTarget();
-			// clear color buffer here (GI) - zeroing alpha (glow) is important or it will accumulate against sky
-			glClearColor(0,0,0,0);
-			mScreen.clear(GL_COLOR_BUFFER_BIT);
-		}
-		else
-		{
-			mScreen.bindTarget();
-			// clear color buffer here - zeroing alpha (glow) is important or it will accumulate against sky
-			glClearColor(0,0,0,0);
-			mScreen.clear(GL_COLOR_BUFFER_BIT);
-		}
-
-		if (gSavedSettings.getBOOL("RenderDeferredAtmospheric"))
+		mScreen.bindTarget();
+		// clear color buffer here - zeroing alpha (glow) is important or it will accumulate against sky
+		glClearColor(0,0,0,0);
+		mScreen.clear(GL_COLOR_BUFFER_BIT);
+		
+		if (RenderDeferredAtmospheric)
 		{ //apply sunlight contribution 
 			LLFastTimer ftm(FTM_ATMOSPHERICS);
-			bindDeferredShader(gDeferredSoftenProgram, 0, &mGIMapPost[0]);	
+			bindDeferredShader(gDeferredSoftenProgram);	
 			{
 				LLGLDepthTest depth(GL_FALSE);
 				LLGLDisable blend(GL_BLEND);
 				LLGLDisable test(GL_ALPHA_TEST);
 
 				//full screen blit
-				glPushMatrix();
-				glLoadIdentity();
-				glMatrixMode(GL_PROJECTION);
-				glPushMatrix();
-				glLoadIdentity();
+				gGL.pushMatrix();
+				gGL.loadIdentity();
+				gGL.matrixMode(LLRender::MM_PROJECTION);
+				gGL.pushMatrix();
+				gGL.loadIdentity();
 
-				glVertexPointer(2, GL_FLOAT, 0, vert);
-				
-				glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+				mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
 				
-				glPopMatrix();
-				glMatrixMode(GL_MODELVIEW);
-				glPopMatrix();
+				mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+
+				gGL.popMatrix();
+				gGL.matrixMode(LLRender::MM_MODELVIEW);
+				gGL.popMatrix();
 			}
 
 			unbindDeferredShader(gDeferredSoftenProgram);
 		}
 
-		{ //render sky
+		{ //render non-deferred geometry (fullbright, alpha, etc)
 			LLGLDisable blend(GL_BLEND);
 			LLGLDisable stencil(GL_STENCIL_TEST);
 			gGL.setSceneBlendType(LLRender::BT_ALPHA);
@@ -7335,15 +7442,8 @@ void LLPipeline::renderDeferredLighting()
 			gPipeline.popRenderTypeMask();
 		}
 
-		BOOL render_local = gSavedSettings.getBOOL("RenderLocalLights");
+		BOOL render_local = RenderLocalLights;
 				
-		if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_DEFERRED) > 2)
-		{
-			mDeferredLight[1].flush();
-			mDeferredLight[2].bindTarget();
-			mDeferredLight[2].clear(GL_COLOR_BUFFER_BIT);
-		}
-
 		if (render_local)
 		{
 			gGL.setSceneBlendType(LLRender::BT_ADD);
@@ -7359,12 +7459,12 @@ void LLPipeline::renderDeferredLighting()
 			std::list<LLVector4> light_colors;
 
 			LLVertexBuffer::unbind();
+			LLVector4a* v = (LLVector4a*) vert.get();
 
-			F32 v[24];
-			glVertexPointer(3, GL_FLOAT, 0, v);
-			
 			{
 				bindDeferredShader(gDeferredLightProgram);
+				mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+
 				LLGLDepthTest depth(GL_TRUE, GL_FALSE);
 				for (LLDrawable::drawable_set_t::iterator iter = mLights.begin(); iter != mLights.end(); ++iter)
 				{
@@ -7391,8 +7491,7 @@ void LLPipeline::renderDeferredLighting()
 					F32 s = volume->getLightRadius()*1.5f;
 
 					LLColor3 col = volume->getLightColor();
-					col *= volume->getLightIntensity();
-
+					
 					if (col.magVecSquared() < 0.001f)
 					{
 						continue;
@@ -7419,15 +7518,16 @@ void LLPipeline::renderDeferredLighting()
 					//correspond to their axis facing, with bit position 3,2,1 matching
 					//axis facing x,y,z, bit set meaning positive facing, bit clear 
 					//meaning negative facing
-					v[0] = c[0]-s; v[1]  = c[1]-s; v[2]  = c[2]-s;  // 0 - 0000 
-					v[3] = c[0]-s; v[4]  = c[1]-s; v[5]  = c[2]+s;  // 1 - 0001
-					v[6] = c[0]-s; v[7]  = c[1]+s; v[8]  = c[2]-s;  // 2 - 0010
-					v[9] = c[0]-s; v[10] = c[1]+s; v[11] = c[2]+s;  // 3 - 0011
+					mDeferredVB->getVertexStrider(vert);
+					v[0].set(c[0]-s,c[1]-s,c[2]-s);  // 0 - 0000 
+					v[1].set(c[0]-s,c[1]-s,c[2]+s);  // 1 - 0001
+					v[2].set(c[0]-s,c[1]+s,c[2]-s);  // 2 - 0010
+					v[3].set(c[0]-s,c[1]+s,c[2]+s);  // 3 - 0011
 																									   
-					v[12] = c[0]+s; v[13] = c[1]-s; v[14] = c[2]-s; // 4 - 0100
-					v[15] = c[0]+s; v[16] = c[1]-s; v[17] = c[2]+s; // 5 - 0101
-					v[18] = c[0]+s; v[19] = c[1]+s; v[20] = c[2]-s; // 6 - 0110
-					v[21] = c[0]+s; v[22] = c[1]+s; v[23] = c[2]+s; // 7 - 0111
+					v[4].set(c[0]+s,c[1]-s,c[2]-s); // 4 - 0100
+					v[5].set(c[0]+s,c[1]-s,c[2]+s); // 5 - 0101
+					v[6].set(c[0]+s,c[1]+s,c[2]-s); // 6 - 0110
+					v[7].set(c[0]+s,c[1]+s,c[2]+s); // 7 - 0111
 
 					if (camera->getOrigin().mV[0] > c[0] + s + 0.2f ||
 						camera->getOrigin().mV[0] < c[0] - s - 0.2f ||
@@ -7446,10 +7546,16 @@ void LLPipeline::renderDeferredLighting()
 							}
 							
 							LLFastTimer ftm(FTM_LOCAL_LIGHTS);
-							glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s);
-							glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f);
+							//glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s);
+							gDeferredLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, tc.v);
+							gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s*s);
+							gDeferredLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
+							gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()*0.5f);
+							//gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f);
+							gGL.syncMatrices();
+							mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
 							glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8,
-								GL_UNSIGNED_BYTE, get_box_fan_indices_ptr(camera, center));
+								GL_UNSIGNED_SHORT, get_box_fan_indices_ptr(camera, center));
 							stop_glerror();
 						}
 					}
@@ -7474,7 +7580,9 @@ void LLPipeline::renderDeferredLighting()
 				LLGLDepthTest depth(GL_TRUE, GL_FALSE);
 				bindDeferredShader(gDeferredSpotLightProgram);
 
-				gDeferredSpotLightProgram.enableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION);
+				mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+
+				gDeferredSpotLightProgram.enableTexture(LLShaderMgr::DEFERRED_PROJECTION);
 
 				for (LLDrawable::drawable_list_t::iterator iter = spot_lights.begin(); iter != spot_lights.end(); ++iter)
 				{
@@ -7496,42 +7604,54 @@ void LLPipeline::renderDeferredLighting()
 					setupSpotLight(gDeferredSpotLightProgram, drawablep);
 					
 					LLColor3 col = volume->getLightColor();
-					col *= volume->getLightIntensity();
-
+					
 					//vertex positions are encoded so the 3 bits of their vertex index 
 					//correspond to their axis facing, with bit position 3,2,1 matching
 					//axis facing x,y,z, bit set meaning positive facing, bit clear 
 					//meaning negative facing
-					v[0] = c[0]-s; v[1]  = c[1]-s; v[2]  = c[2]-s;  // 0 - 0000 
-					v[3] = c[0]-s; v[4]  = c[1]-s; v[5]  = c[2]+s;  // 1 - 0001
-					v[6] = c[0]-s; v[7]  = c[1]+s; v[8]  = c[2]-s;  // 2 - 0010
-					v[9] = c[0]-s; v[10] = c[1]+s; v[11] = c[2]+s;  // 3 - 0011
+					mDeferredVB->getVertexStrider(vert);
+					v[0].set(c[0]-s,c[1]-s,c[2]-s);  // 0 - 0000 
+					v[1].set(c[0]-s,c[1]-s,c[2]+s);  // 1 - 0001
+					v[2].set(c[0]-s,c[1]+s,c[2]-s);  // 2 - 0010
+					v[3].set(c[0]-s,c[1]+s,c[2]+s);  // 3 - 0011
 																									   
-					v[12] = c[0]+s; v[13] = c[1]-s; v[14] = c[2]-s; // 4 - 0100
-					v[15] = c[0]+s; v[16] = c[1]-s; v[17] = c[2]+s; // 5 - 0101
-					v[18] = c[0]+s; v[19] = c[1]+s; v[20] = c[2]-s; // 6 - 0110
-					v[21] = c[0]+s; v[22] = c[1]+s; v[23] = c[2]+s; // 7 - 0111
-
-					glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s);
-					glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f);
+					v[4].set(c[0]+s,c[1]-s,c[2]-s); // 4 - 0100
+					v[5].set(c[0]+s,c[1]-s,c[2]+s); // 5 - 0101
+					v[6].set(c[0]+s,c[1]+s,c[2]-s); // 6 - 0110
+					v[7].set(c[0]+s,c[1]+s,c[2]+s); // 7 - 0111
+					
+					gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, tc.v);
+					gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s*s);
+					gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
+					gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()*0.5f);
+					gGL.syncMatrices();
+					mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
 					glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8,
-							GL_UNSIGNED_BYTE, get_box_fan_indices_ptr(camera, center));
+							GL_UNSIGNED_SHORT, get_box_fan_indices_ptr(camera, center));
 				}
-				gDeferredSpotLightProgram.disableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION);
+				gDeferredSpotLightProgram.disableTexture(LLShaderMgr::DEFERRED_PROJECTION);
 				unbindDeferredShader(gDeferredSpotLightProgram);
 			}
 
+			//reset mDeferredVB to fullscreen triangle
+			mDeferredVB->getVertexStrider(vert);
+			vert[0].set(-1,1,0);
+			vert[1].set(-1,-3,0);
+			vert[2].set(3,1,0);
+
 			{
 				bindDeferredShader(gDeferredMultiLightProgram);
 			
+				mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+
 				LLGLDepthTest depth(GL_FALSE);
 
 				//full screen blit
-				glPushMatrix();
-				glLoadIdentity();
-				glMatrixMode(GL_PROJECTION);
-				glPushMatrix();
-				glLoadIdentity();
+				gGL.pushMatrix();
+				gGL.loadIdentity();
+				gGL.matrixMode(LLRender::MM_PROJECTION);
+				gGL.pushMatrix();
+				gGL.loadIdentity();
 
 				U32 count = 0;
 
@@ -7539,7 +7659,7 @@ void LLPipeline::renderDeferredLighting()
 				LLVector4 light[max_count];
 				LLVector4 col[max_count];
 
-				glVertexPointer(2, GL_FLOAT, 0, vert);
+//				glVertexPointer(2, GL_FLOAT, 0, vert);
 
 				F32 far_z = 0.f;
 
@@ -7556,13 +7676,13 @@ void LLPipeline::renderDeferredLighting()
 					count++;
 					if (count == max_count || fullscreen_lights.empty())
 					{
-						gDeferredMultiLightProgram.uniform1i("light_count", count);
-						gDeferredMultiLightProgram.uniform4fv("light", count, (GLfloat*) light);
-						gDeferredMultiLightProgram.uniform4fv("light_col", count, (GLfloat*) col);
-						gDeferredMultiLightProgram.uniform1f("far_z", far_z);
+						gDeferredMultiLightProgram.uniform1i(LLShaderMgr::MULTI_LIGHT_COUNT, count);
+						gDeferredMultiLightProgram.uniform4fv(LLShaderMgr::MULTI_LIGHT, count, (GLfloat*) light);
+						gDeferredMultiLightProgram.uniform4fv(LLShaderMgr::MULTI_LIGHT_COL, count, (GLfloat*) col);
+						gDeferredMultiLightProgram.uniform1f(LLShaderMgr::MULTI_LIGHT_FAR_Z, far_z);
 						far_z = 0.f;
-						count = 0;
-						glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+						count = 0; 
+						mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
 					}
 				}
 				
@@ -7570,7 +7690,9 @@ void LLPipeline::renderDeferredLighting()
 
 				bindDeferredShader(gDeferredMultiSpotLightProgram);
 
-				gDeferredMultiSpotLightProgram.enableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION);
+				gDeferredMultiSpotLightProgram.enableTexture(LLShaderMgr::DEFERRED_PROJECTION);
+
+				mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
 
 				for (LLDrawable::drawable_list_t::iterator iter = fullscreen_spot_lights.begin(); iter != fullscreen_spot_lights.end(); ++iter)
 				{
@@ -7591,64 +7713,24 @@ void LLPipeline::renderDeferredLighting()
 					setupSpotLight(gDeferredMultiSpotLightProgram, drawablep);
 
 					LLColor3 col = volume->getLightColor();
-					col *= volume->getLightIntensity();
-
-					glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s);
-					glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f);
-					glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+					
+					gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, tc.v);
+					gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s*s);
+					gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
+					gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()*0.5f);
+					mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
 				}
 
-				gDeferredMultiSpotLightProgram.disableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION);
+				gDeferredMultiSpotLightProgram.disableTexture(LLShaderMgr::DEFERRED_PROJECTION);
 				unbindDeferredShader(gDeferredMultiSpotLightProgram);
 
-				glPopMatrix();
-				glMatrixMode(GL_MODELVIEW);
-				glPopMatrix();
+				gGL.popMatrix();
+				gGL.matrixMode(LLRender::MM_MODELVIEW);
+				gGL.popMatrix();
 			}
 		}
 
 		gGL.setColorMask(true, true);
-
-		if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_DEFERRED) > 2)
-		{
-			mDeferredLight[2].flush();
-
-			mScreen.bindTarget();
-			mScreen.clear(GL_COLOR_BUFFER_BIT);
-		
-			gGL.setSceneBlendType(LLRender::BT_ALPHA);
-
-			{ //mix various light maps (local, sun, gi)
-				LLFastTimer ftm(FTM_POST);
-				LLGLDisable blend(GL_BLEND);
-				LLGLDisable test(GL_ALPHA_TEST);
-				LLGLDepthTest depth(GL_FALSE);
-				LLGLDisable stencil(GL_STENCIL_TEST);
-			
-				bindDeferredShader(gDeferredPostProgram, 0, &mGIMapPost[0]);
-
-				gDeferredPostProgram.bind();
-
-				LLVertexBuffer::unbind();
-
-				glVertexPointer(2, GL_FLOAT, 0, vert);
-				glColor3f(1,1,1);
-
-				glPushMatrix();
-				glLoadIdentity();
-				glMatrixMode(GL_PROJECTION);
-				glPushMatrix();
-				glLoadIdentity();
-
-				glDrawArrays(GL_TRIANGLES, 0, 3);
-
-				glPopMatrix();
-				glMatrixMode(GL_MODELVIEW);
-				glPopMatrix();
-
-				unbindDeferredShader(gDeferredPostProgram);
-			}
-		}
 	}
 
 	{ //render non-deferred geometry (alpha, fullbright, glow)
@@ -7764,13 +7846,13 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep)
 	F32 proj_range = far_clip - near_clip;
 	glh::matrix4f light_proj = gl_perspective(fovy, aspect, near_clip, far_clip);
 	screen_to_light = trans * light_proj * screen_to_light;
-	shader.uniformMatrix4fv("proj_mat", 1, FALSE, screen_to_light.m);
-	shader.uniform1f("proj_near", near_clip);
-	shader.uniform3fv("proj_p", 1, p1.v);
-	shader.uniform3fv("proj_n", 1, n.v);
-	shader.uniform3fv("proj_origin", 1, screen_origin.v);
-	shader.uniform1f("proj_range", proj_range);
-	shader.uniform1f("proj_ambiance", params.mV[2]);
+	shader.uniformMatrix4fv(LLShaderMgr::PROJECTOR_MATRIX, 1, FALSE, screen_to_light.m);
+	shader.uniform1f(LLShaderMgr::PROJECTOR_NEAR, near_clip);
+	shader.uniform3fv(LLShaderMgr::PROJECTOR_P, 1, p1.v);
+	shader.uniform3fv(LLShaderMgr::PROJECTOR_N, 1, n.v);
+	shader.uniform3fv(LLShaderMgr::PROJECTOR_ORIGIN, 1, screen_origin.v);
+	shader.uniform1f(LLShaderMgr::PROJECTOR_RANGE, proj_range);
+	shader.uniform1f(LLShaderMgr::PROJECTOR_AMBIANCE, params.mV[2]);
 	S32 s_idx = -1;
 
 	for (U32 i = 0; i < 2; i++)
@@ -7781,15 +7863,15 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep)
 		}
 	}
 
-	shader.uniform1i("proj_shadow_idx", s_idx);
+	shader.uniform1i(LLShaderMgr::PROJECTOR_SHADOW_INDEX, s_idx);
 
 	if (s_idx >= 0)
 	{
-		shader.uniform1f("shadow_fade", 1.f-mSpotLightFade[s_idx]);
+		shader.uniform1f(LLShaderMgr::PROJECTOR_SHADOW_FADE, 1.f-mSpotLightFade[s_idx]);
 	}
 	else
 	{
-		shader.uniform1f("shadow_fade", 1.f);
+		shader.uniform1f(LLShaderMgr::PROJECTOR_SHADOW_FADE, 1.f);
 	}
 
 	{
@@ -7823,7 +7905,7 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep)
 		img = LLViewerFetchedTexture::sWhiteImagep;
 	}
 
-	S32 channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION);
+	S32 channel = shader.enableTexture(LLShaderMgr::DEFERRED_PROJECTION);
 
 	if (channel > -1)
 	{
@@ -7833,9 +7915,9 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep)
 
 			F32 lod_range = logf(img->getWidth())/logf(2.f);
 
-			shader.uniform1f("proj_focus", focus);
-			shader.uniform1f("proj_lod", lod_range);
-			shader.uniform1f("proj_ambient_lod", llclamp((proj_range-focus)/proj_range*lod_range, 0.f, 1.f));
+			shader.uniform1f(LLShaderMgr::PROJECTOR_FOCUS, focus);
+			shader.uniform1f(LLShaderMgr::PROJECTOR_LOD, lod_range);
+			shader.uniform1f(LLShaderMgr::PROJECTOR_AMBIENT_LOD, llclamp((proj_range-focus)/proj_range*lod_range, 0.f, 1.f));
 		}
 	}
 		
@@ -7844,33 +7926,17 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep)
 void LLPipeline::unbindDeferredShader(LLGLSLShader &shader)
 {
 	stop_glerror();
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_NORMAL, mDeferredScreen.getUsage());
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, mDeferredScreen.getUsage());
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_SPECULAR, mDeferredScreen.getUsage());
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_DEPTH, mDeferredScreen.getUsage());
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_LIGHT, mDeferredLight[0].getUsage());
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_LIGHT, LLTexUnit::TT_RECT_TEXTURE);
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_EDGE, mEdgeMap.getUsage());
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_SUN_LIGHT, mDeferredLight[1].getUsage());
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_LOCAL_LIGHT, mDeferredLight[2].getUsage());
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_LUMINANCE);
-	shader.disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_MIP);
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_BLOOM);
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_NORMAL);
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_DIFFUSE);
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_SPECULAR);
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_DEPTH);
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_MIN_POS);
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_MAX_POS);
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_LAST_NORMAL);
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_LAST_DIFFUSE);
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_LAST_MIN_POS);
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_LAST_MAX_POS);
+	shader.disableTexture(LLShaderMgr::DEFERRED_NORMAL, mDeferredScreen.getUsage());
+	shader.disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mDeferredScreen.getUsage());
+	shader.disableTexture(LLShaderMgr::DEFERRED_SPECULAR, mDeferredScreen.getUsage());
+	shader.disableTexture(LLShaderMgr::DEFERRED_DEPTH, mDeferredScreen.getUsage());
+	shader.disableTexture(LLShaderMgr::DEFERRED_LIGHT, mDeferredLight.getUsage());
+	shader.disableTexture(LLShaderMgr::DIFFUSE_MAP);
+	shader.disableTexture(LLShaderMgr::DEFERRED_BLOOM);
 
 	for (U32 i = 0; i < 4; i++)
 	{
-		if (shader.disableTexture(LLViewerShaderMgr::DEFERRED_SHADOW0+i, LLTexUnit::TT_RECT_TEXTURE) > -1)
+		if (shader.disableTexture(LLShaderMgr::DEFERRED_SHADOW0+i, LLTexUnit::TT_RECT_TEXTURE) > -1)
 		{
 			glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE);
 		}
@@ -7878,16 +7944,16 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader)
 
 	for (U32 i = 4; i < 6; i++)
 	{
-		if (shader.disableTexture(LLViewerShaderMgr::DEFERRED_SHADOW0+i) > -1)
+		if (shader.disableTexture(LLShaderMgr::DEFERRED_SHADOW0+i) > -1)
 		{
 			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE);
 		}
 	}
 
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_NOISE);
-	shader.disableTexture(LLViewerShaderMgr::DEFERRED_LIGHTFUNC);
+	shader.disableTexture(LLShaderMgr::DEFERRED_NOISE);
+	shader.disableTexture(LLShaderMgr::DEFERRED_LIGHTFUNC);
 
-	S32 channel = shader.disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
+	S32 channel = shader.disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
 	if (channel > -1)
 	{
 		LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
@@ -7913,11 +7979,11 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 	if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate)
 	{
 		BOOL skip_avatar_update = FALSE;
-		if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK)
+		if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson)
 		{
 			skip_avatar_update = TRUE;
 		}
-
+		
 		if (!skip_avatar_update)
 		{
 			gAgentAvatarp->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON);
@@ -7982,7 +8048,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 
 			stop_glerror();
 
-			glPushMatrix();
+			gGL.pushMatrix();
 
 			mat.set_scale(glh::vec3f(1,1,-1));
 			mat.set_translate(glh::vec3f(0,0,height*2.f));
@@ -7992,7 +8058,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 			mat = current * mat;
 
 			glh_set_current_modelview(mat);
-			glLoadMatrixf(mat.m);
+			gGL.loadMatrix(mat.m);
 
 			LLViewerCamera::updateFrustumPlanes(camera, FALSE, TRUE);
 
@@ -8035,7 +8101,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 					LLPipeline::RENDER_TYPE_CLOUDS,
 					LLPipeline::END_RENDER_TYPES);	
 
-				S32 detail = gSavedSettings.getS32("RenderReflectionDetail");
+				S32 detail = RenderReflectionDetail;
 				if (detail > 0)
 				{ //mask out selected geometry based on reflection detail
 					if (detail < 4)
@@ -8059,7 +8125,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 
 				if (LLDrawPoolWater::sNeedsDistortionUpdate)
 				{
-					if (gSavedSettings.getS32("RenderReflectionDetail") > 0)
+					if (RenderReflectionDetail > 0)
 					{
 						gPipeline.grabReferences(ref_result);
 						LLGLUserClipPlane clip_plane(plane, mat, projection);
@@ -8070,7 +8136,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 				gPipeline.popRenderTypeMask();
 			}	
 			glCullFace(GL_BACK);
-			glPopMatrix();
+			gGL.popMatrix();
 			mWaterRef.flush();
 			glh_set_current_modelview(current);
 			LLPipeline::sUseOcclusion = occlusion;
@@ -8239,7 +8305,14 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
 	}
 	LLPipeline::sShadowRender = TRUE;
 	
-	U32 types[] = { LLRenderPass::PASS_SIMPLE, LLRenderPass::PASS_FULLBRIGHT, LLRenderPass::PASS_SHINY, LLRenderPass::PASS_BUMP, LLRenderPass::PASS_FULLBRIGHT_SHINY };
+	U32 types[] = { 
+		LLRenderPass::PASS_SIMPLE, 
+		LLRenderPass::PASS_FULLBRIGHT, 
+		LLRenderPass::PASS_SHINY, 
+		LLRenderPass::PASS_BUMP, 
+		LLRenderPass::PASS_FULLBRIGHT_SHINY 
+	};
+
 	LLGLEnable cull(GL_CULL_FACE);
 
 	if (use_shader)
@@ -8251,12 +8324,12 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
 	stateSort(shadow_cam, result);
 	
 	//generate shadow map
-	glMatrixMode(GL_PROJECTION);
-	glPushMatrix();
-	glLoadMatrixf(proj.m);
-	glMatrixMode(GL_MODELVIEW);
-	glPushMatrix();
-	glLoadMatrixd(gGLModelView);
+	gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.pushMatrix();
+	gGL.loadMatrix(proj.m);
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
+	gGL.pushMatrix();
+	gGL.loadMatrix(gGLModelView);
 
 	stop_glerror();
 	gGLLastMatrix = NULL;
@@ -8267,12 +8340,8 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
 	}
 
 	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-			
-	glColor4f(1,1,1,1);
 	
 	stop_glerror();
-
-	gGL.setColorMask(false, false);
 	
 	//glCullFace(GL_FRONT);
 
@@ -8283,6 +8352,10 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
 		{ //occlusion program is general purpose depth-only no-textures
 			gOcclusionProgram.bind();
 		}
+
+		gGL.diffuseColor4f(1,1,1,1);
+		gGL.setColorMask(false, false);
+	
 		LLFastTimer ftm(FTM_SHADOW_SIMPLE);
 		gGL.getTexUnit(0)->disable();
 		for (U32 i = 0; i < sizeof(types)/sizeof(U32); ++i)
@@ -8310,16 +8383,26 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
 	{
 		LLFastTimer ftm(FTM_SHADOW_ALPHA);
 		gDeferredShadowAlphaMaskProgram.bind();
-		gDeferredShadowAlphaMaskProgram.setAlphaRange(0.6f, 1.f);
-		renderObjects(LLRenderPass::PASS_ALPHA_SHADOW, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR, TRUE);
-		glColor4f(1,1,1,1);
+		gDeferredShadowAlphaMaskProgram.setMinimumAlpha(0.598f);
+		
+		U32 mask =	LLVertexBuffer::MAP_VERTEX | 
+					LLVertexBuffer::MAP_TEXCOORD0 | 
+					LLVertexBuffer::MAP_COLOR | 
+					LLVertexBuffer::MAP_TEXTURE_INDEX;
+
+		renderObjects(LLRenderPass::PASS_ALPHA_MASK, mask, TRUE, TRUE);
+		renderObjects(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, mask, TRUE, TRUE);
+		renderObjects(LLRenderPass::PASS_ALPHA, mask, TRUE, TRUE);
+		gDeferredTreeShadowProgram.bind();
+		gDeferredTreeShadowProgram.setMinimumAlpha(0.598f);
 		renderObjects(LLRenderPass::PASS_GRASS, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, TRUE);
 	}
 
 	//glCullFace(GL_BACK);
 
+	gDeferredShadowProgram.bind();
 	gGLLastMatrix = NULL;
-	glLoadMatrixd(gGLModelView);
+	gGL.loadMatrix(gGLModelView);
 	doOcclusion(shadow_cam);
 
 	if (use_shader)
@@ -8329,10 +8412,10 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
 	
 	gGL.setColorMask(true, true);
 			
-	glMatrixMode(GL_PROJECTION);
-	glPopMatrix();
-	glMatrixMode(GL_MODELVIEW);
-	glPopMatrix();
+	gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.popMatrix();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
+	gGL.popMatrix();
 	gGLLastMatrix = NULL;
 
 	LLPipeline::sUseOcclusion = occlude;
@@ -8458,238 +8541,60 @@ BOOL LLPipeline::getVisiblePointCloud(LLCamera& camera, LLVector3& min, LLVector
 			LLVector3 line = v1-v2;
 
 			F32 d1 = line*n;
-			F32 d2 = -cp.dist(v2);
-
-			F32 t = d2/d1;
-
-			if (t > 0.f && t < 1.f)
-			{
-				LLVector3 intersect = v2+line*t;
-				pp.push_back(intersect);
-			}	
-		}
-	}
-
-	LLVector3 ext[] = { min-LLVector3(0.05f,0.05f,0.05f),
-		max+LLVector3(0.05f,0.05f,0.05f) };
-
-	for (U32 i = 0; i < pp.size(); ++i)
-	{
-		bool found = true;
-
-		const F32* p = pp[i].mV;
-			
-		for (U32 j = 0; j < 3; ++j)
-		{
-			if (p[j] < ext[0].mV[j] ||
-				p[j] > ext[1].mV[j])
-			{
-				found = false;
-				break;
-			}
-		}
-				
-		for (U32 j = 0; j < 6; ++j)
-		{
-			const LLPlane& cp = camera.getAgentPlane(j);
-			F32 dist = cp.dist(pp[i]);
-			if (dist > 0.05f) //point is above some plane, not contained
-					{
-				found = false;
-				break;
-						}
-					}
-
-					if (found)
-					{
-			fp.push_back(pp[i]);
-		}
-	}
-	
-	if (fp.empty())
-	{
-		return FALSE;
-	}
-	
-	return TRUE;
-}
-
-void LLPipeline::generateGI(LLCamera& camera, LLVector3& lightDir, std::vector<LLVector3>& vpc)
-{
-	if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_DEFERRED) < 3)
-	{
-		return;
-	}
-
-	LLVector3 up;
-
-	//LLGLEnable depth_clamp(GL_DEPTH_CLAMP_NV);
-
-	if (lightDir.mV[2] > 0.5f)
-	{
-		up = LLVector3(1,0,0);
-	}
-	else
-	{
-		up = LLVector3(0, 0, 1);
-	}
-
-	
-	F32 gi_range = gSavedSettings.getF32("RenderGIRange");
-
-	U32 res = mGIMap.getWidth();
-
-	F32 atten = llmax(gSavedSettings.getF32("RenderGIAttenuation"), 0.001f);
-
-	//set radius to range at which distance attenuation of incoming photons is near 0
-
-	F32 lrad = sqrtf(1.f/(atten*0.01f));
-
-	F32 lrange = lrad+gi_range*0.5f;
-
-	LLVector3 pad(lrange,lrange,lrange);
-
-	glh::matrix4f view = look(LLVector3(128.f,128.f,128.f), lightDir, up);
-
-	LLVector3 cp = camera.getOrigin()+camera.getAtAxis()*(gi_range*0.5f);
-
-	glh::vec3f scp(cp.mV);
-	view.mult_matrix_vec(scp);
-	cp.setVec(scp.v);
-
-	F32 pix_width = lrange/(res*0.5f);
-
-	//move cp to the nearest pix_width
-	for (U32 i = 0; i < 3; i++)
-	{
-		cp.mV[i] = llround(cp.mV[i], pix_width);
-	}
-	
-	LLVector3 min = cp-pad;
-	LLVector3 max = cp+pad;
-	
-	//set mGIRange to range in tc space[0,1] that covers texture block of intersecting lights around a point
-	mGIRange.mV[0] = (max.mV[0]-min.mV[0])/res;
-	mGIRange.mV[1] = (max.mV[1]-min.mV[1])/res;
-	mGILightRadius = lrad/lrange*0.5f;
-
-	glh::matrix4f proj = gl_ortho(min.mV[0], max.mV[0],
-								min.mV[1], max.mV[1],
-								-max.mV[2], -min.mV[2]);
-
-	LLCamera sun_cam = camera;
-
-	glh::matrix4f eye_view = glh_get_current_modelview();
-	
-	//get eye space to camera space matrix
-	mGIMatrix = view*eye_view.inverse();
-	mGINormalMatrix = mGIMatrix.inverse().transpose();
-	mGIInvProj = proj.inverse();
-	mGIMatrixProj = proj*mGIMatrix;
-
-	//translate and scale to [0,1]
-	glh::matrix4f trans(.5f, 0.f, 0.f, .5f,
-						0.f, 0.5f, 0.f, 0.5f,
-						0.f, 0.f, 0.5f, 0.5f,
-						0.f, 0.f, 0.f, 1.f);
-
-	mGIMatrixProj = trans*mGIMatrixProj;
-
-	glh_set_current_modelview(view);
-	glh_set_current_projection(proj);
-
-	LLViewerCamera::updateFrustumPlanes(sun_cam, TRUE, FALSE, TRUE);
-
-	sun_cam.ignoreAgentFrustumPlane(LLCamera::AGENT_PLANE_NEAR);
-	static LLCullResult result;
-
-	pushRenderTypeMask();
-
-	andRenderTypeMask(LLPipeline::RENDER_TYPE_SIMPLE,
-								 LLPipeline::RENDER_TYPE_FULLBRIGHT,
-								 LLPipeline::RENDER_TYPE_BUMP,
-								 LLPipeline::RENDER_TYPE_VOLUME,
-								 LLPipeline::RENDER_TYPE_TREE, 
-								 LLPipeline::RENDER_TYPE_TERRAIN,
-								 LLPipeline::RENDER_TYPE_WATER,
-								 LLPipeline::RENDER_TYPE_VOIDWATER,
-								 LLPipeline::RENDER_TYPE_PASS_ALPHA_SHADOW,
-								 LLPipeline::RENDER_TYPE_AVATAR,
-								 LLPipeline::RENDER_TYPE_PASS_SIMPLE,
-								 LLPipeline::RENDER_TYPE_PASS_BUMP,
-								 LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT,
-								 LLPipeline::RENDER_TYPE_PASS_SHINY,
-								 END_RENDER_TYPES);
-
-
-	
-	S32 occlude = LLPipeline::sUseOcclusion;
-	//LLPipeline::sUseOcclusion = 0;
-	LLPipeline::sShadowRender = TRUE;
-	
-	//only render large objects into GI map
-	sMinRenderSize = gSavedSettings.getF32("RenderGIMinRenderSize");
-	
-	LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_GI_SOURCE;
-	mGIMap.bindTarget();
-	
-	F64 last_modelview[16];
-	F64 last_projection[16];
-	for (U32 i = 0; i < 16; i++)
-	{
-		last_modelview[i] = gGLLastModelView[i];
-		last_projection[i] = gGLLastProjection[i];
-		gGLLastModelView[i] = mGIModelview.m[i];
-		gGLLastProjection[i] = mGIProjection.m[i];
-	}
-
-	sun_cam.setOrigin(0.f, 0.f, 0.f);
-	updateCull(sun_cam, result);
-	stateSort(sun_cam, result);
-	
-	for (U32 i = 0; i < 16; i++)
-	{
-		gGLLastModelView[i] = last_modelview[i];
-		gGLLastProjection[i] = last_projection[i];
-	}
+			F32 d2 = -cp.dist(v2);
 
-	mGIProjection = proj;
-	mGIModelview = view;
+			F32 t = d2/d1;
 
-	LLGLEnable cull(GL_CULL_FACE);
+			if (t > 0.f && t < 1.f)
+			{
+				LLVector3 intersect = v2+line*t;
+				pp.push_back(intersect);
+			}	
+		}
+	}
 
-	//generate GI map
-	glMatrixMode(GL_PROJECTION);
-	glPushMatrix();
-	glLoadMatrixf(proj.m);
-	glMatrixMode(GL_MODELVIEW);
-	glPushMatrix();
-	glLoadMatrixf(view.m);
+	LLVector3 ext[] = { min-LLVector3(0.05f,0.05f,0.05f),
+		max+LLVector3(0.05f,0.05f,0.05f) };
 
-	stop_glerror();
-	gGLLastMatrix = NULL;
+	for (U32 i = 0; i < pp.size(); ++i)
+	{
+		bool found = true;
 
-	mGIMap.clear();
+		const F32* p = pp[i].mV;
+			
+		for (U32 j = 0; j < 3; ++j)
+		{
+			if (p[j] < ext[0].mV[j] ||
+				p[j] > ext[1].mV[j])
+			{
+				found = false;
+				break;
+			}
+		}
+				
+		for (U32 j = 0; j < 6; ++j)
+		{
+			const LLPlane& cp = camera.getAgentPlane(j);
+			F32 dist = cp.dist(pp[i]);
+			if (dist > 0.05f) //point is above some plane, not contained
+					{
+				found = false;
+				break;
+						}
+					}
 
+					if (found)
+					{
+			fp.push_back(pp[i]);
+		}
+	}
+	
+	if (fp.empty())
 	{
-		//LLGLEnable enable(GL_DEPTH_CLAMP_NV);
-		renderGeomDeferred(camera);
+		return FALSE;
 	}
-
-	mGIMap.flush();
 	
-	glMatrixMode(GL_PROJECTION);
-	glPopMatrix();
-	glMatrixMode(GL_MODELVIEW);
-	glPopMatrix();
-	gGLLastMatrix = NULL;
-
-	LLPipeline::sUseOcclusion = occlude;
-	LLPipeline::sShadowRender = FALSE;
-	sMinRenderSize = 0.f;
-
-	popRenderTypeMask();
-
+	return TRUE;
 }
 
 void LLPipeline::renderHighlight(const LLViewerObject* obj, F32 fade)
@@ -8726,7 +8631,7 @@ void LLPipeline::generateHighlight(LLCamera& camera)
 	
 	if (!mHighlightSet.empty())
 	{
-		F32 transition = gFrameIntervalSeconds/gSavedSettings.getF32("RenderHighlightFadeTime");
+		F32 transition = gFrameIntervalSeconds/RenderHighlightFadeTime;
 
 		LLGLDisable test(GL_ALPHA_TEST);
 		LLGLDepthTest depth(GL_FALSE);
@@ -8772,11 +8677,23 @@ void LLPipeline::generateHighlight(LLCamera& camera)
 
 void LLPipeline::generateSunShadow(LLCamera& camera)
 {
-	if (!sRenderDeferred || gSavedSettings.getS32("RenderShadowDetail") <= 0)
+	if (!sRenderDeferred || RenderShadowDetail <= 0)
 	{
 		return;
 	}
 
+	BOOL skip_avatar_update = FALSE;
+	if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson)
+	{
+
+		skip_avatar_update = TRUE;
+	}
+
+	if (!skip_avatar_update)
+	{
+		gAgentAvatarp->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON);
+	}
+
 	F64 last_modelview[16];
 	F64 last_projection[16];
 	for (U32 i = 0; i < 16; i++)
@@ -8797,7 +8714,9 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
 					LLPipeline::RENDER_TYPE_TERRAIN,
 					LLPipeline::RENDER_TYPE_WATER,
 					LLPipeline::RENDER_TYPE_VOIDWATER,
-					LLPipeline::RENDER_TYPE_PASS_ALPHA_SHADOW,
+					LLPipeline::RENDER_TYPE_PASS_ALPHA,
+					LLPipeline::RENDER_TYPE_PASS_ALPHA_MASK,
+					LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK,
 					LLPipeline::RENDER_TYPE_PASS_GRASS,
 					LLPipeline::RENDER_TYPE_PASS_SIMPLE,
 					LLPipeline::RENDER_TYPE_PASS_BUMP,
@@ -8819,25 +8738,25 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
 	glh::matrix4f proj[6];
 	
 	//clip contains parallel split distances for 3 splits
-	LLVector3 clip = gSavedSettings.getVector3("RenderShadowClipPlanes");
+	LLVector3 clip = RenderShadowClipPlanes;
 
 	//F32 slope_threshold = gSavedSettings.getF32("RenderShadowSlopeThreshold");
 
 	//far clip on last split is minimum of camera view distance and 128
 	mSunClipPlanes = LLVector4(clip, clip.mV[2] * clip.mV[2]/clip.mV[1]);
 
-	clip = gSavedSettings.getVector3("RenderShadowOrthoClipPlanes");
+	clip = RenderShadowOrthoClipPlanes;
 	mSunOrthoClipPlanes = LLVector4(clip, clip.mV[2]*clip.mV[2]/clip.mV[1]);
 
 	//currently used for amount to extrude frusta corners for constructing shadow frusta
-	LLVector3 n = gSavedSettings.getVector3("RenderShadowNearDist");
+	LLVector3 n = RenderShadowNearDist;
 	//F32 nearDist[] = { n.mV[0], n.mV[1], n.mV[2], n.mV[2] };
 
 	//put together a universal "near clip" plane for shadow frusta
 	LLPlane shadow_near_clip;
 	{
 		LLVector3 p = gAgent.getPositionAgent();
-		p += mSunDir * gSavedSettings.getF32("RenderFarClip")*2.f;
+		p += mSunDir * RenderFarClip*2.f;
 		shadow_near_clip.setVec(p, mSunDir);
 	}
 
@@ -8890,11 +8809,15 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
 				mShadowFrustPoints[3].clear();
 			}
 			popRenderTypeMask();
+
+			if (!skip_avatar_update)
+			{
+				gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode());
+			}
+
 			return;
 		}
 
-		generateGI(camera, lightDir, fp);
-
 		//get good split distances for frustum
 		for (U32 i = 0; i < fp.size(); ++i)
 		{
@@ -8920,405 +8843,420 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
 
 		F32 range = far_clip-near_clip;
 
-		LLVector3 split_exp = gSavedSettings.getVector3("RenderShadowSplitExponent");
+		LLVector3 split_exp = RenderShadowSplitExponent;
 
 		F32 da = 1.f-llmax( fabsf(lightDir*up), fabsf(lightDir*camera.getLeftAxis()) );
 		
 		da = powf(da, split_exp.mV[2]);
 
-
 		F32 sxp = split_exp.mV[1] + (split_exp.mV[0]-split_exp.mV[1])*da;
-
-
+		
 		for (U32 i = 0; i < 4; ++i)
 		{
 			F32 x = (F32)(i+1)/4.f;
 			x = powf(x, sxp);
 			mSunClipPlanes.mV[i] = near_clip+range*x;
 		}
+
+		mSunClipPlanes.mV[0] *= 1.25f; //bump back first split for transition padding
 	}
 
 	// convenience array of 4 near clip plane distances
 	F32 dist[] = { near_clip, mSunClipPlanes.mV[0], mSunClipPlanes.mV[1], mSunClipPlanes.mV[2], mSunClipPlanes.mV[3] };
 	
-	for (S32 j = 0; j < 4; j++)
-	{
-		if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA))
+
+	if (mSunDiffuse == LLColor4::black)
+	{ //sun diffuse is totally black, shadows don't matter
+		LLGLDepthTest depth(GL_TRUE);
+
+		for (S32 j = 0; j < 4; j++)
 		{
-			mShadowFrustPoints[j].clear();
+			mShadow[j].bindTarget();
+			mShadow[j].clear();
+			mShadow[j].flush();
 		}
+	}
+	else
+	{
+		for (S32 j = 0; j < 4; j++)
+		{
+			if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA))
+			{
+				mShadowFrustPoints[j].clear();
+			}
 
-		LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_SHADOW0+j;
+			LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_SHADOW0+j;
 
-		//restore render matrices
-		glh_set_current_modelview(saved_view);
-		glh_set_current_projection(saved_proj);
+			//restore render matrices
+			glh_set_current_modelview(saved_view);
+			glh_set_current_projection(saved_proj);
 
-		LLVector3 eye = camera.getOrigin();
+			LLVector3 eye = camera.getOrigin();
 
-		//camera used for shadow cull/render
-		LLCamera shadow_cam;
+			//camera used for shadow cull/render
+			LLCamera shadow_cam;
 		
-		//create world space camera frustum for this split
-		shadow_cam = camera;
-		shadow_cam.setFar(16.f);
+			//create world space camera frustum for this split
+			shadow_cam = camera;
+			shadow_cam.setFar(16.f);
 	
-		LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE);
+			LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE);
 
-		LLVector3* frust = shadow_cam.mAgentFrustum;
+			LLVector3* frust = shadow_cam.mAgentFrustum;
 
-		LLVector3 pn = shadow_cam.getAtAxis();
+			LLVector3 pn = shadow_cam.getAtAxis();
 		
-		LLVector3 min, max;
+			LLVector3 min, max;
 
-		//construct 8 corners of split frustum section
-		for (U32 i = 0; i < 4; i++)
-		{
-			LLVector3 delta = frust[i+4]-eye;
-			delta += (frust[i+4]-frust[(i+2)%4+4])*0.05f;
-			delta.normVec();
-			F32 dp = delta*pn;
-			frust[i] = eye + (delta*dist[j]*0.95f)/dp;
-			frust[i+4] = eye + (delta*dist[j+1]*1.05f)/dp;
-		}
+			//construct 8 corners of split frustum section
+			for (U32 i = 0; i < 4; i++)
+			{
+				LLVector3 delta = frust[i+4]-eye;
+				delta += (frust[i+4]-frust[(i+2)%4+4])*0.05f;
+				delta.normVec();
+				F32 dp = delta*pn;
+				frust[i] = eye + (delta*dist[j]*0.75f)/dp;
+				frust[i+4] = eye + (delta*dist[j+1]*1.25f)/dp;
+			}
 						
-		shadow_cam.calcAgentFrustumPlanes(frust);
-		shadow_cam.mFrustumCornerDist = 0.f;
+			shadow_cam.calcAgentFrustumPlanes(frust);
+			shadow_cam.mFrustumCornerDist = 0.f;
 		
-		if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
-		{
-			mShadowCamera[j] = shadow_cam;
-		}
-
-		std::vector<LLVector3> fp;
-
-		if (!gPipeline.getVisiblePointCloud(shadow_cam, min, max, fp, lightDir))
-		{
-			//no possible shadow receivers
 			if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
 			{
-				mShadowExtents[j][0] = LLVector3();
-				mShadowExtents[j][1] = LLVector3();
-				mShadowCamera[j+4] = shadow_cam;
-			}
-
-			mShadow[j].bindTarget();
-			{
-				LLGLDepthTest depth(GL_TRUE);
-				mShadow[j].clear();
+				mShadowCamera[j] = shadow_cam;
 			}
-			mShadow[j].flush();
 
-			mShadowError.mV[j] = 0.f;
-			mShadowFOV.mV[j] = 0.f;
+			std::vector<LLVector3> fp;
 
-			continue;
-		}
-
-		if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
-		{
-			mShadowExtents[j][0] = min;
-			mShadowExtents[j][1] = max;
-			mShadowFrustPoints[j] = fp;
-		}
-				
+			if (!gPipeline.getVisiblePointCloud(shadow_cam, min, max, fp, lightDir))
+			{
+				//no possible shadow receivers
+				if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
+				{
+					mShadowExtents[j][0] = LLVector3();
+					mShadowExtents[j][1] = LLVector3();
+					mShadowCamera[j+4] = shadow_cam;
+				}
 
-		//find a good origin for shadow projection
-		LLVector3 origin;
+				mShadow[j].bindTarget();
+				{
+					LLGLDepthTest depth(GL_TRUE);
+					mShadow[j].clear();
+				}
+				mShadow[j].flush();
 
-		//get a temporary view projection
-		view[j] = look(camera.getOrigin(), lightDir, -up);
+				mShadowError.mV[j] = 0.f;
+				mShadowFOV.mV[j] = 0.f;
 
-		std::vector<LLVector3> wpf;
+				continue;
+			}
 
-		for (U32 i = 0; i < fp.size(); i++)
-		{
-			glh::vec3f p = glh::vec3f(fp[i].mV);
-			view[j].mult_matrix_vec(p);
-			wpf.push_back(LLVector3(p.v));
-		}
+			if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
+			{
+				mShadowExtents[j][0] = min;
+				mShadowExtents[j][1] = max;
+				mShadowFrustPoints[j] = fp;
+			}
+				
 
-		min = wpf[0];
-		max = wpf[0];
+			//find a good origin for shadow projection
+			LLVector3 origin;
 
-		for (U32 i = 0; i < fp.size(); ++i)
-		{ //get AABB in camera space
-			update_min_max(min, max, wpf[i]);
-		}
-
-		// Construct a perspective transform with perspective along y-axis that contains
-		// points in wpf
-		//Known:
-		// - far clip plane
-		// - near clip plane
-		// - points in frustum
-		//Find:
-		// - origin
-
-		//get some "interesting" points of reference
-		LLVector3 center = (min+max)*0.5f;
-		LLVector3 size = (max-min)*0.5f;
-		LLVector3 near_center = center;
-		near_center.mV[1] += size.mV[1]*2.f;
-		
-		
-		//put all points in wpf in quadrant 0, reletive to center of min/max
-		//get the best fit line using least squares
-		F32 bfm = 0.f;
-		F32 bfb = 0.f;
+			//get a temporary view projection
+			view[j] = look(camera.getOrigin(), lightDir, -up);
 
-		for (U32 i = 0; i < wpf.size(); ++i)
-		{
-			wpf[i] -= center;
-			wpf[i].mV[0] = fabsf(wpf[i].mV[0]);
-			wpf[i].mV[2] = fabsf(wpf[i].mV[2]);
-		}
+			std::vector<LLVector3> wpf;
 
-		if (!wpf.empty())
-		{ 
-			F32 sx = 0.f;
-			F32 sx2 = 0.f;
-			F32 sy = 0.f;
-			F32 sxy = 0.f;
-			
-			for (U32 i = 0; i < wpf.size(); ++i)
-			{		
-				sx += wpf[i].mV[0];
-				sx2 += wpf[i].mV[0]*wpf[i].mV[0];
-				sy += wpf[i].mV[1];
-				sxy += wpf[i].mV[0]*wpf[i].mV[1]; 
+			for (U32 i = 0; i < fp.size(); i++)
+			{
+				glh::vec3f p = glh::vec3f(fp[i].mV);
+				view[j].mult_matrix_vec(p);
+				wpf.push_back(LLVector3(p.v));
 			}
 
-			bfm = (sy*sx-wpf.size()*sxy)/(sx*sx-wpf.size()*sx2);
-			bfb = (sx*sxy-sy*sx2)/(sx*sx-bfm*sx2);
-		}
-		
-		{
-			// best fit line is y=bfm*x+bfb
-		
-			//find point that is furthest to the right of line
-			F32 off_x = -1.f;
-			LLVector3 lp;
+			min = wpf[0];
+			max = wpf[0];
 
-			for (U32 i = 0; i < wpf.size(); ++i)
-			{
-				//y = bfm*x+bfb
-				//x = (y-bfb)/bfm
-				F32 lx = (wpf[i].mV[1]-bfb)/bfm;
-
-				lx = wpf[i].mV[0]-lx;
-				
-				if (off_x < lx)
-				{
-					off_x = lx;
-					lp = wpf[i];
-				}
+			for (U32 i = 0; i < fp.size(); ++i)
+			{ //get AABB in camera space
+				update_min_max(min, max, wpf[i]);
 			}
 
-			//get line with slope bfm through lp
-			// bfb = y-bfm*x
-			bfb = lp.mV[1]-bfm*lp.mV[0];
+			// Construct a perspective transform with perspective along y-axis that contains
+			// points in wpf
+			//Known:
+			// - far clip plane
+			// - near clip plane
+			// - points in frustum
+			//Find:
+			// - origin
 
-			//calculate error
-			mShadowError.mV[j] = 0.f;
+			//get some "interesting" points of reference
+			LLVector3 center = (min+max)*0.5f;
+			LLVector3 size = (max-min)*0.5f;
+			LLVector3 near_center = center;
+			near_center.mV[1] += size.mV[1]*2.f;
+		
+		
+			//put all points in wpf in quadrant 0, reletive to center of min/max
+			//get the best fit line using least squares
+			F32 bfm = 0.f;
+			F32 bfb = 0.f;
 
 			for (U32 i = 0; i < wpf.size(); ++i)
 			{
-				F32 lx = (wpf[i].mV[1]-bfb)/bfm;
-				mShadowError.mV[j] += fabsf(wpf[i].mV[0]-lx);
+				wpf[i] -= center;
+				wpf[i].mV[0] = fabsf(wpf[i].mV[0]);
+				wpf[i].mV[2] = fabsf(wpf[i].mV[2]);
 			}
 
-			mShadowError.mV[j] /= wpf.size();
-			mShadowError.mV[j] /= size.mV[0];
+			if (!wpf.empty())
+			{ 
+				F32 sx = 0.f;
+				F32 sx2 = 0.f;
+				F32 sy = 0.f;
+				F32 sxy = 0.f;
+			
+				for (U32 i = 0; i < wpf.size(); ++i)
+				{		
+					sx += wpf[i].mV[0];
+					sx2 += wpf[i].mV[0]*wpf[i].mV[0];
+					sy += wpf[i].mV[1];
+					sxy += wpf[i].mV[0]*wpf[i].mV[1]; 
+				}
 
-			if (mShadowError.mV[j] > gSavedSettings.getF32("RenderShadowErrorCutoff"))
-			{ //just use ortho projection
-				mShadowFOV.mV[j] = -1.f;
-				origin.clearVec();
-				proj[j] = gl_ortho(min.mV[0], max.mV[0],
-									min.mV[1], max.mV[1],
-									-max.mV[2], -min.mV[2]);
+				bfm = (sy*sx-wpf.size()*sxy)/(sx*sx-wpf.size()*sx2);
+				bfb = (sx*sxy-sy*sx2)/(sx*sx-bfm*sx2);
 			}
-			else
+		
 			{
-				//origin is where line x = 0;
-				origin.setVec(0,bfb,0);
-
-				F32 fovz = 1.f;
-				F32 fovx = 1.f;
-				
-				LLVector3 zp;
-				LLVector3 xp;
+				// best fit line is y=bfm*x+bfb
+		
+				//find point that is furthest to the right of line
+				F32 off_x = -1.f;
+				LLVector3 lp;
 
 				for (U32 i = 0; i < wpf.size(); ++i)
 				{
-					LLVector3 atz = wpf[i]-origin;
-					atz.mV[0] = 0.f;
-					atz.normVec();
-					if (fovz > -atz.mV[1])
-					{
-						zp = wpf[i];
-						fovz = -atz.mV[1];
-					}
-					
-					LLVector3 atx = wpf[i]-origin;
-					atx.mV[2] = 0.f;
-					atx.normVec();
-					if (fovx > -atx.mV[1])
+					//y = bfm*x+bfb
+					//x = (y-bfb)/bfm
+					F32 lx = (wpf[i].mV[1]-bfb)/bfm;
+
+					lx = wpf[i].mV[0]-lx;
+				
+					if (off_x < lx)
 					{
-						fovx = -atx.mV[1];
-						xp = wpf[i];
+						off_x = lx;
+						lp = wpf[i];
 					}
 				}
 
-				fovx = acos(fovx);
-				fovz = acos(fovz);
+				//get line with slope bfm through lp
+				// bfb = y-bfm*x
+				bfb = lp.mV[1]-bfm*lp.mV[0];
 
-				F32 cutoff = llmin(gSavedSettings.getF32("RenderShadowFOVCutoff"), 1.4f);
-				
-				mShadowFOV.mV[j] = fovx;
-				
-				if (fovx < cutoff && fovz > cutoff)
+				//calculate error
+				mShadowError.mV[j] = 0.f;
+
+				for (U32 i = 0; i < wpf.size(); ++i)
 				{
-					//x is a good fit, but z is too big, move away from zp enough so that fovz matches cutoff
-					F32 d = zp.mV[2]/tan(cutoff);
-					F32 ny = zp.mV[1] + fabsf(d);
+					F32 lx = (wpf[i].mV[1]-bfb)/bfm;
+					mShadowError.mV[j] += fabsf(wpf[i].mV[0]-lx);
+				}
 
-					origin.mV[1] = ny;
+				mShadowError.mV[j] /= wpf.size();
+				mShadowError.mV[j] /= size.mV[0];
+
+				if (mShadowError.mV[j] > RenderShadowErrorCutoff)
+				{ //just use ortho projection
+					mShadowFOV.mV[j] = -1.f;
+					origin.clearVec();
+					proj[j] = gl_ortho(min.mV[0], max.mV[0],
+										min.mV[1], max.mV[1],
+										-max.mV[2], -min.mV[2]);
+				}
+				else
+				{
+					//origin is where line x = 0;
+					origin.setVec(0,bfb,0);
 
-					fovz = 1.f;
-					fovx = 1.f;
+					F32 fovz = 1.f;
+					F32 fovx = 1.f;
+				
+					LLVector3 zp;
+					LLVector3 xp;
 
 					for (U32 i = 0; i < wpf.size(); ++i)
 					{
 						LLVector3 atz = wpf[i]-origin;
 						atz.mV[0] = 0.f;
 						atz.normVec();
-						fovz = llmin(fovz, -atz.mV[1]);
-
+						if (fovz > -atz.mV[1])
+						{
+							zp = wpf[i];
+							fovz = -atz.mV[1];
+						}
+					
 						LLVector3 atx = wpf[i]-origin;
 						atx.mV[2] = 0.f;
 						atx.normVec();
-						fovx = llmin(fovx, -atx.mV[1]);
+						if (fovx > -atx.mV[1])
+						{
+							fovx = -atx.mV[1];
+							xp = wpf[i];
+						}
 					}
 
 					fovx = acos(fovx);
 					fovz = acos(fovz);
 
-					mShadowFOV.mV[j] = cutoff;
-				}
+					F32 cutoff = llmin((F32) RenderShadowFOVCutoff, 1.4f);
+				
+					mShadowFOV.mV[j] = fovx;
+				
+					if (fovx < cutoff && fovz > cutoff)
+					{
+						//x is a good fit, but z is too big, move away from zp enough so that fovz matches cutoff
+						F32 d = zp.mV[2]/tan(cutoff);
+						F32 ny = zp.mV[1] + fabsf(d);
+
+						origin.mV[1] = ny;
+
+						fovz = 1.f;
+						fovx = 1.f;
+
+						for (U32 i = 0; i < wpf.size(); ++i)
+						{
+							LLVector3 atz = wpf[i]-origin;
+							atz.mV[0] = 0.f;
+							atz.normVec();
+							fovz = llmin(fovz, -atz.mV[1]);
+
+							LLVector3 atx = wpf[i]-origin;
+							atx.mV[2] = 0.f;
+							atx.normVec();
+							fovx = llmin(fovx, -atx.mV[1]);
+						}
+
+						fovx = acos(fovx);
+						fovz = acos(fovz);
+
+						mShadowFOV.mV[j] = cutoff;
+					}
 
 				
-				origin += center;
+					origin += center;
 			
-				F32 ynear = -(max.mV[1]-origin.mV[1]);
-				F32 yfar = -(min.mV[1]-origin.mV[1]);
+					F32 ynear = -(max.mV[1]-origin.mV[1]);
+					F32 yfar = -(min.mV[1]-origin.mV[1]);
 				
-				if (ynear < 0.1f) //keep a sensible near clip plane
-				{
-					F32 diff = 0.1f-ynear;
-					origin.mV[1] += diff;
-					ynear += diff;
-					yfar += diff;
-				}
+					if (ynear < 0.1f) //keep a sensible near clip plane
+					{
+						F32 diff = 0.1f-ynear;
+						origin.mV[1] += diff;
+						ynear += diff;
+						yfar += diff;
+					}
 								
-				if (fovx > cutoff)
-				{ //just use ortho projection
-					origin.clearVec();
-					mShadowError.mV[j] = -1.f;
-					proj[j] = gl_ortho(min.mV[0], max.mV[0],
-							min.mV[1], max.mV[1],
-							-max.mV[2], -min.mV[2]);
-				}
-				else
-				{
-					//get perspective projection
-					view[j] = view[j].inverse();
+					if (fovx > cutoff)
+					{ //just use ortho projection
+						origin.clearVec();
+						mShadowError.mV[j] = -1.f;
+						proj[j] = gl_ortho(min.mV[0], max.mV[0],
+								min.mV[1], max.mV[1],
+								-max.mV[2], -min.mV[2]);
+					}
+					else
+					{
+						//get perspective projection
+						view[j] = view[j].inverse();
 
-					glh::vec3f origin_agent(origin.mV);
+						glh::vec3f origin_agent(origin.mV);
 					
-					//translate view to origin
-					view[j].mult_matrix_vec(origin_agent);
+						//translate view to origin
+						view[j].mult_matrix_vec(origin_agent);
 
-					eye = LLVector3(origin_agent.v);
+						eye = LLVector3(origin_agent.v);
 
-					if (!hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
-					{
-						mShadowFrustOrigin[j] = eye;
-					}
+						if (!hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
+						{
+							mShadowFrustOrigin[j] = eye;
+						}
 				
-					view[j] = look(LLVector3(origin_agent.v), lightDir, -up);
+						view[j] = look(LLVector3(origin_agent.v), lightDir, -up);
 
-					F32 fx = 1.f/tanf(fovx);
-					F32 fz = 1.f/tanf(fovz);
+						F32 fx = 1.f/tanf(fovx);
+						F32 fz = 1.f/tanf(fovz);
 
-					proj[j] = glh::matrix4f(-fx, 0, 0, 0,
-											0, (yfar+ynear)/(ynear-yfar), 0, (2.f*yfar*ynear)/(ynear-yfar),
-											0, 0, -fz, 0,
-											0, -1.f, 0, 0);
+						proj[j] = glh::matrix4f(-fx, 0, 0, 0,
+												0, (yfar+ynear)/(ynear-yfar), 0, (2.f*yfar*ynear)/(ynear-yfar),
+												0, 0, -fz, 0,
+												0, -1.f, 0, 0);
+					}
 				}
 			}
-		}
 
-		//shadow_cam.setFar(128.f);
-		shadow_cam.setOriginAndLookAt(eye, up, center);
+			//shadow_cam.setFar(128.f);
+			shadow_cam.setOriginAndLookAt(eye, up, center);
 
-		shadow_cam.setOrigin(0,0,0);
+			shadow_cam.setOrigin(0,0,0);
 
-		glh_set_current_modelview(view[j]);
-		glh_set_current_projection(proj[j]);
+			glh_set_current_modelview(view[j]);
+			glh_set_current_projection(proj[j]);
 
-		LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE);
+			LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE);
 
-		//shadow_cam.ignoreAgentFrustumPlane(LLCamera::AGENT_PLANE_NEAR);
-		shadow_cam.getAgentPlane(LLCamera::AGENT_PLANE_NEAR).set(shadow_near_clip);
+			//shadow_cam.ignoreAgentFrustumPlane(LLCamera::AGENT_PLANE_NEAR);
+			shadow_cam.getAgentPlane(LLCamera::AGENT_PLANE_NEAR).set(shadow_near_clip);
 
-		//translate and scale to from [-1, 1] to [0, 1]
-		glh::matrix4f trans(0.5f, 0.f, 0.f, 0.5f,
-						0.f, 0.5f, 0.f, 0.5f,
-						0.f, 0.f, 0.5f, 0.5f,
-						0.f, 0.f, 0.f, 1.f);
+			//translate and scale to from [-1, 1] to [0, 1]
+			glh::matrix4f trans(0.5f, 0.f, 0.f, 0.5f,
+							0.f, 0.5f, 0.f, 0.5f,
+							0.f, 0.f, 0.5f, 0.5f,
+							0.f, 0.f, 0.f, 1.f);
 
-		glh_set_current_modelview(view[j]);
-		glh_set_current_projection(proj[j]);
+			glh_set_current_modelview(view[j]);
+			glh_set_current_projection(proj[j]);
 
-		for (U32 i = 0; i < 16; i++)
-		{
-			gGLLastModelView[i] = mShadowModelview[j].m[i];
-			gGLLastProjection[i] = mShadowProjection[j].m[i];
-		}
+			for (U32 i = 0; i < 16; i++)
+			{
+				gGLLastModelView[i] = mShadowModelview[j].m[i];
+				gGLLastProjection[i] = mShadowProjection[j].m[i];
+			}
 
-		mShadowModelview[j] = view[j];
-		mShadowProjection[j] = proj[j];
+			mShadowModelview[j] = view[j];
+			mShadowProjection[j] = proj[j];
 
 	
-		mSunShadowMatrix[j] = trans*proj[j]*view[j]*inv_view;
+			mSunShadowMatrix[j] = trans*proj[j]*view[j]*inv_view;
 		
-		stop_glerror();
+			stop_glerror();
 
-		mShadow[j].bindTarget();
-		mShadow[j].getViewport(gGLViewport);
-		mShadow[j].clear();
+			mShadow[j].bindTarget();
+			mShadow[j].getViewport(gGLViewport);
+			mShadow[j].clear();
 		
-		{
-			static LLCullResult result[4];
+			{
+				static LLCullResult result[4];
 
-			//LLGLEnable enable(GL_DEPTH_CLAMP_NV);
-			renderShadow(view[j], proj[j], shadow_cam, result[j], TRUE);
-		}
+				//LLGLEnable enable(GL_DEPTH_CLAMP_NV);
+				renderShadow(view[j], proj[j], shadow_cam, result[j], TRUE);
+			}
 
-		mShadow[j].flush();
+			mShadow[j].flush();
  
-		if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
-		{
-			LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE);
-			mShadowCamera[j+4] = shadow_cam;
+			if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
+			{
+				LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE);
+				mShadowCamera[j+4] = shadow_cam;
+			}
 		}
 	}
 
 	
 	//hack to disable projector shadows 
-	bool gen_shadow = gSavedSettings.getS32("RenderShadowDetail") > 1;
+	bool gen_shadow = RenderShadowDetail > 1;
 
 	if (gen_shadow)
 	{
@@ -9457,7 +9395,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
 	}
 
 
-	if (!gSavedSettings.getBOOL("CameraOffset"))
+	if (!CameraOffset)
 	{
 		glh_set_current_modelview(saved_view);
 		glh_set_current_projection(saved_proj);
@@ -9466,10 +9404,10 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
 	{
 		glh_set_current_modelview(view[1]);
 		glh_set_current_projection(proj[1]);
-		glLoadMatrixf(view[1].m);
-		glMatrixMode(GL_PROJECTION);
-		glLoadMatrixf(proj[1].m);
-		glMatrixMode(GL_MODELVIEW);
+		gGL.loadMatrix(view[1].m);
+		gGL.matrixMode(LLRender::MM_PROJECTION);
+		gGL.loadMatrix(proj[1].m);
+		gGL.matrixMode(LLRender::MM_MODELVIEW);
 	}
 	gGL.setColorMask(true, false);
 
@@ -9480,6 +9418,11 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
 	}
 
 	popRenderTypeMask();
+
+	if (!skip_avatar_update)
+	{
+		gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode());
+	}
 }
 
 void LLPipeline::renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL texture)
@@ -9515,7 +9458,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
 
 	assertInitialized();
 
-	BOOL muted = LLMuteList::getInstance()->isMuted(avatar->getID());
+	bool muted = avatar->isVisuallyMuted();		
 
 	pushRenderTypeMask();
 	
@@ -9601,24 +9544,24 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
 	tdim.mV[0] = fabsf(half_height.dot3(left).getF32());
 	tdim.mV[1] = fabsf(half_height.dot3(up).getF32());
 
-	glMatrixMode(GL_PROJECTION);
-	glPushMatrix();
+	gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.pushMatrix();
 	
 	F32 distance = (pos-camera.getOrigin()).length();
 	F32 fov = atanf(tdim.mV[1]/distance)*2.f*RAD_TO_DEG;
 	F32 aspect = tdim.mV[0]/tdim.mV[1];
 	glh::matrix4f persp = gl_perspective(fov, aspect, 1.f, 256.f);
 	glh_set_current_projection(persp);
-	glLoadMatrixf(persp.m);
+	gGL.loadMatrix(persp.m);
 
-	glMatrixMode(GL_MODELVIEW);
-	glPushMatrix();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
+	gGL.pushMatrix();
 	glh::matrix4f mat;
 	camera.getOpenGLTransform(mat.m);
 
 	mat = glh::matrix4f((GLfloat*) OGL_TO_CFR_ROTATION) * mat;
 
-	glLoadMatrixf(mat.m);
+	gGL.loadMatrix(mat.m);
 	glh_set_current_modelview(mat);
 
 	glClearColor(0.0f,0.0f,0.0f,0.0f);
@@ -9686,14 +9629,19 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
 
 		gGL.flush();
 
-		glPushMatrix();
-		glLoadIdentity();
-		glMatrixMode(GL_PROJECTION);
-		glPushMatrix();
-		glLoadIdentity();
+		gGL.pushMatrix();
+		gGL.loadIdentity();
+		gGL.matrixMode(LLRender::MM_PROJECTION);
+		gGL.pushMatrix();
+		gGL.loadIdentity();
 
 		static const F32 clip_plane = 0.99999f;
 
+		if (LLGLSLShader::sNoFixedFunction)
+		{
+			gUIProgram.bind();
+		}
+
 		gGL.color4ub(64,64,64,255);
 		gGL.begin(LLRender::QUADS);
 		gGL.vertex3f(-1, -1, clip_plane);
@@ -9703,9 +9651,14 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
 		gGL.end();
 		gGL.flush();
 
-		glPopMatrix();
-		glMatrixMode(GL_MODELVIEW);
-		glPopMatrix();
+		if (LLGLSLShader::sNoFixedFunction)
+		{
+			gUIProgram.unbind();
+		}
+
+		gGL.popMatrix();
+		gGL.matrixMode(LLRender::MM_MODELVIEW);
+		gGL.popMatrix();
 	}
 
 	avatar->mImpostor.flush();
@@ -9719,10 +9672,10 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
 	sShadowRender = FALSE;
 	popRenderTypeMask();
 
-	glMatrixMode(GL_PROJECTION);
-	glPopMatrix();
-	glMatrixMode(GL_MODELVIEW);
-	glPopMatrix();
+	gGL.matrixMode(LLRender::MM_PROJECTION);
+	gGL.popMatrix();
+	gGL.matrixMode(LLRender::MM_MODELVIEW);
+	gGL.popMatrix();
 
 	avatar->mNeedsImpostorUpdate = FALSE;
 	avatar->cacheImpostorValues();
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 0661de8cec237418f952910c6eaae08f78ca20a4..b8b4f164fed2e1f709676d04b3adf1c9bc10e207 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -72,7 +72,7 @@ BOOL compute_min_max(LLMatrix4& box, LLVector2& min, LLVector2& max); // Shouldn
 bool LLRayAABB(const LLVector3 &center, const LLVector3 &size, const LLVector3& origin, const LLVector3& dir, LLVector3 &coord, F32 epsilon = 0);
 BOOL setup_hud_matrices(); // use whole screen to render hud
 BOOL setup_hud_matrices(const LLRect& screen_region); // specify portion of screen (in pixels) to render hud attachments from (for picking)
-glh::matrix4f glh_copy_matrix(GLdouble* src);
+glh::matrix4f glh_copy_matrix(F32* src);
 glh::matrix4f glh_get_current_modelview();
 void glh_set_current_modelview(const glh::matrix4f& mat);
 glh::matrix4f glh_get_current_projection();
@@ -111,10 +111,13 @@ class LLPipeline
 	void destroyGL();
 	void restoreGL();
 	void resetVertexBuffers();
+	void doResetVertexBuffers();
 	void resizeScreenTexture();
 	void releaseGLBuffers();
+	void releaseLUTBuffers();
 	void releaseScreenBuffers();
 	void createGLBuffers();
+	void createLUTBuffers();
 
 	void allocateScreenBuffer(U32 resX, U32 resY);
 	bool allocateScreenBuffer(U32 resX, U32 resY, U32 samples);
@@ -231,7 +234,7 @@ class LLPipeline
 	void postSort(LLCamera& camera);
 	void forAllVisibleDrawables(void (*func)(LLDrawable*));
 
-	void renderObjects(U32 type, U32 mask, BOOL texture = TRUE);
+	void renderObjects(U32 type, U32 mask, BOOL texture = TRUE, BOOL batch_texture = FALSE);
 	void renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL texture);
 
 	void grabReferences(LLCullResult& result);
@@ -248,7 +251,7 @@ class LLPipeline
 	void renderGeomDeferred(LLCamera& camera);
 	void renderGeomPostDeferred(LLCamera& camera);
 	void renderGeomShadow(LLCamera& camera);
-	void bindDeferredShader(LLGLSLShader& shader, U32 light_index = 0, LLRenderTarget* gi_source = NULL, LLRenderTarget* last_gi_post = NULL, U32 noise_map = 0xFFFFFFFF);
+	void bindDeferredShader(LLGLSLShader& shader, U32 light_index = 0, U32 noise_map = 0xFFFFFFFF);
 	void setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep);
 
 	void unbindDeferredShader(LLGLSLShader& shader);
@@ -262,7 +265,6 @@ class LLPipeline
 
 
 	void renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& camera, LLCullResult& result, BOOL use_shader = TRUE, BOOL use_occlusion = TRUE);
-	void generateGI(LLCamera& camera, LLVector3& lightDir, std::vector<LLVector3>& vpc);
 	void renderHighlights();
 	void renderDebug();
 	void renderPhysicsDisplay();
@@ -360,7 +362,7 @@ class LLPipeline
 	static BOOL getRenderHighlights(void* data);
 
 	static void updateRenderDeferred();
-	static void refreshRenderDeferred();
+	static void refreshCachedSettings();
 
 	static void throttleNewMemoryAllocation(BOOL disable);
 
@@ -408,7 +410,6 @@ class LLPipeline
 		RENDER_TYPE_PASS_ALPHA					= LLRenderPass::PASS_ALPHA,
 		RENDER_TYPE_PASS_ALPHA_MASK				= LLRenderPass::PASS_ALPHA_MASK,
 		RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK	= LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK,
-		RENDER_TYPE_PASS_ALPHA_SHADOW = LLRenderPass::PASS_ALPHA_SHADOW,
 		// Following are object types (only used in drawable mRenderType)
 		RENDER_TYPE_HUD = LLRenderPass::NUM_RENDER_TYPES,
 		RENDER_TYPE_VOLUME,
@@ -434,34 +435,35 @@ class LLPipeline
 
 	enum LLRenderDebugMask
 	{
-		RENDER_DEBUG_COMPOSITION		= 0x0000001,
-		RENDER_DEBUG_VERIFY				= 0x0000002,
-		RENDER_DEBUG_BBOXES				= 0x0000004,
-		RENDER_DEBUG_OCTREE				= 0x0000008,
-		RENDER_DEBUG_WIND_VECTORS		= 0x0000010,
-		RENDER_DEBUG_OCCLUSION			= 0x0000020,
-		RENDER_DEBUG_POINTS				= 0x0000040,
-		RENDER_DEBUG_TEXTURE_PRIORITY	= 0x0000080,
-		RENDER_DEBUG_TEXTURE_AREA		= 0x0000100,
-		RENDER_DEBUG_FACE_AREA			= 0x0000200,
-		RENDER_DEBUG_PARTICLES			= 0x0000400,
-		RENDER_DEBUG_GLOW				= 0x0000800,
-		RENDER_DEBUG_TEXTURE_ANIM		= 0x0001000,
-		RENDER_DEBUG_LIGHTS				= 0x0002000,
-		RENDER_DEBUG_BATCH_SIZE			= 0x0004000,
-		RENDER_DEBUG_ALPHA_BINS			= 0x0008000,
-		RENDER_DEBUG_RAYCAST            = 0x0010000,
-		RENDER_DEBUG_SHAME				= 0x0020000,
-		RENDER_DEBUG_SHADOW_FRUSTA		= 0x0040000,
-		RENDER_DEBUG_SCULPTED           = 0x0080000,
-		RENDER_DEBUG_AVATAR_VOLUME      = 0x0100000,
-		RENDER_DEBUG_BUILD_QUEUE		= 0x0200000,
-		RENDER_DEBUG_AGENT_TARGET       = 0x0400000,
-		RENDER_DEBUG_UPDATE_TYPE		= 0x0800000,
-		RENDER_DEBUG_PHYSICS_SHAPES     = 0x1000000,
-		RENDER_DEBUG_NORMALS	        = 0x2000000,
-		RENDER_DEBUG_LOD_INFO	        = 0x4000000,
-		RENDER_DEBUG_RENDER_COMPLEXITY  = 0x8000000
+		RENDER_DEBUG_COMPOSITION		= 0x00000001,
+		RENDER_DEBUG_VERIFY				= 0x00000002,
+		RENDER_DEBUG_BBOXES				= 0x00000004,
+		RENDER_DEBUG_OCTREE				= 0x00000008,
+		RENDER_DEBUG_WIND_VECTORS		= 0x00000010,
+		RENDER_DEBUG_OCCLUSION			= 0x00000020,
+		RENDER_DEBUG_POINTS				= 0x00000040,
+		RENDER_DEBUG_TEXTURE_PRIORITY	= 0x00000080,
+		RENDER_DEBUG_TEXTURE_AREA		= 0x00000100,
+		RENDER_DEBUG_FACE_AREA			= 0x00000200,
+		RENDER_DEBUG_PARTICLES			= 0x00000400,
+		RENDER_DEBUG_GLOW				= 0x00000800,
+		RENDER_DEBUG_TEXTURE_ANIM		= 0x00001000,
+		RENDER_DEBUG_LIGHTS				= 0x00002000,
+		RENDER_DEBUG_BATCH_SIZE			= 0x00004000,
+		RENDER_DEBUG_ALPHA_BINS			= 0x00008000,
+		RENDER_DEBUG_RAYCAST            = 0x00010000,
+		RENDER_DEBUG_SHAME				= 0x00020000,
+		RENDER_DEBUG_SHADOW_FRUSTA		= 0x00040000,
+		RENDER_DEBUG_SCULPTED           = 0x00080000,
+		RENDER_DEBUG_AVATAR_VOLUME      = 0x00100000,
+		RENDER_DEBUG_BUILD_QUEUE		= 0x00200000,
+		RENDER_DEBUG_AGENT_TARGET       = 0x00400000,
+		RENDER_DEBUG_UPDATE_TYPE		= 0x00800000,
+		RENDER_DEBUG_PHYSICS_SHAPES     = 0x01000000,
+		RENDER_DEBUG_NORMALS	        = 0x02000000,
+		RENDER_DEBUG_LOD_INFO	        = 0x04000000,
+		RENDER_DEBUG_RENDER_COMPLEXITY  = 0x08000000,
+		RENDER_DEBUG_ATTACHMENT_BYTES	= 0x10000000,
 	};
 
 public:
@@ -531,15 +533,16 @@ class LLPipeline
 	LLRenderTarget			mScreen;
 	LLRenderTarget			mUIScreen;
 	LLRenderTarget			mDeferredScreen;
+	LLRenderTarget			mFXAABuffer;
 	LLRenderTarget			mEdgeMap;
 	LLRenderTarget			mDeferredDepth;
-	LLRenderTarget			mDeferredLight[3];
-	LLRenderTarget			mGIMap;
-	LLRenderTarget			mGIMapPost[2];
-	LLRenderTarget			mLuminanceMap;
+	LLRenderTarget			mDeferredLight;
 	LLRenderTarget			mHighlight;
 	LLRenderTarget			mPhysicsDisplay;
 
+	//utility buffer for rendering post effects, gets abused by renderDeferredLighting
+	LLPointer<LLVertexBuffer> mDeferredVB;
+
 	//sun shadow map
 	LLRenderTarget			mShadow[6];
 	std::vector<LLVector3>	mShadowFrustPoints[4];
@@ -585,6 +588,7 @@ class LLPipeline
 
 	LLColor4				mSunDiffuse;
 	LLVector3				mSunDir;
+	LLVector3				mTransformedSunDir;
 
 	BOOL					mInitialized;
 	BOOL					mVertexShadersEnabled;
@@ -652,6 +656,8 @@ class LLPipeline
 	bool mGroupQ2Locked;
 	bool mGroupQ1Locked;
 
+	bool mResetVertexBuffers; //if true, clear vertex buffers on next update
+
 	LLViewerObject::vobj_list_t		mCreateQ;
 		
 	LLDrawable::drawable_set_t		mRetexturedList;
@@ -770,6 +776,81 @@ class LLPipeline
 
 	//debug use
 	static U32              sCurRenderPoolType ;
+
+	//cached settings
+	static BOOL WindLightUseAtmosShaders;
+	static BOOL VertexShaderEnable;
+	static BOOL RenderAvatarVP;
+	static BOOL RenderDeferred;
+	static F32 RenderDeferredSunWash;
+	static U32 RenderFSAASamples;
+	static U32 RenderResolutionDivisor;
+	static BOOL RenderUIBuffer;
+	static S32 RenderShadowDetail;
+	static BOOL RenderDeferredSSAO;
+	static F32 RenderShadowResolutionScale;
+	static BOOL RenderLocalLights;
+	static BOOL RenderDelayCreation;
+	static BOOL RenderAnimateRes;
+	static BOOL FreezeTime;
+	static S32 DebugBeaconLineWidth;
+	static F32 RenderHighlightBrightness;
+	static LLColor4 RenderHighlightColor;
+	static F32 RenderHighlightThickness;
+	static BOOL RenderSpotLightsInNondeferred;
+	static LLColor4 PreviewAmbientColor;
+	static LLColor4 PreviewDiffuse0;
+	static LLColor4 PreviewSpecular0;
+	static LLColor4 PreviewDiffuse1;
+	static LLColor4 PreviewSpecular1;
+	static LLColor4 PreviewDiffuse2;
+	static LLColor4 PreviewSpecular2;
+	static LLVector3 PreviewDirection0;
+	static LLVector3 PreviewDirection1;
+	static LLVector3 PreviewDirection2;
+	static F32 RenderGlowMinLuminance;
+	static F32 RenderGlowMaxExtractAlpha;
+	static F32 RenderGlowWarmthAmount;
+	static LLVector3 RenderGlowLumWeights;
+	static LLVector3 RenderGlowWarmthWeights;
+	static S32 RenderGlowResolutionPow;
+	static S32 RenderGlowIterations;
+	static F32 RenderGlowWidth;
+	static F32 RenderGlowStrength;
+	static BOOL RenderDepthOfField;
+	static F32 CameraFocusTransitionTime;
+	static F32 CameraFNumber;
+	static F32 CameraFocalLength;
+	static F32 CameraFieldOfView;
+	static F32 RenderShadowNoise;
+	static F32 RenderShadowBlurSize;
+	static F32 RenderSSAOScale;
+	static U32 RenderSSAOMaxScale;
+	static F32 RenderSSAOFactor;
+	static LLVector3 RenderSSAOEffect;
+	static F32 RenderShadowOffsetError;
+	static F32 RenderShadowBiasError;
+	static F32 RenderShadowOffset;
+	static F32 RenderShadowBias;
+	static F32 RenderSpotShadowOffset;
+	static F32 RenderSpotShadowBias;
+	static F32 RenderEdgeDepthCutoff;
+	static F32 RenderEdgeNormCutoff;
+	static LLVector3 RenderShadowGaussian;
+	static F32 RenderShadowBlurDistFactor;
+	static BOOL RenderDeferredAtmospheric;
+	static S32 RenderReflectionDetail;
+	static F32 RenderHighlightFadeTime;
+	static LLVector3 RenderShadowClipPlanes;
+	static LLVector3 RenderShadowOrthoClipPlanes;
+	static LLVector3 RenderShadowNearDist;
+	static F32 RenderFarClip;
+	static LLVector3 RenderShadowSplitExponent;
+	static F32 RenderShadowErrorCutoff;
+	static F32 RenderShadowFOVCutoff;
+	static BOOL CameraOffset;
+	static F32 CameraMaxCoF;
+	static F32 CameraDoFResScale;
 };
 
 void render_bbox(const LLVector3 &min, const LLVector3 &max);
diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml
index 8baaa14595fdb8ea0dcb70a44fd5950b5d7e0c2d..b616e2327bbe99e484d0e3059b13c7a999393b91 100644
--- a/indra/newview/skins/default/colors.xml
+++ b/indra/newview/skins/default/colors.xml
@@ -614,6 +614,9 @@
     <color
      name="PanelFocusBackgroundColor"
      reference="DkGray2" />
+    <color
+     name="PanelNotificationBackground"
+     value="1 0.3 0.3 0" />
     <color
      name="ParcelHoverColor"
      reference="White" />
@@ -746,6 +749,9 @@
     <color
      name="TitleBarFocusColor"
      reference="White_10" />
+    <color
+     name="ToastBackground"
+     value="0.3 0.3 0.3 0" />
     <color
      name="ToolTipBgColor"
      value="0.937 0.89 0.655 1" />
diff --git a/indra/newview/skins/default/textures/checker.png b/indra/newview/skins/default/textures/checker.png
new file mode 100644
index 0000000000000000000000000000000000000000..1ab87e3f02f67f9329f7a7884d4667e3dc7c8e38
Binary files /dev/null and b/indra/newview/skins/default/textures/checker.png differ
diff --git a/indra/newview/skins/default/textures/map_avatar_unknown_32.tga b/indra/newview/skins/default/textures/map_avatar_unknown_32.tga
new file mode 100644
index 0000000000000000000000000000000000000000..d1192478c67cb93677e7942b2f491e1bc413e48b
Binary files /dev/null and b/indra/newview/skins/default/textures/map_avatar_unknown_32.tga differ
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index 8702ebde2ab5ea8aee4ef691e0b36f611ba8c503..eabcc68916b11c30954c2e92d4c911f31dc09abf 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -122,6 +122,8 @@ with the same filename but different name
   <texture name="Checkbox_Press" file_name="widgets/Checkbox_Press.png" preload="true" />
   <texture name="Check_Mark" file_name="icons/check_mark.png" preload="true" />
 
+  <texture name="Checker" file_name="checker.png" preload="false" />
+  
   <texture name="Command_AboutLand_Icon"    file_name="toolbar_icons/land.png"         preload="true" />
   <texture name="Command_Appearance_Icon"   file_name="toolbar_icons/appearance.png"   preload="true" />
   <texture name="Command_Avatar_Icon"       file_name="toolbar_icons/avatars.png"      preload="true" />
@@ -137,6 +139,7 @@ with the same filename but different name
   <texture name="Command_MiniCart_Icon"     file_name="toolbar_icons/mini_cart.png"    preload="true" />
   <texture name="Command_MiniMap_Icon"      file_name="toolbar_icons/mini_map.png"     preload="true" />
   <texture name="Command_Move_Icon"         file_name="toolbar_icons/move.png"         preload="true" />
+  <texture name="Command_Outbox_Icon"       file_name="toolbar_icons/outbox.png"       preload="true" />
   <texture name="Command_People_Icon"       file_name="toolbar_icons/people.png"       preload="true" />
   <texture name="Command_Picks_Icon"        file_name="toolbar_icons/picks.png"        preload="true" />
   <texture name="Command_Places_Icon"       file_name="toolbar_icons/places.png"       preload="true" />
@@ -386,22 +389,9 @@ with the same filename but different name
   <texture name="OptionsMenu_Off" file_name="icons/OptionsMenu_Off.png" preload="false" />
   <texture name="OptionsMenu_Press" file_name="icons/OptionsMenu_Press.png" preload="false" />
 
-  <texture name="OutboxPush_Disabled" file_name="icons/OutboxPush_Disabled.png" preload="true" />
-  <texture name="OutboxPush_Off" file_name="icons/OutboxPush_Off.png" preload="true" />
-  <texture name="OutboxPush_On" file_name="icons/OutboxPush_On.png" preload="true" />
-  <texture name="OutboxPush_On_Over" file_name="icons/OutboxPush_On_Over.png" preload="true" />
-  <texture name="OutboxPush_Over" file_name="icons/OutboxPush_Over.png" preload="true" />
-  <texture name="OutboxPush_Press" file_name="icons/OutboxPush_Press.png" preload="true" />
-  <texture name="OutboxPush_Progress_1" file_name="icons/OutboxPush_Progress_1.png" preload="true" />
-  <texture name="OutboxPush_Progress_2" file_name="icons/OutboxPush_Progress_2.png" preload="true" />
-  <texture name="OutboxPush_Progress_3" file_name="icons/OutboxPush_Progress_3.png" preload="true" />
-  <texture name="OutboxPush_Progress_4" file_name="icons/OutboxPush_Progress_4.png" preload="true" />
-  <texture name="OutboxPush_Progress_5" file_name="icons/OutboxPush_Progress_5.png" preload="true" />
-  <texture name="OutboxPush_Progress_6" file_name="icons/OutboxPush_Progress_6.png" preload="true" />
-  <texture name="OutboxPush_Selected" file_name="icons/OutboxPush_Selected.png" preload="true" />
-  <texture name="OutboxPush_Selected_Disabled" file_name="icons/OutboxPush_Selected_Disabled.png" preload="true" />
-  <texture name="OutboxPush_Selected_Over" file_name="icons/OutboxPush_Selected_Over.png" preload="true" />
-  <texture name="OutboxPush_Selected_Press" file_name="icons/OutboxPush_Selected_Press.png" preload="true" />
+  <texture name="OutboxStatus_Success" file_name="green_checkmark.png" preload="false" />
+  <texture name="OutboxStatus_Warning" file_name="icons/pop_up_caution.png" preload="false" />
+  <texture name="OutboxStatus_Error" file_name="red_x.png" preload="false" />
 
   <texture name="PanOrbit_Off" file_name="bottomtray/PanOrbit_Off.png" preload="false" />
 
diff --git a/indra/newview/skins/default/textures/toolbar_icons/outbox.png b/indra/newview/skins/default/textures/toolbar_icons/outbox.png
new file mode 100644
index 0000000000000000000000000000000000000000..0f3db1c47c7861a8eb6e4337fde23357b17be16d
Binary files /dev/null and b/indra/newview/skins/default/textures/toolbar_icons/outbox.png differ
diff --git a/indra/newview/skins/default/xui/da/floater_buy_currency.xml b/indra/newview/skins/default/xui/da/floater_buy_currency.xml
index ec47b2f445b05f15d040bfee30e99d2a1a58b6df..3c0428b2b08437dbc0f515696ad81c7eae7e2288 100644
--- a/indra/newview/skins/default/xui/da/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/da/floater_buy_currency.xml
@@ -46,7 +46,7 @@
 		L$ [AMT]
 	</text>
 	<text name="currency_links">
-		[http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] | [http://www.secondlife.com/my/account/exchange_rates.php exchange rate]
+		[http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency]
 	</text>
 	<text name="exchange_rate_note">
 		Indtast beløbet for at se nyeste valutakurs.
diff --git a/indra/newview/skins/default/xui/da/floater_camera.xml b/indra/newview/skins/default/xui/da/floater_camera.xml
index 5b7ef6db5460f829908dfb6938e3a2172437f79c..b5d5e8bc084b00c21567ff64bf4eae9711d8b4a1 100644
--- a/indra/newview/skins/default/xui/da/floater_camera.xml
+++ b/indra/newview/skins/default/xui/da/floater_camera.xml
@@ -9,15 +9,6 @@
 	<floater.string name="move_tooltip">
 		Flyt kamera op og ned, til venstre og højre
 	</floater.string>
-	<floater.string name="camera_modes_title">
-		Kamera valg
-	</floater.string>
-	<floater.string name="pan_mode_title">
-		Kredsløb zoom panorering
-	</floater.string>
-	<floater.string name="presets_mode_title">
-		Forvalg
-	</floater.string>
 	<floater.string name="free_mode_title">
 		Se objekt
 	</floater.string>
diff --git a/indra/newview/skins/default/xui/da/menu_viewer.xml b/indra/newview/skins/default/xui/da/menu_viewer.xml
index c2f7d26dc974655c808ccaf21c77e98180693832..d695cd1f896c446899361f744610017d054bba3f 100644
--- a/indra/newview/skins/default/xui/da/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/da/menu_viewer.xml
@@ -20,8 +20,6 @@
 			<menu_item_call label="Væk" name="Set Away"/>
 			<menu_item_call label="Optaget" name="Set Busy"/>
 		</menu>
-		<menu_item_call label="Anmod om administrator status" name="Request Admin Options"/>
-		<menu_item_call label="Stop administrator status" name="Leave Admin Options"/>
 		<menu_item_call label="Afslut [APP_NAME]" name="Quit"/>
 	</menu>
 	<menu label="Kommunikér" name="Communicate">
@@ -36,11 +34,10 @@
 		<menu_item_check label="Søg" name="Search"/>
 		<menu_item_call label="Foto" name="Take Snapshot"/>
 		<menu_item_call label="Opret landemærke for dette sted" name="Create Landmark Here"/>
-		<menu label="Profil for sted" name="Land">
-			<menu_item_call label="Profil for sted" name="Place Profile"/>
-			<menu_item_call label="Om land" name="About Land"/>
-			<menu_item_call label="Region/Estate" name="Region/Estate"/>
-		</menu>
+		<menu_item_separator/>
+		<menu_item_call label="Profil for sted" name="Place Profile"/>
+		<menu_item_call label="Om land" name="About Land"/>
+		<menu_item_call label="Region/Estate" name="Region/Estate"/>
 		<menu_item_call label="Køb dette land" name="Buy Land"/>
 		<menu_item_call label="Mit land" name="My Land"/>
 		<menu label="Vis" name="LandShow">
@@ -56,7 +53,7 @@
 		</menu>
 		<menu_item_call label="Teleport hjem" name="Teleport Home"/>
 		<menu_item_call label="Sæt dette sted som &apos;Hjem&apos;" name="Set Home to Here"/>
-		<menu label="Sol" name="Environment Settings">
+		<menu label="Sol" name="Sun">
 			<menu_item_call label="Solopgang" name="Sunrise"/>
 			<menu_item_call label="Middag" name="Noon"/>
 			<menu_item_call label="Solnedgang" name="Sunset"/>
@@ -121,6 +118,7 @@
 			<menu_item_call label="Model..." name="Upload Model"/>
 			<menu_item_call label="Model Wizard..." name="Upload Model Wizard"/>
 			<menu_item_call label="Mange (L$[COST] pr. fil)..." name="Bulk Upload"/>
+			<menu_item_call label="Sæt standardværdier for upload rettigheder" name="perm prefs"/>
 		</menu>
 		<menu_item_call label="Fortyd" name="Undo"/>
 		<menu_item_call label="Gendan" name="Redo"/>
@@ -154,22 +152,22 @@
 			<menu_item_check label="Vis muse-sigte" name="ShowCrosshairs"/>
 		</menu>
 		<menu label="Gengivelsestyper" name="Rendering Types">
-			<menu_item_check label="Simpel" name="Simple"/>
-			<menu_item_check label="Alpha" name="Alpha"/>
-			<menu_item_check label="Træer" name="Tree"/>
-			<menu_item_check label="Avatarer" name="Character"/>
-			<menu_item_check label="Surface Patch" name="Surface Patch"/>
-			<menu_item_check label="Himmel" name="Sky"/>
-			<menu_item_check label="Vand" name="Water"/>
-			<menu_item_check label="Jord" name="Ground"/>
-			<menu_item_check label="Volume" name="Volume"/>
-			<menu_item_check label="Græs" name="Grass"/>
-			<menu_item_check label="Skyer" name="Clouds"/>
-			<menu_item_check label="Partikler" name="Particles"/>
-			<menu_item_check label="Bump" name="Bump"/>
+			<menu_item_check label="Simpel" name="Rendering Type Simple"/>
+			<menu_item_check label="Alpha" name="Rendering Type Alpha"/>
+			<menu_item_check label="Træer" name="Rendering Type Tree"/>
+			<menu_item_check label="Avatarer" name="Rendering Type Character"/>
+			<menu_item_check label="Surface Patch" name="Rendering Type Surface Patch"/>
+			<menu_item_check label="Himmel" name="Rendering Type Sky"/>
+			<menu_item_check label="Vand" name="Rendering Type Water"/>
+			<menu_item_check label="Jord" name="Rendering Type Ground"/>
+			<menu_item_check label="Volume" name="Rendering Type Volume"/>
+			<menu_item_check label="Græs" name="Rendering Type Grass"/>
+			<menu_item_check label="Skyer" name="Rendering Type Clouds"/>
+			<menu_item_check label="Partikler" name="Rendering Type Particles"/>
+			<menu_item_check label="Bump" name="Rendering Type Bump"/>
 		</menu>
 		<menu label="Gengivelsesegenskaber" name="Rendering Features">
-			<menu_item_check label="UI" name="UI"/>
+			<menu_item_check label="UI" name="ToggleUI"/>
 			<menu_item_check label="Valgte" name="Selected"/>
 			<menu_item_check label="Fremhævede" name="Highlighted"/>
 			<menu_item_check label="Dynamiske teksturer" name="Dynamic Textures"/>
@@ -181,10 +179,7 @@
 		<menu_item_call label="Tøm gruppe cache" name="ClearGroupCache"/>
 		<menu_item_check label="Muse udjævning" name="Mouse Smoothing"/>
 		<menu label="Shortcuts" name="Shortcuts">
-			<menu_item_call label="Billede (L$[COST])..." name="Upload Image"/>
-			<menu_item_check label="Søg" name="Search"/>
 			<menu_item_call label="Frigør taster" name="Release Keys"/>
-			<menu_item_call label="Sæt UI størrelse til standard" name="Set UI Size to Default"/>
 			<menu_item_check label="Vis avanceret menu (gammel genvej)" name="Show Advanced Menu - legacy shortcut"/>
 			<menu_item_call label="Luk vindue" name="Close Window"/>
 			<menu_item_call label="Luk alle vinduer" name="Close All Windows"/>
@@ -193,13 +188,6 @@
 			<menu_item_check label="&quot;Joystick Flycam&quot;" name="Joystick Flycam"/>
 			<menu_item_call label="Nulstil udsyn" name="Reset View"/>
 			<menu_item_call label="Se på den sidste der chattede" name="Look at Last Chatter"/>
-			<menu label="Vælg byggeværktøj" name="Select Tool">
-				<menu_item_call label="Fokuseringsværktøj" name="Focus"/>
-				<menu_item_call label="Flyt værktøj" name="Move"/>
-				<menu_item_call label="Redigeringsværktøj" name="Edit"/>
-				<menu_item_call label="Opret værktøj" name="Create"/>
-				<menu_item_call label="Land værktøj" name="Land"/>
-			</menu>
 			<menu_item_call label="Zoom ind" name="Zoom In"/>
 			<menu_item_call label="Zoom standard" name="Zoom Default"/>
 			<menu_item_call label="Zoom ud" name="Zoom Out"/>
@@ -275,9 +263,8 @@
 			<menu_item_call label="Mist en netværkspakke" name="Drop a Packet"/>
 		</menu>
 		<menu_item_call label="Stød, skub &amp; slag" name="Bumps, Pushes &amp;amp; Hits"/>
-		<menu label="Verden" name="World">
+		<menu label="Verden" name="DevelopWorld">
 			<menu_item_check label="Vælg anden sol end region" name="Sim Sun Override"/>
-			<menu_item_check label="Pejlelys blink effekt" name="Cheesy Beacon"/>
 			<menu_item_check label="Fast vejr" name="Fixed Weather"/>
 			<menu_item_call label="Dump Region Object Cache" name="Dump Region Object Cache"/>
 		</menu>
@@ -299,11 +286,11 @@
 		</menu>
 		<menu label="Avatar" name="Character">
 			<menu label="Grab Baked Texture" name="Grab Baked Texture">
-				<menu_item_call label="Iris" name="Iris"/>
-				<menu_item_call label="Hovede" name="Head"/>
-				<menu_item_call label="Overkrop" name="Upper Body"/>
-				<menu_item_call label="Underkrop" name="Lower Body"/>
-				<menu_item_call label="Nederdel" name="Skirt"/>
+				<menu_item_call label="Iris" name="Grab Iris"/>
+				<menu_item_call label="Hovede" name="Grab Head"/>
+				<menu_item_call label="Overkrop" name="Grab Upper Body"/>
+				<menu_item_call label="Underkrop" name="Grab Lower Body"/>
+				<menu_item_call label="Nederdel" name="Grab Skirt"/>
 			</menu>
 			<menu label="Avatar tests" name="Character Tests">
 				<menu_item_call label="Skift avatar geometri" name="Toggle Character Geometry"/>
@@ -325,8 +312,8 @@
 		<menu_item_check label="Vis administrationsmenu" name="View Admin Options"/>
 	</menu>
 	<menu label="Administrér" name="Admin">
-		<menu label="Object">
-			<menu_item_call label="Tag kopi" name="Take Copy"/>
+		<menu label="Object" name="AdminObject">
+			<menu_item_call label="Tag kopi" name="Admin Take Copy"/>
 			<menu_item_call label="Gennemtving ejer til mig" name="Force Owner To Me"/>
 			<menu_item_call label="Gennemtving ejer tolerance" name="Force Owner Permissive"/>
 			<menu_item_call label="Slet" name="Delete"/>
diff --git a/indra/newview/skins/default/xui/da/notifications.xml b/indra/newview/skins/default/xui/da/notifications.xml
index 3ccdfc036a79a0ca9fa04b311b207f50ad2211ae..cf6f1ccdd9f97563634a2301a8d7994fdccf3984 100644
--- a/indra/newview/skins/default/xui/da/notifications.xml
+++ b/indra/newview/skins/default/xui/da/notifications.xml
@@ -438,7 +438,7 @@ Tilbyd venskab til [NAME]?
 		</form>
 	</notification>
 	<notification name="RemoveFromFriends">
-		Ønsker du at fjerne [NAME] fra din venneliste?
+		Ønsker du at fjerne &lt;nolink&gt;[NAME]&lt;/nolink&gt; fra din venneliste?
 	</notification>
 	<notification name="ConfirmItemDeleteHasLinks">
 		Mindst en af genstandene har lænkede genstande der peger på den. Hvis du sletter denne genstand, vil lænkninger ikke virke mere.  Det anbefales kraftigt at fjerne lænkninger først.
@@ -1023,10 +1023,10 @@ Henvis til dette fra en hjemmeside for at give andre nem adgang til denne lokati
 		Erstattet manglende tøj/kropsdele med standard.
 	</notification>
 	<notification name="FriendOnline">
-		[NAME] er logget på
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; er logget på
 	</notification>
 	<notification name="FriendOffline">
-		[NAME] er logget af
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; er logget af
 	</notification>
 	<notification name="AddSelfFriend">
 		Selvom du nok er meget sød, kan du ikke tilføje dig selv som ven.
@@ -1404,10 +1404,10 @@ Prøv igen om lidt.
 (Som udgangspunkt, vil du være i stand til at se den andens online status)
 	</notification>
 	<notification name="FriendshipAccepted">
-		[NAME] accepterede dit tilbud om venskab.
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; accepterede dit tilbud om venskab.
 	</notification>
 	<notification name="FriendshipDeclined">
-		[NAME] afviste dit tilbud om venskab.
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; afviste dit tilbud om venskab.
 	</notification>
 	<notification name="FriendshipAcceptedByMe">
 		Tilbud om venskab accepteret.
diff --git a/indra/newview/skins/default/xui/da/panel_my_profile.xml b/indra/newview/skins/default/xui/da/panel_my_profile.xml
deleted file mode 100644
index 94da58389f2cc8d1f65a95a10045f7a8f0599daf..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/da/panel_my_profile.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Profil" name="panel_profile">
-	<string name="no_partner_text" value="Ingen"/>
-	<string name="no_group_text" value="Ingen"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="scroll_content_panel">
-					<panel name="second_life_image_panel">
-						<text name="display_name_descr_text">
-							Brugernavn
-						</text>
-						<text name="name_descr_text">
-							Visningsnavn
-						</text>
-						<button label="Profil" name="see_profile_btn" tool_tip="Se profil for denne avatar"/>
-					</panel>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_notes.xml b/indra/newview/skins/default/xui/da/panel_notes.xml
deleted file mode 100644
index 7d8097f6ffeea0b60b15a569199bfd2f5e243434..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/da/panel_notes.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Noter &amp; Privatliv" name="panel_notes">
-	<layout_stack name="layout">
-		<layout_panel name="notes_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<text name="status_message" value="Min private noter:"/>
-					<text name="status_message2" value="Tillad denne person at:"/>
-					<check_box label="Se min online status" name="status_check"/>
-					<check_box label="Se mig på kortet" name="map_check"/>
-					<check_box label="Editére, slette og tage mine objekter" name="objects_check"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-		<layout_panel name="notes_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="Tilføj ven" name="add_friend" tool_tip="Tilbyd venskab til beboer"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="IM" name="im" tool_tip="Ã…ben session med personlige beskeder"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="Opkald" name="call" tool_tip="Opkald til denne beboer"/>
-				</layout_panel>
-				<layout_panel name="show_on_map_btn_lp">
-					<button label="Kort" name="show_on_map_btn" tool_tip="Vis denne beboer på kortet"/>
-				</layout_panel>
-				<layout_panel name="teleport_btn_lp">
-					<button label="Teleportér" name="teleport" tool_tip="Tilbyd teleport"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_profile.xml b/indra/newview/skins/default/xui/da/panel_profile.xml
deleted file mode 100644
index db85eb23a840822a0aae5d36b17a9374091cdc8f..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/da/panel_profile.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Profil" name="panel_profile">
-	<string name="no_partner_text" value="Ingen"/>
-	<string name="no_group_text" value="Ingen"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<panel name="second_life_image_panel">
-						<text name="title_sl_descr_text" value="[SECOND_LIFE]:"/>
-					</panel>
-					<panel name="first_life_image_panel">
-						<text name="title_rw_descr_text" value="Real World:"/>
-					</panel>
-					<text name="title_member_text" value="Beboer siden:"/>
-					<text name="title_acc_status_text" value="Konto status:"/>
-					<text name="title_partner_text" value="Partner:"/>
-					<panel name="partner_data_panel">
-						<text initial_value="(henter)" name="partner_text"/>
-					</panel>
-					<text name="title_groups_text" value="Grupper:"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-	<layout_stack name="layout_verb_buttons">
-		<layout_panel name="profile_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="Tilføj ven" name="add_friend" tool_tip="Tilbyd venskab til beboeren"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="Personlig besked" name="im" tool_tip="Ã…ben session med personlig besked"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="Opkald" name="call" tool_tip="Opkald til denne beboer"/>
-				</layout_panel>
-				<layout_panel name="chat_btn_lp">
-					<button label="Teleportér" name="teleport" tool_tip="Tilbyd teleport"/>
-				</layout_panel>
-				<layout_panel name="overflow_btn_lp">
-					<menu_button label="â–¼" name="overflow_btn" tool_tip="Betal eller del beholdning med denne beboer"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-		<layout_panel name="profile_me_buttons_panel">
-			<button label="Redigér profil" name="edit_profile_btn" tool_tip="Redigér din personlige information"/>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_profile_view.xml b/indra/newview/skins/default/xui/da/panel_profile_view.xml
deleted file mode 100644
index e6e8ca4d1027e99071f52ef0417ab12d7b45a3ea..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/da/panel_profile_view.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel name="panel_target_profile">
-	<string name="status_online">
-		Online
-	</string>
-	<string name="status_offline">
-		Offline
-	</string>
-	<text name="display_name_label" value="Visningsnavn:"/>
-	<text name="solo_username_label" value="Brugernavn:"/>
-	<text name="status" value="Online"/>
-	<text name="user_name_small" value="Se på mig med dette enormt ekstremt super lange navn"/>
-	<button name="copy_to_clipboard" tool_tip="Kopiér til udskriftsholder"/>
-	<text name="user_label" value="Brugernavn:"/>
-	<tab_container name="tabs">
-		<panel label="PROFIL" name="panel_profile"/>
-		<panel label="FAVORITTER" name="panel_picks"/>
-		<panel label="NOTER &amp; PRIVATLIV" name="panel_notes"/>
-	</tab_container>
-</panel>
diff --git a/indra/newview/skins/default/xui/da/strings.xml b/indra/newview/skins/default/xui/da/strings.xml
index 165d47c931b994bd5532d79d2c86e51fa6c7cdda..11d100eeff5442c64af52f205be0c858a11f0dfb 100644
--- a/indra/newview/skins/default/xui/da/strings.xml
+++ b/indra/newview/skins/default/xui/da/strings.xml
@@ -560,6 +560,9 @@ Prøv venligst om lidt igen.
 	<string name="mesh">
 		mesh
 	</string>
+	<string name="AvatarEditingAppearance">
+		(Redigering Udseende)
+	</string>
 	<string name="AvatarAway">
 		Væk
 	</string>
diff --git a/indra/newview/skins/default/xui/de/floater_about.xml b/indra/newview/skins/default/xui/de/floater_about.xml
index 145cc1e30bb4edd23b0b3e6a0e9ce5494e8b264b..b4c28daac99e178055ed974ad250dc4410543ed5 100644
--- a/indra/newview/skins/default/xui/de/floater_about.xml
+++ b/indra/newview/skins/default/xui/de/floater_about.xml
@@ -67,32 +67,34 @@ Voice-Serverversion: [VOICE_VERSION]
 		<panel label="Lizenzen" name="licenses_panel">
 			<text_editor name="credits_editor">
 				3Dconnexion SDK Copyright (C) 1992-2007 3Dconnexion.
-APR Copyright (C) 2000-2004 The Apache Software Foundation.
-Collada DOM Copyright 2005 Sony Computer Entertainment Inc.
-cURL Copyright (C) 1996-2002, Daniel Stenberg (daniel@haxx.se).
-DBus/dbus-glib Copyright (C) 2002, 2003  CodeFactory AB / Copyright (C) 2003, 2004 Red Hat, Inc.
-expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
-FreeType Copyright (C) 1996-2002, The FreeType Project (www.freetype.org).
-GL Copyright (C) 1999-2004 Brian Paul.
-GLOD Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University sowie David Luebke, Brenden Schubert, University of Virginia.
-google-perftools Copyright (c) 2005, Google Inc.
-Havok.com(TM) Copyright (C) 1999-2001, Telekinesys Research Limited.
-jpeg2000 Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW).
-jpeglib Copyright (C) 1991-1998, Thomas G. Lane.
-ogg/vorbis Copyright (C) 2001, Xiphophorus.
-OpenSSL Copyright (C) 1998-2002 The OpenSSL Project.
-PCRE Copyright (c) 1997-2008 University of Cambridge.
-SDL Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga.
-SSLeay Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com).
-xmlrpc-epi Copyright (C) 2000 Epinions, Inc.
-zlib Copyright (C) 1995-2002 Jean-loup Gailly und Mark Adler.
-google-perftools Copyright (c) 2005, Google Inc.
+        APR Copyright (C) 2000-2004 The Apache Software Foundation.
+        Collada DOM Copyright 2005 Sony Computer Entertainment Inc.
+        cURL Copyright (C) 1996-2002, Daniel Stenberg (daniel@haxx.se).
+        DBus/dbus-glib Copyright (C) 2002, 2003  CodeFactory AB / Copyright (C) 2003, 2004 Red Hat, Inc.
+        expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
+        FreeType Copyright (C) 1996-2002, The FreeType Project (www.freetype.org).
+        GL Copyright (C) 1999-2004 Brian Paul.
+        GLOD Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University sowie David Luebke, Brenden Schubert, University of Virginia.
+        google-perftools Copyright (c) 2005, Google Inc.
+        Havok.com(TM) Copyright (C) 1999-2001, Telekinesys Research Limited.
+        jpeg2000 Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW).
+        jpeglib Copyright (C) 1991-1998, Thomas G. Lane.
+        ogg/vorbis Copyright (C) 2001, Xiphophorus.
+        OpenSSL Copyright (C) 1998-2002 The OpenSSL Project.
+        PCRE Copyright (c) 1997-2008 University of Cambridge.
+        SDL Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga.
+        SSLeay Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com).
+        xmlrpc-epi Copyright (C) 2000 Epinions, Inc.
+        zlib Copyright (C) 1995-2002 Jean-loup Gailly und Mark Adler.
+        google-perftools Copyright (c) 2005, Google Inc.
 
-Second Life Viewer verwendet Havok (TM) Physics. (c)Copyright 1999-2010 Havok.com Inc. (und Lizenzgeber). Alle Rechte vorbehalten. Details siehe www.havok.com.
+        Second Life Viewer verwendet Havok (TM) Physics. (c)Copyright 1999-2010 Havok.com Inc. (und Lizenzgeber). Alle Rechte vorbehalten. Details siehe www.havok.com.
 
-Alle Rechte vorbehalten.  Details siehe licenses.txt.
+        Diese Software enthält von der NVIDIA Corporation bereitgestellten Quellcode.
 
-Audiocodierung für Voice-Chat: Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C)
+        Alle Rechte vorbehalten.  Details siehe licenses.txt.
+
+        Audiocodierung für Voice-Chat: Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C)
 			</text_editor>
 		</panel>
 	</tab_container>
diff --git a/indra/newview/skins/default/xui/de/floater_about_land.xml b/indra/newview/skins/default/xui/de/floater_about_land.xml
index 3cf3a162470719c4f5cdbd3fcf18e41aabb3122f..9e330f97662d148798134fb959da65e0c7ad1b52 100644
--- a/indra/newview/skins/default/xui/de/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/de/floater_about_land.xml
@@ -130,7 +130,7 @@
 				Traffic:
 			</text>
 			<text name="DwellText">
-				0
+				Laden...
 			</text>
 			<button label="Land kaufen" label_selected="Land kaufen..." name="Buy Land..."/>
 			<button label="Linden-Verkauf" label_selected="Linden-Verkauf..." name="Linden Sale..." tool_tip="Land muss Eigentum und auf Inhalt gesetzt sein und nicht zur Auktion stehen."/>
@@ -310,13 +310,15 @@ Nur große Parzellen können in der Suche aufgeführt werden.
 				Kein Stoßen (regional)
 			</panel.string>
 			<panel.string name="see_avs_text">
-				Auf dieser Parzelle Einwohner sehen und mit ihnen chatten
+				Avatare auf anderen Parzellen können
 			</panel.string>
 			<text name="allow_label">
 				Anderen Einwohnern gestatten:
 			</text>
-			<check_box label="Terrain bearbeiten" name="edit land check" tool_tip="Falls aktiviert, kann jeder Ihr Land terraformen. Am besten ist es, wenn Sie diese Option deaktiviert lassen. Sie können Ihr eigenes Land jederzeit bearbeiten."/>
-			<check_box label="Fliegen" name="check fly" tool_tip="Falls aktiviert, können Einwohner auf Ihrem Land fliegen. Falls nicht aktiviert, können Einwohner lediglich auf Ihr Land fliegen und dort landen (dann jedoch nicht wieder weiterfliegen) oder über Ihr Land hinweg fliegen."/>
+			<text name="allow_label0">
+				Fliegen:
+			</text>
+			<check_box label="Jeder" name="check fly" tool_tip="Falls aktiviert, können Einwohner auf Ihrem Land fliegen. Falls nicht aktiviert, können Einwohner lediglich auf Ihr Land fliegen und dort landen (dann jedoch nicht wieder weiterfliegen) oder über Ihr Land hinweg fliegen."/>
 			<text name="allow_label2">
 				Bauen:
 			</text>
@@ -332,9 +334,6 @@ Nur große Parzellen können in der Suche aufgeführt werden.
 			</text>
 			<check_box label="Jeder" name="check other scripts"/>
 			<check_box label="Gruppe" name="check group scripts"/>
-			<text name="land_options_label">
-				Landoptionen:
-			</text>
 			<check_box label="Sicher (kein Schaden)" name="check safe" tool_tip="Falls aktiviert, wird Land auf Option „Sicher“ eingestellt, Kampfschäden sind deaktiviert. Ansonsten sind Kampfschäden aktiviert."/>
 			<check_box label="Kein Stoßen" name="PushRestrictCheck" tool_tip="Verhindert Stoßen durch Skripte. Durch Aktivieren dieser Option verhindern Sie störendes Verhalten auf Ihrem Land."/>
 			<check_box label="Ort in Suche anzeigen (30 L$/Woche)" name="ShowDirectoryCheck" tool_tip="Diese Parzelle in Suchergebnissen anzeigen."/>
@@ -375,9 +374,9 @@ Nur große Parzellen können in der Suche aufgeführt werden.
 			</text>
 			<texture_picker label="" name="snapshot_ctrl" tool_tip="Klicken Sie hier, um ein Bild auszuwählen"/>
 			<text name="allow_label5">
-				Einwohnern auf anderen Parzellen Folgendes gestatten:
+				Avatare in anderen Parzellen können Avatare in dieser Parzelle sehen und mit ihnen chatten
 			</text>
-			<check_box label="Avatare sehen" name="SeeAvatarsCheck" tool_tip="Gestattet sowohl Einwohnern auf anderen Parzellen, Einwohner auf dieser Parzelle zu sehen und mit ihnen zu chatten, als auch Ihnen, diese Einwohner auf anderen Parzellen zu sehen und mit ihnen zu chatten."/>
+			<check_box label="Avatare sehen" name="SeeAvatarsCheck" tool_tip="Gestattet sowohl Avataren auf anderen Parzellen, Avatare auf dieser Parzelle zu sehen und mit ihnen zu chatten, als auch Ihnen, diese Avatare auf anderen Parzellen zu sehen und mit ihnen zu chatten."/>
 			<text name="landing_point">
 				Landepunkt: [LANDING]
 			</text>
@@ -459,12 +458,12 @@ Nur große Parzellen können in der Suche aufgeführt werden.
 			<text name="Limit access to this parcel to:">
 				Zugang zu dieser Parzelle
 			</text>
-			<check_box label="Öffentlichen Zugang erlauben [MATURITY]" name="public_access"/>
+			<check_box label="Öffentlichen Zugang gestatten (bei Deaktivierung dieser Option werden Bannlinien generiert)" name="public_access"/>
 			<text name="Only Allow" width="400">
-				Zugang auf Einwohner beschränken, die überprüft wurden von:
+				Zugang nur Einwohnern gestatten, die:
 			</text>
-			<check_box label="Zahlungsinformation gespeichert [ESTATE_PAYMENT_LIMIT]" name="limit_payment" tool_tip="Einwohner ohne Zahlungsinformation nicht zulassen."/>
-			<check_box label="Altersüberprüfung [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="Einwohner ohne Altersüberprüfung nicht zulassen. Weitere Informationen finden Sie im [SUPPORT_SITE]."/>
+			<check_box label="Zahlungsinformationen hinterlegt haben [ESTATE_PAYMENT_LIMIT]" name="limit_payment" tool_tip="Um diese Parzelle besuchen zu können, müssen Einwohner Zahlungsinformationen hinterlegt haben. Weitere Informationen finden Sie auf [SUPPORT_SITE]."/>
+			<check_box label="ihr Alter bestätigt haben [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="Um diese Parzelle besuchen zu können, müssen Einwohner ihr Alter bestätigt haben. Weitere Informationen finden Sie auf [SUPPORT_SITE]."/>
 			<check_box label="Gruppenzugang erlauben: [GROUP]" name="GroupCheck" tool_tip="Gruppe im Register „Allgemein“ festlegen."/>
 			<check_box label="Pässe verkaufen an:" name="PassCheck" tool_tip="Ermöglicht befristeten Zugang zu dieser Parzelle"/>
 			<combo_box name="pass_combo">
diff --git a/indra/newview/skins/default/xui/de/floater_animation_anim_preview.xml b/indra/newview/skins/default/xui/de/floater_animation_anim_preview.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3dc554b1202513a35110a0cbe34cf6ab2c0f1172
--- /dev/null
+++ b/indra/newview/skins/default/xui/de/floater_animation_anim_preview.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Anim Preview" title="ANIMATION.ANIM">
+	<text name="name_label">
+		Name:
+	</text>
+	<text name="description_label">
+		Beschreibung:
+	</text>
+	<button label="Hochladen (L$ [AMOUNT])" name="ok_btn"/>
+	<button label="Abbrechen" label_selected="Abbrechen" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/de/floater_animation_bvh_preview.xml b/indra/newview/skins/default/xui/de/floater_animation_bvh_preview.xml
new file mode 100644
index 0000000000000000000000000000000000000000..9a6f5e016694ad96673d26ee038f56393e38423a
--- /dev/null
+++ b/indra/newview/skins/default/xui/de/floater_animation_bvh_preview.xml
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Animation Preview">
+	<floater.string name="failed_to_initialize">
+		Bewegung konnte nicht initialisiert werden
+	</floater.string>
+	<floater.string name="anim_too_long">
+		Animationsdatei ist [LENGTH] Sekunden lang.
+
+Maximal erlaubt sind [MAX_LENGTH] Sekunden.
+	</floater.string>
+	<floater.string name="failed_file_read">
+		Animationsdatei kann nicht gelesen werden.
+
+[STATUS]
+	</floater.string>
+	<floater.string name="E_ST_OK">
+		OK
+	</floater.string>
+	<floater.string name="E_ST_EOF">
+		Vorzeitiges Dateiende.
+	</floater.string>
+	<floater.string name="E_ST_NO_CONSTRAINT">
+		Constraint-Definition kann nicht gelesen werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_FILE">
+		BVH-Datei kann nicht geöffnet werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_HIER">
+		Ungültige HIERARCHY-Kopfzeile.
+	</floater.string>
+	<floater.string name="E_ST_NO_JOINT">
+		ROOT oder JOINT nicht gefunden.
+	</floater.string>
+	<floater.string name="E_ST_NO_NAME">
+		JOINT-Name nicht erfasst.
+	</floater.string>
+	<floater.string name="E_ST_NO_OFFSET">
+		OFFSET nicht gefunden.
+	</floater.string>
+	<floater.string name="E_ST_NO_CHANNELS">
+		CHANNELS nicht gefunden.
+	</floater.string>
+	<floater.string name="E_ST_NO_ROTATION">
+		Rotationsreihenfolge kann nicht erfasst werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_AXIS">
+		Rotationsachse kann nicht erfasst werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_MOTION">
+		MOTION nicht gefunden.
+	</floater.string>
+	<floater.string name="E_ST_NO_FRAMES">
+		Anzahl der Bilder kann nicht erfasst werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_FRAME_TIME">
+		Bildzeit kann nicht erfasst werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_POS">
+		Positionswerte können nicht erfasst werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_ROT">
+		Rotationswerte können nicht erfasst werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_FILE">
+		Transformationsdatei kann nicht geöffnet werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_HEADER">
+		Transformationskopfzeile kann nicht gelesen werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_NAME">
+		Transformationsnamen können nicht gelesen werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_IGNORE">
+		Ignorieren-Transformationswert kann nicht gelesen werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_RELATIVE">
+		Relativer Transformationswert kann nicht gelesen werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_OUTNAME">
+		Outname-Transformationswert kann nicht gelesen werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MATRIX">
+		Transformationsmatrix kann nicht gelesen werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MERGECHILD">
+		Mergechild-Name kann nicht erfasst werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MERGEPARENT">
+		Mergeparent-Name kann nicht erfasst werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_PRIORITY">
+		Priority-Wert kann nicht erfasst werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_LOOP">
+		Loop-Wert kann nicht erfasst werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EASEIN">
+		EaseIn-Werte können nicht erfasst werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EASEOUT">
+		EaseOut-Werte können nicht erfasst werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_HAND">
+		Hand-Morph-Wert kann nicht erfasst werden.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EMOTE">
+		Emote-Name kann nicht gelesen werden.
+	</floater.string>
+	<floater.string name="E_ST_BAD_ROOT">
+		Falscher Root-Joint-Name, „hip“ verwenden.
+	</floater.string>
+	<text name="name_label">
+		Name:
+	</text>
+	<text name="description_label">
+		Beschreibung:
+	</text>
+	<spinner label="Priorität" name="priority" tool_tip="Steuert, welche Animationen von dieser Animation überschrieben werden können"/>
+	<check_box label="Schleife" name="loop_check" tool_tip="Erzeugt eine Animationsschleife"/>
+	<spinner label="Ein (%)" name="loop_in_point" tool_tip="Anfang einer Animationsschleife festlegen"/>
+	<spinner label="Aus (%)" name="loop_out_point" tool_tip="Ende einer Animationsschleife festlegen"/>
+	<text name="hand_label">
+		Handhaltung
+	</text>
+	<combo_box name="hand_pose_combo" tool_tip="Steuert während der Animation die Bewegung der Hände">
+		<combo_box.item label="Dehnen" name="Spread"/>
+		<combo_box.item label="Entspannt" name="Relaxed"/>
+		<combo_box.item label="Beide zeigen" name="PointBoth"/>
+		<combo_box.item label="Faust" name="Fist"/>
+		<combo_box.item label="Links entspannt" name="RelaxedLeft"/>
+		<combo_box.item label="Nach links zeigen" name="PointLeft"/>
+		<combo_box.item label="Linke Faust" name="FistLeft"/>
+		<combo_box.item label="Rechts entspannt" name="RelaxedRight"/>
+		<combo_box.item label="Nach rechts zeigen" name="PointRight"/>
+		<combo_box.item label="Rechte Faust" name="FistRight"/>
+		<combo_box.item label="Rechts salutieren" name="SaluteRight"/>
+		<combo_box.item label="Tippen" name="Typing"/>
+		<combo_box.item label="Friedensgeste rechts" name="PeaceRight"/>
+	</combo_box>
+	<text name="emote_label">
+		Ausdruck
+	</text>
+	<combo_box name="emote_combo" tool_tip="Steuert Gesichtsregungen während der Animation">
+		<item label="(Keine)" name="[None]" value=""/>
+		<item label="Aaaaah" name="Aaaaah" value="Aaaaah"/>
+		<item label="Ängstlich" name="Afraid" value="Ängstlich"/>
+		<item label="Verärgert" name="Angry" value="Verärgert"/>
+		<item label="Grinst" name="BigSmile" value="Grinst"/>
+		<item label="Gelangweilt" name="Bored" value="Gelangweilt"/>
+		<item label="Weinen" name="Cry" value="Weinen"/>
+		<item label="Verachtung" name="Disdain" value="Verachtung"/>
+		<item label="Verlegen" name="Embarrassed" value="Verlegen"/>
+		<item label="Stirnrunzeln" name="Frown" value="Stirnrunzeln"/>
+		<item label="Küssen" name="Kiss" value="Küssen"/>
+		<item label="Lachen" name="Laugh" value="Lachen"/>
+		<item label="Bäääh" name="Plllppt" value="Bäääh"/>
+		<item label="Angewidert" name="Repulsed" value="Angewidert"/>
+		<item label="Traurig" name="Sad" value="Traurig"/>
+		<item label="Achselzucken" name="Shrug" value="Achselzucken"/>
+		<item label="Lächeln" name="Smile" value="Lächeln"/>
+		<item label="Ãœberraschung" name="Surprise" value="Ãœberraschung"/>
+		<item label="Zwinkern" name="Wink" value="Zwinkern"/>
+		<item label="Sorgenvoll" name="Worry" value="Sorgenvoll"/>
+	</combo_box>
+	<text name="preview_label">
+		Vorschau während:
+	</text>
+	<combo_box name="preview_base_anim" tool_tip="Hiermit können Sie das Verhalten Ihres Avatars testen, während Ihr Avatar normale Bewegungen ausführt.">
+		<item label="Stehen" name="Standing" value="Stehen"/>
+		<item label="Gehen" name="Walking" value="Gehen"/>
+		<item label="Sitzen" name="Sitting" value="Sitzen"/>
+		<item label="Fliegen" name="Flying" value="Fliegen"/>
+	</combo_box>
+	<spinner label="Einblenden (s)" name="ease_in_time" tool_tip="Einblendungszeit für Animationen (in Sekunden)"/>
+	<spinner label="Ausblenden (s)" name="ease_out_time" tool_tip="Ausblendungszeit für Animationen (in Sekunden)"/>
+	<button name="play_btn" tool_tip="Animation abspielen"/>
+	<button name="pause_btn" tool_tip="Animation unterbrechen"/>
+	<button name="stop_btn" tool_tip="Animation anhalten"/>
+	<text name="bad_animation_text">
+		Animationsdatei kann nicht gelesen werden.
+
+Wir empfehlen exportierte BVH-Dateien aus Poser 4.
+	</text>
+	<button label="Hochladen (L$ [AMOUNT])" name="ok_btn"/>
+	<button label="Abbrechen" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/de/floater_avatar.xml b/indra/newview/skins/default/xui/de/floater_avatar.xml
index 1470c4bcd6b2c38205dabcd48415d84407f71080..ba0dd54d96e717e7073f8524d002939cfc13652b 100644
--- a/indra/newview/skins/default/xui/de/floater_avatar.xml
+++ b/indra/newview/skins/default/xui/de/floater_avatar.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Avatar" title="AVATAR-AUSWAHL"/>
+<floater name="Avatar" title="AVATAR AUSWÄHLEN"/>
diff --git a/indra/newview/skins/default/xui/de/floater_buy_currency.xml b/indra/newview/skins/default/xui/de/floater_buy_currency.xml
index 38321b79065bbe8ee41b6ebc74d2e2fbedcaf609..65926c088c72f5cb79029aee713563129711d2d7 100644
--- a/indra/newview/skins/default/xui/de/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/de/floater_buy_currency.xml
@@ -46,7 +46,7 @@
 		[AMT] L$
 	</text>
 	<text name="currency_links">
-		[http://www.secondlife.com/my/account/payment_method_management.php?lang=de-DE Zahlungsart] | [http://www.secondlife.com/my/account/currency.php?lang=de-DE Währung] | [http://www.secondlife.com/my/account/exchange_rates.php?lang=de-DE Umtauschrate]
+		[http://www.secondlife.com/my/account/payment_method_management.php Zahlungsart] | [http://www.secondlife.com/my/account/currency.php Währung]
 	</text>
 	<text name="exchange_rate_note">
 		Geben Sie den Betrag erneut ein, um die aktuellste Umtauschrate anzuzeigen.
diff --git a/indra/newview/skins/default/xui/de/floater_camera.xml b/indra/newview/skins/default/xui/de/floater_camera.xml
index bbf1c8af6001f8b7f7d49d6c9b86b58b731927c5..163ef87d8c18d3e1c82de94b52709aa2918aa276 100644
--- a/indra/newview/skins/default/xui/de/floater_camera.xml
+++ b/indra/newview/skins/default/xui/de/floater_camera.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="camera_floater" title="ANSICHT">
+<floater name="camera_floater" title="KAMERASTEUERUNGEN">
 	<floater.string name="rotate_tooltip">
 		Kamera um Fokus drehen
 	</floater.string>
@@ -9,15 +9,6 @@
 	<floater.string name="move_tooltip">
 		Kamera nach oben, unten, links und rechts bewegen
 	</floater.string>
-	<floater.string name="camera_modes_title">
-		Kameramodi
-	</floater.string>
-	<floater.string name="pan_mode_title">
-		Kreisen - Zoomen - Schwenken
-	</floater.string>
-	<floater.string name="presets_mode_title">
-		Ansichten
-	</floater.string>
 	<floater.string name="free_mode_title">
 		Objekt ansehen
 	</floater.string>
diff --git a/indra/newview/skins/default/xui/de/floater_chat_bar.xml b/indra/newview/skins/default/xui/de/floater_chat_bar.xml
index dc5a7cd681993a38059af9d54ca484db45a04dfc..2464a55665e48235b9741c54dc52048806046b0f 100644
--- a/indra/newview/skins/default/xui/de/floater_chat_bar.xml
+++ b/indra/newview/skins/default/xui/de/floater_chat_bar.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="chat_bar" title="CHAT IN DER NÄHE">
-	<panel>
+	<panel name="bottom_panel">
 		<line_editor label="Zum Chatten hier klicken." name="chat_box" tool_tip="Eingabetaste zum Sprechen, Strg+Eingabe zum Rufen"/>
 		<button name="show_nearby_chat" tool_tip="Chatprotokoll in der Nähe ein-/ausblenden"/>
 	</panel>
diff --git a/indra/newview/skins/default/xui/de/floater_hardware_settings.xml b/indra/newview/skins/default/xui/de/floater_hardware_settings.xml
index 9644bbbaea307524faf16aef7d51d8d696b556f8..ca081aafae842d59710dbbff2ece273cdd9c4b12 100644
--- a/indra/newview/skins/default/xui/de/floater_hardware_settings.xml
+++ b/indra/newview/skins/default/xui/de/floater_hardware_settings.xml
@@ -4,7 +4,7 @@
 		Filtern:
 	</text>
 	<check_box label="Anisotropische Filterung (langsamer, wenn aktiviert)" name="ani"/>
-	<text name="Antialiasing:">
+	<text name="antialiasing label">
 		Antialiasing:
 	</text>
 	<combo_box label="Antialiasing" name="fsaa">
diff --git a/indra/newview/skins/default/xui/de/floater_merchant_outbox.xml b/indra/newview/skins/default/xui/de/floater_merchant_outbox.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a412b530a40f4175a5e2ec1c7e8e263ed35551c5
--- /dev/null
+++ b/indra/newview/skins/default/xui/de/floater_merchant_outbox.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_merchant_outbox" title="HÄNDLER-OUTBOX">
+	<string name="OutboxFolderCount1">
+		1 Ordner
+	</string>
+	<string name="OutboxFolderCountN">
+		[NUM] Ordner
+	</string>
+	<string name="OutboxImporting">
+		Ordner übertragen...
+	</string>
+	<string name="OutboxInitializing">
+		Initialisieren...
+	</string>
+	<panel label="">
+		<panel>
+			<panel name="outbox_inventory_placeholder_panel">
+				<text name="outbox_inventory_placeholder_title">
+					Laden...
+				</text>
+			</panel>
+		</panel>
+		<panel>
+			<button label="In Marktplatz übertragen" name="outbox_import_btn" tool_tip="In meinen Marktplatz-Laden verschieben"/>
+		</panel>
+	</panel>
+</floater>
diff --git a/indra/newview/skins/default/xui/de/floater_model_preview.xml b/indra/newview/skins/default/xui/de/floater_model_preview.xml
index 7f6cd9944f278d121f9587c0c034505f2d343f39..4af8d67686fcad5fd6d8c4985e03288032642404 100644
--- a/indra/newview/skins/default/xui/de/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/de/floater_model_preview.xml
@@ -4,6 +4,9 @@
 	<string name="status_parse_error">
 		Fehler: Fehler beim DAE-Parsen – Details siehe Protokoll.
 	</string>
+	<string name="status_material_mismatch">
+		Fehler: Das Material des Modells ist keine Teilmenge des Referenzmodells.
+	</string>
 	<string name="status_reading_file">
 		Laden...
 	</string>
@@ -137,7 +140,7 @@
 				</panel>
 				<panel name="physics analysis">
 					<text name="method_label">
-						Schritt 2: Analyse
+						Schritt 2: Analysieren
 					</text>
 					<text name="analysis_method_label">
 						Methode:
diff --git a/indra/newview/skins/default/xui/de/floater_model_wizard.xml b/indra/newview/skins/default/xui/de/floater_model_wizard.xml
index 354a505901c47c72f516f21905db0fe4f91a3109..ee26d51d32e288308ef9e93b4f4e9f2b2c48c1b3 100644
--- a/indra/newview/skins/default/xui/de/floater_model_wizard.xml
+++ b/indra/newview/skins/default/xui/de/floater_model_wizard.xml
@@ -6,12 +6,12 @@
 	<button label="2. Optimieren" name="optimize_btn"/>
 	<button label="1. Datei auswählen" name="choose_file_btn"/>
 	<panel name="choose_file_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="choose_file_header_panel">
+			<text name="choose_file_header_text">
 				Modelldatei auswählen
 			</text>
 		</panel>
-		<panel name="content">
+		<panel name="choose_file_content">
 			<text name="advanced_users_text">
 				Fortgeschrittene Benutzer: Wenn Sie bereits mit Tools zur Erstellung von 3D-Inhalten vertraut sind, können Sie den erweiterten Uploader verwenden.
 			</text>
@@ -20,6 +20,9 @@
 				Hochzuladende Modelldatei auswählen
 			</text>
 			<button label="Durchsuchen..." label_selected="Durchsuchen..." name="browse"/>
+			<text name="Model types">
+				Second Life unterstützt COLLADA-Dateien (.dae).
+			</text>
 			<text name="dimensions">
 				X         Y         Z
 			</text>
@@ -32,26 +35,26 @@
 		</panel>
 	</panel>
 	<panel name="optimize_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="optimize_header_panel">
+			<text name="optimize_header_text">
 				Modell optimieren
 			</text>
 		</panel>
-		<text name="description">
+		<text name="optimize_description">
 			Wir haben das Modell auf Leistung optimiert. Sie können es bei Bedarf weiter anpassen.
 		</text>
-		<panel name="content">
+		<panel name="optimize_content">
 			<text name="high_detail_text">
-				Detailstufe generieren: Hoch
+				Detailstufe generieren: hoch
 			</text>
 			<text name="medium_detail_text">
-				Detailstufe generieren: Mittel
+				Detailstufe generieren: mittel
 			</text>
 			<text name="low_detail_text">
-				Detailstufe generieren: Niedrig
+				Detailstufe generieren: niedrig
 			</text>
 			<text name="lowest_detail_text">
-				Detailstufe generieren: Niedrigste
+				Detailstufe generieren: niedrigste
 			</text>
 		</panel>
 		<panel name="content2">
@@ -76,15 +79,15 @@
 		</panel>
 	</panel>
 	<panel name="physics_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="physics_header_panel">
+			<text name="physics_header_text">
 				Physik anpassen
 			</text>
 		</panel>
-		<text name="description">
+		<text name="physics_description">
 			Wir erstellen eine Form für die Außenhülle des Modells. Passen Sie die Detailstufe der Form wie für den beabsichtigten Zweck erforderlich an.
 		</text>
-		<panel name="content">
+		<panel name="physics_content">
 			<button label="Physik neu berechnen" name="recalculate_physics_btn"/>
 			<button label="Neu berechnen..." name="recalculating_physics_btn"/>
 			<text name="lod_label">
@@ -107,17 +110,17 @@
 		</panel>
 	</panel>
 	<panel name="review_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="review_header_panel">
+			<text name="review_header_text">
 				Überprüfen
 			</text>
 		</panel>
-		<panel name="content">
+		<panel name="review_content">
 			<text name="review_prim_equiv">
 				Auswirkung auf Parzelle/Region: Prim-Äquivalenzwert [EQUIV]
 			</text>
 			<text name="review_fee">
-				Die für das Hochladen anfallende Gebühr in Höhe von [FEE] L$ wird von Ihrem Konto abgebucht.
+				Die für das Hochladen anfallende Gebühr in Höhe von L$ [FEE] wird von Ihrem Konto abgebucht.
 			</text>
 			<text name="review_confirmation">
 				Durch Klicken auf „Hochladen“ bestätigen Sie, dass Sie die erforderlichen Rechte für das im Modell enthaltene Material besitzen.
@@ -125,8 +128,8 @@
 		</panel>
 	</panel>
 	<panel name="upload_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="upload_header_panel">
+			<text name="upload_header_text">
 				Upload abgeschlossen
 			</text>
 		</panel>
diff --git a/indra/newview/skins/default/xui/de/floater_moveview.xml b/indra/newview/skins/default/xui/de/floater_moveview.xml
index e8cc77c0386b611a5380d6efae83266e18de5437..c1c8271310bdd961f4da97eca40f8071f8c0b20f 100644
--- a/indra/newview/skins/default/xui/de/floater_moveview.xml
+++ b/indra/newview/skins/default/xui/de/floater_moveview.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="move_floater" title="BEWEGEN">
+<floater name="move_floater" title="GEHEN / RENNEN / FLIEGEN">
 	<string name="walk_forward_tooltip">
 		Vorwärts gehen (Nach-oben-Pfeil oder W drücken)
 	</string>
diff --git a/indra/newview/skins/default/xui/de/floater_preview_animation.xml b/indra/newview/skins/default/xui/de/floater_preview_animation.xml
index 3dcdb52555742654bda28f662f397831da939a89..2dd47a27ad810e897c14d2f74e8701c92647cb73 100644
--- a/indra/newview/skins/default/xui/de/floater_preview_animation.xml
+++ b/indra/newview/skins/default/xui/de/floater_preview_animation.xml
@@ -7,6 +7,6 @@
 		Beschreibung:
 	</text>
 	<line_editor left="108" name="desc" width="160"/>
-	<button label="Inworld abspielen" label_selected="Stopp" name="Anim play btn" tool_tip="Diese Animation so wiedergeben, dass andere sie sehen können." width="116"/>
-	<button label="Lokal abspielen" label_selected="Stopp" left="171" name="Anim audition btn" tool_tip="Diese Animation so wiedergeben, dass nur Sie sie sehen." width="116"/>
+	<button label="Inworld abspielen" label_selected="Stopp" name="Inworld" tool_tip="Diese Animation so wiedergeben, dass andere sie sehen können."/>
+	<button label="Lokal wiedergeben" label_selected="Stopp" name="Locally" tool_tip="Diese Animation so wiedergeben, dass nur Sie sie sehen."/>
 </floater>
diff --git a/indra/newview/skins/default/xui/de/floater_snapshot.xml b/indra/newview/skins/default/xui/de/floater_snapshot.xml
index ae68c71a80c7ef9041345a7ac276af0e7de8e9d3..798461c00754925ab017ffd21d2734100e7124a5 100644
--- a/indra/newview/skins/default/xui/de/floater_snapshot.xml
+++ b/indra/newview/skins/default/xui/de/floater_snapshot.xml
@@ -3,73 +3,63 @@
 	<floater.string name="unknown">
 		unbekannt
 	</floater.string>
-	<radio_group label="Fototyp" name="snapshot_type_radio">
-		<radio_item label="E-Mail" name="postcard"/>
-		<radio_item label="Mein Inventar ([AMOUNT] L$)" name="texture"/>
-		<radio_item label="Auf meinem Computer speichern" name="local"/>
-	</radio_group>
+	<string name="postcard_progress_str">
+		E-Mail senden
+	</string>
+	<string name="profile_progress_str">
+		Posten
+	</string>
+	<string name="inventory_progress_str">
+		Speichern im Inventar
+	</string>
+	<string name="local_progress_str">
+		Speichern auf Computer
+	</string>
+	<string name="profile_succeeded_str">
+		Bild hochgeladen
+	</string>
+	<string name="postcard_succeeded_str">
+		E-Mail gesendet!
+	</string>
+	<string name="inventory_succeeded_str">
+		Im Inventar gespeichert!
+	</string>
+	<string name="local_succeeded_str">
+		Auf Computer gespeichert!
+	</string>
+	<string name="profile_failed_str">
+		Fehler beim Hochladen des Bilds in Ihr Profil.
+	</string>
+	<string name="postcard_failed_str">
+		Fehler beim Senden der E-Mail.
+	</string>
+	<string name="inventory_failed_str">
+		Fehler beim Speichern im Inventar.
+	</string>
+	<string name="local_failed_str">
+		Fehler beim Speichern auf dem Computer.
+	</string>
+	<button name="advanced_options_btn" tool_tip="Erweiterte Optionen"/>
+	<text name="image_res_text">
+		[WIDTH] x [HEIGHT] px
+	</text>
 	<text name="file_size_label">
 		[SIZE] KB
 	</text>
-	<button label="Foto aktualisieren" name="new_snapshot_btn"/>
-	<button label="Senden" name="send_btn"/>
-	<button label="Speichern ([AMOUNT] L$)" name="upload_btn"/>
-	<flyout_button label="Speichern" name="save_btn" tool_tip="Bild als Datei speichern">
-		<flyout_button.item label="Speichern" name="save_item"/>
-		<flyout_button.item label="Speichern unter..." name="saveas_item"/>
-	</flyout_button>
-	<button label="Mehr" name="more_btn" tool_tip="Erweiterte Optionen"/>
-	<button label="Weniger" name="less_btn" tool_tip="Erweiterte Optionen"/>
-	<button label="Abbrechen" name="discard_btn"/>
-	<text name="type_label2">
-		Größe
-	</text>
-	<text name="format_label">
-		Format
-	</text>
-	<combo_box label="Auflösung" name="postcard_size_combo">
-		<combo_box.item label="Aktuelles Fenster" name="CurrentWindow"/>
-		<combo_box.item label="640x480" name="640x480"/>
-		<combo_box.item label="800x600" name="800x600"/>
-		<combo_box.item label="1024x768" name="1024x768"/>
-		<combo_box.item label="Benutzerdefiniert" name="Custom"/>
-	</combo_box>
-	<combo_box label="Auflösung" name="texture_size_combo">
-		<combo_box.item label="Aktuelles Fenster" name="CurrentWindow"/>
-		<combo_box.item label="Klein (128x128)" name="Small(128x128)"/>
-		<combo_box.item label="Mittel (256x256)" name="Medium(256x256)"/>
-		<combo_box.item label="Groß (512x512)" name="Large(512x512)"/>
-		<combo_box.item label="Benutzerdefiniert" name="Custom"/>
-	</combo_box>
-	<combo_box label="Auflösung" name="local_size_combo">
-		<combo_box.item label="Aktuelles Fenster" name="CurrentWindow"/>
-		<combo_box.item label="320x240" name="320x240"/>
-		<combo_box.item label="640x480" name="640x480"/>
-		<combo_box.item label="800x600" name="800x600"/>
-		<combo_box.item label="1024x768" name="1024x768"/>
-		<combo_box.item label="1280x1024" name="1280x1024"/>
-		<combo_box.item label="1600x1200" name="1600x1200"/>
-		<combo_box.item label="Benutzerdefiniert" name="Custom"/>
-	</combo_box>
-	<combo_box label="Format" name="local_format_combo">
-		<combo_box.item label="PNG" name="PNG"/>
-		<combo_box.item label="JPEG" name="JPEG"/>
-		<combo_box.item label="BMP" name="BMP"/>
-	</combo_box>
-	<spinner label="Breite" name="snapshot_width"/>
-	<spinner label="Größe" name="snapshot_height"/>
-	<check_box label="Seitenverhältnis beibehalten" name="keep_aspect_check"/>
-	<slider label="Bildqualität" name="image_quality_slider"/>
-	<text name="layer_type_label">
-		Aufnehmen:
-	</text>
-	<combo_box label="Bildlayer" name="layer_types">
-		<combo_box.item label="Farben" name="Colors"/>
-		<combo_box.item label="Tiefe" name="Depth"/>
-	</combo_box>
-	<check_box label="Schnittstelle" name="ui_check"/>
-	<check_box label="HUDs" name="hud_check"/>
-	<check_box label="Nach dem Speichern offen lassen" name="keep_open_check"/>
-	<check_box label="Frame einfrieren (Vollbild)" name="freeze_frame_check"/>
-	<check_box label="Automatisch aktualisieren" name="auto_snapshot_check"/>
+	<panel name="advanced_options_panel">
+		<text name="advanced_options_label">
+			ERWEITERTE OPTIONEN
+		</text>
+		<text name="layer_type_label">
+			Aufnahme:
+		</text>
+		<combo_box label="Bildebenen" name="layer_types">
+			<combo_box.item label="Farben" name="Colors"/>
+			<combo_box.item label="Tiefe" name="Depth"/>
+		</combo_box>
+		<check_box label="Schnittstelle" name="ui_check"/>
+		<check_box label="HUDs" name="hud_check"/>
+		<check_box label="Standbild (Vollbild)" name="freeze_frame_check"/>
+		<check_box label="Automatisch aktualisieren" name="auto_snapshot_check"/>
+	</panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/de/floater_test_layout_stacks.xml b/indra/newview/skins/default/xui/de/floater_test_layout_stacks.xml
new file mode 100644
index 0000000000000000000000000000000000000000..429447c3784e826c592d5db66c9e4672474d2d45
--- /dev/null
+++ b/indra/newview/skins/default/xui/de/floater_test_layout_stacks.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Test Floater" title="LAYOUTSTACK-TESTS"/>
diff --git a/indra/newview/skins/default/xui/de/floater_test_text_vertical_aligment.xml b/indra/newview/skins/default/xui/de/floater_test_text_vertical_aligment.xml
new file mode 100644
index 0000000000000000000000000000000000000000..506d2b013a27b48b2cbcd821b6b00a5e8234ab82
--- /dev/null
+++ b/indra/newview/skins/default/xui/de/floater_test_text_vertical_aligment.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Test Floater" title="TEST-FENSTER"/>
diff --git a/indra/newview/skins/default/xui/de/floater_tools.xml b/indra/newview/skins/default/xui/de/floater_tools.xml
index cf1d03f32d25182d6b1457f3590267e88f0c910b..dee89b28e532a30fd7ca5e91e038d5c85d737f70 100644
--- a/indra/newview/skins/default/xui/de/floater_tools.xml
+++ b/indra/newview/skins/default/xui/de/floater_tools.xml
@@ -1,5 +1,20 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="toolbox floater" short_title="BAU-WERKZEUGE" title="">
+	<floater.string name="grid_screen_text">
+		Bildschirm
+	</floater.string>
+	<floater.string name="grid_local_text">
+		Lokal
+	</floater.string>
+	<floater.string name="grid_world_text">
+		Welt
+	</floater.string>
+	<floater.string name="grid_reference_text">
+		Referenz
+	</floater.string>
+	<floater.string name="grid_attachment_text">
+		Anhang
+	</floater.string>
 	<floater.string name="status_rotate">
 		An den farbigen Bändern ziehen, um das Objekt zu drehen
 	</floater.string>
@@ -63,7 +78,12 @@
 	</text>
 	<check_box initial_value="true" label="Texturen dehnen" name="checkbox stretch textures" top_pad="-5"/>
 	<check_box initial_value="true" label="Einrasten" name="checkbox snap to grid" top_pad="15"/>
-	<button label="Optionen..." label_selected="Optionen..." name="Options..." tool_tip="Mehr Raster-Optionen anzeigen"/>
+	<combo_box name="combobox grid mode" tool_tip="Wählen Sie das gewünschte Rasterlineal zum Positionieren des Objekts aus.">
+		<combo_box.item label="Welt" name="World"/>
+		<combo_box.item label="Lokal" name="Local"/>
+		<combo_box.item label="Referenz" name="Reference"/>
+	</combo_box>
+	<button label="" label_selected="Optionen..." name="Options..." tool_tip="Mehr Raster-Optionen anzeigen"/>
 	<button label="" label_selected="" name="ToolCube" tool_tip="Würfel"/>
 	<button label="" label_selected="" name="ToolPrism" tool_tip="Prisma"/>
 	<button label="" label_selected="" name="ToolPyramid" tool_tip="Pyramide"/>
diff --git a/indra/newview/skins/default/xui/de/floater_toybox.xml b/indra/newview/skins/default/xui/de/floater_toybox.xml
index 23ec9c2e58aa5411ade2c4f0a0d3af76d600cc9f..90e50804d658d7b58a079614fe58960d9393eb7b 100644
--- a/indra/newview/skins/default/xui/de/floater_toybox.xml
+++ b/indra/newview/skins/default/xui/de/floater_toybox.xml
@@ -1,10 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Toybox" title="SYMBOLLEISTEN ANPASSEN">
+<floater name="Toybox" title="SYMBOLLEISTENSCHALTFLÄCHEN">
 	<text name="toybox label 1">
 		Sie können Schaltflächen durch Ziehen zu Symbolleisten hinzufügen oder daraus entfernen.
 	</text>
 	<text name="toybox label 2">
 		Je nach Einstellung erscheinen Schaltflächen wie dargestellt oder nur als Symbol.
 	</text>
+	<button label="Alle Symbolleisten leeren" label_selected="Alle Symbolleisten leeren" name="btn_clear_all"/>
 	<button label="Standards wiederherstellen" label_selected="Standards wiederherstellen" name="btn_restore_defaults"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/de/floater_translation_settings.xml b/indra/newview/skins/default/xui/de/floater_translation_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3d5d1d46a8bc0072e6c1687fc33342a0e108e683
--- /dev/null
+++ b/indra/newview/skins/default/xui/de/floater_translation_settings.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_translation_settings" title="ÃœBERSETZUNGSEINSTELLUNGEN FÃœR CHATS">
+	<string name="bing_api_key_not_verified">
+		Bing-AppID nicht verifiziert. Versuchen Sie es erneut.
+	</string>
+	<string name="google_api_key_not_verified">
+		Google-API-Schlüssel nicht verifiziert. Versuchen Sie es erneut.
+	</string>
+	<string name="bing_api_key_verified">
+		Bing-AppID verifiziert.
+	</string>
+	<string name="google_api_key_verified">
+		Google-API-Schlüssel verifiziert.
+	</string>
+	<check_box label="Maschinenübersetzung beim Chatten aktivieren" name="translate_chat_checkbox"/>
+	<text name="translate_language_label">
+		Chat übersetzen in:
+	</text>
+	<combo_box name="translate_language_combo">
+		<combo_box.item label="Systemstandard" name="System Default Language"/>
+		<combo_box.item label="English (Englisch)" name="English"/>
+		<combo_box.item label="Dansk (Dänisch)" name="Danish"/>
+		<combo_box.item label="Deutsch" name="German"/>
+		<combo_box.item label="Español (Spanisch)" name="Spanish"/>
+		<combo_box.item label="Français (Französisch)" name="French"/>
+		<combo_box.item label="Italiano (Italienisch)" name="Italian"/>
+		<combo_box.item label="Magyar (Ungarisch)" name="Hungarian"/>
+		<combo_box.item label="Nederlands (Holländisch)" name="Dutch"/>
+		<combo_box.item label="Polski (Polnisch)" name="Polish"/>
+		<combo_box.item label="Português (Portugiesisch)" name="Portugese"/>
+		<combo_box.item label="Русский (Russisch)" name="Russian"/>
+		<combo_box.item label="Türkçe (Türkisch)" name="Turkish"/>
+		<combo_box.item label="Українська (Ukrainisch)" name="Ukrainian"/>
+		<combo_box.item label="中文 (正體) (Chinesisch)" name="Chinese"/>
+		<combo_box.item label="日本語 (Japanisch)" name="Japanese"/>
+		<combo_box.item label="한국어 (Koreanisch)" name="Korean"/>
+	</combo_box>
+	<text name="tip">
+		Übersetzungsservice auswählen:
+	</text>
+	<radio_group name="translation_service_rg">
+		<radio_item initial_value="bing" label="Bing Translator" name="bing"/>
+		<radio_item initial_value="google" label="Google Translate" name="google"/>
+	</radio_group>
+	<text name="bing_api_key_label">
+		Bing-[http://www.bing.com/developers/createapp.aspx AppID]:
+	</text>
+	<button label="Verifizieren" name="verify_bing_api_key_btn"/>
+	<text name="google_api_key_label">
+		Google-[http://code.google.com/apis/language/translate/v2/getting_started.html#auth API-Schlüssel]:
+	</text>
+	<button label="Verifizieren" name="verify_google_api_key_btn"/>
+	<text name="google_links_text">
+		[http://code.google.com/apis/language/translate/v2/pricing.html Pricing] | [https://code.google.com/apis/console Statistik]
+	</text>
+	<button label="OK" name="ok_btn"/>
+	<button label="Abbrechen" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/de/floater_voice_controls.xml b/indra/newview/skins/default/xui/de/floater_voice_controls.xml
index 18d53841b84f36a9d7976ef3fd7dfe403dea40a0..5efda4136eaaa75e45db9b014fe7fdce0484b59d 100644
--- a/indra/newview/skins/default/xui/de/floater_voice_controls.xml
+++ b/indra/newview/skins/default/xui/de/floater_voice_controls.xml
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="floater_voice_controls" title="SPRACHSTEUERUNGEN">
 	<string name="title_nearby">
-		Stimme in der Nähe
+		VOICE-EINSTELLUNGEN
 	</string>
 	<string name="title_group">
-		Gruppengespräch mit [GROUP]
+		GRUPPENGESPRÄCH MIT [GROUP]
 	</string>
 	<string name="title_adhoc">
-		Konferenzgespräch
+		KONFERENZGESPRÄCH
 	</string>
 	<string name="title_peer_2_peer">
-		Gespräch mit [NAME]
+		GESPRÄCH MIT [NAME]
 	</string>
 	<string name="no_one_near">
 		Es ist niemand in der Nähe, der Voice aktiviert hat.
diff --git a/indra/newview/skins/default/xui/de/floater_voice_effect.xml b/indra/newview/skins/default/xui/de/floater_voice_effect.xml
index 3dc0fc2322f2846f1344c513e3403fc52dc827f2..413a46525c56146876bcb8fe4ee226097d0b577f 100644
--- a/indra/newview/skins/default/xui/de/floater_voice_effect.xml
+++ b/indra/newview/skins/default/xui/de/floater_voice_effect.xml
@@ -42,13 +42,16 @@
 	<string name="effect_Demon">
 		Dämon
 	</string>
+	<string name="effect_Female Elf">
+		Weibliche Elfe
+	</string>
 	<string name="effect_Flirty">
 		Kokett
 	</string>
 	<string name="effect_Foxy">
 		Attraktiv
 	</string>
-	<string name="effect_Halloween_2010_Bonus">
+	<string name="effect_Halloween 2010 Bonus">
 		Bonus_Halloween_2010
 	</string>
 	<string name="effect_Helium">
@@ -57,9 +60,18 @@
 	<string name="effect_Husky">
 		Rauchig
 	</string>
+	<string name="effect_Husky Whisper">
+		Rauchiges Flüstern
+	</string>
 	<string name="effect_Intercom">
 		Intercom
 	</string>
+	<string name="effect_Julia">
+		Julia
+	</string>
+	<string name="effect_Lo Lilt">
+		Leises Trällern
+	</string>
 	<string name="effect_Macho">
 		Macho
 	</string>
@@ -69,6 +81,9 @@
 	<string name="effect_Mini">
 		Mini
 	</string>
+	<string name="effect_Model">
+		Modell
+	</string>
 	<string name="effect_Nano">
 		Nano
 	</string>
@@ -90,6 +105,9 @@
 	<string name="effect_Roxanne">
 		Roxanne
 	</string>
+	<string name="effect_Rumble">
+		Rumpeln
+	</string>
 	<string name="effect_Sabrina">
 		Sabrina
 	</string>
@@ -102,6 +120,9 @@
 	<string name="effect_Shorty">
 		Shorty
 	</string>
+	<string name="effect_Smaller">
+		Kleiner
+	</string>
 	<string name="effect_Sneaky">
 		Hinterhältig
 	</string>
diff --git a/indra/newview/skins/default/xui/de/menu_inspect_object_gear.xml b/indra/newview/skins/default/xui/de/menu_inspect_object_gear.xml
index 7c47913e30feaeec58d6c3fb55398c2f5c69ba5f..73e0029b76cc20b496e8a0c0c1a3312097cef56a 100644
--- a/indra/newview/skins/default/xui/de/menu_inspect_object_gear.xml
+++ b/indra/newview/skins/default/xui/de/menu_inspect_object_gear.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<menu name="Gear Menu">
+<toggleable_menu name="Gear Menu">
 	<menu_item_call label="Berühren" name="touch"/>
 	<menu_item_call label="Sitzen" name="sit"/>
 	<menu_item_call label="Bezahlen" name="pay"/>
@@ -12,7 +12,8 @@
 	<menu_item_call label="Hinzufügen" name="add"/>
 	<menu_item_call label="Melden" name="report"/>
 	<menu_item_call label="Ignorieren" name="block"/>
+	<menu_item_call label="Freischalten" name="unblock"/>
 	<menu_item_call label="Hineinzoomen" name="zoom_in"/>
 	<menu_item_call label="Entfernen" name="remove"/>
 	<menu_item_call label="Weitere Infos" name="more_info"/>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/de/menu_inventory.xml b/indra/newview/skins/default/xui/de/menu_inventory.xml
index 733a0b85c38223e208bdcafc436284154033925a..39b3099336ab2279fc1e0d9de0317f90283e7aec 100644
--- a/indra/newview/skins/default/xui/de/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/de/menu_inventory.xml
@@ -59,6 +59,7 @@
 	<menu_item_call label="Eigenschaften" name="Properties"/>
 	<menu_item_call label="Umbenennen" name="Rename"/>
 	<menu_item_call label="Asset-UUID kopieren" name="Copy Asset UUID"/>
+	<menu_item_call label="Ausschneiden" name="Cut"/>
 	<menu_item_call label="Kopieren" name="Copy"/>
 	<menu_item_call label="Einfügen" name="Paste"/>
 	<menu_item_call label="Als Link einfügen" name="Paste As Link"/>
@@ -84,6 +85,6 @@
 	<menu_item_call label="Hinzufügen" name="Wearable Add"/>
 	<menu_item_call label="Ausziehen" name="Take Off"/>
 	<menu_item_call label="In Händler-Outbox kopieren" name="Merchant Copy"/>
-	<menu_item_call label="In Händler-Outbox verschieben" name="Merchant Move"/>
+	<menu_item_call label="In Marktplatz übertragen" name="Marketplace Send"/>
 	<menu_item_call label="--keine Optionen--" name="--no options--"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/de/menu_login.xml b/indra/newview/skins/default/xui/de/menu_login.xml
index c90205fbe482d4eb4d2f6ff8f5c0eaaf378aa7dd..b43b41a5dc2cf0f80a47e047e4092d2d6c5f9431 100644
--- a/indra/newview/skins/default/xui/de/menu_login.xml
+++ b/indra/newview/skins/default/xui/de/menu_login.xml
@@ -17,8 +17,8 @@
 		<menu_item_call label="Fenstergröße einstellen..." name="Set Window Size..."/>
 		<menu_item_call label="Servicebedingungen anzeigen" name="TOS"/>
 		<menu_item_call label="Wichtige Meldung anzeigen" name="Critical"/>
-		<menu_item_call label="Test Medienbrowser" name="Web Browser Test"/>
 		<menu_item_call label="Web Content Floater Debug Test" name="Web Content Floater Debug Test"/>
+		<menu label="Protokollierungsstufe festlegen" name="Set Logging Level"/>
 		<menu_item_check label="Grid-Auswahl anzeigen" name="Show Grid Picker"/>
 		<menu_item_call label="Benachrichtigungs-Konsole anzeigen" name="Show Notifications Console"/>
 	</menu>
diff --git a/indra/newview/skins/default/xui/de/menu_toolbars.xml b/indra/newview/skins/default/xui/de/menu_toolbars.xml
index cfeae3deca6f64607d78f893df601b3d27952523..3fb48e26b2e5a2d164eca019ac4edd067b3ecc7f 100644
--- a/indra/newview/skins/default/xui/de/menu_toolbars.xml
+++ b/indra/newview/skins/default/xui/de/menu_toolbars.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Toolbars Popup">
-	<menu_item_call label="Schaltflächen auswählen..." name="Chose Buttons"/>
+	<menu_item_call label="Diese Schaltfläche entfernen" name="Remove button"/>
+	<menu_item_call label="Symbolleistenschaltflächen..." name="Choose Buttons"/>
 	<menu_item_check label="Symbole und Beschriftungen" name="icons_with_text"/>
 	<menu_item_check label="Nur Symbole" name="icons_only"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/de/menu_viewer.xml b/indra/newview/skins/default/xui/de/menu_viewer.xml
index e6135aa100a8b462ff66541bb06d22abf68c28a4..d011c7295cb7169d8b42bc6985b9e1f4238e2d69 100644
--- a/indra/newview/skins/default/xui/de/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/de/menu_viewer.xml
@@ -1,55 +1,60 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu_bar name="Main Menu">
 	<menu label="Ich" name="Me">
-		<menu_item_call label="Dashboard..." name="Manage My Account">
-			<menu_item_call.on_click name="ManageMyAccount_url" parameter="WebLaunchJoinNow,http://secondlife.com/account/index.php?lang=de"/>
-		</menu_item_call>
 		<menu_item_call label="Profil..." name="Profile"/>
 		<menu_item_call label="Aussehen..." name="ChangeOutfit"/>
+		<menu_item_call label="Avatar auswählen..." name="Avatar Picker"/>
 		<menu_item_check label="Inventar..." name="Inventory"/>
-		<menu_item_check label="Gesten..." name="Gestures"/>
-		<menu_item_check label="Stimme..." name="ShowVoice"/>
+		<menu_item_call label="Neues Inventarfenster" name="NewInventoryWindow"/>
+		<menu_item_call label="Orte..." name="Places"/>
+		<menu_item_call label="Auswahlen..." name="Picks"/>
+		<menu_item_call label="Kamerasteuerungen..." name="Camera Controls"/>
 		<menu label="Bewegung" name="Movement">
 			<menu_item_call label="Hinsetzen" name="Sit Down Here"/>
 			<menu_item_check label="Fliegen" name="Fly"/>
 			<menu_item_check label="Immer rennen" name="Always Run"/>
 			<menu_item_call label="Animation meines Avatars stoppen" name="Stop Animating My Avatar"/>
+			<menu_item_call label="Gehen/Rennen/Fliegen..." name="Walk / run / fly"/>
 		</menu>
 		<menu label="Status" name="Status">
 			<menu_item_call label="Abwesend" name="Set Away"/>
 			<menu_item_call label="Beschäftigt" name="Set Busy"/>
 		</menu>
-		<menu_item_call label="Admin-Status anfordern" name="Request Admin Options"/>
-		<menu_item_call label="Admin-Status verlassen" name="Leave Admin Options"/>
-		<menu_item_call label="L$ kaufen" name="Buy and Sell L$"/>
+		<menu_item_call label="L$ kaufen..." name="Buy and Sell L$"/>
+		<menu_item_call label="Händler-Outbox..." name="MerchantOutbox"/>
+		<menu_item_call label="Kontoübersicht..." name="Manage My Account">
+			<menu_item_call.on_click name="ManageMyAccount_url" parameter="WebLaunchJoinNow,http://secondlife.com/account/index.php?lang=de"/>
+		</menu_item_call>
 		<menu_item_call label="Einstellungen..." name="Preferences"/>
-		<menu_item_call label="Symbolleisten..." name="Toolbars"/>
+		<menu_item_call label="Symbolleistenschaltflächen..." name="Toolbars"/>
 		<menu_item_call label="Alle Steuerelemente ausblenden" name="Hide UI"/>
 		<menu_item_call label="[APP_NAME] schließen" name="Quit"/>
 	</menu>
 	<menu label="Unterhalten" name="Communicate">
-		<menu_item_call label="Meine Freunde" name="My Friends"/>
-		<menu_item_call label="Meine Gruppen" name="My Groups"/>
-		<menu_item_check label="Chat in der Nähe" name="Nearby Chat"/>
+		<menu_item_check label="Chat..." name="Nearby Chat"/>
+		<menu_item_check label="Sprechen" name="Speak"/>
+		<menu_item_check label="Voice-Einstellungen..." name="Nearby Voice"/>
+		<menu_item_check label="Voice-Morphing..." name="ShowVoice"/>
+		<menu_item_check label="Gesten..." name="Gestures"/>
+		<menu_item_call label="Freunde" name="My Friends"/>
+		<menu_item_call label="Gruppen" name="My Groups"/>
 		<menu_item_call label="Leute in der Nähe" name="Active Speakers"/>
-		<menu_item_check label="Stimme in der Nähe" name="Nearby Voice"/>
 	</menu>
 	<menu label="Welt" name="World">
-		<menu_item_check label="Minikarte" name="Mini-Map"/>
+		<menu_item_call label="Landmarke für diesen Ort setzen" name="Create Landmark Here"/>
+		<menu_item_call label="Ziele..." name="Destinations"/>
 		<menu_item_check label="Karte" name="World Map"/>
+		<menu_item_check label="Minikarte" name="Mini-Map"/>
 		<menu_item_check label="Suchen" name="Search"/>
+		<menu_item_call label="Nach Hause teleportieren" name="Teleport Home"/>
+		<menu_item_call label="Hier als Zuhause wählen" name="Set Home to Here"/>
 		<menu_item_call label="Foto" name="Take Snapshot"/>
-		<menu_item_call label="Landmarke für diesen Ort setzen" name="Create Landmark Here"/>
-		<menu label="Ortsprofil" name="Land">
-			<menu_item_call label="Ortsprofil" name="Place Profile"/>
-			<menu_item_call label="Land-Info" name="About Land"/>
-			<menu_item_call label="Region/Grundbesitz" name="Region/Estate"/>
-		</menu>
+		<menu_item_call label="Ortsprofil" name="Place Profile"/>
+		<menu_item_call label="Landinformationen" name="About Land"/>
+		<menu_item_call label="Region/Grundbesitz" name="Region/Estate"/>
+		<menu_item_call label="Mein Landbesitz..." name="My Land"/>
 		<menu_item_call label="Dieses Land kaufen" name="Buy Land"/>
-		<menu_item_call label="Mein Land" name="My Land"/>
 		<menu label="Anzeigen" name="LandShow">
-			<menu_item_check label="Bewegungssteuerung" name="Movement Controls"/>
-			<menu_item_check label="Ansichtsteuerung" name="Camera Controls"/>
 			<menu_item_check label="Bannlinien" name="Ban Lines"/>
 			<menu_item_check label="Strahlen" name="beacons"/>
 			<menu_item_check label="Grundstücksgrenzen" name="Property Lines"/>
@@ -58,16 +63,15 @@
 			<menu_item_check label="Parzelleneigenschaften" name="Parcel Properties"/>
 			<menu_item_check label="Menü „Erweitert“" name="Show Advanced Menu"/>
 		</menu>
-		<menu_item_call label="Teleport nach Hause" name="Teleport Home"/>
-		<menu_item_call label="Hier als Zuhause wählen" name="Set Home to Here"/>
-		<menu label="Sonne" name="Environment Settings">
+		<menu label="Sonne" name="Sun">
 			<menu_item_call label="Sonnenaufgang" name="Sunrise"/>
 			<menu_item_call label="Mittag" name="Noon"/>
 			<menu_item_call label="Sonnenuntergang" name="Sunset"/>
 			<menu_item_call label="Mitternacht" name="Midnight"/>
+			<menu_item_call label="Regionseinstellungen verwenden" name="Use Region Settings"/>
 		</menu>
-		<menu label="Umgebungs-Editor" name="Enviroment Editor">
-			<menu_item_call label="Umgebungseinstellungen..." name="Enviroment Settings"/>
+		<menu label="Umwelt-Editor" name="Environment Editor">
+			<menu_item_call label="Umwelt-Einstellungen..." name="Environment Settings"/>
 			<menu label="Wasser-Voreinstellungen" name="Water Presets">
 				<menu_item_call label="Neue Voreinstellung..." name="new_water_preset"/>
 				<menu_item_call label="Voreinstellung bearbeiten..." name="edit_water_preset"/>
@@ -140,11 +144,13 @@
 			<menu_item_call label="Animation ([COST] L$)..." name="Upload Animation"/>
 			<menu_item_call label="Modell..." name="Upload Model"/>
 			<menu_item_call label="Mehrfach-Upload ([COST] L$ pro Datei)..." name="Bulk Upload"/>
+			<menu_item_call label="Hochlade-Berechtigungen (Standard) festlegen" name="perm prefs"/>
 		</menu>
 		<menu_item_call label="Rückgängig" name="Undo"/>
 		<menu_item_call label="Wiederholen" name="Redo"/>
 	</menu>
 	<menu label="Hilfe" name="Help">
+		<menu_item_call label="Anweisungen..." name="How To"/>
 		<menu_item_call label="[SECOND_LIFE]-Hilfe" name="Second Life Help"/>
 		<menu_item_call label="Missbrauch melden" name="Report Abuse"/>
 		<menu_item_call label="Fehler melden" name="Report Bug"/>
@@ -172,22 +178,22 @@
 			<menu_item_check label="Fadenkreuz für Mouselook anzeigen" name="ShowCrosshairs"/>
 		</menu>
 		<menu label="Darstellungstypen" name="Rendering Types">
-			<menu_item_check label="Einfach" name="Simple"/>
-			<menu_item_check label="Alpha" name="Alpha"/>
-			<menu_item_check label="Baum" name="Tree"/>
-			<menu_item_check label="Avatare" name="Character"/>
-			<menu_item_check label="Flächenpatch" name="Surface Patch"/>
-			<menu_item_check label="Himmel" name="Sky"/>
-			<menu_item_check label="Wasser" name="Water"/>
-			<menu_item_check label="Boden" name="Ground"/>
-			<menu_item_check label="Volumen" name="Volume"/>
-			<menu_item_check label="Gras" name="Grass"/>
-			<menu_item_check label="Wolken" name="Clouds"/>
-			<menu_item_check label="Partikel" name="Particles"/>
-			<menu_item_check label="Unebenheiten" name="Bump"/>
+			<menu_item_check label="Einfach" name="Rendering Type Simple"/>
+			<menu_item_check label="Alpha" name="Rendering Type Alpha"/>
+			<menu_item_check label="Baum" name="Rendering Type Tree"/>
+			<menu_item_check label="Avatare" name="Rendering Type Character"/>
+			<menu_item_check label="Flächenpatch" name="Rendering Type Surface Patch"/>
+			<menu_item_check label="Himmel" name="Rendering Type Sky"/>
+			<menu_item_check label="Wasser" name="Rendering Type Water"/>
+			<menu_item_check label="Boden" name="Rendering Type Ground"/>
+			<menu_item_check label="Volumen" name="Rendering Type Volume"/>
+			<menu_item_check label="Gras" name="Rendering Type Grass"/>
+			<menu_item_check label="Wolken" name="Rendering Type Clouds"/>
+			<menu_item_check label="Partikel" name="Rendering Type Particles"/>
+			<menu_item_check label="Unebenheiten" name="Rendering Type Bump"/>
 		</menu>
 		<menu label="Rendering-Eigenschaften" name="Rendering Features">
-			<menu_item_check label="UI" name="UI"/>
+			<menu_item_check label="UI" name="ToggleUI"/>
 			<menu_item_check label="Ausgewählt" name="Selected"/>
 			<menu_item_check label="Farblich hervorgehoben" name="Highlighted"/>
 			<menu_item_check label="Dynamische Texturen" name="Dynamic Textures"/>
@@ -199,11 +205,8 @@
 		<menu_item_check label="Plugin Read Thread verwenden" name="Use Plugin Read Thread"/>
 		<menu_item_call label="Gruppen-Cache löschen" name="ClearGroupCache"/>
 		<menu_item_check label="Weiche Mausbewegung" name="Mouse Smoothing"/>
+		<menu_item_call label="Tasten freigeben" name="Release Keys"/>
 		<menu label="Tastaturkürzel" name="Shortcuts">
-			<menu_item_call label="Bild ([COST] L$)..." name="Upload Image"/>
-			<menu_item_check label="Suchen" name="Search"/>
-			<menu_item_call label="Tasten freigeben" name="Release Keys"/>
-			<menu_item_call label="UI-Größe auf Standard setzen" name="Set UI Size to Default"/>
 			<menu_item_check label="Erweitert-Menü anzeigen - veraltetet" name="Show Advanced Menu - legacy shortcut"/>
 			<menu_item_call label="Fenster schließen" name="Close Window"/>
 			<menu_item_call label="Alle Fenster schließen" name="Close All Windows"/>
@@ -212,13 +215,6 @@
 			<menu_item_check label="Joystick-Flycam" name="Joystick Flycam"/>
 			<menu_item_call label="Ansicht zurücksetzen" name="Reset View"/>
 			<menu_item_call label="Letzten Chatter ansehen" name="Look at Last Chatter"/>
-			<menu label="Bauwerkzeug auswählen" name="Select Tool">
-				<menu_item_call label="Fokus-Werkzeug" name="Focus"/>
-				<menu_item_call label="Werkzeug „Bewegen“" name="Move"/>
-				<menu_item_call label="Bearbeiten" name="Edit"/>
-				<menu_item_call label="Werkzeug „Erstellen&quot;" name="Create"/>
-				<menu_item_call label="Land-Werkzeug" name="Land"/>
-			</menu>
 			<menu_item_call label="Hineinzoomen" name="Zoom In"/>
 			<menu_item_call label="Zoom-Standard" name="Zoom Default"/>
 			<menu_item_call label="Wegzoomen" name="Zoom Out"/>
@@ -289,7 +285,9 @@
 			<menu_item_check label="Lichter" name="Lights"/>
 			<menu_item_check label="Gelenkpunkte" name="Collision Skeleton"/>
 			<menu_item_check label="Raycast" name="Raycast"/>
+			<menu_item_check label="Windvektoren" name="Wind Vectors"/>
 			<menu_item_check label="Komplexität beim Rendern" name="rendercomplexity"/>
+			<menu_item_check label="Byte in Anhängen" name="attachment bytes"/>
 			<menu_item_check label="Formen" name="Sculpt"/>
 		</menu>
 		<menu label="Rendering" name="Rendering">
@@ -301,7 +299,6 @@
 			<menu_item_check label="Licht und Schatten" name="Lighting and Shadows"/>
 			<menu_item_check label="Schatten von Sonne-/Mond-Projektoren" name="Shadows from Sun/Moon/Projectors"/>
 			<menu_item_check label="SSAO und Schattenglättung" name="SSAO and Shadow Smoothing"/>
-			<menu_item_check label="Globale Beleuchtung (experimentell)" name="Global Illumination"/>
 			<menu_item_check label="Fehler in GL beseitigen" name="Debug GL"/>
 			<menu_item_check label="Fehler in Pipeline beseitigen" name="Debug Pipeline"/>
 			<menu_item_check label="Automatische Alpha-Masken (aufgeschoben)" name="Automatic Alpha Masks (deferred)"/>
@@ -332,9 +329,8 @@
 			<menu_item_call label="Aufnahme starten" name="Start Record"/>
 			<menu_item_call label="Aufnahme stoppen" name="Stop Record"/>
 		</menu>
-		<menu label="Welt" name="World">
+		<menu label="Welt" name="DevelopWorld">
 			<menu_item_check label="Sonnen-Override für Sim" name="Sim Sun Override"/>
-			<menu_item_check label="Pulsierender Strahl" name="Cheesy Beacon"/>
 			<menu_item_check label="Festgelegtes Wetter" name="Fixed Weather"/>
 			<menu_item_call label="Regionsobjekt-Cache ausgeben" name="Dump Region Object Cache"/>
 		</menu>
@@ -366,11 +362,11 @@
 		</menu>
 		<menu label="Avatar" name="Character">
 			<menu label="Geladene Textur nehmen" name="Grab Baked Texture">
-				<menu_item_call label="Iris" name="Iris"/>
-				<menu_item_call label="Kopf" name="Head"/>
-				<menu_item_call label="Oberkörper" name="Upper Body"/>
-				<menu_item_call label="Unterkörper" name="Lower Body"/>
-				<menu_item_call label="Rock" name="Skirt"/>
+				<menu_item_call label="Iris" name="Grab Iris"/>
+				<menu_item_call label="Kopf" name="Grab Head"/>
+				<menu_item_call label="Oberkörper" name="Grab Upper Body"/>
+				<menu_item_call label="Unterkörper" name="Grab Lower Body"/>
+				<menu_item_call label="Rock" name="Grab Skirt"/>
 			</menu>
 			<menu label="Avatar-Tests" name="Character Tests">
 				<menu_item_call label="Aussehen als XML speichern" name="Appearance To XML"/>
@@ -398,20 +394,28 @@
 		<menu_item_check label="HTTP-Texturen" name="HTTP Textures"/>
 		<menu_item_check label="HTTP-Inventar" name="HTTP Inventory"/>
 		<menu_item_call label="Bilder komprimieren" name="Compress Images"/>
+		<menu_item_call label="Visual Leak Detector aktivieren" name="Enable Visual Leak Detector"/>
 		<menu_item_check label="Ausgabe Fehlerbeseitigung ausgeben" name="Output Debug Minidump"/>
 		<menu_item_check label="Bei nächster Ausführung Fenster öffnen" name="Console Window"/>
+		<menu label="Protokollierungsstufe festlegen" name="Set Logging Level">
+			<menu_item_check label="Debug" name="Debug"/>
+			<menu_item_check label="Info" name="Info"/>
+			<menu_item_check label="Warnung" name="Warning"/>
+			<menu_item_check label="Fehler" name="Error"/>
+			<menu_item_check label="Keine" name="None"/>
+		</menu>
 		<menu_item_call label="Admin-Status anfordern" name="Request Admin Options"/>
 		<menu_item_call label="Admin-Status verlassen" name="Leave Admin Options"/>
 		<menu_item_check label="Admin-Menü anzeigen" name="View Admin Options"/>
 	</menu>
 	<menu label="Admin" name="Admin">
-		<menu label="Object">
-			<menu_item_call label="Kopie nehmen" name="Take Copy"/>
-			<menu_item_call label="Besitzer zu mir zwingen" name="Force Owner To Me"/>
-			<menu_item_call label="Erlaubnis des Besitzers erzwingen" name="Force Owner Permissive"/>
+		<menu label="Objekt" name="AdminObject">
+			<menu_item_call label="Kopie nehmen" name="Admin Take Copy"/>
+			<menu_item_call label="Mich zum Besitzer machen" name="Force Owner To Me"/>
+			<menu_item_call label="Besitzererlaubnis erzwingen" name="Force Owner Permissive"/>
 			<menu_item_call label="Löschen" name="Delete"/>
-			<menu_item_call label="Fest" name="Lock"/>
-			<menu_item_call label="Asset-ID zulassen" name="Get Assets IDs"/>
+			<menu_item_call label="Sperren" name="Lock"/>
+			<menu_item_call label="Asset-IDs abrufen" name="Get Assets IDs"/>
 		</menu>
 		<menu label="Parzelle" name="Parcel">
 			<menu_item_call label="Besitzer zu mir zwingen" name="Owner To Me"/>
@@ -442,14 +446,14 @@
 			<menu_item_call label="Physik" name="Physics"/>
 			<menu_item_call label="Alle Kleider" name="All Clothes"/>
 		</menu>
-		<menu label="Hilfe" name="Help">
+		<menu label="Hilfe" name="DeprecatedHelp">
 			<menu_item_call label="Offizielles Linden-Blog" name="Official Linden Blog"/>
 			<menu_item_call label="Scripting-Portal" name="Scripting Portal"/>
 			<menu label="Fehlermeldungen" name="Bug Reporting">
 				<menu_item_call label="Allgemeiner Probleme-Tracker" name="Public Issue Tracker"/>
 				<menu_item_call label="Hilfe zum Allgemeinen Probleme-Tracker" name="Publc Issue Tracker Help"/>
 				<menu_item_call label="Fehlermeldungs-1x1" name="Bug Reporing 101"/>
-				<menu_item_call label="Sicherheitsfragen" name="Security Issues"/>
+				<menu_item_call label="Sicherheitsprobleme" name="Security Issues"/>
 				<menu_item_call label="QA-Wiki" name="QA Wiki"/>
 			</menu>
 		</menu>
diff --git a/indra/newview/skins/default/xui/de/notifications.xml b/indra/newview/skins/default/xui/de/notifications.xml
index fc38608df5fb154cc97f0270b2ac6dc72f150814..ac068fcd4ea1be1ed135094464bac53d5e69ffa5 100644
--- a/indra/newview/skins/default/xui/de/notifications.xml
+++ b/indra/newview/skins/default/xui/de/notifications.xml
@@ -86,17 +86,38 @@ Stellen Sie sicher, dass Ihre Internetverbindung funktioniert.
 		<usetemplate canceltext="Abbrechen" name="yesnocancelbuttons" notext="Nicht speichern" yestext="Speichern"/>
 	</notification>
 	<notification name="ConfirmNoCopyToOutbox">
-		Ihnen fehlt die Berechtigung zum Kopieren dieses Artikels in die Händler-Outbox. Möchten Sie wirklich den folgenden Artikel verschieben?
-        [ITEM_NAME]
-		<usetemplate name="okcancelbuttons" notext="Nein" yestext="Ja"/>
+		Sie sind nicht berechtigt, einen oder mehrere dieser Artikel in die Händler-Outbox zu kopieren. Sie können sie verschieben oder zurücklassen.
+		<usetemplate name="okcancelbuttons" notext="Artikel nicht verschieben" yestext="Artikel verschieben"/>
+	</notification>
+	<notification name="OutboxFolderCreated">
+		Für jeden Artikel, den Sie in die oberste Ebene Ihrer Händler-Outbox übertragen haben, wurde ein neuer Ordner erstellt.
+		<usetemplate ignoretext="Neuer Ordner in Händler-Outbox erstellt" name="okignore" yestext="OK"/>
 	</notification>
-	<notification name="OutboxUploadComplete">
-		Marktplatz-Upload abgeschlossen.
-		<usetemplate name="okbutton" yestext="Hurra!"/>
+	<notification name="OutboxImportComplete">
+		Erfolg
+
+Alle Ordner wurden erfolgreich an den Marktplatz übertragen.
+		<usetemplate ignoretext="Alle Ordner an den Marktplatz übertragen" name="okignore" yestext="OK"/>
 	</notification>
-	<notification name="OutboxUploadHadErrors">
-		Marktplatz-Upload mit Fehlern abgeschlossen. Korrigieren Sie die Fehler in Ihrer Outbox und versuchen Sie es erneut. Vielen Dank!
-		<usetemplate name="okbutton" yestext="Erneut versuchen"/>
+	<notification name="OutboxImportHadErrors">
+		Einige Ordner wurden nicht übertragen
+
+Beim Übertragen bestimmter Ordner an den Marktplatz ist ein Fehler aufgetreten. Diese Ordner befinden sich noch in Ihrer Händler-Outbox.
+
+Weitere Informationen finden Sie im [[MARKETPLACE_IMPORTS_URL] Fehlerprotokoll].
+		<usetemplate name="okbutton" yestext="OK"/>
+	</notification>
+	<notification name="OutboxImportFailed">
+		Ãœbertragung fehlgeschlagen
+
+Aufgrund eines System- oder Netzwerkfehlers wurden keine Ordner an den Marktplatz übertragen. Versuchen Sie es später erneut.
+		<usetemplate name="okbutton" yestext="OK"/>
+	</notification>
+	<notification name="OutboxInitFailed">
+		Marktplatzinitialisierung fehlgeschlagen
+
+Marktplatzinitialisierung aufgrund eines System- oder Netzwerkfehlers fehlgeschlagen. Versuchen Sie es später erneut.
+		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="CompileQueueSaveText">
 		Der Text für ein Skript konnte aus folgendem Grund nicht hochgeladen werden: [REASON]. Bitte versuchen Sie es erneut.
@@ -656,7 +677,7 @@ Erwartet wurde [VALIDS]
 		Ausgabedatei konnte nicht erstellt werden: [FILE]
 	</notification>
 	<notification name="DoNotSupportBulkAnimationUpload">
-		Der Mehrfach-Upload von Animationsdateien wird zurzeit von [APP_NAME] nicht unterstützt.
+		Der Bulk-Upload von BVH-Animationsdateien wird zurzeit von [APP_NAME] nicht unterstützt.
 	</notification>
 	<notification name="CannotUploadReason">
 		Datei [FILE] kann aus folgendem Grund nicht hochgeladen werden: [REASON]
@@ -992,7 +1013,7 @@ Sie sind nicht berechtigt, Land für die aktive Gruppe zu kaufen.
 		</form>
 	</notification>
 	<notification name="RemoveFromFriends">
-		Möchten Sie [NAME] aus Ihrer Freundesliste entfernen?
+		Möchten Sie &lt;nolink&gt;[NAME]&lt;/nolink&gt; aus Ihrer Freundesliste entfernen?
 		<usetemplate name="okcancelbuttons" notext="Abbrechen" yestext="OK"/>
 	</notification>
 	<notification name="RemoveMultipleFromFriends">
@@ -1124,8 +1145,13 @@ Der Gruppe „[GROUP_NAME]“ [AREA] m² an Land schenken?
 	<notification name="DisplaySetToSafe">
 		Es wurden sichere Anzeige-Einstellungen gewählt, da die Option -safe verwendet wurde.
 	</notification>
-	<notification name="DisplaySetToRecommended">
-		Es wurden die für Ihre Systemkonfiguration empfohlenen Anzeige-Einstellungen gewählt.
+	<notification name="DisplaySetToRecommendedGPUChange">
+		Die Anzeigeeinstellungen wurden auf die empfohlenen Werte gesetzt, da Ihre Grafikkarte geändert wurde
+von „[LAST_GPU]“
+in „[THIS_GPU]“
+	</notification>
+	<notification name="DisplaySetToRecommendedFeatureChange">
+		Aufgrund einer Änderung des Rendersubsystems wurden die Anzeigeeinstellungen auf die empfohlenen Werte gesetzt.
 	</notification>
 	<notification name="ErrorMessage">
 		[ERROR_MESSAGE]
@@ -1443,7 +1469,7 @@ Zur Installation des Updates muss [APP_NAME] neu gestartet werden.
 		<usetemplate ignoretext="Bestätigen, bevor Objekte an Ihre Eigentümer zurückgegeben werden" name="okcancelignore" notext="Abbrechen" yestext="OK"/>
 	</notification>
 	<notification name="GroupLeaveConfirmMember">
-		Sie sind Mitglied der Gruppe [GROUP].
+		Sie sind gegenwärtig Mitglied der Gruppe &lt;nolink&gt;[GROUP]&lt;/nolink&gt;.
 Diese Gruppe verlassen?
 		<usetemplate name="okcancelbuttons" notext="Abbrechen" yestext="OK"/>
 	</notification>
@@ -1926,7 +1952,13 @@ Inventarobjekt(e) verschieben?
 		<usetemplate ignoretext="Bestätigen, bevor Sitzung beendet wird" name="okcancelignore" notext="Nicht beenden" yestext="Beenden"/>
 	</notification>
 	<notification name="ConfirmRestoreToybox">
-		Möchten Sie wirklich Ihre Standardschaltflächen und -symbolleisten wiederherstellen? 
+		Durch diese Aktion werden Ihre Standardschaltflächen und -symbolleisten wiederhergestellt.
+
+Diese Aktion kann nicht rückgängig gemacht werden.
+		<usetemplate name="okcancelbuttons" notext="Abbrechen" yestext="OK"/>
+	</notification>
+	<notification name="ConfirmClearAllToybox">
+		Durch diese Aktion werden alle Schaltflächen zurück in die Toolbox gestellt; die Symbolleisten sind leer.
     
 Diese Aktion kann nicht rückgängig gemacht werden.
 		<usetemplate name="okcancelbuttons" notext="Abbrechen" yestext="OK"/>
@@ -2134,10 +2166,10 @@ Hierzu wird Ihr Webbrowser geöffnet.
 		Betreff: [SUBJECT], Nachricht: [MESSAGE]
 	</notification>
 	<notification name="FriendOnline">
-		[NAME] ist online
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; ist online
 	</notification>
 	<notification name="FriendOffline">
-		[NAME] ist offline
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; ist offline
 	</notification>
 	<notification name="AddSelfFriend">
 		Obwohl Sie ein sehr netter Mensch sind, können Sie sich nicht selbst als Freund hinzufügen.
@@ -2250,14 +2282,16 @@ Wählen Sie ein einzelnes Objekt aus.
 		Ihre Visitenkarte wurde abgelehnt.
 	</notification>
 	<notification name="TeleportToLandmark">
-		Sie können an Positionen wie „[NAME]“ teleportieren, wenn Sie rechts in Ihrem Bildschirm die Tafel „Orte“ öffnen und dann die Registerkarte „Meine Landmarken“ auswählen.
-Klicken Sie auf eine Landmarke, um diese auszuwählen. Klicken Sie anschließend auf unten in der Registerkarte auf „Teleportieren“.
-(Sie können auch auf die Landmarke doppelt klicken oder mit rechts auf die Landmarke klicken und dann „Teleportieren“ auswählen).
+		Um zu Orten wie „[NAME]“ zu teleportieren, klicken Sie zuerst auf die Schaltfläche „Orte“
+    und dann im eingeblendeten Fenster auf die Registerkarte „Landmarken“. Klicken Sie auf
+    die gewünschte Landmarke und dann unten im Fenster auf „Teleportieren“.
+    (Sie können auch auf die Landmarke doppelklicken bzw. sie mit der rechten Maustaste ankklicken und dann
+    „Teleportieren“ wählen.)
 	</notification>
 	<notification name="TeleportToPerson">
-		Sie können Einwohner wie „[NAME]“ kontaktieren, wenn Sie die Tafel „Leute“ auf der rechten Seite Ihres Bildschirms öffnen.
-Wählen Sie den Einwohner aus der Liste aus und klicken Sie unten auf „IM“.
-(Sie können auch auf den Namen doppelt klicken oder mit rechts auf den Namen klicken und dann „IM“ auswählen).
+		Um Einwohner wie „[NAME]“ zu kontaktieren, klicken Sie auf die Schaltfläche „Leute“, wählen Sie eingeblendeten Fenster einen Einwohner aus
+    und klicken Sie unten im Fenster auf „IM“.
+    (Sie können auch auf den Namen doppelklicken bzw. ihn mit der rechten Maustaste anklicken und dann „IM“ wählen.)
 	</notification>
 	<notification name="CantSelectLandFromMultipleRegions">
 		Land kann nicht über Servergrenzen hinweg ausgewählt werden.
@@ -2278,6 +2312,9 @@ Wählen Sie eine kleinere Landfläche.
 	<notification name="PaymentSent">
 		[MESSAGE]
 	</notification>
+	<notification name="PaymentFailure">
+		[MESSAGE]
+	</notification>
 	<notification name="EventNotification">
 		Event-Benachrichtigung:
 
@@ -2532,10 +2569,10 @@ Versuchen Sie es in einigen Minuten erneut.
 		</form>
 	</notification>
 	<notification name="FriendshipAccepted">
-		[NAME] hat Ihr Freundschaftsangebot akzeptiert.
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; hat Ihr Freundschaftsangebot akzeptiert.
 	</notification>
 	<notification name="FriendshipDeclined">
-		[NAME] hat Ihr Freundschaftsangebot abgelehnt.
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; hat Ihr Freundschaftsangebot abgelehnt.
 	</notification>
 	<notification name="FriendshipAcceptedByMe">
 		Ihr Freundschaftsangebot wurde angeommen.
@@ -2607,16 +2644,16 @@ Anfrage gestatten?
 		„&lt;nolink&gt;[TITLE]&lt;/nolink&gt;“ von [NAME]
 [MESSAGE]
 		<form name="form">
-			<button name="Mute" text="Blockieren"/>
-			<button name="Ignore" text="Ignorieren"/>
+			<button name="Client_Side_Mute" text="Blockieren"/>
+			<button name="Client_Side_Ignore" text="Ignorieren"/>
 		</form>
 	</notification>
 	<notification name="ScriptDialogGroup">
 		„&lt;nolink&gt;[TITLE]&lt;/nolink&gt;“ von [GROUPNAME]
 [MESSAGE]
 		<form name="form">
-			<button name="Mute" text="Blockieren"/>
-			<button name="Ignore" text="Ignorieren"/>
+			<button name="Client_Side_Mute" text="Blockieren"/>
+			<button name="Client_Side_Ignore" text="Ignorieren"/>
 		</form>
 	</notification>
 	<notification name="BuyLindenDollarSuccess">
@@ -2812,6 +2849,18 @@ Details finden Sie in der Protokolldatei.
 
 für folgende Einwohner freigeben:
 
+[RESIDENTS]
+		<usetemplate name="okcancelbuttons" notext="Abbrechen" yestext="OK"/>
+	</notification>
+	<notification name="ShareFolderConfirmation">
+		Es kann nur jeweils ein Ordner geteilt werden.
+
+Möchten Sie wirklich die folgenden Artikel:
+
+&lt;nolink&gt;[ITEMS]&lt;/nolink&gt;
+
+mit den folgenden Einwohnern teilen:
+
 [RESIDENTS]
 		<usetemplate name="okcancelbuttons" notext="Abbrechen" yestext="OK"/>
 	</notification>
diff --git a/indra/newview/skins/default/xui/de/panel_edit_skin.xml b/indra/newview/skins/default/xui/de/panel_edit_skin.xml
index f167f45e98a7d64daa641fe9f6f83db66246543f..60f6919485c628598840ce838ff2481a1be1384d 100644
--- a/indra/newview/skins/default/xui/de/panel_edit_skin.xml
+++ b/indra/newview/skins/default/xui/de/panel_edit_skin.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="edit_skin_panel">
 	<panel name="avatar_skin_color_panel">
-		<texture_picker label="Kopftattoo" name="Head Tattoos" tool_tip="Zum Auswählen eines Bildes hier klicken"/>
-		<texture_picker label="Obere Tattoos" name="Upper Tattoos" tool_tip="Zum Auswählen eines Bildes hier klicken"/>
-		<texture_picker label="Untere Tattoos" name="Lower Tattoos" tool_tip="Zum Auswählen eines Bildes hier klicken"/>
+		<texture_picker label="Kopf" name="Head" tool_tip="Klicken, um ein Bild zu wählen"/>
+		<texture_picker label="Oberkörper" name="Upper Body" tool_tip="Klicken, um ein Bild zu wählen"/>
+		<texture_picker label="Unterkörper" name="Lower Body" tool_tip="Klicken, um ein Bild zu wählen"/>
 	</panel>
 	<panel name="accordion_panel">
 		<accordion name="wearable_accordion">
diff --git a/indra/newview/skins/default/xui/de/panel_my_profile.xml b/indra/newview/skins/default/xui/de/panel_my_profile.xml
deleted file mode 100644
index 89a4dfdabae25de398e5d4582486055035acf2d2..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/de/panel_my_profile.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Profil" name="panel_profile">
-	<string name="CaptionTextAcctInfo">
-		[ACCTTYPE]
-[PAYMENTINFO] [AGEVERIFICATION]
-	</string>
-	<string name="payment_update_link_url">
-		http://www.secondlife.com/account/billing.php?lang=de-DE
-	</string>
-	<string name="partner_edit_link_url">
-		http://www.secondlife.com/account/partners.php?lang=de
-	</string>
-	<string name="my_account_link_url" value="http://secondlife.com/my/account/index.php?lang=de-DE"/>
-	<string name="no_partner_text" value="Keiner"/>
-	<string name="no_group_text" value="Keiner"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="scroll_content_panel">
-					<panel name="second_life_image_panel">
-						<text name="display_name_descr_text">
-							Benutzername
-						</text>
-						<text name="name_descr_text">
-							Anzeigename
-						</text>
-						<button label="Profil" name="see_profile_btn" tool_tip="Profil zu diesem Avatar anzeigen"/>
-					</panel>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/de/panel_nearby_chat.xml b/indra/newview/skins/default/xui/de/panel_nearby_chat.xml
index 2068c39024366cdc6beeb9982bf44def6df939b3..07ad761791cd7bd3f7be2091ddcc65ad5928a0e1 100644
--- a/indra/newview/skins/default/xui/de/panel_nearby_chat.xml
+++ b/indra/newview/skins/default/xui/de/panel_nearby_chat.xml
@@ -1,4 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="nearby_chat">
-	<check_box label="Chat übersetzen" name="translate_chat_checkbox"/>
+	<layout_stack name="stack">
+		<layout_panel name="translate_chat_checkbox_lp">
+			<check_box label="Chat übersetzen" name="translate_chat_checkbox"/>
+		</layout_panel>
+	</layout_stack>
 </panel>
diff --git a/indra/newview/skins/default/xui/de/panel_notes.xml b/indra/newview/skins/default/xui/de/panel_notes.xml
deleted file mode 100644
index ef1961b63d56391da1fc3f259d70f058cbf6edae..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/de/panel_notes.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Notizen &amp; Privatsphäre" name="panel_notes">
-	<layout_stack name="layout">
-		<layout_panel name="notes_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<text name="status_message" value="Meine Notizen:"/>
-					<text name="status_message2" value="Diese Person kann:"/>
-					<check_box label="meinen Online-Status sehen." name="status_check"/>
-					<check_box label="mich auf der Karte sehen." name="map_check"/>
-					<check_box label="meine Objekte bearbeiten, löschen oder nehmen." name="objects_check"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-		<layout_panel name="notes_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="Freund hinzufügen" name="add_friend" tool_tip="Dem Einwohner die Freundschaft anbieten"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="IM" name="im" tool_tip="Instant Messenger öffnen"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="Anrufen" name="call" tool_tip="Diesen Einwohner anrufen"/>
-				</layout_panel>
-				<layout_panel name="show_on_map_btn_lp">
-					<button label="Karte" name="show_on_map_btn" tool_tip="Einwohner auf Karte anzeigen"/>
-				</layout_panel>
-				<layout_panel name="teleport_btn_lp">
-					<button label="Teleportieren" name="teleport" tool_tip="Teleport anbieten"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/de/panel_postcard_message.xml b/indra/newview/skins/default/xui/de/panel_postcard_message.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6eeef8af712c00ae806419edea09887fa94d7f6d
--- /dev/null
+++ b/indra/newview/skins/default/xui/de/panel_postcard_message.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_postcard_message">
+	<text name="to_label">
+		An:
+	</text>
+	<text name="name_label">
+		Von:
+	</text>
+	<text name="subject_label">
+		Betreff:
+	</text>
+	<line_editor label="Betreff hier eingeben." name="subject_form"/>
+	<text name="msg_label">
+		Nachricht:
+	</text>
+	<text_editor name="msg_form">
+		Nachricht hier eingeben.
+	</text_editor>
+	<button label="Abbrechen" name="cancel_btn"/>
+	<button label="Senden" name="send_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/de/panel_postcard_settings.xml b/indra/newview/skins/default/xui/de/panel_postcard_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c1a1c0cc463792231ce34709e766608af2e5c88e
--- /dev/null
+++ b/indra/newview/skins/default/xui/de/panel_postcard_settings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_postcard_settings">
+	<combo_box label="Auflösung" name="postcard_size_combo">
+		<combo_box.item label="Aktuelles Fenster" name="CurrentWindow"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="Benutzerdefiniert" name="Custom"/>
+	</combo_box>
+	<layout_stack name="postcard_image_params_ls">
+		<layout_panel name="postcard_image_size_lp">
+			<spinner label="Breite" name="postcard_snapshot_width"/>
+			<spinner label="Höhe" name="postcard_snapshot_height"/>
+			<check_box label="Seitenverhältnis beibehalten" name="postcard_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="postcard_image_format_quality_lp">
+			<slider label="Bildqualität" name="image_quality_slider"/>
+			<text name="image_quality_level">
+				([QLVL])
+			</text>
+		</layout_panel>
+	</layout_stack>
+</panel>
diff --git a/indra/newview/skins/default/xui/de/panel_preferences_chat.xml b/indra/newview/skins/default/xui/de/panel_preferences_chat.xml
index 04f6c273301477044b4a47a580e3b4778956a730..746a561e6c69fedc542b398ac1a4b4f553f13e47 100644
--- a/indra/newview/skins/default/xui/de/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/de/panel_preferences_chat.xml
@@ -29,30 +29,5 @@
 	<check_box label="IM-Chats" name="EnableIMChatPopups" tool_tip="Markieren, um Popups zu sehen, wenn Instant Message eintrifft"/>
 	<spinner label="Lebenszeit von Toasts für Chat in der Nähe:" name="nearby_toasts_lifetime"/>
 	<spinner label="Ein-/Ausblenddauer von Toasts für Chat in der Nähe:" name="nearby_toasts_fadingtime"/>
-	<check_box name="translate_chat_checkbox"/>
-	<text name="translate_chb_label">
-		Beim Chatten Maschinenübersetzung verwenden
-	</text>
-	<text name="translate_language_text">
-		Chat übersetzen in:
-	</text>
-	<combo_box name="translate_language_combobox" width="200">
-		<combo_box.item label="Systemstandard" name="System Default Language"/>
-		<combo_box.item label="English (Englisch)" name="English"/>
-		<combo_box.item label="Dansk (Dänisch)" name="Danish"/>
-		<combo_box.item label="Deutsch" name="German"/>
-		<combo_box.item label="Español (Spanisch)" name="Spanish"/>
-		<combo_box.item label="Français (Französisch)" name="French"/>
-		<combo_box.item label="Italiano (Italienisch)" name="Italian"/>
-		<combo_box.item label="Magyar (Ungarisch)" name="Hungarian"/>
-		<combo_box.item label="Nederlands (Holländisch)" name="Dutch"/>
-		<combo_box.item label="Polski (Polnisch)" name="Polish"/>
-		<combo_box.item label="Português (Portugiesisch)" name="Portugese"/>
-		<combo_box.item label="Русский (Russisch)" name="Russian"/>
-		<combo_box.item label="Türkçe (Türkisch)" name="Turkish"/>
-		<combo_box.item label="Українська (Ukrainisch)" name="Ukrainian"/>
-		<combo_box.item label="中文 (正體) (Chinesisch)" name="Chinese"/>
-		<combo_box.item label="日本語 (Japanisch)" name="Japanese"/>
-		<combo_box.item label="한국어 (Koreanisch)" name="Korean"/>
-	</combo_box>
+	<button label="Übersetzungseinstellungen für Chats" name="ok_btn"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/de/panel_preferences_setup.xml b/indra/newview/skins/default/xui/de/panel_preferences_setup.xml
index 8b18bf8659f4d1c93834533aa33789b12a9f3b73..8c7ea688d7f6f724e3152aa9df8aed100dd3b56a 100644
--- a/indra/newview/skins/default/xui/de/panel_preferences_setup.xml
+++ b/indra/newview/skins/default/xui/de/panel_preferences_setup.xml
@@ -15,7 +15,7 @@
 		Web:
 	</text>
 	<radio_group name="use_external_browser">
-		<radio_item label="Meinen Browser verwenden (IE, Firefox, Safari)" name="external" tool_tip="Standard Webbrowser des Systems verwenden, um die Hilfe, Weblinks usw. anzuzeigen. Bei Vollbildmodus nicht empfohlen." value="1"/>
+		<radio_item label="Meinen Browser verwenden (IE, Firefox, Safari)" name="external" tool_tip="Standard Webbrowser des Systems verwenden, um die Hilfe, Weblinks usw. anzuzeigen. Bei Vollbildmodus nicht empfohlen." value="true"/>
 		<radio_item label="Integrierten Browser verwenden" name="internal" tool_tip="Integrierten Webbrowser verwenden, um die Hilfe, Weblinks usw. anzuzeigen. Dieser Browser öffnet als neues Fenster innerhalb von [APP_NAME]." value=""/>
 	</radio_group>
 	<check_box initial_value="true" label="Plugins aktivieren" name="browser_plugins_enabled"/>
diff --git a/indra/newview/skins/default/xui/de/panel_profile.xml b/indra/newview/skins/default/xui/de/panel_profile.xml
deleted file mode 100644
index b4c6e67108564f801305b05281f83bd2f40dae58..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/de/panel_profile.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Profil" name="panel_profile">
-	<string name="CaptionTextAcctInfo">
-		[ACCTTYPE]
-[PAYMENTINFO] [AGEVERIFICATION]
-	</string>
-	<string name="payment_update_link_url">
-		http://www.secondlife.com/account/billing.php?lang=de-DE
-	</string>
-	<string name="partner_edit_link_url">
-		http://www.secondlife.com/account/partners.php?lang=de
-	</string>
-	<string name="my_account_link_url" value="http://secondlife.com/my/account/index.php?lang=de-DE"/>
-	<string name="no_partner_text" value="Keiner"/>
-	<string name="no_group_text" value="Keiner"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<panel name="second_life_image_panel">
-						<text name="title_sl_descr_text" value="[SECOND_LIFE]:"/>
-					</panel>
-					<panel name="first_life_image_panel">
-						<text name="title_rw_descr_text" value="Echtes Leben:"/>
-					</panel>
-					<text name="title_member_text" value="Einwohner seit:"/>
-					<text name="title_acc_status_text" value="Kontostatus:"/>
-					<text_editor name="acc_status_text">
-						Einwohner. Keine Zahlungsinfo archiviert.
-              Linden.
-					</text_editor>
-					<text name="title_partner_text" value="Partner:"/>
-					<panel name="partner_data_panel">
-						<text initial_value="(wird in Datenbank gesucht)" name="partner_text"/>
-					</panel>
-					<text name="title_groups_text" value="Gruppen:"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-	<layout_stack name="layout_verb_buttons">
-		<layout_panel name="profile_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="Freund hinzufügen" name="add_friend" tool_tip="Dem Einwohner die Freundschaft anbieten"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="IM" name="im" tool_tip="Instant Messenger öffnen"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="Anrufen" name="call" tool_tip="Diesen Einwohner anrufen"/>
-				</layout_panel>
-				<layout_panel name="chat_btn_lp">
-					<button label="Teleportieren" name="teleport" tool_tip="Teleport anbieten"/>
-				</layout_panel>
-				<layout_panel name="overflow_btn_lp">
-					<menu_button label="â–¼" name="overflow_btn" tool_tip="Dem Einwohner Geld geben oder Inventar an den Einwohner schicken"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-		<layout_panel name="profile_me_buttons_panel">
-			<button label="Profil bearbeiten" name="edit_profile_btn" tool_tip="Ihre persönlichen Informationen bearbeiten"/>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/de/panel_profile_view.xml b/indra/newview/skins/default/xui/de/panel_profile_view.xml
deleted file mode 100644
index 7e93bd1edee2175e8a66dee06c5401f06902970c..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/de/panel_profile_view.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel name="panel_target_profile">
-	<string name="status_online">
-		Online
-	</string>
-	<string name="status_offline">
-		Offline
-	</string>
-	<text name="display_name_label" value="Anzeigename:"/>
-	<text name="solo_username_label" value="Benutzername:"/>
-	<text name="status" value="Online"/>
-	<text name="user_name_small" value="Dieser Name ist ein ganz außerordentlich langer Name"/>
-	<button name="copy_to_clipboard" tool_tip="In Zwischenablage kopieren"/>
-	<text name="user_label" value="Benutzername:"/>
-	<tab_container name="tabs" tab_min_width="60">
-		<panel label="PROFIL" name="panel_profile"/>
-		<panel label="AUSWAHL" name="panel_picks"/>
-		<panel label="NOTIZEN &amp; PRIVATSPHÄRE" name="panel_notes"/>
-	</tab_container>
-</panel>
diff --git a/indra/newview/skins/default/xui/de/panel_region_estate.xml b/indra/newview/skins/default/xui/de/panel_region_estate.xml
index b93bd3e44210d6377084e8fca6ed7e84f800580e..aecf6f62fc5ed3167b81edeab1927f7a02329a3d 100644
--- a/indra/newview/skins/default/xui/de/panel_region_estate.xml
+++ b/indra/newview/skins/default/xui/de/panel_region_estate.xml
@@ -16,10 +16,10 @@
 		(unbekannt)
 	</text>
 	<text name="Only Allow">
-		Zugang nur dann, wenn überprüft mit:
+		Zugang nur Einwohnern gestatten, die:
 	</text>
-	<check_box label="Zahlungsinformation gespeichert" name="limit_payment" tool_tip="Einwohner ohne Zahlungsinformation nicht zulassen."/>
-	<check_box label="Altersüberprüfung" name="limit_age_verified" tool_tip="Einwohner ohne Altersüberprüfung verbannen. Weitere Informationen finden Sie auf [SUPPORT_SITE]."/>
+	<check_box label="Zahlungsinformationen hinterlegt haben" name="limit_payment" tool_tip="Um diesen Grundbesitz besuchen zu können, müssen Einwohner Zahlungsinformationen hinterlegt haben. Weitere Informationen finden Sie auf [SUPPORT_SITE]."/>
+	<check_box label="ihr Alter bestätigt haben" name="limit_age_verified" tool_tip="Um diesen Grundbesitz besuchen zu können, müssen Einwohner ihr Alter bestätigt haben. Weitere Informationen finden Sie auf [SUPPORT_SITE]."/>
 	<check_box label="Voice-Chat erlauben" name="voice_chat_check"/>
 	<button label="?" name="voice_chat_help"/>
 	<text name="abuse_email_text" width="222">
diff --git a/indra/newview/skins/default/xui/de/panel_script_ed.xml b/indra/newview/skins/default/xui/de/panel_script_ed.xml
index adfe2a342b77a694e6130fecafef47d633099c1e..7e03aeff15fec2e3ec31323658613299965ccdb9 100644
--- a/indra/newview/skins/default/xui/de/panel_script_ed.xml
+++ b/indra/newview/skins/default/xui/de/panel_script_ed.xml
@@ -22,6 +22,8 @@
 		<menu label="Datei" name="File">
 			<menu_item_call label="Speichern" name="Save"/>
 			<menu_item_call label="Alle Änderungen zurücksetzen" name="Revert All Changes"/>
+			<menu_item_call label="Aus Datei laden..." name="LoadFromFile"/>
+			<menu_item_call label="In Datei speichern..." name="SaveToFile"/>
 		</menu>
 		<menu label="Bearbeiten" name="Edit">
 			<menu_item_call label="Rückgängig" name="Undo"/>
diff --git a/indra/newview/skins/default/xui/de/panel_snapshot_inventory.xml b/indra/newview/skins/default/xui/de/panel_snapshot_inventory.xml
new file mode 100644
index 0000000000000000000000000000000000000000..10827ce6f201baf60f65b55bb501295b9890bef4
--- /dev/null
+++ b/indra/newview/skins/default/xui/de/panel_snapshot_inventory.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_inventory">
+	<text name="title">
+		In meinem Inventar speichern
+	</text>
+	<text name="hint_lbl">
+		Das Speichern eines Bilds in Ihrem Inventar kostet [UPLOAD_COST] L$. Um das Bild als Textur zu speichern, wählen Sie eines der quadratischen Formate aus.
+	</text>
+	<combo_box label="Auflösung" name="texture_size_combo">
+		<combo_box.item label="Aktuelles Fenster" name="CurrentWindow"/>
+		<combo_box.item label="Klein (128x128)" name="Small(128x128)"/>
+		<combo_box.item label="Mittel (256x256)" name="Medium(256x256)"/>
+		<combo_box.item label="Groß (512x512)" name="Large(512x512)"/>
+		<combo_box.item label="Benutzerdefiniert" name="Custom"/>
+	</combo_box>
+	<spinner label="Breite" name="inventory_snapshot_width"/>
+	<spinner label="Höhe" name="inventory_snapshot_height"/>
+	<check_box label="Seitenverhältnis beibehalten" name="inventory_keep_aspect_check"/>
+	<button label="Abbrechen" name="cancel_btn"/>
+	<button label="Speichern" name="save_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/de/panel_snapshot_local.xml b/indra/newview/skins/default/xui/de/panel_snapshot_local.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3aeae8038824a7ce76049931c7fbfe100e996a6b
--- /dev/null
+++ b/indra/newview/skins/default/xui/de/panel_snapshot_local.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_local">
+	<text name="title">
+		Auf meinem Computer speichern
+	</text>
+	<combo_box label="Auflösung" name="local_size_combo">
+		<combo_box.item label="Aktuelles Fenster" name="CurrentWindow"/>
+		<combo_box.item label="320x240" name="320x240"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="1280x1024" name="1280x1024"/>
+		<combo_box.item label="1600x1200" name="1600x1200"/>
+		<combo_box.item label="Benutzerdefiniert" name="Custom"/>
+	</combo_box>
+	<layout_stack name="local_image_params_ls">
+		<layout_panel name="local_image_size_lp">
+			<spinner label="Breite" name="local_snapshot_width"/>
+			<spinner label="Höhe" name="local_snapshot_height"/>
+			<check_box label="Seitenverhältnis beibehalten" name="local_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="local_image_format_quality_lp">
+			<combo_box label="Format" name="local_format_combo">
+				<combo_box.item label="PNG (verlustfrei)" name="PNG"/>
+				<combo_box.item label="JPEG" name="JPEG"/>
+				<combo_box.item label="BMP (verlustfrei)" name="BMP"/>
+			</combo_box>
+			<slider label="Bildqualität" name="image_quality_slider"/>
+			<text name="image_quality_level">
+				([QLVL])
+			</text>
+		</layout_panel>
+	</layout_stack>
+	<button label="Abbrechen" name="cancel_btn"/>
+	<flyout_button label="Speichern" name="save_btn" tool_tip="Bild als Datei speichern">
+		<flyout_button.item label="Speichern" name="save_item"/>
+		<flyout_button.item label="Speichern unter..." name="saveas_item"/>
+	</flyout_button>
+</panel>
diff --git a/indra/newview/skins/default/xui/de/panel_snapshot_options.xml b/indra/newview/skins/default/xui/de/panel_snapshot_options.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e1d8a5dc6d48fb3a4f6fc54d9df1be4e5965524f
--- /dev/null
+++ b/indra/newview/skins/default/xui/de/panel_snapshot_options.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_options">
+	<button label="In meinem Profil posten" name="save_to_profile_btn"/>
+	<button label="E-Mail" name="save_to_email_btn"/>
+	<button label="In meinem Inventar speichern ([AMOUNT] L$)" name="save_to_inventory_btn"/>
+	<button label="Auf meinem Computer speichern" name="save_to_computer_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/de/panel_snapshot_postcard.xml b/indra/newview/skins/default/xui/de/panel_snapshot_postcard.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c9afe86d7fe6f8ef6bb2da067fb360a99c9e229a
--- /dev/null
+++ b/indra/newview/skins/default/xui/de/panel_snapshot_postcard.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_postcard">
+	<string name="default_subject">
+		Postkarte aus [SECOND_LIFE].
+	</string>
+	<string name="default_message">
+		Sehen Sie mal!
+	</string>
+	<string name="upload_message">
+		Senden...
+	</string>
+	<text name="title">
+		E-Mail
+	</text>
+	<button label="Nachricht" name="message_btn"/>
+	<button label="Einstellungen" name="settings_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/de/panel_snapshot_profile.xml b/indra/newview/skins/default/xui/de/panel_snapshot_profile.xml
new file mode 100644
index 0000000000000000000000000000000000000000..8d1c52dea820e5b8283c93c4472a60b08dbf1ab4
--- /dev/null
+++ b/indra/newview/skins/default/xui/de/panel_snapshot_profile.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_profile">
+	<text name="title">
+		In meinem Profil posten
+	</text>
+	<combo_box label="Auflösung" name="profile_size_combo">
+		<combo_box.item label="Aktuelles Fenster" name="CurrentWindow"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="Benutzerdefiniert" name="Custom"/>
+	</combo_box>
+	<layout_stack name="profile_image_params_ls">
+		<layout_panel name="profile_image_size_lp">
+			<spinner label="Breite" name="profile_snapshot_width"/>
+			<spinner label="Höhe" name="profile_snapshot_height"/>
+			<check_box label="Seitenverhältnis beibehalten" name="profile_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="profile_image_metadata_lp">
+			<text name="caption_label">
+				Bildunterschrift:
+			</text>
+			<check_box initial_value="true" label="Ort einschließen" name="add_location_cb"/>
+		</layout_panel>
+	</layout_stack>
+	<button label="Abbrechen" name="cancel_btn"/>
+	<button label="Posten" name="post_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/de/panel_status_bar.xml b/indra/newview/skins/default/xui/de/panel_status_bar.xml
index d34fcf70bc3340a55acd87ddcfde3e583f0d2bed..14ace0ac3af0d071f3365356a2017bffeacf7360 100644
--- a/indra/newview/skins/default/xui/de/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/de/panel_status_bar.xml
@@ -15,10 +15,10 @@
 	<panel.string name="buycurrencylabel">
 		[AMT] L$
 	</panel.string>
-	<panel name="balance_bg">
+	<panel left="-415" name="balance_bg" width="205">
 		<text name="balance" tool_tip="Klicken, um L$-Guthaben zu aktualisieren" value="20 L$"/>
 		<button label="L$ kaufen" name="buyL" tool_tip="Hier klicken, um mehr L$ zu kaufen"/>
-		<button label="Einkaufen" name="goShop" tool_tip="Second Life-Marktplatz öffnen"/>
+		<button label="Einkaufen" name="goShop" tool_tip="Second Life-Marktplatz öffnen" width="85"/>
 	</panel>
 	<text name="TimeText" tool_tip="Aktuelle Zeit (Pazifik)">
 		24:00 H PST
diff --git a/indra/newview/skins/default/xui/de/sidepanel_inventory.xml b/indra/newview/skins/default/xui/de/sidepanel_inventory.xml
index 674ea3376b39a8ac5889ebeb32b149d2e2101eb0..18aad64f964dbf8058b93b98d676e510301b4a66 100644
--- a/indra/newview/skins/default/xui/de/sidepanel_inventory.xml
+++ b/indra/newview/skins/default/xui/de/sidepanel_inventory.xml
@@ -2,47 +2,24 @@
 <panel label="Sonstiges" name="objects panel">
 	<panel label="" name="sidepanel__inventory_panel">
 		<layout_stack name="inventory_layout_stack">
-			<layout_panel name="inbox_outbox_layout_panel">
-				<layout_stack name="inbox_outbox_layout_stack">
-					<layout_panel name="inbox_layout_panel">
-						<panel label="" name="marketplace_inbox">
-							<string name="InboxLabelWithArg">
-								Erhaltene Artikel ([NUM])
-							</string>
-							<string name="InboxLabelNoArg">
-								Erhaltene Artikel
-							</string>
-							<button label="Erhaltene Artikel" name="inbox_btn"/>
-							<text name="inbox_fresh_new_count">
-								[NUM] neu
-							</text>
-							<panel tool_tip="Drag and drop items to your inventory to manage and use them">
-								<text name="inbox_inventory_placeholder">
-									Einkäufe auf dem Marktplatz werden hierher geliefert.
-								</text>
-							</panel>
-						</panel>
-					</layout_panel>
-					<layout_panel name="outbox_layout_panel">
-						<panel label="" name="marketplace_outbox">
-							<string name="OutboxLabelWithArg">
-								Händler-Outbox ([NUM])
-							</string>
-							<string name="OutboxLabelNoArg">
-								Händler-Outbox
-							</string>
-							<button label="Händler-Outbox" name="outbox_btn"/>
-							<button label="" name="outbox_sync_btn" tool_tip="In meinen Marktplatz-Laden verschieben"/>
-							<panel>
-								<panel name="outbox_inventory_placeholder_panel">
-									<text name="outbox_inventory_placeholder_title">
-										Laden...
-									</text>
-								</panel>
-							</panel>
-						</panel>
-					</layout_panel>
-				</layout_stack>
+			<layout_panel name="inbox_layout_panel">
+				<panel label="" name="marketplace_inbox">
+					<string name="InboxLabelWithArg">
+						Erhaltene Artikel ([NUM])
+					</string>
+					<string name="InboxLabelNoArg">
+						Erhaltene Artikel
+					</string>
+					<button label="Erhaltene Artikel" name="inbox_btn"/>
+					<text name="inbox_fresh_new_count">
+						[NUM] neu
+					</text>
+					<panel name="inbox_inventory_placeholder_panel" tool_tip="Artikel zur Verwendung in Ihr Inventar ziehen">
+						<text name="inbox_inventory_placeholder">
+							Einkäufe aus dem Marktplatz werden hierher geliefert.
+						</text>
+					</panel>
+				</panel>
 			</layout_panel>
 		</layout_stack>
 		<panel name="button_panel">
diff --git a/indra/newview/skins/default/xui/de/strings.xml b/indra/newview/skins/default/xui/de/strings.xml
index 2929556d430c9fef928cf1e2637c046a28f7af62..d917d33d12ee9426f2dc627fd62a0345137dba60 100644
--- a/indra/newview/skins/default/xui/de/strings.xml
+++ b/indra/newview/skins/default/xui/de/strings.xml
@@ -181,8 +181,8 @@ Aktuelle Informationen finden Sie unter www.secondlife.com/status.
 	</string>
 	<string name="LoginFailedPremiumOnly">
 		Die Anmeldung bei Second Life ist vorübergehend eingeschränkt, um sicherzustellen, dass Einwohner, die sich bereits inworld aufhalten, das bestmögliche Erlebnis haben.
-	 	
-Benutzer mit kostenlosen Konten können sich während dieses Zeitraums nicht bei Second Life anmelden, damit die Kapazität den Benutzern zur Verfügung steht, die ein gebührenpflichtiges Premium-Konto besitzen.
+
+Benutzer mit kostenlosen Konten können sich während dieses Zeitraums nicht bei Second Life anmelden, damit die Kapazität Benutzern zur Verfügung steht, die ein gebührenpflichtiges Premium-Konto besitzen.
 	</string>
 	<string name="LoginFailedComputerProhibited">
 		Der Zugriff auf Second Life ist von diesem Computer aus nicht möglich.
@@ -339,17 +339,35 @@ Warten Sie kurz und versuchen Sie dann noch einmal, sich anzumelden.
 		Sie können nur ein einzelnes Objekt hierher ziehen
 	</string>
 	<string name="TooltipPrice" value="[AMOUNT] L$"/>
+	<string name="TooltipOutboxDragToWorld">
+		Sie können Artikel nicht in Ihrer Händler-Outbox rezzen
+	</string>
 	<string name="TooltipOutboxNoTransfer">
-		Eines oder mehrere dieser Objekte können nicht verkauft oder an einen anderen Benutzer übertragen werden.
+		Einer oder mehrere dieser Artikel können nicht verkauft oder übertragen werden.
+	</string>
+	<string name="TooltipOutboxNotInInventory">
+		Nur Artikel direkt aus Ihrem Inventar können in Ihre Händler-Outbox gelegt werden
 	</string>
 	<string name="TooltipOutboxWorn">
-		Sie tragen eines oder mehrere dieser Objekte. Nehmen Sie es/sie von Ihrem Avatar ab und versuchen Sie dann erneut, es/sie zu verschieben.
+		Artikel, die Sie tragen, können nicht in Ihre Händler-Outbox gelegt werden.
+	</string>
+	<string name="TooltipOutboxCallingCard">
+		Sie können keine Visitenkarten in Ihre Händler-Outbox legen
 	</string>
 	<string name="TooltipOutboxFolderLevels">
-		Dieser Ordner hat zu viele Unterordnerebenen. Ordnen Sie die Unterordner so an, dass maximal vier Verschachtelungsebenen vorhanden sind (Stammordner enthält A enthält B enthält C).
+		Tiefe der verschachtelten Ordner überschreitet 3
+	</string>
+	<string name="TooltipOutboxTooManyFolders">
+		Anzahl von Unterordnern im obersten Ordner überschreitet 20
 	</string>
 	<string name="TooltipOutboxTooManyObjects">
-		Dieser Ordner enthält mehr als 200 Objekte. Verpacken Sie einige dieser Artikel in Behältern, um die Anzahl zu verringern.
+		Anzahl von Artikeln im obersten Ordner überschreitet 200
+	</string>
+	<string name="TooltipDragOntoOwnChild">
+		Sie können einen Ordner nicht in einen seiner untergeordneten Ordner verschieben
+	</string>
+	<string name="TooltipDragOntoSelf">
+		Sie können einen Ordner nicht in sich selbst verschieben
 	</string>
 	<string name="TooltipHttpUrl">
 		Anklicken, um Webseite anzuzeigen
@@ -817,6 +835,9 @@ Warten Sie kurz und versuchen Sie dann noch einmal, sich anzumelden.
 	<string name="anim_yes_head">
 		Ja
 	</string>
+	<string name="multiple_textures">
+		Mehrfach
+	</string>
 	<string name="texture_loading">
 		Wird geladen...
 	</string>
@@ -976,6 +997,9 @@ Warten Sie kurz und versuchen Sie dann noch einmal, sich anzumelden.
 	<string name="choose_the_directory">
 		Verzeichnis auswählen
 	</string>
+	<string name="script_files">
+		Skripts
+	</string>
 	<string name="AvatarSetNotAway">
 		Nicht abwesend
 	</string>
@@ -1214,43 +1238,36 @@ Warten Sie kurz und versuchen Sie dann noch einmal, sich anzumelden.
 		Sie haben keine Kopie dieser Textur in Ihrem Inventar.
 	</string>
 	<string name="InventoryInboxNoItems">
-		Objekte, die auf dem Marktplatz gekauft wurden, werden hierher geliefert.
+		Einkäufe aus dem Marktplatz erscheinen hier. Sie können diese dann zur Verwendung in Ihr Inventar ziehen.
 	</string>
 	<string name="MarketplaceURL">
-		http://marketplace.[DOMAIN_NAME]
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/
 	</string>
 	<string name="MarketplaceURL_CreateStore">
-		http://marketplace.[DOMAIN_NAME]/create_store
+		http://community.secondlife.com/t5/English-Knowledge-Base/Selling-in-the-Marketplace/ta-p/700193#Section_.4
 	</string>
-	<string name="MarketplaceURL_LearnMore">
-		http://marketplace.[DOMAIN_NAME]/learn_more
-	</string>
-	<string name="InventoryOutboxCreationErrorTitle">
-		Ihre Händler-Outbox ist nicht richtig konfiguriert
+	<string name="MarketplaceURL_Dashboard">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/merchants/store/dashboard
 	</string>
-	<string name="InventoryOutboxCreationErrorTooltip">
-		Konfigurationsfehler in Händler-Outbox
+	<string name="MarketplaceURL_Imports">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/merchants/store/imports
 	</string>
-	<string name="InventoryOutboxCreationError">
-		Wenden Sie sich zur Behebung des Problems an den Kundendienst.
+	<string name="MarketplaceURL_LearnMore">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/learn_more
 	</string>
 	<string name="InventoryOutboxNotMerchantTitle">
-		Jeder kann Artikel im Marktplatz verkaufen
-	</string>
-	<string name="InventoryOutboxNotMerchantTooltip">
-		Werden Sie Händler!
+		Jeder kann Artikel im Marktplatz verkaufen.
 	</string>
+	<string name="InventoryOutboxNotMerchantTooltip"/>
 	<string name="InventoryOutboxNotMerchant">
-		[[MARKETPLACE_URL] Im Second Life Marktplatz] werden über eine Million virtuelle Produkte zum Verkauf angeboten, die alle von Einwohnern erstellt wurden. Auch Sie können selbst erstellte Artikel sowie bestimmte gekaufte Artikel verkaufen. Die Einrichtung eines Händlerkontos geht blitzschnell und ist kostenlos. [[LEARN_MORE_URL] Lesen Sie weitere Informationen] oder [[CREATE_STORE_URL] öffnen Sie einen Laden] im Marktplatz, um Ihre Objekte zu verkaufen.
+		Wenn Sie als Händler aktiv werden möchten, müssen Sie einen [[MARKETPLACE_CREATE_STORE_URL] Laden im Marktplatz erstellen].
 	</string>
 	<string name="InventoryOutboxNoItemsTitle">
-		Eine neue Methode, um Artikel in den Marktplatz zu übertragen
-	</string>
-	<string name="InventoryOutboxNoItemsTooltip">
-		Legen Sie Artikel hier ab, um sie zum Verkauf im Marktplatz vorzubereiten
+		Ihre Outbox ist leer.
 	</string>
+	<string name="InventoryOutboxNoItemsTooltip"/>
 	<string name="InventoryOutboxNoItems">
-		Ziehen Sie zu verkaufende Artikel oder Ordner in diesen Bereich. Es erscheinen Kopien der Artikel; Ihr Inventar bleibt unverändert, es sei denn, es handelt sich um einen nicht kopierbaren Artikel. Wenn die Artikel in den Marktplatz übertragen werden sollen, klicken Sie auf die Schaltfläche „Hochladen“. Nach Übertragung der Artikel in Ihr Marktplatz-Inventar verschwinden sie aus diesem Ordner.
+		Ziehen Sie Ordner in dien Bereich und klicken Sie auf „In Marktplatz übertragen“, um sie im [[MARKETPLACE_DASHBOARD_URL] Marktplatz] zum Verkauf anzubieten.
 	</string>
 	<string name="Marketplace Error None">
 		Keine Fehler
@@ -1412,6 +1429,9 @@ Warten Sie kurz und versuchen Sie dann noch einmal, sich anzumelden.
 	<string name="no_attachments">
 		Keine Anhänge getragen
 	</string>
+	<string name="Attachments remain">
+		Anhänge (noch [COUNT] Positionen frei)
+	</string>
 	<string name="Buy">
 		Kaufen
 	</string>
@@ -1538,6 +1558,12 @@ Warten Sie kurz und versuchen Sie dann noch einmal, sich anzumelden.
 	<string name="Right Pec">
 		Rechts
 	</string>
+	<string name="Neck">
+		Hals
+	</string>
+	<string name="Avatar Center">
+		Avatar-Mitte
+	</string>
 	<string name="Invalid Attachment">
 		Ungültige Stelle für Anhang
 	</string>
@@ -3898,6 +3924,9 @@ Falls diese Meldung weiterhin angezeigt wird, wenden Sie sich bitte an [SUPPORT_
 	<string name="Saved_message">
 		(Gespeichert am [LONG_TIMESTAMP])
 	</string>
+	<string name="IM_unblock_only_groups_friends">
+		Wenn Sie diese Meldung sehen, müssen Sie unter „Einstellungen“ &gt; „Privatsphäre“ die Option „Nur IMs und Anrufe von Freunden oder Gruppen durchstellen“ deaktivieren.
+	</string>
 	<string name="answered_call">
 		Ihr Anruf wurde entgegengenommen
 	</string>
@@ -4030,6 +4059,18 @@ Falls diese Meldung weiterhin angezeigt wird, wenden Sie sich bitte an [SUPPORT_
 	<string name="you_paid_ldollars_no_name">
 		Sie haben [REASON] [AMOUNT] L$ bezahlt.
 	</string>
+	<string name="you_paid_failure_ldollars">
+		Sie haben [NAME] [AMOUNT] L$ [REASON] nicht bezahlt.
+	</string>
+	<string name="you_paid_failure_ldollars_no_info">
+		Sie haben [AMOUNT] L$ nicht bezahlt.
+	</string>
+	<string name="you_paid_failure_ldollars_no_reason">
+		Sie haben [NAME] [AMOUNT] L$ nicht bezahlt.
+	</string>
+	<string name="you_paid_failure_ldollars_no_name">
+		Sie haben [AMOUNT] L$ [REASON] nicht bezahlt.
+	</string>
 	<string name="for item">
 		für [ITEM]
 	</string>
@@ -4082,8 +4123,8 @@ Falls diese Meldung weiterhin angezeigt wird, wenden Sie sich bitte an [SUPPORT_
 		Online
 	</string>
 	<string name="uploading_abuse_report">
-		Bericht wird hochgeladen...
-  
+		Hochladen...
+
 Missbrauchsbericht
 	</string>
 	<string name="New Shape">
@@ -4351,8 +4392,8 @@ Missbrauchsbericht
 	<string name="server_is_down">
 		Trotz all unserer Bemühungen ist ein unerwarteter Fehler aufgetreten.
 
-	Bitte überprüfen Sie status.secondlifegrid.net, um festzustellen, ob ein Problem besteht.  
-        Falls Sie weiterhin Problem haben, überprüfen Sie bitte Ihre Netzwerk- und Firewalleinstellungen.
+	Bitte überprüfen Sie status.secondlifegrid.net, um herauszufinden, ob ein Problem besteht.
+ Falls Sie weiterhin Problem haben, überprüfen Sie bitte Ihre Netzwerk- und Firewalleinstellungen.
 	</string>
 	<string name="dateTimeWeekdaysNames">
 		Sonntag:Montag:Dienstag:Mittwoch:Donnerstag:Freitag:Samstag
@@ -4440,6 +4481,12 @@ Setzen Sie den Editorpfad in Anführungszeichen
 	<string name="ExternalEditorFailedToRun">
 		Externer Editor konnte nicht ausgeführt werden.
 	</string>
+	<string name="TranslationFailed">
+		Ãœbersetzung fehlgeschlagen: [REASON]
+	</string>
+	<string name="TranslationResponseParseError">
+		Fehler beim Parsen der Ãœbersetzungsantwort.
+	</string>
 	<string name="Esc">
 		Esc
 	</string>
@@ -4810,7 +4857,10 @@ Setzen Sie den Editorpfad in Anführungszeichen
 		Minikarte
 	</string>
 	<string name="Command_Move_Label">
-		Bewegen
+		Gehen / Rennen / Fliegen
+	</string>
+	<string name="Command_Outbox_Label">
+		Händler-Outbox
 	</string>
 	<string name="Command_People_Label">
 		Leute
@@ -4837,10 +4887,10 @@ Setzen Sie den Editorpfad in Anführungszeichen
 		Sprechen
 	</string>
 	<string name="Command_View_Label">
-		Ansicht
+		Kamerasteuerungen
 	</string>
 	<string name="Command_Voice_Label">
-		Stimme in der Nähe
+		Voice-Einstellungen
 	</string>
 	<string name="Command_AboutLand_Tooltip">
 		Informationen zu dem von Ihnen besuchten Land
@@ -4884,6 +4934,9 @@ Setzen Sie den Editorpfad in Anführungszeichen
 	<string name="Command_Move_Tooltip">
 		Ihren Avatar bewegen
 	</string>
+	<string name="Command_Outbox_Tooltip">
+		Artikel zum Verkauf in den Marktplatz übertragen
+	</string>
 	<string name="Command_People_Tooltip">
 		Freunde, Gruppen und Leute in der Nähe
 	</string>
@@ -4912,7 +4965,16 @@ Setzen Sie den Editorpfad in Anführungszeichen
 		Kamerawinkel ändern
 	</string>
 	<string name="Command_Voice_Tooltip">
-		Leute in der Nähe mit Sprechfähigkeit
+		Lautstärkeregler für Anrufe und Leute in Ihrer Nähe in SL
+	</string>
+	<string name="Toolbar_Bottom_Tooltip">
+		gegenwärtig in der unteren Symbolleiste
+	</string>
+	<string name="Toolbar_Left_Tooltip">
+		gegenwärtig in der linken Symbolleiste
+	</string>
+	<string name="Toolbar_Right_Tooltip">
+		gegenwärtig in der rechten Symbolleiste
 	</string>
 	<string name="Retain%">
 		% zurückbehalten
@@ -4938,4 +5000,19 @@ Setzen Sie den Editorpfad in Anführungszeichen
 	<string name="Normal">
 		Normal
 	</string>
+	<string name="snapshot_quality_very_low">
+		Sehr niedrig
+	</string>
+	<string name="snapshot_quality_low">
+		Niedrig
+	</string>
+	<string name="snapshot_quality_medium">
+		Mittel
+	</string>
+	<string name="snapshot_quality_high">
+		Hoch
+	</string>
+	<string name="snapshot_quality_very_high">
+		Sehr hoch
+	</string>
 </strings>
diff --git a/indra/newview/skins/default/xui/de/teleport_strings.xml b/indra/newview/skins/default/xui/de/teleport_strings.xml
index bbfc8306888e619b0eda47e505a9393c7397f1d8..9cf381bacc13581b7e7eba7228faf7c8c6682fe1 100644
--- a/indra/newview/skins/default/xui/de/teleport_strings.xml
+++ b/indra/newview/skins/default/xui/de/teleport_strings.xml
@@ -21,8 +21,8 @@ Wenn der Teleport dann immer noch nicht funktioniert, melden Sie sich bitte ab u
 Versuchen Sie es später noch einmal.
 		</message>
 		<message name="NoHelpIslandTP">
-		Sie können nicht zurück nach Welcome Island teleportieren. 
-Gehen Sie zu „Welcome Island Public“ und wiederholen sie das Tutorial.
+			Sie können nicht zurück nach Welcome Island teleportieren.
+Gehen Sie zu „Welcome Island Public“, um das Tutorial zu wiederholen.
 		</message>
 		<message name="noaccess_tport">
 			Sie haben leider keinen Zugang zu diesem Teleport-Ziel.
diff --git a/indra/newview/skins/default/xui/en/floater_aaa.xml b/indra/newview/skins/default/xui/en/floater_aaa.xml
index 930bbaa8cb10b74b80ce297f27bd71d56649c7fb..d11373ce1d574c7a35cd08fcc6df7bf19ffbeb90 100644
--- a/indra/newview/skins/default/xui/en/floater_aaa.xml
+++ b/indra/newview/skins/default/xui/en/floater_aaa.xml
@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- legacy_header_height="18"
  can_minimize="false"
  can_tear_off="false"
  can_resize="true"
@@ -16,67 +15,98 @@
  save_dock_state="true"
  save_visibility="true"
  single_instance="true" 
- width="320">
-  <string name="nudge_parabuild" translate="false">Nudge 1</string>
-  <string name="test_the_vlt">This string CHANGE2 is extracted.</string>
-  <string name="testing_eli">Just a test. changes.</string>
-  <text_editor
-   parse_urls="true"
-   bg_readonly_color="ChatHistoryBgColor"
-   bg_writeable_color="ChatHistoryBgColor" 
-   border_visible="false"
-   follows="all"
-   font="SansSerif" 
-	 left="1"
-   top="20"
-   layout="topleft"
-	 height="260"
-   name="chat_history"
-   max_length="200000" 
-   parse_highlights="true"
-   text_color="ChatHistoryTextColor"
-   text_readonly_color="ChatHistoryTextColor"
-   translate="false"
-   track_end="true" 
-   wrap="true" 
-   width="320">
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    </text_editor>
+ width="650">
+  <text left="0"
+        follows="left|top|bottom"
+        top="5"
+        clip_partial="true"        
+        bottom="-5"
+        width="100"
+        valign="top">
+this
+is
+some
+text
+that
+is
+top
+aligned</text>
+  <text left_pad="5"
+        follows="left|top|bottom"
+        top="5"
+        bottom="-5"
+        clip_partial="true"
+        width="100"
+        valign="center">
+this
+is
+some
+text
+that
+is
+center
+aligned</text>
+  <text left_pad="5"
+        follows="left|top|bottom"
+        top="5"
+        clip_partial="true"        
+        bottom="-5"
+        width="100"
+        valign="bottom">
+this
+is
+some
+text
+that
+is
+bottom
+aligned</text>
+  <text_editor left_pad="5"
+        follows="left|top|bottom"
+        top="5"
+        clip_partial="true"
+        bottom="-5"
+        width="100"
+        valign="top">
+this
+is
+some
+text
+that
+is
+top
+aligned
+  </text_editor>
+  <text_editor left_pad="5"
+        follows="left|top|bottom"
+        top="5"
+        bottom="-5"
+        clip_partial="true"
+        width="100"
+        valign="center">
+this
+is
+some
+text
+that
+is
+center
+aligned
+  </text_editor>
+  <text_editor left_pad="5"
+        follows="left|top|bottom"
+        top="5"
+        clip_partial="true"
+        bottom="-5"
+        width="100"
+        valign="bottom">
+this
+is
+some
+text
+that
+is
+bottom
+aligned
+  </text_editor>
 </floater>
diff --git a/indra/newview/skins/default/xui/en/floater_about.xml b/indra/newview/skins/default/xui/en/floater_about.xml
index 36af47582477e3ee27868b63b2252fe87e7d9f8a..060d88900327b5adf81538625697af44b2c9d353 100644
--- a/indra/newview/skins/default/xui/en/floater_about.xml
+++ b/indra/newview/skins/default/xui/en/floater_about.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="centered"
+ positioning="centered"
  legacy_header_height="18"
  height="440"
  layout="topleft"
@@ -196,34 +196,36 @@ Dummy Name replaced at run time
        top="5"
        width="435"
        word_wrap="true">
-3Dconnexion SDK Copyright (C) 1992-2007 3Dconnexion
-APR Copyright (C) 2000-2004 The Apache Software Foundation
-Collada DOM Copyright 2005 Sony Computer Entertainment Inc.
-cURL Copyright (C) 1996-2002, Daniel Stenberg, (daniel@haxx.se)
-DBus/dbus-glib Copyright (C) 2002, 2003  CodeFactory AB / Copyright (C) 2003, 2004 Red Hat, Inc.
-expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
-FreeType Copyright (C) 1996-2002, The FreeType Project (www.freetype.org).
-GL Copyright (C) 1999-2004 Brian Paul.
-GLOD Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University and David Luebke, Brenden Schubert, University of Virginia.
-google-perftools Copyright (c) 2005, Google Inc.
-Havok.com(TM) Copyright (C) 1999-2001, Telekinesys Research Limited.
-jpeg2000 Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW)
-jpeglib Copyright (C) 1991-1998, Thomas G. Lane.
-ogg/vorbis Copyright (C) 2001, Xiphophorus
-OpenSSL Copyright (C) 1998-2002 The OpenSSL Project.
-PCRE Copyright (c) 1997-2008 University of Cambridge
-SDL Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
-SSLeay Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
-xmlrpc-epi Copyright (C) 2000 Epinions, Inc.
-zlib Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler.
-google-perftools Copyright (c) 2005, Google Inc.
+        3Dconnexion SDK Copyright (C) 1992-2007 3Dconnexion
+        APR Copyright (C) 2000-2004 The Apache Software Foundation
+        Collada DOM Copyright 2005 Sony Computer Entertainment Inc.
+        cURL Copyright (C) 1996-2002, Daniel Stenberg, (daniel@haxx.se)
+        DBus/dbus-glib Copyright (C) 2002, 2003  CodeFactory AB / Copyright (C) 2003, 2004 Red Hat, Inc.
+        expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
+        FreeType Copyright (C) 1996-2002, The FreeType Project (www.freetype.org).
+        GL Copyright (C) 1999-2004 Brian Paul.
+        GLOD Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University and David Luebke, Brenden Schubert, University of Virginia.
+        google-perftools Copyright (c) 2005, Google Inc.
+        Havok.com(TM) Copyright (C) 1999-2001, Telekinesys Research Limited.
+        jpeg2000 Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW)
+        jpeglib Copyright (C) 1991-1998, Thomas G. Lane.
+        ogg/vorbis Copyright (C) 2001, Xiphophorus
+        OpenSSL Copyright (C) 1998-2002 The OpenSSL Project.
+        PCRE Copyright (c) 1997-2008 University of Cambridge
+        SDL Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
+        SSLeay Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+        xmlrpc-epi Copyright (C) 2000 Epinions, Inc.
+        zlib Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler.
+        google-perftools Copyright (c) 2005, Google Inc.
 
-Second Life Viewer uses Havok (TM) Physics. (c)Copyright 1999-2010 Havok.com Inc. (and its Licensors). All Rights Reserved. See www.havok.com for details.
+        Second Life Viewer uses Havok (TM) Physics. (c)Copyright 1999-2010 Havok.com Inc. (and its Licensors). All Rights Reserved. See www.havok.com for details.
 
-All rights reserved.  See licenses.txt for details.
+        This software contains source code provided by NVIDIA Corporation.
 
-Voice chat Audio coding: Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C)
-        </text_editor>
+        All rights reserved.  See licenses.txt for details.
+
+        Voice chat Audio coding: Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C)
+      </text_editor>
       </panel>
     </tab_container>
 </floater>
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 1c7b354221a36c07f5ab2195b8478282f207dcc9..fb123ec4d1df418d7077b74183834f804d6107b4 100644
--- a/indra/newview/skins/default/xui/en/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/en/floater_about_land.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  can_tear_off="false"
  height="420"
  layout="topleft"
@@ -192,12 +192,12 @@
              type="string"
              length="1"
              follows="left|top"
-             height="20"
+             height="18"
              layout="topleft"
              left_pad="2"
              valign="center" 
              name="ContentRatingText"
-             top_delta="0"
+             top_delta="-2"
              width="250">
                 Adult
             </text>
@@ -209,7 +209,7 @@
              layout="topleft"
              left="10"
              name="Owner:"
-             top_pad="1"
+             top_pad="3"
              width="100">
                 Owner:
             </text>
@@ -736,7 +736,7 @@
              height="16"
              layout="topleft"
              left_pad="10"
-             top_delta="-3" 
+             top_delta="-1" 
              mouse_opaque="false"
              name="region_maturity_text"
              valign="center" 
@@ -1206,15 +1206,11 @@ Only large parcels can be listed in search.
              name="push_restrict_region_text">
                 No Pushing (Region Override)
             </panel.string>
-            <panel.string
-             name="see_avs_text">
-                 See and chat with residents on this parcel
-            </panel.string>
             <text
              type="string"
              length="1"
              follows="left|top"
-             text_color="white"
+             text_color="White"
              height="16"
              layout="topleft"
              left="10"
@@ -1223,30 +1219,33 @@ Only large parcels can be listed in search.
              width="278">
                 Allow other Residents to:
             </text>
-            <check_box
-             height="16"
-             label="Edit Terrain"
-             layout="topleft"
-             left="14"
-             name="edit land check"
-             tool_tip="If checked, anyone can terraform your land. It is best to leave this unchecked, as you can always edit your own land."
-             top_pad="4"
-             width="147i" />
-            <check_box
+          <text
+           type="string"
+           length="1"
+           follows="left|top"
+           height="16"
+           layout="topleft"
+           left="20"
+           name="allow_label0"
+           width="150">
+            Fly:
+          </text>
+
+          <check_box
              height="16"
-             label="Fly"
+             label="Everyone"
              layout="topleft"
              name="check fly"
              tool_tip="If checked, Residents can fly on your land. If unchecked, they can only fly into and over your land."
-             left_pad="4"
-             width="150" />
+             left_pad="2"
+             width="130" />
             <text
              type="string"
              length="1"
              follows="left|top"
              height="16"
              layout="topleft"
-             left="14"
+             left="20"
              name="allow_label2"
              width="150">
                 Build:
@@ -1271,7 +1270,7 @@ Only large parcels can be listed in search.
              follows="left|top"
              height="16"
              layout="topleft"
-             left="14"
+             left="20"
              name="allow_label3"
              width="150">
                 Object Entry:
@@ -1298,7 +1297,7 @@ Only large parcels can be listed in search.
              follows="left|top"
              height="16"
              layout="topleft"
-             left="14"
+             left="20"
              name="allow_label4"
              width="150">
                 Run Scripts:
@@ -1319,49 +1318,47 @@ Only large parcels can be listed in search.
              name="check group scripts"
              top_delta="0"
              width="70" />
-           <text
-             type="string"
-             text_color="white"
-             length="1"
-             follows="left|top"
-             height="16"
-             layout="topleft"
-             left="10"
-             name="land_options_label"
-             width="278">
-                Land Options:
-            </text>
-            <check_box
+          <panel
+            bevel_style="none"
+            border="true"
+            top="146"
+            bottom="146"
+            follows="left|bottom|right"
+            left="20"
+            right="-20"/>
+          <check_box
              height="16"
              label="Safe (no damage)"
              layout="topleft"
-             left="14"
+             left="18"
              name="check safe"
              tool_tip="If checked, sets the land to Safe, disabling damage combat. If cleared, damage combat is enabled."
-             top_pad="5"
+             top="130"
              width="200" />
             <check_box
              height="16"
              label="No Pushing"
              layout="topleft"
-             left_pad="5"
+             left_pad="35"
              name="PushRestrictCheck"
              tool_tip="Prevents scripts from pushing. Checking this option may be useful for preventing disruptive behavior on your land."
-             top_delta="0"
+             top="130"
              width="119" />
             <check_box
              height="16"
              label="Show Place in Search (L$30/week)"
              layout="topleft"
-             left="14"
+             left="18"
              name="ShowDirectoryCheck"
              tool_tip="Let people see this parcel in search results"
+             top="150"
              width="430" />
             <combo_box
              enabled="false"
              height="23"
              layout="topleft"
-             left="30"
+             left="20"
+             top="194"
              name="land category with adult"
              visible="false"
              width="140">
@@ -1426,7 +1423,8 @@ Only large parcels can be listed in search.
              enabled="false"
              height="23"
              layout="topleft"
-             left="30"
+             left="20"
+             top="194"
              name="land category"
              visible="false"
              width="140">
@@ -1487,11 +1485,11 @@ Only large parcels can be listed in search.
              height="16"
              label="Moderate Content"
              layout="topleft"
-             left="14"
+             left="18"
              name="MatureCheck"
-             top="177"
+             top="170"
              label_text.valign="center" 
-             label_text.v_pad="-5" 
+             label_text.v_pad="-1" 
              tool_tip=" "
              width="200" />
             <text
@@ -1500,18 +1498,19 @@ Only large parcels can be listed in search.
              follows="left|top"
              height="16"
              layout="topleft"
-             left="10"
+             left="20"
              name="Snapshot:"
-             text_color="white"
-             top="220"
+             text_color="White"
+             top="225"
              width="200">
                 Snapshot:
             </text>
             <texture_picker
              follows="left|top"
+             top_pad="0"
              height="150"
              layout="topleft"
-             left="14"
+             left="20"
              name="snapshot_ctrl"
              fallback_image="default_land_picture.j2c" 
              tool_tip="Click to choose a picture"
@@ -1520,33 +1519,34 @@ Only large parcels can be listed in search.
              type="string"
              length="1"
              follows="left|top"
-             text_color="white"
-             height="16"
+             text_color="LtGray"
+             height="32"
              layout="topleft"
-             left="230"
-             top="174"
+             left="274"
+             top="150"
              name="allow_label5"
-             width="278">
-              Allow Residents on other parcels to:
+             width="205"
+             wrap="true">
+              Avatars on other parcels can see and chat with avatars on this parcel
             </text>
             <check_box
              height="16"
-             label="See Avatars"
              follows="top"
              layout="topleft"
-             left="230"
+             left="253"
+             top="150"
              name="SeeAvatarsCheck"
-             tool_tip="Allows residents on other parcels to see and chat with residents on this parcel, and you to see and chat with them."
-             width="120" />
+             tool_tip="Allows avatars on other parcels to see and chat with avatars on this parcel, and you to see and chat with them."
+             width="10" />
             <text
              type="string"
              length="1"
              follows="left|top"
              height="16"
              layout="topleft"
-             left="230"
-             top="230"
-             text_color="white"
+             left="255"
+             top="282"
+             text_color="White"
              name="landing_point"
              word_wrap="true"
              width="200">
@@ -1554,12 +1554,13 @@ Only large parcels can be listed in search.
             </text>
             <button
              follows="right|top"
+             top_pad="0"
              height="23"
              label="Set"
              label_selected="Set"
              layout="topleft"
              name="Set"
-             left="230"
+             left="255"
              tool_tip="Sets the landing point where visitors arrive. Sets to your avatar&apos;s location inside this parcel."
              width="50" />
             <button
@@ -1575,11 +1576,11 @@ Only large parcels can be listed in search.
             <text
              type="string"
              length="1"
-             text_color="white"
+             text_color="White"
              follows="left|top"
              height="16"
              layout="topleft"
-             left="230"
+             left="255"
              top_pad="10"
              name="Teleport Routing: "
              width="200">
@@ -1589,7 +1590,7 @@ Only large parcels can be listed in search.
              height="23"
              layout="topleft"
              name="landing type"
-             top_pad="3"
+             top_pad="0"
              tool_tip="Teleport Routing -- select how to handle teleports onto your land"
              width="120">
                 <combo_box.item
@@ -1951,35 +1952,17 @@ Only large parcels can be listed in search.
 				(Defined by the Estate)
 			</panel.string>
       <panel.string
-       name="allow_public_access">
-        Allow Public Access ([MATURITY]) (Note: Unchecking this will create ban lines)
-      </panel.string>
-            <panel.string
              name="estate_override">
                 One or more of these options is set at the estate level
             </panel.string>
-            <text
-             type="string"
-             length="1"
-             follows="left|top"
-             height="16"
-             layout="topleft"
-             left="10"
-             name="Limit access to this parcel to:"
-             text_color="White"
-             top="10"
-             width="400">
-                Access To This Parcel
-            </text>
             <check_box
              follows="top|left"
              height="16"
              layout="topleft"
-             left_delta="0"
+             left="8"
              name="public_access"
-             top_pad="5"
-             label_text.valign="center"
-             label_text.v_pad="-2" 
+             label="Allow Public Access (Unchecking this will create ban lines)"
+             top_pad="10" 
              width="278" />
             <text
              type="string"
@@ -1989,28 +1972,28 @@ Only large parcels can be listed in search.
              layout="topleft"
              left_delta="20"
              name="Only Allow"
-             top="49"
+             top="30"
              width="325">
-                Restrict Access to Residents verified by:
+                Allow access only to Residents who:
             </text>
             <check_box
              follows="top|left"
              height="16"
-             label="Payment Information on File [ESTATE_PAYMENT_LIMIT]"
+             label="Have payment Information on File [ESTATE_PAYMENT_LIMIT]"
              layout="topleft"
              left_delta="0"
              name="limit_payment"
-             tool_tip="Ban unidentified Residents."
+             tool_tip="Residents must have payment information on file to access this parcel.  See the [SUPPORT_SITE] for more information."
              top_pad="4"
              width="278" />
             <check_box
              follows="top|left"
              height="16"
-             label="Age Verification [ESTATE_AGE_LIMIT]"
+             label="Have been age-verified [ESTATE_AGE_LIMIT]"
              layout="topleft"
              left_delta="0"
              name="limit_age_verified"
-             tool_tip="Ban Residents who have not verified their age. See the [SUPPORT_SITE] for more information."
+             tool_tip="Residents must be age verified to access this parcel. See the [SUPPORT_SITE] for more information."
              top_pad="4"
              width="278" />
             <check_box
@@ -2020,7 +2003,7 @@ Only large parcels can be listed in search.
              left="8"
              name="GroupCheck"
              tool_tip="Set group in the General tab."
-             top="109"
+             top="89"
              width="278" />
             <check_box
              enabled="false"
@@ -2102,7 +2085,7 @@ Only large parcels can be listed in search.
              column_padding="0"
              follows="top|bottom"
              heading_height="14"
-             height="120"
+             height="125"
              layout="topleft"
              left="0"
              multi_select="true"
@@ -2151,7 +2134,7 @@ Only large parcels can be listed in search.
              column_padding="0"
              follows="top|bottom"
              heading_height="14"
-             height="120"
+             height="125"
              layout="topleft"
              left="0"
              multi_select="true"
diff --git a/indra/newview/skins/default/xui/en/floater_activeim.xml b/indra/newview/skins/default/xui/en/floater_activeim.xml
index 670c528f083b7c7a4e1e96c18f339761bb54dfda..b79c5d9a19773ae6740a8fe50e10fa43b57e99d1 100644
--- a/indra/newview/skins/default/xui/en/floater_activeim.xml
+++ b/indra/newview/skins/default/xui/en/floater_activeim.xml
@@ -6,7 +6,6 @@
 	title="ACTIVE IM"
 	height="22"
 	width="320"
-	follows="right|bottom"
 	background_visible="true"
 	can_close="true"
 	can_dock="true"
diff --git a/indra/newview/skins/default/xui/en/floater_animation_anim_preview.xml b/indra/newview/skins/default/xui/en/floater_animation_anim_preview.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b5538a511c1f689db942de9c77ee0f36083c6f3b
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_animation_anim_preview.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<floater
+ legacy_header_height="18"
+ height="190"
+ layout="topleft"
+ name="Anim Preview"
+ help_topic="animation_anim_preview"
+ title="ANIMATION.ANIM"
+ width="300">
+    <text
+     type="string"
+     length="1"
+     follows="left|top"
+     height="15"
+     layout="topleft"
+     left="10"
+     mouse_opaque="false"
+     name="name_label"
+     top="20"
+     width="275">
+        Name:
+    </text>
+    <line_editor
+     border_style="line"
+     border_thickness="1"
+     follows="left|top|right"
+     height="19"
+     layout="topleft"
+     left_delta="0"
+     max_length_bytes="63"
+     name="name_form"
+     top_pad="0"
+     width="280" />
+    <text
+     type="string"
+     length="1"
+     follows="left|top"
+     height="15"
+     layout="topleft"
+     left_delta="0"
+     mouse_opaque="false"
+     name="description_label"
+     top_pad="10"
+     width="270">
+        Description:
+    </text>
+    <line_editor
+     border_style="line"
+     border_thickness="1"
+     follows="left|top|right"
+     height="19"
+     layout="topleft"
+     left_delta="0"
+     max_length_bytes="127"
+     name="description_form"
+     top_pad="0"
+     width="280" />
+    <button
+     follows="left|bottom"
+     height="22"
+     label="Upload (L$[AMOUNT])"
+     layout="topleft"
+     left="45"
+     name="ok_btn"
+     top_pad="60"
+     width="150" />
+    <button
+     follows="right|bottom"
+     height="22"
+     label="Cancel"
+     label_selected="Cancel"
+     layout="topleft"
+     name="cancel_btn"
+     left_pad="5"
+     width="90" />
+</floater>
diff --git a/indra/newview/skins/default/xui/en/floater_animation_preview.xml b/indra/newview/skins/default/xui/en/floater_animation_bvh_preview.xml
similarity index 100%
rename from indra/newview/skins/default/xui/en/floater_animation_preview.xml
rename to indra/newview/skins/default/xui/en/floater_animation_bvh_preview.xml
diff --git a/indra/newview/skins/default/xui/en/floater_avatar.xml b/indra/newview/skins/default/xui/en/floater_avatar.xml
index 6009821f7faeae04877dc23441a16d9786840348..cd5cca02bdb19023929b882956c8308713bb7f6b 100644
--- a/indra/newview/skins/default/xui/en/floater_avatar.xml
+++ b/indra/newview/skins/default/xui/en/floater_avatar.xml
@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  ignore_ui_scale="false"
  legacy_header_height="225"
  can_minimize="true"
  can_close="true"
  can_resize="true"
  min_height="230"
- min_width="450"
+ min_width="515"
  height="230"
  layout="topleft"
  name="Avatar"
@@ -15,7 +15,7 @@
  help_topic="avatar"
  save_rect="true"
  save_visibility="true"
- title="AVATAR PICKER"
+ title="CHOOSE AN AVATAR"
  width="700">
     <web_browser
       top="25"
diff --git a/indra/newview/skins/default/xui/en/floater_avatar_picker.xml b/indra/newview/skins/default/xui/en/floater_avatar_picker.xml
index cbbbeb609481a49ce10f0c3b6111d078e447f4b6..1a55dc2e2ce46108413c32671dd27c480783defe 100644
--- a/indra/newview/skins/default/xui/en/floater_avatar_picker.xml
+++ b/indra/newview/skins/default/xui/en/floater_avatar_picker.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  legacy_header_height="18"
  can_resize="true"
  height="350"
diff --git a/indra/newview/skins/default/xui/en/floater_build_options.xml b/indra/newview/skins/default/xui/en/floater_build_options.xml
index afb7917043136b99064a2a45a2af22645338dc39..38428b36fc6d55c4cfdbe4b2b1a96f3f3dc2c3e8 100644
--- a/indra/newview/skins/default/xui/en/floater_build_options.xml
+++ b/indra/newview/skins/default/xui/en/floater_build_options.xml
@@ -1,71 +1,13 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
  legacy_header_height="18"
- follows="right"
- height="198"
+ height="170"
  layout="topleft"
  name="build options floater"
  help_topic="build_options_floater"
  save_rect="true"
  title="GRID OPTIONS"
  width="264">
- 	<floater.string
-     name="grid_screen_text">
-        Screen
-    </floater.string>
-    <floater.string
-     name="grid_local_text">
-        Local
-    </floater.string>
-    <floater.string
-     name="grid_world_text">
-        World
-    </floater.string>
-    <floater.string
-     name="grid_reference_text">
-        Reference
-    </floater.string>
-    <floater.string
-     name="grid_attachment_text">
-        Attachment
-    </floater.string>
-    <text
-     type="string"
-     length="1"
-     follows="left|top"
-     height="16"
-     layout="topleft"
-     left="10"
-     tool_tip="Grid opacity"
-     name="grid_mode_label"
-     top_pad="30"
-     width="123">
-        Mode
-    </text>
-    <combo_box
-     height="23"
-     layout="topleft"
-     left_pad="9"
-     follows="left|top"
-     name="combobox grid mode"
-     tool_tip="Choose the type of grid ruler for positioning the object"
-     top_delta="-3"
-     width="108">
-      <combo_box.item
-       label="World grid"
-       name="World"
-       value="World" />
-      <combo_box.item
-       label="Local grid"
-       name="Local"
-       value="Local" />
-      <combo_box.item
-       label="Reference grid"
-       name="Reference"
-       value="Reference" />
-       <combo_box.commit_callback
-      function="GridOptions.gridMode"/>
-    </combo_box>
     <spinner
      control_name="GridResolution"
      follows="left|top"
@@ -78,7 +20,7 @@
      max_val="5"
      min_val="0.01"
      name="GridResolution"
-     top_pad="4"
+     top_pad="30"
      width="200" />
     <spinner
      control_name="GridDrawSize"
diff --git a/indra/newview/skins/default/xui/en/floater_buy_contents.xml b/indra/newview/skins/default/xui/en/floater_buy_contents.xml
index 92001534e7e349d0586788069eb061fe5191c27d..ac96a7080572de496d1b368eb72eeb9dc72c0cf3 100644
--- a/indra/newview/skins/default/xui/en/floater_buy_contents.xml
+++ b/indra/newview/skins/default/xui/en/floater_buy_contents.xml
@@ -62,7 +62,7 @@
      layout="topleft"
      left="10"
      name="buy_text"
-     text_color="white"
+     text_color="White"
      top="220"
      use_ellipses="true" 
      width="260">
diff --git a/indra/newview/skins/default/xui/en/floater_buy_currency.xml b/indra/newview/skins/default/xui/en/floater_buy_currency.xml
index 49ca6cc8baebd253a00c474212b8d9872475641e..553c5d51d013a11a9fa84fa62ea84666e035efb4 100644
--- a/indra/newview/skins/default/xui/en/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/en/floater_buy_currency.xml
@@ -215,7 +215,7 @@
     <text
      type="string"
      length="1"
-     text_color="0.7 0.7 0.7 0.5"
+     text_color="LtGray_50"
      follows="top|left"
      layout="topleft"
      halign="right"
@@ -224,12 +224,12 @@
      width="300"
      height="30"
      name="currency_links">
-      [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] | [http://www.secondlife.com/my/account/exchange_rates.php exchange rate]
+      [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency]
     </text>
     <text
      type="string"
      length="1"
-     text_color="0.7 0.7 0.7 0.5"
+     text_color="LtGray_50"
      follows="top|left"
      layout="topleft"
      halign="right"
@@ -243,7 +243,7 @@ Re-enter amount to see the latest exchange rate.
     <text
      type="string"
      length="1"
-     text_color="0.7 0.7 0.7 0.5"
+     text_color="LtGray_50"
      follows="top|left"
      layout="topleft"
      halign="right"
@@ -257,7 +257,7 @@ Re-enter amount to see the latest exchange rate.
     <text
      type="string"
      length="1"
-     text_color="0.7 0.7 0.7 0.5"
+     text_color="LtGray_50"
      follows="top|left"
      layout="topleft"
      halign="right"
diff --git a/indra/newview/skins/default/xui/en/floater_buy_object.xml b/indra/newview/skins/default/xui/en/floater_buy_object.xml
index 8dfb6ba00c03c90cd735c6d96d7292c34de703c2..5fdd4aa49d990a0757e27ff367e32ac0cfb1455f 100644
--- a/indra/newview/skins/default/xui/en/floater_buy_object.xml
+++ b/indra/newview/skins/default/xui/en/floater_buy_object.xml
@@ -89,7 +89,7 @@
      left_delta="0"
 	 line_spacing.pixels="7"
      name="buy_text"
-     text_color="white"
+     text_color="White"
      top_pad="5"
      use_ellipses="true"
      width="260"
@@ -106,7 +106,7 @@ Buy for L$[AMOUNT] from:
      left_delta="0"
 	 line_spacing.pixels="7"
      name="buy_name_text"
-     text_color="white"
+     text_color="White"
      top_pad="5"
      use_ellipses="true"
      width="260">
diff --git a/indra/newview/skins/default/xui/en/floater_camera.xml b/indra/newview/skins/default/xui/en/floater_camera.xml
index e7f5207271752fc7800f9eaf205ce03bcdecdb03..22bc488a925377a06c974a10b9bd11393c3f726f 100644
--- a/indra/newview/skins/default/xui/en/floater_camera.xml
+++ b/indra/newview/skins/default/xui/en/floater_camera.xml
@@ -1,19 +1,19 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="specified"
- specified_left="320"
- specified_bottom="80"
+ positioning="specified"
+ left="458"
+ bottom="-80"
+ follows="left|bottom"
  legacy_header_height="18"
  can_minimize="true"
  can_close="true"
- follows="bottom"
  height="164"
  layout="topleft"
  name="camera_floater"
  help_topic="camera_floater"
  save_visibility="true"
  single_instance="true"
- title="VIEW"
+ title="CAMERA CONTROLS"
  chrome="true"
  save_rect="true"
  width="228">
@@ -29,18 +29,6 @@
      name="move_tooltip">
         Move Camera Up and Down, Left and Right
     </floater.string>
-    <floater.string
-     name="camera_modes_title">
-        Camera modes
-    </floater.string>
-    <floater.string
-     name="pan_mode_title">
-       Orbit Zoom Pan
-    </floater.string>
-    <floater.string
-     name="presets_mode_title">
-        Preset Views
-    </floater.string>
     <floater.string
      name="free_mode_title">
         View Object
diff --git a/indra/newview/skins/default/xui/en/floater_chat_bar.xml b/indra/newview/skins/default/xui/en/floater_chat_bar.xml
index 87606c1a2aaeb61e0ca8ebd30f8c02498fb776d6..688a01ce7bc2d05a8b43a0ef906a73509c312bf3 100644
--- a/indra/newview/skins/default/xui/en/floater_chat_bar.xml
+++ b/indra/newview/skins/default/xui/en/floater_chat_bar.xml
@@ -1,14 +1,15 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="specified"
- specified_left="320"
- specified_bottom="10"
+ positioning="specified"
+ left="10"
+ bottom="-10"
  height="60"
  layout="topleft"
  legacy_header_height="25"
  single_instance="true"
  title="NEARBY CHAT"
  save_rect="true"
+ save_visibility="true"
  can_close="true"
  can_minimize="true"
  help_topic="chat_bar"
@@ -17,19 +18,20 @@
  can_resize="true"
  default_tab_group="1"
  name="chat_bar"
- width="380">
+ width="300">
     <panel
         top="20"
         class="panel_nearby_chat"
         follow="all"
-        width="380"
+        width="300"
         height="0"
         visible="false"
         filename="panel_nearby_chat.xml"
         name="nearby_chat" />
-    <panel width="380" 
+    <panel width="300" 
            height="31" 
            left="0" 
+           name="bottom_panel"
            bottom="-1" 
            follows="left|right|bottom" 
            tab_group="1">
@@ -48,7 +50,7 @@
         text_pad_right="25"
         tool_tip="Press Enter to say, Ctrl+Enter to shout"
         top="2"
-        width="335" />
+        width="255" />
       <output_monitor
         auto_update="true"
         follows="right"
diff --git a/indra/newview/skins/default/xui/en/floater_choose_group.xml b/indra/newview/skins/default/xui/en/floater_choose_group.xml
index dc1ee5f24e21f5b4bf7591adb1d9a4a40e831ca4..2cf6e682fde9d484d7c778c5f2246391fc69e090 100644
--- a/indra/newview/skins/default/xui/en/floater_choose_group.xml
+++ b/indra/newview/skins/default/xui/en/floater_choose_group.xml
@@ -20,7 +20,7 @@
         Choose a group:
     </text>
     <scroll_list
-     height="160"
+     height="165"
      layout="topleft"
      left_delta="0"
      name="group list"
diff --git a/indra/newview/skins/default/xui/en/floater_color_picker.xml b/indra/newview/skins/default/xui/en/floater_color_picker.xml
index 421f3a72c61f14c69164180ba65225793f76ea84..e06d10606a3b72e47bfbf87c9ae1ddcc133d3a39 100644
--- a/indra/newview/skins/default/xui/en/floater_color_picker.xml
+++ b/indra/newview/skins/default/xui/en/floater_color_picker.xml
@@ -2,7 +2,6 @@
 <floater
  legacy_header_height="18"
  can_minimize="false"
- follows="left|top"
  height="380"
  layout="topleft"
  name="ColorPicker"
diff --git a/indra/newview/skins/default/xui/en/floater_critical.xml b/indra/newview/skins/default/xui/en/floater_critical.xml
index 13b15bf724060976b62fdae0f1a1437628d08e66..143bcb44300ad988dbc8590fa0d8bbed27255062 100644
--- a/indra/newview/skins/default/xui/en/floater_critical.xml
+++ b/indra/newview/skins/default/xui/en/floater_critical.xml
@@ -6,7 +6,7 @@
  height="500"
  layout="topleft"
  name="modal container"
- open_positioning="centered"
+ positioning="centered"
  width="600">
     <button
      height="20"
diff --git a/indra/newview/skins/default/xui/en/floater_destinations.xml b/indra/newview/skins/default/xui/en/floater_destinations.xml
index 373114a1eb8a748170552b2dcf1450fd86defe16..39aa8e07bb647b5131ad52614b8429aa6d4b2d33 100644
--- a/indra/newview/skins/default/xui/en/floater_destinations.xml
+++ b/indra/newview/skins/default/xui/en/floater_destinations.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  ignore_ui_scale="false"
  legacy_header_height="225"
  can_minimize="true"
diff --git a/indra/newview/skins/default/xui/en/floater_event.xml b/indra/newview/skins/default/xui/en/floater_event.xml
index 7ed020f83235f3ce5a115878121775d8cd58812f..cf61b7d24d4409b1f0db01787af31438a212681f 100644
--- a/indra/newview/skins/default/xui/en/floater_event.xml
+++ b/indra/newview/skins/default/xui/en/floater_event.xml
@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- follows="all"
  height="400"
  can_resize="true"
  help_topic="event_details"
diff --git a/indra/newview/skins/default/xui/en/floater_fast_timers.xml b/indra/newview/skins/default/xui/en/floater_fast_timers.xml
index 49aa8f384008638e734b0a7bab7ab2f6adeed287..77adb5524e7b073931d9e38744c46734ed250029 100644
--- a/indra/newview/skins/default/xui/en/floater_fast_timers.xml
+++ b/indra/newview/skins/default/xui/en/floater_fast_timers.xml
@@ -22,7 +22,6 @@
           top="5"
           width="180"
           height="40"
-          pad_bottom="-5"
           label="Pause"
           font="SansSerifHuge"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/en/floater_gesture.xml b/indra/newview/skins/default/xui/en/floater_gesture.xml
index a941734358c683db55766194aa7b80885eba3f27..200e9b9537c2228ad07e799201ce8c3b84b999d4 100644
--- a/indra/newview/skins/default/xui/en/floater_gesture.xml
+++ b/indra/newview/skins/default/xui/en/floater_gesture.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  save_rect="true"
  legacy_header_height="18"
  can_resize="true"
@@ -9,7 +9,6 @@
  help_topic="gestures"
  title="GESTURES"
  background_visible="true"
- follows="all"
  label="Places"
  layout="topleft"
  min_height="350"
diff --git a/indra/newview/skins/default/xui/en/floater_hardware_settings.xml b/indra/newview/skins/default/xui/en/floater_hardware_settings.xml
index 05f4c52b950e0ba11bc1b52dd0fa6dabfdecf233..66bb9d3cea8e74d63286911ac71ec819e9223ac6 100644
--- a/indra/newview/skins/default/xui/en/floater_hardware_settings.xml
+++ b/indra/newview/skins/default/xui/en/floater_hardware_settings.xml
@@ -35,7 +35,7 @@
      height="12"
      layout="topleft"
      left="10"
-     name="Antialiasing:"
+     name="antialiasing label"
      top_pad="7"
      width="188">
         Antialiasing:
diff --git a/indra/newview/skins/default/xui/en/floater_help_browser.xml b/indra/newview/skins/default/xui/en/floater_help_browser.xml
index d101bca6943e59523d433ecf12c8c62a3e65bcc3..c06cb63f8acd1b414d814a5e708740f7306dcc38 100644
--- a/indra/newview/skins/default/xui/en/floater_help_browser.xml
+++ b/indra/newview/skins/default/xui/en/floater_help_browser.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  legacy_header_height="18"
  can_resize="true"
  height="600"
@@ -34,7 +34,6 @@
          left_delta="0"
          top_delta="0"
          name="external_controls"
-         user_resize="false"
          width="620">
             <web_browser
              trusted_content="true" 
diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml
index cb7d91abb882ced4fd97412d3a2d53e23ea641a3..ca73883e5346c3aed135449f0731a09025594e0c 100644
--- a/indra/newview/skins/default/xui/en/floater_im_session.xml
+++ b/indra/newview/skins/default/xui/en/floater_im_session.xml
@@ -3,8 +3,8 @@
  legacy_header_height="18"
  background_visible="true"
  default_tab_group="1"
- follows="all"
- height="350"
+ height="355"
+ help_topic="floater_im_box"
  layout="topleft"
  name="panel_im"
  can_dock="false"
@@ -16,7 +16,7 @@
  min_width="250"
  min_height="190">
   <layout_stack
-   animate="false" 
+   animate="true" 
    default_tab_group="2"
   follows="all"
   height="320"
@@ -32,8 +32,7 @@
       min_width="115"
       width="150" 
       height="320" 
-      auto_resize="false"
-      user_resize="false">
+      auto_resize="false">
       <panel
         name="panel_im_control_panel"
         layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/floater_image_preview.xml b/indra/newview/skins/default/xui/en/floater_image_preview.xml
index 86232de1a4711d88783cf07120802a1139e97ee2..44d2c14cc8d1cbd2090e8bd3407900a222c73540 100644
--- a/indra/newview/skins/default/xui/en/floater_image_preview.xml
+++ b/indra/newview/skins/default/xui/en/floater_image_preview.xml
@@ -2,7 +2,7 @@
 <floater
  legacy_header_height="18"
  can_minimize="false"
- height="440"
+ height="460"
  layout="topleft"
  name="Image Preview"
  help_topic="image_preview"
@@ -108,7 +108,7 @@
     <text
      type="string"
      length="1"
-     bottom="225"
+     bottom="250"
      height="45"
      word_wrap="true"
      follows="top|left"
@@ -137,7 +137,7 @@ Try saving image as 24 bit Targa (.tga).
      layout="topleft"
      left="165"
      name="cancel_btn"
-     top="410"
+     top="430"
      width="125" />
     <button
      follows="bottom|left"
diff --git a/indra/newview/skins/default/xui/en/floater_joystick.xml b/indra/newview/skins/default/xui/en/floater_joystick.xml
index 6e1bb8fcd02fa9b8469766331d618122832b4911..59f6a9434c4ac5661411b878b34c9874b0b2c765 100644
--- a/indra/newview/skins/default/xui/en/floater_joystick.xml
+++ b/indra/newview/skins/default/xui/en/floater_joystick.xml
@@ -13,6 +13,7 @@
     </floater.string>
     <check_box
      bottom="38"
+     height="10"
      control_name="JoystickEnabled"
      halign="left"
      label="Enable Joystick:"
@@ -28,6 +29,7 @@
      width="380" />
     <spinner
      bottom="48"
+     height="10"
      control_name="JoystickAxis1"
      decimal_digits="0"
      increment="1"
@@ -41,6 +43,7 @@
      width="140" />
     <spinner
      bottom="48"
+     height="10"     
      control_name="JoystickAxis2"
      decimal_digits="0"
      increment="1"
@@ -54,6 +57,7 @@
      width="140" />
     <spinner
      bottom="48"
+     height="10"     
      control_name="JoystickAxis0"
      decimal_digits="0"
      increment="1"
@@ -67,6 +71,7 @@
      width="140" />
     <spinner
      bottom="68"
+     height="10"     
      control_name="JoystickAxis4"
      decimal_digits="0"
      increment="1"
@@ -80,6 +85,7 @@
      width="140" />
     <spinner
      bottom="68"
+     height="10"     
      control_name="JoystickAxis5"
      decimal_digits="0"
      increment="1"
@@ -93,6 +99,7 @@
      width="140" />
     <spinner
      bottom="68"
+     height="10"     
      control_name="JoystickAxis3"
      decimal_digits="0"
      increment="1"
@@ -106,6 +113,7 @@
      width="140" />
     <spinner
      bottom="88"
+     height="10"     
      control_name="JoystickAxis6"
      decimal_digits="0"
      increment="1"
@@ -119,6 +127,7 @@
      width="140" />
     <check_box
      bottom_delta="18"
+     height="10"
      control_name="ZoomDirect"
      label="Direct Zoom"
      layout="topleft"
@@ -127,6 +136,7 @@
      width="60" />
     <check_box
      bottom_delta="0"
+     height="10"     
      control_name="Cursor3D"
      label="3D Cursor"
      layout="topleft"
@@ -135,6 +145,7 @@
      width="60" />
     <check_box
      bottom_delta="0"
+     height="10"     
      control_name="AutoLeveling"
      label="Auto Level"
      layout="topleft"
@@ -157,6 +168,7 @@
     </text>
     <check_box
      bottom="127"
+     height="10"     
      control_name="JoystickAvatarEnabled"
      halign="center"
      label="Avatar"
@@ -166,6 +178,7 @@
      width="60" />
     <check_box
      bottom="127"
+     height="10"     
      control_name="JoystickBuildEnabled"
      halign="center"
      label="Build"
@@ -175,6 +188,7 @@
      width="60" />
     <check_box
      bottom="127"
+     height="10"     
      control_name="JoystickFlycamEnabled"
      halign="center"
      label="Flycam"
@@ -257,6 +271,7 @@
     </text>
     <spinner
      bottom="144"
+     height="10"     
      control_name="AvatarAxisScale1"
      decimal_digits="2"
      label_width="0"
@@ -268,6 +283,7 @@
      width="56" />
     <spinner
      bottom="144"
+     height="10"     
      control_name="BuildAxisScale1"
      decimal_digits="2"
      label_width="0"
@@ -279,6 +295,7 @@
      width="56" />
     <spinner
      bottom="144"
+     height="10"     
      control_name="FlycamAxisScale1"
      decimal_digits="2"
      label_width="0"
@@ -301,6 +318,7 @@
     </text>
     <spinner
      bottom="164"
+     height="10"     
      control_name="AvatarAxisScale2"
      decimal_digits="2"
      label_width="0"
@@ -312,6 +330,7 @@
      width="56" />
     <spinner
      bottom="164"
+     height="10"     
      control_name="BuildAxisScale2"
      decimal_digits="2"
      label_width="0"
@@ -323,6 +342,7 @@
      width="56" />
     <spinner
      bottom="164"
+     height="10"     
      control_name="FlycamAxisScale2"
      decimal_digits="2"
      label_width="0"
@@ -345,6 +365,7 @@
     </text>
     <spinner
      bottom="184"
+     height="10"     
      control_name="AvatarAxisScale0"
      decimal_digits="2"
      label_width="0"
@@ -356,6 +377,7 @@
      width="56" />
     <spinner
      bottom="184"
+     height="10"     
      control_name="BuildAxisScale0"
      decimal_digits="2"
      label_width="0"
@@ -367,6 +389,7 @@
      width="56" />
     <spinner
      bottom="184"
+     height="10"     
      control_name="FlycamAxisScale0"
      decimal_digits="2"
      label_width="0"
@@ -389,6 +412,7 @@
     </text>
     <spinner
      bottom="204"
+     height="10"     
      control_name="AvatarAxisScale4"
      decimal_digits="2"
      label_width="0"
@@ -400,6 +424,7 @@
      width="56" />
     <spinner
      bottom="204"
+     height="10"     
      control_name="BuildAxisScale4"
      decimal_digits="2"
      label_width="0"
@@ -411,6 +436,7 @@
      width="56" />
     <spinner
      bottom="204"
+     height="10"     
      control_name="FlycamAxisScale4"
      decimal_digits="2"
      label_width="0"
@@ -433,6 +459,7 @@
     </text>
     <spinner
      bottom="224"
+     height="10"
      control_name="AvatarAxisScale5"
      decimal_digits="2"
      label_width="0"
@@ -444,6 +471,7 @@
      width="56" />
     <spinner
      bottom="224"
+     height="10"
      control_name="BuildAxisScale5"
      decimal_digits="2"
      label_width="0"
@@ -455,6 +483,7 @@
      width="56" />
     <spinner
      bottom="224"
+     height="10"
      control_name="FlycamAxisScale5"
      decimal_digits="2"
      label_width="0"
@@ -477,6 +506,7 @@
     </text>
     <spinner
      bottom="244"
+     height="10"
      control_name="BuildAxisScale3"
      decimal_digits="2"
      label_width="0"
@@ -488,6 +518,7 @@
      width="56" />
     <spinner
      bottom="244"
+     height="10"
      control_name="FlycamAxisScale3"
      decimal_digits="2"
      label_width="0"
@@ -510,6 +541,7 @@
     </text>
     <spinner
      bottom="274"
+     height="10"
      control_name="AvatarAxisDeadZone1"
      decimal_digits="2"
      increment="0.01"
@@ -520,6 +552,7 @@
      width="56" />
     <spinner
      bottom="274"
+     height="10"
      control_name="BuildAxisDeadZone1"
      decimal_digits="2"
      increment="0.01"
@@ -530,6 +563,7 @@
      width="56" />
     <spinner
      bottom="274"
+     height="10"
      control_name="FlycamAxisDeadZone1"
      decimal_digits="2"
      increment="0.01"
@@ -551,6 +585,7 @@
     </text>
     <spinner
      bottom="294"
+     height="10"     
      control_name="AvatarAxisDeadZone2"
      decimal_digits="2"
      increment="0.01"
@@ -561,6 +596,7 @@
      width="56" />
     <spinner
      bottom="294"
+     height="10"
      control_name="BuildAxisDeadZone2"
      decimal_digits="2"
      increment="0.01"
@@ -571,6 +607,7 @@
      width="56" />
     <spinner
      bottom="294"
+     height="10"
      control_name="FlycamAxisDeadZone2"
      decimal_digits="2"
      increment="0.01"
@@ -592,6 +629,7 @@
     </text>
     <spinner
      bottom="314"
+     height="10"
      control_name="AvatarAxisDeadZone0"
      decimal_digits="2"
      increment="0.01"
@@ -602,6 +640,7 @@
      width="56" />
     <spinner
      bottom="314"
+     height="10"
      control_name="BuildAxisDeadZone0"
      decimal_digits="2"
      increment="0.01"
@@ -612,6 +651,7 @@
      width="56" />
     <spinner
      bottom="314"
+     height="10"
      control_name="FlycamAxisDeadZone0"
      decimal_digits="2"
      increment="0.01"
@@ -633,6 +673,7 @@
     </text>
     <spinner
      bottom="334"
+     height="10"
      control_name="AvatarAxisDeadZone4"
      decimal_digits="2"
      increment="0.01"
@@ -643,6 +684,7 @@
      width="56" />
     <spinner
      bottom="334"
+     height="10"
      control_name="BuildAxisDeadZone4"
      decimal_digits="2"
      increment="0.01"
@@ -653,6 +695,7 @@
      width="56" />
     <spinner
      bottom="334"
+     height="10"
      control_name="FlycamAxisDeadZone4"
      decimal_digits="2"
      increment="0.01"
@@ -674,6 +717,7 @@
     </text>
     <spinner
      bottom="354"
+     height="10"
      control_name="AvatarAxisDeadZone5"
      decimal_digits="2"
      increment="0.01"
@@ -684,6 +728,7 @@
      width="56" />
     <spinner
      bottom="354"
+     height="10"
      control_name="BuildAxisDeadZone5"
      decimal_digits="2"
      increment="0.01"
@@ -694,6 +739,7 @@
      width="56" />
     <spinner
      bottom="354"
+     height="10"
      control_name="FlycamAxisDeadZone5"
      decimal_digits="2"
      increment="0.01"
@@ -715,6 +761,7 @@
     </text>
     <spinner
      bottom="374"
+     height="10"
      control_name="BuildAxisDeadZone3"
      decimal_digits="2"
      increment="0.01"
@@ -725,6 +772,7 @@
      width="56" />
     <spinner
      bottom="374"
+     height="10"
      control_name="FlycamAxisDeadZone3"
      decimal_digits="2"
      increment="0.01"
@@ -802,6 +850,7 @@
     </text>
     <spinner
      bottom="430"
+     height="10"
      control_name="FlycamAxisScale6"
      decimal_digits="2"
      label_width="0"
@@ -824,6 +873,7 @@
     </text>
     <spinner
      bottom="450"
+     height="10"
      control_name="FlycamAxisDeadZone6"
      decimal_digits="2"
      increment="0.01"
diff --git a/indra/newview/skins/default/xui/en/floater_land_holdings.xml b/indra/newview/skins/default/xui/en/floater_land_holdings.xml
index 3737294ebe633bb0b9e0e65c7e6182f305181435..390ec9ab7d4015364fbc0bcd1660fb2acc994377 100644
--- a/indra/newview/skins/default/xui/en/floater_land_holdings.xml
+++ b/indra/newview/skins/default/xui/en/floater_land_holdings.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="centered"
+ positioning="centered"
  legacy_header_height="18"
  height="430"
  layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/floater_live_lsleditor.xml b/indra/newview/skins/default/xui/en/floater_live_lsleditor.xml
index 1f192f9b280ac5701bc75620f33c0e013af917d8..5cd7cd196dd469b2af1870022d4717f3a46fe35e 100644
--- a/indra/newview/skins/default/xui/en/floater_live_lsleditor.xml
+++ b/indra/newview/skins/default/xui/en/floater_live_lsleditor.xml
@@ -4,7 +4,6 @@
  bevel_style="none"
  border_style="line"
  can_resize="true"
- follows="left|top"
  height="580"
  layout="topleft"
  min_height="271"
diff --git a/indra/newview/skins/default/xui/en/floater_lsl_guide.xml b/indra/newview/skins/default/xui/en/floater_lsl_guide.xml
index c9d87f158f435cedb4e8f4402d56b1dcaacb92db..e9676777f439eb94aa3b2179906407e9fe903e93 100644
--- a/indra/newview/skins/default/xui/en/floater_lsl_guide.xml
+++ b/indra/newview/skins/default/xui/en/floater_lsl_guide.xml
@@ -2,7 +2,6 @@
 <floater
  legacy_header_height="18"
  can_resize="true"
- follows="left|top"
  height="400"
  layout="topleft"
  min_height="271"
diff --git a/indra/newview/skins/default/xui/en/floater_map.xml b/indra/newview/skins/default/xui/en/floater_map.xml
index 31972d412247fa32cb77e7c012966519decda46c..b8893e11d90207b5430afd4630aadccc0f57fc44 100644
--- a/indra/newview/skins/default/xui/en/floater_map.xml
+++ b/indra/newview/skins/default/xui/en/floater_map.xml
@@ -1,10 +1,9 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  can_minimize="true" 
  can_resize="true"
  chrome="true"
- follows="top|right"
  height="200"
  layout="topleft"
  min_height="128"
diff --git a/indra/newview/skins/default/xui/en/floater_media_browser.xml b/indra/newview/skins/default/xui/en/floater_media_browser.xml
index c3324a6aa40be8fb11f94f1ad50beeeb27eef315..ce788654aa32ed97a8d4789a273dc25be2f92d4c 100644
--- a/indra/newview/skins/default/xui/en/floater_media_browser.xml
+++ b/indra/newview/skins/default/xui/en/floater_media_browser.xml
@@ -37,7 +37,6 @@
          min_height="20"
          name="nav_controls"
          top="400"
-         user_resize="false"
          width="800">
             <button
              follows="left|top"
@@ -113,7 +112,6 @@
          min_height="20"         
          name="time_controls"
          top_delta="0"
-         user_resize="false"
          width="800">
             <button
              follows="left|top"
@@ -171,7 +169,6 @@
          min_height="20"         
          name="parcel_owner_controls"
          top_delta="0"
-         user_resize="false"
          width="540">
             <button
              enabled="false"
@@ -193,7 +190,6 @@
          left_delta="0"
          name="external_controls"
          top_delta="0"
-         user_resize="false"
          width="540">
           <web_browser
              bottom="-30"
diff --git a/indra/newview/skins/default/xui/en/floater_mem_leaking.xml b/indra/newview/skins/default/xui/en/floater_mem_leaking.xml
index 28a29c42aac37287bda427efa55db6888b675997..fb7d09a21eb9e96511f701c9b85c2e05c7926a9c 100644
--- a/indra/newview/skins/default/xui/en/floater_mem_leaking.xml
+++ b/indra/newview/skins/default/xui/en/floater_mem_leaking.xml
@@ -2,7 +2,6 @@
 <floater
  legacy_header_height="18"
  can_minimize="false"
- follows="left|top"
  height="175"
  layout="topleft"
  name="MemLeak"
diff --git a/indra/newview/skins/default/xui/en/floater_merchant_outbox.xml b/indra/newview/skins/default/xui/en/floater_merchant_outbox.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b98f280b562735228408e092aa809394db6b4f01
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_merchant_outbox.xml
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<floater
+    positioning="cascading"
+    can_close="true"
+    can_resize="true"
+    height="440"
+    help_topic="floater_merchant_outbox"
+    min_width="300"
+    min_height="200"
+    name="floater_merchant_outbox"
+    save_rect="true"
+    save_visibility="false"
+    reuse_instance="true"
+    title="MERCHANT OUTBOX"
+    width="333">
+  <string name="OutboxFolderCount0"></string>
+  <string name="OutboxFolderCount1">1 folder</string>
+  <string name="OutboxFolderCountN">[NUM] folders</string>
+  <string name="OutboxImporting">Sending folders...</string>
+  <string name="OutboxInitializing">Initializing...</string>
+  <panel
+      follows="all"
+      layout="topleft"
+      left="0"
+      top="0"
+      label=""
+      height="440"
+      width="333">
+    <panel
+        follows="all"
+        left="10"
+        bottom="370"
+        width="313"
+        top="0"
+        bg_opaque_color="InventoryBackgroundColor">
+      <panel
+          name="outbox_inventory_placeholder_panel"
+          follows="all"
+          layout="topleft"
+          top="0"
+          left="0"
+          width="308"
+          height="370"
+          bg_opaque_color="InventoryBackgroundColor">
+        <text
+            name="outbox_inventory_placeholder_title"
+            type="string"
+            follows="top|left|right"
+            layout="topleft"
+            top="10"
+            left="0"
+            width="308"
+            height="25"
+            wrap="true"
+            halign="center"
+            font="SansSerifBold">
+          Loading...
+        </text>
+        <text
+            name="outbox_inventory_placeholder_text"
+            type="string"
+            follows="top|left|right"
+            layout="topleft"
+            top="35"
+            left="0"
+            width="308"
+            height="130"
+            wrap="true"
+            halign="left" />
+      </panel>
+    </panel>
+    <panel
+        follows="bottom|left|right"
+        left="10"
+        bottom="435"
+        width="313"
+        top="370">
+      <panel
+          name="outbox_generic_drag_target"
+          mouse_opaque="false"
+          follows="all"
+          top="5"
+          left="5"
+          width="303"
+          height="25"
+          background_visible="false"
+          bg_alpha_color="EmphasisColor_35"
+          border="true"
+          bevel_style="in"
+          visible="true">
+        <text
+            type="string"
+            follows="all"
+            layout="topleft"
+            top="6"
+            height="20"
+            left="5"
+            width="293"
+            halign="center"
+            font="SansSerifMedium"
+            font_shadow="hard"
+            valign="top">
+          Drag items here to create folders
+        </text>
+      </panel>
+      <text
+          name="outbox_folder_count"
+          type="string"
+          follows="all"
+          layout="topleft"
+          top="40"
+          left="5"
+          width="150"
+          height="20"
+          wrap="true"
+          halign="left"
+          valign="center"
+          font="SansSerif"/>
+      <button
+          label="Send to Marketplace"
+          tool_tip="Push to my Marketplace Storefront"
+          is_toggle="false"
+          name="outbox_import_btn"
+          follows="bottom|right"
+          tab_stop="false"
+          halign="center"
+          top="37"
+          left="160"
+          height="25"
+          width="150"
+          enabled="false" />
+    </panel>
+    <layout_stack name="import_progress_indicator" orientation="vertical" left="0" height="440" top="0" width="333" follows="all" visible="false">
+      <layout_panel />
+      <layout_panel height="24" auto_resize="false">
+        <layout_stack orientation="horizontal" left="0" height="24" top="0" width="333" follows="all">
+          <layout_panel width="0" />
+          <layout_panel width="24" auto_resize="false">
+            <loading_indicator
+                height="24"
+                layout="topleft"
+                left="0"
+                top="0"
+                width="24" />
+          </layout_panel>
+          <layout_panel width="0" />
+        </layout_stack>
+      </layout_panel>
+      <layout_panel />
+    </layout_stack>
+  </panel>
+</floater>
diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml
old mode 100755
new mode 100644
index fbaf4f0a8a80803a556ab9be3a4e92d94f2480c0..0e211551e67dc099c159b46688f30d1405590dd7
--- a/indra/newview/skins/default/xui/en/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml
@@ -6,6 +6,7 @@
 
   <string name="status_idle"></string>
   <string name="status_parse_error">Error: Dae parsing issue - see log for details.</string>
+  <string name="status_material_mismatch">Error: Material of model is not a subset of reference model.</string>
   <string name="status_reading_file">Loading...</string>
   <string name="status_generating_meshes">Generating Meshes...</string>
   <string name="status_vertex_number_overflow">Error: Vertex number is more than 65534, aborted!</string>
@@ -116,18 +117,18 @@
              name="lod_tab_border"
              top_pad="0"
              width="619" />
-            <text
-             follows="left|top"
-             height="18"
-             initial_value="Source"
-             layout="topleft"
-             left="75"
-             name="source"
-             text_color="ModelUploaderLabels"
-             top="15"
-             valign="center"
-             value="Source"
-             width="335" />
+          <text
+           follows="left|top"
+           height="18"
+           initial_value="Source"
+           layout="topleft"
+           left="75"
+           name="source"
+           text_color="ModelUploaderLabels"
+           top="15"
+           valign="center"
+           value="Source"
+           width="335"/>
             <text
              follows="left|top"
              halign="right"
@@ -162,7 +163,7 @@
              name="high_label"
              text_color="ModelUploaderLabels"
              top_pad="10"
-             valign="center"
+             valign="top"
              value="High"
              width="65" />
             <combo_box
@@ -239,34 +240,34 @@
             <text
              follows="left|top"
              halign="right"
-             height="18"
+             height="15"
              initial_value="0"
              layout="topleft"
              left_pad="0"
              name="high_triangles"
-             valign="center"
+             valign="top"
              value="0"
              width="65" />
             <text
              follows="left|top"
              halign="right"
-             height="18"
+             height="15"
              initial_value="0"
              layout="topleft"
              left_pad="0"
              name="high_vertices"
-             valign="center"
+             valign="top"
              value="0"
              width="65" />
             <text
              follows="left|top"
              halign="center"
-             height="18"
+             height="15"
              initial_value=""
              layout="topleft"
              left_pad="0"
              name="high_status"
-             valign="center"
+             valign="top"
              value=""
              width="65" />
             <icon
@@ -276,7 +277,7 @@
              left_delta="20"
              mouse_opaque="true"
              name="status_icon_high"
-             top_delta="0"
+             top_delta="-2"
              width="16" />
             <text
              follows="left|top"
@@ -287,7 +288,7 @@
              name="medium_label"
              text_color="ModelUploaderLabels"
              top_pad="15"
-             valign="center"
+             valign="top"
              value="Medium"
              width="65" />
             <combo_box
@@ -367,34 +368,34 @@
             <text
              follows="left|top"
              halign="right"
-             height="18"
+             height="15"
              initial_value="0"
              layout="topleft"
              left_pad="0"
              name="medium_triangles"
-             valign="center"
+             valign="top"
              value="0"
              width="65" />
             <text
              follows="left|top"
              halign="right"
-             height="18"
+             height="15"
              initial_value="0"
              layout="topleft"
              left_pad="0"
              name="medium_vertices"
-             valign="center"
+             valign="top"
              value="0"
              width="65" />
             <text
              follows="left|top"
              halign="center"
-             height="18"
+             height="15"
              initial_value=""
              layout="topleft"
              left_pad="0"
              name="medium_status"
-             valign="center"
+             valign="top"
              value=""
              width="65" />
             <icon
@@ -404,7 +405,7 @@
              left_delta="20"
              mouse_opaque="true"
              name="status_icon_medium"
-             top_delta="0"
+             top_delta="-2"
              width="16" />
             <text
              follows="left|top"
@@ -415,7 +416,7 @@
              name="low_label"
              text_color="ModelUploaderLabels"
              top_pad="15"
-             valign="center"
+             valign="top"
              value="Low"
              width="65" />
             <combo_box
@@ -495,34 +496,34 @@
             <text
              follows="left|top"
              halign="right"
-             height="18"
+             height="15"
              initial_value="0"
              layout="topleft"
              left_pad="0"
              name="low_triangles"
-             valign="center"
+             valign="top"
              value="0"
              width="65" />
             <text
              follows="left|top"
              halign="right"
-             height="18"
+             height="15"
              initial_value="0"
              layout="topleft"
              left_pad="0"
              name="low_vertices"
-             valign="center"
+             valign="top"
              value="0"
              width="65" />
             <text
              follows="left|top"
              halign="center"
-             height="18"
+             height="15"
              initial_value=""
              layout="topleft"
              left_pad="0"
              name="low_status"
-             valign="center"
+             valign="top"
              value=""
              width="65" />
             <icon
@@ -532,7 +533,7 @@
              left_delta="20"
              mouse_opaque="true"
              name="status_icon_low"
-             top_delta="0"
+             top_delta="-2"
              width="16" />
             <text
              follows="left|top"
@@ -543,7 +544,7 @@
              name="lowest_label"
              text_color="ModelUploaderLabels"
              top_pad="15"
-             valign="center"
+             valign="top"
              value="Lowest"
              width="65" />
             <combo_box
@@ -623,34 +624,34 @@
             <text
              follows="left|top"
              halign="right"
-             height="18"
+             height="15"
              initial_value="0"
              layout="topleft"
              left_pad="0"
              name="lowest_triangles"
-             valign="center"
+             valign="top"
              value="0"
              width="65" />
             <text
              follows="left|top"
              halign="right"
-             height="18"
+             height="15"
              initial_value="0"
              layout="topleft"
              left_pad="0"
              name="lowest_vertices"
-             valign="center"
+             valign="top"
              value="0"
              width="65" />
             <text
              follows="left|top"
              halign="center"
-             height="18"
+             height="15"
              initial_value=""
              layout="topleft"
              left_pad="0"
              name="lowest_status"
-             valign="center"
+             valign="top"
              value=""
              width="65" />
             <icon
@@ -789,7 +790,7 @@
                     <check_box name="physics_use_hull" follows="left|top" width="130" left_pad="5" height="20" label="Use Convex Hull"/> -->
                 </panel>
             
-            <!-- ==== STEP 2: Analyse ==== -->
+            <!-- ==== STEP 2: Analyze ==== -->
             <view_border
               bevel_style="none"
               follows="top|left"
@@ -818,7 +819,7 @@
                       name="method_label"
                       text_color="White"
                       top_pad="0">
-                      Step 2: Analyse
+                      Step 2: Analyze
                     </text>
                     <text
                       follows="top|left"
diff --git a/indra/newview/skins/default/xui/en/floater_model_wizard.xml b/indra/newview/skins/default/xui/en/floater_model_wizard.xml
index 9c0af7d9ba5330c62b8d36c68b60b7ab12266ad0..62b8c5f96edd46c2fac913b37c1136059206889f 100644
--- a/indra/newview/skins/default/xui/en/floater_model_wizard.xml
+++ b/indra/newview/skins/default/xui/en/floater_model_wizard.xml
@@ -108,7 +108,7 @@
 		 height="22"
 		 top_pad="15"
 		 width="505"
-		 name="header_panel"
+		 name="choose_file_header_panel"
 		 bg_opaque_color="DkGray2"
 		 background_visible="true"
 		 background_opaque="true"
@@ -117,7 +117,7 @@
 			 width="200"
 			 left="10"
 			 top="3"
-			 name="header_text"
+			 name="choose_file_header_text"
 			 text_color="White"
 			 height="10"
 			 font="SansSerifBig"
@@ -130,7 +130,7 @@
 		 left="15"
 		 height="310"
 		 width="505"
-		 name="content"
+		 name="choose_file_content"
 		 bg_opaque_color="DkGray2"
 		 background_visible="true"
 		 background_opaque="true">
@@ -287,7 +287,7 @@
 		<panel
 		 height="22"
 		 top_pad="15"
-		 name="header_panel"
+		 name="optimize_header_panel"
 		 width="505"
 		 bg_opaque_color="DkGray2"
 		 background_visible="true"
@@ -296,7 +296,7 @@
 			<text
 			 width="200"
 			 left="10"
-			 name="header_text"
+			 name="optimize_header_text"
 			 top="3"
 			 text_color="White"
 			 height="10"
@@ -311,7 +311,7 @@
 		 height="20"
 		 font="SansSerifSmall"
 		 layout="topleft"
-		 name="description"
+		 name="optimize_description"
 		 word_wrap="true"
 		 left_delta="5">
 			We have optimized the model for performance. Adjust it further if you wish.
@@ -322,7 +322,7 @@
 		 left="15"
 		 height="270"
 		 width="505"
-		 name="content"
+		 name="optimize_content"
 		 bg_opaque_color="DkGray2"
 		 background_visible="true"
 		 background_opaque="true">
@@ -497,7 +497,7 @@ Higher prim weight</text>
 		<panel
 		 height="22"
 		 top_pad="15"
-		 name="header_panel"
+		 name="physics_header_panel"
 		 width="505"
 		 bg_opaque_color="DkGray2"
 		 background_visible="true"
@@ -506,7 +506,7 @@ Higher prim weight</text>
 			<text
 			 width="200"
 			 left="10"
-			 name="header_text"
+			 name="physics_header_text"
 			 top="3"
 			 height="10"
 			 font="SansSerifBig"
@@ -521,7 +521,7 @@ Higher prim weight</text>
 		 height="50"
 		 font="SansSerifSmall"
 		 layout="topleft"
-		 name="description"
+		 name="physics_description"
 		 word_wrap="true"
 		 left_delta="5">
 			We will create a shape for the outer hull of the model. Adjust the shape's detail level as needed for the intended purpose of your model.
@@ -531,7 +531,7 @@ Higher prim weight</text>
 		 left="15"
 		 height="270"
 		 width="505"
-		 name="content"
+		 name="physics_content"
 		 bg_opaque_color="DkGray2"
 		 background_visible="true"
 		 background_opaque="true">
@@ -635,7 +635,7 @@ Buildings</text>
 		<panel
 		 height="22"
 		 top_pad="15"
-		 name="header_panel"
+		 name="review_header_panel"
 		 width="505"
 		 bg_opaque_color="DkGray2"
 		 background_visible="true"
@@ -644,7 +644,7 @@ Buildings</text>
 			<text
 			 width="200"
 			 left="10"
-			 name="header_text"
+			 name="review_header_text"
 			 text_color="White" 
 			 top="3"
 			 height="10"
@@ -658,7 +658,7 @@ Buildings</text>
 		 left="15"
 		 height="310"
 		 width="505"
-		 name="content"
+		 name="review_content"
 		 bg_opaque_color="DkGray2"
 		 background_visible="true"
 		 background_opaque="true">
@@ -706,7 +706,7 @@ Buildings</text>
 		<panel
 		 height="22"
 		 top_pad="15"
-		 name="header_panel"
+		 name="upload_header_panel"
 		 width="505"
 		 bg_opaque_color="DkGray2"
 		 background_visible="true"
@@ -715,7 +715,7 @@ Buildings</text>
 			<text
 			 width="200"
 			 left="10"
-			 name="header_text"
+			 name="upload_header_text"
 			 top="3"
 			 text_color="White" 
 			 height="10"
diff --git a/indra/newview/skins/default/xui/en/floater_moveview.xml b/indra/newview/skins/default/xui/en/floater_moveview.xml
index e96039a3e153fa16d7f3db583011a08be5421308..4e7ee7913fba8e7766646b3406b49bc1c81df15e 100644
--- a/indra/newview/skins/default/xui/en/floater_moveview.xml
+++ b/indra/newview/skins/default/xui/en/floater_moveview.xml
@@ -1,13 +1,12 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="specified"
- specified_left="558"
- specified_bottom="80"
+ positioning="specified"
+ left="320"
+ bottom="-80"
  legacy_header_height="18"
  can_dock="false"
  can_minimize="true"
  can_close="true"
- follows="bottom"
  height="110"
  layout="topleft"
  name="move_floater"
@@ -16,7 +15,7 @@
  save_visibility="true"
  single_instance="true"
  chrome="true"
- title="MOVE"
+ title="WALK / RUN / FLY"
  width="133">
     <string
      name="walk_forward_tooltip">
diff --git a/indra/newview/skins/default/xui/en/floater_my_appearance.xml b/indra/newview/skins/default/xui/en/floater_my_appearance.xml
index a40393aed8b6ec804a24d9f7cd17ef9ca5c39aa8..fdea7a821ab28e26259eb9d2a54d417f77a5af57 100644
--- a/indra/newview/skins/default/xui/en/floater_my_appearance.xml
+++ b/indra/newview/skins/default/xui/en/floater_my_appearance.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 
 <floater
-  open_positioning="cascading"
+  positioning="cascading"
   legacy_header_height="18"
   can_resize="true"
   height="588"
@@ -12,7 +12,7 @@
   single_instance="true"
   reuse_instance="true"
   title="APPEARANCE"
-  min_height="260"
+  min_height="440"
   min_width="333"
   width="333">
     <panel
diff --git a/indra/newview/skins/default/xui/en/floater_my_inventory.xml b/indra/newview/skins/default/xui/en/floater_my_inventory.xml
index cd0b59dc5136e76f1e1b9a1391d33b1df62808be..184f29625595a485568d60304ff98e526df51ba0 100644
--- a/indra/newview/skins/default/xui/en/floater_my_inventory.xml
+++ b/indra/newview/skins/default/xui/en/floater_my_inventory.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  can_close="true"
  can_resize="true"
  height="570"
diff --git a/indra/newview/skins/default/xui/en/floater_my_web_profile.xml b/indra/newview/skins/default/xui/en/floater_my_web_profile.xml
new file mode 100644
index 0000000000000000000000000000000000000000..df46fc198f2acfca79af55fbd0087fe22c68ff76
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_my_web_profile.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<floater name="floater_my_web_profile"
+         help_topic="web_profile"
+         width="780"
+         height="775"
+         save_rect="true"
+         single_instance="true"
+         reuse_instance="false"
+         filename="floater_web_content.xml"/>
\ No newline at end of file
diff --git a/indra/newview/skins/default/xui/en/floater_people.xml b/indra/newview/skins/default/xui/en/floater_people.xml
index 32dda1b694920961f9b6b936196661c412ab374c..08d0b00a835ebd5140021d85e94d9b23ddb12d74 100644
--- a/indra/newview/skins/default/xui/en/floater_people.xml
+++ b/indra/newview/skins/default/xui/en/floater_people.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
 
 <floater
-  open_positioning="cascading"
+  positioning="cascading"
   can_close="true"
   can_resize="true"
   height="570"
@@ -25,10 +25,6 @@
         class="panel_people"
         name="panel_people"
         filename="panel_people.xml"/>
-      <panel
-        class="panel_profile_view"
-        name="panel_profile_view"
-        filename="panel_profile_view.xml"/>
       <panel
         class="panel_group_info_sidetray"
         name="panel_group_info_sidetray"
diff --git a/indra/newview/skins/default/xui/en/floater_picks.xml b/indra/newview/skins/default/xui/en/floater_picks.xml
index 78821166624401bdea23a42c6c97d09a1aa11f25..984894b0165a4012b6056806ac3a813cc96d5b5a 100644
--- a/indra/newview/skins/default/xui/en/floater_picks.xml
+++ b/indra/newview/skins/default/xui/en/floater_picks.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  can_close="true"
  can_resize="true"
  height="572"
diff --git a/indra/newview/skins/default/xui/en/floater_places.xml b/indra/newview/skins/default/xui/en/floater_places.xml
index 6484b543604ec6a31e02b11c6ecb24d5cf241913..b241e265a9a7ba6bcc502e18d9443131ca6e6a2c 100644
--- a/indra/newview/skins/default/xui/en/floater_places.xml
+++ b/indra/newview/skins/default/xui/en/floater_places.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 
 <floater
-  open_positioning="cascading"
+  positioning="cascading"
   legacy_header_height="18"
   can_resize="true"
   height="588"
@@ -11,7 +11,7 @@
   save_rect="true"
   reuse_instance="true"
   title="PLACES"
-  min_height="230"
+  min_height="440"
   min_width="333"
   width="333">
     <panel
diff --git a/indra/newview/skins/default/xui/en/floater_preferences.xml b/indra/newview/skins/default/xui/en/floater_preferences.xml
index 402868bb977659a03b3afd7afc64de835cf093dc..bd6faf4ed8fb01650f528413e2c2fb9d303eca51 100644
--- a/indra/newview/skins/default/xui/en/floater_preferences.xml
+++ b/indra/newview/skins/default/xui/en/floater_preferences.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
  legacy_header_height="18"
- open_positioning="centered"
+ positioning="centered"
  default_tab_group="1"
  height="460"
  layout="topleft"
@@ -100,7 +100,7 @@
          help_topic="preferences_colors_tab"
          name="colors" />
         <panel
-		 class="panel_preference"
+         class="panel_preference_privacy"
          filename="panel_preferences_privacy.xml"
          label="Privacy"
          layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/floater_preview_animation.xml b/indra/newview/skins/default/xui/en/floater_preview_animation.xml
index 8427c7b06f228a5c3312c7351b95ef0523126dd7..3ea5f54f2cbd4f4460e3746f4565962df6069466 100644
--- a/indra/newview/skins/default/xui/en/floater_preview_animation.xml
+++ b/indra/newview/skins/default/xui/en/floater_preview_animation.xml
@@ -41,18 +41,26 @@
      label_selected="Stop"
      layout="topleft"
      left="10"
-     name="Anim play btn"
+     name="Inworld"
      tool_tip="Play this animation so that others can see it"
      top="47"
-     width="125" />
+     width="125">
+       <button.commit_callback
+        function="PreviewAnim.Play"
+        parameter="Inworld" /> 
+    </button>
     <button
      height="20"
      label="Play Locally"
      label_selected="Stop"
      layout="topleft"
      left_pad="5"
-     name="Anim audition btn"
+     name="Locally"
      tool_tip="Play this animation so that only you can see it"
      top_delta="0"
-     width="125" />
+     width="125">
+       <button.commit_callback
+        function="PreviewAnim.Play"
+        parameter="Locally" /> 
+    </button>
 </floater>
diff --git a/indra/newview/skins/default/xui/en/floater_preview_notecard.xml b/indra/newview/skins/default/xui/en/floater_preview_notecard.xml
index f35628f8e519814675253ecf1fac602bb3a13149..be3b2d179d5155acaf9a359baac3dc9498a7a6d9 100644
--- a/indra/newview/skins/default/xui/en/floater_preview_notecard.xml
+++ b/indra/newview/skins/default/xui/en/floater_preview_notecard.xml
@@ -3,7 +3,6 @@
  legacy_header_height="18"
  can_resize="true"
  default_tab_group="1"
- follows="left|top"
  height="361"
  layout="topleft"
  min_height="243"
diff --git a/indra/newview/skins/default/xui/en/floater_preview_texture.xml b/indra/newview/skins/default/xui/en/floater_preview_texture.xml
index 92d3a6702c1d64f8d5fa759f19d1fbe1bd15a18b..137e278ddcf562bc3732ede88379fead5094e654 100644
--- a/indra/newview/skins/default/xui/en/floater_preview_texture.xml
+++ b/indra/newview/skins/default/xui/en/floater_preview_texture.xml
@@ -2,7 +2,6 @@
 <floater
  legacy_header_height="18"
  can_resize="true"
- follows="left|top"
  height="350"
  layout="topleft"
  min_height="200"
diff --git a/indra/newview/skins/default/xui/en/floater_script.xml b/indra/newview/skins/default/xui/en/floater_script.xml
index 73e6d6147a311053d3335877aa5784f9e82fd5e7..bd4edb81c85dd329f03ecc06dda0cb1decf913b6 100644
--- a/indra/newview/skins/default/xui/en/floater_script.xml
+++ b/indra/newview/skins/default/xui/en/floater_script.xml
@@ -2,7 +2,6 @@
 <floater
  legacy_header_height="18"
  background_visible="true"
- follows="left|top|right|bottom"
  height="250"
  layout="topleft"
  name="script_floater"
diff --git a/indra/newview/skins/default/xui/en/floater_script_debug_panel.xml b/indra/newview/skins/default/xui/en/floater_script_debug_panel.xml
index ce96ea232e949656dae8f91d4dc511c4f83c813f..b5dd2f97b9237b4e4ab6d65b699b5a4affe8005f 100644
--- a/indra/newview/skins/default/xui/en/floater_script_debug_panel.xml
+++ b/indra/newview/skins/default/xui/en/floater_script_debug_panel.xml
@@ -2,7 +2,6 @@
 <floater
  legacy_header_height="18"
  can_resize="true"
- follows="left|top|right|bottom"
  height="200"
  layout="topleft"
  name="script"
diff --git a/indra/newview/skins/default/xui/en/floater_search.xml b/indra/newview/skins/default/xui/en/floater_search.xml
index dd818e2e0659646b6f3d1dda5f582631dfda8640..c3e7028dc5b79e2686a0230143d91e691e84a960 100644
--- a/indra/newview/skins/default/xui/en/floater_search.xml
+++ b/indra/newview/skins/default/xui/en/floater_search.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
-  open_positioning="cascading"
+  positioning="cascading"
   legacy_header_height="18"
   can_resize="true"
   height="775"
diff --git a/indra/newview/skins/default/xui/en/floater_snapshot.xml b/indra/newview/skins/default/xui/en/floater_snapshot.xml
index d7a1510c1c0c8cb5db1b1bf681cca1747f9fda30..49d64767cc783f28164c1ad28da13ef9515bab51 100644
--- a/indra/newview/skins/default/xui/en/floater_snapshot.xml
+++ b/indra/newview/skins/default/xui/en/floater_snapshot.xml
@@ -1,16 +1,15 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  legacy_header_height="18"
  can_minimize="true"
  can_close="true"
- follows="left|top"
- height="600"
+ height="500"
  layout="topleft"
  name="Snapshot"
  help_topic="snapshot"
  save_rect="true"
- save_visibility="true"
+ save_visibility="false"
  title="SNAPSHOT PREVIEW"
  width="470">
     <floater.string
@@ -35,7 +34,7 @@
     </string>
  	<string
  	 name="profile_succeeded_str">
- 	    Your Profile Feed has been updated!
+ 	    Image uploaded
  	</string>
  	<string
  	 name="postcard_succeeded_str">
@@ -51,7 +50,7 @@
  	</string>
  	<string
  	 name="profile_failed_str">
- 	    Failed to update your Profile Feed.
+ 	    Failed to upload image to your Profile Feed.
  	</string>
  	<string
  	 name="postcard_failed_str">
@@ -65,45 +64,15 @@
  	 name="local_failed_str">
  	    Failed to save to computer.
  	</string>
-   <view_border 
-    bevel_style="in"
-    follows="left|top" 
-    height="21"
-    left="10"
-    layout="topleft"
-    name="img_info_border"
-    top="22"
-    width="50"
-   />
-   <icon
-    follows="top|left"
-    height="18"
-    image_name="Snapshot_Off"
-    layout="topleft"
-    left_delta="-5"
-    mouse_opaque="true"
-    name="refresh_icon"
-    top_delta="3"
-    width="36" />
-   <button
-    follows="left|top"
-    height="22"
-    image_overlay="Refresh_Off"
-    layout="topleft"
-    left_delta="31"
-    name="new_snapshot_btn"
-    top_delta="-3"
-    width="23" />
     <button
      follows="left|top"
      height="23"
      image_overlay="TabIcon_Close_Off"
-     is_toggle="true"
      layout="topleft"
-     left="240"
+     left="236"
      name="advanced_options_btn"
      tool_tip="Advanced options"
-     top_delta="0"
+     top="25"
      width="23" />
   <ui_ctrl 
     height="160"
@@ -113,6 +82,70 @@
     top="50"
     follows="left|top"
     left="10">
+      <panel
+       background_visible="true"
+       bg_alpha_color="0.9 1 0.9 1"
+       follows="left|top"
+       font="SansSerifLarge"
+       halign="center"
+       height="20"
+       layout="topleft"
+       left="0"
+       length="1"
+       name="succeeded_panel"
+       right="-1"
+       top="0"
+       type="string"
+       visible="false">
+          <text
+           follows="all"
+           font="SansSerif"
+           halign="center"
+           height="18"
+           layout="topleft"
+           left="1"
+           length="1"
+           name="succeeded_lbl"
+           right="-1"
+           text_color="0.2 0.5 0.2 1"
+           top="4"
+           translate="false"
+           type="string">
+              Succeeded
+          </text>
+      </panel>
+      <panel
+       background_visible="true"
+       bg_alpha_color="1 0.9 0.9 1"
+       follows="left|top"
+       font="SansSerifLarge"
+       halign="center"
+       height="20"
+       layout="topleft"
+       left_delta="0"
+       length="1"
+       name="failed_panel"
+       right="-1"
+       top="0"
+       type="string"
+       visible="false">
+          <text
+           follows="all"
+           font="SansSerif"
+           halign="center"
+           height="18"
+           layout="topleft"
+           left="1"
+           length="1"
+           name="failed_lbl"
+           right="-1"
+           text_color="0.5 0.2 0.2 1"
+           top="4"
+           translate="false"
+           type="string">
+              Failed
+          </text>
+      </panel>
       <loading_indicator
        follows="left|top"
        height="48"
@@ -139,6 +172,34 @@
        width="130">
           Working
       </text>
+      <button
+       follows="left|top"
+       height="22"
+       image_overlay="Refresh_Off"
+       layout="topleft"
+       left="20"
+       name="new_snapshot_btn"
+       bottom="-20"
+       visible="false"
+       width="22" />
+      <text
+       follows="left|top"
+       font="SansSerifBold"
+       halign="left"
+       height="18"
+       layout="topleft"
+       left_pad="10"
+       length="1"
+       name="refresh_lbl"
+       right="-5"
+       text_color="red"
+       top_delta="0"
+       translate="false"
+       type="string"
+       visible="false"
+       width="130">
+          Refresh to save.
+      </text>
   </ui_ctrl>
   <view_border 
    bevel_style="in" 
@@ -180,7 +241,7 @@
    </text>
     <panel_container
      follows="left|top"
-     height="360"
+     height="260"
      layout="topleft"
      left="0"
      name="panel_container"
diff --git a/indra/newview/skins/default/xui/en/floater_stats.xml b/indra/newview/skins/default/xui/en/floater_stats.xml
index 406114294df6b5d8b9273090220d0adf1c0c9831..2fd932786bdf9e897bbcf0f06bfd740bd5aa751d 100644
--- a/indra/newview/skins/default/xui/en/floater_stats.xml
+++ b/indra/newview/skins/default/xui/en/floater_stats.xml
@@ -2,7 +2,6 @@
 <floater
  legacy_header_height="18"
  can_resize="true"
- follows="top|right"
  height="400"
  layout="topleft"
  name="Statistics"
diff --git a/indra/newview/skins/default/xui/en/floater_sys_well.xml b/indra/newview/skins/default/xui/en/floater_sys_well.xml
index 9b96a5badc7ec019c00c29b26c2f246c11bea4f0..ecedb2743896e3d3b75d56f0d9fba45cb9a4e6cf 100644
--- a/indra/newview/skins/default/xui/en/floater_sys_well.xml
+++ b/indra/newview/skins/default/xui/en/floater_sys_well.xml
@@ -2,7 +2,6 @@
 <floater
  legacy_header_height="18"
  bevel_style="in"
- follows="right|bottom"
  layout="topleft"
  name="sys_well_window"
  help_topic="notification_chiclet"
diff --git a/indra/newview/skins/default/xui/en/floater_test_layout_stacks.xml b/indra/newview/skins/default/xui/en/floater_test_layout_stacks.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a04050e7eb7987c5b30ccc65c44a66ea999ab07e
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_test_layout_stacks.xml
@@ -0,0 +1,226 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<floater
+ can_resize="true"
+ can_close="true"
+ bevel_style="in"
+ height="300"
+ layout="topleft"
+ min_height="40"
+ min_width="420"
+ name="Test Floater"
+ title="LAYOUTSTACK TESTS"
+ width="420">
+  <layout_stack name="test_stack"
+              left="0"
+              top="0"
+              width="100"
+              height="250"
+              follows="left|top|bottom"
+              orientation="vertical">
+    <layout_panel name="flex"
+                  auto_resize="true"
+                  user_resize="true"
+                  bg_alpha_color="blue"
+                  height="11"
+                  min_height="0"
+                  background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="white">flex</text>
+    </layout_panel>
+    <layout_panel name="flex"
+                  auto_resize="true"
+                  user_resize="true"
+                  bg_alpha_color="blue"
+                  height="11"
+                  min_height="0"
+                  visible="false"
+                  background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="white">flex</text>
+    </layout_panel>
+    <layout_panel name="flex"
+                  auto_resize="true"
+                  user_resize="true"
+                  bg_alpha_color="blue"
+                  height="11"
+                  min_height="0"
+                  visible="true"
+                  background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="white">flex</text>
+    </layout_panel>
+    <layout_panel name="flex"
+                  auto_resize="true"
+                  user_resize="true"
+                  bg_alpha_color="blue"
+                  height="11"
+                  min_height="0"
+                  background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="white">flex</text>
+    </layout_panel>
+  </layout_stack>
+  <layout_stack name="test_stack"
+              left_pad="5"
+              top="0"
+              width="100"
+              height="250"
+              follows="left|top|bottom"
+              orientation="vertical">
+    <layout_panel name="flex"
+                  auto_resize="true"
+                  user_resize="true"
+                  bg_alpha_color="blue"
+                  height="100"
+                  background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="white">flex</text>
+    </layout_panel>
+    <layout_panel name="flex"
+                  auto_resize="true"
+                  user_resize="true"
+                  visible="false"
+                  bg_alpha_color="blue"
+                  height="100"
+                  background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="white">flex</text>
+    </layout_panel>
+    <layout_panel name="fixed"
+                  auto_resize="false"
+                  user_resize="true"
+                  height="50"
+                  min_height="10"
+                  bg_alpha_color="green"
+                  background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="black">fixed</text>
+    </layout_panel>
+    <layout_panel name="fixed"
+                auto_resize="false"
+                  user_resize="true"
+                height="50"
+                min_height="10"
+                bg_alpha_color="green"
+                background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="black">fixed</text>
+    </layout_panel>
+    <layout_panel name="flex"
+                  auto_resize="true"
+                  user_resize="true"
+                  bg_alpha_color="blue"
+                  height="100"
+                  background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="white">flex</text>
+    </layout_panel>
+    <layout_panel name="flex"
+                  auto_resize="true"
+                  user_resize="true"
+                  bg_alpha_color="blue"
+                  height="100"
+                  background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="white">flex</text>
+    </layout_panel>
+    <layout_panel name="flex"
+                  auto_resize="true"
+                  user_resize="true"
+                  bg_alpha_color="blue"
+                  height="100"
+                  background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="white">flex</text>
+    </layout_panel>
+    <layout_panel name="flex"
+                  auto_resize="true"
+                  user_resize="true"
+                  bg_alpha_color="blue"
+                  height="100"
+                  visible="true"
+                  background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="white">flex</text>
+    </layout_panel>
+  </layout_stack>
+  <layout_stack name="test_stack"
+               left_pad="5"
+               top="0"
+               width="100"
+               height="250"
+               follows="left|top|bottom"
+               orientation="vertical">
+    <layout_panel name="flex"
+                  auto_resize="true"
+                  user_resize="true"
+                  height="11"
+                  bg_alpha_color="blue"
+                  background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="white">flex</text>
+    </layout_panel>
+    <layout_panel name="fixed"
+                auto_resize="false"
+                  user_resize="true"
+                height="50"
+                bg_alpha_color="green"
+                background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="black">fixed</text>
+    </layout_panel>
+    <layout_panel name="flex"
+                  auto_resize="true"
+                  user_resize="true"
+                  bg_alpha_color="blue"
+                  height="11"
+                  background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="white">flex</text>
+    </layout_panel>
+  </layout_stack>
+  <layout_stack name="test_stack"
+               left_pad="5"
+               top="0"
+               width="100"
+               height="250"
+               follows="left|top|bottom"
+               orientation="vertical">
+    <layout_panel name="fixed"
+                auto_resize="false"
+                  user_resize="true"
+                height="50"
+                bg_alpha_color="green"
+                background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="black">fixed</text>
+    </layout_panel>
+    <layout_panel name="fixed"
+                auto_resize="false"
+                  user_resize="true"
+                height="50"
+                bg_alpha_color="green"
+                background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="black">fixed</text>
+    </layout_panel>
+    <layout_panel name="fixed"
+                auto_resize="false"
+                  user_resize="true"
+                height="50"
+                bg_alpha_color="green"
+                background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="black">fixed</text>
+    </layout_panel>
+    <layout_panel name="flex"
+                  auto_resize="true"
+                  user_resize="true"
+                  bg_alpha_color="blue"
+                  height="11"
+                  min_height="0"
+                  background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="white">flex</text>
+    </layout_panel>
+    <layout_panel name="flex"
+                  auto_resize="true"
+                  user_resize="true"
+                  bg_alpha_color="blue"
+                  height="11"
+                  min_height="0"
+                  background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="white">flex</text>
+    </layout_panel>
+    <layout_panel name="flex"
+                  auto_resize="true"
+                  user_resize="true"
+                  bg_alpha_color="blue"
+                  height="11"
+                  min_height="0"
+                  background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="white">flex</text>
+    </layout_panel>
+  </layout_stack>
+</floater>
diff --git a/indra/newview/skins/default/xui/en/floater_test_text_editor.xml b/indra/newview/skins/default/xui/en/floater_test_text_editor.xml
index 548e24efba3d9cdd817377a4e6ca8cceafb949f6..e1fefc363133250c94dfaa3c8819b24ce71204ff 100644
--- a/indra/newview/skins/default/xui/en/floater_test_text_editor.xml
+++ b/indra/newview/skins/default/xui/en/floater_test_text_editor.xml
@@ -3,6 +3,7 @@
  legacy_header_height="18"
  can_resize="true"
  height="600"
+ single_instance="false"
  layout="topleft"
  name="floater_test_text_editor"
  translate="false"
diff --git a/indra/newview/skins/default/xui/en/floater_test_text_vertical_aligment.xml b/indra/newview/skins/default/xui/en/floater_test_text_vertical_aligment.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d11373ce1d574c7a35cd08fcc6df7bf19ffbeb90
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_test_text_vertical_aligment.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<floater
+ can_minimize="false"
+ can_tear_off="false"
+ can_resize="true"
+ can_drag_on_left="false"
+ can_close="true"
+ can_dock="true"
+ bevel_style="in"
+ height="300"
+ layout="topleft"
+ name="Test Floater"
+ save_rect="true"
+ title="TEST FLOATER"
+ save_dock_state="true"
+ save_visibility="true"
+ single_instance="true" 
+ width="650">
+  <text left="0"
+        follows="left|top|bottom"
+        top="5"
+        clip_partial="true"        
+        bottom="-5"
+        width="100"
+        valign="top">
+this
+is
+some
+text
+that
+is
+top
+aligned</text>
+  <text left_pad="5"
+        follows="left|top|bottom"
+        top="5"
+        bottom="-5"
+        clip_partial="true"
+        width="100"
+        valign="center">
+this
+is
+some
+text
+that
+is
+center
+aligned</text>
+  <text left_pad="5"
+        follows="left|top|bottom"
+        top="5"
+        clip_partial="true"        
+        bottom="-5"
+        width="100"
+        valign="bottom">
+this
+is
+some
+text
+that
+is
+bottom
+aligned</text>
+  <text_editor left_pad="5"
+        follows="left|top|bottom"
+        top="5"
+        clip_partial="true"
+        bottom="-5"
+        width="100"
+        valign="top">
+this
+is
+some
+text
+that
+is
+top
+aligned
+  </text_editor>
+  <text_editor left_pad="5"
+        follows="left|top|bottom"
+        top="5"
+        bottom="-5"
+        clip_partial="true"
+        width="100"
+        valign="center">
+this
+is
+some
+text
+that
+is
+center
+aligned
+  </text_editor>
+  <text_editor left_pad="5"
+        follows="left|top|bottom"
+        top="5"
+        clip_partial="true"
+        bottom="-5"
+        width="100"
+        valign="bottom">
+this
+is
+some
+text
+that
+is
+bottom
+aligned
+  </text_editor>
+</floater>
diff --git a/indra/newview/skins/default/xui/en/floater_test_textbox.xml b/indra/newview/skins/default/xui/en/floater_test_textbox.xml
index 2df9bb35fe89c24525e1d0c9b03b76c4fc06450e..1d31fbd6dc05f14f2dfd3ef275a800435ff73a74 100644
--- a/indra/newview/skins/default/xui/en/floater_test_textbox.xml
+++ b/indra/newview/skins/default/xui/en/floater_test_textbox.xml
@@ -8,21 +8,7 @@
  help_topic="floater_test_textbox"
  translate="false"
  width="800">
-    <text
-     type="string"
-     length="1"
-     height="90"
-     layout="topleft"
-     left="10"
-     top_pad="30"
-     width="300">
-        First line of multiple lines
-Second line of multiple lines
-Third line of multiple lines
-Fourth line of multiple lines
-Fifth line of multiple lines
-    </text>
-  <text
+ <text
     clip_partial="true"
     top_pad="10"
     left="10"
diff --git a/indra/newview/skins/default/xui/en/floater_test_widgets.xml b/indra/newview/skins/default/xui/en/floater_test_widgets.xml
index 13c850c86c0300c1000a46c372011795bdf3b13b..10854f5a499c358bba03f8b2b4a84f69ce2f7e6a 100644
--- a/indra/newview/skins/default/xui/en/floater_test_widgets.xml
+++ b/indra/newview/skins/default/xui/en/floater_test_widgets.xml
@@ -115,6 +115,7 @@
   </flyout_button>
   <check_box
    bottom_delta="35"
+   height="10"
    label="Checkbox"
    layout="topleft"
    tool_tip="checkbox"
@@ -275,6 +276,7 @@
   <!-- "spinner" is a numerical input widget with an up and down arrow to
        change the value. -->
   <spinner
+    height="10"
    bottom_delta="35"
    follows="top|left"
    label="Spinner"
diff --git a/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml b/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml
index cad7d72ed7f913e6f342f137c53b4159ff64fb51..ffb8b842f0cbb3920eb1507d22de4fa25d5fc1cf 100644
--- a/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml
+++ b/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml
@@ -3,15 +3,17 @@
  legacy_header_height="18"
  can_minimize="false"
  can_resize="true"
- height="290"
+ height="330"
  layout="topleft"
- min_height="290"
+ min_height="330"
  min_width="410"
  name="texture picker"
  help_topic="texture_picker"
  title="PICK: TEXTURE"
  width="410">
-    <floater.string
+ 
+<!--  top static -->
+ <floater.string
      name="choose_picture">
         Click to choose a picture
     </floater.string>
@@ -19,6 +21,16 @@
      name="pick title">
         Pick:
     </floater.string>
+
+    <view
+     left="4"
+     top="20"
+     name="preview_widget"
+     height="165"
+     width="165"
+     follows="left|top"
+    />
+  
     <text
      type="string"
      length="1"
@@ -34,70 +46,94 @@
      width="163">
         Multiple textures
     </text>
+	
+	<!-- mode selector -->
+	   <radio_group
+     control_name="mode_selection"
+     height="20"
+     layout="topleft"
+     left="18"
+     top_pad="80"
+     name="mode_selection"
+     follows="left|top">
+        <radio_item
+         label="Inventory"
+         name="inventory"
+         top_delta="20" 
+         layout="topleft"
+         height="16" 
+         left="0" 
+         value="0"
+         width="80" />
+        <radio_item
+         label="Local"
+         left_pad="0"
+         layout="topleft"
+         top_delta="0" 
+         height="16" 
+         name="local"
+         value="1"
+         width="75" />
+    </radio_group>
+	<!-- -->
+	
     <text
      type="string"
      length="1"
      follows="left|top"
      height="14"
      layout="topleft"
-     left_delta="0"
+     left_delta="-12"
      name="unknown"
-     top_pad="80"
-     width="163">
+     top_pad="4"
+     width="">
         Size: [DIMENSIONS]
     </text>
+    
+<!--  middle: inventory mode -->
+
     <button
      enabled="false"
-     follows="left|bottom"
-     height="20"
+     follows="left|top"
+     height="18"
      label="Default"
      label_selected="Default"
      layout="topleft"
-     left_delta="0"
      name="Default"
-     top_pad="4"
-     width="80" />
+     width="73"
+	 left="94"
+     top="215"/>
     <button
+     follows="left|top"
+     height="20"
+     label="Blank"
+     label_selected="Blank"
+     layout="topleft"
+     left_delta="0"
+     name="Blank"
+     top_pad="5"
+     width="73" />
+     <button
      enabled="false"
-     follows="left|bottom"
+     follows="left|top"
      height="20"
      label="None"
      label_selected="None"
      layout="topleft"
-     left_pad="4"
+     left_delta="0"
      name="None"
-     top_delta="0"
-     width="80" />
-    <button
-     follows="left|bottom"
-     height="20"
-     label="Blank"
-     label_selected="Blank"
-     layout="topleft"
-     left="4"
-     name="Blank"
      top_pad="5"
-     width="80" />
-         <button
-     follows="left|bottom"
+     width="73" />
+    <button
+     follows="left|top"
      height="28"
      image_selected="eye_button_active.tga"
      image_unselected="eye_button_inactive.tga"
      layout="topleft"
-     left_pad="50"
-     top_delta="3"
+     left_delta="-80"
+     top_delta="-25"
      name="Pipette"
      width="28" />
-   <check_box
-     follows="left|bottom"
-     height="20"
-     initial_value="true"
-     label="Apply now"
-     layout="topleft"
-     left="4"
-     name="apply_immediate_check"
-     top="262"
-     width="120" />
     <filter_editor
      follows="left|top|right"
      height="23"
@@ -113,7 +149,7 @@
      bg_alpha_color="DkGray2"
      border="false"
      follows="all"
-     height="200"
+     height="233"
      layout="topleft"
      left_delta="0"
      name="inventory panel"
@@ -128,23 +164,89 @@
      top_pad="0"
      left_delta="-3"
      width="200" />
-         <button
-     follows="right|bottom"
+
+<!--  middle: local mode -->
+    <button
+     follows="left|top"
+     height="18"
+     label="Add"
+     label_selected="Add"
+     layout="topleft"
+     left="94"
+     top="215"
+     name="l_add_btn"
+     width="73"
+     visible="false"/>
+    <button
+     enabled="false"
+     follows="left|top"
+     height="20"
+     label="Remove"
+     label_selected="Remove"
+     layout="topleft"
+     left_delta="0"
+     name="l_rem_btn"
+     top_pad="5"
+     width="73"
+     visible="false"/>
+    <button
+     enabled="false"
+     follows="left|top"
+     height="20"
+     label="Upload"
+     label_selected="Upload"
+     layout="topleft"
+     left_delta="0"
+     name="l_upl_btn"
+     top_pad="5"
+     width="73"
+     visible="false"/>
+    <scroll_list
+     name="l_name_list"
+     left="170"
+     top="22"
+     width="235"
+     height="260"
+     follows="left|top|right|bottom"
+     column_padding="0"
+     can_resize="false"
+     draw_heading="true"
+     multi_select="true"
+     search_column="1"
+     visible="false">
+        <column name="unit_name" label="Name" dynamicwidth="true" />
+        <column name="unit_id_HIDDEN" label="ID" width="0" />
+    </scroll_list>
+     
+<!-- bottom static -->
+    <button
+     follows="bottom"
      height="20"
      label="OK"
      label_selected="OK"
      layout="topleft"
-     right="-120"
+     left="95"
+     top="-30"
      name="Select"
      width="100" />
     <button
-     follows="right|bottom"
+     follows="bottom"
      height="20"
      label="Cancel"
      label_selected="Cancel"
      layout="topleft"
-     right="-10"
-     left_pad="5"
+     left_delta="120"
+     top_delta="0"
      name="Cancel"
      width="100" />
+    <check_box
+     follows="left|bottom"
+     height="20"
+     initial_value="true"
+     label="Apply now"
+     layout="topleft"
+     left="6"
+     name="apply_immediate_check"
+     top_delta="0"
+     width="120" />
 </floater>
diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml
index 1808cab2a5e8846d7702392f10bc3827434331ea..e37740d20cd71aa64c8ca4746165bb36d7253829 100644
--- a/indra/newview/skins/default/xui/en/floater_tools.xml
+++ b/indra/newview/skins/default/xui/en/floater_tools.xml
@@ -1,8 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  legacy_header_height="18"
- follows="left|top|right"
  height="580"
  layout="topleft"
  bg_opaque_image="Window_NoTitle_Foreground"
@@ -15,7 +14,27 @@
  save_visibility="true"
  sound_flags="0"
  width="295">
-    <floater.string
+  <floater.string
+     name="grid_screen_text">
+    Screen
+  </floater.string>
+  <floater.string
+   name="grid_local_text">
+    Local
+  </floater.string>
+  <floater.string
+   name="grid_world_text">
+    World
+  </floater.string>
+  <floater.string
+   name="grid_reference_text">
+    Reference
+  </floater.string>
+  <floater.string
+   name="grid_attachment_text">
+    Attachment
+  </floater.string>
+  <floater.string
      name="status_rotate">
         Drag colored bands to rotate object
     </floater.string>
@@ -313,20 +332,48 @@
      top_pad="0"
      name="checkbox snap to grid"
      width="134" />
-    <button
-     left_pad="0"
-     label="Options..."
+    <combo_box
+      height="20"
+      layout="topleft"
+      follows="left|top"
+      name="combobox grid mode"
+      tool_tip="Choose the type of grid ruler for positioning the object"
+      top="83"
+      left="195"
+      top_pad="0"
+      width="60">
+      <combo_box.item
+      label="World"
+      name="World"
+      value="World" />
+      <combo_box.item
+      label="Local"
+      name="Local"
+      value="Local" />
+      <combo_box.item
+      label="Reference"
+      name="Reference"
+      value="Reference" />
+      <combo_box.commit_callback
+      function="BuildTool.gridMode"/>
+    </combo_box>  
+  
+  <button
+     left="259"
+     label=""
+     image_selected="ForwardArrow_Press"
+     image_unselected="ForwardArrow_Off"
      layout="topleft"
      follows="top|left"
      name="Options..."
      tool_tip="See more grid options"
      top="83"
-     right="-35"
-     width="65"
-     height="21" >
+     width="25"
+     height="20" >
 	 <button.commit_callback
 	     function="BuildTool.gridOptions"/>
 	</button>
+  
    <button
      follows="left|top"
      height="20"
@@ -791,6 +838,7 @@
      tab_min_width="40"
      tab_position="top"
      tab_height="25"
+     open_tabs_on_drag_and_drop="true"
      top="173"
      width="295">
 	
@@ -1158,6 +1206,7 @@ even though the user gets a free copy.
              label="Modify"
              layout="topleft"
              left="10"
+             height="10"
              name="checkbox next owner can modify"
              width="85" />
             <check_box
diff --git a/indra/newview/skins/default/xui/en/floater_toybox.xml b/indra/newview/skins/default/xui/en/floater_toybox.xml
index 493d44a9cf85921f44f0ae36d1a3d22a050c974e..d8211c24a72744f149cdc82c4126fcc79c251654 100644
--- a/indra/newview/skins/default/xui/en/floater_toybox.xml
+++ b/indra/newview/skins/default/xui/en/floater_toybox.xml
@@ -5,12 +5,12 @@
   can_minimize="false"
   can_resize="false"
   default_tab_group="1"
-  height="330"
+  height="375"
   help_topic="toybox"
   layout="topleft"
   legacy_header_height="18"
   name="Toybox"
-  open_positioning="centered"
+  positioning="centered"
   save_rect="true"
   single_instance="true"
   title="TOOLBAR BUTTONS"
@@ -18,7 +18,7 @@
   <text
     follows="left|top"
     font="SansSerifMedium"
-    valign="bottom"
+    valign="top"
     halign="left"
     height="20"
     layout="topleft"
@@ -33,7 +33,7 @@
   <text
     follows="left|top"
     font="SansSerifMedium"
-    valign="bottom"
+    valign="top"
     halign="left"
     height="20"
     layout="topleft"
@@ -46,7 +46,7 @@
       Buttons will appear as shown or as icon-only depending on each toolbar's settings.
   </text>
   <toolbar
-    bottom="265"
+    bottom="310"
     button_display_mode="icons_with_text"
     follows="all"
     left="20"
@@ -82,11 +82,11 @@
   <panel
     bevel_style="none"
     border="true"
-    bottom="266"
+    bottom="311"
     follows="left|bottom|right"
     left="20"
     right="-20"
-    top="266" />
+    top="311" />
   <button
     follows="left|bottom|right"
     height="23"
@@ -95,7 +95,7 @@
     layout="topleft"
     left="185"
     name="btn_clear_all"
-    top="285"
+    top="330"
     width="130">
     <button.commit_callback function="Toybox.ClearAll" />
   </button>
@@ -107,7 +107,7 @@
     layout="topleft"
     left="335"
     name="btn_restore_defaults"
-    top="285"
+    top="330"
     width="130">
     <button.commit_callback function="Toybox.RestoreDefaults" />
   </button>
diff --git a/indra/newview/skins/default/xui/en/floater_ui_preview.xml b/indra/newview/skins/default/xui/en/floater_ui_preview.xml
index 3921cfcd2c92ffff9e226d134457e9a36840df25..06d43272935f1f8f245094e9482bb35a7f41f651 100644
--- a/indra/newview/skins/default/xui/en/floater_ui_preview.xml
+++ b/indra/newview/skins/default/xui/en/floater_ui_preview.xml
@@ -22,6 +22,7 @@ or specifying its path in the "Editor Path" field.</string>
      layout="topleft"
      left="0"
      mouse_opaque="false"
+     default_tab_group="1"
      name="main_panel"
      right="750"
      top="0">
@@ -196,6 +197,7 @@ or specifying its path in the "Editor Path" field.</string>
          left="10"
          name="name_list"
          right="-10"
+         tab_group="1"
          search_column="1"
          top="80">
             <scroll_list.columns
diff --git a/indra/newview/skins/default/xui/en/floater_voice_controls.xml b/indra/newview/skins/default/xui/en/floater_voice_controls.xml
index 6807b01fa3ebe2eae75334b0a01aaa0dfc182efa..dce2720cf8cf46c63eddfc054524f05ddafd38b3 100644
--- a/indra/newview/skins/default/xui/en/floater_voice_controls.xml
+++ b/indra/newview/skins/default/xui/en/floater_voice_controls.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  can_resize="true"
  can_minimize="true"
  can_close="true"
@@ -49,7 +49,6 @@
          width="263">
         <layout_panel
          follows="top|left|right"
-         user_resize="false"
          auto_resize="false"
          layout="topleft"
          min_height="20"
@@ -72,7 +71,7 @@
              layout="topleft"
              left_pad="10"
              name="user_text"
-             text_color="white"
+             text_color="White"
              top="4"
              use_ellipses="true"
              value="My Avatar:"
@@ -89,7 +88,7 @@
              visible="true"
              width="20" />
         </layout_panel>
-        <layout_panel name="leave_call_panel" height="26" min_height="26" user_resize="false" auto_resize="false">
+        <layout_panel name="leave_call_panel" height="26" min_height="26" auto_resize="false">
         <layout_stack
          clip="true"
          follows="left|top|right"
@@ -110,7 +109,6 @@
           </layout_panel>
           <layout_panel
            auto_resize="false"
-           user_resize="false"
            follows="top|right"
            height="23"
            visible="true"
@@ -133,7 +131,6 @@
           top_pad="0"
           height="132"
           name="callers_panel"
-          user_resize="false" 
           auto_resize="true"
           width="280">
         <avatar_list
diff --git a/indra/newview/skins/default/xui/en/floater_voice_effect.xml b/indra/newview/skins/default/xui/en/floater_voice_effect.xml
index 2c754cd8d0f3974c2c0d8af124872683e24c7eab..35cb2670d0904187dfcd55e9cd06c0df45a4f27d 100644
--- a/indra/newview/skins/default/xui/en/floater_voice_effect.xml
+++ b/indra/newview/skins/default/xui/en/floater_voice_effect.xml
@@ -7,7 +7,6 @@
  help_topic="voice_effects"
  title="VOICE MORPHING"
  background_visible="true"
- follows="all"
  label="Places"
  layout="topleft"
  min_height="360"
@@ -37,15 +36,20 @@
   <string name="effect_Cyber">Cyber</string>
   <string name="effect_DeepBot">DeepBot</string>
   <string name="effect_Demon">Demon</string>
+  <string name="effect_Female Elf">Female Elf</string>
   <string name="effect_Flirty">Flirty</string>
   <string name="effect_Foxy">Foxy</string>
-  <string name="effect_Halloween_2010_Bonus">Halloween_2010_Bonus</string>
+  <string name="effect_Halloween 2010 Bonus">Halloween_2010_Bonus</string>
   <string name="effect_Helium">Helium</string>
   <string name="effect_Husky">Husky</string>
+  <string name="effect_Husky Whisper">Husky Whisper</string>
   <string name="effect_Intercom">Intercom</string>
+  <string name="effect_Julia">Julia</string>
+  <string name="effect_Lo Lilt">Lo Lilt</string>
   <string name="effect_Macho">Macho</string>
   <string name="effect_Micro">Micro</string>
   <string name="effect_Mini">Mini</string>
+  <string name="effect_Model">Model</string>
   <string name="effect_Nano">Nano</string>
   <string name="effect_Nightmare">Nightmare</string>
   <string name="effect_PopBot">PopBot</string>
@@ -53,10 +57,12 @@
   <string name="effect_Radio">Radio</string>
   <string name="effect_Robot">Robot</string>
   <string name="effect_Roxanne">Roxanne</string>
+  <string name="effect_Rumble">Rumble</string>
   <string name="effect_Sabrina">Sabrina</string>
   <string name="effect_Samantha">Samantha</string>
   <string name="effect_Sexy">Sexy</string>
   <string name="effect_Shorty">Shorty</string>
+  <string name="effect_Smaller">Smaller</string>
   <string name="effect_Sneaky">Sneaky</string>
   <string name="effect_Stallion">Stallion</string>
   <string name="effect_Sultry">Sultry</string>
diff --git a/indra/newview/skins/default/xui/en/floater_web_content.xml b/indra/newview/skins/default/xui/en/floater_web_content.xml
index 57d1c92acbfdbbc6b8be8b00996728dc03dba067..cea10adca8e8b182df6f9c18259bac5e39d70afe 100644
--- a/indra/newview/skins/default/xui/en/floater_web_content.xml
+++ b/indra/newview/skins/default/xui/en/floater_web_content.xml
@@ -31,7 +31,6 @@
       min_height="20"
       name="nav_controls"
       top="400"
-      user_resize="false"
       width="770">
       <button
         image_overlay="Arrow_Left_Off"
@@ -160,7 +159,6 @@
       left_delta="0"
       name="external_controls"
       top_delta="0"
-      user_resize="false"
       auto_resize="true"
       width="585">
       <web_browser
@@ -173,8 +171,7 @@
     </layout_panel>
     <layout_panel name="status_bar" 
                   height="23"
-                  auto_resize="false"
-                  user_resize="false">
+                  auto_resize="false">
       <text
         type="string"
         length="200"
diff --git a/indra/newview/skins/default/xui/en/floater_window_size.xml b/indra/newview/skins/default/xui/en/floater_window_size.xml
index 355d25778542db0881796c7aa2f9412bc2ffd4a9..115fe413f3ca4e3dc96c1375ea660487cfed895f 100644
--- a/indra/newview/skins/default/xui/en/floater_window_size.xml
+++ b/indra/newview/skins/default/xui/en/floater_window_size.xml
@@ -28,22 +28,50 @@
      tool_tip="width x height"
      top_pad="5"
      width="179">
-        <combo_box.item
-         label="1000 x 700 (default)"
-         name="item0"
-         value="1000 x 700" />
-        <combo_box.item
-         label="1024 x 768"
-         name="item1"
-         value="1024 x 768" />
-        <combo_box.item
-         label="1280 x 720 (720p)"
-         name="item2"
-         value="1280 x 720" />
-        <combo_box.item
-         label="1920 x 1080 (1080p)"
-         name="item3"
-         value="1920 x 1080" />
+      <combo_box.item
+       label="1000 x 700 (default)"
+       name="item1"
+       value="1000 x 700" />
+      <combo_box.item
+       label="1024 x 768 (4:3 XGA)"
+       name="item2"
+       value="1024 x 768" />
+      <combo_box.item
+       label="1280 x 720 (16:9 HDTV)"
+       name="item3"
+       value="1280 x 720" />
+      <combo_box.item
+       label="1280 x 800 (5:8 WXGA)"
+       name="item4"
+       value="1280 x 800" />
+      <combo_box.item
+       label="1280 x 1024 (5:4 SXGA)"
+       name="item5"
+       value="1280 x 1024" />
+      <combo_box.item
+       label="1440 x 900 (8:5 WSXGA)"
+       name="item7"
+       value="1440 x 900" />
+      <combo_box.item
+       label="1600 x 900 (16:9 HD+)"
+       name="item8"
+       value="1600 x 900" />
+      <combo_box.item
+       label="1600 x 1200 (4:3 UXGA)"
+       name="item9"
+       value="1600 x 1200" />
+      <combo_box.item
+       label="1680 x 1050 (8:5 WSXGA+)"
+       name="item10"
+       value="1680 x 1050" />
+      <combo_box.item
+       label="1920 x 1080 (16:9 HDTV)"
+       name="item11"
+       value="1920 x 1080" />
+      <combo_box.item
+       label="1920 x 1200 (8:5 WUXGA)"
+       name="item12"
+       value="1920 x 1200" />
     </combo_box>
     <button
      follows="right|bottom"
diff --git a/indra/newview/skins/default/xui/en/floater_world_map.xml b/indra/newview/skins/default/xui/en/floater_world_map.xml
index 4314c8a9e2a2253e4f8d77451d76908c03010a1b..83407069d2eee1ab962a8d3381a9c897bd9c746a 100644
--- a/indra/newview/skins/default/xui/en/floater_world_map.xml
+++ b/indra/newview/skins/default/xui/en/floater_world_map.xml
@@ -2,7 +2,7 @@
 <floater
  legacy_header_height="18"
  can_resize="true"
- open_positioning="centered"
+ positioning="centered"
  height="600"
  layout="topleft"
  min_height="520"
@@ -468,7 +468,7 @@
      left="3"
      top_pad="7"
      mouse_opaque="true"
-     name="region_icon"
+     name="location_icon"
      width="16" />
     <search_editor
      follows="top|right"
diff --git a/indra/newview/skins/default/xui/en/inspect_object.xml b/indra/newview/skins/default/xui/en/inspect_object.xml
index 8d14c974b434b4ddef43e3b0a49a95732cbea132..bfeb8fc470144883d6cf27ddc8f20e6e25b0e00f 100644
--- a/indra/newview/skins/default/xui/en/inspect_object.xml
+++ b/indra/newview/skins/default/xui/en/inspect_object.xml
@@ -56,7 +56,7 @@ owner secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about
    halign="right"
    right="-5"
    name="price_text"
-   text_color="white"
+   text_color="White"
    top="60"
    font_shadow="none"
    width="60">
@@ -90,6 +90,7 @@ L$30,000
    follows="all"
    font="SansSerifSmall"
    height="13"
+   clip="false"
    name="object_media_url"
    width="207"
    left_pad="2"
diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml
index b4be17e677b524bc666883e4039affdf27c3bdb0..a87027a1136a05fdffb88828c6fb8da5bc859fec 100644
--- a/indra/newview/skins/default/xui/en/main_view.xml
+++ b/indra/newview/skins/default/xui/en/main_view.xml
@@ -23,7 +23,6 @@
               left="0"
               top="0"
               width="1024"
-              user_resize="false"
               auto_resize="false"
               visible="true">
       <view mouse_opaque="false"
@@ -40,7 +39,6 @@
                   name="nav_bar_container"
                   tab_stop="false"
                   width="1024"
-                  user_resize="false"
                   visible="false"/>
     <layout_panel auto_resize="true"  
                   follows="all"
diff --git a/indra/newview/skins/default/xui/en/menu_edit.xml b/indra/newview/skins/default/xui/en/menu_edit.xml
index fab76c497cff0a6d0ca4614bb83f051780d48074..99061e089a9cff5136b5309758476430853bcc24 100644
--- a/indra/newview/skins/default/xui/en/menu_edit.xml
+++ b/indra/newview/skins/default/xui/en/menu_edit.xml
@@ -6,6 +6,7 @@
   <menu_item_call
    label="Undo"
    name="Undo"
+   allow_key_repeat="true"
    shortcut="control|Z">
     <menu_item_call.on_click
      function="Edit.Undo" />
@@ -15,6 +16,7 @@
   <menu_item_call
    label="Redo"
    name="Redo"
+   allow_key_repeat="true"
    shortcut="control|Y">
     <menu_item_call.on_click
      function="Edit.Redo" />
@@ -43,6 +45,7 @@
   <menu_item_call
    label="Paste"
    name="Paste"
+   allow_key_repeat="true"
    shortcut="control|V">
     <menu_item_call.on_click
      function="Edit.Paste" />
diff --git a/indra/newview/skins/default/xui/en/menu_inspect_object_gear.xml b/indra/newview/skins/default/xui/en/menu_inspect_object_gear.xml
index f818ebe2d7dabe49187173fb8c16e601e59b639d..63e154697bad3270cad1ae052f33750db5d877ac 100644
--- a/indra/newview/skins/default/xui/en/menu_inspect_object_gear.xml
+++ b/indra/newview/skins/default/xui/en/menu_inspect_object_gear.xml
@@ -113,6 +113,15 @@
     <menu_item_call.on_visible
      function="Object.EnableMute" />
   </menu_item_call>
+  <menu_item_call
+   label="Unblock"
+   layout="topleft"
+   name="unblock">
+    <menu_item_call.on_click
+     function="Object.Mute" />
+    <menu_item_call.on_visible
+     function="Object.EnableUnmute" />
+  </menu_item_call>
   <menu_item_call
     label="Zoom In"
     layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml
index fb85e5278a00c72e6a3e78a95777ea7e1a22d543..b13bf5b5086d7594984a3e446139fdf410f2f8ae 100644
--- a/indra/newview/skins/default/xui/en/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/en/menu_inventory.xml
@@ -452,6 +452,14 @@
     <menu_item_separator
      layout="topleft" 
      name="Copy Separator" />
+    <menu_item_call
+     label="Cut"
+     layout="topleft"
+     name="Cut">
+        <menu_item_call.on_click
+         function="Inventory.DoToSelected"
+         parameter="cut" />
+    </menu_item_call>
     <menu_item_call
      label="Copy"
      layout="topleft"
@@ -686,12 +694,12 @@
 		 parameter="copy_to_outbox" />
 	</menu_item_call>
 	<menu_item_call
-	 label="Move to Merchant Outbox"
+	 label="Send to Marketplace"
 	 layout="topleft"
-	 name="Merchant Move">
+	 name="Marketplace Send">
 		<menu_item_call.on_click
 		 function="Inventory.DoToSelected"
-		 parameter="move_to_outbox" />
+		 parameter="send_to_marketplace" />
 	</menu_item_call>
 	<menu_item_call
      label="--no options--"
diff --git a/indra/newview/skins/default/xui/en/menu_inventory_add.xml b/indra/newview/skins/default/xui/en/menu_inventory_add.xml
index 0f42000ae792fa96ce2cb5cb79de7ebc24619c5e..e91f5af3d53cdf4db7f768b3887cc285a3ef804a 100644
--- a/indra/newview/skins/default/xui/en/menu_inventory_add.xml
+++ b/indra/newview/skins/default/xui/en/menu_inventory_add.xml
@@ -3,6 +3,7 @@
  layout="topleft"
  left="0"
  mouse_opaque="false"
+ can_tear_off="true"
  name="menu_inventory_add"
  visible="false">
             <menu
diff --git a/indra/newview/skins/default/xui/en/menu_login.xml b/indra/newview/skins/default/xui/en/menu_login.xml
index 8ac1ac9e093fec25f7f4309cd08fcd4d143f7849..101e104eabfd499389bd5149f71dea1badf0d30c 100644
--- a/indra/newview/skins/default/xui/en/menu_login.xml
+++ b/indra/newview/skins/default/xui/en/menu_login.xml
@@ -174,7 +174,58 @@
          function="Advanced.WebContentTest"
          parameter="http://google.com"/>
       </menu_item_call>
-      <menu_item_check
+      <menu
+       create_jump_keys="true"
+       label="Set Logging Level"
+       name="Set Logging Level"
+       tear_off="true">
+        <menu_item_check
+          label="Debug">
+          <menu_item_check.on_check
+            function="Develop.CheckLoggingLevel"
+            parameter="0" />
+          <menu_item_check.on_click
+           function="Develop.SetLoggingLevel"
+           parameter="0" />
+        </menu_item_check>
+        <menu_item_check
+          label="Info">
+          <menu_item_check.on_check
+            function="Develop.CheckLoggingLevel"
+            parameter="1" />
+          <menu_item_check.on_click
+           function="Develop.SetLoggingLevel"
+           parameter="1" />
+        </menu_item_check>
+        <menu_item_check
+          label="Warning">
+          <menu_item_check.on_check
+            function="Develop.CheckLoggingLevel"
+            parameter="2" />
+          <menu_item_check.on_click
+           function="Develop.SetLoggingLevel"
+           parameter="2" />
+        </menu_item_check>
+        <menu_item_check
+          label="Error">
+          <menu_item_check.on_check
+            function="Develop.CheckLoggingLevel"
+            parameter="3" />
+          <menu_item_check.on_click
+           function="Develop.SetLoggingLevel"
+           parameter="3" />
+        </menu_item_check>
+        <menu_item_check
+          label="None">
+          <menu_item_check.on_check
+            function="Develop.CheckLoggingLevel"
+            parameter="4" />
+          <menu_item_check.on_click
+           function="Develop.SetLoggingLevel"
+           parameter="4" />
+        </menu_item_check>
+      </menu>
+     <menu_item_check
         label="Show Grid Picker"
         name="Show Grid Picker"
         visible="false" 
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 263d961be1fff1efe8ea5a909de847989920338c..5ba566b175e59a113a0abc154e62f0748e39f9fd 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -8,14 +8,6 @@
      label="Me"
      name="Me"
      tear_off="true">
-      <menu_item_call
-           label="Dashboard..."
-           name="Manage My Account">
-        <menu_item_call.on_click
-         function="PromptShowURL"
-         name="ManageMyAccount_url"
-         parameter="WebLaunchJoinNow,http://secondlife.com/account/" />
-      </menu_item_call>
       <menu_item_call
        label="Profile..."
        name="Profile">
@@ -31,6 +23,14 @@
         <menu_item_call.on_enable
          function="Edit.EnableCustomizeAvatar" />
       </menu_item_call>
+      <menu_item_call
+       label="Choose an avatar..."
+       name="Avatar Picker">
+        <menu_item_call.on_click
+         function="Floater.ToggleOrBringToFront"
+         parameter="avatar" />
+      </menu_item_call>
+      <menu_item_separator/>
       <menu_item_check
          label="Inventory..."
          name="Inventory"
@@ -52,29 +52,28 @@
          function="Inventory.NewWindow"
          parameter="" />
       </menu_item_call>
-      <menu_item_check
-       label="Gestures..."
-       name="Gestures"
-       shortcut="control|G">
-        <menu_item_check.on_check
-         function="Floater.Visible"
-         parameter="gestures" />
-        <menu_item_check.on_click
-         function="Floater.Toggle"
-         parameter="gestures" />
-      </menu_item_check>
-      <menu_item_check
-       label="Voice..."
-       name="ShowVoice"
-       visibility_control="VoiceMorphingEnabled">
-        <menu_item_check.on_check
-         function="Floater.Visible"
-         Parameter="voice_effect" />
-        <menu_item_check.on_click
-         function="Floater.Toggle"
-         parameter="voice_effect" />
-      </menu_item_check>
-
+      <menu_item_call
+       label="Places..."
+       name="Places">
+        <menu_item_call.on_click
+         function="Floater.ToggleOrBringToFront"
+         parameter="places" />
+      </menu_item_call>
+      <menu_item_call
+       label="Picks..."
+       name="Picks">
+        <menu_item_call.on_click
+         function="Floater.ToggleOrBringToFront"
+         parameter="picks" />
+      </menu_item_call>
+      <menu_item_separator/>
+      <menu_item_call
+       label="Camera Controls..."
+       name="Camera Controls">
+        <menu_item_call.on_click
+         function="Floater.ToggleOrBringToFront"
+         parameter="camera" />
+      </menu_item_call>
       <menu
        create_jump_keys="true"
        label="Movement"
@@ -117,6 +116,13 @@
           <menu_item_call.on_click
            function="Tools.StopAllAnimations" />
         </menu_item_call>
+        <menu_item_call
+         label="Walk / run / fly..."
+         name="Walk / run / fly">
+          <menu_item_call.on_click
+           function="Floater.ToggleOrBringToFront"
+           parameter="moveview" />
+        </menu_item_call>
       </menu>
 
       <menu
@@ -138,30 +144,28 @@
         </menu_item_call>
       </menu>
 
+      <menu_item_separator/>
+
       <menu_item_call
-       label="Request Admin Status"
-       name="Request Admin Options"
-       shortcut="control|alt|G"
-       visible="false">
+         label="Buy L$..."
+         name="Buy and Sell L$">
         <menu_item_call.on_click
-         function="Advanced.RequestAdminStatus" />
+         function="BuyCurrency" />
       </menu_item_call>
       <menu_item_call
-       label="Leave Admin Status"
-       name="Leave Admin Options"
-       shortcut="control|alt|shift|G"
-       visible="false">
+         label="Merchant Outbox..."
+         name="MerchantOutbox">
         <menu_item_call.on_click
-         function="Advanced.LeaveAdminStatus" />
+         function="Floater.ToggleOrBringToFront"
+         parameter="outbox" />
       </menu_item_call>
-
-      <menu_item_separator/>
-
       <menu_item_call
-         label="Buy L$"
-         name="Buy and Sell L$">
+           label="Account dashboard..."
+           name="Manage My Account">
         <menu_item_call.on_click
-         function="BuyCurrency" />
+         function="PromptShowURL"
+         name="ManageMyAccount_url"
+         parameter="WebLaunchJoinNow,http://secondlife.com/account/" />
       </menu_item_call>
 
       <menu_item_separator/>
@@ -205,33 +209,8 @@
      label="Communicate"
      name="Communicate"
      tear_off="true">
-        <menu_item_call
-         label="My Friends"
-         name="My Friends"
-         shortcut="control|shift|F">
-            <menu_item_call.on_click
-             function="SideTray.PanelPeopleTab"
-             parameter="friends_panel" />
-            </menu_item_call>
-        <menu_item_call
-         label="My Groups"
-         name="My Groups"
-         shortcut="control|shift|G">
-            <menu_item_call.on_click
-             function="SideTray.PanelPeopleTab"
-             parameter="groups_panel" />
-        </menu_item_call>
-
-        <menu_item_separator/>
-
-        <!--menu_item_call
-         label="Chat"
-         name="Chat">
-            <menu_item_call.on_click
-             function="World.Chat" />
-        </menu_item_call-->
         <menu_item_check
-         label="Nearby Chat"
+         label="Chat..."
          name="Nearby Chat"
          shortcut="control|H"
          use_mac_ctrl="true">
@@ -242,16 +221,21 @@
              function="Floater.Toggle"
              parameter="chat_bar" />
         </menu_item_check>
-        <menu_item_call
-         label="Nearby People"
-         name="Active Speakers"
-         shortcut="control|shift|A">
-            <menu_item_call.on_click
-             function="SideTray.PanelPeopleTab"
-             parameter="nearby_panel" />
-            </menu_item_call>
         <menu_item_check
-         label="Nearby Voice"
+         label="Speak"
+         name="Speak">
+            <menu_item_check.on_check
+             function="Agent.IsMicrophoneOn"
+             parameter="speak" />
+            <menu_item_check.on_enable
+             function="Agent.IsActionAllowed"
+             parameter="speak" />
+            <menu_item_check.on_click
+             function="Agent.ToggleMicrophone"
+             parameter="speak" />
+        </menu_item_check>
+        <menu_item_check
+         label="Voice settings..."
          name="Nearby Voice">
             <menu_item_check.on_check
              function="Floater.Visible"
@@ -260,12 +244,86 @@
              function="Floater.Toggle"
              parameter="voice_controls" />
         </menu_item_check>
+        <menu_item_check
+         label="Voice morphing..."
+         name="ShowVoice"
+         visibility_control="VoiceMorphingEnabled">
+            <menu_item_check.on_check
+             function="Floater.Visible"
+             parameter="voice_effect" />
+            <menu_item_check.on_click
+             function="Floater.Toggle"
+             parameter="voice_effect" />
+        </menu_item_check>
+        <menu_item_check
+         label="Gestures..."
+         name="Gestures"
+         shortcut="control|G">
+            <menu_item_check.on_check
+             function="Floater.Visible"
+             parameter="gestures" />
+            <menu_item_check.on_click
+             function="Floater.Toggle"
+             parameter="gestures" />
+        </menu_item_check>
+        <menu_item_separator/>
+        <menu_item_call
+         label="Friends"
+         name="My Friends"
+         shortcut="control|shift|F">
+            <menu_item_call.on_click
+             function="SideTray.PanelPeopleTab"
+             parameter="friends_panel" />
+            </menu_item_call>
+        <menu_item_call
+         label="Groups"
+         name="My Groups"
+         shortcut="control|shift|G">
+            <menu_item_call.on_click
+             function="SideTray.PanelPeopleTab"
+             parameter="groups_panel" />
+        </menu_item_call>
+        <menu_item_call
+         label="Nearby people"
+         name="Active Speakers"
+         shortcut="control|shift|A">
+            <menu_item_call.on_click
+              function="SideTray.PanelPeopleTab"
+              parameter="nearby_panel" />
+        </menu_item_call>
     </menu>
     <menu
      create_jump_keys="true"
      label="World"
      name="World"
      tear_off="true">
+        <menu_item_call
+         label="Landmark This Place"
+         name="Create Landmark Here">
+            <menu_item_call.on_click
+             function="World.CreateLandmark" />
+            <menu_item_call.on_enable
+             function="World.EnableCreateLandmark" />
+        </menu_item_call>
+        <menu_item_call
+         label="Destinations..."
+         name="Destinations">
+            <menu_item_call.on_click
+             function="Floater.ToggleOrBringToFront"
+             parameter="destinations" />
+        </menu_item_call>
+        <menu_item_check
+         label="World map"
+         name="World Map"
+         shortcut="control|M"
+         use_mac_ctrl="true">
+            <menu_item_check.on_check
+             function="Floater.Visible"
+             parameter="world_map" />
+            <menu_item_check.on_click
+             function="Floater.Toggle"
+             parameter="world_map" />
+        </menu_item_check>
             <menu_item_check
          label="Mini-map"
          name="Mini-Map"
@@ -276,18 +334,6 @@
             <menu_item_check.on_click
              function="Floater.Toggle"
              parameter="mini_map" />
-        </menu_item_check>
-         <menu_item_check
-         label="World Map"
-         name="World Map"
-         shortcut="control|M"
-         use_mac_ctrl="true">
-            <menu_item_check.on_check
-             function="Floater.Visible"
-             parameter="world_map" />
-            <menu_item_check.on_click
-             function="Floater.Toggle"
-             parameter="world_map" />
         </menu_item_check>
         <menu_item_check
         label="Search"
@@ -300,6 +346,25 @@
              function="Floater.Toggle"
              parameter="search" />
             </menu_item_check>
+        <menu_item_separator/>
+        <menu_item_call
+         label="Teleport home"
+         name="Teleport Home"
+         shortcut="control|shift|H">
+        <menu_item_call.on_click
+         function="World.TeleportHome" />
+        <menu_item_call.on_enable
+         function="World.EnableTeleportHome" />
+        </menu_item_call>
+            <menu_item_call
+             label="Set home to here"
+             name="Set Home to Here">
+                <menu_item_call.on_click
+                 function="World.SetHomeLocation" />
+                <menu_item_call.on_enable
+                 function="World.EnableSetHomeLocation" />
+            </menu_item_call>
+        <menu_item_separator/>
         <menu_item_call
          label="Snapshot"
          name="Take Snapshot"
@@ -308,82 +373,51 @@
              function="Floater.Show"
              parameter="snapshot" />
         </menu_item_call>
-      <menu_item_call
-             label="Landmark This Place"
-             name="Create Landmark Here">
-                <menu_item_call.on_click
-                 function="World.CreateLandmark" />
-                <menu_item_call.on_enable
-                 function="World.EnableCreateLandmark" />
-            </menu_item_call>
-      <menu
-           create_jump_keys="true"
-           label="Place Profile"
-           name="Land"
-           tear_off="true">
+        <menu_item_separator/>
         <menu_item_call
-         label="Place Profile"
+         label="Place profile"
          layout="topleft"
          name="Place Profile">
             <menu_item_call.on_click
              function="World.PlaceProfile" />
         </menu_item_call>
         <menu_item_call
-         label="About Land"
+         label="About land"
          name="About Land">
             <menu_item_call.on_click
              function="Floater.Show"
              parameter="about_land" />
         </menu_item_call>
         <menu_item_call
-         label="Region/Estate"
+         label="Region / Estate"
          name="Region/Estate">
             <menu_item_call.on_click
              function="Floater.Show"
              parameter="region_info" />
         </menu_item_call>
-        </menu>
+        <menu_item_call
+         label="My land holdings..."
+         name="My Land">
+            <menu_item_call.on_click
+             function="Floater.Show"
+             parameter="land_holdings" />
+        </menu_item_call>
+        <menu_item_call
+         label="Buy this land"
+         name="Buy Land">
+            <menu_item_call.on_click
+             function="Land.Buy" />
+            <menu_item_call.on_enable
+             function="World.EnableBuyLand" />
+            </menu_item_call>
 
         <menu_item_separator/>
 
-        <menu_item_call
-             label="Buy This Land"
-             name="Buy Land">
-                <menu_item_call.on_click
-                 function="Land.Buy" />
-                <menu_item_call.on_enable
-                 function="World.EnableBuyLand" />
-            </menu_item_call>
-        <menu_item_call
-             label="My Land"
-             name="My Land">
-                <menu_item_call.on_click
-                 function="Floater.Show"
-                 parameter="land_holdings" />
-        </menu_item_call>
         <menu
            create_jump_keys="true"
            label="Show"
            name="LandShow"
            tear_off="true">
-         <menu_item_check
-         label="Move Controls"
-         name="Movement Controls">
-            <menu_item_check.on_check
-             function="Floater.Visible"
-             parameter="moveview" />
-            <menu_item_check.on_click
-             function="World.Toggle.MovementControls" />
-        </menu_item_check>
-        <menu_item_check
-         label="View Controls"
-         name="Camera Controls">
-            <menu_item_check.on_check
-             function="Floater.Visible"
-             parameter="camera" />
-            <menu_item_check.on_click
-             function="World.Toggle.CameraControls" />
-        </menu_item_check>
           <menu_item_check
              label="Ban Lines"
              name="Ban Lines">
@@ -456,24 +490,6 @@
         </menu>
 
         <menu_item_separator/>
-
-	    <menu_item_call
-	     label="Teleport Home"
-	     name="Teleport Home"
-	     shortcut="control|shift|H">
-		<menu_item_call.on_click
-		 function="World.TeleportHome" />
-		<menu_item_call.on_enable
-		 function="World.EnableTeleportHome" />
-	    </menu_item_call>
-            <menu_item_call
-             label="Set Home to Here"
-             name="Set Home to Here">
-                <menu_item_call.on_click
-                 function="World.SetHomeLocation" />
-                <menu_item_call.on_enable
-                 function="World.EnableSetHomeLocation" />
-            </menu_item_call>
     <!--    <menu_item_check
          label="Show Navigation Bar"
          name="ShowNavbarNavigationPanel">
@@ -496,12 +512,10 @@
         </menu_item_check>
         <menu_item_separator/>-->
 
-        <menu_item_separator/>
-
         <menu
          create_jump_keys="true"
          label="Sun"
-         name="Environment Settings"
+         name="Sun"
          tear_off="true">
             <menu_item_call
              label="Sunrise"
@@ -533,6 +547,14 @@
                  function="World.EnvSettings"
                  parameter="midnight" />
             </menu_item_call>
+            <menu_item_separator/>
+            <menu_item_call
+             label="Use Region Settings"
+             name="Use Region Settings">
+                <menu_item_call.on_click
+                 function="World.EnvSettings"
+                 parameter="region" />
+            </menu_item_call>
         </menu>
 	    
    
@@ -1122,6 +1144,7 @@
          enabled="false"
          label="Undo"
          name="Undo"
+         allow_key_repeat="true"
          shortcut="control|Z">
             <on_click
              function="Edit.Undo"
@@ -1133,6 +1156,7 @@
          enabled="false"
          label="Redo"
          name="Redo"
+         allow_key_repeat="true"
          shortcut="control|Y">
             <on_click
              function="Edit.Redo"
@@ -1146,6 +1170,13 @@
      label="Help"
      name="Help"
      tear_off="true">
+        <menu_item_call
+         label="How to..."
+         name="How To">
+            <menu_item_call.on_click
+             function="Help.ToggleHowTo"
+             parameter="" />
+        </menu_item_call>
         <menu_item_call
          label="[SECOND_LIFE] Help"
          name="Second Life Help"
@@ -1411,7 +1442,7 @@
          tear_off="true">
             <menu_item_check
              label="Simple"
-             name="Simple"
+             name="Rendering Type Simple"
              shortcut="control|alt|shift|1">
                 <menu_item_check.on_check
                  function="Advanced.CheckRenderType"
@@ -1422,7 +1453,7 @@
             </menu_item_check>
             <menu_item_check
              label="Alpha"
-             name="Alpha"
+             name="Rendering Type Alpha"
              shortcut="control|alt|shift|2">
                 <menu_item_check.on_check
                  function="Advanced.CheckRenderType"
@@ -1433,7 +1464,7 @@
             </menu_item_check>
             <menu_item_check
              label="Tree"
-             name="Tree"
+             name="Rendering Type Tree"
              shortcut="control|alt|shift|3">
                 <menu_item_check.on_check
                  function="Advanced.CheckRenderType"
@@ -1444,7 +1475,7 @@
             </menu_item_check>
             <menu_item_check
              label="Avatars"
-             name="Character"
+             name="Rendering Type Character"
              shortcut="control|alt|shift|4">
                 <menu_item_check.on_check
                  function="Advanced.CheckRenderType"
@@ -1455,7 +1486,7 @@
             </menu_item_check>
             <menu_item_check
              label="Surface Patch"
-             name="Surface Patch"
+             name="Rendering Type Surface Patch"
              shortcut="control|alt|shift|5">
                 <menu_item_check.on_check
                  function="Advanced.CheckRenderType"
@@ -1466,7 +1497,7 @@
             </menu_item_check>
             <menu_item_check
              label="Sky"
-             name="Sky"
+             name="Rendering Type Sky"
              shortcut="control|alt|shift|6">
                 <menu_item_check.on_check
                  function="Advanced.CheckRenderType"
@@ -1477,7 +1508,7 @@
             </menu_item_check>
             <menu_item_check
              label="Water"
-             name="Water"
+             name="Rendering Type Water"
              shortcut="control|alt|shift|7">
                 <menu_item_check.on_check
                  function="Advanced.CheckRenderType"
@@ -1488,7 +1519,7 @@
             </menu_item_check>
             <menu_item_check
              label="Ground"
-             name="Ground"
+             name="Rendering Type Ground"
              shortcut="control|alt|shift|8">
                 <menu_item_check.on_check
                  function="Advanced.CheckRenderType"
@@ -1499,7 +1530,7 @@
             </menu_item_check>
             <menu_item_check
              label="Volume"
-             name="Volume"
+             name="Rendering Type Volume"
              shortcut="control|alt|shift|9">
                 <menu_item_check.on_check
                  function="Advanced.CheckRenderType"
@@ -1510,7 +1541,7 @@
             </menu_item_check>
             <menu_item_check
              label="Grass"
-             name="Grass"
+             name="Rendering Type Grass"
              shortcut="control|alt|shift|0">
                 <menu_item_check.on_check
                  function="Advanced.CheckRenderType"
@@ -1521,7 +1552,7 @@
             </menu_item_check>
             <menu_item_check
              label="Clouds"
-             name="Clouds"
+             name="Rendering Type Clouds"
              shortcut="control|alt|shift|-">
                 <menu_item_check.on_check
                  function="Advanced.CheckRenderType"
@@ -1532,7 +1563,7 @@
             </menu_item_check>
             <menu_item_check
              label="Particles"
-             name="Particles"
+             name="Rendering Type Particles"
              shortcut="control|alt|shift|=">
                 <menu_item_check.on_check
                  function="Advanced.CheckRenderType"
@@ -1543,7 +1574,7 @@
             </menu_item_check>
             <menu_item_check
              label="Bump"
-             name="Bump"
+             name="Rendering Type Bump"
              shortcut="control|alt|shift|\">
                 <menu_item_check.on_check
                  function="Advanced.CheckRenderType"
@@ -1560,7 +1591,7 @@
          tear_off="true">
             <menu_item_check
              label="UI"
-             name="UI"
+             name="ToggleUI"
              shortcut="control|alt|F1">
                 <menu_item_check.on_check
                  function="Advanced.CheckFeature"
@@ -1674,36 +1705,6 @@
              function="ToggleControl"
              parameter="MouseSmooth" />
         </menu_item_check>
-
-        <menu_item_separator/>
-
-        <menu
-         create_jump_keys="true"
-         label="Shortcuts"
-         name="Shortcuts"
-         tear_off="true"
-         visible="false">
-          <menu_item_call
-             label="Image (L$[COST])..."
-             name="Upload Image"
-             shortcut="control|U">
-            <menu_item_call.on_click
-               function="File.UploadImage"
-               parameter="" />
-            <menu_item_call.on_enable
-               function="File.EnableUpload" />
-            </menu_item_call>
-            <menu_item_check
-               label="Search"
-               name="Search"
-               shortcut="control|F">
-            <menu_item_check.on_check
-             function="Floater.Visible"
-             parameter="search" />
-            <menu_item_check.on_click
-             function="Floater.Toggle"
-             parameter="search" />
-            </menu_item_check>
             <menu_item_call
              enabled="false"
              label="Release Keys"
@@ -1715,12 +1716,14 @@
                  function="Tools.EnableReleaseKeys"
                  parameter="" />
             </menu_item_call>
-            <menu_item_call
-             label="Set UI Size to Default"
-             name="Set UI Size to Default">
-                <menu_item_call.on_click
-                 function="View.DefaultUISize" />
-            </menu_item_call>
+        <menu_item_separator/>
+
+        <menu
+         create_jump_keys="true"
+         label="Shortcuts"
+         name="Shortcuts"
+         tear_off="true"
+         visible="false">
             <!-- This second, alternative shortcut for Show Advanced Menu is for backward compatibility.  The main shortcut has been changed so it's Linux-friendly, where the old shortcut is typically eaten by the window manager. -->
             <menu_item_check
                label="Show Advanced Menu - legacy shortcut"
@@ -1807,55 +1810,6 @@
 
             <menu_item_separator/>
 
-            <menu
-             create_jump_keys="true"
-             label="Select Build Tool"
-             name="Select Tool"
-             tear_off="true">
-                <menu_item_call
-                 label="Focus Tool"
-                 name="Focus"
-                 shortcut="control|1">
-                    <menu_item_call.on_click
-                     function="Tools.SelectTool"
-                     parameter="focus" />
-                </menu_item_call>
-                <menu_item_call
-                 label="Move Tool"
-                 name="Move"
-                 shortcut="control|2">
-                    <menu_item_call.on_click
-                     function="Tools.SelectTool"
-                     parameter="move" />
-                </menu_item_call>
-                <menu_item_call
-                 label="Edit Tool"
-                 name="Edit"
-                 shortcut="control|3">
-                    <menu_item_call.on_click
-                     function="Tools.SelectTool"
-                     parameter="edit" />
-                </menu_item_call>
-                <menu_item_call
-                 label="Create Tool"
-                 name="Create"
-                 shortcut="control|4">
-                    <menu_item_call.on_click
-                     function="Tools.SelectTool"
-                     parameter="create" />
-                </menu_item_call>
-                <menu_item_call
-                 label="Land Tool"
-                 name="Land"
-                 shortcut="control|5">
-                    <menu_item_call.on_click
-                     function="Tools.SelectTool"
-                     parameter="land" />
-                </menu_item_call>
-            </menu>
-
-            <menu_item_separator/>
-
             <menu_item_call
              label="Zoom In"
              name="Zoom In"
@@ -2464,6 +2418,16 @@
           <menu_item_check.on_click
            function="Advanced.ToggleInfoDisplay"
            parameter="rendercomplexity" />
+        </menu_item_check>
+        <menu_item_check
+         label="Attachment Bytes"
+         name="attachment bytes">
+          <menu_item_check.on_check
+           function="Advanced.CheckInfoDisplay"
+           parameter="attachment bytes" />
+          <menu_item_check.on_click
+           function="Advanced.ToggleInfoDisplay"
+           parameter="attachment bytes" />
         </menu_item_check>
 		<menu_item_check
          label="Sculpt"
@@ -2569,19 +2533,6 @@
             <menu_item_check.on_enable
                  function="Advanced.EnableRenderDeferredOptions" />
           </menu_item_check>
-          <menu_item_check
-                   label="   Global Illumination (experimental)"
-                   name="Global Illumination">
-            <menu_item_check.on_check
-             function="CheckControl"
-             parameter="RenderDeferredGI" />
-            <menu_item_check.on_click
-             function="ToggleControl"
-             parameter="RenderDeferredGI" />
-            <menu_item_check.on_enable
-                 function="Advanced.EnableRenderDeferredOptions" />
-          </menu_item_check>
-
           <menu_item_separator />
 
           <menu_item_check
@@ -2831,7 +2782,7 @@
         <menu
          create_jump_keys="true"
          label="World"
-         name="World"
+         name="DevelopWorld"
          tear_off="true">
             <menu_item_check
              label="Sim Sun Override"
@@ -2843,16 +2794,6 @@
                  function="ToggleControl"
                  parameter="SkyOverrideSimSunPosition" />
             </menu_item_check>
-            <menu_item_check
-             label="Cheesy Beacon"
-             name="Cheesy Beacon">
-                <menu_item_check.on_check
-                 function="CheckControl"
-                 parameter="CheesyBeacon" />
-                <menu_item_check.on_click
-                 function="ToggleControl"
-                 parameter="CheesyBeacon" />
-            </menu_item_check>
             <menu_item_check
              label="Fixed Weather"
              name="Fixed Weather">
@@ -3077,7 +3018,7 @@
              tear_off="true">
                 <menu_item_call
                  label="Iris"
-                 name="Iris">
+                 name="Grab Iris">
                     <menu_item_call.on_click
                      function="Advanced.GrabBakedTexture"
                      parameter="iris" />
@@ -3087,7 +3028,7 @@
                 </menu_item_call>
                 <menu_item_call
                  label="Head"
-                 name="Head">
+                 name="Grab Head">
                     <menu_item_call.on_click
                      function="Advanced.GrabBakedTexture"
                      parameter="head" />
@@ -3097,7 +3038,7 @@
                 </menu_item_call>
                 <menu_item_call
                  label="Upper Body"
-                 name="Upper Body">
+                 name="Grab Upper Body">
                     <menu_item_call.on_click
                      function="Advanced.GrabBakedTexture"
                      parameter="upper" />
@@ -3107,7 +3048,7 @@
                 </menu_item_call>
                 <menu_item_call
                  label="Lower Body"
-                 name="Lower Body">
+                 name="Grab Lower Body">
                     <menu_item_call.on_click
                      function="Advanced.GrabBakedTexture"
                      parameter="lower" />
@@ -3117,7 +3058,7 @@
                 </menu_item_call>
                 <menu_item_call
                  label="Skirt"
-                 name="Skirt">
+                 name="Grab Skirt">
                     <menu_item_call.on_click
                      function="Advanced.GrabBakedTexture"
                      parameter="skirt" />
@@ -3327,6 +3268,14 @@
             <menu_item_call.on_click
              function="Advanced.CompressImage" />
         </menu_item_call>
+
+      <menu_item_call
+         label="Enable Visual Leak Detector"
+         name="Enable Visual Leak Detector">
+        <menu_item_call.on_click
+           function="Advanced.ToggleVisualLeakDetector" />
+        </menu_item_call>
+      
         <menu_item_check
          label="Output Debug Minidump"
          name="Output Debug Minidump">
@@ -3347,6 +3296,62 @@
              function="ToggleControl"
              parameter="ShowConsoleWindow" />
         </menu_item_check>
+        <menu
+         create_jump_keys="true"
+         label="Set Logging Level"
+         name="Set Logging Level"
+         tear_off="true">
+          <menu_item_check
+            name="Debug"
+            label="Debug">
+            <menu_item_check.on_check
+              function="Develop.CheckLoggingLevel"
+              parameter="0" />
+            <menu_item_check.on_click
+             function="Develop.SetLoggingLevel"
+             parameter="0" />
+          </menu_item_check>
+          <menu_item_check
+            name="Info"
+            label="Info">
+            <menu_item_check.on_check
+              function="Develop.CheckLoggingLevel"
+              parameter="1" />
+            <menu_item_check.on_click
+             function="Develop.SetLoggingLevel"
+             parameter="1" />
+          </menu_item_check>
+          <menu_item_check
+            name="Warning"
+            label="Warning">
+            <menu_item_check.on_check
+              function="Develop.CheckLoggingLevel"
+              parameter="2" />
+            <menu_item_check.on_click
+             function="Develop.SetLoggingLevel"
+             parameter="2" />
+          </menu_item_check>
+          <menu_item_check
+            name="Error"
+            label="Error">
+            <menu_item_check.on_check
+              function="Develop.CheckLoggingLevel"
+              parameter="3" />
+            <menu_item_check.on_click
+             function="Develop.SetLoggingLevel"
+             parameter="3" />
+          </menu_item_check>
+          <menu_item_check
+            name="None"
+            label="None">
+            <menu_item_check.on_check
+              function="Develop.CheckLoggingLevel"
+              parameter="4" />
+            <menu_item_check.on_click
+             function="Develop.SetLoggingLevel"
+             parameter="4" />
+          </menu_item_check>
+       </menu>
 
         <menu_item_separator/>
 
@@ -3385,10 +3390,11 @@
         <menu
          create_jump_keys="true"
          label="Object"
+         name="AdminObject"
          tear_off="true">
             <menu_item_call
              label="Take Copy"
-             name="Take Copy"
+             name="Admin Take Copy"
              shortcut="control|alt|shift|O">
                 <menu_item_call.on_click
                  function="Admin.ForceTakeCopy" />
@@ -3657,7 +3663,7 @@
         <menu
          create_jump_keys="true"
          label="Help"
-         name="Help"
+         name="DeprecatedHelp"
          tear_off="true">
             <menu_item_call
              label="Official Linden Blog"
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index e4458f33b175f3aaa2aa05e17c52eb905b5d9e00..afc5b916e77d5345896c82cf41587082bea2a0de 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -203,34 +203,80 @@ Save changes to current clothing/body part?
    icon="alertmodal.tga"
      name="ConfirmNoCopyToOutbox"
      type="alertmodal">
-        You don't have permission to copy this item to the Marketplace Outbox. Are you sure you want to move the following item?
-        [ITEM_NAME]
+You don't have permission to copy one or more of these items to the Merchant Outbox.  You can move them or leave them behind.
+    <usetemplate
+     name="okcancelbuttons"
+     notext="Don't move item(s)"
+     yestext="Move item(s)"/>
+  </notification>
+
+  <notification
+   icon="OutboxStatus_Success"
+   name="OutboxFolderCreated"
+   type="outbox">
+    <unique/>
+A new folder has been created for each item you have transferred into the top level of your Merchant Outbox.
+
+    <usetemplate
+     ignoretext="A new folder was created in the Merchant Outbox"
+     name="okignore"
+     yestext="OK"/>
+  </notification>
+
+  <notification
+   icon="OutboxStatus_Success"
+   name="OutboxImportComplete"
+   type="outbox">
+Success
+
+All folders were successfully sent to the Marketplace.
+
         <usetemplate
-         name="okcancelbuttons"
-         notext="No"
-         yestext="Yes"/>
-    </notification>
+         ignoretext="All folders sent to the Marketplace"
+         name="okignore"
+         yestext="OK"/>
+  </notification>
 
   <notification
-   icon="alertmodal.tga"
-   name="OutboxUploadComplete"
-   type="alertmodal">
-Marketplace upload complete.
+   icon="OutboxStatus_Warning"
+   name="OutboxImportHadErrors"
+   type="outbox">
+Some folders did not transfer
+
+Errors occurred when some folders were sent to the Marketplace.  Those folders are still in your Merchant Outbox.
+
+See the [[MARKETPLACE_IMPORTS_URL] error log] for more information.
+
         <usetemplate
          name="okbutton"
-         yestext="Hooray!"/>
+         yestext="OK"/>
   </notification>
 
   <notification
-   icon="alertmodal.tga"
-   name="OutboxUploadHadErrors"
-   type="alertmodal">
-Marketplace upload completed with errors!  Please correct the problems in your outbox and retry.  Thanks.
+   icon="OutboxStatus_Error"
+   name="OutboxImportFailed"
+   type="outbox">
+Transfer failed
+
+No folders were sent to the Marketplace because of a system or network error.  Try again later.
+
         <usetemplate
          name="okbutton"
-         yestext="Boo!"/>
+         yestext="OK"/>
   </notification>
 
+  <notification
+   icon="OutboxStatus_Error"
+   name="OutboxInitFailed"
+   type="outbox">
+Marketplace initialization failed
+
+Initialization with the Marketplace failed because of a system or network error.  Try again later.
+
+        <usetemplate
+         name="okbutton"
+         yestext="OK"/>
+  </notification>
     
 
     <notification
@@ -1621,7 +1667,7 @@ Unable to create output file: [FILE]
    icon="alertmodal.tga"
    name="DoNotSupportBulkAnimationUpload"
    type="alertmodal">
-[APP_NAME] does not currently support bulk upload of animation files.
+[APP_NAME] does not currently support bulk upload of BVH format animation files.
   <tag>fail</tag>
   </notification>
 
@@ -2369,7 +2415,7 @@ Would you be my friend?
    name="RemoveFromFriends"
    type="alertmodal">
     <tag>friendship</tag>
-Do you want to remove [NAME] from your Friends List?
+Do you want to remove &lt;nolink&gt;[NAME]&lt;/nolink&gt; from your Friends List?
     <tag>confirm</tag>
     <usetemplate
      name="okcancelbuttons"
@@ -3409,7 +3455,7 @@ Are you sure you want to return the selected objects to their owners? Transferab
    icon="alert.tga"
    name="GroupLeaveConfirmMember"
    type="alert">
-You are currently a member of the group [GROUP].
+You are currently a member of the group &lt;nolink&gt;[GROUP]&lt;/nolink&gt;.
 Leave Group?
     <tag>group</tag>
     <tag>confirm</tag>
@@ -5161,7 +5207,7 @@ Topic: [SUBJECT], Message: [MESSAGE]
    name="FriendOnline"
    type="notifytip">
     <tag>friendship</tag>
-[NAME] is Online
+&lt;nolink&gt;[NAME]&lt;/nolink&gt; is Online
   </notification>
 
   <notification
@@ -5169,7 +5215,7 @@ Topic: [SUBJECT], Message: [MESSAGE]
    name="FriendOffline"
    type="notifytip">
     <tag>friendship</tag>
-[NAME] is Offline
+&lt;nolink&gt;[NAME]&lt;/nolink&gt; is Offline
   </notification>
 
   <notification
@@ -5516,6 +5562,15 @@ Please select at least one type of content to search (General, Moderate, or Adul
 [MESSAGE]
   </notification>
 
+  <notification
+   icon="notify.tga"
+   name="PaymentFailure"
+   persist="true"
+   type="notify">
+    <tag>funds</tag>
+[MESSAGE]
+  </notification>
+
    <!-- EventNotification couldn't be persist since server decide is it necessary to notify 
    user about subscribed event via LLEventNotifier-->
   <notification
@@ -6171,7 +6226,7 @@ Your object named &lt;nolink&gt;[OBJECTFROMNAME]&lt;/nolink&gt; has given you th
    name="FriendshipAccepted"
    type="offer">
     <tag>friendship</tag>
-[NAME] accepted your friendship offer.
+&lt;nolink&gt;[NAME]&lt;/nolink&gt; accepted your friendship offer.
   </notification>
 
   <notification
@@ -6180,7 +6235,7 @@ Your object named &lt;nolink&gt;[OBJECTFROMNAME]&lt;/nolink&gt; has given you th
    persist="true"
    type="notify">
     <tag>friendship</tag>
-[NAME] declined your friendship offer.
+&lt;nolink&gt;[NAME]&lt;/nolink&gt; declined your friendship offer.
   </notification>
   
     <notification
@@ -6354,11 +6409,11 @@ Grant this request?
     <form name="form">
       <button
        index="-2"
-       name="Mute"
+       name="Client_Side_Mute"
        text="Block"/>
       <button
        index="-1"
-       name="Ignore"
+       name="Client_Side_Ignore"
        text="Ignore"/>
     </form>
   </notification>
@@ -6373,11 +6428,11 @@ Grant this request?
     <form name="form">
       <button
        index="-2"
-       name="Mute"
+       name="Client_Side_Mute"
        text="Block"/>
       <button
        index="-1"
-       name="Ignore"
+       name="Client_Side_Ignore"
        text="Ignore"/>
     </form>
   </notification>
@@ -6934,6 +6989,26 @@ Are you sure you want to share the following items:
 
 With the following Residents:
 
+[RESIDENTS]
+  <tag>confirm</tag>
+	<usetemplate
+     name="okcancelbuttons"
+     notext="Cancel"
+     yestext="OK"/>
+  </notification>
+  
+  <notification
+   icon="notifytip.tga"
+   name="ShareFolderConfirmation"
+   type="alertmodal">
+Only one folder at a time can be shared.
+
+Are you sure you want to share the following items:
+
+&lt;nolink&gt;[ITEMS]&lt;/nolink&gt;
+
+With the following Residents:
+
 [RESIDENTS]
   <tag>confirm</tag>
 	<usetemplate
@@ -7135,7 +7210,7 @@ Mute everyone?
     <usetemplate
      ignoretext="Confirm before I mute all participants in a group call"
      name="okcancelignore"
-     yestext="Ok"
+     yestext="OK"
      notext="Cancel">
       <unique/>
     </usetemplate>
@@ -7621,4 +7696,31 @@ Otherwise, you can look at the Map and find places marked &quot;Infohub&quot;.
 You died and have been teleported to your home location.
   </global>
 
+  <notification
+   icon="alertmodal.tga"
+   name="LocalBitmapsUpdateFileNotFound"
+   persist="true"
+   type="notify">
+[FNAME] could not be updated because the file could no longer be found.
+Disabling future updates for this file.
+  </notification>
+
+  <notification
+   icon="alertmodal.tga"
+   name="LocalBitmapsUpdateFailedFinal"
+   persist="true"
+   type="notify">
+[FNAME] could not be opened or decoded for [NRETRIES] attempts, and is now considered broken.
+Disabling future updates for this file.
+  </notification>
+
+  <notification
+   icon="alertmodal.tga"
+   name="LocalBitmapsVerifyFail"
+   persist="true"
+   type="notify">
+Attempted to add an invalid or unreadable image file [FNAME] which could not be opened or decoded.
+Attempt cancelled.
+  </notification>
+  
 </notifications>
diff --git a/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml b/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml
index e70abc0975e36d4b3d8966d614ebc8b7780812a9..d68fa6ca6c2d4cd6b7885793c5222683a460441a 100644
--- a/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml
+++ b/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml
@@ -27,8 +27,7 @@
          mouse_opaque="false"
          width="147"
          top="0"
-         name="speakers_list_panel"
-         user_resize="false">
+         name="speakers_list_panel">
             <avatar_list
              color="DkGray2"
              follows="all"
@@ -50,7 +49,6 @@
          min_height="25"
          width="130"
          name="call_btn_panel"
-         user_resize="false"
          visible="false">
             <button
              follows="all"
@@ -58,7 +56,7 @@
              label="Call"
              name="call_btn"
              width="130"
-             top="5" />
+             top="0" />
         </layout_panel>
         <layout_panel
          auto_resize="false"
@@ -68,14 +66,13 @@
          min_height="25"
          width="130"
          name="end_call_btn_panel"
-         user_resize="false"
          visible="false">
             <button
              follows="all"
              height="20"
              label="Leave Call"
              name="end_call_btn"
-             top="5"/>
+             top="0"/>
         </layout_panel>
         <layout_panel
          auto_resize="false"
@@ -85,14 +82,13 @@
          min_height="25"
          width="130"
          name="voice_ctrls_btn_panel"
-         user_resize="false"
          visible="false">
             <button
              follows="all"
              height="20"
              label="Voice Controls"
              name="voice_ctrls_btn"
-             top="5"
+             top="0"
              use_ellipses="true" />
         </layout_panel>
     </layout_stack>
diff --git a/indra/newview/skins/default/xui/en/panel_block_list_sidetray.xml b/indra/newview/skins/default/xui/en/panel_block_list_sidetray.xml
index 1e6a31d388395acae39daa5aa86744acd963617d..7c67fd7f835c950dd13eea2e79c5c7d32dafd3c9 100644
--- a/indra/newview/skins/default/xui/en/panel_block_list_sidetray.xml
+++ b/indra/newview/skins/default/xui/en/panel_block_list_sidetray.xml
@@ -28,7 +28,7 @@
      layout="topleft"
      left_pad="10"
      name="title_text"
-     text_color="white"
+     text_color="White"
      top="5"
      width="250">
         Block List
diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray_lite.xml b/indra/newview/skins/default/xui/en/panel_bottomtray_lite.xml
index b5e1a5f16df15c9faa438f8e992c0d25e688581e..f4722b05d69a81ffc6289ee43f87e4a3b6fd7e96 100644
--- a/indra/newview/skins/default/xui/en/panel_bottomtray_lite.xml
+++ b/indra/newview/skins/default/xui/en/panel_bottomtray_lite.xml
@@ -31,7 +31,6 @@
      width="1000">
         <layout_panel
          auto_resize="false"
-         user_resize="false" 
          min_width="2"
          width="2" />
         <layout_panel
@@ -40,8 +39,7 @@
          height="28"
          layout="topleft"
          width="310"
-         min_width="188"
-         user_resize="false">
+         min_width="188">
           <panel
             left="0"
             filename="panel_nearby_chat_bar.xml"
@@ -61,8 +59,7 @@
          width="82"
          top_delta="0"
          min_width="52"
-         name="gesture_panel"
-         user_resize="false">
+         name="gesture_panel">
             <gesture_combo_list
              follows="left|right"
              height="23"
@@ -80,7 +77,6 @@
         </layout_panel>
         <layout_panel
          auto_resize="false"
-         user_resize="false" 
          min_width="3"
          name="after_gesture_panel"
          width="3"/>
diff --git a/indra/newview/skins/default/xui/en/panel_chat_header.xml b/indra/newview/skins/default/xui/en/panel_chat_header.xml
index 2645d472f98be0588feb540107bf518c1b09550b..5c5c718bdf9c684fd6e21e6f9c9aab8f07e89f43 100644
--- a/indra/newview/skins/default/xui/en/panel_chat_header.xml
+++ b/indra/newview/skins/default/xui/en/panel_chat_header.xml
@@ -23,7 +23,7 @@
     <text
       parse_urls="false"
       allow_scroll="false"
-      v_pad = "7"
+      v_pad = "6"
       read_only = "true"
       follows="left|right"
       font.style="BOLD"
@@ -37,7 +37,7 @@
       top="0"
       translate="false"
       use_ellipses="true"
-      valign="bottom" 
+      valign="top" 
       value="TestString PleaseIgnore" />
   <text
     allow_scroll="false"
@@ -49,7 +49,7 @@
     left_pad="5"
     name="time_box"
     right="-5"
-    top="8"
+    top="7"
     value="23:30"
     width="110" />
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_chat_item.xml b/indra/newview/skins/default/xui/en/panel_chat_item.xml
index 6af110540075ae0bf770df51efadbeaf733e130a..1ef99649e67d27cd2a46c75406f6fe9adb1f702f 100644
--- a/indra/newview/skins/default/xui/en/panel_chat_item.xml
+++ b/indra/newview/skins/default/xui/en/panel_chat_item.xml
@@ -16,13 +16,14 @@
         top="3"
         width="18" />
 	<text_chat
-      top="5"
+      top="3"
       left="30"
+      right="-10"
       height="120"
       text_color="white"
       word_wrap="true"
       mouse_opaque="true"
-      valign="bottom"
+      valign="top"
       name="msg_text">
 	</text_chat>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_chiclet_bar.xml b/indra/newview/skins/default/xui/en/panel_chiclet_bar.xml
index 41d1036a4d4859791b2f622b273efa1a0f2449cf..ff0146490b91bbe40e1a7a57441ee2ff54c36ee8 100644
--- a/indra/newview/skins/default/xui/en/panel_chiclet_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_chiclet_bar.xml
@@ -27,8 +27,8 @@
          min_width="95"
          mouse_opaque="false"
          name="chiclet_list_panel"
+         auto_resize="true"
          top="0"
-         user_resize="false"
          width="189">
       <chiclet_panel
              chiclet_padding="4"
@@ -78,7 +78,6 @@
       </chiclet_panel>
     </layout_panel>
     <layout_panel auto_resize="false"
-                      user_resize="false"
                       width="4"
                       min_width="4"/>
     <layout_panel
@@ -90,7 +89,6 @@
          min_width="37"
          name="im_well_panel"
          top="0"
-         user_resize="false"
          width="37">
       <chiclet_im_well
              follows="right"
@@ -139,7 +137,6 @@ image_pressed_selected  "Lit" + "Selected" - there are new messages and the Well
          min_width="37"
          name="notification_well_panel"
          top="0"
-         user_resize="false"
          width="37">
       <chiclet_notification
              follows="right"
diff --git a/indra/newview/skins/default/xui/en/panel_classified_info.xml b/indra/newview/skins/default/xui/en/panel_classified_info.xml
index 6c8d994bc6324238b0d8ff284398b03cbfddc2bb..d4a2745d1d694f262b2727950f433ddd70550400 100644
--- a/indra/newview/skins/default/xui/en/panel_classified_info.xml
+++ b/indra/newview/skins/default/xui/en/panel_classified_info.xml
@@ -289,8 +289,7 @@
           left="0"
           top="0"
           width="290"
-          height="16"
-          user_resize="false">
+          height="16">
         <text
          follows="left|top"
          font.style="BOLD"
@@ -327,8 +326,7 @@
           left="0"
           top="0"
           width="290"
-          height="16"
-          user_resize="false">
+          height="16">
         <text
          follows="left|top"
          font.style="BOLD"
@@ -357,8 +355,7 @@
           left="0"
           top="0"
           width="290"
-          height="215"
-          user_resize="false">
+          height="215">
         <text
          auto_resize="false"
          follows="left|top"
@@ -416,7 +413,6 @@
 			  layout="bottomleft"
 			  left="0"
 			  name="layout_panel1"
-		      user_resize="false" 
 		      auto_resize="true"
 			  width="101">
 			  <button
@@ -436,7 +432,6 @@
 			  layout="bottomleft"
 			  left_pad="3"
 			  name="show_on_map_btn_lp"
-		      user_resize="false" 
 		      auto_resize="true"
 			  width="100">
 			  <button
@@ -455,7 +450,6 @@
 			  layout="bottomleft"
 			  left_pad="3"
 			  name="edit_btn_lp"
-		      user_resize="false" 
 		      auto_resize="true"
 			  width="101">
 			  <button
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 beea53437a88254b521f235309bddf340eab2255..aa8e3d07a6e3044c8a7dd3567b7df0b0b6afce12 100644
--- a/indra/newview/skins/default/xui/en/panel_cof_wearables.xml
+++ b/indra/newview/skins/default/xui/en/panel_cof_wearables.xml
@@ -37,6 +37,7 @@
              top="0"
              width="311" />
         </accordion_tab>
+         <!-- The Attachments title is overwritten by the definition of "Attachments remain" in strings.xml -->
         <accordion_tab
          layout="topleft"
          name="tab_attachments"
diff --git a/indra/newview/skins/default/xui/en/panel_dummy_clothing_list_item.xml b/indra/newview/skins/default/xui/en/panel_dummy_clothing_list_item.xml
index df459b4083688831ee3974603f41634774fb58fc..4b05ab27e4690c4ed6240e4eb8332e67f2fc204e 100644
--- a/indra/newview/skins/default/xui/en/panel_dummy_clothing_list_item.xml
+++ b/indra/newview/skins/default/xui/en/panel_dummy_clothing_list_item.xml
@@ -29,7 +29,7 @@
      width="380" />
     <icon
      height="16"
-     color="0.75 0.75 0.75 1"
+     color="LtGray"
      follows="top|left"
      image_name="Inv_Object"
      layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_classified.xml b/indra/newview/skins/default/xui/en/panel_edit_classified.xml
index e512d63f9e2ebd48f8809332e93cbd60705157f5..3509eaa2851f63c77565e724a185bab1e1a9f31a 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_classified.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_classified.xml
@@ -319,7 +319,6 @@
 			  layout="bottomleft"
 			  left="0"
 			  name="save_changes_btn_lp"
-		      user_resize="false" 
 		      auto_resize="true"
 			  width="156">
 			  <button
@@ -339,7 +338,6 @@
 			  layout="bottomleft"
 			  left_pad="3"
 			  name="show_on_map_btn_lp"
-		      user_resize="false" 
 		      auto_resize="true"
 			  width="157">
 			  <button
diff --git a/indra/newview/skins/default/xui/en/panel_edit_pick.xml b/indra/newview/skins/default/xui/en/panel_edit_pick.xml
index 2ec2e03e8c9323fd59e6084a5cb808d3136b1fd7..0faa1598b1b932cbaa7d28dbbe8756bc6714c299 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_pick.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_pick.xml
@@ -201,7 +201,6 @@
 			  layout="topleft"
 			  left="0"
 			  name="layout_panel1"
-		      user_resize="false" 
 		      auto_resize="true"
 			  width="150">
 		        <button
@@ -221,7 +220,6 @@
 			  layout="topleft"
 			  left_pad="4"
 			  name="layout_panel2"
-		      user_resize="false" 
 		      auto_resize="true"
 			  width="146">
 		        <button
diff --git a/indra/newview/skins/default/xui/en/panel_edit_profile.xml b/indra/newview/skins/default/xui/en/panel_edit_profile.xml
index 442eb8c28d79d5c1352484dbc4f59982c3444a72..2c7c8133d139125ab611f159c346a84adc25988f 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_profile.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_profile.xml
@@ -435,7 +435,6 @@
 			  layout="bottomleft"
 			  name="save_changes_btn_lp"
 			  top="0"
-		      user_resize="false" 
 		      auto_resize="true"
 			  width="153">
         <button
@@ -456,7 +455,6 @@
 			  left_pad="3"
 			  name="show_on_map_btn_lp"
 			  top="0"
-		      user_resize="false" 
 		      auto_resize="true"
 			  width="154">
         <button
diff --git a/indra/newview/skins/default/xui/en/panel_edit_skin.xml b/indra/newview/skins/default/xui/en/panel_edit_skin.xml
index 45591ba2ad754ec7580174dc964b530d47fed02f..b61f65a3d16a62fde197aea0c9a9284a2886ce85 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_skin.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_skin.xml
@@ -27,10 +27,10 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Head Tattoos"
+        label="Head"
         layout="topleft"
         left="25"
-        name="Head Tattoos"
+        name="Head"
         tool_tip="Click to choose a picture"
         top="10"
         width="74" >
@@ -43,10 +43,10 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Upper Tattoos"
+        label="Upper body"
         layout="topleft"
         left_pad="20"
-        name="Upper Tattoos"
+        name="Upper Body"
         tool_tip="Click to choose a picture"
         top="10"
         width="74" >
@@ -59,10 +59,10 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Lower Tattoos"
+        label="Lower body"
         layout="topleft"
         left_pad="20"
-        name="Lower Tattoos"
+        name="Lower Body"
         tool_tip="Click to choose a picture"
         top="10"
         width="74" >
diff --git a/indra/newview/skins/default/xui/en/panel_edit_wearable.xml b/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
index c8764a6a8439501720773449f656b2e692e4c456..f34b9132189318f140e331877f2089df1f05ffef 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
@@ -164,7 +164,7 @@
      layout="topleft"
      left_pad="8"
      name="edit_wearable_title"
-     text_color="white"
+     text_color="White"
      top="3"
      value="Editing Shape"
      use_ellipses="true"
@@ -190,7 +190,7 @@
          layout="topleft"
          left="10"
          name="description_text"
-         text_color="white"
+         text_color="White"
          top="10"
          value="Shape:"
          width="150" />
@@ -254,7 +254,7 @@
          name="description"
          prevalidate_callback="ascii"
          select_on_focus="true"
-         text_color="black"
+         text_color="Black"
          top_pad="3"
          width="290" />
     </panel>
@@ -454,7 +454,6 @@
              left="0"			
              mouse_opaque="false"
              name="save_as_btn_lp"
-             user_resize="false" 
              auto_resize="true"
              width="154">
                 <button
@@ -474,7 +473,6 @@
              left_pad="3"			
              mouse_opaque="false"
              name="revert_btn_lp"
-             user_resize="false" 
              auto_resize="true"
              width="152">
                 <button
diff --git a/indra/newview/skins/default/xui/en/panel_group_control_panel.xml b/indra/newview/skins/default/xui/en/panel_group_control_panel.xml
index c1dc2aaaf78a047154b67b7d9d585347852b32c3..ad10e53a4e324cd31132e5c60eab946d38d8bbbe 100644
--- a/indra/newview/skins/default/xui/en/panel_group_control_panel.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_control_panel.xml
@@ -26,8 +26,7 @@
          mouse_opaque="false"
          width="145"
          top="0"
-         name="speakers_list_panel"
-         user_resize="false">
+         name="speakers_list_panel">
             <avatar_list
              color="DkGray2"
              follows="all"
@@ -48,8 +47,7 @@
          layout="topleft"
          min_height="28"
          width="130"
-         name="group_info_btn_panel"
-         user_resize="false">
+         name="group_info_btn_panel">
             <button
              follows="left|right|bottom"
              height="23"
@@ -66,8 +64,7 @@
          layout="topleft"
          min_height="28"
          width="130"
-         name="call_btn_panel"
-         user_resize="false">
+         name="call_btn_panel">
             <button
              follows="all"
              height="23"
@@ -84,7 +81,6 @@
          min_height="28"
          width="130"
          name="end_call_btn_panel"
-         user_resize="false"
          visible="false">
             <button
              follows="all"
@@ -101,7 +97,6 @@
          min_height="28"
          width="130"
          name="voice_ctrls_btn_panel"
-         user_resize="false"
          visible="false">
             <button
              follows="all"
diff --git a/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml b/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
index ec3f3b48bcb72b6bc29b8f77bfac72b397da8be6..206496cc0e8eb0608310c52d5e7983fc56b50b20 100644
--- a/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
@@ -97,6 +97,7 @@ background_visible="true"
        follows="all"
        layout="topleft"
        auto_resize="true"
+       user_resize="true"
        height="513"
        width="313">
    <accordion
@@ -195,7 +196,6 @@ background_visible="true"
 				layout="bottomleft"
 				left="0"
 				name="btn_refresh_lp"
-			    user_resize="false" 
 			    auto_resize="false"
 				width="24">
 					<button
@@ -215,7 +215,6 @@ background_visible="true"
 				layout="bottomleft"
 				left_pad="3"
 				name="btn_chat_lp"
-			    user_resize="false" 
 			    auto_resize="true"
 				width="91">
 					<button
@@ -234,7 +233,6 @@ background_visible="true"
 				layout="bottomleft"
 				left_pad="3"
 				name="call_btn_lp"
-			    user_resize="false" 
 			    auto_resize="true"
 				width="91">
 					<button
@@ -255,7 +253,6 @@ background_visible="true"
 				layout="bottomleft"
 				left_pad="3"
 				name="btn_apply_lp"
-			    user_resize="false" 
 			    auto_resize="true"
 				width="91">
 					<button
diff --git a/indra/newview/skins/default/xui/en/panel_group_roles.xml b/indra/newview/skins/default/xui/en/panel_group_roles.xml
index a7178dc28864d56fb5aae93571ee6431e6d5d396..eea26061256279f29de0a5410ccfbb3ea5a0ff8b 100644
--- a/indra/newview/skins/default/xui/en/panel_group_roles.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_roles.xml
@@ -172,7 +172,7 @@ including the Everyone and Owner Roles.
              draw_heading="true"
              draw_stripes="false"
              heading_height="23"
-             height="130"
+             height="132"
              layout="topleft"
              search_column="1"
              left="0"
diff --git a/indra/newview/skins/default/xui/en/panel_im_control_panel.xml b/indra/newview/skins/default/xui/en/panel_im_control_panel.xml
index 9f73b7c54024d7b024b5bd1141ac23258819168f..8fcd6ccbaf27ce0500ff65d966ff599b038e33fb 100644
--- a/indra/newview/skins/default/xui/en/panel_im_control_panel.xml
+++ b/indra/newview/skins/default/xui/en/panel_im_control_panel.xml
@@ -32,8 +32,7 @@
          min_height="20"
          width="140"
          name="view_profile_btn_panel"
-         top="0" 
-         user_resize="false">
+         top="0" >
             <button
              follows="left|top|right"
              height="23"
@@ -49,8 +48,7 @@
          layout="topleft"
          min_height="25"
          width="140"
-         name="add_friend_btn_panel"
-         user_resize="false">
+         name="add_friend_btn_panel">
             <button
              follows="left|top|right"
              height="23"
@@ -66,8 +64,7 @@
          layout="topleft"
          min_height="25"
          width="140"
-         name="teleport_btn_panel"
-         user_resize="false">
+         name="teleport_btn_panel">
         <button
              auto_resize="false"
              follows="left|top|right"
@@ -84,8 +81,7 @@
          layout="topleft"
          min_height="25"
          width="140"
-         name="share_btn_panel"
-         user_resize="false">
+         name="share_btn_panel">
            <button
              auto_resize="true"
              follows="left|top|right"
@@ -101,8 +97,7 @@
          layout="topleft"
          min_height="25"
          width="140"
-         name="pay_btn_panel"
-         user_resize="false">
+         name="pay_btn_panel">
            <button
              auto_resize="true"
              follows="left|top|right"
@@ -118,8 +113,7 @@
          layout="topleft"
          min_height="25"
          width="140"
-         name="call_btn_panel"
-         user_resize="false">
+         name="call_btn_panel">
             <button
              follows="left|top|right"
              height="23"
@@ -135,7 +129,6 @@
          min_height="25"
          width="140"
          name="end_call_btn_panel"
-         user_resize="false"
          visible="false">
             <button
              follows="left|top|right"
@@ -152,7 +145,6 @@
          min_height="25"
          width="140"
          name="voice_ctrls_btn_panel"
-         user_resize="false"
          visible="false">
             <button
              follows="left|top|right"
@@ -169,7 +161,6 @@
        layout="topleft"
        min_height="0"
        width="140"
-       name="spacer"
-       user_resize="false" />
+       name="spacer"/>
     </layout_stack>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_inbox_inventory.xml b/indra/newview/skins/default/xui/en/panel_inbox_inventory.xml
index 383e637ace13947f996cb4a8132b6e498a35ef2d..413e22e444947a07363ecee76dc00e83f82627c0 100644
--- a/indra/newview/skins/default/xui/en/panel_inbox_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_inbox_inventory.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <inbox_inventory_panel
+    accepts_drag_and_drop="false"
     name="inventory_inbox"
     start_folder="Received Items"
     follows="all" layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_instant_message.xml b/indra/newview/skins/default/xui/en/panel_instant_message.xml
index 4251128714f207380b2cecfaf57721064490b46e..2e5d65090227d73ef8be4f64582cfcf9f39f1d26 100644
--- a/indra/newview/skins/default/xui/en/panel_instant_message.xml
+++ b/indra/newview/skins/default/xui/en/panel_instant_message.xml
@@ -15,7 +15,7 @@
     <panel
      background_visible="true"
      bevel_style="in"
-     bg_alpha_color="black"
+     bg_alpha_color="Black"
      follows="top"
      height="24"
      label="im_header"
@@ -64,7 +64,7 @@
          left_pad="5"
          name="user_name"
          parse_urls="false"
-         text_color="white"
+         text_color="White"
          top="8"
          translate="false"
          use_ellipses="true"
@@ -90,7 +90,7 @@
      layout="topleft"
      left="10"
      name="message"
-     text_color="white"
+     text_color="White"
      top="33"
      use_ellipses="true"
      value=""
diff --git a/indra/newview/skins/default/xui/en/panel_landmark_info.xml b/indra/newview/skins/default/xui/en/panel_landmark_info.xml
index d2088594dd91148667ce12312e97f700a61ea2b2..fd6e96b9a7e1255972ac801a8fcfcabdeac0accd 100644
--- a/indra/newview/skins/default/xui/en/panel_landmark_info.xml
+++ b/indra/newview/skins/default/xui/en/panel_landmark_info.xml
@@ -271,7 +271,7 @@
                 <text_editor
                  bg_readonly_color="DkGray2"
                  follows="all"
-                 height="70"
+                 height="75"
                  layout="topleft"
                  left="0"
                  max_length="127"
@@ -288,7 +288,7 @@
                  layout="topleft"
                  left="0"
                  name="folder_label"
-                 top_pad="15"
+                 top_pad="10"
                  value="Landmark location:"
                  width="290" />
                 <combo_box
diff --git a/indra/newview/skins/default/xui/en/panel_landmarks.xml b/indra/newview/skins/default/xui/en/panel_landmarks.xml
index 23d8cb11cac136fbf4cd7e33455639c478f1cb63..2a5933e3e93bbc9f5ebe13b07809b2d47beb17a5 100644
--- a/indra/newview/skins/default/xui/en/panel_landmarks.xml
+++ b/indra/newview/skins/default/xui/en/panel_landmarks.xml
@@ -114,7 +114,6 @@
 		       height="25"
 		       layout="topleft"
 		       name="options_gear_btn_panel"
-		       user_resize="false"
 		       width="32">
 		          <menu_button
 		           follows="bottom|left"
@@ -135,7 +134,6 @@
 		       height="25"
 		       layout="topleft"
 		       name="add_btn_panel"
-		       user_resize="false"
 		       width="32">
 		          <button
 		           follows="bottom|left"
@@ -156,7 +154,6 @@
 		       height="25"
 		       layout="topleft"
 		       name="dummy_panel"
-		       user_resize="false"
 		       width="212">
 		          <icon
 		           follows="bottom|left|right"
@@ -173,7 +170,6 @@
 		       height="25"
 		       layout="topleft"
 		       name="trash_btn_panel"
-		       user_resize="false"
 		       width="31">
 		          <dnd_button
 		           follows="bottom|left"
diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml
index 6521bf2a4eaf92b1d8515ffd12196a24d2bf76b0..223326dd06e2119d4a54a915b5747bfb4f273ad3 100644
--- a/indra/newview/skins/default/xui/en/panel_login.xml
+++ b/indra/newview/skins/default/xui/en/panel_login.xml
@@ -48,7 +48,6 @@ name="login"
 layout="topleft"
 width="705"
 min_width="705"
-user_resize="false"
 height="80">
 <text
 follows="left|bottom"
@@ -165,7 +164,6 @@ follows="right|bottom"
 name="links"
 width="205"
 min_width="205"
-user_resize="false"
 height="80">
    <text
 follows="right|bottom"
diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
index e6c5110999d4bc5067490c58e88637e3cf9cae8a..1c882bb099aa48ee30e1fe944fc8d58b9b883837 100644
--- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <panel
- background_visible="true"
  default_tab_group="1"
  follows="all"
  height="423"
@@ -51,10 +50,6 @@
    top="18"
    width="303" />
   <tab_container
-     bg_alpha_color="DkGray"
-     bg_opaque_color="DkGray"
-     background_visible="true"
-     background_opaque="true"
      follows="all"
      halign="center"
      height="339"
@@ -71,7 +66,6 @@
      bg_opaque_color="DkGray2"
      bg_alpha_color="DkGray2"
      background_visible="true"
-     background_opaque="true"
      border="false"
      bevel_style="none"
      follows="all"
@@ -86,11 +80,9 @@
      top="16"
      width="288" />
     <recent_inventory_panel
-     accepts_drag_and_drop="false"
      bg_opaque_color="DkGray2"
      bg_alpha_color="DkGray2"
      background_visible="true"
-     background_opaque="true"
      border="false"
      bevel_style="none"
      follows="all"
@@ -119,7 +111,6 @@
        height="25"
        layout="topleft"
        name="options_gear_btn_panel"
-       user_resize="false"
        width="32">
           <menu_button
            follows="bottom|left"
@@ -140,7 +131,6 @@
        height="25"
        layout="topleft"
        name="add_btn_panel"
-       user_resize="false"
        width="32">
           <button
            follows="bottom|left"
@@ -161,7 +151,6 @@
        height="25"
        layout="topleft"
        name="dummy_panel"
-       user_resize="false"
        width="212">
           <icon
            follows="bottom|left|right"
@@ -178,7 +167,6 @@
        height="25"
        layout="topleft"
        name="trash_btn_panel"
-       user_resize="false"
        width="31">
           <dnd_button
            follows="bottom|left"
diff --git a/indra/newview/skins/default/xui/en/panel_my_profile.xml b/indra/newview/skins/default/xui/en/panel_my_profile.xml
deleted file mode 100644
index 4bd2235cdae86799fd169430d94132b0218d9b3f..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/en/panel_my_profile.xml
+++ /dev/null
@@ -1,146 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<panel
- follows="all"
- height="535"
- label="Profile"
- layout="topleft"
- left="0"
- name="panel_profile"
- top="0"
- width="315">
-    <string
-     name="CaptionTextAcctInfo">
-        [ACCTTYPE]
-[PAYMENTINFO] [AGEVERIFICATION]
-    </string>
-    <string
-     name="payment_update_link_url">
-        http://www.secondlife.com/account/billing.php?lang=en
-    </string>
-    <string
-     name="partner_edit_link_url">
-        http://www.secondlife.com/account/partners.php?lang=en
-    </string>
-    <string
-     name="my_account_link_url"
-     value="http://secondlife.com/account" />
-    <string
-     name="no_partner_text"
-     value="None" />
-    <string
-     name="no_group_text"
-     value="None" />
-    <string
-	   name="RegisterDateFormat">
-	   [REG_DATE] ([AGE])
-	  </string>
-    <string
-      name="name_text_args">
-      [NAME]
-    </string>
-    <string
-      name="display_name_text_args">
-      [DISPLAY_NAME]
-    </string>
-  <layout_stack
-     name="layout"
-     orientation="vertical"
-     follows="all"
-     layout="topleft"
-     left="0"
-     top="0"
-     height="510"
-     width="315"
-     border_size="0">
-      <layout_panel
-         name="profile_stack"
-         follows="all"
-         layout="topleft"
-         top="0"
-         left="0"
-         height="492"
-         user_resize="false"
-         width="315">
-        <scroll_container
-         color="DkGray2"
-         follows="all"
-         layout="topleft"
-         left="0"
-         name="profile_scroll"
-         opaque="true"
-         height="488"
-         width="315"
-         top="0">
-          <panel
-                layout="topleft"
-          follows="left|top|right"
-                height="488"
-               name="scroll_content_panel"
-                top="0"
-                left="0"
-                width="297">
-            <panel
-                  follows="left|top|right"
-                  height="117"
-                  layout="topleft"
-                  left="10"
-                  name="second_life_image_panel"
-                  top="0"
-                  width="297">
-
-              <texture_picker
-               allow_no_texture="true"
-               default_image_name="None"
-               enabled="false"
-               fallback_image="Generic_Person_Large"
-               follows="top|left"
-               height="124"
-               layout="topleft"
-               left="3"
-               name="2nd_life_pic"
-               top="10"
-               width="102" />
-
-              <text
-                follows="left|top|right"
-                font="SansSerifLarge"
-                font.style="BOLD"
-                height="15"
-                layout="topleft"
-                left_pad="10"
-                name="display_name_descr_text"
-                text_color="0.7 0.7 0.7 1.0"
-                top_delta="0"
-                width="280" >
-                User name
-                </text>
-
-              <text
-                follows="left|top|right"
-                font.style="BOLD"
-                height="15"
-                layout="topleft"
-                left_delta="0"
-                name="name_descr_text"
-                text_color="0.4 0.4 0.4 1.0"
-                top_delta="20"
-                width="280">
-                Display Name
-              </text>
-
-              <button
-                follows="bottom"
-                height="23"
-                left_delta="0"
-                top_delta="20"
-                label="Profile"
-                name="see_profile_btn"
-                tool_tip="See profile for this avatar"
-                width="120" />
-
-            </panel>
-          </panel>
-        </scroll_container>
-      </layout_panel>
-      </layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/en/panel_navigation_bar.xml b/indra/newview/skins/default/xui/en/panel_navigation_bar.xml
index 7a8e872dc967b0691b248ab8c140688a728a0eb6..3edeb9aa3670b7e782b7afac5715e28633fbeb5c 100644
--- a/indra/newview/skins/default/xui/en/panel_navigation_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_navigation_bar.xml
@@ -54,11 +54,11 @@
     width="800"
     height="2"/>
 	 <layout_stack
-       use_border="true"
-       bevel_style="none"
        follows="all"
        height="34"
        layout="topleft"
+       border_size="0"
+       resize_bar_overlap="3"
        left="0"
        mouse_opaque="false"
        name="nvp_stack"
@@ -70,133 +70,134 @@
            layout="topleft"
            auto_resize="true"
            user_resize="true"
-           min_width="480"
+           min_width="410"
            name="navigation_layout_panel"
            width="480">
-	<panel
-	 background_visible="false"
-	 follows="left|top|right"
-	 top="3"
-	 height="23"
-	 layout="topleft"
-               left="0"
-	 name="navigation_panel"
-     width="480">
-	     <pull_button
-	     follows="left|top"
-	     direction="down"
-	     height="23"
-	     image_overlay="Arrow_Left_Off"
-	     image_bottom_pad="1"
-	     layout="topleft"
-	     left="10"
-	     name="back_btn"
-	     tool_tip="Go back to previous location"
-	     top="2"
-	     width="31" />
-	    <pull_button
-	     follows="left|top"
-	     direction="down"
-	     height="23"
-	     image_overlay="Arrow_Right_Off"
-	     image_bottom_pad="1"
-	     layout="topleft"
-	     left_pad="0"
-	     name="forward_btn"
-	     tool_tip="Go forward one location"
-	     top_delta="0"
-	     width="31" />
-	    <button
-	     follows="left|top"
-	     height="23"
-	     image_bottom_pad="1"
-	     image_overlay="Home_Off"
-	     layout="topleft"
-	     left_pad="7"
-	     name="home_btn"
-	     tool_tip="Teleport to my home location"
-	     top_delta="0"
-	     width="32" />
-	    <location_input
-                   follows="all"
-	     halign="right"
-	     height="23"
-	     label="Location"
-	     layout="topleft"
-	     left_pad="7"
-	     max_chars="254"
-	     mouse_opaque="false"
-	     name="location_combo"
-	     top_delta="0"
-            width="355">
-         <combo_list
-         mouse_wheel_opaque="true"/>
-	    </location_input>
-             </panel>
-         </layout_panel>
-         
-         <layout_panel
-           auto_resize="false"
-           layout="topleft"
-           max_width="5"
-           min_width="5"
-           name="nav_bar_resize_handle_panel"
-           user_resize="false"
-           width="5">
-             <icon
-               follows="top|right"
-               height="25"
-               image_name="ChatBarHandle"
-               layout="topleft"
-               left="-6"
-               name="resize_handle"
-               top="4"
-               width="5" />
-         </layout_panel>
-         
+	        <panel
+	         background_visible="false"
+	         follows="left|top|right"
+	         top="3"
+	         height="23"
+	         layout="topleft"
+                       left="0"
+	         name="navigation_panel"
+             width="480">
+	         <pull_button
+	         follows="left|top"
+	         direction="down"
+	         height="23"
+	         image_overlay="Arrow_Left_Off"
+	         image_bottom_pad="1"
+	         layout="topleft"
+	         left="10"
+	         name="back_btn"
+	         tool_tip="Go back to previous location"
+	         top="2"
+	         width="31" />
+	        <pull_button
+	         follows="left|top"
+	         direction="down"
+	         height="23"
+	         image_overlay="Arrow_Right_Off"
+	         image_bottom_pad="1"
+	         layout="topleft"
+	         left_pad="0"
+	         name="forward_btn"
+	         tool_tip="Go forward one location"
+	         top_delta="0"
+	         width="31" />
+	        <button
+	         follows="left|top"
+	         height="23"
+	         image_bottom_pad="1"
+	         image_overlay="Home_Off"
+	         layout="topleft"
+	         left_pad="7"
+	         name="home_btn"
+	         tool_tip="Teleport to my home location"
+	         top_delta="0"
+	         width="32" />
+	        <location_input
+                       follows="all"
+	         halign="right"
+	         height="23"
+	         label="Location"
+	         layout="topleft"
+	         left_pad="7"
+	         max_chars="254"
+	         mouse_opaque="false"
+	         name="location_combo"
+	         top_delta="0"
+                width="355">
+             <combo_list
+             mouse_wheel_opaque="true"/>
+	        </location_input>
+         </panel>
+          <icon
+             follows="top|right"
+             height="25"
+             image_name="ChatBarHandle"
+             layout="topleft"
+             left="-3"
+             name="resize_handle"
+             top="4"
+             width="5" />
+        </layout_panel>
          <layout_panel
            follows="top|left"
-	     layout="topleft"
+	         layout="topleft"
            auto_resize="true"
            user_resize="true"
-           min_width="315"
+           min_width="185"
            name="favorites_layout_panel"
-           width="315">
-    <favorites_bar
-     follows="left|right|top"
-     font="SansSerifSmall"
-               height="20"
-     layout="topleft"
-     left="0"
-     name="favorite"
-     image_drag_indication="Accordion_ArrowOpened_Off"
-     tool_tip="Drag Landmarks here for quick access to your favorite places in Second Life!"
-               width="311">
-        <label
-         follows="left|top"
-         height="15"
-         layout="topleft"
-         left="10"
-         name="favorites_bar_label"
-         text_color="LtGray"
-         tool_tip="Drag Landmarks here for quick access to your favorite places in Second Life!"
-         top="12"
-         width="102">
-          Favorites Bar
-        </label>
-                 <!-- More button actually is a text box. -->
-                 <more_button
-                   follows="left|bottom"
-                   name=">>"
-                   tab_stop="false"
-                   tool_tip="Show more of My Favorites"
-                   top="13"
-                   width="50"
-                   bottom="0"
-                   valign="bottom">
-                   More &#9660;
-                   </more_button>
-  </favorites_bar>
+           width="320">
+           <icon
+             follows="top|left"
+             height="25"
+             image_name="ChatBarHandle"
+             layout="topleft"
+             left="-323"
+             name="resize_handle"
+             top="4"
+             width="5" />
+
+           <favorites_bar
+             follows="left|right|top"
+             font="SansSerifSmall"
+             height="20"
+             layout="topleft"
+             left="0"
+             top="4"
+             name="favorite"
+             image_drag_indication="Accordion_ArrowOpened_Off"
+             tool_tip="Drag Landmarks here for quick access to your favorite places in Second Life!"
+             width="320">
+            <label
+             follows="left|top"
+             height="13"
+             layout="topleft"
+             left="10"
+             name="favorites_bar_label"
+             text_color="LtGray"
+             tool_tip="Drag Landmarks here for quick access to your favorite places in Second Life!"
+             top="13"
+	     valign="bottom"
+             width="102">
+              Favorites Bar
+            </label>
+              <!-- More button actually is a text box. -->
+              <more_button
+                follows="left|bottom"
+                name=">>"
+                tab_stop="false"
+                tool_tip="Show more of My Favorites"
+                top="13"
+                width="50"
+                bottom="0"
+                valign="bottom">
+                More &#9660;
+                </more_button>
+         </favorites_bar>
          </layout_panel>
      
      </layout_stack>
diff --git a/indra/newview/skins/default/xui/en/panel_nearby_chat.xml b/indra/newview/skins/default/xui/en/panel_nearby_chat.xml
index d492f9bd68b1f84bc031e80ba3e3ad00389701e5..d683116eb8b339321114fc75732a3f7a260d5246 100644
--- a/indra/newview/skins/default/xui/en/panel_nearby_chat.xml
+++ b/indra/newview/skins/default/xui/en/panel_nearby_chat.xml
@@ -1,35 +1,63 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel
- height="300"
  follows="all"
+ height="300"
+ help_topic="nearby_chat"
  layout="topleft"
  name="nearby_chat"
- help_topic="nearby_chat"
  width="320">
-            <check_box
-             bottom_delta="36"
-             control_name="TranslateChat"
-             enabled="true"
-             height="16"
-             label="Translate chat"
-             layout="topleft"
-             left="5"
-             name="translate_chat_checkbox"
-             width="230" />
-  <chat_history
-    parse_urls="true"
-    bg_readonly_color="ChatHistoryBgColor"
-    bg_writeable_color="ChatHistoryBgColor"
-    follows="all"
-    left="5"
-    top_delta="17"
-    layout="topleft"
-    height="260"
-    name="chat_history"
-    parse_highlights="true"
-    text_color="ChatHistoryTextColor"
-    text_readonly_color="ChatHistoryTextColor"
-    right_widget_pad="5"
-    left_widget_pad="0"
-    width="315" />
+  <layout_stack
+   follows="all"
+   height="295"
+   layout="topleft"
+   left="0"
+   name="stack"
+   top="5"
+   orientation="vertical"
+   width="320">
+    <layout_panel
+     auto_resize="false"
+     height="26"
+     layout="topleft"
+     left_delta="0"
+     name="translate_chat_checkbox_lp"
+     top_delta="0"
+     visible="true"
+     width="313">
+      <check_box
+       top="10"
+       control_name="TranslateChat"
+       enabled="true"
+       height="16"
+       label="Translate chat"
+       layout="topleft"
+       left="5"
+       name="translate_chat_checkbox"
+       width="300" />
+    </layout_panel>
+    <layout_panel
+     auto_resize="true"
+     height="277"
+     left_delta="0"
+     layout="topleft"
+     name="chat_history_lp"
+     width="318">
+      <chat_history
+       bg_readonly_color="ChatHistoryBgColor"
+       bg_writeable_color="ChatHistoryBgColor"
+       follows="all"
+       layout="topleft"
+       left="5"
+       left_widget_pad="0"
+       height="272"
+       name="chat_history"
+       parse_highlights="true"
+       parse_urls="true"
+       right_widget_pad="5"
+       text_color="ChatHistoryTextColor"
+       text_readonly_color="ChatHistoryTextColor"
+       top="0"
+       width="313" />
+    </layout_panel>
+  </layout_stack>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_nearby_media.xml b/indra/newview/skins/default/xui/en/panel_nearby_media.xml
index bfc503f05b05a6199e676b05dceaae5ac7b4cfcb..d1cb64f7ad3570270b5ad03808f1bd28f477ac7c 100644
--- a/indra/newview/skins/default/xui/en/panel_nearby_media.xml
+++ b/indra/newview/skins/default/xui/en/panel_nearby_media.xml
@@ -196,7 +196,6 @@
 			name="stop"
 			mouse_opaque="false"
 			auto_resize="false"
-			user_resize="false"
 			layout="topleft"
 			top="0"
 			height="22"
@@ -224,7 +223,6 @@
 			name="play"
 			mouse_opaque="false"
 			auto_resize="false"
-			user_resize="false"
 			layout="topleft"
 			top="0"
 			height="22"
@@ -252,7 +250,6 @@
 			name="pause"
 			mouse_opaque="false"
 			auto_resize="false"
-			user_resize="false"
 			layout="topleft"
 			top="0"
 			min_width="22"
@@ -279,7 +276,6 @@
 			name="volume_slider_ctrl"
 			mouse_opaque="false"
 			auto_resize="true"
-			user_resize="false"
 			follows="left|right"
 			layout="topleft"
 			top="0"
@@ -304,7 +300,6 @@
 			name="mute"
 			mouse_opaque="false"
 			auto_resize="false"
-			user_resize="false"
 			layout="topleft"
 			top="0"
 			height="72"
@@ -333,7 +328,6 @@
 			name="zoom"
 			mouse_opaque="false"
 			auto_resize="false"
-			user_resize="false"
 			layout="topleft"
 			top="0"
 			height="28"
@@ -361,7 +355,6 @@
 			name="unzoom"
 			mouse_opaque="false"
 			auto_resize="false"
-			user_resize="false"
 			layout="topleft"
 			top="0"
 			min_width="21"
@@ -388,8 +381,7 @@
 		<layout_panel
 			name="right_bookend"
 			width="0"
-			mouse_opaque="false"
-			user_resize="false" />
+			mouse_opaque="false"/>
 	  </layout_stack>
 	</panel>
   </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_notes.xml b/indra/newview/skins/default/xui/en/panel_notes.xml
deleted file mode 100644
index 124b1cfc6beef726422a1ec906ac6e9f2a783a46..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/en/panel_notes.xml
+++ /dev/null
@@ -1,236 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<panel
- follows="all"
- height="515"
- label="Notes &amp; Privacy"
- layout="topleft"
- left="0"
- name="panel_notes"
- top="0"
- width="313"
->
-    <layout_stack
-     name="layout"
-     orientation="vertical"
-     follows="all"
-     layout="topleft"
-     left="0"
-     top="0"
-     height="517"
-     width="313"
-     border_size="0">
-      <layout_panel
-       name="notes_stack"
-       follows="all"
-       layout="topleft"
-       top="0"
-       left="0"
-       height="450"
-       width="313">
-        <scroll_container
-         color="DkGray2"
-         follows="all"
-         layout="topleft"
-         left="0"
-         name="profile_scroll"
-         opaque="true"
-         height="450"
-         width="313"
-         top="0">
-          <panel
-           height="450"
-           layout="topleft"
-           name="profile_scroll_panel"
-           top="0"
-           left="0"
-           width="303">
-            <text
-             follows="left|top"
-         font.style="BOLD"
-             height="16"
-             layout="topleft"
-             left="11"
-             name="status_message"
-             text_color="white"
-             top="10"
-             value="My private notes:"
-             width="293" />
-            <text_editor
-             follows="left|top"
-             height="120"
-             layout="topleft"
-             left="12"
-             max_length="1000"
-             name="notes_edit"
-             text_color="DkGray"
-             top_pad="3"
-             width="288"
-             word_wrap="true" />
-            <text
-             follows="left|top"
-         font.style="BOLD"
-             height="16"
-             layout="topleft"
-             left="11"
-             name="status_message2"
-             text_color="white"
-             top_pad="20"
-             value="Allow this person to:"
-             width="293" />
-            <check_box
-             enabled="false"
-             height="16"
-             label="See my online status"
-             layout="topleft"
-             left="10"
-             name="status_check"
-             width="293" />
-            <check_box
-             enabled="false"
-             height="16"
-             label="See me on the map"
-             layout="topleft"
-             left="10"
-             name="map_check"
-             width="293" />
-            <check_box
-             enabled="false"
-             height="16"
-             label="Edit, delete or take my objects"
-             layout="topleft"
-             left="10"
-             name="objects_check"
-             width="293" />
-          </panel>
-        </scroll_container>
-      </layout_panel>
-      <layout_panel
-       follows="bottom|left"
-       height="30"
-         layout="topleft"
-         left="0"
-         name="notes_buttons_panel"
-         auto_resize="false"
-         width="313">
-         
-         <layout_stack
-	     	follows="bottom|left|right"
-			height="23"
-			layout="topleft"
-			name="bottom_bar_ls"
-			left="2"
-			orientation="horizontal"
-			top_pad="5"
-			width="309">
-	
-				<layout_panel
-				follows="bottom|left|right"
-				height="23"
-				layout="bottomleft"
-				left="0"
-				name="add_friend_btn_lp"
-			    user_resize="false" 
-			    auto_resize="true"
-				width="118">
-					<button
-			         follows="bottom|left|right"
-			         height="23"
-			         label="Add Friend"
-			         layout="topleft"
-			         left="1"
-			         mouse_opaque="false"
-			         name="add_friend"
-			         tool_tip="Offer friendship to the Resident"
-			         top="0"
-			         width="117" />	
-				</layout_panel>
-				
-				<layout_panel
-				follows="bottom|left|right"
-				height="23"
-				layout="bottomleft"
-				left_pad="3"
-				name="im_btn_lp"
-			    user_resize="false" 
-			    auto_resize="true"
-				width="22">
-					<button
-			         follows="bottom|left|right"
-			         height="23"
-			         label="IM"
-			         layout="topleft"
-			         name="im"
-			         tool_tip="Open instant message session"
-			         top="0"
-			         left="1"
-			         width="21" />		
-				</layout_panel>
-				
-				<layout_panel
-				follows="bottom|left|right"
-				height="23"
-				layout="bottomleft"
-				left_pad="3"
-				name="call_btn_lp"
-			    user_resize="false" 
-			    auto_resize="true"
-				width="52">
-					<button
-			         follows="bottom|left|right"
-			         height="23"
-			         label="Call"
-			         layout="topleft"
-			         name="call"
-			         tool_tip="Call this Resident"
-			         left="1"
-			         top="0"
-			         use_ellipses="true"
-			         width="51" />		
-				</layout_panel>
-				
-				<layout_panel
-				follows="bottom|left|right"
-				height="23"
-				layout="bottomleft"
-				left_pad="3"
-				name="show_on_map_btn_lp"
-			    user_resize="false" 
-			    auto_resize="true"
-				width="46">
-					<button
-			         enabled="false"
-			         follows="bottom|left|right"
-			         height="23"
-			         label="Map"
-			         layout="topleft"
-			         name="show_on_map_btn"
-			         tool_tip="Show the Resident on the map"
-			         top="0"
-			         left="1"
-			         width="45" />
-				</layout_panel>
-				
-				<layout_panel
-				follows="bottom|left|right"
-				height="23"
-				layout="bottomleft"
-				left_pad="3"
-				name="teleport_btn_lp"
-			    user_resize="false" 
-			    auto_resize="true"
-				width="81">
-					<button
-			         follows="bottom|left|right"
-			         height="23"
-			         label="Teleport"
-			         layout="topleft"
-			         name="teleport"
-			         tool_tip="Offer teleport"
-			         left="1"
-			         top="0"
-			         width="80" />	
-				</layout_panel>
-		</layout_stack>     
-        </layout_panel>
-    </layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/en/panel_notification.xml b/indra/newview/skins/default/xui/en/panel_notification.xml
index f6f62ac54eb71ee56051b27cb0be8ab0a00a81ed..94c468e1bb0d06e189cc7d6cfeeee4ae94a13f8d 100644
--- a/indra/newview/skins/default/xui/en/panel_notification.xml
+++ b/indra/newview/skins/default/xui/en/panel_notification.xml
@@ -3,8 +3,8 @@
   background_opaque="false"
       border_visible="false"
   background_visible="true"
-  bg_alpha_color="1 0.3 0.3 0"
-  bg_opaque_color="1 0.3 0.3 0"
+  bg_alpha_color="PanelNotificationBackground"
+  bg_opaque_color="PanelNotificationBackground"
   label="notification_panel"
   layout="topleft"
   left="0"
@@ -20,8 +20,8 @@
       border_visible="false"
  bevel_style="none"
     background_visible="true"
-  bg_alpha_color="0.3 0.3 0.3 0"
-  bg_opaque_color="0.3 0.3 0.3 0"
+  bg_alpha_color="ToastBackground"
+  bg_opaque_color="ToastBackground"
     follows="left|right|top"
     height="100"
     label="info_panel"
@@ -39,7 +39,7 @@
       left="10"
       name="text_box"
       read_only="true"
-      text_color="white"
+      text_color="White"
       top="10"
       visible="false" 
       width="285"
@@ -52,7 +52,7 @@
       layout="topleft"
       left="10"
       name="caution_text_box"
-      text_color="1 0.82 0.46 1"
+      text_color="NotifyCautionBoxColor"
       top="10"
       visible="false"
       width="285"
@@ -60,7 +60,7 @@
     <text_editor
     	h_pad="0"
 	v_pad="0"
-      bg_readonly_color="0.0 0.0 0.0 0"
+      bg_readonly_color="Transparent"
       border_visible="false"
       embedded_items="false"
       enabled="false"
@@ -73,8 +73,8 @@
       name="text_editor_box"
       read_only="true"
       tab_stop="false"
-      text_color="white"
-      text_readonly_color="white"
+      text_color="White"
+      text_readonly_color="White"
       top="10"
       visible="false"
       width="285"
diff --git a/indra/newview/skins/default/xui/en/panel_online_status_toast.xml b/indra/newview/skins/default/xui/en/panel_online_status_toast.xml
index b1a7697e8338b94543432fd71c1e167d93b9da0e..dadbd9c9abc807f0a50674cb63254938494fcc22 100644
--- a/indra/newview/skins/default/xui/en/panel_online_status_toast.xml
+++ b/indra/newview/skins/default/xui/en/panel_online_status_toast.xml
@@ -25,7 +25,7 @@
      layout="topleft"
      left_pad="5"
      name="message"
-     text_color="white"
+     text_color="White"
      top="15"
      use_ellipses="true"
      value=""
diff --git a/indra/newview/skins/default/xui/en/panel_outbox_inventory.xml b/indra/newview/skins/default/xui/en/panel_outbox_inventory.xml
index 66117615e42e16cbc81cdbf65f34e41791e4ec0c..a3d39e55af53a20a6c95ccff9fd9ac8b65d10c8e 100644
--- a/indra/newview/skins/default/xui/en/panel_outbox_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_outbox_inventory.xml
@@ -8,7 +8,6 @@
     bg_opaque_color="DkGray2"
     bg_alpha_color="DkGray2"
     background_visible="true"
-    background_opaque="true"
     border="false"
     bevel_style="none"
     show_item_link_overlays="true"
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 e1cd78bad8abb23b67ed936a71354b8e02fe461e..b61f110e32f92c067c86769694fc33e0fcfe5e3e 100644
--- a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
@@ -198,7 +198,6 @@ It is calculated as border_size + 2*UIResizeBarOverlap
                  height="154"
                  name="add_button_and_combobox"
                  width="311"
-                 user_resize="false"
                  visible="true">
 
             <!-- List containing items from the COF and Base outfit -->
@@ -271,8 +270,7 @@ It is calculated as border_size + 2*UIResizeBarOverlap
                  height="30"
                  name="filter_panel"
                  width="311"
-                 visible="false"
-                 user_resize="false">
+                 visible="false">
 
                     <filter_editor
 		             background_image="TextField_Search_Off"
@@ -515,7 +513,6 @@ It is calculated as border_size + 2*UIResizeBarOverlap
                      left="0"			
                      mouse_opaque="false"
                      name="save_btn_lp"
-                     user_resize="false" 
                      auto_resize="true"
                      width="156">
         <button
@@ -550,7 +547,6 @@ It is calculated as border_size + 2*UIResizeBarOverlap
                      left_pad="3"			
                      mouse_opaque="false"
                      name="revert_btn_lp"
-                     user_resize="false" 
                      auto_resize="true"
                      width="147">
         <button
diff --git a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
index 2ad2416179d4be49875890212bfebe482f8f2c5f..405d9513db34520224b387d8936bb1f2e2f63443 100644
--- a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
@@ -84,7 +84,6 @@
                      left="0"			
                      mouse_opaque="false"
                      name="save_btn_lp"
-                     user_resize="false" 
                      auto_resize="true"
                      width="156">
                     <button
@@ -118,7 +117,6 @@
                      left_pad="3"			
                      mouse_opaque="false"
                      name="wear_btn_lp"
-                     user_resize="false" 
                      auto_resize="true"
                      width="147">
                     <button
diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml
index 0ebfd9c037a949af794e497f74f8afca315b0614..98c7c49ff4793bbcc92ea1311e0b9bbd9f1cf684 100644
--- a/indra/newview/skins/default/xui/en/panel_people.xml
+++ b/indra/newview/skins/default/xui/en/panel_people.xml
@@ -284,7 +284,6 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
 				       height="25"
 				       layout="topleft"
 				       name="options_gear_btn_panel"
-				       user_resize="false"
 				       width="32">
 				          <menu_button
 				           follows="bottom|left"
@@ -305,7 +304,6 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
 				       height="25"
 				       layout="topleft"
 				       name="add_btn_panel"
-				       user_resize="false"
 				       width="32">
 				          <button
 				           follows="bottom|left"
@@ -326,7 +324,6 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
 				       height="25"
 				       layout="topleft"
 				       name="dummy_panel"
-				       user_resize="false"
 				       width="210">
 				          <icon
 				           follows="bottom|left|right"
@@ -343,7 +340,6 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
 				       height="25"
 				       layout="topleft"
 				       name="trash_btn_panel"
-				       user_resize="false"
 				       width="31">
 				          <dnd_button
 				           follows="bottom|left"
@@ -602,7 +598,6 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
 			layout="bottomleft"
 			left="0"
 			name="view_profile_btn_lp"
-		    user_resize="false" 
 		    auto_resize="true"
 			width="68">
 				<button
@@ -623,7 +618,6 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
 			layout="bottomleft"
 			left_pad="3"
 			name="im_btn_lp"
-		    user_resize="false" 
 		    auto_resize="true"
 			width="41">
 				<button
@@ -644,7 +638,6 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
 			layout="bottomleft"
 			left_pad="3"
 			name="call_btn_lp"
-		    user_resize="false" 
 		    auto_resize="true"
 			width="52">
 				<button
@@ -665,7 +658,6 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
 			layout="bottomleft"
 			left_pad="3"
 			name="share_btn_lp"
-		    user_resize="false" 
 		    auto_resize="true"
 			width="66">
 				<button
@@ -686,7 +678,6 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
 			layout="bottomleft"
 			left_pad="3"
 			name="teleport_btn_lp"
-		    user_resize="false" 
 		    auto_resize="true"
 			width="77">
 				<button
@@ -720,7 +711,6 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
 			left="0"			
 			mouse_opaque="false"
 			name="group_info_btn_lp"
-		    user_resize="false" 
 		    auto_resize="true"
 			width="108">
 				<button
@@ -743,7 +733,6 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
 			left_pad="3"
 			mouse_opaque="false"
 			name="chat_btn_lp"
-		    user_resize="false" 
 		    auto_resize="true"
 			width="101">
 				<button
@@ -766,7 +755,6 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
 			left_pad="3"
 			mouse_opaque="false"
 			name="group_call_btn_lp"
-		    user_resize="false" 
 		    auto_resize="true"
 			width="96">
 				<button
diff --git a/indra/newview/skins/default/xui/en/panel_pick_info.xml b/indra/newview/skins/default/xui/en/panel_pick_info.xml
index 24046d5cca6e5f8cf3ddd985eac70e7d67a0c440..79d190e1e09a0e6dea7ae3d190080c2dc6cc333e 100644
--- a/indra/newview/skins/default/xui/en/panel_pick_info.xml
+++ b/indra/newview/skins/default/xui/en/panel_pick_info.xml
@@ -139,7 +139,6 @@
 			  layout="bottomleft"
 			  left="0"
 			  name="layout_panel1"
-		      user_resize="false" 
 		      auto_resize="true"
 			  width="101">
 			  <button
@@ -158,7 +157,6 @@
 			  layout="bottomleft"
 			  left_pad="3"
 			  name="show_on_map_btn_lp"
-		      user_resize="false" 
 		      auto_resize="true"
 			  width="100">
 			  <button
@@ -177,7 +175,6 @@
 			  layout="bottomleft"
 			  left_pad="3"
 			  name="edit_btn_lp"
-		      user_resize="false" 
 		      auto_resize="true"
 			  width="101">
 			  <button
diff --git a/indra/newview/skins/default/xui/en/panel_picks.xml b/indra/newview/skins/default/xui/en/panel_picks.xml
index 85f402dfa246df7b06013db678751e897b1acce5..8def96cada1d79213cd0561a9ef88e1af84d4bdc 100644
--- a/indra/newview/skins/default/xui/en/panel_picks.xml
+++ b/indra/newview/skins/default/xui/en/panel_picks.xml
@@ -102,7 +102,6 @@ bg_opaque_color="DkGray2"
 			  layout="bottomleft"
 			  left="0"
 			  name="gear_menu_btn"
-		      user_resize="false" 
 		      auto_resize="true"
 			  width="51">
 				<button
@@ -124,7 +123,6 @@ bg_opaque_color="DkGray2"
 			  height="18"
 			  layout="bottomleft"
 			  name="trash_btn_lp"
-		      user_resize="false" 
 		      auto_resize="true"
 			  width="18">
 				<button
@@ -170,7 +168,6 @@ bg_opaque_color="DkGray2"
 			  layout="topleft"
 			  left="0"
 			  name="info_btn_lp"
-		      user_resize="false" 
 		      auto_resize="true"
 			  top="0"
 			  width="95">
@@ -192,7 +189,6 @@ bg_opaque_color="DkGray2"
 			  layout="bottomleft" 
 			  left_pad="2"
 			  name="teleport_btn_lp"
-		      user_resize="false" 
 		      auto_resize="true"
 			  width="117">
 		        <button
@@ -212,7 +208,6 @@ bg_opaque_color="DkGray2"
 			  height="28"
 			  layout="bottomleft"
 			  name="show_on_map_btn_lp"
-		      user_resize="false" 
 		      auto_resize="true" 
 			  left_pad="2"
 			  width="90">
diff --git a/indra/newview/skins/default/xui/en/panel_place_profile.xml b/indra/newview/skins/default/xui/en/panel_place_profile.xml
index e280115bda016a304d09837921a316740f459b6a..308acf0c0c5c7a777621d762a99557951c17b3d8 100644
--- a/indra/newview/skins/default/xui/en/panel_place_profile.xml
+++ b/indra/newview/skins/default/xui/en/panel_place_profile.xml
@@ -238,7 +238,6 @@
                  mouse_opaque="false"
                  name="here_panel"
                  top="0"
-                 user_resize="false"
                  width="60">
                     <icon
                      follows="top|left"
@@ -259,7 +258,6 @@
                  mouse_opaque="false"
                  name="for_sale_panel"
                  top="0"
-                 user_resize="false"
                  width="60">
                     <icon
                      follows="top|left"
diff --git a/indra/newview/skins/default/xui/en/panel_places.xml b/indra/newview/skins/default/xui/en/panel_places.xml
index 670aa47313d16d6225eb6beba9c0a5485b983f93..f169dbb70270af5192d1380e184effe6734a8d81 100644
--- a/indra/newview/skins/default/xui/en/panel_places.xml
+++ b/indra/newview/skins/default/xui/en/panel_places.xml
@@ -92,7 +92,6 @@ background_visible="true"
 			left="0"			
 			mouse_opaque="false"
 			name="lp1"
-		    user_resize="false" 
 		    auto_resize="true"
 			width="193">
 			
@@ -115,7 +114,6 @@ background_visible="true"
 					left="0"			
 					mouse_opaque="false"
 					name="teleport_btn_lp"
-				    user_resize="false" 
 				    auto_resize="true"
 					width="109">
 						<button
@@ -137,7 +135,6 @@ background_visible="true"
 					left_pad="3"
 					mouse_opaque="false"
 					name="chat_btn_lp"
-				    user_resize="false" 
 				    auto_resize="true"
 					width="86">
 						<button
@@ -161,7 +158,6 @@ background_visible="true"
 			left_pad="0"			
 			mouse_opaque="false"
 			name="lp2"
-		    user_resize="false" 
 		    auto_resize="true"
 			width="116">
 			
@@ -185,7 +181,6 @@ background_visible="true"
 					left_pad="0"
 					mouse_opaque="false"
 					name="edit_btn_lp"
-				    user_resize="false" 
 				    auto_resize="true"
 					width="84">
 						<button
@@ -208,7 +203,6 @@ background_visible="true"
 					left_pad="0"
 					mouse_opaque="false"
 					name="overflow_btn_lp"
-				    user_resize="false" 
 				    auto_resize="true"
 					width="24">
 						<menu_button
@@ -246,7 +240,6 @@ background_visible="true"
 					left_pad="3"			
 					mouse_opaque="false"
 					name="profile_btn_lp"
-				    user_resize="false" 
 				    auto_resize="true"
 					width="102">
 						<button
@@ -283,7 +276,6 @@ background_visible="true"
 					mouse_opaque="false"
 					name="close_btn_lp"
 					top="0"
-				    user_resize="false" 
 				    auto_resize="true"
 					width="51">
 						<button
@@ -324,7 +316,6 @@ background_visible="true"
 			mouse_opaque="false"
 			name="save_btn_lp"
 			top="0"
-		    user_resize="false" 
 		    auto_resize="true"
 			width="153">
 				<button
@@ -347,7 +338,6 @@ background_visible="true"
 			mouse_opaque="false"
 			name="cancel_btn_lp"
 			top="0"
-		    user_resize="false" 
 		    auto_resize="true"
 			width="154">
 				<button
diff --git a/indra/newview/skins/default/xui/en/panel_postcard_message.xml b/indra/newview/skins/default/xui/en/panel_postcard_message.xml
index e9f322f590f14cf05596c718eb2413cb504fb787..ab2a42ea01bf1baa6be6c97a037f41d2c8da9a2d 100644
--- a/indra/newview/skins/default/xui/en/panel_postcard_message.xml
+++ b/indra/newview/skins/default/xui/en/panel_postcard_message.xml
@@ -87,8 +87,8 @@
     <text_editor
      type="string"
      length="1"
-     follows="left|top|right|bottom"
-     height="140"
+     follows="left|top|right"
+     height="60"
      layout="topleft"
      left_delta="0"
      max_length="700"
@@ -104,7 +104,7 @@
      label="Cancel"
      layout="topleft"
      name="cancel_btn"
-     right="-10"
+     right="-32"
      top="350"
      width="100">
       <button.commit_callback
diff --git a/indra/newview/skins/default/xui/en/panel_postcard_settings.xml b/indra/newview/skins/default/xui/en/panel_postcard_settings.xml
index 84e35937980539b914565a58a0d6c74d43913514..3f67a48b14ff3f848bedd91fd330cab8f9373949 100644
--- a/indra/newview/skins/default/xui/en/panel_postcard_settings.xml
+++ b/indra/newview/skins/default/xui/en/panel_postcard_settings.xml
@@ -34,69 +34,103 @@
          name="Custom"
          value="[i-1,i-1]" />
     </combo_box>
-    <spinner
-     allow_text_entry="false"
-     decimal_digits="0"
-     follows="left|top"
-     height="20"
-     increment="32"
-     label="Width"
-     label_width="40"
-     layout="topleft"
-     left="10"
-     max_val="6016"
-     min_val="32"
-     name="postcard_snapshot_width"
+    <layout_stack
+     animate="false"
+     follows="all"
+     height="275"
+     layout="bottomleft"
+     name="postcard_image_params_ls"
+     left_delta="0"
+     orientation="vertical"
      top_pad="10"
-     width="95" />
-    <spinner
-     allow_text_entry="false"
-     decimal_digits="0"
-     follows="left|top"
-     height="20"
-     increment="32"
-     label="Height"
-     label_width="40"
-     layout="topleft"
-     left_pad="5"
-     max_val="6016"
-     min_val="32"
-     name="postcard_snapshot_height"
-     top_delta="0"
-     width="95" />
-    <check_box
-     bottom_delta="20"
-     follows="left|top"
-     label="Constrain proportions"
-     layout="topleft"
-     left="10"
-     name="postcard_keep_aspect_check" />
-    <slider
-     decimal_digits="0"
-     follows="left|top"
-     height="15"
-     increment="1"
-     initial_value="75"
-     label="Image quality"
-     label_width="80"
-     layout="topleft"
-     left="10"
-     max_val="100"
-     name="image_quality_slider"
-     top_pad="7"
-     width="200" />
-    <text
-     type="string"
-     follows="left|top"
-     font="SansSerifSmall"
-     length="1"
-     height="14"
-     layout="topleft"
-     left_pad="-5"
-     halign="left"
-     name="image_quality_level"
-     top_delta="0"
-     width="60">
-       ([QLVL])
-    </text>
+     right="-10">
+        <layout_panel
+         follows="top|left|right"
+         height="60"
+         layout="topleft"
+         left="0"
+         name="postcard_image_size_lp"
+         auto_resize="false"
+         top="0"
+         right="-1"
+         visible="true">
+            <spinner
+             allow_text_entry="false"
+             decimal_digits="0"
+             follows="left|top"
+             height="20"
+             increment="32"
+             label="Width"
+             label_width="40"
+             layout="topleft"
+             left="10"
+             max_val="6016"
+             min_val="32"
+             name="postcard_snapshot_width"
+             top_pad="10"
+             width="95" />
+            <spinner
+             allow_text_entry="false"
+             decimal_digits="0"
+             follows="left|top"
+             height="20"
+             increment="32"
+             label="Height"
+             label_width="40"
+             layout="topleft"
+             left_pad="5"
+             max_val="6016"
+             min_val="32"
+             name="postcard_snapshot_height"
+             top_delta="0"
+             width="95" />
+            <check_box
+              height="10"
+             bottom_delta="20"
+             follows="left|top"
+             label="Constrain proportions"
+             layout="topleft"
+             left="10"
+             name="postcard_keep_aspect_check" />
+        </layout_panel>
+        <layout_panel
+         follows="top|left|right"
+         height="23"
+         layout="topleft"
+         left="0"
+         name="postcard_image_format_quality_lp"
+         auto_resize="true"
+         top="0"
+         right="-1"
+         visible="true">
+            <slider
+             decimal_digits="0"
+             follows="left|top"
+             height="15"
+             increment="1"
+             initial_value="75"
+             label="Image quality"
+             label_width="80"
+             layout="topleft"
+             left="0"
+             max_val="100"
+             name="image_quality_slider"
+             top_pad="7"
+             width="190" />
+            <text
+             type="string"
+             follows="left|top"
+             font="SansSerifSmall"
+             length="1"
+             height="14"
+             layout="topleft"
+             left_pad="-5"
+             halign="left"
+             name="image_quality_level"
+             top_delta="0"
+             width="60">
+               ([QLVL])
+            </text>
+        </layout_panel>
+    </layout_stack>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_general.xml b/indra/newview/skins/default/xui/en/panel_preferences_general.xml
index 4079a80924972fc55a5b92724d524faac1701323..24882988b06619646bb5f3e51d3db867f65301d2 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_general.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_general.xml
@@ -331,7 +331,7 @@
    </text>
    <radio_group
      control_name="LetterKeysFocusChatBar" 
-     height="20"
+     height="34"
      layout="topleft"
      left="35"
      top_pad="0" 
@@ -339,7 +339,7 @@
         <radio_item
          label="Starts local chat"
          name="radio_start_chat"
-         top_delta="20" 
+         top="0" 
          layout="topleft"
          height="16" 
          left="0" 
@@ -364,7 +364,7 @@
      layout="topleft"
      left="30"
      name="title_afk_text"
-     top_pad="15" 
+     top_pad="5" 
      width="190">
     	Away timeout:
     </text>
@@ -420,7 +420,7 @@
      follows="left|top"
      height="29"
      layout="topleft"
-     left="50"
+     left="30"
      name="busy_response"
      width="470"
      word_wrap="true">
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 47236c1a48b38bfb322d0e4e947bcfe8a020516f..587c461bee96ebc9e6c20682973bcd746d6df0c7 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml
@@ -59,7 +59,6 @@
      top_pad="30"
      width="350" />
     <check_box
-     enabled_control="EnableVoiceChat"
      control_name="VoiceCallsFriendsOnly"
      height="16"
      label="Only friends and groups can call or IM me"
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
index a7078ce2e106cf8ddd2d46a0da0cf86e0f9200c0..4aeea8823e688845558c83619550d0a58b5639b7 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
@@ -122,7 +122,7 @@
       layout="topleft"
       left_delta="0"
       name="external"
-      value="1"
+      value="true"
       top="0"
       tool_tip="Use the default system web browser for help, web links, etc. Not recommended if running full screen."
       width="480" />
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_sound.xml b/indra/newview/skins/default/xui/en/panel_preferences_sound.xml
index 1f92244eb97d5c265214c85e1ccb621400faad1e..b71586aab16921ae4114845c273dd976c2d56f38 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_sound.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_sound.xml
@@ -63,7 +63,7 @@
       layout="topleft"
       left_pad="0"
       name="mute_chb_label"
-      top_delta="0"
+      top_delta="-1"
       width="150"
       wrap="true">
       Mute when minimized
diff --git a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml
index 273c2524742b21ede2e5d50feec5021b124d450a..198ccd6e2f7cdf352d91881c97fa5a0a4c2ed62d 100644
--- a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml
+++ b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml
@@ -31,8 +31,7 @@
 		width="0"
 		name="left_bookend_bottom"
 		mouse_opaque="false"
-		layout="topleft"
-		user_resize="false" />
+		layout="topleft"/>
 	<layout_panel
 		name="media_progress_indicator"
 		mouse_opaque="false"
@@ -41,7 +40,6 @@
 		left="0"
 		top="0"
 		auto_resize="false"
-		user_resize="false"
 		min_width="100"
 		width="200">
 	  <progress_bar
@@ -59,8 +57,7 @@
 		name="right_bookend_bottom"
 		width="0"
 		mouse_opaque="false"
-		layout="topleft"
-		user_resize="false" />
+		layout="topleft"/>
   </layout_stack>
   <layout_stack
 	  name="media_controls"
@@ -79,13 +76,11 @@
 		top="0"
 		width="0"
 		mouse_opaque="false"
-		layout="topleft"
-		user_resize="false" />
+		layout="topleft"/>
 	<layout_panel
 		name="back"
 		top="0"
 		auto_resize="false"
-		user_resize="false"
 		layout="topleft"
 		mouse_opaque="false"
 		min_width="22"
@@ -114,7 +109,6 @@
 		name="fwd"
 		mouse_opaque="false"
 		auto_resize="false"
-		user_resize="false"
 		layout="topleft"
 		min_width="22"
 		top="0"
@@ -142,7 +136,6 @@
 		name="home"
 		mouse_opaque="false"
 		auto_resize="false"
-		user_resize="false"
 		layout="topleft"
 		top="0"
 		height="22"
@@ -170,7 +163,6 @@
 		name="media_stop"
 		mouse_opaque="false"
 		auto_resize="false"
-		user_resize="false"
 		layout="topleft"
 		top="0"
 		height="22"
@@ -198,7 +190,6 @@
 		name="reload"
 		mouse_opaque="false"
 		auto_resize="false"
-		user_resize="false"
 		layout="topleft"
 		top="0"
 		height="22"
@@ -226,7 +217,6 @@
 		name="stop"
 		mouse_opaque="false"
 		auto_resize="false"
-		user_resize="false"
 		layout="topleft"
 		top="0"
 		height="22"
@@ -254,7 +244,6 @@
 		name="play"
 		mouse_opaque="false"
 		auto_resize="false"
-		user_resize="false"
 		layout="topleft"
 		top="0"
 		height="22"
@@ -282,7 +271,6 @@
 		name="pause"
 		mouse_opaque="false"
 		auto_resize="false"
-		user_resize="false"
 		layout="topleft"
 		top="0"
 		min_width="22"
@@ -310,7 +298,6 @@
 		name="media_address"
 		mouse_opaque="false"
 		auto_resize="true"
-		user_resize="false"
 		height="24"
 		follows="left|right|bottom"
 		layout="topleft"
@@ -343,8 +330,7 @@
 			layout="topleft"
 			width="16"
 			mouse_opaque="false"
-			auto_resize="false"
-			user_resize="false">
+			auto_resize="false">
 		  <icon
 			  name="media_whitelist_flag"
 			  follows="top|right"
@@ -358,8 +344,7 @@
 			layout="topleft"
 			width="16"
 			mouse_opaque="false"
-			auto_resize="false"
-			user_resize="false">
+			auto_resize="false">
 		  <icon
 			  name="media_secure_lock_flag"
 			  height="16"
@@ -374,7 +359,6 @@
 		name="media_play_position"
 		mouse_opaque="false"
 		auto_resize="true"
-		user_resize="false"
 		follows="left|right"
 		layout="topleft"
 		top="0"
@@ -399,7 +383,6 @@
 		name="skip_back"
 		mouse_opaque="false"
 		auto_resize="false"
-		user_resize="false"
 		layout="topleft"
 		top="0"
 		min_width="22"
@@ -428,7 +411,6 @@
 		name="skip_forward"
 		mouse_opaque="false"
 		auto_resize="false"
-		user_resize="false"
 		layout="topleft"
 		top="0"
 		min_width="22"
@@ -455,7 +437,6 @@
 		name="media_volume"
 		mouse_opaque="false"
 		auto_resize="false"
-		user_resize="false"
 		layout="topleft"
 		top="0"
 		height="72"
@@ -511,7 +492,6 @@
 		name="zoom_frame"
 		mouse_opaque="false"
 		auto_resize="false"
-		user_resize="false"
 		layout="topleft"
 		top="0"
 		height="28"
@@ -539,7 +519,6 @@
 		name="close"
 		mouse_opaque="false"
 		auto_resize="false"
-		user_resize="false"
 		layout="topleft"
 		top="0"
 		min_width="21"
@@ -567,7 +546,6 @@
 		name="new_window"
 		mouse_opaque="false"
 		auto_resize="false"
-		user_resize="false"
 		layout="topleft"
 		top="0"
 		min_width="22"
@@ -596,8 +574,7 @@
 		mouse_opaque="false"
 		top="0"
 		width="0"
-		layout="topleft"
-		user_resize="false" />
+		layout="topleft"/>
   </layout_stack>
   <panel
 	  name="media_region"
diff --git a/indra/newview/skins/default/xui/en/panel_profile.xml b/indra/newview/skins/default/xui/en/panel_profile.xml
deleted file mode 100644
index f5a9daa994c3705bb7cc1a16f29f4bc1a30e85a0..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/en/panel_profile.xml
+++ /dev/null
@@ -1,458 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<panel
- follows="all"
- height="430"
- label="Profile"
- layout="topleft"
- left="0"
- name="panel_profile"
- top="0"
- width="317">
-    <string
-     name="CaptionTextAcctInfo">
-        [ACCTTYPE]
-[PAYMENTINFO] [AGEVERIFICATION]
-    </string>
-    <string
-     name="payment_update_link_url">
-        http://www.secondlife.com/account/billing.php?lang=en
-    </string>
-    <string
-     name="partner_edit_link_url">
-        http://www.secondlife.com/account/partners.php?lang=en
-    </string>
-    <string
-     name="my_account_link_url"
-     value="http://secondlife.com/account" />
-    <string
-     name="no_partner_text"
-     value="None" />
-    <string
-     name="no_group_text"
-     value="None" />
-    <string
-	 name="RegisterDateFormat">
-	 [REG_DATE] ([AGE])
-	</string>
-  <string
-  name="name_text_args">
-    [NAME]
-  </string>
-  <string
-    name="display_name_text_args">
-    [DISPLAY_NAME]
-  </string>
-    <layout_stack
-     name="layout"
-     orientation="vertical"
-     follows="all"
-     layout="topleft"
-     left="0"
-     top="0"
-     height="400"
-     width="317"
-     border_size="0">
-      <layout_panel
-         name="profile_stack"
-         follows="all"
-         layout="topleft"
-         top="0"
-         left="0"
-         height="400"
-         width="317">
-        <scroll_container
-         color="DkGray2"
-         follows="all"
-         layout="topleft"
-         left="0"
-         name="profile_scroll"
-         opaque="true"
-         height="400"
-         width="317"
-         top="0">
-          <panel
-                layout="topleft"
-          follows="left|top|right"
-                height="505"
-		min_height="505"
-                name="profile_scroll_panel"
-                top="0"
-                left="0"
-                width="297">
-            <panel
-                  follows="left|top|right"
-                  height="124"
-                  layout="topleft"
-                  left="13"
-                  name="second_life_image_panel"
-                  top="0"
-                  width="297">
-              <texture_picker
-               allow_no_texture="true"
-               default_image_name="None"
-               enabled="false"
-               fallback_image="Generic_Person_Large"
-               follows="top|left"
-               height="124"
-               layout="topleft"
-               left="0"
-               name="2nd_life_pic"
-               top="10"
-               width="102" />
-              <text
-               follows="left|top|right"
-         font.style="BOLD"
-               height="15"
-               layout="topleft"
-               left_pad="10"
-               name="title_sl_descr_text"
-               text_color="white"
-               top_delta="0"
-               value="[SECOND_LIFE]:"
-               width="180" />
-              <expandable_text
-               follows="left|top|right"
-               height="97"
-               layout="topleft"
-               left="107"
-               textbox.max_length="512"
-               textbox.show_context_menu="true"
-               name="sl_description_edit"
-               top_pad="-3"
-               translate="false"
-               width="180"
-               expanded_bg_visible="true"
-               expanded_bg_color="DkGray">
-                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean viverra orci et justo sagittis aliquet.Nullamma lesuada mauris sit amet ipsum. adipiscing elit. Ae nean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet ipsum. adipiscing elit. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet ipsum.
-              </expandable_text>
-            </panel>
-            <panel
-             follows="left|top|right"
-             height="124"
-             layout="topleft"
-       top_pad="0"
-             left="13"
-             name="first_life_image_panel"
-             width="297">
-              <texture_picker
-               allow_no_texture="true"
-               default_image_name="None"
-               enabled="false"
-               fallback_image="Generic_Person_Large"
-               follows="top|left"
-               height="124"
-               layout="topleft"
-               left="0"
-               name="real_world_pic"
-               width="102" />
-              <text
-               follows="left|top|right"
-         font.style="BOLD"
-               height="15"
-               layout="topleft"
-               left_pad="10"
-               name="title_rw_descr_text"
-               text_color="white"
-               top_delta="0"
-               value="Real World:"
-               width="180" />
-              <expandable_text
-               follows="left|top|right"
-               height="97"
-               layout="topleft"
-               left="107"
-               textbox.max_length="512"
-               textbox.show_context_menu="true"
-               name="fl_description_edit"
-               top_pad="-3"
-               translate="false"
-               width="180"
-               expanded_bg_visible="true"
-               expanded_bg_color="DkGray">
-                Lorem ipsum dolor sit amet, consectetur adlkjpiscing elit moose moose. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet. adipiscing elit. Aenean rigviverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet sorbet ipsum. adipiscing elit. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet ipsum.
-              </expandable_text>
-            </panel>
-            <text
-              follows="left|top"
-              height="15"
-        font.style="BOLD"
-        font="SansSerifMedium"
-              layout="topleft"
-              left="10"
-              name="homepage_edit"
-              top_pad="0"
-              translate="false"
-              value="http://librarianavengers.org"
-              width="300"
-              word_wrap="false"
-              use_ellipses="true" />
-            <text
-             follows="left|top"
-           font.style="BOLD"
-             height="10"
-             layout="topleft"
-             left="10"
-             name="title_member_text"
-             text_color="white"
-             top_pad="10"
-             value="Resident Since:"
-             width="300" />
-            <text_editor
-             allow_scroll="false"
-             bg_visible="false"
-             follows="left|top"
-             h_pad="0"
-             height="15"
-             layout="topleft"
-             left="10"
-             name="register_date"
-             read_only="true"
-             translate="false"
-             v_pad="0"
-             value="05/31/2376"
-             width="300"
-             word_wrap="true" />
-            <text
-             follows="left|top"
-       font.style="BOLD"
-             height="15"
-             layout="topleft"
-             left="10"
-             name="title_acc_status_text"
-             text_color="white"
-             top_pad="5"
-             value="Account Status:"
-             width="300" />
-            <!-- <text
-         type="string"
-         follows="left|top"
-         font="SansSerifSmall"
-         height="15"
-         layout="topleft"
-         left_pad="10"
-         name="my_account_link"
-         top_delta="0"
-	 value="Go to Dashboard"
-         width="100"/> -->
-            <text_editor
-             allow_scroll="false"
-             bg_visible="false"
-             follows="left|top"
-             h_pad="0"
-             height="28"
-             layout="topleft"
-             left="10"
-             name="acc_status_text"
-             read_only="true"
-             top_pad="0"
-             translate="false"
-             v_pad="0"
-             width="300"
-             word_wrap="true">
-              Resident. No payment info on file.
-              Linden.
-            </text_editor>
-            <text
-             follows="left|top"
-       font.style="BOLD"
-             height="15"
-             layout="topleft"
-             left="10"
-             name="title_partner_text"
-             text_color="white"
-             top_pad="3"
-             value="Partner:"
-             width="300" />
-            <panel
-             follows="left|top"
-             height="15"
-             layout="topleft"
-             left="10"
-             name="partner_data_panel"
-             top_pad="0"
-             width="300">
-              <text
-               follows="left|top"
-               height="10"
-               initial_value="(retrieving)"
-               layout="topleft"
-               left="0"
-               parse_urls="true"
-               name="partner_text"
-               top="0"
-               use_ellipses="true"
-           width="300" />
-            </panel>
-            <text
-             follows="left|top"
-       font.style="BOLD"
-             height="13"
-             layout="topleft"
-             left="10"
-             name="title_groups_text"
-             text_color="white"
-             top_pad="3"
-             value="Groups:"
-             width="300" />
-            <expandable_text
-            follows="all"
-            height="103"
-            layout="topleft"
-            left="7"
-            name="sl_groups"
-            textbox.max_length="512"
-            textbox.show_context_menu="true"
-            top_pad="0"
-            translate="false"
-            width="290"
-            expanded_bg_visible="true"
-            expanded_bg_color="DkGray">
-              Lorem ipsum dolor sit amet, consectetur adlkjpiscing elit moose moose. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet. adipiscing elit. Aenean rigviverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet sorbet ipsum. adipiscing elit. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet ipsum. Aenean viverra tulip moosetop. Slan de heelish marfnik tooplod. Sum sum to whop de wompam booster copm.
-            </expandable_text>
-          </panel>
-        </scroll_container>
-      </layout_panel>
-           
-</layout_stack>
-
-	<layout_stack
-     name="layout_verb_buttons"
-     orientation="horizontal"
-     follows="bottom|left|right"
-     layout="topleft"
-     left="2"
-     top_pad="1"
-     height="30"
-     width="315"
-     border_size="0">
-     	<layout_panel
-         follows="bottom|left"
-         height="30"
-         layout="topleft"
-         name="profile_buttons_panel"
-         top="0"
-         auto_resize="false"
-         width="317">
-         	
-           <layout_stack
-	     	follows="bottom|left|right"
-			height="23"
-			layout="topleft"
-			name="bottom_bar_ls"
-			left="0"
-			orientation="horizontal"
-			top_pad="5"
-			width="317">
-	
-				<layout_panel
-				follows="bottom|left|right"
-				height="23"
-				layout="bottomleft"
-				left="0"
-				name="add_friend_btn_lp"
-			    user_resize="false" 
-			    auto_resize="true"
-				width="121">
-					<button
-			         follows="bottom|left|right"
-			         height="23"
-			         label="Add Friend"
-			         layout="topleft"
-			         left="1"
-			         mouse_opaque="false"
-			         name="add_friend"
-			         tool_tip="Offer friendship to the Resident"
-			         top="0"
-			         width="120" />	
-				</layout_panel>
-				
-				<layout_panel
-				follows="bottom|left|right"
-				height="23"
-				layout="bottomleft"
-				left_pad="3"
-				name="im_btn_lp"
-			    user_resize="false" 
-			    auto_resize="true"
-				width="22">
-					<button
-			         follows="bottom|left|right"
-			         height="23"
-			         label="IM"
-			         layout="topleft"
-			         name="im"
-			         tool_tip="Open instant message session"
-			         top="0"
-			         left="1"
-			         width="21" />		
-				</layout_panel>
-				
-				<layout_panel
-				follows="bottom|left|right"
-				height="23"
-				layout="bottomleft"
-				left_pad="3"
-				name="call_btn_lp"
-			    user_resize="false" 
-			    auto_resize="true"
-				width="52">
-					<button
-			         follows="bottom|left|right"
-			         height="23"
-			         label="Call"
-			         layout="topleft"
-			         name="call"
-			         tool_tip="Call this Resident"
-			         left="1"
-			         top="0"
-			         use_ellipses="true"
-			         width="51" />		
-				</layout_panel>
-				
-				<layout_panel
-				follows="bottom|left|right"
-				height="23"
-				layout="bottomleft"
-				left_pad="3"
-				name="chat_btn_lp"
-			    user_resize="false" 
-			    auto_resize="true"
-				width="93">
-					<button
-			         follows="bottom|left|right"
-			         height="23"
-			         label="Teleport"
-			         layout="topleft"
-			         name="teleport"
-			         tool_tip="Offer teleport"
-			         left="1"
-			         top="0"
-			         use_ellipses="true"
-			         width="92" />
-				</layout_panel>
-				
-				<layout_panel
-				follows="bottom|left|right"
-				height="23"
-				layout="bottomleft"
-				left_pad="3"
-				name="overflow_btn_lp"
-			    user_resize="false" 
-			    auto_resize="false"
-				width="24">
-					<menu_button
-			         follows="bottom|left|right"
-			         height="23"
-			         label="â–¼"
-			         layout="topleft"
-			         name="overflow_btn"
-			         tool_tip="Pay money to or share inventory with the Resident"
-			         left="1"
-			         top="0"
-			         width="23" />		
-				</layout_panel>
-		</layout_stack>
-      </layout_panel>
-     </layout_stack>
-
-</panel>
diff --git a/indra/newview/skins/default/xui/en/panel_profile_view.xml b/indra/newview/skins/default/xui/en/panel_profile_view.xml
deleted file mode 100644
index 646875b52e844febb87dbec0a33bf0ff5e39a851..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/en/panel_profile_view.xml
+++ /dev/null
@@ -1,162 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<panel
- background_visible="true"
- follows="all"
- height="570"
- layout="topleft"
- min_height="350"
- name="panel_target_profile"
- left="0"
- width="333">
-  <string
-   name="status_online">
-    Online
-  </string>
-  <string
-   name="status_offline">
-    Offline
-  </string>
-  <button
-   follows="top|left"
-   height="24"
-   image_hover_unselected="BackButton_Over"
-   image_pressed="BackButton_Press"
-   image_unselected="BackButton_Off"
-   layout="topleft"
-   name="back"
-   left="10"
-   tab_stop="false"
-   top="2"
-   width="30"
-   use_draw_context_alpha="false" />
-  <text
-   top="10"
-   follows="top|left"
-   height="13"
-   layout="topleft"
-   left="45"
-   name="display_name_label"
-   text_color="LtGray"
-   value="Display Name:"
-   width="80" />
-  <text
-   top_delta="0"
-   follows="top|left"
-   height="13"
-   layout="topleft"
-   left="45"
-   name="solo_username_label"
-   text_color="LtGray"
-   value="Username:"
-   visible="false" 
-   width="80" />
-  <text
-   follows="top|right"
-   halign="right"
-   height="13"
-   layout="topleft"
-   right="-15"
-   name="status"
-   text_color="LtGray_50"
-   top_delta="0"
-   value="Online"
-   width="150" />
-  <text
-   follows="top|left|right"
-   font="SansSerifBigBold"
-   height="29"
-   layout="topleft"
-   left="45"
-   name="user_name_small"
-   text_color="LtGray"
-   top="22"
-   value="Jack oh look at me this is a super duper long name"
-   use_ellipses="true"
-   word_wrap="true"
-   visible="false"
-   width="255" />
-  <text
-   follows="top|left|right"
-   font="SansSerifHugeBold"
-   height="27"
-   layout="topleft"
-   left="45"
-   name="user_name"
-   text_color="LtGray"
-   translate="false"
-   top="25"
-   value="TestString PleaseIgnore"
-   visible="true"
-   use_ellipses="true"
-   width="258" /> 
-  <button
-         name="copy_to_clipboard"
-         layout="topleft"
-         follows="top|right"
-         image_overlay="Copy"
-         top_delta="0"
-         right="-15"
-         height="21"
-         width="21"
-         tab_stop="false" 
-         tool_tip="Copy to Clipboard"/>
-  <text
-   follows="top|left"
-   height="13"
-   layout="topleft"
-   left="45"
-   name="user_label"
-   text_color="LtGray"
-   top_pad="10" 
-   value="Username:"
-   width="70" />
-  <text
-   follows="top|left"
-   height="20"
-   layout="topleft"
-   left_pad="0"
-   name="user_slid"
-   text_color="EmphasisColor"
-   font="SansSerifBold"
-   top_delta="-2"
-   translate="false"
-   use_ellipses="true"
-   value="teststring.pleaseignore"
-   width="195" 
-   wrap="true "/>
-  <tab_container
-   follows="all"
-   height="489"
-   halign="center"
-   layout="topleft"
-   left="5"
-   min_width="333"
-   name="tabs"
-   tab_min_width="80"
-   tab_height="30"
-   tab_position="top"
-   top_pad="5"
-   width="317">
-    <panel
-     class="panel_profile"
-     filename="panel_profile.xml"
-     label="PROFILE"
-     layout="topleft"
-     help_topic="profile_profile_tab"
-     name="panel_profile" />
-    <panel
-     class="panel_picks"
-     filename="panel_picks.xml"
-     label="PICKS"
-     layout="topleft"
-     help_topic="profile_picks_tab"
-     name="panel_picks" />
-    <panel
-     class="panel_notes"
-     filename="panel_notes.xml"
-     label="NOTES &amp; PRIVACY"
-     layout="topleft"
-     help_topic="profile_notes_tab"
-     name="panel_notes" />
-  </tab_container>
-</panel>
diff --git a/indra/newview/skins/default/xui/en/panel_progress.xml b/indra/newview/skins/default/xui/en/panel_progress.xml
index 4535c563398a43117fff2dfa8736e3de9e933122..860caf2d217a91a117c9c8da05b799f90f8ea7b3 100644
--- a/indra/newview/skins/default/xui/en/panel_progress.xml
+++ b/indra/newview/skins/default/xui/en/panel_progress.xml
@@ -12,45 +12,43 @@
      height="768"
      layout="topleft"
      left="0"
-     name="stack1"
+     name="horizontal_centering"
      orientation="horizontal"
      top="0"
      width="1024">
         <layout_panel
          layout="topleft"
          min_width="10"
-         name="panel1"
-         user_resize="false"
+         name="left"
          width="150" />
         <layout_panel
          height="768"
          layout="topleft"
-         min_width="640"
-         name="panel2"
-         user_resize="false"
-         width="640">
+         min_width="670"
+         name="center"
+         width="670">
             <layout_stack
              follows="left|right|top|bottom"
              height="768"
              layout="topleft"
              left="0"
              orientation="vertical" 
-             name="stack2"
+             name="vertical_centering"
              top="0"
-             width="640">
+             width="670">
                 <layout_panel
                  height="200"
                  layout="topleft"
                  min_height="10"
                  name="panel3"
-                 width="640" />
+                 width="670" />
                 <layout_panel
                  auto_resize="false"
                  height="250"
                  layout="topleft"
                  min_height="250"
                  name="panel4"
-                 width="640">
+                 width="670">
                     <icon
                      color="LoginProgressBoxCenterColor"
                      follows="left|right|bottom|top"
@@ -59,7 +57,7 @@
                      layout="topleft"
                      left="0"
                      top="0"
-                     width="640" />
+                     width="670" />
                     <text
                      follows="left|right|top"
                      font="SansSerifHuge"
@@ -71,7 +69,7 @@
                      name="title_text"
                      text_color="LoginProgressBoxTextColor"
                      top_delta="50"
-                     width="593" />
+                     right="-47"/>
                     <text
                      follows="left|right|top"
                      font="SansSerif"
@@ -83,7 +81,7 @@
                      name="progress_text"
                      text_color="LoginProgressBoxTextColor"
                      top_pad="5"
-                     width="593"
+                     right="-47"
                      word_wrap="true"/>
                     <progress_bar
                      bottom="115"
@@ -106,7 +104,7 @@
                      name="message_text"
                      text_color="LoginProgressBoxTextColor"
                      top="145"
-                     width="550"
+                     right="-90"
                      word_wrap="true"/>
                 </layout_panel>
                 <layout_panel
@@ -114,14 +112,13 @@
                  layout="topleft"
                  min_width="10"
                  name="panel5"
-                 width="640" />
+                 width="670" />
             </layout_stack>
         </layout_panel>
         <layout_panel
          layout="topleft"
          min_width="10"
-         name="panel6"
-         user_resize="false"
+         name="right"
          width="150" />
     </layout_stack>
     <button
diff --git a/indra/newview/skins/default/xui/en/panel_region_covenant.xml b/indra/newview/skins/default/xui/en/panel_region_covenant.xml
index df16f6fd373438ddd4ff1c1e632d5319ee90117b..112f12500df2f95a4409a42e7bc4453db7bf8bd8 100644
--- a/indra/newview/skins/default/xui/en/panel_region_covenant.xml
+++ b/indra/newview/skins/default/xui/en/panel_region_covenant.xml
@@ -57,7 +57,7 @@
      mouse_opaque="false"
      name="estate_name_text"
      top_delta="0"
-     width="150">
+     width="350">
         mainland
     </text>
     <text
@@ -79,7 +79,7 @@
      mouse_opaque="false"
      name="estate_owner_text"
      top_delta="0"
-     width="150">
+     width="350">
         (none)
     </text>
     <text
diff --git a/indra/newview/skins/default/xui/en/panel_region_estate.xml b/indra/newview/skins/default/xui/en/panel_region_estate.xml
index 6b28639a777ac8e8a08662170eafb5a12cd81a65..bfd796a62bd91da5ac00c702ae97171ac7f71e14 100644
--- a/indra/newview/skins/default/xui/en/panel_region_estate.xml
+++ b/indra/newview/skins/default/xui/en/panel_region_estate.xml
@@ -134,26 +134,26 @@
      name="Only Allow"
      top_delta="-30"
      width="278">
-        Restrict Access to accounts verified by:
+        Allow access only to Residents who:
     </text>
     <check_box
      follows="top|left"
      height="16"
-     label="Payment Information on File"
+     label="Have payment information on file"
      layout="topleft"
      left_delta="0"
      name="limit_payment"
-     tool_tip="Ban unidentified Residents"
+     tool_tip="Residents must have payment information on file to access this estate.  See the [SUPPORT_SITE] for more information."
      top_pad="2"
      width="278" />
     <check_box
      follows="top|left"
      height="16"
-     label="Age Verification"
+     label="Have been age-verified"
      layout="topleft"
      left_delta="0"
      name="limit_age_verified"
-     tool_tip="Ban Residents who have not verified their age. See the [SUPPORT_SITE] for more information."
+     tool_tip="Residents must be age verified to access this estate. See the [SUPPORT_SITE] for more information."
      top_pad="2"
      width="278" />
 
diff --git a/indra/newview/skins/default/xui/en/panel_script_ed.xml b/indra/newview/skins/default/xui/en/panel_script_ed.xml
index 8d420243864c56e4cda3fa1d0f53e2b7ad2e00d1..f6a8af097355f99a354ba45868823b708b595416 100644
--- a/indra/newview/skins/default/xui/en/panel_script_ed.xml
+++ b/indra/newview/skins/default/xui/en/panel_script_ed.xml
@@ -54,12 +54,22 @@
              label="Save"
              layout="topleft"
              name="Save" />
-            <menu_item_separator
-             layout="topleft" />
-            <menu_item_call
-             label="Revert All Changes"
-             layout="topleft"
-             name="Revert All Changes" />
+          <menu_item_separator
+           layout="topleft" />
+          <menu_item_call
+           label="Revert All Changes"
+           layout="topleft"
+           name="Revert All Changes" />
+          <menu_item_separator
+           layout="topleft" />
+          <menu_item_call
+           label="Load from file..."
+           layout="topleft"
+           name="LoadFromFile" />
+          <menu_item_call
+           label="Save to file..."
+           layout="topleft"
+           name="SaveToFile" />
         </menu>
         <menu
          top="0"
diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml b/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml
index 7b148fa338f084ad6f3d447f059fae4916935bb5..71d808fa4b22b0ac5145739dc3015488bbd59a6a 100644
--- a/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml
@@ -114,18 +114,20 @@
      width="95" />
     <check_box
      bottom_delta="20"
+     height="10"
      follows="left|top"
      label="Constrain proportions"
      layout="topleft"
      left="10"
-     name="inventory_keep_aspect_check" />
+     name="inventory_keep_aspect_check"
+     visible="false" />
     <button
      follows="right|bottom"
      height="23"
      label="Cancel"
      layout="topleft"
      name="cancel_btn"
-     right="-10"
+     right="-32"
      top="350"
      width="100">
       <button.commit_callback
diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_local.xml b/indra/newview/skins/default/xui/en/panel_snapshot_local.xml
index 4d6c4bcdfaccc741885eda31d4200a1eff51ea16..781ab174031b942158a3d8708012983f2a2f8769 100644
--- a/indra/newview/skins/default/xui/en/panel_snapshot_local.xml
+++ b/indra/newview/skins/default/xui/en/panel_snapshot_local.xml
@@ -80,115 +80,156 @@
          name="Custom"
          value="[i-1,i-1]" />
     </combo_box>
-    <spinner
-     allow_text_entry="false"
-     decimal_digits="0"
-     follows="left|top"
-     height="20"
-     increment="32"
-     label="Width"
-     label_width="40"
-     layout="topleft"
-     left="10"
-     max_val="6016"
-     min_val="32"
-     name="local_snapshot_width"
-     top_pad="10"
-     width="95" />
-    <spinner
-     allow_text_entry="false"
-     decimal_digits="0"
-     follows="left|top"
-     height="20"
-     increment="32"
-     label="Height"
-     label_width="40"
-     layout="topleft"
-     left_pad="5"
-     max_val="6016"
-     min_val="32"
-     name="local_snapshot_height"
-     top_delta="0"
-     width="95" />
-    <check_box
-     bottom_delta="20"
-     follows="left|top"
-     label="Constrain proportions"
-     layout="topleft"
-     left="10"
-     name="local_keep_aspect_check" />
-    <combo_box
-     follows="left|top"
-     height="23"
-     label="Format"
-     layout="topleft"
+    <layout_stack
+     animate="false"
+     follows="all"
+     height="275"
+     layout="bottomleft"
+     name="local_image_params_ls"
      left_delta="0"
-     name="local_format_combo"
+     orientation="vertical"
      top_pad="10"
-     width="120">
-        <combo_box.item
-         label="PNG (Lossless)"
-         name="PNG"
-         value="PNG" />
-        <combo_box.item
-         label="JPEG"
-         name="JPEG"
-         value="JPEG" />
-        <combo_box.item
-         label="BMP (Lossless)"
-         name="BMP"
-         value="BMP" />
-    </combo_box>
-    <slider
-     decimal_digits="0"
-     follows="left|top"
-     height="15"
-     increment="1"
-     initial_value="75"
-     label="Image quality"
-     label_width="80"
-     layout="topleft"
-     left="10"
-     max_val="100"
-     name="image_quality_slider"
-     top_pad="7"
-     width="200" />
-    <text
-     type="string"
-     follows="left|top"
-     font="SansSerifSmall"
-     length="1"
-     height="14"
-     layout="topleft"
-     left_pad="-5"
-     halign="left"
-     name="image_quality_level"
-     top_delta="0"
-     width="60">
-       ([QLVL])
-    </text>
+     right="-10">
+        <layout_panel
+         follows="top|left|right"
+         height="60"
+         layout="topleft"
+         left="0"
+         name="local_image_size_lp"
+         auto_resize="false"
+         top="0"
+         right="-1"
+         visible="true">
+            <spinner
+             allow_text_entry="false"
+             decimal_digits="0"
+             follows="left|top"
+             height="20"
+             increment="32"
+             label="Width"
+             label_width="40"
+             layout="topleft"
+             left="10"
+             max_val="6016"
+             min_val="32"
+             name="local_snapshot_width"
+             top_pad="10"
+             width="95" />
+            <spinner
+             allow_text_entry="false"
+             decimal_digits="0"
+             follows="left|top"
+             height="20"
+             increment="32"
+             label="Height"
+             label_width="40"
+             layout="topleft"
+             left_pad="5"
+             max_val="6016"
+             min_val="32"
+             name="local_snapshot_height"
+             top_delta="0"
+             width="95" />
+            <check_box
+             bottom_delta="20"
+             height="10"
+             follows="left|top"
+             label="Constrain proportions"
+             layout="topleft"
+             left="10"
+             name="local_keep_aspect_check" />
+        </layout_panel>
+        <layout_panel
+         follows="top|left|right"
+         height="23"
+         layout="topleft"
+         left="0"
+         name="local_image_format_quality_lp"
+         auto_resize="true"
+         top="0"
+         right="-1"
+         visible="true">
+            <combo_box
+             follows="left|top"
+             height="23"
+             label="Format"
+             layout="topleft"
+             left_delta="0"
+             name="local_format_combo"
+             top_pad="0"
+             width="120">
+                <combo_box.item
+                 label="PNG (Lossless)"
+                 name="PNG"
+                 value="PNG" />
+                <combo_box.item
+                 label="JPEG"
+                 name="JPEG"
+                 value="JPEG" />
+                <combo_box.item
+                 label="BMP (Lossless)"
+                 name="BMP"
+                 value="BMP" />
+            </combo_box>
+            <slider
+             decimal_digits="0"
+             follows="left|top"
+             height="15"
+             increment="1"
+             initial_value="75"
+             label="Image quality"
+             label_width="80"
+             layout="topleft"
+             left="10"
+             max_val="100"
+             name="image_quality_slider"
+             top_pad="7"
+             width="200" />
+            <text
+             type="string"
+             follows="left|top"
+             font="SansSerifSmall"
+             length="1"
+             height="14"
+             layout="topleft"
+             left_pad="-5"
+             halign="left"
+             name="image_quality_level"
+             top_delta="0"
+             width="60">
+               ([QLVL])
+            </text>
+        </layout_panel>
+    </layout_stack>
     <button
      follows="right|bottom"
      height="23"
      label="Cancel"
      layout="topleft"
      name="cancel_btn"
-     right="-10"
+     right="-32"
      top="350"
      width="100">
       <button.commit_callback
        function="Local.Cancel" />
     </button>
-    <button
+    <flyout_button
      follows="right|bottom"
      height="23"
      label="Save"
      layout="topleft"
      left_delta="-106"
      name="save_btn"
+     tool_tip="Save image to a file"
      top_delta="0"
      width="100">
-      <button.commit_callback
-       function="Local.Save" />
-    </button>
+        <flyout_button.item
+         label="Save"
+         name="save_item"
+         value="save" />
+        <flyout_button.item
+         label="Save As..."
+         name="saveas_item"
+         value="save as" />
+    </flyout_button>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_options.xml b/indra/newview/skins/default/xui/en/panel_snapshot_options.xml
index 792f6dbec8f032cd454a481b81cb55bf97ed61af..d2f29ade44c74911b534f3ced8309a54140ee112 100644
--- a/indra/newview/skins/default/xui/en/panel_snapshot_options.xml
+++ b/indra/newview/skins/default/xui/en/panel_snapshot_options.xml
@@ -81,68 +81,4 @@
     <button.commit_callback
      function="Snapshot.SaveToComputer" />
   </button>
-  <panel
-   background_visible="true"
-   bg_alpha_color="0.9 1 0.9 1"
-   bottom="-10"
-   follows="left|bottom|right"
-   font="SansSerifLarge"
-   halign="center"
-   height="20"
-   layout="topleft"
-   left_delta="0"
-   length="1"
-   name="succeeded_panel"
-   right="-10"
-   type="string"
-   visible="false">
-      <text
-       follows="all"
-       font="SansSerif"
-       halign="center"
-       height="18"
-       layout="topleft"
-       left="1"
-       length="1"
-       name="succeeded_lbl"
-       right="-1"
-       text_color="0.2 0.5 0.2 1"
-       top="4"
-       translate="false"
-       type="string">
-          Succeeded
-      </text>
-  </panel>
-  <panel
-   background_visible="true"
-   bg_alpha_color="1 0.9 0.9 1"
-   bottom="-10"
-   follows="left|bottom|right"
-   font="SansSerifLarge"
-   halign="center"
-   height="20"
-   layout="topleft"
-   left_delta="0"
-   length="1"
-   name="failed_panel"
-   right="-10"
-   type="string"
-   visible="false">
-      <text
-       follows="all"
-       font="SansSerif"
-       halign="center"
-       height="18"
-       layout="topleft"
-       left="1"
-       length="1"
-       name="failed_lbl"
-       right="-1"
-       text_color="0.5 0.2 0.2 1"
-       top="4"
-       translate="false"
-       type="string">
-          Failed
-      </text>
-  </panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_postcard.xml b/indra/newview/skins/default/xui/en/panel_snapshot_postcard.xml
index d8ff043444b4caf4e4ea2485ab4aeb2789a6360e..ebba292a935f0f1c6e906319690cdc5fd736b780 100644
--- a/indra/newview/skins/default/xui/en/panel_snapshot_postcard.xml
+++ b/indra/newview/skins/default/xui/en/panel_snapshot_postcard.xml
@@ -16,14 +16,6 @@
      name="upload_message">
         Sending...
     </string>
-    <string
-     name="default_subject">
-        Postcard from [SECOND_LIFE].
-    </string>
-    <string
-     name="default_message">
-        Check this out!
-    </string>
     <icon
      follows="top|left"
      height="18"
diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml b/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml
index 0760a33f82e0a49866e556eeb8b3c02fc786273a..0dd357aa1a747c9711c800ea5f45c9117ff32039 100644
--- a/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml
+++ b/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml
@@ -68,83 +68,117 @@
          name="Custom"
          value="[i-1,i-1]" />
     </combo_box>
-    <spinner
-     allow_text_entry="false"
-     decimal_digits="0"
-     follows="left|top"
-     height="20"
-     increment="32"
-     label="Width"
-     label_width="40"
-     layout="topleft"
-     left="10"
-     max_val="6016"
-     min_val="32"
-     name="profile_snapshot_width"
-     top_pad="10"
-     width="95" />
-    <spinner
-     allow_text_entry="false"
-     decimal_digits="0"
-     follows="left|top"
-     height="20"
-     increment="32"
-     label="Height"
-     label_width="40"
-     layout="topleft"
-     left_pad="5"
-     max_val="6016"
-     min_val="32"
-     name="profile_snapshot_height"
-     top_delta="0"
-     width="95" />
-    <check_box
-     bottom_delta="20"
-     label="Constrain proportions"
-     layout="topleft"
-     left="10"
-     name="profile_keep_aspect_check" />
-    <text
-     length="1"
-     follows="top|left|right"
-     font="SansSerif"
-     height="16"
-     layout="topleft"
-     left="12"
-     name="caption_label"
-     right="-10"
-     top_pad="10"
-     type="string">
-        Caption:
-    </text>
-    <text_editor
+    <layout_stack
+     animate="false"
      follows="all"
-     height="170"
-     layout="topleft"
-     left_delta="0"
-     length="1"
-     max_length="700"
-     name="caption"
-     right="-10"
-     top_pad="5"
-     type="string"
-     word_wrap="true">
-    </text_editor>
-    <check_box
-     follows="left|bottom"
-     initial_value="true"
-     label="Include location"
-     layout="topleft"
+     height="270"
+     layout="bottomleft"
+     name="profile_image_params_ls"
      left_delta="0"
-     name="add_location_cb"
-     top_pad="15" />
+     orientation="vertical"
+     top_pad="10"
+     right="-10">
+        <layout_panel
+         follows="top|left|right"
+         height="55"
+         layout="topleft"
+         left="0"
+         name="profile_image_size_lp"
+         auto_resize="false"
+         top="0"
+         right="-1"
+         visible="true">
+            <spinner
+             allow_text_entry="false"
+             decimal_digits="0"
+             follows="left|top"
+             height="20"
+             increment="32"
+             label="Width"
+             label_width="40"
+             layout="topleft"
+             left="10"
+             max_val="6016"
+             min_val="32"
+             name="profile_snapshot_width"
+             top_pad="10"
+             width="95" />
+            <spinner
+             allow_text_entry="false"
+             decimal_digits="0"
+             follows="left|top"
+             height="20"
+             increment="32"
+             label="Height"
+             label_width="40"
+             layout="topleft"
+             left_pad="5"
+             max_val="6016"
+             min_val="32"
+             name="profile_snapshot_height"
+             top_delta="0"
+             width="95" />
+            <check_box
+              height="10"
+             bottom_delta="20"
+             label="Constrain proportions"
+             layout="topleft"
+             left="10"
+             name="profile_keep_aspect_check" />
+        </layout_panel>
+        <layout_panel
+         follows="top|left|right"
+         height="200"
+         layout="topleft"
+         left="0"
+         name="profile_image_metadata_lp"
+         auto_resize="true"
+         top="0"
+         right="-1"
+         visible="true">
+            <text
+             length="1"
+             follows="top|left|right"
+             font="SansSerif"
+             height="16"
+             layout="topleft"
+             left="0"
+             name="caption_label"
+             right="-10"
+             top_pad="0"
+             type="string">
+                Caption:
+            </text>
+            <text_editor
+             follows="all"
+             height="155"
+             layout="topleft"
+             left_delta="0"
+             length="1"
+             max_length="700"
+             name="caption"
+             right="-10"
+             top_pad="5"
+             type="string"
+             word_wrap="true">
+            </text_editor>
+            <check_box
+             follows="left|bottom"
+             initial_value="true"
+             label="Include location"
+             layout="topleft"
+             left_delta="0"
+             name="add_location_cb"
+             top_pad="15" />
+        </layout_panel>
+    </layout_stack>
     <button
      follows="right|bottom"
      height="23"
      label="Cancel"
      layout="topleft"
      name="cancel_btn"
-     right="-10"
+     right="-32"
      top="350"
      width="100">
       <button.commit_callback
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 3239c4e531f56f3ad379b60e8a5f7157e119ea25..3aa34439f13210f1f1b51cd88d147bc29f3831b6 100644
--- a/indra/newview/skins/default/xui/en/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml
@@ -35,8 +35,8 @@
     </panel.string>
   <panel
     height="18"
-    left="-370"
-    width="160"
+    left="-395"
+    width="185"
     top="1"
     follows="right|top" 
     name="balance_bg">
@@ -67,10 +67,9 @@
      label_shadow="true"
      name="buyL"
      pad_right="0"
-     pad_bottom="2"
      tool_tip="Click to buy more L$"
      top="0"
-     width="55" />
+     width="80" />
     <button
      halign="left"
      font="SansSerifSmall"
@@ -87,8 +86,6 @@
      left_pad="0"
      label_shadow="true"
      name="goShop"
-     pad_right="0"
-     pad_bottom="2"
      tool_tip="Open Second Life Marketplace"
      top="0"
      width="65" />
diff --git a/indra/newview/skins/default/xui/en/panel_sys_well_item.xml b/indra/newview/skins/default/xui/en/panel_sys_well_item.xml
index 5e74689c5a26816a566f3231586ba37962261b98..007b73a4bc0de298013e7ba76f30c386833d325a 100644
--- a/indra/newview/skins/default/xui/en/panel_sys_well_item.xml
+++ b/indra/newview/skins/default/xui/en/panel_sys_well_item.xml
@@ -13,7 +13,7 @@
   follows="left|right"
   background_opaque="false"
   background_visible="true"
-  bg_alpha_color="0.0 0.0 0.0 0.0" >
+  bg_alpha_color="SysWellItemUnselected" >
   <text
     clip_partial="true" 
     top="2"
@@ -22,7 +22,7 @@
     height="28"
     layout="topleft"
     follows="right|left"
-    text_color="white"
+    text_color="White"
     use_ellipses="true"
     word_wrap="true"
     mouse_opaque="false"
diff --git a/indra/newview/skins/default/xui/en/panel_teleport_history_item.xml b/indra/newview/skins/default/xui/en/panel_teleport_history_item.xml
index c89e1dc215f05d7f9e4c870a16262c1806ef7829..c5b0be0616f78c70285898a93569d35471273ab9 100644
--- a/indra/newview/skins/default/xui/en/panel_teleport_history_item.xml
+++ b/indra/newview/skins/default/xui/en/panel_teleport_history_item.xml
@@ -44,7 +44,7 @@
      parse_urls="false"
      use_ellipses="true"
      name="region"
-     text_color="white"
+     text_color="White"
      top="4"
      value="..."
      width="330" />
diff --git a/indra/newview/skins/default/xui/en/panel_toast.xml b/indra/newview/skins/default/xui/en/panel_toast.xml
index b9e714dd30c4f803fda4215446d6bf2666905fd3..37a904bca81ac724d06613c70a9eef3f0846d6a1 100644
--- a/indra/newview/skins/default/xui/en/panel_toast.xml
+++ b/indra/newview/skins/default/xui/en/panel_toast.xml
@@ -10,7 +10,6 @@
 -->
 
 <floater
- open_positioning="none"
  legacy_header_height="0"
  header_height="0"
  name="toast"
@@ -21,7 +20,6 @@
  width="310"
  left="0"
  top="0"
- follows="right|bottom"
  background_visible="false"
  bg_opaque_image="Toast_Over"
  bg_alpha_image="Toast_Background"
@@ -60,7 +58,7 @@
    left="20"
    name="toast_text"
    word_wrap="true"
-   text_color="white"
+   text_color="White"
    top="5"
    translate="false"
    use_ellipses="true"
diff --git a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml
index 3c69a0cb6cc37d72adc25d1a0b9adee72fdf07b9..58911bed56224ef99e96d1375b1f48fc6b78fd29 100644
--- a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml
+++ b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml
@@ -20,7 +20,6 @@
                 mouse_opaque="false">
   <layout_panel name="vertical_toolbar_panel"
                 auto_resize="true"
-                user_resize="false"
                 width="1024"
                 height="500"
                 mouse_opaque="false">
@@ -34,7 +33,6 @@
                   mouse_opaque="false">
       <layout_panel name="left_toolbar_panel"
                     auto_resize="false"
-                    user_resize="false"
                     height="500"
                     width="30"
                     mouse_opaque="false">
@@ -61,7 +59,6 @@
       </layout_panel>
       <layout_panel name="non_toolbar_panel"
                     auto_resize="true"
-                    user_resize="false"
                     mouse_opaque="false"
                     height="100"
                     width="200">
@@ -102,7 +99,6 @@
       </layout_panel>
       <layout_panel name="right_toolbar_panel"
                     auto_resize="false"
-                    user_resize="false"
                     height="500"
                     width="30"
                     mouse_opaque="false">
@@ -132,7 +128,6 @@
   </layout_panel>
   <layout_panel name="bottom_toolbar_panel"
                 auto_resize="false"
-                user_resize="false"
                 height="30"
                 width="1024"
                 mouse_opaque="false">
diff --git a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml
index b52784d6bc44475bf38f8fd93b376faa3c576441..6ecb57b41d8da6bc45d16df29bc672080f1618ed 100644
--- a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml
+++ b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml
@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <panel
-	  background_visible="true"
 	  follows="all"
 	  height="570"
 	  label="Things"
@@ -30,11 +29,12 @@
               width="330">
              <layout_panel
                  name="main_inventory_layout_panel"
-								 layout="topleft"
+                 layout="topleft"
+                 auto_resize="true"
+                 user_resize="true"
                  min_dim="150"
                  width="330"
                  follows="bottom|left|right"
-                 user_resize="false"
                  height="300">
                  <panel
                       class="panel_main_inventory"
@@ -48,41 +48,18 @@
                       height="300"
                       width="330" />
              </layout_panel>
-					   <layout_panel
-                 width="330"
-								 layout="topleft"
-                 auto_resize="true"
-                 user_resize="false"
-                 follows="bottom|left|right"
-                 name="inbox_outbox_layout_panel"
-                 visible="false"
-                 min_dim="35"
-                 max_dim="235"
-                 expanded_min_dim="125"
-                 height="235">
-							 <layout_stack
-										follows="left|right|top|bottom"
-										layout="topleft"
-										left="0"
-										top="0"
-										orientation="vertical"
-										name="inbox_outbox_layout_stack"
-                    open_time_constant="0.02"
-                    close_time_constant="0.02"
-										height="235"
-										width="330">
-								 <layout_panel
+			 <layout_panel
                  width="330"
-								 layout="topleft"
-                 auto_resize="true"
-                 user_resize="false"
+                 layout="topleft"
+                 auto_resize="false"
+                 user_resize="true"
                  follows="left|right|top"
                  name="inbox_layout_panel"
                  visible="false"
                  min_dim="35"
-                 max_dim="200"
+                 max_dim="235"
                  expanded_min_dim="90"
-                 height="200">
+                 height="235">
                  <panel
                       follows="all"
                       layout="topleft"
@@ -91,13 +68,14 @@
                       class="panel_marketplace_inbox"
                       top="0"
                       label=""
-                      height="200"
+                      height="235"
                       width="330">
                      <string name="InboxLabelWithArg">Received items ([NUM])</string>
                      <string name="InboxLabelNoArg">Received items</string>
                      <button
+                        control_name="InventoryInboxToggleState"
                         label="Received items"
-												font="SansSerifMedium"
+						font="SansSerifMedium"
                         name="inbox_btn"
                         height="35"
                         width="308"
@@ -127,15 +105,16 @@
                         [NUM] new
                      </text>
                      <panel
+                        name="inbox_inventory_placeholder_panel"
                         follows="all"
                         left="10"
-                        bottom="200"
+                        bottom="235"
                         width="308"
                         top="35"
                         bg_opaque_color="InventoryBackgroundColor"
                         background_visible="true"
                         background_opaque="true"
-                        tool_tip="Drag and drop items to your inventory to manage and use them"
+                        tool_tip="Drag and drop items to your inventory to use them"
                         >
                         <text
 							name="inbox_inventory_placeholder"
@@ -145,7 +124,7 @@
 							top="0"
 							left="0"
 							width="308"
-							height="165"
+							height="200"
 							wrap="true"
 							halign="center">
 							Purchases from the marketplace will be delivered here.
@@ -153,139 +132,6 @@
                     </panel>
                  </panel>
              </layout_panel>
-             <layout_panel
-                 width="330"
-                 layout="topleft"
-                 auto_resize="true"
-                 user_resize="false"
-                 follows="all"
-                 name="outbox_layout_panel"
-                 visible="false"
-                 min_dim="35"
-                 max_dim="200"
-                 expanded_min_dim="90"
-                 height="200">
-                 <panel
-                      follows="all"
-                      layout="topleft"
-                      left="0"
-                      name="marketplace_outbox"
-                      class="panel_marketplace_outbox"
-                      top="0"
-                      label=""
-                      height="200"
-                      width="330">
-                     <string name="OutboxLabelWithArg">Merchant outbox ([NUM])</string>
-                     <string name="OutboxLabelNoArg">Merchant outbox</string>
-                     <button
-                        label="Merchant outbox"
-                        font="SansSerifMedium"
-                        name="outbox_btn"
-                        height="35"
-                        width="308"
-                        image_unselected="MarketplaceBtn_Off"
-                        image_selected="MarketplaceBtn_Selected"
-                        halign="left"
-                        handle_right_mouse="false"
-                        follows="top|left|right"
-                        is_toggle="true"
-                        tab_stop="false"
-                        pad_left="35"
-                        top="0"
-                        left="10" />
-                     <button
-                         image_unselected="OutboxPush_Off"
-                         image_selected="OutboxPush_Selected"
-                         image_hover_selected="OutboxPush_Selected_Over"
-                         image_hover_unselected="OutboxPush_Over"
-                         image_disabled_selected="OutboxPush_Selected_Disabled"
-                         image_disabled="OutboxPush_Disabled"
-                         image_pressed="OutboxPush_Press"
-                         image_pressed_selected="OutboxPush_Selected_Press"
-                         label=""
-                         tool_tip="Push to my Marketplace Storefront"
-                         is_toggle="false"
-                         name="outbox_sync_btn"
-                         follows="top|right"
-                         tab_stop="false"
-                         halign="center"
-                         top="6"
-                         left="-50"
-                         height="23"
-                         width="32"
-                         enabled="false" />
-                     <loading_indicator
-                        follows="top|right"
-                        name="outbox_sync_indicator"
-                        top="6"
-                        left="-50"
-                        height="23"
-                        width="32"
-                        images_per_sec="1.15"
-                        tab_stop="false"
-                        visible="false">
-                         <images>
-                             <image name="OutboxPush_Progress_1"/>
-                             <image name="OutboxPush_Progress_2"/>
-                             <image name="OutboxPush_Progress_3"/>
-                             <image name="OutboxPush_Progress_4"/>
-                             <image name="OutboxPush_Progress_5"/>
-                             <image name="OutboxPush_Progress_6"/>
-                         </images>
-                     </loading_indicator>
-                     <panel
-                        follows="all"
-                        left="10"
-                        bottom="200"
-                        width="308"
-                        top="35"
-                        bg_opaque_color="InventoryBackgroundColor"
-                        background_visible="true"
-                        background_opaque="true"
-                        >
-						<panel
-							name="outbox_inventory_placeholder_panel"
-							follows="all"
-							layout="topleft"
-							top="0"
-							left="0"
-							width="308"
-							height="165"
-							bg_opaque_color="InventoryBackgroundColor"
-							background_visible="true"
-							background_opaque="true"
-							>
-							<text
-								name="outbox_inventory_placeholder_title"
-								type="string"
-								follows="all"
-								layout="topleft"
-								top="10"
-								left="0"
-								width="308"
-								height="25"
-								wrap="true"
-								halign="center"
-								font="SansSerifBold">
-								Loading...
-							</text>
-							<text
-								name="outbox_inventory_placeholder_text"
-								type="string"
-								follows="all"
-								layout="topleft"
-								top="35"
-								left="0"
-								width="308"
-								height="130"
-								wrap="true"
-								halign="left" />
-						</panel>
-                    </panel>
-                 </panel>
-             </layout_panel>
-						 </layout_stack>
-						 </layout_panel>
          </layout_stack>
 		<panel
 		     follows="bottom|left|right"
@@ -312,7 +158,6 @@
                      left="0"			
                      mouse_opaque="false"
                      name="info_btn_lp"
-                     user_resize="false" 
                      auto_resize="true"
                      width="101">
                     <button
@@ -334,7 +179,6 @@
                      left_pad="1"			
                      mouse_opaque="false"
                      name="share_btn_lp"
-                     user_resize="false" 
                      auto_resize="true"
                      width="100">
                     <button
@@ -356,7 +200,6 @@
                      left_pad="1"			
                      mouse_opaque="false"
                      name="shop_btn_lp"
-                     user_resize="false" 
                      auto_resize="true"
                      width="100">
                     <button
@@ -406,8 +249,7 @@
 			</layout_stack>
 		</panel>
 	</panel>
-
-<panel
+	<panel
 		 follows="all"
 		 layout="topleft"
 		 left="0"
@@ -420,8 +262,7 @@
 		 visible="false"
 		 width="330">
 	</panel>
-
-<panel
+	<panel
 		 follows="all"
 		 layout="topleft"
 		 left="0"
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index befcc5dd87a40cb9b411b4ef8151bb2ce448de79..4ccec4838ac00a6bdf57cd01fee2d23cb5e5a251 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -18,7 +18,7 @@
 	<string name="StartupClearingCache">Clearing cache...</string>
 	<string name="StartupInitializingTextureCache">Initializing texture cache...</string>
 	<string name="StartupInitializingVFS">Initializing VFS...</string>
-  <string name="StartupRequireDriverUpdate">Graphics initialization failed. Please update your graphics driver!</string>
+	<string name="StartupRequireDriverUpdate">Graphics initialization failed. Please update your graphics driver!</string>
 
 	<!--  progress -->
 	<string name="ProgressRestoring">Restoring...</string>
@@ -35,9 +35,9 @@
 	<string name="LoginAttempt">Previous login attempt failed. Logging in, attempt [NUMBER]</string>
 	<string name="LoginPrecaching">Loading world...</string>
 	<string name="LoginInitializingBrowser">Initializing embedded web browser...</string>
-  <string name="LoginInitializingMultimedia">Initializing multimedia...</string>
-  <string name="LoginInitializingFonts">Loading fonts...</string>
-  <string name="LoginVerifyingCache">Verifying cache files (can take 60-90 seconds)...</string>
+	<string name="LoginInitializingMultimedia">Initializing multimedia...</string>
+	<string name="LoginInitializingFonts">Loading fonts...</string>
+	<string name="LoginVerifyingCache">Verifying cache files (can take 60-90 seconds)...</string>
 	<string name="LoginProcessingResponse">Processing response...</string>
 	<string name="LoginInitializingWorld">Initializing world...</string>
 	<string name="LoginDecodingImages">Decoding images...</string>
@@ -49,12 +49,12 @@
 	<string name="LoginWaitingForRegionHandshake">Waiting for region handshake...</string>
 	<string name="LoginConnectingToRegion">Connecting to region...</string>
 	<string name="LoginDownloadingClothing">Downloading clothing...</string>
-        <string name="InvalidCertificate">The server returned an invalid or corrupt certificate. Please contact the Grid administrator.</string>
-        <string name="CertInvalidHostname">An invalid hostname was used to access the server, please check your SLURL or Grid hostname.</string>
-        <string name="CertExpired">The certificate returned by the Grid appears to be expired.  Please check your system clock, or contact your Grid administrator.</string>
-        <string name="CertKeyUsage">The certificate returned by the server could not be used for SSL.  Please contact your Grid administrator.</string>
-        <string name="CertBasicConstraints">Too many certificates were in the servers Certificate chain.  Please contact your Grid administrator.</string>
-        <string name="CertInvalidSignature">The certificate signature returned by the Grid server could not be verified.  Please contact your Grid administrator.</string>
+	<string name="InvalidCertificate">The server returned an invalid or corrupt certificate. Please contact the Grid administrator.</string>
+	<string name="CertInvalidHostname">An invalid hostname was used to access the server, please check your SLURL or Grid hostname.</string>
+	<string name="CertExpired">The certificate returned by the Grid appears to be expired.  Please check your system clock, or contact your Grid administrator.</string>
+	<string name="CertKeyUsage">The certificate returned by the server could not be used for SSL.  Please contact your Grid administrator.</string>
+	<string name="CertBasicConstraints">Too many certificates were in the servers Certificate chain.  Please contact your Grid administrator.</string>
+	<string name="CertInvalidSignature">The certificate signature returned by the Grid server could not be verified.  Please contact your Grid administrator.</string>
 
 	<string name="LoginFailedNoNetwork">Network error: Could not establish connection, please check your network connection.</string>
 	<string name="LoginFailed">Login failed.</string>
@@ -88,7 +88,7 @@ We are very sorry for the inconvenience.</string>
 Logins are currently restricted to employees only.
 Check www.secondlife.com/status for updates.</string>
 	<string name="LoginFailedPremiumOnly">Second Life logins are temporarily restricted in order to make sure that those in-world have the best possible experience.
-	 	
+
 People with free accounts will not be able to access Second Life during this time, to make room for those who have paid for Second Life.</string>
 	<string name="LoginFailedComputerProhibited">Second Life cannot be accessed from this computer.
 If you feel this is an error, please contact
@@ -164,10 +164,18 @@ Please try logging in again in a minute.</string>
 	<string name="TooltipLand">Land:</string>
 	<string name="TooltipMustSingleDrop">Only a single item can be dragged here</string>
 	<string name="TooltipPrice" value="L$[AMOUNT]: "/>
-	<string name="TooltipOutboxNoTransfer">One or more of these objects cannot be sold or transferred to another user.</string>
-	<string name="TooltipOutboxWorn">You are wearing one or more of these objects. Remove them from your avatar and try moving them again.</string>
-	<string name="TooltipOutboxFolderLevels">This folder has too many levels of subfolders. Rearrange the interior folders to a maximum of 4 levels deep (Root Folder contains A contains B contains C).</string>
-	<string name="TooltipOutboxTooManyObjects">This folder contains more than 200 objects. Box some of the items to reduce the object count.</string>
+
+	<string name="TooltipOutboxDragToWorld">You can not rez items in your merchant outbox</string>
+	<string name="TooltipOutboxNoTransfer">One or more of these objects cannot be sold or transferred.</string>
+	<string name="TooltipOutboxNotInInventory">Your merchant outbox can only accept items directly from your inventory</string>
+	<string name="TooltipOutboxWorn">You can not put items you are wearing into your merchant outbox</string>
+	<string name="TooltipOutboxCallingCard">You can not put calling cards into your merchant outbox</string>
+	<string name="TooltipOutboxFolderLevels">Depth of nested folders exceeds 3</string>
+	<string name="TooltipOutboxTooManyFolders">Subfolder count in top-level folder exceeds 20</string>
+	<string name="TooltipOutboxTooManyObjects">Item count in top-level folder exceeds 200</string>
+	
+	<string name="TooltipDragOntoOwnChild">You can't move a folder into its child</string>
+	<string name="TooltipDragOntoSelf">You can't move a folder into itself</string>
 	
 	<!-- tooltips for Urls -->
 	<string name="TooltipHttpUrl">Click to view this web page</string>
@@ -188,7 +196,7 @@ Please try logging in again in a minute.</string>
 	<string name="TooltipObjectIMUrl">Click to view this object's description</string>
 	<string name="TooltipMapUrl">Click to view this location on a map</string>
 	<string name="TooltipSLAPP">Click to run the secondlife:// command</string>
-	<string name="CurrentURL" value=" CurrentURL: [CurrentURL]" />	
+	<string name="CurrentURL" value=" CurrentURL: [CurrentURL]" />
 
 	<!-- text for SLURL labels -->
 	<string name="SLurlLabelTeleport">Teleport to</string>
@@ -361,6 +369,9 @@ Please try logging in again in a minute.</string>
 	<string name="anim_yes_happy">Yes (Happy)</string>
 	<string name="anim_yes_head">Yes</string>
 
+	<!-- build floater -->
+	<string name="multiple_textures">Multiple</string>
+
 	<!-- world map -->
 	<string name="texture_loading">Loading...</string>
 	<string name="worldmap_offline">Offline</string>
@@ -392,8 +403,9 @@ Please try logging in again in a minute.</string>
 	<string name="AddAndRemoveJoints">Add and remove joints with other objects</string>
 	<string name="ChangePermissions">Change its permissions</string>
 	<string name="TrackYourCamera">Track your camera</string>
-	<string name="ControlYourCamera">Control your camera</string>
-	<string name="NotConnected">Not Connected</string>
+  <string name="ControlYourCamera">Control your camera</string>
+  <string name="TeleportYourAgent">Teleport you</string>
+  <string name="NotConnected">Not Connected</string>
 
 	<!-- Sim Access labels -->
 	<string name="SIM_ACCESS_PG">General</string>
@@ -427,9 +439,10 @@ Please try logging in again in a minute.</string>
 	<string name="compressed_image_files">Compressed Images</string>
 	<string name="load_files">Load Files</string>
 	<string name="choose_the_directory">Choose Directory</string>
+	<string name="script_files">Scripts</string>
 
-	<!-- LSL Usage Hover Tips -->
-	<!-- NOTE: For now these are set as translate="false", until DEV-40761 is implemented (to internationalize the rest of tooltips in the same window).
+  <!-- LSL Usage Hover Tips -->
+  <!-- NOTE: For now these are set as translate="false", until DEV-40761 is implemented (to internationalize the rest of tooltips in the same window).
              This has no effect on viewer code, but prevents Linden Lab internal localization tool from scraping these strings.  -->
 	<string name="LSLTipSleepTime" translate="false">
 Sleeps script for [SLEEP_TIME] seconds.
@@ -1950,7 +1963,7 @@ Returns a string with the requested data about the region
   <string name="physics">Physics</string>
   <string name="invalid">invalid</string>
   <string name="none">none</string>
-  
+
   <!-- Not Worn Wearable Types -->
 	<string name="shirt_not_worn">Shirt not worn</string>
 	<string name="pants_not_worn">Pants not worn</string>
@@ -1987,7 +2000,7 @@ Returns a string with the requested data about the region
 
   <!-- Wearable List-->
   <string name="NewWearable">New [WEARABLE_ITEM]</string>
-  
+
 	<!-- LLGroupNotify -->
 	<!-- used in the construction of a Group Notice blue dialog box, buttons, tooltip etc. Seems to be no longer utilized by code in Viewer 2.0 -->
 	<string name="next">Next</string>
@@ -2028,24 +2041,28 @@ Returns a string with the requested data about the region
 	<string name="PlacesNoMatchingItems">Didn't find what you're looking for? Try [secondlife:///app/search/places/[SEARCH_TERM] Search].</string>
 	<string name="FavoritesNoMatchingItems">Drag a landmark here to add it to your favorites.</string>
 	<string name="InventoryNoTexture">You do not have a copy of this texture in your inventory</string>
-	<string name="InventoryInboxNoItems">When you purchase or otherwise receive an item, it will appear here so you can drag it to a folder in your inventory, or delete it if you do not wish to keep it.</string>
-	<string name="MarketplaceURL">http://marketplace.[DOMAIN_NAME]</string>
-	<string name="MarketplaceURL_CreateStore">http://marketplace.[DOMAIN_NAME]/create_store</string>
-	<string name="MarketplaceURL_LearnMore">http://marketplace.[DOMAIN_NAME]/learn_more</string>
-	<string name="InventoryOutboxCreationErrorTitle">Your Merchant Outbox is not properly configured</string>
-	<string name="InventoryOutboxCreationErrorTooltip">Merchant Outbox configuration error</string>
-	<string name="InventoryOutboxCreationError">Please contact Customer Service to correct the problem.</string>
-	<string name="InventoryOutboxNotMerchantTitle">Anyone can sell items on the Marketplace</string>
-	<string name="InventoryOutboxNotMerchantTooltip">Become a merchant!</string>
-	<string name="InventoryOutboxNotMerchant">[[MARKETPLACE_URL] The Second Life Marketplace] offers more than one million virtual products for sale, all of them created by Residents. You, too, can sell items you create, as well as some of the items you have purchased. It’s easy and setup is free.  [[LEARN_MORE_URL] Learn more] or [[CREATE_STORE_URL] create a store] on the Marketplace to get started.</string>
-	<string name="InventoryOutboxNoItemsTitle">A new way to send items to the Marketplace</string>
-	<string name="InventoryOutboxNoItemsTooltip">Drag and drop items here to prepare them for sale on the Marketplace</string>
-	<string name="InventoryOutboxNoItems">Drag items or folders that you wish to sell into this area.  A copy of the item will appear, leaving your inventory unchanged, unless you have dragged a no-copy item.  When you are ready to send the items to the Marketplace, click the Upload button. Once your items have been moved to your Marketplace Inventory, they will disappear from this folder.</string>
+	<string name="InventoryInboxNoItems">Your Marketplace purchases will appear here. You may then drag them into your inventory to use them.</string>
+	<string name="MarketplaceURL">https://marketplace.[MARKETPLACE_DOMAIN_NAME]/</string>
+	<string name="MarketplaceURL_CreateStore">http://community.secondlife.com/t5/English-Knowledge-Base/Selling-in-the-Marketplace/ta-p/700193#Section_.4</string>
+	<string name="MarketplaceURL_Dashboard">https://marketplace.[MARKETPLACE_DOMAIN_NAME]/merchants/store/dashboard</string>
+	<string name="MarketplaceURL_Imports">https://marketplace.[MARKETPLACE_DOMAIN_NAME]/merchants/store/imports</string>
+	<string name="MarketplaceURL_LearnMore">https://marketplace.[MARKETPLACE_DOMAIN_NAME]/learn_more</string>
+	<string name="InventoryOutboxNotMerchantTitle">Anyone can sell items on the Marketplace.</string>
+	<string name="InventoryOutboxNotMerchantTooltip"></string>
+	<string name="InventoryOutboxNotMerchant">
+If you'd like to become a merchant, you'll need to [[MARKETPLACE_CREATE_STORE_URL] create a Marketplace store].
+	</string>
+	<string name="InventoryOutboxNoItemsTitle">Your outbox is empty.</string>
+	<string name="InventoryOutboxNoItemsTooltip"></string>
+	<string name="InventoryOutboxNoItems">
+Drag folders to this area and click "Send to Marketplace" to list them for sale on the [[MARKETPLACE_DASHBOARD_URL] Marketplace].
+	</string>
 
 	<string name="Marketplace Error None">No errors</string>
 	<string name="Marketplace Error Not Merchant">Error: Before sending items to the Marketplace you will need to set yourself up as a merchant (free of charge).</string>
 	<string name="Marketplace Error Empty Folder">Error: This folder has no contents.</string>
-	<string name="Marketplace Error Unassociated Products">Error: This item failed to upload because your merchant account has too many items unassociated with products.  To fix this error, login to the marketplace website and reduce your unassociated item count.</string>
+	<string name="Marketplace Error Unassociated Products">Error: This item failed to upload because your merchant account has too many items unassociated with products.  To fix this error, log in to the marketplace website and reduce your unassociated item count.</string>
+
 	<string name="Marketplace Error Object Limit">Error: This item contains too many objects.  Fix this error by placing objects together in boxes to reduce the total count to less than 200.</string>
 	<string name="Marketplace Error Folder Depth">Error: This item contains too many levels of nested folders.  Reorganize it to a maximum of 3 levels of nested folders.</string>
 	<string name="Marketplace Error Unsellable Item">Error: This item can not be sold on the marketplace.</string>
@@ -2133,6 +2150,7 @@ Returns a string with the requested data about the region
 	<string name="InvFolder All">All</string>
 
 	<string name="no_attachments">No attachments worn</string>
+    <string name="Attachments remain">Attachments ([COUNT] slots remain)</string>
 
 	<!-- inventory FVBridge -->
 	<!--  This is used in llpanelinventory.cpp when constructing a context menu for an item for Sale  -->
@@ -2313,7 +2331,7 @@ Returns a string with the requested data about the region
 	<string name="ScriptLimitsRequestWrongRegion">Error: script information is only available in your current region</string>
 	<string name="ScriptLimitsRequestWaiting">Retrieving information...</string>
 	<string name="ScriptLimitsRequestDontOwnParcel">You do not have permission to examine this parcel</string>
-	
+
 	<string name="SITTING_ON">Sitting On</string>
 	<string name="ATTACH_CHEST">Chest</string>
 	<string name="ATTACH_HEAD">Head</string>
@@ -2353,7 +2371,7 @@ Returns a string with the requested data about the region
 	<string name="ATTACH_HUD_BOTTOM_LEFT">HUD Bottom Left</string>
 	<string name="ATTACH_HUD_BOTTOM">HUD Bottom</string>
 	<string name="ATTACH_HUD_BOTTOM_RIGHT">HUD Bottom Right</string>
-			
+
 	<!-- script editor -->
 	<string name="CursorPos">Line [LINE], Column [COLUMN]</string>
 
@@ -2366,7 +2384,7 @@ Returns a string with the requested data about the region
 
 	<!-- panel contents -->
 	<string name="PanelContentsTooltip">Content of object</string>
-	<string name="PanelContentsNewScript">New Script</string>	
+	<string name="PanelContentsNewScript">New Script</string>
 
   <!-- panel preferences general -->
   <string name="BusyModeResponseDefault">The Resident you messaged is in &apos;busy mode&apos; which means they have requested not to be disturbed.  Your message will still be shown in their IM panel for later viewing.</string>
@@ -2396,7 +2414,7 @@ Returns a string with the requested data about the region
 	<!-- panel classified -->
 	<string name="ClassifiedClicksTxt">Clicks: [TELEPORT] teleport, [MAP] map, [PROFILE] profile</string>
 	<string name="ClassifiedUpdateAfterPublish">(will update after publish)</string>
-  
+
   <!-- panel picks -->
   <string name="NoPicksClassifiedsText">You haven't created any Picks or Classifieds. Click the Plus button below to create a Pick or Classified.</string>
   <string name="NoAvatarPicksClassifiedsText">User has no picks or classifieds</string>
@@ -3224,6 +3242,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 	<string name="IM_to_label">To</string>
 	<string name="IM_moderator_label">(Moderator)</string>
 	<string name="Saved_message">(Saved [LONG_TIMESTAMP])</string>
+	<string name="IM_unblock_only_groups_friends">To see this message, you must uncheck &apos;Only friends and groups can call or IM me&apos; in Preferences/Privacy.</string>
 
 	<!-- voice calls -->
 	<string name="answered_call">Your call has been answered</string>
@@ -3273,7 +3292,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
     You have blocked this Resident. Sending a message will automatically unblock them.
   </string>
   <!--Some times string name is getting from the body of server response.
-  For ex.: from gIMMgr::showSessionStartError in the LLViewerChatterBoxSessionStartReply::post. 
+  For ex.: from gIMMgr::showSessionStartError in the LLViewerChatterBoxSessionStartReply::post.
   In case of the EXT-3115 issue 'generic' is passed into the gIMMgr::showSessionStartError as a string name.
   Also there are some other places where "generic" is used.
   So, let add string with name="generic" with the same value as "generic_request_error" -->
@@ -3299,7 +3318,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
     You are not a session moderator.
   </string>
   <!--Some times string name is getting from the body of server response.
-  For ex.: from gIMMgr::showSessionStartError in the LLViewerChatterBoxSessionStartReply::post. 
+  For ex.: from gIMMgr::showSessionStartError in the LLViewerChatterBoxSessionStartReply::post.
   In case of the EXT-3562 issue 'muted' is passed into the gIMMgr::showSessionStartError as a string name.
   So, let add string with name="muted" with the same value as "muted_error" -->
   <string name="muted">
@@ -3312,12 +3331,12 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
     Unable to add users to chat session with [RECIPIENT].
   </string>
   <!--Some times string name is getting from the body of server response.
-  For ex.: from gIMMgr::showSessionStartError in the LLViewerChatterBoxSessionStartReply::post. 
+  For ex.: from gIMMgr::showSessionStartError in the LLViewerChatterBoxSessionStartReply::post.
   In case of the EXT-3562 issue 'message' is passed into the gIMMgr::showSessionStartError as a string name.
   So, let add string with name="message" with the same value as "message_session_event" -->
   <string name="message">
     Unable to send your message to the chat session with [RECIPIENT].
-  </string>  
+  </string>
   <string name="message_session_event">
     Unable to send your message to the chat session with [RECIPIENT].
   </string>
@@ -3325,7 +3344,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
     Error while moderating.
   </string>
   <!--Some times string name is getting from the body of server response.
-  For ex.: from gIMMgr::showSessionStartError in the LLViewerChatterBoxSessionStartReply::post. 
+  For ex.: from gIMMgr::showSessionStartError in the LLViewerChatterBoxSessionStartReply::post.
   In case of the EXT-3459 issue 'removed' is passed into the gIMMgr::showSessionStartError as a string name.
   So, let add string with name="removed" with the same value as "removed_from_group" -->
   <string name="removed">
@@ -3346,9 +3365,9 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 	<string name="session_initialization_timed_out_error">
 		The session initialization is timed out
 	</string>
-  
+
   <string name="Home position set.">Home position set.</string>
-  
+
   <string name="voice_morphing_url">http://secondlife.com/landing/voicemorphing</string>
 
   <!-- Financial operations strings -->
@@ -3358,6 +3377,10 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
   <string name="you_paid_ldollars_no_info">You paid L$[AMOUNT].</string>
   <string name="you_paid_ldollars_no_reason">You paid [NAME] L$[AMOUNT].</string>
   <string name="you_paid_ldollars_no_name">You paid L$[AMOUNT] [REASON].</string>
+  <string name="you_paid_failure_ldollars">You failed to pay [NAME] L$[AMOUNT] [REASON].</string>
+  <string name="you_paid_failure_ldollars_no_info">You failed to pay L$[AMOUNT].</string>
+  <string name="you_paid_failure_ldollars_no_reason">You failed to pay [NAME] L$[AMOUNT].</string>
+  <string name="you_paid_failure_ldollars_no_name">You failed to pay L$[AMOUNT] [REASON].</string>
   <string name="for item">for [ITEM]</string>
   <string name="for a parcel of land">for a parcel of land</string>
   <string name="for a land access pass">for a land access pass</string>
@@ -3366,20 +3389,20 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
   <string name="to join a group">to join a group</string>
   <string name="to upload">to upload</string>
   <string name="to publish a classified ad">to publish a classified ad</string>
-  
+
   <string name="giving">Giving L$ [AMOUNT]</string>
   <string name="uploading_costs">Uploading costs L$ [AMOUNT]</string>
   <string name="this_costs">This costs L$ [AMOUNT]</string>
   <string name="buying_selected_land">Buying selected land for L$ [AMOUNT]</string>
   <string name="this_object_costs">This object costs L$ [AMOUNT]</string>
-  
+
   <string name="group_role_everyone">Everyone</string>
   <string name="group_role_officers">Officers</string>
   <string name="group_role_owners">Owners</string>
   <string name="group_member_status_online">Online</string>
 
   <string name="uploading_abuse_report">Uploading...
-  
+
 Abuse Report</string>
 
   <!-- names for new inventory items-->
@@ -3473,23 +3496,23 @@ Abuse Report</string>
 
   <!-- birth date format shared by avatar inspector and profile panels -->
   <string name="AvatarBirthDateFormat">[mthnum,datetime,slt]/[day,datetime,slt]/[year,datetime,slt]</string>
-  
+
   <string name="DefaultMimeType">none/none</string>
   <string name="texture_load_dimensions_error">Can't load images larger than [WIDTH]*[HEIGHT]</string>
 
   <!-- language specific white-space characters, delimiters, spacers, item separation symbols -->
   <string name="sentences_separator" value=" "></string>
   <string name="words_separator" value=", "/>
-  
+
   <string name="server_is_down">
 	Despite our best efforts, something unexpected has gone wrong.
 
-	Please check status.secondlifegrid.net to see if there is a known problem with the service.  
+	Please check status.secondlifegrid.net to see if there is a known problem with the service.
         If you continue to experience problems, please check your network and firewall setup.
   </string>
 
-  <!-- overriding datetime formating. 
-	didn't translate if this is not needed for current localization 
+  <!-- overriding datetime formating.
+	didn't translate if this is not needed for current localization
   -->
   <string name="dateTimeWeekdaysNames">Sunday:Monday:Tuesday:Wednesday:Thursday:Friday:Saturday</string>
   <string name="dateTimeWeekdaysShortNames">Sun:Mon:Tue:Wed:Thu:Fri:Sat</string>
@@ -3522,7 +3545,7 @@ Abuse Report</string>
   <string name="DeleteItem">Delete selected item?</string>
 
   <string name="EmptyOutfitText">There are no items in this outfit</string>
- 
+
  <!-- External editor status codes -->
  <string name="ExternalEditorNotSet">Select an editor using the ExternalEditor setting.</string>
  <string name="ExternalEditorNotFound">Cannot find the external editor you specified.
@@ -3674,7 +3697,8 @@ Try enclosing path to the editor with double quotes.
   <string name="Command_Map_Label">Map</string>
   <string name="Command_Marketplace_Label">Marketplace</string>
   <string name="Command_MiniMap_Label">Mini-map</string>
-  <string name="Command_Move_Label">Move</string>
+  <string name="Command_Move_Label">Walk / run / fly</string>
+  <string name="Command_Outbox_Label">Merchant outbox</string>
   <string name="Command_People_Label">People</string>
   <string name="Command_Picks_Label">Picks</string>
   <string name="Command_Places_Label">Places</string>
@@ -3683,7 +3707,7 @@ Try enclosing path to the editor with double quotes.
   <string name="Command_Search_Label">Search</string>
   <string name="Command_Snapshot_Label">Snapshot</string>
   <string name="Command_Speak_Label">Speak</string>
-  <string name="Command_View_Label">View</string>
+  <string name="Command_View_Label">Camera controls</string>
   <string name="Command_Voice_Label">Voice settings</string>
 
   <string name="Command_AboutLand_Tooltip">Information about the land you're visiting</string>
@@ -3700,6 +3724,7 @@ Try enclosing path to the editor with double quotes.
   <string name="Command_Marketplace_Tooltip">Go shopping</string>
   <string name="Command_MiniMap_Tooltip">Show nearby people</string>
   <string name="Command_Move_Tooltip">Moving your avatar</string>
+  <string name="Command_Outbox_Tooltip">Transfer items to your marketplace for sale</string>
   <string name="Command_People_Tooltip">Friends, groups, and nearby people</string>
   <string name="Command_Picks_Tooltip">Places to show as favorites in your profile</string>
   <string name="Command_Places_Tooltip">Places you've saved</string>
diff --git a/indra/newview/skins/default/xui/en/widgets/avatar_list_item.xml b/indra/newview/skins/default/xui/en/widgets/avatar_list_item.xml
index 1bb3188cc8aee74c2a02b87b84541b6683712323..8a4ccb19f9deb576d45be15af72c4c6fc6fdd2b5 100644
--- a/indra/newview/skins/default/xui/en/widgets/avatar_list_item.xml
+++ b/indra/newview/skins/default/xui/en/widgets/avatar_list_item.xml
@@ -17,13 +17,13 @@
   <voice_call_invited_style
    font="SansSerifSmall"
    font.style="NORMAL"
-   color="0.5 0.5 0.5 0.5"/>
+   color="AvatarListItemIconVoiceInvitedColor"/>
 
   <!-- styles for avatar item JOINED to voice call -->
   <voice_call_joined_style
    font="SansSerifSmall"
    font.style="NORMAL"
-   color="white"/>
+   color="White"/>
 
   <!-- styles for avatar item which HAS LEFT voice call -->
   <voice_call_left_style
@@ -35,11 +35,11 @@
   <online_style
    font="SansSerifSmall"
    font.style="NORMAL"
-   color="white"/>
+   color="White"/>
 
   <!-- styles for OFFLINE avatar item -->
   <offline_style
    font="SansSerifSmall"
    font.style="NORMAL"
-   color="0.5 0.5 0.5 1.0"/>
+   color="Gray"/>
 </avatar_list_item>
diff --git a/indra/newview/skins/default/xui/en/widgets/bodyparts_list_item.xml b/indra/newview/skins/default/xui/en/widgets/bodyparts_list_item.xml
index 0eec002006d53c9465b04973c7de7acc72d0b2e7..0016a8cf53cee8f8a66e056b02576de9345e829d 100644
--- a/indra/newview/skins/default/xui/en/widgets/bodyparts_list_item.xml
+++ b/indra/newview/skins/default/xui/en/widgets/bodyparts_list_item.xml
@@ -24,7 +24,7 @@
    parse_urls="false"
    use_ellipses="true"
    name="item_name"
-   text_color="white"
+   text_color="White"
    top="5"
    value="..."
    width="359" />
diff --git a/indra/newview/skins/default/xui/en/widgets/button.xml b/indra/newview/skins/default/xui/en/widgets/button.xml
index e2baba92a3a45051a6f2c03eba8ea9050e4c2c6e..2b2c3faf917e8ad4acc59aa0c6dbfedbbe6892c8 100644
--- a/indra/newview/skins/default/xui/en/widgets/button.xml
+++ b/indra/newview/skins/default/xui/en/widgets/button.xml
@@ -21,7 +21,7 @@
         font="SansSerifSmall"
         hover_glow_amount="0.15"
         halign="center"
-        pad_bottom="3" 
+        pad_bottom="1"
         height="23"
         scale_image="true"
         handle_right_mouse="true"
diff --git a/indra/newview/skins/default/xui/en/widgets/check_box.xml b/indra/newview/skins/default/xui/en/widgets/check_box.xml
index cca64fad2a735a33c82163f2f6d967d451b7801e..8947024e458e05959268cf36937df1729ac3e9bc 100644
--- a/indra/newview/skins/default/xui/en/widgets/check_box.xml
+++ b/indra/newview/skins/default/xui/en/widgets/check_box.xml
@@ -10,7 +10,7 @@
                         text_readonly_color="LabelDisabledColor"/>
   <check_box.check_button name="CheckboxCtrl Button"
                           left="2"
-                          bottom="2"
+                          bottom="1"
                           width="13"
                           height="13" 
                           commit_on_return="false"
diff --git a/indra/newview/skins/default/xui/en/widgets/clothing_list_item.xml b/indra/newview/skins/default/xui/en/widgets/clothing_list_item.xml
index 96d72c78a65561e33c2897805b9dc17e55a2c24e..d83f44737ecca46add346afbc78fb7e80f94c3bb 100644
--- a/indra/newview/skins/default/xui/en/widgets/clothing_list_item.xml
+++ b/indra/newview/skins/default/xui/en/widgets/clothing_list_item.xml
@@ -24,7 +24,7 @@
    parse_urls="false"
    use_ellipses="true"
    name="item_name"
-   text_color="white"
+   text_color="White"
    top="5"
    value="..."
    width="359" />
diff --git a/indra/newview/skins/default/xui/en/widgets/dummy_clothing_list_item.xml b/indra/newview/skins/default/xui/en/widgets/dummy_clothing_list_item.xml
index 6c60624805000dab89ff16fa3145a56ec7cd2e3e..8c805da04822b40dbb29ce4b91c8a7f424064734 100644
--- a/indra/newview/skins/default/xui/en/widgets/dummy_clothing_list_item.xml
+++ b/indra/newview/skins/default/xui/en/widgets/dummy_clothing_list_item.xml
@@ -9,7 +9,7 @@
  width="380">
   <item_icon
     height="16"
-    color="0.75 0.75 0.75 1"
+    color="LtGray"
     follows="top|left"
     image_name="Inv_Object"
     layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/widgets/floater.xml b/indra/newview/skins/default/xui/en/widgets/floater.xml
index adbb183317884bb66bb78384ce827354fc317d00..97a5ae7d4e575451496c357d644206b4a582a03c 100644
--- a/indra/newview/skins/default/xui/en/widgets/floater.xml
+++ b/indra/newview/skins/default/xui/en/widgets/floater.xml
@@ -2,7 +2,7 @@
 <!-- See also settings.xml UIFloater* settings for configuration -->
 <floater
  name="floater"
- open_positioning="none"
+ positioning="none"
  layout="topleft"
  bg_opaque_color="FloaterFocusBackgroundColor"
  bg_alpha_color="FloaterDefaultBackgroundColor"
diff --git a/indra/newview/skins/default/xui/en/widgets/outbox_folder_view_folder.xml b/indra/newview/skins/default/xui/en/widgets/outbox_folder_view_folder.xml
index 07929961075f9c24174a607c85fa9c876604e93f..d19c47f54f3ce17525c2bc9d3b5d1a10d9e0165f 100644
--- a/indra/newview/skins/default/xui/en/widgets/outbox_folder_view_folder.xml
+++ b/indra/newview/skins/default/xui/en/widgets/outbox_folder_view_folder.xml
@@ -6,14 +6,4 @@
   item_top_pad="4"
   selection_image="Rounded_Square"
   >
-  <error_badge 
-    label=" " 
-    label_offset_horiz="-1"
-    location="right" 
-    padding_horiz="12.5" 
-    padding_vert="2"
-    location_offset_hcenter="-23"
-    image="Error_Tag_Background"
-    image_color="Black"
-    />
 </outbox_folder_view_folder>
diff --git a/indra/newview/skins/default/xui/en/widgets/outbox_inventory_panel.xml b/indra/newview/skins/default/xui/en/widgets/outbox_inventory_panel.xml
index e3f20728196e2b51f9cd489e3e3477160396866f..3964569da24a9346996145189a6437926b1bf7d0 100644
--- a/indra/newview/skins/default/xui/en/widgets/outbox_inventory_panel.xml
+++ b/indra/newview/skins/default/xui/en/widgets/outbox_inventory_panel.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<outbox_inventory_panel show_load_status="false" />
+<outbox_inventory_panel show_empty_message="false" show_load_status="false" />
diff --git a/indra/newview/skins/default/xui/en/widgets/tab_container.xml b/indra/newview/skins/default/xui/en/widgets/tab_container.xml
index 3e2202b20fc5486448786fe78601bcfb2c1ec14d..0586119681a5cf16953c5bd056eec0a9e2b8298f 100644
--- a/indra/newview/skins/default/xui/en/widgets/tab_container.xml
+++ b/indra/newview/skins/default/xui/en/widgets/tab_container.xml
@@ -11,7 +11,7 @@ label_pad_left - padding to the left of tab button labels
                halign="center"
                font="SansSerifSmall" 
                tab_height="21"
-               label_pad_bottom="2"
+               label_pad_bottom="1"
                label_pad_left="4">
   <!--
   Possible additional attributes for tabs:
diff --git a/indra/newview/skins/default/xui/en/widgets/window_shade.xml b/indra/newview/skins/default/xui/en/widgets/window_shade.xml
new file mode 100644
index 0000000000000000000000000000000000000000..23eb2f13fb821531e12de71b63f3668379beab57
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/widgets/window_shade.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<window_shade shade_color="0 0 0 0.5"/>
diff --git a/indra/newview/skins/default/xui/es/floater_about.xml b/indra/newview/skins/default/xui/es/floater_about.xml
index b7c9cc27acd730ba30bfa2c2df4e7c6d2154a303..307b61133f3494036159b3fdc159ba21f2009e9d 100644
--- a/indra/newview/skins/default/xui/es/floater_about.xml
+++ b/indra/newview/skins/default/xui/es/floater_about.xml
@@ -67,32 +67,34 @@ Versión del servidor de voz: [VOICE_VERSION]
 		<panel label="Licencias" name="licenses_panel">
 			<text_editor name="credits_editor">
 				3Dconnexion SDK Copyright (C) 1992-2007 3Dconnexion
-APR Copyright (C) 2000-2004 The Apache Software Foundation
-Collada DOM Copyright 2005 Sony Computer Entertainment Inc.
-cURL Copyright (C) 1996-2002, Daniel Stenberg, (daniel@haxx.se)
-DBus/dbus-glib Copyright (C) 2002, 2003  CodeFactory AB / Copyright (C) 2003, 2004 Red Hat, Inc.
-expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
-FreeType Copyright (C) 1996-2002, The FreeType Project (www.freetype.org).
-GL Copyright (C) 1999-2004 Brian Paul.
-GLOD Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University y David Luebke, Brenden Schubert, University of Virginia.
-google-perftools Copyright (c) 2005, Google Inc.
-Havok.com(TM) Copyright (C) 1999-2001, Telekinesys Research Limited.
-jpeg2000 Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW)
-jpeglib Copyright (C) 1991-1998, Thomas G. Lane.
-ogg/vorbis Copyright (C) 2001, Xiphophorus
-OpenSSL Copyright (C) 1998-2002 The OpenSSL Project.
-PCRE Copyright (c) 1997-2008 University of Cambridge
-SDL Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
-SSLeay Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
-xmlrpc-epi Copyright (C) 2000 Epinions, Inc.
-zlib Copyright (C) 1995-2002 Jean-loup Gailly y Mark Adler.
-google-perftools Copyright (c) 2005, Google Inc.
+        APR Copyright (C) 2000-2004 The Apache Software Foundation
+        Collada DOM Copyright 2005 Sony Computer Entertainment Inc.
+        cURL Copyright (C) 1996-2002, Daniel Stenberg, (daniel@haxx.se)
+        DBus/dbus-glib Copyright (C) 2002, 2003  CodeFactory AB / Copyright (C) 2003, 2004 Red Hat, Inc.
+        expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
+        FreeType Copyright (C) 1996-2002, The FreeType Project (www.freetype.org).
+        GL Copyright (C) 1999-2004 Brian Paul.
+        GLOD Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University and David Luebke, Brenden Schubert, University of Virginia.
+        google-perftools Copyright (c) 2005, Google Inc.
+        Havok.com(TM) Copyright (C) 1999-2001, Telekinesys Research Limited.
+        jpeg2000 Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW)
+        jpeglib Copyright (C) 1991-1998, Thomas G. Lane.
+        ogg/vorbis Copyright (C) 2001, Xiphophorus
+        OpenSSL Copyright (C) 1998-2002 The OpenSSL Project.
+        PCRE Copyright (c) 1997-2008 University of Cambridge
+        SDL Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
+        SSLeay Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+        xmlrpc-epi Copyright (C) 2000 Epinions, Inc.
+        zlib Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler.
+        google-perftools Copyright (c) 2005, Google Inc.
 
-El visor de Second Life utiliza Havok (TM) Physics. (c)Copyright 1999-2010 Havok.com Inc. (y los propietarios de las licencias). Reservados todos los derechos. Consulta www.havok.com si deseas obtener más información.
+        El visor de Second Life usa Havok (TM) Physics. (c)Copyright 1999-2010 Havok.com Inc. (y sus licenciadores). Reservados todos los derechos. Vea los detalles en www.havok.com.
 
-Reservados todos los derechos.  Consulta las licencias en .txt si deseas obtener más información.
+        Este software contiene código fuente suministrado por NVIDIA Corporation.
 
-Codificación de sonido del chat de voz: Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C)
+        Reservados todos los derechos.  Consulte los detalles en licenses.txt.
+
+        Codificación del audio del chat de voz: Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C)
 			</text_editor>
 		</panel>
 	</tab_container>
diff --git a/indra/newview/skins/default/xui/es/floater_about_land.xml b/indra/newview/skins/default/xui/es/floater_about_land.xml
index b6391e28a01e73f51d3225b82962be1e692e0df0..fd54d74af28cf0ab06649817195a575ab56953b0 100644
--- a/indra/newview/skins/default/xui/es/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/es/floater_about_land.xml
@@ -130,7 +130,7 @@ Vaya al menú Mundo &gt; Acerca del terreno o seleccione otra parcela para ver s
 				Tráfico:
 			</text>
 			<text name="DwellText">
-				0
+				Cargando...
 			</text>
 			<button label="Comprar terreno" left="130" name="Buy Land..." width="125"/>
 			<button label="Venta Linden" name="Linden Sale..." tool_tip="El terreno debe estar en propiedad, con contenido, y no estar en subasta."/>
@@ -309,13 +309,15 @@ Sólo las parcelas más grandes pueden listarse en la búsqueda.
 				Sin &apos;empujones&apos; (prevalece lo marcado en la región)
 			</panel.string>
 			<panel.string name="see_avs_text">
-				Ver a los residentes de esta parcela y chatear con ellos
+				Los avatares de otras parcelas pueden ver
 			</panel.string>
 			<text name="allow_label">
 				Permitir a otros Residentes:
 			</text>
-			<check_box label="Editar el terreno" name="edit land check" tool_tip="Si se marca, cualquiera podrá modificar su terreno. Mejor dejarlo desmarcado, pues usted siempre puede modificar su terreno."/>
-			<check_box label="Volar" name="check fly" tool_tip="Si se marca, los residentes podrán volar en su terreno. Si no, sólo podrán volar al cruzarlo o hasta que aterricen en él."/>
+			<text name="allow_label0">
+				Volar:
+			</text>
+			<check_box label="Todos" name="check fly" tool_tip="Si se marca, los residentes podrán volar en su terreno. Si no, sólo podrán volar al cruzarlo o hasta que aterricen en él."/>
 			<text name="allow_label2">
 				Crear objetos:
 			</text>
@@ -331,9 +333,6 @@ Sólo las parcelas más grandes pueden listarse en la búsqueda.
 			</text>
 			<check_box label="Todos los residentes" name="check other scripts"/>
 			<check_box label="El grupo" name="check group scripts"/>
-			<text name="land_options_label">
-				Opciones del terreno:
-			</text>
 			<check_box label="Seguro (sin daño)" name="check safe" tool_tip="Si se marca, convierte el terreno en &apos;seguro&apos;, desactivando el daño en combate. Si no, se activa el daño en combate."/>
 			<check_box label="Sin &apos;empujones&apos;" name="PushRestrictCheck" tool_tip="Previene scripts que empujen. Marcando esta opción prevendrá que en su terreno haya comportamientos destructivos."/>
 			<check_box label="Mostrar el sitio en la búsqueda (30 L$/semana)" name="ShowDirectoryCheck" tool_tip="Let people see this parcel in search results"/>
@@ -374,9 +373,9 @@ Sólo las parcelas más grandes pueden listarse en la búsqueda.
 			</text>
 			<texture_picker label="" name="snapshot_ctrl" tool_tip="Pulse para elegir una imagen"/>
 			<text name="allow_label5">
-				Permitir a los residentes de otras parcelas:
+				Los avatares de otras parcelas pueden ver a los avatares de esta parcela y chatear con ellos
 			</text>
-			<check_box label="Ver los avatares" name="SeeAvatarsCheck" tool_tip="Permite que los residentes de otras parcelas vean a los residentes de ésta y chateen con ellos, y también que tú puedas verles y chatear con ellos."/>
+			<check_box label="Ver los avatares" name="SeeAvatarsCheck" tool_tip="Permite que los avatares de otras parcelas vean a los avatares de ésta y chateen con ellos, y también que tú puedas verles y chatear con ellos."/>
 			<text name="landing_point">
 				Punto de llegada: [LANDING]
 			</text>
@@ -461,12 +460,12 @@ los media:
 			<text name="Limit access to this parcel to:">
 				Acceso a esta parcela
 			</text>
-			<check_box label="Permitir el acceso público [MATURITY]" name="public_access"/>
+			<check_box label="Permitir el acceso público (si no seleccionas esta opción, se crearán líneas de prohibición)" name="public_access"/>
 			<text name="Only Allow">
-				Restringir el acceso a residentes verificados con:
+				Permitir únicamente el acceso a los Residentes que:
 			</text>
-			<check_box label="Información de pago aportada [ESTATE_PAYMENT_LIMIT]" name="limit_payment" tool_tip="Expulsa a los Residentes no identificados."/>
-			<check_box label="Verificación de edad [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="Expulsa a los Residentes que no hayan verificado su edad. Más información en [SUPPORT_SITE]."/>
+			<check_box label="Han aportado información de pago [ESTATE_PAYMENT_LIMIT]" name="limit_payment" tool_tip="Para poder acceder a esta parcela los Residentes deben haber aportado información de pago en su cuenta. Para más información, ver [SUPPORT_SITE]."/>
+			<check_box label="Han verificado su edad [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="Para poder acceder a esta parcela los Residentes deben haber verificado su edad. Para más información, ver [SUPPORT_SITE]."/>
 			<check_box label="Acceso permitido al grupo: [GROUP]" name="GroupCheck" tool_tip="Elija el grupo en la pestaña General."/>
 			<check_box label="Vender pases a:" name="PassCheck" tool_tip="Permitir acceso temporal a esta parcela"/>
 			<combo_box name="pass_combo">
diff --git a/indra/newview/skins/default/xui/es/floater_avatar.xml b/indra/newview/skins/default/xui/es/floater_avatar.xml
index 7c87fbe01ccc128ba05e22766ae02aede90d8bfb..21d202309f4c91df68ad38a5fb4c36b5a3dca5f6 100644
--- a/indra/newview/skins/default/xui/es/floater_avatar.xml
+++ b/indra/newview/skins/default/xui/es/floater_avatar.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Avatar" title="SELECTOR DE AVATAR"/>
+<floater name="Avatar" title="ELIGE UN AVATAR"/>
diff --git a/indra/newview/skins/default/xui/es/floater_buy_currency.xml b/indra/newview/skins/default/xui/es/floater_buy_currency.xml
index 43bbf0b70fc5a36bf62eb2e646762d906247b3f7..2c8848265f481a62e66c56a6e3a34b29c4b5ddc8 100644
--- a/indra/newview/skins/default/xui/es/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/es/floater_buy_currency.xml
@@ -46,7 +46,7 @@
 		[AMT] L$
 	</text>
 	<text name="currency_links">
-		[http://www.secondlife.com/my/account/payment_method_management.php método de pago] | [http://www.secondlife.com/my/account/currency.php moneda] | [http://www.secondlife.com/my/account/exchange_rates.php tipo de cambio]
+		[http://www.secondlife.com/my/account/payment_method_management.php método de pago] | [http://www.secondlife.com/my/account/currency.php moneda]
 	</text>
 	<text name="exchange_rate_note">
 		Vuelve a escribir la cantidad para ver el tipo de cambio más reciente.
diff --git a/indra/newview/skins/default/xui/es/floater_buy_land.xml b/indra/newview/skins/default/xui/es/floater_buy_land.xml
index 9d33b69de9f439d0f0134342e3bbd16b41291943..005fe90318ac73ddbecaa889b769361089123435 100644
--- a/indra/newview/skins/default/xui/es/floater_buy_land.xml
+++ b/indra/newview/skins/default/xui/es/floater_buy_land.xml
@@ -160,7 +160,7 @@ para cubrir esta parcela.
 		Podrá o no unirse o dividirse.
 	</text>
 	<text name="covenant_text">
-		Debes aceptar el Contrato del Estado:
+		Debes aceptar el Contrato del estado:
 	</text>
 	<text left="470" name="covenant_timestamp_text"/>
 	<text_editor name="covenant_editor">
diff --git a/indra/newview/skins/default/xui/es/floater_camera.xml b/indra/newview/skins/default/xui/es/floater_camera.xml
index cdcb9a146b2e0e10d9ae457fa803185e90919870..b0704ab7889b2d49d3ee86019bfc7dc69ec6846d 100644
--- a/indra/newview/skins/default/xui/es/floater_camera.xml
+++ b/indra/newview/skins/default/xui/es/floater_camera.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="camera_floater" title="VER">
+<floater name="camera_floater" title="CONTROLES DE LA CÁMARA">
 	<floater.string name="rotate_tooltip">
 		Girar la cámara alrededor de lo enfocado
 	</floater.string>
@@ -9,15 +9,6 @@
 	<floater.string name="move_tooltip">
 		Mover la cámara arriba y abajo, izquierda y derecha
 	</floater.string>
-	<floater.string name="camera_modes_title">
-		Modos de cámara
-	</floater.string>
-	<floater.string name="pan_mode_title">
-		Orbital - Zoom - Panorámica
-	</floater.string>
-	<floater.string name="presets_mode_title">
-		Vistas predefinidas
-	</floater.string>
 	<floater.string name="free_mode_title">
 		Centrar el objeto
 	</floater.string>
diff --git a/indra/newview/skins/default/xui/es/floater_chat_bar.xml b/indra/newview/skins/default/xui/es/floater_chat_bar.xml
index 5e5ef616b8db3096fcfa4847dec79ac5bd62fba4..2e948050570a2eca9045f21eafb78dca9a3b0fca 100644
--- a/indra/newview/skins/default/xui/es/floater_chat_bar.xml
+++ b/indra/newview/skins/default/xui/es/floater_chat_bar.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="chat_bar" title="CHAT">
-	<panel>
+	<panel name="bottom_panel">
 		<line_editor label="Pulsa aquí para chatear." name="chat_box" tool_tip="Pulsa Enter para decirlo o Ctrl+Enter para gritarlo"/>
 		<button name="show_nearby_chat" tool_tip="Muestra o esconde el registro del chat"/>
 	</panel>
diff --git a/indra/newview/skins/default/xui/es/floater_hardware_settings.xml b/indra/newview/skins/default/xui/es/floater_hardware_settings.xml
index 0150241d9a91791a20ca2fd523debaba84ba083e..b96076836b4448f49b51b5ad8921ed3dfa602749 100644
--- a/indra/newview/skins/default/xui/es/floater_hardware_settings.xml
+++ b/indra/newview/skins/default/xui/es/floater_hardware_settings.xml
@@ -4,7 +4,7 @@
 		Filtrado:
 	</text>
 	<check_box label="Filtrado anisotrópico (más lento si se activa)" name="ani"/>
-	<text name="Antialiasing:">
+	<text name="antialiasing label">
 		Antialiasing:
 	</text>
 	<combo_box label="Antialiasing" name="fsaa" width="94">
diff --git a/indra/newview/skins/default/xui/es/floater_merchant_outbox.xml b/indra/newview/skins/default/xui/es/floater_merchant_outbox.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a7c17fc136c01cdd3790f7fee96c95dff9f62473
--- /dev/null
+++ b/indra/newview/skins/default/xui/es/floater_merchant_outbox.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_merchant_outbox" title="BUZÓN DE SALIDA DE COMERCIANTE">
+	<string name="OutboxFolderCount1">
+		1 carpeta
+	</string>
+	<string name="OutboxFolderCountN">
+		[NUM] carpetas
+	</string>
+	<string name="OutboxImporting">
+		Enviando carpetas...
+	</string>
+	<string name="OutboxInitializing">
+		Inicializando...
+	</string>
+	<panel label="">
+		<panel>
+			<panel name="outbox_inventory_placeholder_panel">
+				<text name="outbox_inventory_placeholder_title">
+					Cargando...
+				</text>
+			</panel>
+		</panel>
+		<panel>
+			<button label="Enviar al Mercado" name="outbox_import_btn" tool_tip="Poner en el escaparate de Mi Mercado"/>
+		</panel>
+	</panel>
+</floater>
diff --git a/indra/newview/skins/default/xui/es/floater_model_preview.xml b/indra/newview/skins/default/xui/es/floater_model_preview.xml
index 3e774536129a67e5b1553a481ca917321b618a8f..ab3ba5aed7e4e0431d7a43dd5c6a3e2b0f4fe994 100644
--- a/indra/newview/skins/default/xui/es/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/es/floater_model_preview.xml
@@ -4,6 +4,9 @@
 	<string name="status_parse_error">
 		Error: Problema de análisis de DAE - consulta los datos en el registro.
 	</string>
+	<string name="status_material_mismatch">
+		Error: el material del modelo no es un subconjunto del modelo de referencia.
+	</string>
 	<string name="status_reading_file">
 		Cargando...
 	</string>
diff --git a/indra/newview/skins/default/xui/es/floater_model_wizard.xml b/indra/newview/skins/default/xui/es/floater_model_wizard.xml
index c4eb5e955ad6fe7c8bfa6ecda19fc9b56bd64976..5bd6b5e0e55731176d5373ce0390a43d0f6bf555 100644
--- a/indra/newview/skins/default/xui/es/floater_model_wizard.xml
+++ b/indra/newview/skins/default/xui/es/floater_model_wizard.xml
@@ -6,12 +6,12 @@
 	<button label="2. Optimizar" name="optimize_btn"/>
 	<button label="1. Seleccionar archivo" name="choose_file_btn"/>
 	<panel name="choose_file_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="choose_file_header_panel">
+			<text name="choose_file_header_text">
 				Elige el archivo de modelo
 			</text>
 		</panel>
-		<panel name="content">
+		<panel name="choose_file_content">
 			<text name="advanced_users_text">
 				Usuarios avanzados: si tienes experiencia con las herramientas de creación de contenidos 3D, quizá te interese utilizar la función de subida avanzada.
 			</text>
@@ -19,7 +19,10 @@
 			<text name="Cache location">
 				Elige el archivo de modelo que deseas subir
 			</text>
-			<button label="Buscar..." label_selected="Buscar..." name="browse"/>
+			<button label="Examinar..." label_selected="Examinar..." name="browse"/>
+			<text name="Model types">
+				‎Second Life admite los archivos COLLADA (.dae)
+			</text>
 			<text name="dimensions">
 				X         Y         Z
 			</text>
@@ -32,15 +35,15 @@
 		</panel>
 	</panel>
 	<panel name="optimize_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="optimize_header_panel">
+			<text name="optimize_header_text">
 				Optimizar el modelo
 			</text>
 		</panel>
-		<text name="description">
+		<text name="optimize_description">
 			Hemos optimizado el rendimiento del modelo, pero puedes ajustarlo más si lo deseas.
 		</text>
-		<panel name="content">
+		<panel name="optimize_content">
 			<text name="high_detail_text">
 				Generar el nivel de detalle: Alto
 			</text>
@@ -76,15 +79,15 @@
 		</panel>
 	</panel>
 	<panel name="physics_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="physics_header_panel">
+			<text name="physics_header_text">
 				Ajustar la física
 			</text>
 		</panel>
-		<text name="description">
+		<text name="physics_description">
 			Crearemos una forma para la apariencia exterior del modelo. Ajusta el nivel de detalle de la forma según se necesite para el propósito proyectado del modelo.
 		</text>
-		<panel name="content">
+		<panel name="physics_content">
 			<button label="Recalcular física" name="recalculate_physics_btn"/>
 			<button label="Recalculando..." name="recalculating_physics_btn"/>
 			<text name="lod_label">
@@ -107,12 +110,12 @@
 		</panel>
 	</panel>
 	<panel name="review_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="review_header_panel">
+			<text name="review_header_text">
 				Revisar
 			</text>
 		</panel>
-		<panel name="content">
+		<panel name="review_content">
 			<text name="review_prim_equiv">
 				Impacto en la parcela/región: [EQUIV] equivalentes en prim
 			</text>
@@ -125,8 +128,8 @@
 		</panel>
 	</panel>
 	<panel name="upload_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="upload_header_panel">
+			<text name="upload_header_text">
 				Subida finalizada
 			</text>
 		</panel>
diff --git a/indra/newview/skins/default/xui/es/floater_moveview.xml b/indra/newview/skins/default/xui/es/floater_moveview.xml
index b29fe0484863622337e9fb478a1e8c6a4af1828f..0e7b950bd3b33f9ddc58e0a36ad1e440f9181df6 100644
--- a/indra/newview/skins/default/xui/es/floater_moveview.xml
+++ b/indra/newview/skins/default/xui/es/floater_moveview.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="move_floater" title="MOVERME">
+<floater name="move_floater" title="CAMINAR / CORRER / VOLAR">
 	<string name="walk_forward_tooltip">
 		Caminar hacia adelante (cursor arriba o W)
 	</string>
diff --git a/indra/newview/skins/default/xui/es/floater_snapshot.xml b/indra/newview/skins/default/xui/es/floater_snapshot.xml
index eafc623ea93905771a9535ceea81af901153d56b..23078b3a553edc163cda06fea82be8cc59c7b1e9 100644
--- a/indra/newview/skins/default/xui/es/floater_snapshot.xml
+++ b/indra/newview/skins/default/xui/es/floater_snapshot.xml
@@ -3,73 +3,63 @@
 	<floater.string name="unknown">
 		desconocido
 	</floater.string>
-	<radio_group label="Tipo de foto" name="snapshot_type_radio">
-		<radio_item label="Correo-e" name="postcard"/>
-		<radio_item label="Mi inventario ([AMOUNT] L$)" name="texture"/>
-		<radio_item label="Guardar en mi ordenador" name="local"/>
-	</radio_group>
+	<string name="postcard_progress_str">
+		Enviando el correo electrónico
+	</string>
+	<string name="profile_progress_str">
+		Publicando
+	</string>
+	<string name="inventory_progress_str">
+		Guardando en el inventario
+	</string>
+	<string name="local_progress_str">
+		Guardando en el equipo
+	</string>
+	<string name="profile_succeeded_str">
+		Imagen subida
+	</string>
+	<string name="postcard_succeeded_str">
+		Correo electrónico enviado
+	</string>
+	<string name="inventory_succeeded_str">
+		¡Guardado en el inventario!
+	</string>
+	<string name="local_succeeded_str">
+		¡Guardado en el equipo!
+	</string>
+	<string name="profile_failed_str">
+		Error al subir la imagen a los comentarios de tu perfil.
+	</string>
+	<string name="postcard_failed_str">
+		Error al enviar el correo electrónico.
+	</string>
+	<string name="inventory_failed_str">
+		Error al guardar en el inventario.
+	</string>
+	<string name="local_failed_str">
+		Error al guardar en el equipo.
+	</string>
+	<button name="advanced_options_btn" tool_tip="Opciones avanzadas"/>
+	<text name="image_res_text">
+		[WIDTH] x [HEIGHT] px
+	</text>
 	<text name="file_size_label">
 		[SIZE] kB
 	</text>
-	<button label="Actualizar la foto" name="new_snapshot_btn"/>
-	<button label="Enviar" name="send_btn"/>
-	<button label="Ahorro ([AMOUNT] L$)" name="upload_btn"/>
-	<flyout_button label="Guardar" name="save_btn" tool_tip="Guardar la imagen en un archivo">
-		<flyout_button.item label="Guardar" name="save_item"/>
-		<flyout_button.item label="Guardar como..." name="saveas_item"/>
-	</flyout_button>
-	<button label="Más" name="more_btn" tool_tip="Opciones avanzadas"/>
-	<button label="Menos" name="less_btn" tool_tip="Opciones avanzadas"/>
-	<button label="Cancelar" name="discard_btn"/>
-	<text name="type_label2">
-		Tamaño
-	</text>
-	<text name="format_label">
-		Formato
-	</text>
-	<combo_box label="Resolución" name="postcard_size_combo">
-		<combo_box.item label="Ventana actual" name="CurrentWindow"/>
-		<combo_box.item label="640x480" name="640x480"/>
-		<combo_box.item label="800x600" name="800x600"/>
-		<combo_box.item label="1024x768" name="1024x768"/>
-		<combo_box.item label="Personalizado" name="Custom"/>
-	</combo_box>
-	<combo_box label="Resolución" name="texture_size_combo">
-		<combo_box.item label="Ventana actual" name="CurrentWindow"/>
-		<combo_box.item label="Pequeña (128x128)" name="Small(128x128)"/>
-		<combo_box.item label="Mediana (256x256)" name="Medium(256x256)"/>
-		<combo_box.item label="Grande (512x512)" name="Large(512x512)"/>
-		<combo_box.item label="Personalizado" name="Custom"/>
-	</combo_box>
-	<combo_box label="Resolución" name="local_size_combo">
-		<combo_box.item label="Ventana actual" name="CurrentWindow"/>
-		<combo_box.item label="320x240" name="320x240"/>
-		<combo_box.item label="640x480" name="640x480"/>
-		<combo_box.item label="800x600" name="800x600"/>
-		<combo_box.item label="1024x768" name="1024x768"/>
-		<combo_box.item label="1280x1024" name="1280x1024"/>
-		<combo_box.item label="1600x1200" name="1600x1200"/>
-		<combo_box.item label="Personalizado" name="Custom"/>
-	</combo_box>
-	<combo_box label="Formato" name="local_format_combo">
-		<combo_box.item label="PNG" name="PNG"/>
-		<combo_box.item label="JPEG" name="JPEG"/>
-		<combo_box.item label="BMP" name="BMP"/>
-	</combo_box>
-	<spinner label="Ancho" name="snapshot_width"/>
-	<spinner label="Altura" name="snapshot_height"/>
-	<check_box label="Mantener las proporciones" name="keep_aspect_check"/>
-	<slider label="Calidad de la imagen" name="image_quality_slider"/>
-	<text name="layer_type_label">
-		Captura:
-	</text>
-	<combo_box label="Capas de imagen" name="layer_types">
-		<combo_box.item label="Colores" name="Colors"/>
-		<combo_box.item label="Profundidad" name="Depth"/>
-	</combo_box>
-	<check_box label="Interfaz" name="ui_check"/>
-	<check_box label="HUDs" name="hud_check"/>
-	<check_box label="Mantener abierto después de guardar" name="keep_open_check"/>
-	<check_box label="Congelar la toma (pantalla completa)" name="freeze_frame_check"/>
-	<check_box label="Actualizar automáticamente" name="auto_snapshot_check"/>
+	<panel name="advanced_options_panel">
+		<text name="advanced_options_label">
+			OPCIONES AVANZADAS
+		</text>
+		<text name="layer_type_label">
+			Captura:
+		</text>
+		<combo_box label="Capas de imagen" name="layer_types">
+			<combo_box.item label="Colores" name="Colors"/>
+			<combo_box.item label="Profundidad" name="Depth"/>
+		</combo_box>
+		<check_box label="Interfaz" name="ui_check"/>
+		<check_box label="HUDs" name="hud_check"/>
+		<check_box label="Congelar la toma (pantalla completa)" name="freeze_frame_check"/>
+		<check_box label="Actualizar automáticamente" name="auto_snapshot_check"/>
+	</panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/es/floater_test_layout_stacks.xml b/indra/newview/skins/default/xui/es/floater_test_layout_stacks.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b479d5f6d6bbc342a4c4bb9a33199290356156d9
--- /dev/null
+++ b/indra/newview/skins/default/xui/es/floater_test_layout_stacks.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Test Floater" title="LAYOUTSTACK TESTS"/>
diff --git a/indra/newview/skins/default/xui/es/floater_toybox.xml b/indra/newview/skins/default/xui/es/floater_toybox.xml
index b36a05a6e4bea3a8798725e735dc53190c4dffaa..7275b0546ba7877b5a42a6ce918c72fd7d8f3624 100644
--- a/indra/newview/skins/default/xui/es/floater_toybox.xml
+++ b/indra/newview/skins/default/xui/es/floater_toybox.xml
@@ -1,10 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Toybox" title="PERSONALIZAR BARRAS DE HERRAMIENTAS">
+<floater name="Toybox" title="BOTONES DE LA BARRA DE HERRAMIENTAS">
 	<text name="toybox label 1">
 		Puedes agregar o quitar botones arrastrándolos a las barras de herramientas o desde ellas.
 	</text>
 	<text name="toybox label 2">
 		Los botones aparecerán como se muestra o solo como iconos, según la configuración de cada barra de herramientas.
 	</text>
+	<button label="Quitar todas las barras de herramientas" label_selected="Quitar todas las barras de herramientas" name="btn_clear_all"/>
 	<button label="Restaurar valores predeterminados" label_selected="Restaurar valores predeterminados" name="btn_restore_defaults"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/es/floater_translation_settings.xml b/indra/newview/skins/default/xui/es/floater_translation_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..765c9a05a28b5fea0550d63dc6da94f759e8f51e
--- /dev/null
+++ b/indra/newview/skins/default/xui/es/floater_translation_settings.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_translation_settings" title="CONFIGURACIÓN DE LA TRADUCCIÓN DEL CHAT">
+	<string name="bing_api_key_not_verified">
+		appID de Bing no se ha confirmado. Vuelve a intentarlo.
+	</string>
+	<string name="google_api_key_not_verified">
+		La clave de API de Google no se ha confirmado. Vuelve a intentarlo.
+	</string>
+	<string name="bing_api_key_verified">
+		appID de Bing se ha confirmado.
+	</string>
+	<string name="google_api_key_verified">
+		La clave de API de Google se ha confirmado.
+	</string>
+	<check_box label="Activar la traducción automática durante el chat" name="translate_chat_checkbox"/>
+	<text name="translate_language_label">
+		Traducir el chat al:
+	</text>
+	<combo_box name="translate_language_combo">
+		<combo_box.item label="Predeterminado del sistema" name="System Default Language"/>
+		<combo_box.item label="Inglés" name="English"/>
+		<combo_box.item label="Dansk (danés)" name="Danish"/>
+		<combo_box.item label="Deutsch (alemán)" name="German"/>
+		<combo_box.item label="Español (español)" name="Spanish"/>
+		<combo_box.item label="Français (francés)" name="French"/>
+		<combo_box.item label="Italiano (italiano)" name="Italian"/>
+		<combo_box.item label="Magyar (húngaro)" name="Hungarian"/>
+		<combo_box.item label="Nederlands (neerlandés)" name="Dutch"/>
+		<combo_box.item label="Polski (polaco)" name="Polish"/>
+		<combo_box.item label="Português (portugués)" name="Portugese"/>
+		<combo_box.item label="Русский (ruso)" name="Russian"/>
+		<combo_box.item label="Türkçe (turco)" name="Turkish"/>
+		<combo_box.item label="Українська (ucraniano)" name="Ukrainian"/>
+		<combo_box.item label="中文 (正體) (Chino)" name="Chinese"/>
+		<combo_box.item label="日本語 (japonés)" name="Japanese"/>
+		<combo_box.item label="한국어 (coreano)" name="Korean"/>
+	</combo_box>
+	<text name="tip">
+		Elige el servicio de traducción:
+	</text>
+	<radio_group name="translation_service_rg">
+		<radio_item initial_value="bing" label="Bing Translator" name="bing"/>
+		<radio_item initial_value="google" label="Traductor de Google" name="google"/>
+	</radio_group>
+	<text name="bing_api_key_label">
+		[http://www.bing.com/developers/createapp.aspx AppID] de Bing:
+	</text>
+	<button label="Verificar" name="verify_bing_api_key_btn"/>
+	<text name="google_api_key_label">
+		[http://code.google.com/apis/language/translate/v2/getting_started.html#auth Clave de API] de Google:
+	</text>
+	<button label="Verificar" name="verify_google_api_key_btn"/>
+	<text name="google_links_text">
+		[http://code.google.com/apis/language/translate/v2/pricing.html Precios] | [https://code.google.com/apis/console Estadísticas]
+	</text>
+	<button label="OK" name="ok_btn"/>
+	<button label="Cancelar" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/es/floater_voice_controls.xml b/indra/newview/skins/default/xui/es/floater_voice_controls.xml
index cefec2a7a16cfd2e5eea09837f379cc7978c1ab3..eff21239be1a40f873536478c073c9e7cc42a2f7 100644
--- a/indra/newview/skins/default/xui/es/floater_voice_controls.xml
+++ b/indra/newview/skins/default/xui/es/floater_voice_controls.xml
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="floater_voice_controls" title="CONTROLES DE LA VOZ">
 	<string name="title_nearby">
-		Chat de voz
+		CONFIGURACIÓN DE VOZ
 	</string>
 	<string name="title_group">
-		Multiconferencia de voz con [GROUP]
+		MULTICONFERENCIA DE VOZ CON [GROUP]
 	</string>
 	<string name="title_adhoc">
-		Multiconferencia de voz
+		MULTICONFERENCIA DE VOZ
 	</string>
 	<string name="title_peer_2_peer">
-		Llamada: [NAME]
+		LLAMADA A [NAME]
 	</string>
 	<string name="no_one_near">
 		Nadie cercano tiene activada la voz
diff --git a/indra/newview/skins/default/xui/es/menu_inspect_object_gear.xml b/indra/newview/skins/default/xui/es/menu_inspect_object_gear.xml
index bcdc25894f4f609ae983a65424c272270e0abc54..9d0a8c50ef4cea0c155d5e9677751592a20d25f0 100644
--- a/indra/newview/skins/default/xui/es/menu_inspect_object_gear.xml
+++ b/indra/newview/skins/default/xui/es/menu_inspect_object_gear.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<menu name="Gear Menu">
+<toggleable_menu name="Gear Menu">
 	<menu_item_call label="Tocar" name="touch"/>
 	<menu_item_call label="Sentarse" name="sit"/>
 	<menu_item_call label="Pagar" name="pay"/>
@@ -12,7 +12,8 @@
 	<menu_item_call label="Añadir" name="add"/>
 	<menu_item_call label="Denunciar" name="report"/>
 	<menu_item_call label="Ignorar" name="block"/>
+	<menu_item_call label="No ignorar" name="unblock"/>
 	<menu_item_call label="Acercar el zoom" name="zoom_in"/>
 	<menu_item_call label="Quitar" name="remove"/>
 	<menu_item_call label="Más información" name="more_info"/>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/es/menu_inventory.xml b/indra/newview/skins/default/xui/es/menu_inventory.xml
index f1f1ef091fc2f1c22f596381d964dd1e83ce3842..4a8f37dee4d825ed54b5d3c607e0e3bbbdf2b414 100644
--- a/indra/newview/skins/default/xui/es/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/es/menu_inventory.xml
@@ -84,6 +84,6 @@
 	<menu_item_call label="Añadir" name="Wearable Add"/>
 	<menu_item_call label="Quitarse" name="Take Off"/>
 	<menu_item_call label="Copiar al Buzón de salida de comerciante" name="Merchant Copy"/>
-	<menu_item_call label="Mover al Buzón de salida de comerciante" name="Merchant Move"/>
+	<menu_item_call label="Enviar al Mercado" name="Marketplace Send"/>
 	<menu_item_call label="--sin opciones--" name="--no options--"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/es/menu_login.xml b/indra/newview/skins/default/xui/es/menu_login.xml
index e3abf7ad6295795919f834f1990b0c20505ce6bc..289ac3f0757089861087c2e3a867d93e05f73267 100644
--- a/indra/newview/skins/default/xui/es/menu_login.xml
+++ b/indra/newview/skins/default/xui/es/menu_login.xml
@@ -16,8 +16,8 @@
 		<menu_item_call label="Definir el tamaño de la ventana..." name="Set Window Size..."/>
 		<menu_item_call label="Mostrar los &apos;TOS&apos;" name="TOS"/>
 		<menu_item_call label="Mostrar mensaje crítico" name="Critical"/>
-		<menu_item_call label="Prueba de navegadores de medios" name="Web Browser Test"/>
 		<menu_item_call label="Prueba de depuración de ventanas de contenido web" name="Web Content Floater Debug Test"/>
+		<menu label="Configurar el nivel de registro" name="Set Logging Level"/>
 		<menu_item_check label="Mostrar el selector de Grid" name="Show Grid Picker"/>
 		<menu_item_call label="Mostrar la consola de notificaciones" name="Show Notifications Console"/>
 	</menu>
diff --git a/indra/newview/skins/default/xui/es/menu_toolbars.xml b/indra/newview/skins/default/xui/es/menu_toolbars.xml
index f8ed1c54ca3bdbc3b7e2c3885d3a55d4a7b5ed7f..63f3dc43bd5b839193372c950fc442c15079aaaf 100644
--- a/indra/newview/skins/default/xui/es/menu_toolbars.xml
+++ b/indra/newview/skins/default/xui/es/menu_toolbars.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Toolbars Popup">
-	<menu_item_call label="Elegir botones..." name="Chose Buttons"/>
+	<menu_item_call label="Quitar este botón" name="Remove button"/>
+	<menu_item_call label="Botones de la barra de herramientas..." name="Choose Buttons"/>
 	<menu_item_check label="Iconos y etiquetas" name="icons_with_text"/>
 	<menu_item_check label="Solo iconos" name="icons_only"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/es/menu_viewer.xml b/indra/newview/skins/default/xui/es/menu_viewer.xml
index 0714e7f2c6b7246f40c8485f99766330581a03d3..9522d4eac669ccf3e8a089019f189ae35939768d 100644
--- a/indra/newview/skins/default/xui/es/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/es/menu_viewer.xml
@@ -1,55 +1,59 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu_bar name="Main Menu">
 	<menu label="Yo" name="Me">
-		<menu_item_call label="Panel de control..." name="Manage My Account">
-			<menu_item_call.on_click name="ManageMyAccount_url" parameter="WebLaunchJoinNow,http://secondlife.com/account/index.php?lang=es"/>
-		</menu_item_call>
 		<menu_item_call label="Perfil..." name="Profile"/>
 		<menu_item_call label="Apariencia" name="ChangeOutfit"/>
+		<menu_item_call label="Elige un avatar..." name="Avatar Picker"/>
 		<menu_item_check label="Inventario..." name="Inventory"/>
-		<menu_item_check label="Gestos..." name="Gestures"/>
-		<menu_item_check label="Voz..." name="ShowVoice"/>
+		<menu_item_call label="Nueva ventana del inventario" name="NewInventoryWindow"/>
+		<menu_item_call label="Lugares..." name="Places"/>
+		<menu_item_call label="Destacados..." name="Picks"/>
+		<menu_item_call label="Controles de la cámara..." name="Camera Controls"/>
 		<menu label="Movimiento" name="Movement">
 			<menu_item_call label="Sentarte" name="Sit Down Here"/>
 			<menu_item_check label="Volar" name="Fly"/>
 			<menu_item_check label="Correr siempre" name="Always Run"/>
 			<menu_item_call label="Parar mis animaciones" name="Stop Animating My Avatar"/>
+			<menu_item_call label="Caminar / Correr / Volar..." name="Walk / run / fly"/>
 		</menu>
 		<menu label="Estado" name="Status">
 			<menu_item_call label="Ausente" name="Set Away"/>
 			<menu_item_call label="Ocupado" name="Set Busy"/>
 		</menu>
-		<menu_item_call label="Solicitar estatus de Administrador" name="Request Admin Options"/>
-		<menu_item_call label="Dejar el estatus de Administrador" name="Leave Admin Options"/>
-		<menu_item_call label="Comprar L$" name="Buy and Sell L$"/>
+		<menu_item_call label="Comprar L$..." name="Buy and Sell L$"/>
+		<menu_item_call label="Panel de control de la cuenta..." name="Manage My Account">
+			<menu_item_call.on_click name="ManageMyAccount_url" parameter="WebLaunchJoinNow,http://secondlife.com/account/index.php?lang=es"/>
+		</menu_item_call>
 		<menu_item_call label="Preferencias..." name="Preferences"/>
-		<menu_item_call label="Barras de herramientas..." name="Toolbars"/>
+		<menu_item_call label="Botones de la barra de herramientas..." name="Toolbars"/>
 		<menu_item_call label="Ocultar todos los controles" name="Hide UI"/>
 		<menu_item_call label="Salir de [APP_NAME]" name="Quit"/>
 	</menu>
 	<menu label="Comunicarme" name="Communicate">
-		<menu_item_call label="Mis amigos" name="My Friends"/>
-		<menu_item_call label="Mis grupos" name="My Groups"/>
-		<menu_item_check label="Chat" name="Nearby Chat"/>
+		<menu_item_check label="Chat..." name="Nearby Chat"/>
+		<menu_item_check label="Hablar" name="Speak"/>
+		<menu_item_check label="Configuración de voz..." name="Nearby Voice"/>
+		<menu_item_check label="Transformación de voz..." name="ShowVoice"/>
+		<menu_item_check label="Gestos..." name="Gestures"/>
+		<menu_item_call label="Amigos" name="My Friends"/>
+		<menu_item_call label="Grupos" name="My Groups"/>
 		<menu_item_call label="Gente cerca" name="Active Speakers"/>
-		<menu_item_check label="Chat de voz" name="Nearby Voice"/>
 	</menu>
 	<menu label="Mundo" name="World">
-		<menu_item_check label="Minimapa" name="Mini-Map"/>
+		<menu_item_call label="Crear un hito de este sitio" name="Create Landmark Here"/>
+		<menu_item_call label="Destinos..." name="Destinations"/>
 		<menu_item_check label="Mapa del mundo" name="World Map"/>
+		<menu_item_check label="Minimapa" name="Mini-Map"/>
 		<menu_item_check label="Buscar" name="Search"/>
+		<menu_item_call label="Teleportar a la Base" name="Teleport Home"/>
+		<menu_item_call label="Fijar mi Base aquí" name="Set Home to Here"/>
 		<menu_item_call label="Foto" name="Take Snapshot"/>
-		<menu_item_call label="Crear un hito de este sitio" name="Create Landmark Here"/>
-		<menu label="Perfil del lugar" name="Land">
-			<menu_item_call label="Perfil del lugar" name="Place Profile"/>
-			<menu_item_call label="Acerca del terreno" name="About Land"/>
-			<menu_item_call label="Región/Estado" name="Region/Estate"/>
-		</menu>
+		<menu_item_call label="Perfil del lugar" name="Place Profile"/>
+		<menu_item_call label="Acerca del terreno" name="About Land"/>
+		<menu_item_call label="Región/Estado" name="Region/Estate"/>
+		<menu_item_call label="Mis terrenos..." name="My Land"/>
 		<menu_item_call label="Comprar este terreno" name="Buy Land"/>
-		<menu_item_call label="Mi terreno" name="My Land"/>
 		<menu label="Mostrar" name="LandShow">
-			<menu_item_check label="Controles del movimiento" name="Movement Controls"/>
-			<menu_item_check label="Controles de la cámara" name="Camera Controls"/>
 			<menu_item_check label="Líneas de prohibición" name="Ban Lines"/>
 			<menu_item_check label="Balizas" name="beacons"/>
 			<menu_item_check label="Límites de las parcelas" name="Property Lines"/>
@@ -58,16 +62,15 @@
 			<menu_item_check label="Propiedades de la parcela" name="Parcel Properties"/>
 			<menu_item_check label="Menú Avanzado" name="Show Advanced Menu"/>
 		</menu>
-		<menu_item_call label="Teleportar a la Base" name="Teleport Home"/>
-		<menu_item_call label="Fijar mi Base aquí" name="Set Home to Here"/>
-		<menu label="Sol" name="Environment Settings">
+		<menu label="Sol" name="Sun">
 			<menu_item_call label="Amanecer" name="Sunrise"/>
 			<menu_item_call label="Mediodía" name="Noon"/>
 			<menu_item_call label="Atardecer" name="Sunset"/>
 			<menu_item_call label="Medianoche" name="Midnight"/>
+			<menu_item_call label="Usar configuración de región" name="Use Region Settings"/>
 		</menu>
-		<menu label="Editor de entorno" name="Enviroment Editor">
-			<menu_item_call label="Configuración de entorno..." name="Enviroment Settings"/>
+		<menu label="Editor de entorno" name="Environment Editor">
+			<menu_item_call label="Configuración del entorno..." name="Environment Settings"/>
 			<menu label="Agua predefinida" name="Water Presets">
 				<menu_item_call label="Nuevo predefinido..." name="new_water_preset"/>
 				<menu_item_call label="Editar predefinido..." name="edit_water_preset"/>
@@ -140,11 +143,13 @@
 			<menu_item_call label="Animación ([COST] L$)..." name="Upload Animation"/>
 			<menu_item_call label="Modelo..." name="Upload Model"/>
 			<menu_item_call label="Masivo ([COST] L$ por archivo)..." name="Bulk Upload"/>
+			<menu_item_call label="Configurar los permisos por defecto de subida" name="perm prefs"/>
 		</menu>
 		<menu_item_call label="Deshacer" name="Undo"/>
 		<menu_item_call label="Rehacer" name="Redo"/>
 	</menu>
 	<menu label="Ayuda" name="Help">
+		<menu_item_call label="Cómo..." name="How To"/>
 		<menu_item_call label="Ayuda de [SECOND_LIFE]" name="Second Life Help"/>
 		<menu_item_call label="Denunciar una infracción" name="Report Abuse"/>
 		<menu_item_call label="Informar de un fallo" name="Report Bug"/>
@@ -172,22 +177,22 @@
 			<menu_item_check label="Mostrar el Punto de Mira en la vista subjetiva" name="ShowCrosshairs"/>
 		</menu>
 		<menu label="Objetos representados" name="Rendering Types">
-			<menu_item_check label="Simple" name="Simple"/>
-			<menu_item_check label="Alfa" name="Alpha"/>
-			<menu_item_check label="Árbol" name="Tree"/>
-			<menu_item_check label="Avatares" name="Character"/>
-			<menu_item_check label="Parche de superficie" name="Surface Patch"/>
-			<menu_item_check label="Cielo" name="Sky"/>
-			<menu_item_check label="Agua" name="Water"/>
-			<menu_item_check label="Terreno" name="Ground"/>
-			<menu_item_check label="volumen" name="Volume"/>
-			<menu_item_check label="Hierba" name="Grass"/>
-			<menu_item_check label="Nubes" name="Clouds"/>
-			<menu_item_check label="Partículas" name="Particles"/>
-			<menu_item_check label="Efectos de relieve" name="Bump"/>
+			<menu_item_check label="Simple" name="Rendering Type Simple"/>
+			<menu_item_check label="Alfa" name="Rendering Type Alpha"/>
+			<menu_item_check label="Árbol" name="Rendering Type Tree"/>
+			<menu_item_check label="Avatares" name="Rendering Type Character"/>
+			<menu_item_check label="Parcela de superficie" name="Rendering Type Surface Patch"/>
+			<menu_item_check label="Cielo" name="Rendering Type Sky"/>
+			<menu_item_check label="Agua" name="Rendering Type Water"/>
+			<menu_item_check label="Terreno" name="Rendering Type Ground"/>
+			<menu_item_check label="Volumen" name="Rendering Type Volume"/>
+			<menu_item_check label="Hierba" name="Rendering Type Grass"/>
+			<menu_item_check label="Nubes" name="Rendering Type Clouds"/>
+			<menu_item_check label="Partículas" name="Rendering Type Particles"/>
+			<menu_item_check label="Efectos de relieve" name="Rendering Type Bump"/>
 		</menu>
 		<menu label="Rasgos renderizados" name="Rendering Features">
-			<menu_item_check label="UI" name="UI"/>
+			<menu_item_check label="UI" name="ToggleUI"/>
 			<menu_item_check label="Seleccionado" name="Selected"/>
 			<menu_item_check label="Realzados" name="Highlighted"/>
 			<menu_item_check label="Texturas dinámicas" name="Dynamic Textures"/>
@@ -198,11 +203,8 @@
 		<menu_item_check label="Usar Plugin Read Thread" name="Use Plugin Read Thread"/>
 		<menu_item_call label="Vaciar la caché de grupo" name="ClearGroupCache"/>
 		<menu_item_check label="Vista subjetiva suavizada" name="Mouse Smoothing"/>
+		<menu_item_call label="Recuperar las teclas" name="Release Keys"/>
 		<menu label="Atajos de teclado" name="Shortcuts">
-			<menu_item_call label="Imagen ([COST] L$)..." name="Upload Image"/>
-			<menu_item_check label="Buscar" name="Search"/>
-			<menu_item_call label="Recuperar las teclas" name="Release Keys"/>
-			<menu_item_call label="Interfaz en el tamaño predeterminado" name="Set UI Size to Default"/>
 			<menu_item_check label="Mostrar el menú Avanzado - acceso directo antiguo" name="Show Advanced Menu - legacy shortcut"/>
 			<menu_item_call label="Cerrar la ventana" name="Close Window"/>
 			<menu_item_call label="Cerrar todas las ventanas" name="Close All Windows"/>
@@ -211,13 +213,6 @@
 			<menu_item_check label="Flycam del joystick" name="Joystick Flycam"/>
 			<menu_item_call label="Volver a la vista por defecto" name="Reset View"/>
 			<menu_item_call label="Mirar al último que habló" name="Look at Last Chatter"/>
-			<menu label="Seleccionar la herramienta de construcción" name="Select Tool">
-				<menu_item_call label="Herramienta Visión" name="Focus"/>
-				<menu_item_call label="Herramienta Mover" name="Move"/>
-				<menu_item_call label="Herramienta Editar" name="Edit"/>
-				<menu_item_call label="Herramienta Crear" name="Create"/>
-				<menu_item_call label="Herramienta Terreno" name="Land"/>
-			</menu>
 			<menu_item_call label="Acercar el zoom" name="Zoom In"/>
 			<menu_item_call label="Zoom por defecto" name="Zoom Default"/>
 			<menu_item_call label="Alejar el zoom" name="Zoom Out"/>
@@ -271,7 +266,9 @@
 			<menu_item_check label="Actualizar el tipo" name="Update Type"/>
 			<menu_item_check label="Información sobre el nivel de detalle" name="LOD Info"/>
 			<menu_item_check label="Crear cola" name="Build Queue"/>
+			<menu_item_check label="Vectores de viento" name="Wind Vectors"/>
 			<menu_item_check label="Complejidad del renderizado" name="rendercomplexity"/>
+			<menu_item_check label="Bytes de adjunto" name="attachment bytes"/>
 			<menu_item_check label="Esculpir" name="Sculpt"/>
 		</menu>
 		<menu label="Rendering" name="Rendering">
@@ -280,7 +277,6 @@
 			<menu_item_check label="Luces y sombras" name="Lighting and Shadows"/>
 			<menu_item_check label="Sombras del sol/la luna/proyectores" name="Shadows from Sun/Moon/Projectors"/>
 			<menu_item_check label="SSAO y sombras suavizadas" name="SSAO and Shadow Smoothing"/>
-			<menu_item_check label="Iluminación global (experimental)" name="Global Illumination"/>
 			<menu_item_check label="Capas alfa automáticas (deferidas)" name="Automatic Alpha Masks (deferred)"/>
 			<menu_item_check label="Capas alfa automáticas (no deferidas)" name="Automatic Alpha Masks (non-deferred)"/>
 			<menu_item_check label="Animation Textures" name="Animation Textures"/>
@@ -295,11 +291,10 @@
 			<menu_item_call label="Drop a Packet" name="Drop a Packet"/>
 		</menu>
 		<menu_item_call label="Bumps, Pushes &amp; Hits" name="Bumps, Pushes &amp;amp; Hits"/>
-		<menu label="World" name="World">
-			<menu_item_check label="Region Sun Override" name="Sim Sun Override"/>
-			<menu_item_check label="Beacon flashing effect" name="Cheesy Beacon"/>
-			<menu_item_check label="Fixed Weather" name="Fixed Weather"/>
-			<menu_item_call label="Dump Region Object Cache" name="Dump Region Object Cache"/>
+		<menu label="Mundo virtual" name="DevelopWorld">
+			<menu_item_check label="Anular el sol del Sim" name="Sim Sun Override"/>
+			<menu_item_check label="Meteorología fija" name="Fixed Weather"/>
+			<menu_item_call label="Volcar la caché de objetos de la región" name="Dump Region Object Cache"/>
 		</menu>
 		<menu label="UI" name="UI">
 			<menu_item_call label="Prueba de navegadores de medios" name="Web Browser Test"/>
@@ -319,11 +314,11 @@
 		</menu>
 		<menu label="Avatar" name="Character">
 			<menu label="Grab Baked Texture" name="Grab Baked Texture">
-				<menu_item_call label="Iris" name="Iris"/>
-				<menu_item_call label="Head" name="Head"/>
-				<menu_item_call label="Upper Body" name="Upper Body"/>
-				<menu_item_call label="Lower Body" name="Lower Body"/>
-				<menu_item_call label="Skirt" name="Skirt"/>
+				<menu_item_call label="Iris" name="Grab Iris"/>
+				<menu_item_call label="Cabeza" name="Grab Head"/>
+				<menu_item_call label="Parte superior del cuerpo" name="Grab Upper Body"/>
+				<menu_item_call label="Parte inferior del cuerpo" name="Grab Lower Body"/>
+				<menu_item_call label="Falda" name="Grab Skirt"/>
 			</menu>
 			<menu label="Character Tests" name="Character Tests">
 				<menu_item_call label="Toggle Character Geometry" name="Toggle Character Geometry"/>
@@ -340,17 +335,19 @@
 		<menu_item_check label="HTTP Textures" name="HTTP Textures"/>
 		<menu_item_check label="Inventario HTTP" name="HTTP Inventory"/>
 		<menu_item_check label="Console Window on next Run" name="Console Window"/>
+		<menu label="Configurar el nivel de registro" name="Set Logging Level"/>
 		<menu_item_call label="Request Admin Status" name="Request Admin Options"/>
 		<menu_item_call label="Leave Admin Status" name="Leave Admin Options"/>
 		<menu_item_check label="Show Admin Menu" name="View Admin Options"/>
 	</menu>
 	<menu label="Admin" name="Admin">
-		<menu label="Object">
-			<menu_item_call label="Coger una copia" name="Take Copy"/>
-			<menu_item_call label="Force Owner To Me" name="Force Owner To Me"/>
-			<menu_item_call label="Force Owner Permissive" name="Force Owner Permissive"/>
+		<menu label="Objeto" name="AdminObject">
+			<menu_item_call label="Tomar una copia" name="Admin Take Copy"/>
+			<menu_item_call label="Forzar que yo sea el propietario" name="Force Owner To Me"/>
+			<menu_item_call label="Forzar permiso al propietario" name="Force Owner Permissive"/>
 			<menu_item_call label="Eliminar" name="Delete"/>
-			<menu_item_call label="Lock" name="Lock"/>
+			<menu_item_call label="Bloquear" name="Lock"/>
+			<menu_item_call label="Obtener ID de objetos" name="Get Assets IDs"/>
 		</menu>
 		<menu label="Parcel" name="Parcel">
 			<menu_item_call label="Force Owner To Me" name="Owner To Me"/>
@@ -367,5 +364,16 @@
 		<menu label="Take Off Clothing" name="Take Off Clothing">
 			<menu_item_call label="Física" name="Physics"/>
 		</menu>
+		<menu label="Ayuda" name="DeprecatedHelp">
+			<menu_item_call label="Blog oficial" name="Official Linden Blog"/>
+			<menu_item_call label="Portal de programación" name="Scripting Portal"/>
+			<menu label="Informes de fallos" name="Bug Reporting">
+				<menu_item_call label="Public Issue Tracker" name="Public Issue Tracker"/>
+				<menu_item_call label="Ayuda del Public Issue Tracker" name="Publc Issue Tracker Help"/>
+				<menu_item_call label="Informes de fallos - instrucciones" name="Bug Reporing 101"/>
+				<menu_item_call label="Problemas de seguridad" name="Security Issues"/>
+				<menu_item_call label="Wiki QA" name="QA Wiki"/>
+			</menu>
+		</menu>
 	</menu>
 </menu_bar>
diff --git a/indra/newview/skins/default/xui/es/notifications.xml b/indra/newview/skins/default/xui/es/notifications.xml
index 3fe0072a200c0220d946758a5bae4de369ff8294..d47c3d7ad886da40e1a5d7345de4e8c80c09d69b 100644
--- a/indra/newview/skins/default/xui/es/notifications.xml
+++ b/indra/newview/skins/default/xui/es/notifications.xml
@@ -86,17 +86,38 @@ Asegúrate de que tu conexión a Internet está funcionando adecuadamente.
 		<usetemplate canceltext="Cancelar" name="yesnocancelbuttons" notext="No guardarlos" yestext="Guardarlos"/>
 	</notification>
 	<notification name="ConfirmNoCopyToOutbox">
-		No tienes permiso para copiar este objeto en el Buzón de salida de comerciante. ¿Estás seguro de que quieres mover el objeto siguiente?
-        [ITEM_NAME]
-		<usetemplate name="okcancelbuttons" notext="No" yestext="Sí"/>
+		No tienes permiso para copiar uno o varios de estos objetos en el Buzón de salida de comerciante. Puedes moverlos o dejártelos.
+		<usetemplate name="okcancelbuttons" notext="No mover objeto(s)" yestext="Mover objeto(s)"/>
 	</notification>
-	<notification name="OutboxUploadComplete">
-		Envío al mercado finalizado.
-		<usetemplate name="okbutton" yestext="¡Hurra!"/>
+	<notification name="OutboxFolderCreated">
+		Se ha creado una carpeta nueva para cada objeto que has transferido al nivel superior de tu Buzón de salida de comerciante.
+		<usetemplate ignoretext="Se ha creado una carpeta nueva en el Buzón de salida de comerciante" name="okignore" yestext="OK"/>
 	</notification>
-	<notification name="OutboxUploadHadErrors">
-		El envío al mercado ha tenido errores. Corrige los problemas de tu buzón de salida y repite la operación. Muchas gracias.
-		<usetemplate name="okbutton" yestext="Reintentar"/>
+	<notification name="OutboxImportComplete">
+		Éxito
+
+Todas las carpetas se han enviado correctamente al Mercado.
+		<usetemplate ignoretext="Todas las carpetas enviadas al Mercado" name="okignore" yestext="OK"/>
+	</notification>
+	<notification name="OutboxImportHadErrors">
+		Algunas carpetas no se han transferido
+
+Han ocurrido errores al enviar algunas carpetas al Mercado. Dichas carpetas todavía están en tu Buzón de salida de comerciante.
+
+Puedes consultar más información en el [[MARKETPLACE_IMPORTS_URL] registro de errores].
+		<usetemplate name="okbutton" yestext="OK"/>
+	</notification>
+	<notification name="OutboxImportFailed">
+		Error de transferencia
+
+No se han enviado carpetas al Mercado a causa de un error del sistema o de la red. Vuelve a intentarlo más tarde.
+		<usetemplate name="okbutton" yestext="OK"/>
+	</notification>
+	<notification name="OutboxInitFailed">
+		Error al inicializar el mercado
+
+La inicialización del mercado ha fallado por un error del sistema o de la red. Vuelve a intentarlo más tarde.
+		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="CompileQueueSaveText">
 		Hubo un problema al subir el texto de un script por la siguiente razón: [REASON]. Por favor, inténtalo más tarde.
@@ -981,7 +1002,7 @@ no tienes el permiso de comprar terreno para el grupo que tienes activado actual
 		</form>
 	</notification>
 	<notification name="RemoveFromFriends">
-		¿Quieres eliminar a [NAME] de tu lista de amigos?
+		¿Quieres eliminar a &lt;nolink&gt;[NAME]&lt;/nolink&gt; de tu lista de amigos?
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
 	</notification>
 	<notification name="RemoveMultipleFromFriends">
@@ -1114,8 +1135,13 @@ El precio de compra del terreno no se le devolverá al propietario. Si se vende
 	<notification name="DisplaySetToSafe">
 		Las configuraciones que se muestran se han fijado en los niveles guardados, pues especificaste la opción de guardarlos.
 	</notification>
-	<notification name="DisplaySetToRecommended">
-		Las configuraciones que se muestran se han fijado en los niveles recomendados para la configuración de tu sistema.
+	<notification name="DisplaySetToRecommendedGPUChange">
+		La configuración de pantalla se ha establecido en los niveles recomendados porque tu tarjeta de gráficos ha cambiado
+de &apos;[LAST_GPU]&apos;
+a &apos;[THIS_GPU]&apos;
+	</notification>
+	<notification name="DisplaySetToRecommendedFeatureChange">
+		La configuración de pantalla se ha establecido en los niveles recomendados a causa de un cambio en el subsistema de renderizado.
 	</notification>
 	<notification name="ErrorMessage">
 		[ERROR_MESSAGE]
@@ -1437,8 +1463,8 @@ Debemos reiniciar [APP_NAME] para instalar la actualización.
 		<usetemplate ignoretext="Confirmar antes de devolver objetos a sus propietarios." name="okcancelignore" notext="Cancelar" yestext="OK"/>
 	</notification>
 	<notification name="GroupLeaveConfirmMember">
-		Actualmente, eres miembro del grupo [GROUP].
-¿Dejar el grupo?
+		Actualmente perteneces al grupo &lt;nolink&gt;[GROUP]&lt;/nolink&gt;.
+¿Deseas abandonar el grupo?
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
 	</notification>
 	<notification name="ConfirmKick">
@@ -1920,7 +1946,13 @@ Dado que estos objetos tienen scripts, moverlos a tu inventario puede provocar u
 		<usetemplate ignoretext="Confirmar antes de salir" name="okcancelignore" notext="No salir" yestext="Salir"/>
 	</notification>
 	<notification name="ConfirmRestoreToybox">
-		¿Estás seguro de que quieres restaurar los botones y barras de herramientas predeterminados? 
+		Esta acción restaurará los botones y barras de herramientas predeterminados.
+
+Esta acción no se puede deshacer.
+		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
+	</notification>
+	<notification name="ConfirmClearAllToybox">
+		Esta acción volverá a colocar todos los botones a la caja de herramientas y las barras de herramientas aparecerán vacías.
     
 Esta acción no se puede deshacer.
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
@@ -2128,10 +2160,10 @@ Al hacerlo se iniciará el navegador web.
 		Asunto: [SUBJECT], Mensaje: [MESSAGE]
 	</notification>
 	<notification name="FriendOnline">
-		[NAME] está conectado
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; está conectado
 	</notification>
 	<notification name="FriendOffline">
-		[NAME] está desconectado
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; está desconectado
 	</notification>
 	<notification name="AddSelfFriend">
 		Aunque eres muy agradable, no puedes añadirte como amigo a ti mismo.
@@ -2244,14 +2276,16 @@ Por favor, selecciona un sólo objeto.
 		Se ha rehusado tu tarjeta de visita.
 	</notification>
 	<notification name="TeleportToLandmark">
-		Puedes teleportarte a lugares como &apos;[NAME]&apos; abriendo el panel Lugares -a la derecha de tu pantalla- y seleccionando la sección Hitos.
-Pulsa en un hito para seleccionarlo, y, luego, pulsa &apos;Teleportar&apos; en la parte inferior del panel.
-(También puedes pulsar dos veces en el hito o pulsarlo con el botón derecho del ratón y elegir &apos;Teleportar&apos;.)
+		Para teleportarte a lugares como &apos;[NAME]&apos;, pulsa el botón &quot;Lugares&quot;,
+    y selecciona la pestaña Hitos en la ventana que se abre. Pulsa en un
+    hito para seleccionarlo y luego pulsa &apos;Teleportar&apos; en la parte inferior de la ventana.
+    (También puedes pulsar dos veces en el hito o pulsarlo con el botón derecho del ratón y
+    elegir &apos;Teleportar&apos;.)
 	</notification>
 	<notification name="TeleportToPerson">
-		Puedes contactar con un Residente como &apos;[NAME]&apos; abriendo el panel Gente en el lado derecho de tu pantalla.
-Elige al Residente de la lista y pulsa &apos;MI&apos; en la parte inferior del panel.
-(También puedes pulsar dos veces en su nombre o pulsarlo con el botón derecho y elegir &apos;MI&apos;).
+		Para ponerte en contacto con Residentes como &apos;[NAME]&apos;, pulsa el botón &quot;Gente&quot;, selecciona un Residente en la ventana que se abre y después pulsa en &apos;MI&apos; en
+    la parte inferior de la ventana.
+    (También puedes pulsar dos veces en su nombre o pulsarlo con el botón derecho y elegir &apos;MI&apos;).
 	</notification>
 	<notification name="CantSelectLandFromMultipleRegions">
 		No puedes seleccionar un terreno que cruce las fronteras entre servidores.
@@ -2272,6 +2306,9 @@ Inténtalo seleccionando un trozo más pequeño de terreno.
 	<notification name="PaymentSent">
 		[MESSAGE]
 	</notification>
+	<notification name="PaymentFailure">
+		[MESSAGE]
+	</notification>
 	<notification name="EventNotification">
 		Notificación de un evento:
 
@@ -2526,10 +2563,10 @@ Por favor, vuelve a intentarlo en unos momentos.
 		</form>
 	</notification>
 	<notification name="FriendshipAccepted">
-		[NAME] ha aceptado tu oferta de amistad.
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; ha aceptado tu ofrecimiento de amistad.
 	</notification>
 	<notification name="FriendshipDeclined">
-		[NAME] ha rehusado tu oferta de amistad.
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; ha rechazado tu ofrecimiento de amistad.
 	</notification>
 	<notification name="FriendshipAcceptedByMe">
 		Aceptado el ofrecimiento de amistad.
@@ -2807,6 +2844,18 @@ Con los siguientes residentes:
 [RESIDENTS]
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
 	</notification>
+	<notification name="ShareFolderConfirmation">
+		Sólo puedes compartir una carpeta en cada momento.
+
+¿Estás seguro de que quieres compartir los elementos siguientes?
+
+&lt;nolink&gt;[ITEMS]&lt;/nolink&gt;
+
+Con los siguientes Residentes:
+
+[RESIDENTS]
+		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Aceptar"/>
+	</notification>
 	<notification name="ItemsShared">
 		Los elementos se han compartido correctamente.
 	</notification>
diff --git a/indra/newview/skins/default/xui/es/panel_edit_skin.xml b/indra/newview/skins/default/xui/es/panel_edit_skin.xml
index 501ecfb4de3dd6127f4c0224e43b9d2849ba313b..8d895a615218a5b1ceb2c4c25431978a6bb5b738 100644
--- a/indra/newview/skins/default/xui/es/panel_edit_skin.xml
+++ b/indra/newview/skins/default/xui/es/panel_edit_skin.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="edit_skin_panel">
 	<panel name="avatar_skin_color_panel">
-		<texture_picker label="Tatuajes de la cabeza" name="Head Tattoos" tool_tip="Pulsa para elegir una imagen"/>
-		<texture_picker label="Tatuajes superiores" name="Upper Tattoos" tool_tip="Pulsa para elegir una imagen"/>
-		<texture_picker label="Tatuajes inferiores" name="Lower Tattoos" tool_tip="Pulsa para elegir una imagen"/>
+		<texture_picker label="Cabeza" name="Head" tool_tip="Pulsa para elegir una imagen"/>
+		<texture_picker label="Parte superior del cuerpo" name="Upper Body" tool_tip="Pulsa para elegir una imagen"/>
+		<texture_picker label="Parte inferior del cuerpo" name="Lower Body" tool_tip="Pulsa para elegir una imagen"/>
 	</panel>
 	<panel name="accordion_panel">
 		<accordion name="wearable_accordion">
diff --git a/indra/newview/skins/default/xui/es/panel_my_profile.xml b/indra/newview/skins/default/xui/es/panel_my_profile.xml
deleted file mode 100644
index 29e5e6f652ed19642c33946b2bb725a4c03e86bb..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/es/panel_my_profile.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Perfil" name="panel_profile">
-	<string name="no_partner_text" value="Ninguno/a"/>
-	<string name="no_group_text" value="Ninguno"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="scroll_content_panel">
-					<panel name="second_life_image_panel">
-						<text name="display_name_descr_text">
-							Nombre de usuario
-						</text>
-						<text name="name_descr_text">
-							Nombre mostrado
-						</text>
-						<button label="Perfil" name="see_profile_btn" tool_tip="Ver el perfil de este avatar"/>
-					</panel>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/es/panel_navigation_bar.xml b/indra/newview/skins/default/xui/es/panel_navigation_bar.xml
index 1b7f5d5a9f43e9bc4c9015b453f8fa8ba7ed6a39..d36c6283bcf7be3be8b975f3e0d3f3e5f25186d2 100644
--- a/indra/newview/skins/default/xui/es/panel_navigation_bar.xml
+++ b/indra/newview/skins/default/xui/es/panel_navigation_bar.xml
@@ -3,7 +3,7 @@
 	<layout_stack name="nvp_stack">
 		<layout_panel name="navigation_layout_panel">
 			<panel name="navigation_panel">
-				<pull_button name="back_btn" tool_tip="Volver a lo localización anterior"/>
+				<pull_button name="back_btn" tool_tip="Volver a la localización anterior"/>
 				<pull_button name="forward_btn" tool_tip="Ir una localización adelante"/>
 				<button name="home_btn" tool_tip="Teleportar a mi Base"/>
 				<location_input label="Lugar" name="location_combo"/>
diff --git a/indra/newview/skins/default/xui/es/panel_nearby_chat.xml b/indra/newview/skins/default/xui/es/panel_nearby_chat.xml
index 5a852a6711851ed99e161ac8c9cca82b6027e183..4220ab3c9f8a6b90ddde81868ec4e892ee3a7b91 100644
--- a/indra/newview/skins/default/xui/es/panel_nearby_chat.xml
+++ b/indra/newview/skins/default/xui/es/panel_nearby_chat.xml
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="nearby_chat">
-	<check_box label="Traducir chat" name="translate_chat_checkbox"/>
+	<check_box label="Traducir el chat" name="translate_chat_checkbox"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/es/panel_notes.xml b/indra/newview/skins/default/xui/es/panel_notes.xml
deleted file mode 100644
index 00d4caf4685cdb16acfdf0eed6d4d4294c8dff1e..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/es/panel_notes.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Notas y Privacidad" name="panel_notes">
-	<layout_stack name="layout">
-		<layout_panel name="notes_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<text name="status_message" value="Mis notas privadas:"/>
-					<text name="status_message2" value="Permitir que esta persona:"/>
-					<check_box label="Vea si estoy conectado" name="status_check"/>
-					<check_box label="Me vea en el mapa" name="map_check"/>
-					<check_box label="Edite, borre o coja mis objetos" name="objects_check"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-		<layout_panel name="notes_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="Añadir como amigo" name="add_friend" tool_tip="Ofrecer amistad a este Residente"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="MI" name="im" tool_tip="Abrir una sesión de mensajes instantáneos"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="Llamar" name="call" tool_tip="Llamar a este Residente"/>
-				</layout_panel>
-				<layout_panel name="show_on_map_btn_lp">
-					<button label="Mapa" name="show_on_map_btn" tool_tip="Mostrar al Residente en el mapa"/>
-				</layout_panel>
-				<layout_panel name="teleport_btn_lp">
-					<button label="Teleporte" name="teleport" tool_tip="Ofrecer teleporte"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/es/panel_people.xml b/indra/newview/skins/default/xui/es/panel_people.xml
index 2fcbb00aed1f6d251010f0112cfa80871cf1a1bc..a9d38dca2502807bae6ed8b37651ad1bf088cdbd 100644
--- a/indra/newview/skins/default/xui/es/panel_people.xml
+++ b/indra/newview/skins/default/xui/es/panel_people.xml
@@ -76,7 +76,7 @@
 				<button label="Compartir" name="share_btn" tool_tip="Compartir un objeto del inventario"/>
 			</layout_panel>
 			<layout_panel name="teleport_btn_lp">
-				<button label="Teleportarte" name="teleport_btn" tool_tip="Ofrecer teleporte"/>
+				<button label="Teleporte" name="teleport_btn" tool_tip="Ofrecer teleporte"/>
 			</layout_panel>
 		</layout_stack>
 		<layout_stack name="bottom_bar_ls1">
diff --git a/indra/newview/skins/default/xui/es/panel_postcard_message.xml b/indra/newview/skins/default/xui/es/panel_postcard_message.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7316d91f5c8d554acf4fff79cee65dfe9d11d976
--- /dev/null
+++ b/indra/newview/skins/default/xui/es/panel_postcard_message.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_postcard_message">
+	<text name="to_label">
+		Hasta:
+	</text>
+	<text name="name_label">
+		Desde:
+	</text>
+	<text name="subject_label">
+		Asunto:
+	</text>
+	<line_editor label="Escribe aquí el asunto." name="subject_form"/>
+	<text name="msg_label">
+		Mensaje:
+	</text>
+	<text_editor name="msg_form">
+		Escribe aquí tu mensaje.
+	</text_editor>
+	<button label="Cancelar" name="cancel_btn"/>
+	<button label="Enviar" name="send_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/es/panel_postcard_settings.xml b/indra/newview/skins/default/xui/es/panel_postcard_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..39313194479076ff03365a8d5c12cc271493373c
--- /dev/null
+++ b/indra/newview/skins/default/xui/es/panel_postcard_settings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_postcard_settings">
+	<combo_box label="Resolución" name="postcard_size_combo">
+		<combo_box.item label="Ventana actual" name="CurrentWindow"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="Personalizado" name="Custom"/>
+	</combo_box>
+	<layout_stack name="postcard_image_params_ls">
+		<layout_panel name="postcard_image_size_lp">
+			<spinner label="Ancho" name="postcard_snapshot_width"/>
+			<spinner label="Altura" name="postcard_snapshot_height"/>
+			<check_box label="Mantener las proporciones" name="postcard_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="postcard_image_format_quality_lp">
+			<slider label="Calidad de la imagen" name="image_quality_slider"/>
+			<text name="image_quality_level">
+				([QLVL])
+			</text>
+		</layout_panel>
+	</layout_stack>
+</panel>
diff --git a/indra/newview/skins/default/xui/es/panel_preferences_chat.xml b/indra/newview/skins/default/xui/es/panel_preferences_chat.xml
index e82258556693bc24a051975804606da170919f59..aea9b9ce4ac86abfca9ead70be56efebe319b655 100644
--- a/indra/newview/skins/default/xui/es/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/es/panel_preferences_chat.xml
@@ -29,30 +29,5 @@
 	<check_box label="Chats de MI" name="EnableIMChatPopups" tool_tip="Activa esta casilla para ver una ventana emergente cada vez que recibas un mensaje instantáneo"/>
 	<spinner label="Duración de los interlocutores favoritos:" name="nearby_toasts_lifetime"/>
 	<spinner label="Tiempo de los otros interlocutores:" name="nearby_toasts_fadingtime"/>
-	<check_box name="translate_chat_checkbox"/>
-	<text name="translate_chb_label">
-		Usar en el chat el traductor automático
-	</text>
-	<text name="translate_language_text">
-		Traducir el chat al:
-	</text>
-	<combo_box name="translate_language_combobox">
-		<combo_box.item label="Predeterminado del sistema" name="System Default Language"/>
-		<combo_box.item label="English (inglés)" name="English"/>
-		<combo_box.item label="Dansk (danés)" name="Danish"/>
-		<combo_box.item label="Deutsch (alemán)" name="German"/>
-		<combo_box.item label="Español" name="Spanish"/>
-		<combo_box.item label="Français (francés)" name="French"/>
-		<combo_box.item label="Italiano (italiano)" name="Italian"/>
-		<combo_box.item label="Magyar (húngaro)" name="Hungarian"/>
-		<combo_box.item label="Nederlands (neerlandés)" name="Dutch"/>
-		<combo_box.item label="Polski (polaco)" name="Polish"/>
-		<combo_box.item label="Português (portugués)" name="Portugese"/>
-		<combo_box.item label="Русский (ruso)" name="Russian"/>
-		<combo_box.item label="Türkçe (turco)" name="Turkish"/>
-		<combo_box.item label="Українська (ucraniano)" name="Ukrainian"/>
-		<combo_box.item label="中文 (正體) (Chino)" name="Chinese"/>
-		<combo_box.item label="日本語 (japonés)" name="Japanese"/>
-		<combo_box.item label="한국어 (coreano)" name="Korean"/>
-	</combo_box>
+	<button label="Configuración de la traducción del chat" name="ok_btn"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/es/panel_preferences_setup.xml b/indra/newview/skins/default/xui/es/panel_preferences_setup.xml
index 3de18654b5ba31edbea6aa63526191fd60a91bd8..81a29dae5ad2f38e59998605925d73603e6846b7 100644
--- a/indra/newview/skins/default/xui/es/panel_preferences_setup.xml
+++ b/indra/newview/skins/default/xui/es/panel_preferences_setup.xml
@@ -15,7 +15,7 @@
 		Web:
 	</text>
 	<radio_group name="use_external_browser">
-		<radio_item label="Usar mi navegador (IE, Firefox, Safari)" name="external" tool_tip="Usa tu navegador por defecto para ayuda, enlaces web, etc. No es aconsejable si estás a pantalla completa." value="1"/>
+		<radio_item label="Usar mi navegador (IE, Firefox, Safari)" name="external" tool_tip="Usa tu navegador por defecto para ayuda, enlaces web, etc. No es aconsejable si estás a pantalla completa." value="true"/>
 		<radio_item label="Usar el navegador incorporado" name="internal" tool_tip="Usa el navegador incorporado para ayuda, enlaces web, etc. Este navegador se abre en una nueva ventana dentro de [APP_NAME]." value=""/>
 	</radio_group>
 	<check_box initial_value="true" label="Activar plugins" name="browser_plugins_enabled"/>
diff --git a/indra/newview/skins/default/xui/es/panel_profile.xml b/indra/newview/skins/default/xui/es/panel_profile.xml
deleted file mode 100644
index 334c0541af9bc7d65128a5d0f8bd1440d9597f0b..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/es/panel_profile.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Perfil" name="panel_profile">
-	<string name="CaptionTextAcctInfo">
-		[ACCTTYPE]
-[PAYMENTINFO] [AGEVERIFICATION]
-	</string>
-	<string name="payment_update_link_url">
-		http://www.secondlife.com/account/billing.php?lang=es-ES
-	</string>
-	<string name="partner_edit_link_url">
-		http://www.secondlife.com/account/partners.php?lang=es
-	</string>
-	<string name="my_account_link_url" value="http://secondlife.com/my/account/index.php?lang=es-ES"/>
-	<string name="no_partner_text" value="Ninguno"/>
-	<string name="no_group_text" value="Ninguno"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<panel name="second_life_image_panel">
-						<text name="title_sl_descr_text" value="[SECOND_LIFE]:"/>
-					</panel>
-					<panel name="first_life_image_panel">
-						<text name="title_rw_descr_text" value="Mundo real:"/>
-					</panel>
-					<text name="title_member_text" value="Residente desde:"/>
-					<text name="title_acc_status_text" value="Estado de la cuenta:"/>
-					<text name="title_partner_text" value="Compañero/a:"/>
-					<panel name="partner_data_panel">
-						<text initial_value="(obteniendo)" name="partner_text"/>
-					</panel>
-					<text name="title_groups_text" value="Grupos:"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-	<layout_stack name="layout_verb_buttons">
-		<layout_panel name="profile_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="Añadir como amigo" name="add_friend" tool_tip="Ofrecer amistad a este Residente"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="MI" name="im" tool_tip="Abrir una sesión de mensajes instantáneos"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="Llamar" name="call" tool_tip="Llamar a este Residente"/>
-				</layout_panel>
-				<layout_panel name="chat_btn_lp">
-					<button label="Teleporte" name="teleport" tool_tip="Ofrecer teleporte"/>
-				</layout_panel>
-				<layout_panel name="overflow_btn_lp">
-					<menu_button label="▼" name="overflow_btn" tool_tip="Pagar dinero al Residente o compartir algo del inventario con él"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-		<layout_panel name="profile_me_buttons_panel">
-			<button label="Editar el perfil" name="edit_profile_btn" tool_tip="Modificar tu información personal"/>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/es/panel_profile_view.xml b/indra/newview/skins/default/xui/es/panel_profile_view.xml
deleted file mode 100644
index cb374dee52f988c004edda15582ff102308d4398..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/es/panel_profile_view.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel name="panel_target_profile">
-	<string name="status_online">
-		Conectado/a
-	</string>
-	<string name="status_offline">
-		Desconectado/a
-	</string>
-	<text name="display_name_label" value="Nombre mostrado:"/>
-	<text name="solo_username_label" value="Nombre de usuario:"/>
-	<text name="status" value="Conectado/a"/>
-	<text name="user_name_small" value="Jack, ¿has visto esto? Es un nombre larguísimo."/>
-	<button name="copy_to_clipboard" tool_tip="Copiar al portapapeles"/>
-	<text name="user_label" value="Nombre de usuario:"/>
-	<tab_container name="tabs">
-		<panel label="PERFIL" name="panel_profile"/>
-		<panel label="DESTACADOS" name="panel_picks"/>
-		<panel label="NOTAS Y PRIVACIDAD" name="panel_notes"/>
-	</tab_container>
-</panel>
diff --git a/indra/newview/skins/default/xui/es/panel_region_estate.xml b/indra/newview/skins/default/xui/es/panel_region_estate.xml
index c51c3815d1146fcc5b7419c6331cf9cb1ef695fe..84c1ed7686cf9dfa68f24f1d8ac81a4a8fb49799 100644
--- a/indra/newview/skins/default/xui/es/panel_region_estate.xml
+++ b/indra/newview/skins/default/xui/es/panel_region_estate.xml
@@ -10,7 +10,7 @@
 		(desconocido)
 	</text>
 	<text name="owner_text">
-		Propietario del Estado:
+		Propietario del estado:
 	</text>
 	<text name="estate_owner">
 		(desconocido)
@@ -23,10 +23,10 @@
 	<check_box label="Permitir el acceso público" name="externally_visible_check"/>
 	<button label="?" name="externally_visible_help"/>
 	<text name="Only Allow">
-		Restringir el acceso a cuentas verificadas por:
+		Permitir únicamente el acceso a los Residentes que:
 	</text>
-	<check_box label="Información de pago aportada" name="limit_payment" tool_tip="Expulsa a los Residentes no identificados."/>
-	<check_box label="Verificación de la edad" name="limit_age_verified" tool_tip="Expulsa a los Residentes que no hayan verificado su edad. Más información en [SUPPORT_SITE]."/>
+	<check_box label="Han aportado la información de pago." name="limit_payment" tool_tip="Para poder acceder a este estado los Residentes deben haber aportado información de pago en su cuenta. Para más información, ver [SUPPORT_SITE]."/>
+	<check_box label="Han verificado su edad" name="limit_age_verified" tool_tip="Para poder acceder a este estado los Residentes deben haber verificado su edad. Para más información, ver [SUPPORT_SITE]."/>
 	<check_box label="Permitir el chat de voz" name="voice_chat_check"/>
 	<button label="?" name="voice_chat_help"/>
 	<check_box label="Permitir el teleporte a cualquier punto" name="allow_direct_teleport"/>
@@ -39,7 +39,7 @@
 	</string>
 	<button label="?" name="abuse_email_address_help"/>
 	<button label="Aplicar" name="apply_btn"/>
-	<button label="Expulsar a un Residente del Estado..." name="kick_user_from_estate_btn"/>
+	<button label="Expulsar a un Residente del estado..." name="kick_user_from_estate_btn"/>
 	<button label="Enviar un mensaje al estado..." name="message_estate_btn"/>
 	<text name="estate_manager_label">
 		Administradores del estado:
diff --git a/indra/newview/skins/default/xui/es/panel_script_ed.xml b/indra/newview/skins/default/xui/es/panel_script_ed.xml
index 46952c6974ff27ae8ef164e52ab031506ff49219..4c4077b96f0ad3b3724c915e83f0ef7735b08864 100644
--- a/indra/newview/skins/default/xui/es/panel_script_ed.xml
+++ b/indra/newview/skins/default/xui/es/panel_script_ed.xml
@@ -22,6 +22,8 @@
 		<menu label="Archivo" name="File">
 			<menu_item_call label="Guardar" name="Save"/>
 			<menu_item_call label="Deshacer todos los cambios" name="Revert All Changes"/>
+			<menu_item_call label="Cargar desde archivo..." name="LoadFromFile"/>
+			<menu_item_call label="Guardar en archivo..." name="SaveToFile"/>
 		</menu>
 		<menu label="Editar" name="Edit">
 			<menu_item_call label="Deshacer" name="Undo"/>
diff --git a/indra/newview/skins/default/xui/es/panel_snapshot_inventory.xml b/indra/newview/skins/default/xui/es/panel_snapshot_inventory.xml
new file mode 100644
index 0000000000000000000000000000000000000000..12c74b5cd1838e80ea89f4bf3fba55e97487210e
--- /dev/null
+++ b/indra/newview/skins/default/xui/es/panel_snapshot_inventory.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_inventory">
+	<text name="title">
+		Guardar en mi inventario
+	</text>
+	<text name="hint_lbl">
+		Guardar una imagen en el inventario cuesta [UPLOAD_COST] L$. Para guardar una imagen como una textura, selecciona uno de los formatos cuadrados.
+	</text>
+	<combo_box label="Resolución" name="texture_size_combo">
+		<combo_box.item label="Ventana actual" name="CurrentWindow"/>
+		<combo_box.item label="Pequeña (128x128)" name="Small(128x128)"/>
+		<combo_box.item label="Mediana (256x256)" name="Medium(256x256)"/>
+		<combo_box.item label="Grande (512x512)" name="Large(512x512)"/>
+		<combo_box.item label="Personalizado" name="Custom"/>
+	</combo_box>
+	<spinner label="Ancho" name="inventory_snapshot_width"/>
+	<spinner label="Altura" name="inventory_snapshot_height"/>
+	<check_box label="Mantener las proporciones" name="inventory_keep_aspect_check"/>
+	<button label="Cancelar" name="cancel_btn"/>
+	<button label="Guardar" name="save_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/es/panel_snapshot_local.xml b/indra/newview/skins/default/xui/es/panel_snapshot_local.xml
new file mode 100644
index 0000000000000000000000000000000000000000..08c45d2e7645a2d648abaa164d3ffdda4f51df1b
--- /dev/null
+++ b/indra/newview/skins/default/xui/es/panel_snapshot_local.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_local">
+	<text name="title">
+		Guardar en mi ordenador
+	</text>
+	<combo_box label="Resolución" name="local_size_combo">
+		<combo_box.item label="Ventana actual" name="CurrentWindow"/>
+		<combo_box.item label="320x240" name="320x240"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="1280x1024" name="1280x1024"/>
+		<combo_box.item label="1600x1200" name="1600x1200"/>
+		<combo_box.item label="Personalizado" name="Custom"/>
+	</combo_box>
+	<layout_stack name="local_image_params_ls">
+		<layout_panel name="local_image_size_lp">
+			<spinner label="Ancho" name="local_snapshot_width"/>
+			<spinner label="Altura" name="local_snapshot_height"/>
+			<check_box label="Mantener las proporciones" name="local_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="local_image_format_quality_lp">
+			<combo_box label="Formato" name="local_format_combo">
+				<combo_box.item label="PNG (sin pérdida)" name="PNG"/>
+				<combo_box.item label="JPEG" name="JPEG"/>
+				<combo_box.item label="BMP (sin pérdida)" name="BMP"/>
+			</combo_box>
+			<slider label="Calidad de la imagen" name="image_quality_slider"/>
+			<text name="image_quality_level">
+				([QLVL])
+			</text>
+		</layout_panel>
+	</layout_stack>
+	<button label="Cancelar" name="cancel_btn"/>
+	<flyout_button label="Guardar" name="save_btn" tool_tip="Guardar la imagen en un archivo">
+		<flyout_button.item label="Guardar" name="save_item"/>
+		<flyout_button.item label="Guardar como..." name="saveas_item"/>
+	</flyout_button>
+</panel>
diff --git a/indra/newview/skins/default/xui/es/panel_snapshot_options.xml b/indra/newview/skins/default/xui/es/panel_snapshot_options.xml
new file mode 100644
index 0000000000000000000000000000000000000000..2b2584f66c58bbaec68a2cae763caefde1d89a66
--- /dev/null
+++ b/indra/newview/skins/default/xui/es/panel_snapshot_options.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_options">
+	<button label="Publicar en los comentarios de Mi perfil" name="save_to_profile_btn"/>
+	<button label="Correo-e" name="save_to_email_btn"/>
+	<button label="Guardar en Mi inventario ([AMOUNT] L$)" name="save_to_inventory_btn"/>
+	<button label="Guardar en mi ordenador" name="save_to_computer_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/es/panel_snapshot_postcard.xml b/indra/newview/skins/default/xui/es/panel_snapshot_postcard.xml
new file mode 100644
index 0000000000000000000000000000000000000000..649d547ba0c3d0160780ad9af85737f394f56b8b
--- /dev/null
+++ b/indra/newview/skins/default/xui/es/panel_snapshot_postcard.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_postcard">
+	<string name="default_subject">
+		Postal desde [SECOND_LIFE].
+	</string>
+	<string name="default_message">
+		¡Mira esto!
+	</string>
+	<string name="upload_message">
+		Enviando...
+	</string>
+	<text name="title">
+		Correo-e
+	</text>
+	<button label="Mensaje" name="message_btn"/>
+	<button label="Ajustes" name="settings_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/es/panel_snapshot_profile.xml b/indra/newview/skins/default/xui/es/panel_snapshot_profile.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6a0bc22d685983e4febb7f83d63af28c1b8bbf98
--- /dev/null
+++ b/indra/newview/skins/default/xui/es/panel_snapshot_profile.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_profile">
+	<text name="title">
+		Publicar en los comentarios de Mi perfil
+	</text>
+	<combo_box label="Resolución" name="profile_size_combo">
+		<combo_box.item label="Ventana actual" name="CurrentWindow"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="Personalizado" name="Custom"/>
+	</combo_box>
+	<layout_stack name="profile_image_params_ls">
+		<layout_panel name="profile_image_size_lp">
+			<spinner label="Ancho" name="profile_snapshot_width"/>
+			<spinner label="Altura" name="profile_snapshot_height"/>
+			<check_box label="Mantener las proporciones" name="profile_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="profile_image_metadata_lp">
+			<text name="caption_label">
+				Título:
+			</text>
+			<check_box initial_value="true" label="Incluir ubicación" name="add_location_cb"/>
+		</layout_panel>
+	</layout_stack>
+	<button label="Cancelar" name="cancel_btn"/>
+	<button label="Publicar" name="post_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/es/panel_status_bar.xml b/indra/newview/skins/default/xui/es/panel_status_bar.xml
index d43790c8c6fe4cef88e71aebff2c70c825ee82d6..7eead3bc184ddb340d1d18590c79931fc3598f5c 100644
--- a/indra/newview/skins/default/xui/es/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/es/panel_status_bar.xml
@@ -15,10 +15,10 @@
 	<panel.string name="buycurrencylabel">
 		[AMT] L$
 	</panel.string>
-	<panel name="balance_bg">
+	<panel left="-410" name="balance_bg" width="200">
 		<text name="balance" tool_tip="Haz clic para actualizar tu saldo en L$" value="20 L$"/>
 		<button label="Comprar L$" name="buyL" tool_tip="Pulsa para comprar más L$"/>
-		<button label="Comprar" name="goShop" tool_tip="Abrir el mercado de Second Life"/>
+		<button label="Comprar" name="goShop" tool_tip="Abrir el mercado de Second Life" width="80"/>
 	</panel>
 	<text name="TimeText" tool_tip="Hora actual (Pacífico)">
 		24:00 AM PST
diff --git a/indra/newview/skins/default/xui/es/sidepanel_inventory.xml b/indra/newview/skins/default/xui/es/sidepanel_inventory.xml
index 79d0cb84e8990b374ccf379d9b6b78a1d1b03680..f68dcc65e390e14f882d10371beee57737e58013 100644
--- a/indra/newview/skins/default/xui/es/sidepanel_inventory.xml
+++ b/indra/newview/skins/default/xui/es/sidepanel_inventory.xml
@@ -2,47 +2,24 @@
 <panel label="Cosas" name="objects panel">
 	<panel label="" name="sidepanel__inventory_panel">
 		<layout_stack name="inventory_layout_stack">
-			<layout_panel name="inbox_outbox_layout_panel">
-				<layout_stack name="inbox_outbox_layout_stack">
-					<layout_panel name="inbox_layout_panel">
-						<panel label="" name="marketplace_inbox">
-							<string name="InboxLabelWithArg">
-								Objetos recibidos ([NUM])
-							</string>
-							<string name="InboxLabelNoArg">
-								Objetos recibidos
-							</string>
-							<button label="Objetos recibidos" name="inbox_btn"/>
-							<text name="inbox_fresh_new_count">
-								[NUM] nuevos
-							</text>
-							<panel tool_tip="Drag and drop items to your inventory to manage and use them">
-								<text name="inbox_inventory_placeholder">
-									Aquí se entregarán las compras realizadas en el mercado.
-								</text>
-							</panel>
-						</panel>
-					</layout_panel>
-					<layout_panel name="outbox_layout_panel">
-						<panel label="" name="marketplace_outbox">
-							<string name="OutboxLabelWithArg">
-								Buzón de salida de comerciante ([NUM])
-							</string>
-							<string name="OutboxLabelNoArg">
-								Buzón de salida de comerciante
-							</string>
-							<button label="Buzón de salida de comerciante" name="outbox_btn"/>
-							<button label="" name="outbox_sync_btn" tool_tip="Poner en el escaparate de Mi Mercado"/>
-							<panel>
-								<panel name="outbox_inventory_placeholder_panel">
-									<text name="outbox_inventory_placeholder_title">
-										Cargando...
-									</text>
-								</panel>
-							</panel>
-						</panel>
-					</layout_panel>
-				</layout_stack>
+			<layout_panel name="inbox_layout_panel">
+				<panel label="" name="marketplace_inbox">
+					<string name="InboxLabelWithArg">
+						Objetos recibidos ([NUM])
+					</string>
+					<string name="InboxLabelNoArg">
+						Objetos recibidos
+					</string>
+					<button label="Objetos recibidos" name="inbox_btn"/>
+					<text name="inbox_fresh_new_count">
+						[NUM] nuevos
+					</text>
+					<panel tool_tip="Drag and drop items to your inventory to manage and use them">
+						<text name="inbox_inventory_placeholder">
+							Aquí se entregarán las compras realizadas en el mercado.
+						</text>
+					</panel>
+				</panel>
 			</layout_panel>
 		</layout_stack>
 		<panel name="button_panel">
diff --git a/indra/newview/skins/default/xui/es/strings.xml b/indra/newview/skins/default/xui/es/strings.xml
index 83747b85c0318e02e23f2c7225b10b805a6c493d..67c65c6ce9a48b700356d9721951c5ed66fd1136 100644
--- a/indra/newview/skins/default/xui/es/strings.xml
+++ b/indra/newview/skins/default/xui/es/strings.xml
@@ -171,9 +171,9 @@ Actualmente, solo se permite iniciar sesión a los empleados.
 Consulta www.secondlife.com/status si deseas obtener actualizaciones.
 	</string>
 	<string name="LoginFailedPremiumOnly">
-		Se ha restringido de manera temporal el inicio de sesión en Second Life con el fin de garantizar una experiencia óptima a nuestros residentes.
-	 	
-Aquellos usuarios que dispongan de cuentas gratuitas no podrán acceder a Second Life durante este período de tiempo, ya que el propósito de esta medida es obtener espacio suficiente para los residentes que hayan pagado por acceder a Second Life.
+		Las conexiones a Second Life se han restringido provisionalmente para garantizar que los usuarios que ya están conectados tengan la mejor experiencia posible.
+
+Durante este tiempo, las personas con cuentas gratuitas no podrán acceder a Second Life, ya que tienen prioridad los usuarios con una cuenta de pago.
 	</string>
 	<string name="LoginFailedComputerProhibited">
 		No se puede acceder a Second Life desde este ordenador.
@@ -330,17 +330,35 @@ Intenta iniciar sesión de nuevo en unos instantes.
 		Aquí se puede arrastrar sólo un ítem
 	</string>
 	<string name="TooltipPrice" value="[AMOUNT] L$:"/>
+	<string name="TooltipOutboxDragToWorld">
+		No puedes colocar objetos en tu buzón de salida de comerciante
+	</string>
 	<string name="TooltipOutboxNoTransfer">
-		Uno o varios de estos objetos no se pueden vender o transferir a otro usuario.
+		Uno o varios de estos objetos no se pueden vender o transferir.
+	</string>
+	<string name="TooltipOutboxNotInInventory">
+		Tu buzón de salida de comerciante sólo puede aceptar objetos procedentes directamente de tu inventario
 	</string>
 	<string name="TooltipOutboxWorn">
-		Llevas puestos uno o más de estos objetos. Quítatelos del avatar y vuelve a intentar moverlos.
+		No puedes poner artículos que llevas puestos en el buzón de salida de comerciante
+	</string>
+	<string name="TooltipOutboxCallingCard">
+		No puedes poner tarjetas de visita en tu buzón de salida de comerciante
 	</string>
 	<string name="TooltipOutboxFolderLevels">
-		Esta carpeta tiene demasiados niveles de subcarpetas. Reorganiza las carpetas interiores de forma que tengas como máximo 4 niveles de profundidad (la carpeta raíz contiene A, que contiene B, que contiene C).
+		La profundidad de carpetas anidadas excede de 3
+	</string>
+	<string name="TooltipOutboxTooManyFolders">
+		El número de subcarpetas de la carpeta de nivel superior excede de 20
 	</string>
 	<string name="TooltipOutboxTooManyObjects">
-		Esta carpeta contiene más de 200 objetos. Guarda algunos objetos en una caja para disminuir su cantidad.
+		El número de elementos de la carpeta de nivel superior excede de 200
+	</string>
+	<string name="TooltipDragOntoOwnChild">
+		No puedes mover una carpeta a su carpeta secundaria
+	</string>
+	<string name="TooltipDragOntoSelf">
+		No puedes mover una carpeta dentro de sí misma
 	</string>
 	<string name="TooltipHttpUrl">
 		Pulsa para ver esta página web
@@ -586,6 +604,9 @@ Intenta iniciar sesión de nuevo en unos instantes.
 	<string name="mesh">
 		red
 	</string>
+	<string name="AvatarEditingAppearance">
+		(Edición de Apariencia)
+	</string>
 	<string name="AvatarAway">
 		Ausente
 	</string>
@@ -958,6 +979,9 @@ Intenta iniciar sesión de nuevo en unos instantes.
 	<string name="choose_the_directory">
 		Elegir directorio
 	</string>
+	<string name="script_files">
+		Scripts
+	</string>
 	<string name="AvatarSetNotAway">
 		Salir del estado ausente
 	</string>
@@ -1196,43 +1220,36 @@ Intenta iniciar sesión de nuevo en unos instantes.
 		No tienes en tu inventario una copia de esta textura
 	</string>
 	<string name="InventoryInboxNoItems">
-		Aquí se entregarán los objetos comprados en el mercado.
+		Aquí aparecerán algunos de los objetos que recibas, como los regalos Premium. Después puedes arrastrarlos a tu inventario.
 	</string>
 	<string name="MarketplaceURL">
-		http://marketplace.[DOMAIN_NAME]
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/
 	</string>
 	<string name="MarketplaceURL_CreateStore">
-		http://marketplace.[DOMAIN_NAME]/create_store
+		http://community.secondlife.com/t5/English-Knowledge-Base/Selling-in-the-Marketplace/ta-p/700193#Section_.4
 	</string>
-	<string name="MarketplaceURL_LearnMore">
-		http://marketplace.[DOMAIN_NAME]/learn_more
-	</string>
-	<string name="InventoryOutboxCreationErrorTitle">
-		Tu Buzón de salida de comerciante no está configurado correctamente
+	<string name="MarketplaceURL_Dashboard">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/merchants/store/dashboard
 	</string>
-	<string name="InventoryOutboxCreationErrorTooltip">
-		Error de configuración del Buzón de salida de comerciante
+	<string name="MarketplaceURL_Imports">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/merchants/store/imports
 	</string>
-	<string name="InventoryOutboxCreationError">
-		Ponte en contacto con el servicio de atención al cliente para resolver el problema.
+	<string name="MarketplaceURL_LearnMore">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/learn_more
 	</string>
 	<string name="InventoryOutboxNotMerchantTitle">
-		Cualquiera puede vender objetos en el mercado
-	</string>
-	<string name="InventoryOutboxNotMerchantTooltip">
-		¡Hazte comerciante!
+		Cualquier usuario puede vender objetos en el mercado.
 	</string>
+	<string name="InventoryOutboxNotMerchantTooltip"/>
 	<string name="InventoryOutboxNotMerchant">
-		[[MARKETPLACE_URL] El Mercado de Second Life] pone en venta más de un millón de productos virtuales, todos ellos creados por residentes. Tú también puedes vender los objetos que crees, así como algunos de los objetos que hayas comprado. Es fácil y es gratuito. [[LEARN_MORE_URL] Más información] o [[CREATE_STORE_URL] crea una tienda] en el mercado para empezar.
+		Para hacerte comerciante debes [[MARKETPLACE_CREATE_STORE_URL] crear una tienda del Mercado].
 	</string>
 	<string name="InventoryOutboxNoItemsTitle">
-		Una nueva forma para enviar objetos al mercado
-	</string>
-	<string name="InventoryOutboxNoItemsTooltip">
-		Arrastra y coloca aquí los objetos que desees preparar para venderlos en el mercado
+		El buzón de salida está vacío.
 	</string>
+	<string name="InventoryOutboxNoItemsTooltip"/>
 	<string name="InventoryOutboxNoItems">
-		Arrastra a esta zona los objetos o carpetas que desees vender. Aparecerá una copia del objeto, sin quitarlo de tu inventario, salvo que el objeto arrastrado sea &quot;no copiable&quot;. Cuando estés listo para enviar los objetos al mercado, pulsa en el botón Subir. Cuando se hayan trasladado los objetos a tu inventario en el mercado, desaparecerán de esta carpeta.
+		Arrastra carpetas a esta sección y pulsa en &quot;Enviar al Mercado&quot; para incluirlas en la lista de venta del [[MARKETPLACE_DASHBOARD_URL] Mercado].
 	</string>
 	<string name="Marketplace Error None">
 		Sin errores
@@ -1388,6 +1405,9 @@ Intenta iniciar sesión de nuevo en unos instantes.
 	<string name="no_attachments">
 		No tienes puestos anexos
 	</string>
+	<string name="Attachments remain">
+		Anexos (quedan [COUNT] ranuras)
+	</string>
 	<string name="Buy">
 		Comprar
 	</string>
@@ -1514,6 +1534,12 @@ Intenta iniciar sesión de nuevo en unos instantes.
 	<string name="Right Pec">
 		Pecho derecho
 	</string>
+	<string name="Neck">
+		Cuello
+	</string>
+	<string name="Avatar Center">
+		Centro del avatar
+	</string>
 	<string name="Invalid Attachment">
 		Punto de colocación no válido
 	</string>
@@ -3841,6 +3867,9 @@ Si sigues recibiendo este mensaje, contacta con [SUPPORT_SITE].
 	<string name="inventory_item_offered-im">
 		Ofrecido el item del inventario
 	</string>
+	<string name="share_alert">
+		Arrastra los ítems desde el invenbtario hasta aquí
+	</string>
 	<string name="no_session_message">
 		(La sesión de MI no existe)
 	</string>
@@ -3937,6 +3966,18 @@ Si sigues recibiendo este mensaje, contacta con [SUPPORT_SITE].
 	<string name="you_paid_ldollars_no_name">
 		Has pagado [AMOUNT] L$ por [REASON].
 	</string>
+	<string name="you_paid_failure_ldollars">
+		No has pagado a [NAME] [AMOUNT] L$ [REASON].
+	</string>
+	<string name="you_paid_failure_ldollars_no_info">
+		No has pagado [AMOUNT] L$.
+	</string>
+	<string name="you_paid_failure_ldollars_no_reason">
+		No has pagado a [NAME] [AMOUNT] L$.
+	</string>
+	<string name="you_paid_failure_ldollars_no_name">
+		No has pagado [AMOUNT] L$ [REASON].
+	</string>
 	<string name="for item">
 		para [ITEM]
 	</string>
@@ -3990,7 +4031,7 @@ Si sigues recibiendo este mensaje, contacta con [SUPPORT_SITE].
 	</string>
 	<string name="uploading_abuse_report">
 		Subiendo...
-  
+
 Denuncia de infracción
 	</string>
 	<string name="New Shape">
@@ -4258,7 +4299,7 @@ Denuncia de infracción
 	<string name="server_is_down">
 		Parece que hay algún problema que ha escapado a nuestros controles.
 
-	Visita status.secondlifegrid.net para ver si hay alguna incidencia conocida que esté afectando al servicio.  
+	Visita status.secondlifegrid.net para ver si hay alguna incidencia conocida que esté afectando al servicio.
         Si sigues teniendo problemas, comprueba la configuración de la red y del servidor de seguridad.
 	</string>
 	<string name="dateTimeWeekdaysNames">
@@ -4347,6 +4388,12 @@ Inténtalo incluyendo la ruta de acceso al editor entre comillas
 	<string name="ExternalEditorFailedToRun">
 		Error al ejecutar el editor externo.
 	</string>
+	<string name="TranslationFailed">
+		Error al traducir: [REASON]
+	</string>
+	<string name="TranslationResponseParseError">
+		Error al analizar la respuesta de la traducción.
+	</string>
 	<string name="Esc">
 		Esc
 	</string>
@@ -4717,7 +4764,10 @@ Inténtalo incluyendo la ruta de acceso al editor entre comillas
 		Minimapa
 	</string>
 	<string name="Command_Move_Label">
-		Moverme
+		Caminar / Correr / Volar
+	</string>
+	<string name="Command_Outbox_Label">
+		Buzón de salida de comerciante
 	</string>
 	<string name="Command_People_Label">
 		Gente
@@ -4744,10 +4794,10 @@ Inténtalo incluyendo la ruta de acceso al editor entre comillas
 		Hablar
 	</string>
 	<string name="Command_View_Label">
-		Visión
+		Controles de la cámara
 	</string>
 	<string name="Command_Voice_Label">
-		Chat de voz
+		Configuración de voz
 	</string>
 	<string name="Command_AboutLand_Tooltip">
 		Información sobre el terreno que vas a visitar
@@ -4791,6 +4841,9 @@ Inténtalo incluyendo la ruta de acceso al editor entre comillas
 	<string name="Command_Move_Tooltip">
 		Desplazando el avatar
 	</string>
+	<string name="Command_Outbox_Tooltip">
+		Transfiere objetos a tu mercado para venderlos
+	</string>
 	<string name="Command_People_Tooltip">
 		Amigos, grupos y personas próximas
 	</string>
@@ -4819,7 +4872,16 @@ Inténtalo incluyendo la ruta de acceso al editor entre comillas
 		Cambiando el ángulo de la cámara
 	</string>
 	<string name="Command_Voice_Tooltip">
-		Personas próximas con capacidad de voz
+		Controles de volumen para las llamadas y la gente que se encuentre cerca de ti en el mundo virtual
+	</string>
+	<string name="Toolbar_Bottom_Tooltip">
+		actualmente en tu barra de herramientas inferior
+	</string>
+	<string name="Toolbar_Left_Tooltip">
+		actualmente en tu barra de herramientas izquierda
+	</string>
+	<string name="Toolbar_Right_Tooltip">
+		actualmente en tu barra de herramientas derecha
 	</string>
 	<string name="Retain%">
 		% retención
@@ -4845,4 +4907,19 @@ Inténtalo incluyendo la ruta de acceso al editor entre comillas
 	<string name="Normal">
 		Normal
 	</string>
+	<string name="snapshot_quality_very_low">
+		Muy bajo
+	</string>
+	<string name="snapshot_quality_low">
+		Bajo
+	</string>
+	<string name="snapshot_quality_medium">
+		Medio
+	</string>
+	<string name="snapshot_quality_high">
+		Alto
+	</string>
+	<string name="snapshot_quality_very_high">
+		Muy alto
+	</string>
 </strings>
diff --git a/indra/newview/skins/default/xui/es/teleport_strings.xml b/indra/newview/skins/default/xui/es/teleport_strings.xml
index e785a7ac4072c6e89511f56eda8ac5cde40c32f4..a23d9c43d0feab09fef52875a844c492edda9b64 100644
--- a/indra/newview/skins/default/xui/es/teleport_strings.xml
+++ b/indra/newview/skins/default/xui/es/teleport_strings.xml
@@ -20,8 +20,8 @@ Si sigues recibiendo este mensaje, por favor, acude al [SUPPORT_SITE].
 Vuelva a intentarlo en un momento.
 		</message>
 		<message name="NoHelpIslandTP">
-		No puede teleportarse de vuelta a la Welcome Island (&apos;Isla de Ayuda&apos;).
-Vaya a la &apos;Welcome Island Public&apos; (&apos;Isla Pública de Ayuda&apos;) para repetir el tutorial.
+			No te puedes volver a teleportar a la isla de bienvenida.
+Para repetir el tutorial, visita la isla de bienvenida pública.
 		</message>
 		<message name="noaccess_tport">
 			Lo sentimos, pero no tienes acceso al destino de este teleporte.
diff --git a/indra/newview/skins/default/xui/fr/floater_about.xml b/indra/newview/skins/default/xui/fr/floater_about.xml
index 4d02513a5321dc3fad629663994a051c0c712626..4409949584129108e07a7be112e9855c28f77a7d 100644
--- a/indra/newview/skins/default/xui/fr/floater_about.xml
+++ b/indra/newview/skins/default/xui/fr/floater_about.xml
@@ -67,32 +67,34 @@ Version serveur vocal : [VOICE_VERSION]
 		<panel label="Licences" name="licenses_panel">
 			<text_editor name="credits_editor">
 				3Dconnexion SDK Copyright (C) 1992-2007 3Dconnexion
-APR Copyright (C) 2000-2004 The Apache Software Foundation
-Collada DOM Copyright 2005 Sony Computer Entertainment Inc.
-cURL Copyright (C) 1996-2002, Daniel Stenberg, (daniel@haxx.se)
-DBus/dbus-glib Copyright (C) 2002, 2003  CodeFactory AB / Copyright (C) 2003, 2004 Red Hat, Inc.
-expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
-FreeType Copyright (C) 1996-2002, The FreeType Project (www.freetype.org).
-GL Copyright (C) 1999-2004 Brian Paul.
-GLOD Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University et David Luebke, Brenden Schubert, University of Virginia.
-google-perftools Copyright (c) 2005, Google Inc.
-Havok.com(TM) Copyright (C) 1999-2001, Telekinesys Research Limited.
-jpeg2000 Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW)
-jpeglib Copyright (C) 1991-1998, Thomas G. Lane.
-ogg/vorbis Copyright (C) 2001, Xiphophorus
-OpenSSL Copyright (C) 1998-2002 The OpenSSL Project.
-PCRE Copyright (c) 1997-2008 University of Cambridge
-SDL Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
-SSLeay Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
-xmlrpc-epi Copyright (C) 2000 Epinions, Inc.
-zlib Copyright (C) 1995-2002 Jean-loup Gailly et Mark Adler.
-google-perftools Copyright (c) 2005, Google Inc.
+        APR Copyright (C) 2000-2004 The Apache Software Foundation
+        Collada DOM Copyright 2005 Sony Computer Entertainment Inc.
+        cURL Copyright (C) 1996-2002, Daniel Stenberg, (daniel@haxx.se)
+        DBus/dbus-glib Copyright (C) 2002, 2003  CodeFactory AB / Copyright (C) 2003, 2004 Red Hat, Inc.
+        expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
+        FreeType Copyright (C) 1996-2002, The FreeType Project (www.freetype.org).
+        GL Copyright (C) 1999-2004 Brian Paul.
+        GLOD Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University et David Luebke, Brenden Schubert, University of Virginia.
+        google-perftools Copyright (c) 2005, Google Inc.
+        Havok.com(TM) Copyright (C) 1999-2001, Telekinesys Research Limited.
+        jpeg2000 Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW)
+        jpeglib Copyright (C) 1991-1998, Thomas G. Lane.
+        ogg/vorbis Copyright (C) 2001, Xiphophorus
+        OpenSSL Copyright (C) 1998-2002 The OpenSSL Project.
+        PCRE Copyright (c) 1997-2008 University of Cambridge
+        SDL Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
+        SSLeay Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+        xmlrpc-epi Copyright (C) 2000 Epinions, Inc.
+        zlib Copyright (C) 1995-2002 Jean-loup Gailly et Mark Adler.
+        google-perftools Copyright (c) 2005, Google Inc.
 
-Le client Second Life utilise Havok (TM) Physics. (c)Copyright 1999-2010 Havok.com Inc. (et ses concédants de licence). Tous droits réservés. Pour plus de détails, consultez le site Web www.havok.com.
+        Le client Second Life utilise Havok (TM) Physics. (c)Copyright 1999-2010 Havok.com Inc. (et ses concédants de licence). Tous droits réservés. Pour plus de détails, consultez le site Web www.havok.com.
 
-Tous droits réservés. Voir licenses.txt pour plus d&apos;informations.
+        Ce logiciel contient du code source fourni par NVIDIA Corporation.
 
-Codage audio du chat vocal : Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C)
+        Tous droits réservés.  Voir licenses.txt pour plus d&apos;informations.
+
+        Codage audio du chat vocal : Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C)
 			</text_editor>
 		</panel>
 	</tab_container>
diff --git a/indra/newview/skins/default/xui/fr/floater_about_land.xml b/indra/newview/skins/default/xui/fr/floater_about_land.xml
index 9771c3f7fd282bc6bac7b85e3b262bab83558dee..6f8885487a07a17a7d03729a991210161abb17ab 100644
--- a/indra/newview/skins/default/xui/fr/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/fr/floater_about_land.xml
@@ -132,7 +132,7 @@
 				Trafic :
 			</text>
 			<text name="DwellText">
-				0
+				Chargement...
 			</text>
 			<button label="Acheter du terrain" label_selected="Acheter le terrain..." left_delta="60" name="Buy Land..." width="125"/>
 			<button label="Vente Linden" label_selected="Vente Linden..." name="Linden Sale..." tool_tip="Le terrain doit être la propriété d&apos;un résident, avoir un contenu défini et ne pas être aux enchères."/>
@@ -313,13 +313,15 @@ Seules les parcelles de grande taille peuvent apparaître dans la recherche.
 				Pas de bousculades (les règles de la région priment)
 			</panel.string>
 			<panel.string name="see_avs_text">
-				Voir et chatter avec les résidents sur cette parcelle
+				Les avatars sur les autres parcelles peuvent voir
 			</panel.string>
 			<text name="allow_label">
 				Autoriser les autres résidents à :
 			</text>
-			<check_box label="Modifier le terrain" name="edit land check" tool_tip="Si cette option est cochée, n&apos;importe qui peut terraformer votre terrain. Il vaut mieux ne pas cocher cette option pour toujours pouvoir modifer votre propre terrain."/>
-			<check_box label="Voler" name="check fly" tool_tip="Si cette option est cochée, les résidents peuvent voler sur votre terrain. Si elle n&apos;est pas cochée, ils ne pourront voler que lorsqu&apos;ils arrivent et passent au dessus de votre terrain."/>
+			<text name="allow_label0">
+				Voler :
+			</text>
+			<check_box label="Tous" name="check fly" tool_tip="Si cette option est cochée, les résidents peuvent voler sur votre terrain. Si elle n&apos;est pas cochée, ils ne pourront voler que lorsqu&apos;ils arrivent et passent au dessus de votre terrain."/>
 			<text name="allow_label2">
 				Construire :
 			</text>
@@ -335,9 +337,6 @@ Seules les parcelles de grande taille peuvent apparaître dans la recherche.
 			</text>
 			<check_box label="Tous" name="check other scripts"/>
 			<check_box label="Groupe" name="check group scripts"/>
-			<text name="land_options_label">
-				Options du terrain :
-			</text>
 			<check_box label="Sécurisé (pas de dégâts)" name="check safe" tool_tip="Si cette option est cochée, le terrain est sécurisé et il n&apos;y pas de risques de dommages causés par des combats. Si elle est décochée, des dommages causés par les combats peuvent avoir lieu."/>
 			<check_box label="Pas de bousculades" name="PushRestrictCheck" tool_tip="Empêche l&apos;utilisation de scripts causant des bousculades. Cette option est utile pour empêcher les comportements abusifs sur votre terrain."/>
 			<check_box label="Afficher le lieu dans la recherche (30 L$/semaine)" name="ShowDirectoryCheck" tool_tip="Afficher la parcelle dans les résultats de recherche"/>
@@ -378,9 +377,9 @@ Seules les parcelles de grande taille peuvent apparaître dans la recherche.
 			</text>
 			<texture_picker label="" name="snapshot_ctrl" tool_tip="Cliquez pour sélectionner une image"/>
 			<text name="allow_label5">
-				Autoriser les résidents sur les autres parcelles à :
+				Les avatars présents sur d&apos;autres parcelles peuvent voir et chatter avec les avatars présents sur cette parcelle.
 			</text>
-			<check_box label="Voir les avatars" name="SeeAvatarsCheck" tool_tip="Permettre aux résidents présents sur d&apos;autres parcelles de voir et chatter avec les résidents présents sur cette parcelle et vous permettre de les voir et de chatter avec eux."/>
+			<check_box label="Voir les avatars" name="SeeAvatarsCheck" tool_tip="Permettre aux avatars présents sur d&apos;autres parcelles de voir et chatter avec les avatars présents sur cette parcelle et à vous de les voir et de chatter avec eux."/>
 			<text name="landing_point">
 				Lieu d&apos;arrivée : [LANDING]
 			</text>
@@ -466,12 +465,12 @@ musique :
 			<text name="Limit access to this parcel to:">
 				Accès à cette parcelle
 			</text>
-			<check_box label="Autoriser l&apos;accès public [MATURITY]" name="public_access"/>
+			<check_box label="Autoriser l&apos;accès public (des lignes d&apos;interdiction seront créées si cette case n&apos;est pas cochée)" name="public_access"/>
 			<text name="Only Allow">
-				Limiter l&apos;accès aux résidents vérifiés par :
+				Conditions d&apos;accès des résidents :
 			</text>
-			<check_box label="Informations de paiement enregistrées [ESTATE_PAYMENT_LIMIT]" name="limit_payment" tool_tip="Bannir les résidents non identifiés."/>
-			<check_box label="Vérification de l&apos;âge [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="Bannir les résidents qui n&apos;ont pas vérifié leur âge. Consultez la page [SUPPORT_SITE] pour plus d&apos;informations."/>
+			<check_box label="Informations de paiement enregistrées [ESTATE_PAYMENT_LIMIT]" name="limit_payment" tool_tip="Pour pouvoir accéder à cette parcelle, les résidents doivent avoir enregistré des informations de paiement. Consultez le [SUPPORT_SITE] pour plus d&apos;informations."/>
+			<check_box label="Âge vérifié [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="Pour que les résidents puissent accéder à cette parcelle, leur âge doit avoir fait l&apos;objet d&apos;une vérification. Consultez le [SUPPORT_SITE] pour plus d&apos;informations."/>
 			<check_box label="Autoriser l&apos;accès au groupe : [GROUP]" name="GroupCheck" tool_tip="Définir le groupe à l&apos;onglet Général."/>
 			<check_box label="Vendre des pass à :" name="PassCheck" tool_tip="Autoriser un accès temporaire à cette parcelle"/>
 			<combo_box name="pass_combo" width="110">
diff --git a/indra/newview/skins/default/xui/fr/floater_animation_anim_preview.xml b/indra/newview/skins/default/xui/fr/floater_animation_anim_preview.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e82518ce8055749ee1100ab2ff1db779a8929abd
--- /dev/null
+++ b/indra/newview/skins/default/xui/fr/floater_animation_anim_preview.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Anim Preview" title="ANIMATION.ANIM">
+	<text name="name_label">
+		Nom :
+	</text>
+	<text name="description_label">
+		Description :
+	</text>
+	<button label="Charger ([AMOUNT] L$)" name="ok_btn"/>
+	<button label="Annuler" label_selected="Annuler" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/fr/floater_animation_bvh_preview.xml b/indra/newview/skins/default/xui/fr/floater_animation_bvh_preview.xml
new file mode 100644
index 0000000000000000000000000000000000000000..84c40b5987f38526034301bd2b80a6589338f66d
--- /dev/null
+++ b/indra/newview/skins/default/xui/fr/floater_animation_bvh_preview.xml
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Animation Preview">
+	<floater.string name="failed_to_initialize">
+		Échec de l&apos;initialisation du mouvement
+	</floater.string>
+	<floater.string name="anim_too_long">
+		La durée du fichier d&apos;animation est de [LENGTH] secondes.
+
+La limite maximale est de [MAX_LENGTH] secondes.
+	</floater.string>
+	<floater.string name="failed_file_read">
+		Impossible de lire le fichier d&apos;animation.
+
+[STATUS]
+	</floater.string>
+	<floater.string name="E_ST_OK">
+		Ok
+	</floater.string>
+	<floater.string name="E_ST_EOF">
+		Fin prématurée du fichier.
+	</floater.string>
+	<floater.string name="E_ST_NO_CONSTRAINT">
+		Impossible de lire la définition des contraintes.
+	</floater.string>
+	<floater.string name="E_ST_NO_FILE">
+		Impossible d&apos;ouvrir le fichier BVH.
+	</floater.string>
+	<floater.string name="E_ST_NO_HIER">
+		En-tête HIERARCHY non valide.
+	</floater.string>
+	<floater.string name="E_ST_NO_JOINT">
+		Impossible de trouver ROOT ou JOINT.
+	</floater.string>
+	<floater.string name="E_ST_NO_NAME">
+		Impossible d&apos;obtenir le nom JOINT.
+	</floater.string>
+	<floater.string name="E_ST_NO_OFFSET">
+		Impossible de trouver OFFSET.
+	</floater.string>
+	<floater.string name="E_ST_NO_CHANNELS">
+		CHANNELS introuvables.
+	</floater.string>
+	<floater.string name="E_ST_NO_ROTATION">
+		Impossible d&apos;obtenir l&apos;ordre de rotation.
+	</floater.string>
+	<floater.string name="E_ST_NO_AXIS">
+		Impossible d&apos;obtenir l&apos;axe de rotation.
+	</floater.string>
+	<floater.string name="E_ST_NO_MOTION">
+		Impossible de trouver MOTION.
+	</floater.string>
+	<floater.string name="E_ST_NO_FRAMES">
+		Impossible d&apos;obtenir le nombre d&apos;images.
+	</floater.string>
+	<floater.string name="E_ST_NO_FRAME_TIME">
+		Impossible d&apos;obtenir la durée des images.
+	</floater.string>
+	<floater.string name="E_ST_NO_POS">
+		Impossible d&apos;obtenir les valeurs de position.
+	</floater.string>
+	<floater.string name="E_ST_NO_ROT">
+		Impossible d&apos;obtenir les valeurs de rotation.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_FILE">
+		Impossible d&apos;ouvrir le fichier de traduction.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_HEADER">
+		Impossible de lire l&apos;en-tête de traduction.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_NAME">
+		Impossible de lire les noms de traduction.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_IGNORE">
+		Impossible de lire la valeur ignorant la traduction.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_RELATIVE">
+		Impossible de lire la valeur relative de la traduction.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_OUTNAME">
+		Impossible de lire la valeur outname de la traduction.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MATRIX">
+		Impossible de lire la matrice de traduction.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MERGECHILD">
+		Impossible d&apos;obtenir le nom mergechild.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MERGEPARENT">
+		Impossible d&apos;obtenir le nom mergeparent.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_PRIORITY">
+		Impossible d&apos;obtenir la valeur priority.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_LOOP">
+		Impossible d&apos;obtenir la valeur loop.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EASEIN">
+		Impossible d&apos;obtenir les valeurs easeIn.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EASEOUT">
+		Impossible d&apos;obtenir les valeurs easeOut.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_HAND">
+		Impossible d&apos;obtenir la valeur hand morph.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EMOTE">
+		Impossible de lire le nom emote.
+	</floater.string>
+	<floater.string name="E_ST_BAD_ROOT">
+		Nom root joint incorrect ; utiliser &quot;hip&quot;.
+	</floater.string>
+	<text name="name_label">
+		Nom :
+	</text>
+	<text name="description_label">
+		Description :
+	</text>
+	<spinner label="Priorité" name="priority" tool_tip="Contrôle quelles autres animations peuvent être remplacées par cette animation."/>
+	<check_box label="Boucle" name="loop_check" tool_tip="Entraîne la lecture en boucle de cette animation."/>
+	<spinner label="Début (%)" name="loop_in_point" tool_tip="Définit le point de l&apos;animation auquel retourne la boucle."/>
+	<spinner label="Fin (%)" name="loop_out_point" tool_tip="Définit le point de l&apos;animation auquel se termine la boucle."/>
+	<text name="hand_label">
+		Pose des mains
+	</text>
+	<combo_box name="hand_pose_combo" tool_tip="Contrôle ce que font les mains pendant l&apos;animation.">
+		<combo_box.item label="Écartées" name="Spread"/>
+		<combo_box.item label="Détendues" name="Relaxed"/>
+		<combo_box.item label="Montrer du doigt (les deux)" name="PointBoth"/>
+		<combo_box.item label="Poing" name="Fist"/>
+		<combo_box.item label="Détendue (gauche)" name="RelaxedLeft"/>
+		<combo_box.item label="Montrer du doigt (gauche)" name="PointLeft"/>
+		<combo_box.item label="Poing (gauche)" name="FistLeft"/>
+		<combo_box.item label="Détendue (droite)" name="RelaxedRight"/>
+		<combo_box.item label="Montrer du doigt (droite)" name="PointRight"/>
+		<combo_box.item label="Poing (droite)" name="FistRight"/>
+		<combo_box.item label="Salut (droite)" name="SaluteRight"/>
+		<combo_box.item label="Clavier" name="Typing"/>
+		<combo_box.item label="Paix (droite)" name="PeaceRight"/>
+	</combo_box>
+	<text name="emote_label">
+		Expression
+	</text>
+	<combo_box name="emote_combo" tool_tip="Contrôle ce que fait le visage pendant l&apos;animation.">
+		<item label="(Aucune)" name="[None]" value=""/>
+		<item label="Aaaaah" name="Aaaaah" value="Aaaaah"/>
+		<item label="Effrayé" name="Afraid" value="Effrayé"/>
+		<item label="En colère" name="Angry" value="En colère"/>
+		<item label="Grand sourire" name="BigSmile" value="Grand sourire"/>
+		<item label="Ennui" name="Bored" value="Ennui"/>
+		<item label="Pleurer" name="Cry" value="Pleurer"/>
+		<item label="Mépris" name="Disdain" value="Mépris"/>
+		<item label="Gêne" name="Embarrassed" value="Gêne"/>
+		<item label="Froncer les sourcils" name="Frown" value="Froncer les sourcils"/>
+		<item label="Embrasser" name="Kiss" value="Embrasser"/>
+		<item label="Rire" name="Laugh" value="Rire"/>
+		<item label="Tirer la langue" name="Plllppt" value="Tirer la langue"/>
+		<item label="Dégoût" name="Repulsed" value="Dégoût"/>
+		<item label="Triste" name="Sad" value="Triste"/>
+		<item label="Hausser les épaules" name="Shrug" value="Hausser les épaules"/>
+		<item label="Sourire" name="Smile" value="Sourire"/>
+		<item label="Surprise" name="Surprise" value="Surprise"/>
+		<item label="Clin d&apos;Å“il" name="Wink" value="Clin d&apos;Å“il"/>
+		<item label="Inquiétude" name="Worry" value="Inquiétude"/>
+	</combo_box>
+	<text name="preview_label">
+		Aperçu
+	</text>
+	<combo_box name="preview_base_anim" tool_tip="Permet de tester le comportement de l&apos;animation lorsque votre avatar effectue certaines actions courantes.">
+		<item label="Debout" name="Standing" value="Debout"/>
+		<item label="En marche" name="Walking" value="En marche"/>
+		<item label="Assis" name="Sitting" value="Assis"/>
+		<item label="En vol" name="Flying" value="En vol"/>
+	</combo_box>
+	<spinner label="Transition début (s)" name="ease_in_time" tool_tip="Durée (en secondes) de l&apos;entrée en fondu de l&apos;animation."/>
+	<spinner label="Transition fin (s)" name="ease_out_time" tool_tip="Durée (en secondes) de la sortie en fondu de l&apos;animation."/>
+	<button name="play_btn" tool_tip="Lire l&apos;animation."/>
+	<button name="pause_btn" tool_tip="Suspendre l&apos;animation."/>
+	<button name="stop_btn" tool_tip="Arrêter la lecture de l&apos;animation."/>
+	<text name="bad_animation_text">
+		Impossible de lire le fichier d&apos;animation.
+
+Les fichiers BVH exportés depuis Poser 4 sont recommandés.
+	</text>
+	<button label="Charger ([AMOUNT] L$)" name="ok_btn"/>
+	<button label="Annuler" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/fr/floater_avatar.xml b/indra/newview/skins/default/xui/fr/floater_avatar.xml
index cfbac66c0e16c5990d25d49102c6dbd04cb8b57f..7cbb50a3d610a6959235a656e433ed255d0503f9 100644
--- a/indra/newview/skins/default/xui/fr/floater_avatar.xml
+++ b/indra/newview/skins/default/xui/fr/floater_avatar.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Avatar" title="CHOIX D&apos;AVATAR"/>
+<floater name="Avatar" title="CHOISIR UN AVATAR"/>
diff --git a/indra/newview/skins/default/xui/fr/floater_buy_currency.xml b/indra/newview/skins/default/xui/fr/floater_buy_currency.xml
index b3acc830789adc16642aa56254fa6197368b664f..148a5a35d23b5bd33ca08bf0bf52e651e2f65167 100644
--- a/indra/newview/skins/default/xui/fr/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/fr/floater_buy_currency.xml
@@ -22,10 +22,10 @@ le Lindex...
 	<text name="currency_action">
 		Je veux acheter
 	</text>
-	<text name="currency_label" left="308">
+	<text left="308" name="currency_label">
 		L$
 	</text>
-	<line_editor label="L$" name="currency_amt" width="65" left_pad="-85">
+	<line_editor label="L$" left_pad="-85" name="currency_amt" width="65">
 		1234
 	</line_editor>
 	<text name="buying_label">
@@ -47,13 +47,13 @@ le Lindex...
 		[AMT] L$
 	</text>
 	<text name="currency_links">
-		[http://www.secondlife.com/my/account/payment_method_management.php?lang=fr-FR mode de paiement] | [http://www.secondlife.com/my/account/currency.php?lang=fr-FR devise] | [http://www.secondlife.com/my/account/exchange_rates.php?lang=fr-FR taux de change]
+		[http://www.secondlife.com/my/account/payment_method_management.php mode de paiement] | [http://www.secondlife.com/my/account/currency.php devise]
 	</text>
 	<text name="exchange_rate_note">
 		Saisissez à nouveau le montant pour voir le taux de change actuel.
 	</text>
 	<text name="purchase_warning_repurchase">
-		Confirmer cet achat n'achète que des L$, pas l'objet.
+		Confirmer cet achat n&apos;achète que des L$, pas l&apos;objet.
 	</text>
 	<text bottom_delta="16" name="purchase_warning_notenough">
 		Vous n&apos;achetez pas assez de L$. Veuillez augmenter le montant.
diff --git a/indra/newview/skins/default/xui/fr/floater_camera.xml b/indra/newview/skins/default/xui/fr/floater_camera.xml
index 97ff246c4d72b7008ff7d157287d94a9a9d18f06..f2b0ee8af3f49f29e0c4ac48c9a32be019978a5c 100644
--- a/indra/newview/skins/default/xui/fr/floater_camera.xml
+++ b/indra/newview/skins/default/xui/fr/floater_camera.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="camera_floater" title="AFFICHER">
+<floater name="camera_floater" title="PARAMÈTRES DE LA CAMÉRA">
 	<floater.string name="rotate_tooltip">
 		Faire tourner la caméra autour du point central
 	</floater.string>
@@ -9,15 +9,6 @@
 	<floater.string name="move_tooltip">
 		Déplacer la caméra vers le haut et le bas, la gauche et la droite
 	</floater.string>
-	<floater.string name="camera_modes_title">
-		Modes
-	</floater.string>
-	<floater.string name="pan_mode_title">
-		Rotation - Zoom - Panoramique
-	</floater.string>
-	<floater.string name="presets_mode_title">
-		Préréglages
-	</floater.string>
 	<floater.string name="free_mode_title">
 		Voir l&apos;objet
 	</floater.string>
diff --git a/indra/newview/skins/default/xui/fr/floater_chat_bar.xml b/indra/newview/skins/default/xui/fr/floater_chat_bar.xml
index 88a2fb669b84c62102a3fe050e8bbfdb3cd39102..890411d09182c28bcebbeb3b7f0d9c4dca6011d3 100644
--- a/indra/newview/skins/default/xui/fr/floater_chat_bar.xml
+++ b/indra/newview/skins/default/xui/fr/floater_chat_bar.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="chat_bar" title="CHAT PRÈS DE MOI">
-	<panel>
-		<line_editor label="Cliquer ici pour chatter." name="chat_box" tool_tip="Appuyer sur Entrée pour dire, Ctrl-Entrée pour crier"/>
-		<button name="show_nearby_chat" tool_tip="Affiche/Masque le journal de chats près de vous"/>
+	<panel name="bottom_panel">
+		<line_editor label="Cliquer ici pour chatter." name="chat_box" tool_tip="Appuyer sur Entrée pour dire, Ctrl+Entrée pour crier"/>
+		<button name="show_nearby_chat" tool_tip="Afficher/masquer le journal de chat près de vous."/>
 	</panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/fr/floater_hardware_settings.xml b/indra/newview/skins/default/xui/fr/floater_hardware_settings.xml
index 8ad301823bf2ea8f8888d6267d608edf6f50aa61..2bc76e0c632501de04281d2017b485b3a5009f07 100644
--- a/indra/newview/skins/default/xui/fr/floater_hardware_settings.xml
+++ b/indra/newview/skins/default/xui/fr/floater_hardware_settings.xml
@@ -4,7 +4,7 @@
 		Filtres :
 	</text>
 	<check_box label="Filtre anisotrope (plus lent si activé)" name="ani"/>
-	<text name="Antialiasing:">
+	<text name="antialiasing label">
 		Anti-aliasing :
 	</text>
 	<combo_box label="Anti-aliasing" name="fsaa" width="84">
diff --git a/indra/newview/skins/default/xui/fr/floater_merchant_outbox.xml b/indra/newview/skins/default/xui/fr/floater_merchant_outbox.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b491dd6aed368839398f0a6281d2c4e7e7970631
--- /dev/null
+++ b/indra/newview/skins/default/xui/fr/floater_merchant_outbox.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_merchant_outbox" title="BOÃŽTE D&apos;ENVOI VENDEUR">
+	<string name="OutboxFolderCount1">
+		1 dossier
+	</string>
+	<string name="OutboxFolderCountN">
+		[NUM] dossiers
+	</string>
+	<string name="OutboxImporting">
+		Envoi de dossiers...
+	</string>
+	<string name="OutboxInitializing">
+		Initialisation...
+	</string>
+	<panel label="">
+		<panel>
+			<panel name="outbox_inventory_placeholder_panel">
+				<text name="outbox_inventory_placeholder_title">
+					Chargement...
+				</text>
+			</panel>
+		</panel>
+		<panel>
+			<button label="Envoyer vers la Place du marché" name="outbox_import_btn" tool_tip="Vers ma vitrine de la Place du marché"/>
+		</panel>
+	</panel>
+</floater>
diff --git a/indra/newview/skins/default/xui/fr/floater_model_preview.xml b/indra/newview/skins/default/xui/fr/floater_model_preview.xml
index a26deb1aefdf66b84bb976a8c14e68fd76ed88b3..a3b50351ae44dc4d0a07eec01b0f8e3016c48e10 100644
--- a/indra/newview/skins/default/xui/fr/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/fr/floater_model_preview.xml
@@ -4,6 +4,9 @@
 	<string name="status_parse_error">
 		Erreur : Problème d&apos;analyse de fichier .dae ; reportez-vous au journal pour plus de détails.
 	</string>
+	<string name="status_material_mismatch">
+		Erreur : le matériau du modèle ne correspond pas à un sous-ensemble du modèle de référence.
+	</string>
 	<string name="status_reading_file">
 		Chargement...
 	</string>
@@ -137,7 +140,7 @@
 				</panel>
 				<panel name="physics analysis">
 					<text name="method_label">
-						Étape 2 : Analyse
+						Étape 2 : Analyser
 					</text>
 					<text name="analysis_method_label">
 						Moyen :
diff --git a/indra/newview/skins/default/xui/fr/floater_model_wizard.xml b/indra/newview/skins/default/xui/fr/floater_model_wizard.xml
index cd2eb761ec1aaad9ebe9a334215d60571f7d23f7..128b9d6fa40af3486a149e85fde5299618f16eea 100644
--- a/indra/newview/skins/default/xui/fr/floater_model_wizard.xml
+++ b/indra/newview/skins/default/xui/fr/floater_model_wizard.xml
@@ -6,12 +6,12 @@
 	<button label="2. Optimisation" name="optimize_btn"/>
 	<button label="1. Sélection du fichier" name="choose_file_btn"/>
 	<panel name="choose_file_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="choose_file_header_panel">
+			<text name="choose_file_header_text">
 				Choisir un fichier de modèle
 			</text>
 		</panel>
-		<panel name="content">
+		<panel name="choose_file_content">
 			<text name="advanced_users_text">
 				Utilisateurs expérimentés : si vous êtes habitué à utiliser des outils de création de contenu en 3D, l&apos;outil de chargement avancé est mis à votre disposition.
 			</text>
@@ -20,6 +20,9 @@
 				Choisir un fichier de modèle à charger
 			</text>
 			<button label="Parcourir..." label_selected="Parcourir..." name="browse"/>
+			<text name="Model types">
+				Second Life prend en charge les fichiers COLLADA (.dae).
+			</text>
 			<text name="dimensions">
 				X         Y         Z
 			</text>
@@ -27,20 +30,20 @@
 				AVERTISSEMENT :
 			</text>
 			<text name="warning_text">
-				Vous ne pourrez pas effectuer l&apos;étape de chargement finale du modèle sur les serveurs Second Life. [secondlife:///app/floater/learn_more Découvrez comment] configurer votre compte pour les chargements de modèle de maillage.
+				Vous ne pourrez pas effectuer l&apos;étape de chargement finale du modèle sur les serveurs Second Life. [secondlife:///app/floater/learn_more Découvrez comment] configurer votre compte pour le chargement de modèles de maillage.
 			</text>
 		</panel>
 	</panel>
 	<panel name="optimize_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="optimize_header_panel">
+			<text name="optimize_header_text">
 				Optimiser le modèle
 			</text>
 		</panel>
-		<text name="description">
+		<text name="optimize_description">
 			Le modèle a été optimisé en termes de performances. Vous pouvez l&apos;ajuster si vous le souhaitez.
 		</text>
-		<panel name="content">
+		<panel name="optimize_content">
 			<text name="high_detail_text">
 				Générer le niveau de détail : Élevé
 			</text>
@@ -76,15 +79,15 @@
 		</panel>
 	</panel>
 	<panel name="physics_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="physics_header_panel">
+			<text name="physics_header_text">
 				Ajuster les propriétés physiques
 			</text>
 		</panel>
-		<text name="description">
+		<text name="physics_description">
 			Une forme va être créée pour l&apos;enveloppe externe du modèle. Ajustez le niveau de détail de la forme en fonction de l&apos;objectif souhaité pour votre modèle.
 		</text>
-		<panel name="content">
+		<panel name="physics_content">
 			<button label="Recalcul physique" name="recalculate_physics_btn"/>
 			<button label="Recalcul en cours..." name="recalculating_physics_btn"/>
 			<text name="lod_label">
@@ -107,12 +110,12 @@
 		</panel>
 	</panel>
 	<panel name="review_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="review_header_panel">
+			<text name="review_header_text">
 				Vérification
 			</text>
 		</panel>
-		<panel name="content">
+		<panel name="review_content">
 			<text name="review_prim_equiv">
 				Impact sur la parcelle/région : équivalent à [EQUIV] prims
 			</text>
@@ -125,8 +128,8 @@
 		</panel>
 	</panel>
 	<panel name="upload_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="upload_header_panel">
+			<text name="upload_header_text">
 				Chargement terminé
 			</text>
 		</panel>
diff --git a/indra/newview/skins/default/xui/fr/floater_moveview.xml b/indra/newview/skins/default/xui/fr/floater_moveview.xml
index 0b0ec5184681e1dfcd2b2a267ca560b5c61e99a6..853af2afdff3182968e3edfb58806dc79a5f73ff 100644
--- a/indra/newview/skins/default/xui/fr/floater_moveview.xml
+++ b/indra/newview/skins/default/xui/fr/floater_moveview.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="move_floater" title="BOUGER">
+<floater name="move_floater" title="MARCHER / COURIR / VOLER">
 	<string name="walk_forward_tooltip">
 		Marcher en avant (appuyer sur la flèche vers le haut ou W)
 	</string>
diff --git a/indra/newview/skins/default/xui/fr/floater_object_weights.xml b/indra/newview/skins/default/xui/fr/floater_object_weights.xml
index f1b063a3da5cbe30cacf6cc2196a487c1f6a8b05..2667188308cba72c29382007dd09b956d3bd58fb 100644
--- a/indra/newview/skins/default/xui/fr/floater_object_weights.xml
+++ b/indra/newview/skins/default/xui/fr/floater_object_weights.xml
@@ -1,28 +1,28 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="object_weights" title="AVANCÉ">
 	<floater.string name="nothing_selected" value="--"/>
-	<text name="selected_text" value="SELECTIONNÉ"/>
+	<text name="selected_text" value="SÉLECTION"/>
 	<text name="objects" value="--"/>
 	<text name="objects_label" value="Objets"/>
 	<text name="prims" value="--"/>
 	<text name="prims_label" value="Prims"/>
-	<text name="weights_of_selected_text" value="POIDS DES OBJETS SELECTIONNÉS"/>
+	<text name="weights_of_selected_text" value="POIDS DE LA SÉLECTION"/>
 	<text name="download" value="--"/>
-	<text name="download_label" value="Télécharger"/>
+	<text name="download_label" value="Téléchargement"/>
 	<text name="physics" value="--"/>
-	<text name="physics_label" value="Propriétés physiques"/>
+	<text name="physics_label" value="Physique"/>
 	<text name="server" value="--"/>
 	<text name="server_label" value="Serveur"/>
 	<text name="display" value="--"/>
-	<text name="display_label" value="Afficher"/>
+	<text name="display_label" value="Affichage"/>
 	<text name="land_impacts_text" value="IMPACTS SUR LE TERRAIN"/>
 	<text name="selected" value="--"/>
 	<text name="selected_label" value="Sélection"/>
 	<text name="rezzed_on_land" value="--"/>
-	<text name="rezzed_on_land_label" value="Rezzé sur le terrain"/>
+	<text name="rezzed_on_land_label" value="Rezzés sur le terrain"/>
 	<text name="remaining_capacity" value="--"/>
 	<text name="remaining_capacity_label" value="Capacité restante"/>
 	<text name="total_capacity" value="--"/>
 	<text name="total_capacity_label" value="Capacité totale"/>
-	<text name="help_SLURL" value="[secondlife:///app/help/object_weights What is all this?...]"/>
+	<text name="help_SLURL" value="[secondlife:///app/help/object_weights De quoi s&apos;agit-il ?...]"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/fr/floater_preview_animation.xml b/indra/newview/skins/default/xui/fr/floater_preview_animation.xml
index a9407abfde3e055198f3475db9bc1515790ebce8..f2cb1d5e70eb0ade6fa6c54e65fbc74d1e4c9e2f 100644
--- a/indra/newview/skins/default/xui/fr/floater_preview_animation.xml
+++ b/indra/newview/skins/default/xui/fr/floater_preview_animation.xml
@@ -6,6 +6,6 @@
 	<text name="desc txt">
 		Description :
 	</text>
-	<button label="Jouer dans Second Life" label_selected="Stop" name="Anim play btn" tool_tip="Lire cette animation de façon à ce que les autres puissent la voir" width="131"/>
-	<button label="Jouer localement" label_selected="Stop" left="160" name="Anim audition btn" tool_tip="Lire cette animation de façon à ce que vous soyez la seule personne à pouvoir la voir" width="120"/>
+	<button label="Exécuter dans Second Life" label_selected="Arrêter" name="Inworld" tool_tip="Lire cette animation de façon à ce que les autres la voient."/>
+	<button label="Exécuter localement" label_selected="Arrêter" name="Locally" tool_tip="Lire cette animation de façon à ce que vous soyez la seule personne à la voir."/>
 </floater>
diff --git a/indra/newview/skins/default/xui/fr/floater_snapshot.xml b/indra/newview/skins/default/xui/fr/floater_snapshot.xml
index 34d0957b4614e9cc3342525abfb61a7a8b5945ec..9244051edce7308e7617d390bab018ba4a13a936 100644
--- a/indra/newview/skins/default/xui/fr/floater_snapshot.xml
+++ b/indra/newview/skins/default/xui/fr/floater_snapshot.xml
@@ -1,75 +1,65 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Snapshot" title="APERÇU DE LA PHOTO" width="247">
+<floater name="Snapshot" title="APERÇU DE LA PHOTO">
 	<floater.string name="unknown">
 		inconnu
 	</floater.string>
-	<radio_group label="Type de photo" name="snapshot_type_radio">
-		<radio_item label="E-mail" name="postcard"/>
-		<radio_item label="Mon inventaire ([AMOUNT] L$)" name="texture"/>
-		<radio_item label="Enregistrer sur mon ordinateur" name="local"/>
-	</radio_group>
+	<string name="postcard_progress_str">
+		Envoi par e-mail
+	</string>
+	<string name="profile_progress_str">
+		Publication
+	</string>
+	<string name="inventory_progress_str">
+		Enregistrement dans l&apos;inventaire
+	</string>
+	<string name="local_progress_str">
+		Enregistrement sur l&apos;ordinateur
+	</string>
+	<string name="profile_succeeded_str">
+		Image chargée
+	</string>
+	<string name="postcard_succeeded_str">
+		Envoi par e-mail effectué !
+	</string>
+	<string name="inventory_succeeded_str">
+		Enregistrement dans l&apos;inventaire effectué !
+	</string>
+	<string name="local_succeeded_str">
+		Enregistrement sur l&apos;ordinateur effectué !
+	</string>
+	<string name="profile_failed_str">
+		Échec de chargement de l&apos;image sur le flux de votre profil.
+	</string>
+	<string name="postcard_failed_str">
+		Échec d&apos;envoi par e-mail.
+	</string>
+	<string name="inventory_failed_str">
+		Échec d&apos;enregistrement dans l&apos;inventaire.
+	</string>
+	<string name="local_failed_str">
+		Échec d&apos;enregistrement sur l&apos;ordinateur.
+	</string>
+	<button name="advanced_options_btn" tool_tip="Options avancées"/>
+	<text name="image_res_text">
+		[WIDTH] x [HEIGHT] px
+	</text>
 	<text name="file_size_label">
 		[SIZE] Ko
 	</text>
-	<button label="Rafraîchir" name="new_snapshot_btn"/>
-	<button label="Envoyer" name="send_btn"/>
-	<button label="Enreg. ([AMOUNT] L$)" name="upload_btn"/>
-	<flyout_button label="Enregistrer" name="save_btn" tool_tip="Enregistrer l&apos;image sous forme de fichier">
-		<flyout_button.item label="Enregistrer" name="save_item"/>
-		<flyout_button.item label="Enregistrer sous..." name="saveas_item"/>
-	</flyout_button>
-	<button label="Plus" name="more_btn" tool_tip="Options avancées"/>
-	<button label="Moins" name="less_btn" tool_tip="Options avancées"/>
-	<button label="Annuler" name="discard_btn"/>
-	<text name="type_label2">
-		Taille
-	</text>
-	<text name="format_label">
-		Format
-	</text>
-	<combo_box label="Résolution" name="postcard_size_combo">
-		<combo_box.item label="Fenêtre actuelle" name="CurrentWindow"/>
-		<combo_box.item label="640 x 480" name="640x480"/>
-		<combo_box.item label="800 x 600" name="800x600"/>
-		<combo_box.item label="1 024 x 768" name="1024x768"/>
-		<combo_box.item label="Personnalisée" name="Custom"/>
-	</combo_box>
-	<combo_box label="Résolution" name="texture_size_combo">
-		<combo_box.item label="Fenêtre actuelle" name="CurrentWindow"/>
-		<combo_box.item label="Petite (128 x 128)" name="Small(128x128)"/>
-		<combo_box.item label="Moyenne (256 x 256)" name="Medium(256x256)"/>
-		<combo_box.item label="Grande (512 x 512)" name="Large(512x512)"/>
-		<combo_box.item label="Personnalisée" name="Custom"/>
-	</combo_box>
-	<combo_box label="Résolution" name="local_size_combo">
-		<combo_box.item label="Fenêtre actuelle" name="CurrentWindow"/>
-		<combo_box.item label="320 x 240" name="320x240"/>
-		<combo_box.item label="640 x 480" name="640x480"/>
-		<combo_box.item label="800 x 600" name="800x600"/>
-		<combo_box.item label="1 024 x 768" name="1024x768"/>
-		<combo_box.item label="1 280 x 1 024" name="1280x1024"/>
-		<combo_box.item label="1 600 x 1 200" name="1600x1200"/>
-		<combo_box.item label="Personnalisée" name="Custom"/>
-	</combo_box>
-	<combo_box label="Format" name="local_format_combo">
-		<combo_box.item label="PNG" name="PNG"/>
-		<combo_box.item label="JPEG" name="JPEG"/>
-		<combo_box.item label="BMP" name="BMP"/>
-	</combo_box>
-	<spinner label="Larg." name="snapshot_width"/>
-	<spinner label="Haut." name="snapshot_height"/>
-	<check_box label="Contraindre les proportions" name="keep_aspect_check"/>
-	<slider label="Qualité de l&apos;image" name="image_quality_slider"/>
-	<text name="layer_type_label">
-		Capturer :
-	</text>
-	<combo_box label="Couches d&apos;images" name="layer_types">
-		<combo_box.item label="Couleurs" name="Colors"/>
-		<combo_box.item label="Profondeur" name="Depth"/>
-	</combo_box>
-	<check_box label="Interface" name="ui_check"/>
-	<check_box label="HUD" name="hud_check"/>
-	<check_box label="Garder ouvert après enregistrement" name="keep_open_check"/>
-	<check_box label="Arrêt sur image (plein écran)" name="freeze_frame_check"/>
-	<check_box label="Actualisation automatique" name="auto_snapshot_check"/>
+	<panel name="advanced_options_panel">
+		<text name="advanced_options_label">
+			OPTIONS AVANCÉES
+		</text>
+		<text name="layer_type_label">
+			Capturer :
+		</text>
+		<combo_box label="Couches d&apos;images" name="layer_types">
+			<combo_box.item label="Couleurs" name="Colors"/>
+			<combo_box.item label="Profondeur" name="Depth"/>
+		</combo_box>
+		<check_box label="Interface" name="ui_check"/>
+		<check_box label="HUD" name="hud_check"/>
+		<check_box label="Arrêt sur image (plein écran)" name="freeze_frame_check"/>
+		<check_box label="Actualisation automatique" name="auto_snapshot_check"/>
+	</panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/fr/floater_stats.xml b/indra/newview/skins/default/xui/fr/floater_stats.xml
index a74a338bd713dfc15464e00acba116bd82bfbec3..2ce2e6dcd55d89aa17d959581e16856427b8b6d3 100644
--- a/indra/newview/skins/default/xui/fr/floater_stats.xml
+++ b/indra/newview/skins/default/xui/fr/floater_stats.xml
@@ -38,7 +38,7 @@
 			<stat_view label="Simulateur" name="sim">
 				<stat_bar label="Dilatation temporelle" name="simtimedilation"/>
 				<stat_bar label="FPS sim" name="simfps"/>
-				<stat_bar label="Propriétés physiques FPS" name="simphysicsfps"/>
+				<stat_bar label="FPS physique" name="simphysicsfps"/>
 				<stat_view label="Détails des propriétés physiques" name="physicsdetail">
 					<stat_bar label="Objets fixés" name="physicspinnedtasks"/>
 					<stat_bar label="Objets LOD faibles" name="physicslodtasks"/>
@@ -53,17 +53,17 @@
 				<stat_bar label="Événements de scripts" name="simscripteps"/>
 				<stat_bar label="Paquets en entrée" name="siminpps"/>
 				<stat_bar label="Paquets en sortie" name="simoutpps"/>
-				<stat_bar label="En attente des téléchargements" name="simpendingdownloads"/>
-				<stat_bar label="En attente des chargements" name="simpendinguploads"/>
+				<stat_bar label="Téléchargements en attente" name="simpendingdownloads"/>
+				<stat_bar label="Chargements en attente" name="simpendinguploads"/>
 				<stat_bar label="Total Unacked Bytes" name="simtotalunackedbytes"/>
 				<stat_view label="Temps (ms)" name="simperf">
-					<stat_bar label="Durée du cadre totale" name="simframemsec"/>
+					<stat_bar label="Durée totale de l'image" name="simframemsec"/>
 					<stat_bar label="Durée nette" name="simnetmsec"/>
-					<stat_bar label="Durée physique" name="simsimphysicsmsec"/>
-					<stat_bar label="Durée de la simulation" name="simsimothermsec"/>
-					<stat_bar label="Durée de l&apos;avatar" name="simagentmsec"/>
+					<stat_bar label="Durée sim (physique)" name="simsimphysicsmsec"/>
+					<stat_bar label="Durée sim (autre)" name="simsimothermsec"/>
+					<stat_bar label="Durée des avatars" name="simagentmsec"/>
 					<stat_bar label="Durée des images" name="simimagesmsec"/>
-					<stat_bar label="Durée du script" name="simscriptmsec"/>
+					<stat_bar label="Durée des scripts" name="simscriptmsec"/>
 					<stat_bar label="Temps d&apos;inactivité" name="simsparemsec"/>
 					<stat_view label="Détails Temps (ms)" name="timedetails">
 						<stat_bar label="Etape propr. physiques" name="simsimphysicsstepmsec"/>
diff --git a/indra/newview/skins/default/xui/fr/floater_test_layout_stacks.xml b/indra/newview/skins/default/xui/fr/floater_test_layout_stacks.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b479d5f6d6bbc342a4c4bb9a33199290356156d9
--- /dev/null
+++ b/indra/newview/skins/default/xui/fr/floater_test_layout_stacks.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Test Floater" title="LAYOUTSTACK TESTS"/>
diff --git a/indra/newview/skins/default/xui/fr/floater_test_text_vertical_aligment.xml b/indra/newview/skins/default/xui/fr/floater_test_text_vertical_aligment.xml
new file mode 100644
index 0000000000000000000000000000000000000000..702170ef524a9d1accfff8ca2697c5f197b574fa
--- /dev/null
+++ b/indra/newview/skins/default/xui/fr/floater_test_text_vertical_aligment.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Test Floater" title="FLOATER TEST"/>
diff --git a/indra/newview/skins/default/xui/fr/floater_tools.xml b/indra/newview/skins/default/xui/fr/floater_tools.xml
index 1ecf47f2e5ec9df792f5e3a726e6ed9fab898997..e21c6f4c08e78b30110e09d6461706aa09e8e09a 100644
--- a/indra/newview/skins/default/xui/fr/floater_tools.xml
+++ b/indra/newview/skins/default/xui/fr/floater_tools.xml
@@ -1,5 +1,20 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="toolbox floater" short_title="OUTILS POUR LA CONSTRUCTION" title="">
+	<floater.string name="grid_screen_text">
+		Écran
+	</floater.string>
+	<floater.string name="grid_local_text">
+		Local
+	</floater.string>
+	<floater.string name="grid_world_text">
+		Monde
+	</floater.string>
+	<floater.string name="grid_reference_text">
+		Référence
+	</floater.string>
+	<floater.string name="grid_attachment_text">
+		Élément attaché
+	</floater.string>
 	<floater.string name="status_rotate">
 		Pour faire tourner l&apos;objet, faites glisser les bandes de couleur.
 	</floater.string>
@@ -63,7 +78,12 @@
 	</text>
 	<check_box initial_value="true" label="Étirer les textures" name="checkbox stretch textures"/>
 	<check_box initial_value="true" label="Fixer" name="checkbox snap to grid"/>
-	<button label="Options..." label_selected="Options..." name="Options..." tool_tip="Afficher d&apos;autres options de grille"/>
+	<combo_box name="combobox grid mode" tool_tip="Choisir le type d&apos;axe de grille pour le positionnement de l&apos;objet.">
+		<combo_box.item label="Monde" name="World"/>
+		<combo_box.item label="Local" name="Local"/>
+		<combo_box.item label="Référence" name="Reference"/>
+	</combo_box>
+	<button label="" label_selected="Options..." name="Options..." tool_tip="Afficher d&apos;autres options de grille"/>
 	<button label="" label_selected="" name="ToolCube" tool_tip="Cube"/>
 	<button label="" label_selected="" name="ToolPrism" tool_tip="Prisme droit"/>
 	<button label="" label_selected="" name="ToolPyramid" tool_tip="Pyramide"/>
@@ -106,7 +126,7 @@
 		Aucune sélection effectuée.
 	</text>
 	<text name="remaining_capacity">
-		[CAPACITY_STRING] [secondlife:///app/openfloater/object_weights More info]
+		[CAPACITY_STRING] [secondlife:///app/openfloater/object_weights Plus d&apos;infos]
 	</text>
 	<tab_container name="Object Info Tabs">
 		<panel label="Général" name="General">
diff --git a/indra/newview/skins/default/xui/fr/floater_toybox.xml b/indra/newview/skins/default/xui/fr/floater_toybox.xml
index e6fa212c65089758eef8f08fb1ca4f77df2c31bd..f99d3d30b5885ca38230b253bf7b1263ddb54a9e 100644
--- a/indra/newview/skins/default/xui/fr/floater_toybox.xml
+++ b/indra/newview/skins/default/xui/fr/floater_toybox.xml
@@ -1,10 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Toybox" title="PERSONNALISER LA BARRE D&apos;OUTILS">
+<floater name="Toybox" title="BOUTONS DES BARRES D&apos;OUTILS">
 	<text name="toybox label 1">
-		Ajouter ou supprimer des boutons en les faisant glisser vers les barres d&apos;outils ou à partir de ces dernières.
+		Ajouter ou supprimer des boutons : les faire glisser vers ou depuis les barres d&apos;outils.
 	</text>
 	<text name="toybox label 2">
-		Les boutons s&apos;afficheront comme indiqué ou comme des icônes, en fonction des paramètres de chaque barre d&apos;outils.
+		Ils s&apos;afficheront comme indiqué ou comme des icônes, selon les paramètres de barre d&apos;outils.
 	</text>
-	<button label="Restaurer les choix par défaut" label_selected="Restaurer les choix par défaut" name="btn_restore_defaults"/>
+	<button label="Effacer tout" label_selected="Effacer tout" name="btn_clear_all"/>
+	<button label="Valeurs par défaut" label_selected="Valeurs par défaut" name="btn_restore_defaults"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/fr/floater_translation_settings.xml b/indra/newview/skins/default/xui/fr/floater_translation_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c7582f110f6390fd87ac6b56419bd35e32b1638d
--- /dev/null
+++ b/indra/newview/skins/default/xui/fr/floater_translation_settings.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_translation_settings" title="TRADUCTION AUTOMATIQUE">
+	<string name="bing_api_key_not_verified">
+		ID d&apos;application Bing non vérifié. Veuillez réessayer.
+	</string>
+	<string name="google_api_key_not_verified">
+		Clé d&apos;API Google non vérifiée. Veuillez réessayer.
+	</string>
+	<string name="bing_api_key_verified">
+		ID d&apos;application Bing vérifié.
+	</string>
+	<string name="google_api_key_verified">
+		Clé d&apos;API Google vérifiée.
+	</string>
+	<check_box label="Activer la traduction automatique lors des chats" name="translate_chat_checkbox"/>
+	<text name="translate_language_label">
+		Traduire les chats en :
+	</text>
+	<combo_box name="translate_language_combo">
+		<combo_box.item label="Langue système par défaut" name="System Default Language"/>
+		<combo_box.item label="English (Anglais)" name="English"/>
+		<combo_box.item label="Dansk (Danois)" name="Danish"/>
+		<combo_box.item label="Deutsch (Allemand)" name="German"/>
+		<combo_box.item label="Español (Espagnol)" name="Spanish"/>
+		<combo_box.item label="Français" name="French"/>
+		<combo_box.item label="Italiano (Italien)" name="Italian"/>
+		<combo_box.item label="Magyar (Hongrois)" name="Hungarian"/>
+		<combo_box.item label="Nederlands (Néerlandais)" name="Dutch"/>
+		<combo_box.item label="Polski (Polonais)" name="Polish"/>
+		<combo_box.item label="Português (Portugais)" name="Portugese"/>
+		<combo_box.item label="Русский (Russe)" name="Russian"/>
+		<combo_box.item label="Türkçe (Turc)" name="Turkish"/>
+		<combo_box.item label="Українська (Ukrainien)" name="Ukrainian"/>
+		<combo_box.item label="中文 (正體) (Chinois)" name="Chinese"/>
+		<combo_box.item label="日本語 (Japonais)" name="Japanese"/>
+		<combo_box.item label="한국어 (Coréen)" name="Korean"/>
+	</combo_box>
+	<text name="tip">
+		Choisir le service à utiliser :
+	</text>
+	<radio_group name="translation_service_rg">
+		<radio_item initial_value="bing" label="Bing Translator" name="bing"/>
+		<radio_item initial_value="google" label="Google Translate" name="google"/>
+	</radio_group>
+	<text name="bing_api_key_label">
+		[http://www.bing.com/developers/createapp.aspx ID d&apos;application] Bing :
+	</text>
+	<button label="Vérifier" name="verify_bing_api_key_btn"/>
+	<text name="google_api_key_label">
+		[http://code.google.com/apis/language/translate/v2/getting_started.html#auth Clé d&apos;API] Google :
+	</text>
+	<button label="Vérifier" name="verify_google_api_key_btn"/>
+	<text name="google_links_text">
+		[http://code.google.com/apis/language/translate/v2/pricing.html Tarification] | [https://code.google.com/apis/console Statistiques]
+	</text>
+	<button label="OK" name="ok_btn"/>
+	<button label="Annuler" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/fr/floater_voice_controls.xml b/indra/newview/skins/default/xui/fr/floater_voice_controls.xml
index 2b2bb8bbe3256ae51fc68b03960b2d0a49c89e28..fc4de4a5a6d16799efe7684159c7aa5824a39a86 100644
--- a/indra/newview/skins/default/xui/fr/floater_voice_controls.xml
+++ b/indra/newview/skins/default/xui/fr/floater_voice_controls.xml
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="floater_voice_controls" title="CONTROLES DE LA VOIX">
 	<string name="title_nearby">
-		Chat près de vous
+		PARAMÈTRES VOCAUX
 	</string>
 	<string name="title_group">
-		Appel de groupe avec [GROUP]
+		APPEL DE GROUPE AVEC [GROUP]
 	</string>
 	<string name="title_adhoc">
-		Téléconférence
+		CONFÉRENCE
 	</string>
 	<string name="title_peer_2_peer">
-		Appel avec [NAME]
+		APPEL AVEC [NAME]
 	</string>
 	<string name="no_one_near">
 		Il n&apos;y a personne près de vous avec le chat vocal activé
diff --git a/indra/newview/skins/default/xui/fr/floater_voice_effect.xml b/indra/newview/skins/default/xui/fr/floater_voice_effect.xml
index 92ee6ecf24f875ef91f8dc8091fc103f7aabd773..671fb5c14db16b31120104fe2ba635538e8a4172 100644
--- a/indra/newview/skins/default/xui/fr/floater_voice_effect.xml
+++ b/indra/newview/skins/default/xui/fr/floater_voice_effect.xml
@@ -42,13 +42,16 @@
 	<string name="effect_Demon">
 		Démon
 	</string>
+	<string name="effect_Female Elf">
+		Femme elfe
+	</string>
 	<string name="effect_Flirty">
 		Flirt
 	</string>
 	<string name="effect_Foxy">
 		Séduction
 	</string>
-	<string name="effect_Halloween_2010_Bonus">
+	<string name="effect_Halloween 2010 Bonus">
 		Halloween_2010_Bonus
 	</string>
 	<string name="effect_Helium">
@@ -57,9 +60,18 @@
 	<string name="effect_Husky">
 		Rauque
 	</string>
+	<string name="effect_Husky Whisper">
+		Murmure rauque
+	</string>
 	<string name="effect_Intercom">
 		Interphone
 	</string>
+	<string name="effect_Julia">
+		Julia
+	</string>
+	<string name="effect_Lo Lilt">
+		Mélodieux
+	</string>
 	<string name="effect_Macho">
 		Macho
 	</string>
@@ -69,6 +81,9 @@
 	<string name="effect_Mini">
 		Mini
 	</string>
+	<string name="effect_Model">
+		Modèle
+	</string>
 	<string name="effect_Nano">
 		Nano
 	</string>
@@ -90,6 +105,9 @@
 	<string name="effect_Roxanne">
 		Roxanne
 	</string>
+	<string name="effect_Rumble">
+		Grondement
+	</string>
 	<string name="effect_Sabrina">
 		Sabrina
 	</string>
@@ -102,6 +120,9 @@
 	<string name="effect_Shorty">
 		Petite voix
 	</string>
+	<string name="effect_Smaller">
+		Plus faible
+	</string>
 	<string name="effect_Sneaky">
 		Sournois
 	</string>
diff --git a/indra/newview/skins/default/xui/fr/menu_group_plus.xml b/indra/newview/skins/default/xui/fr/menu_group_plus.xml
index 0db5afedc795c54c793826fbd8752defc25c5785..ad76f11d79744908af0fc233cc589eefa4bf5a16 100644
--- a/indra/newview/skins/default/xui/fr/menu_group_plus.xml
+++ b/indra/newview/skins/default/xui/fr/menu_group_plus.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="menu_group_plus">
-	<menu_item_call label="Rejoindre des groupes..." name="item_join"/>
+	<menu_item_call label="Rejoindre un groupe..." name="item_join"/>
 	<menu_item_call label="Nouveau groupe..." name="item_new"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/fr/menu_inspect_object_gear.xml b/indra/newview/skins/default/xui/fr/menu_inspect_object_gear.xml
index 074bb54cdc512824bf538283af811694d7e2f007..f3b974aba582e2c6ffaae695f50823431803cc2a 100644
--- a/indra/newview/skins/default/xui/fr/menu_inspect_object_gear.xml
+++ b/indra/newview/skins/default/xui/fr/menu_inspect_object_gear.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<menu name="Gear Menu">
+<toggleable_menu name="Gear Menu">
 	<menu_item_call label="Toucher" name="touch"/>
 	<menu_item_call label="M&apos;asseoir" name="sit"/>
 	<menu_item_call label="Payer" name="pay"/>
@@ -12,7 +12,8 @@
 	<menu_item_call label="Ajouter" name="add"/>
 	<menu_item_call label="Signaler" name="report"/>
 	<menu_item_call label="Ignorer" name="block"/>
+	<menu_item_call label="Ne plus ignorer" name="unblock"/>
 	<menu_item_call label="Zoomer en avant" name="zoom_in"/>
 	<menu_item_call label="Supprimer" name="remove"/>
 	<menu_item_call label="En savoir plus" name="more_info"/>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/fr/menu_inventory.xml b/indra/newview/skins/default/xui/fr/menu_inventory.xml
index 53df8d11da0ebb91b5f27b3e5a4b1058ae2ee0f6..59dcff907556df80dcf24dbde73ffaa3363a9e36 100644
--- a/indra/newview/skins/default/xui/fr/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/fr/menu_inventory.xml
@@ -59,6 +59,7 @@
 	<menu_item_call label="Propriétés" name="Properties"/>
 	<menu_item_call label="Renommer" name="Rename"/>
 	<menu_item_call label="Copier l&apos;UUID (identifiant universel unique)" name="Copy Asset UUID"/>
+	<menu_item_call label="Couper" name="Cut"/>
 	<menu_item_call label="Copier" name="Copy"/>
 	<menu_item_call label="Coller" name="Paste"/>
 	<menu_item_call label="Coller comme lien" name="Paste As Link"/>
@@ -71,7 +72,7 @@
 	<menu_item_call label="Jouer dans Second Life" name="Animation Play"/>
 	<menu_item_call label="Jouer localement" name="Animation Audition"/>
 	<menu_item_call label="Envoyer un message instantané" name="Send Instant Message"/>
-	<menu_item_call label="Offrir de téléporter..." name="Offer Teleport..."/>
+	<menu_item_call label="Proposer une téléportation..." name="Offer Teleport..."/>
 	<menu_item_call label="Démarrer le chat conférence" name="Conference Chat"/>
 	<menu_item_call label="Activer" name="Activate"/>
 	<menu_item_call label="Désactiver" name="Deactivate"/>
@@ -84,6 +85,6 @@
 	<menu_item_call label="Ajouter" name="Wearable Add"/>
 	<menu_item_call label="Enlever" name="Take Off"/>
 	<menu_item_call label="Copier vers la boîte d&apos;envoi vendeur" name="Merchant Copy"/>
-	<menu_item_call label="Déplacer vers la boîte d&apos;envoi vendeur" name="Merchant Move"/>
+	<menu_item_call label="Envoyer vers la Place du marché" name="Marketplace Send"/>
 	<menu_item_call label="--aucune option--" name="--no options--"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/fr/menu_login.xml b/indra/newview/skins/default/xui/fr/menu_login.xml
index 8210c1be514626832b553039399a8d88c2d5b6ac..dc6b2793caefbe4990d4c2016e060ff4888f087e 100644
--- a/indra/newview/skins/default/xui/fr/menu_login.xml
+++ b/indra/newview/skins/default/xui/fr/menu_login.xml
@@ -17,8 +17,8 @@
 		<menu_item_call label="Définir la taille de la fenêtre..." name="Set Window Size..."/>
 		<menu_item_call label="Afficher les conditions d&apos;utilisation" name="TOS"/>
 		<menu_item_call label="Afficher le message critique" name="Critical"/>
-		<menu_item_call label="Test du navigateur de médias" name="Web Browser Test"/>
 		<menu_item_call label="Test de débogage de la fenêtre flottante du contenu Web" name="Web Content Floater Debug Test"/>
+		<menu label="Définir le niveau de connexion" name="Set Logging Level"/>
 		<menu_item_check label="Afficher le sélecteur de grille" name="Show Grid Picker"/>
 		<menu_item_call label="Afficher la console des notifications" name="Show Notifications Console"/>
 	</menu>
diff --git a/indra/newview/skins/default/xui/fr/menu_people_nearby_view_sort.xml b/indra/newview/skins/default/xui/fr/menu_people_nearby_view_sort.xml
index 0aad174fbdb25316f25b7993158dc464c7b589c9..8bb466b8d6ed444006dab85cc1a185da3cc1d8ea 100644
--- a/indra/newview/skins/default/xui/fr/menu_people_nearby_view_sort.xml
+++ b/indra/newview/skins/default/xui/fr/menu_people_nearby_view_sort.xml
@@ -5,5 +5,5 @@
 	<menu_item_check label="Trier par distance" name="sort_distance"/>
 	<menu_item_check label="Afficher les icônes des résidents" name="view_icons"/>
 	<menu_item_check label="Afficher la carte" name="view_map"/>
-	<menu_item_call label="Afficher les résidents et les objets interdits" name="show_blocked_list"/>
+	<menu_item_call label="Afficher les résidents et les objets ignorés" name="show_blocked_list"/>
 </toggleable_menu>
diff --git a/indra/newview/skins/default/xui/fr/menu_toolbars.xml b/indra/newview/skins/default/xui/fr/menu_toolbars.xml
index bbfbe4b9ed4804ea3706d91f9bf6eceb4ebfcfa4..f74d206d562893b229508aba8aa724c40a35112a 100644
--- a/indra/newview/skins/default/xui/fr/menu_toolbars.xml
+++ b/indra/newview/skins/default/xui/fr/menu_toolbars.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Toolbars Popup">
-	<menu_item_call label="Choisir les boutons..." name="Chose Buttons"/>
-	<menu_item_check label="Icônes et étiquettes" name="icons_with_text"/>
+	<menu_item_call label="Supprimer ce bouton" name="Remove button"/>
+	<menu_item_call label="Boutons des barres d&apos;outils..." name="Choose Buttons"/>
+	<menu_item_check label="Icônes et libellés" name="icons_with_text"/>
 	<menu_item_check label="Icônes uniquement" name="icons_only"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/fr/menu_viewer.xml b/indra/newview/skins/default/xui/fr/menu_viewer.xml
index 64cd463070adb266e125323e955572ff0a79dbe6..3c3d4f5f6940104d92dcf95b59213dd02c5ebaa8 100644
--- a/indra/newview/skins/default/xui/fr/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/fr/menu_viewer.xml
@@ -1,55 +1,60 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu_bar name="Main Menu">
 	<menu label="Moi" name="Me">
-		<menu_item_call label="Page d&apos;accueil..." name="Manage My Account">
-			<menu_item_call.on_click name="ManageMyAccount_url" parameter="WebLaunchJoinNow,http://secondlife.com/account/index.php?lang=fr"/>
-		</menu_item_call>
 		<menu_item_call label="Profil..." name="Profile"/>
 		<menu_item_call label="Apparence..." name="ChangeOutfit"/>
+		<menu_item_call label="Choisir un avatar..." name="Avatar Picker"/>
 		<menu_item_check label="Inventaire..." name="Inventory"/>
-		<menu_item_check label="Gestes..." name="Gestures"/>
-		<menu_item_check label="Chat vocal..." name="ShowVoice"/>
+		<menu_item_call label="Nouvelle fenêtre d&apos;inventaire" name="NewInventoryWindow"/>
+		<menu_item_call label="Endroits..." name="Places"/>
+		<menu_item_call label="Favoris..." name="Picks"/>
+		<menu_item_call label="Paramètres de la caméra..." name="Camera Controls"/>
 		<menu label="Déplacement" name="Movement">
 			<menu_item_call label="M&apos;asseoir" name="Sit Down Here"/>
 			<menu_item_check label="Voler" name="Fly"/>
 			<menu_item_check label="Toujours courir" name="Always Run"/>
 			<menu_item_call label="Arrêter mon animation" name="Stop Animating My Avatar"/>
+			<menu_item_call label="Marcher / Courir / Voler..." name="Walk / run / fly"/>
 		</menu>
 		<menu label="Statut" name="Status">
 			<menu_item_call label="Absent" name="Set Away"/>
 			<menu_item_call label="Occupé" name="Set Busy"/>
 		</menu>
-		<menu_item_call label="Demander le statut Admin" name="Request Admin Options"/>
-		<menu_item_call label="Quitter le statut Admin" name="Leave Admin Options"/>
-		<menu_item_call label="Acheter des L$" name="Buy and Sell L$"/>
+		<menu_item_call label="Acheter des L$..." name="Buy and Sell L$"/>
+		<menu_item_call label="Boîte d&apos;envoi vendeur..." name="MerchantOutbox"/>
+		<menu_item_call label="Page d&apos;accueil du compte..." name="Manage My Account">
+			<menu_item_call.on_click name="ManageMyAccount_url" parameter="WebLaunchJoinNow,http://secondlife.com/account/index.php?lang=fr"/>
+		</menu_item_call>
 		<menu_item_call label="Préférences..." name="Preferences"/>
-		<menu_item_call label="Barres d&apos;outils..." name="Toolbars"/>
-		<menu_item_call label="Cacher tous les contrôles" name="Hide UI"/>
+		<menu_item_call label="Boutons des barres d&apos;outils..." name="Toolbars"/>
+		<menu_item_call label="Masquer tous les contrôles" name="Hide UI"/>
 		<menu_item_call label="Quitter [APP_NAME]" name="Quit"/>
 	</menu>
 	<menu label="Communiquer" name="Communicate">
-		<menu_item_call label="Mes amis" name="My Friends"/>
-		<menu_item_call label="Mes groupes" name="My Groups"/>
-		<menu_item_check label="Chat près de moi" name="Nearby Chat"/>
-		<menu_item_call label="Personnes près de moi" name="Active Speakers"/>
-		<menu_item_check label="Chat vocal près de vous" name="Nearby Voice"/>
+		<menu_item_check label="Chat..." name="Nearby Chat"/>
+		<menu_item_check label="Parler" name="Speak"/>
+		<menu_item_check label="Paramètres vocaux..." name="Nearby Voice"/>
+		<menu_item_check label="Effet de voix..." name="ShowVoice"/>
+		<menu_item_check label="Gestes..." name="Gestures"/>
+		<menu_item_call label="Amis" name="My Friends"/>
+		<menu_item_call label="Groupes" name="My Groups"/>
+		<menu_item_call label="Personnes près de vous" name="Active Speakers"/>
 	</menu>
 	<menu label="Monde" name="World">
-		<menu_item_check label="Mini-carte" name="Mini-Map"/>
+		<menu_item_call label="Créer un repère pour ce lieu" name="Create Landmark Here"/>
+		<menu_item_call label="Destinations..." name="Destinations"/>
 		<menu_item_check label="Carte du monde" name="World Map"/>
+		<menu_item_check label="Mini-carte" name="Mini-Map"/>
 		<menu_item_check label="Rechercher" name="Search"/>
+		<menu_item_call label="Me téléporter chez moi" name="Teleport Home"/>
+		<menu_item_call label="Définir le domicile ici" name="Set Home to Here"/>
 		<menu_item_call label="Photo" name="Take Snapshot"/>
-		<menu_item_call label="Créer un repère pour ce lieu" name="Create Landmark Here"/>
-		<menu label="Profil du lieu" name="Land">
-			<menu_item_call label="Profil du lieu" name="Place Profile"/>
-			<menu_item_call label="À propos du terrain" name="About Land"/>
-			<menu_item_call label="Région/Domaine" name="Region/Estate"/>
-		</menu>
+		<menu_item_call label="Profil du lieu" name="Place Profile"/>
+		<menu_item_call label="À propos du terrain" name="About Land"/>
+		<menu_item_call label="Région/Domaine" name="Region/Estate"/>
+		<menu_item_call label="Mes terrains..." name="My Land"/>
 		<menu_item_call label="Acheter ce terrain" name="Buy Land"/>
-		<menu_item_call label="Mes terrains" name="My Land"/>
 		<menu label="Afficher" name="LandShow">
-			<menu_item_check label="Contrôles de mouvement" name="Movement Controls"/>
-			<menu_item_check label="Contrôles d’affichage" name="Camera Controls"/>
 			<menu_item_check label="Lignes d&apos;interdiction" name="Ban Lines"/>
 			<menu_item_check label="Balises" name="beacons"/>
 			<menu_item_check label="Limites du terrain" name="Property Lines"/>
@@ -58,16 +63,15 @@
 			<menu_item_check label="Propriétés de la parcelle" name="Parcel Properties"/>
 			<menu_item_check label="Menu Avancé" name="Show Advanced Menu"/>
 		</menu>
-		<menu_item_call label="Me téléporter chez moi" name="Teleport Home"/>
-		<menu_item_call label="Définir le domicile ici" name="Set Home to Here"/>
-		<menu label="Luminosité" name="Environment Settings">
+		<menu label="Luminosité" name="Sun">
 			<menu_item_call label="Aube" name="Sunrise"/>
 			<menu_item_call label="Milieu de journée" name="Noon"/>
 			<menu_item_call label="Coucher de soleil" name="Sunset"/>
 			<menu_item_call label="Minuit" name="Midnight"/>
+			<menu_item_call label="Utiliser les réglages de la région" name="Use Region Settings"/>
 		</menu>
-		<menu label="Éditeur d&apos;environnement" name="Enviroment Editor">
-			<menu_item_call label="Paramètres d&apos;environnement..." name="Enviroment Settings"/>
+		<menu label="Éditeur d&apos;environnement" name="Environment Editor">
+			<menu_item_call label="Paramètres d&apos;environnement..." name="Environment Settings"/>
 			<menu label="Préréglages de l&apos;eau" name="Water Presets">
 				<menu_item_call label="Nouveau préréglage..." name="new_water_preset"/>
 				<menu_item_call label="Modifier un préréglage..." name="edit_water_preset"/>
@@ -140,11 +144,13 @@
 			<menu_item_call label="Animation ([COST] L$)..." name="Upload Animation"/>
 			<menu_item_call label="Modèle..." name="Upload Model"/>
 			<menu_item_call label="Lot ([COST] L$ par fichier)..." name="Bulk Upload"/>
+			<menu_item_call label="Définir les droits de chargement par défaut" name="perm prefs"/>
 		</menu>
 		<menu_item_call label="Annuler" name="Undo"/>
 		<menu_item_call label="Refaire" name="Redo"/>
 	</menu>
 	<menu label="Aide" name="Help">
+		<menu_item_call label="Aide rapide..." name="How To"/>
 		<menu_item_call label="Aide de [SECOND_LIFE]" name="Second Life Help"/>
 		<menu_item_call label="Signaler une infraction" name="Report Abuse"/>
 		<menu_item_call label="Signaler un bug" name="Report Bug"/>
@@ -172,22 +178,22 @@
 			<menu_item_check label="Afficher le réticule de la vue subjective" name="ShowCrosshairs"/>
 		</menu>
 		<menu label="Types de rendu" name="Rendering Types">
-			<menu_item_check label="Simple" name="Simple"/>
-			<menu_item_check label="Alpha" name="Alpha"/>
-			<menu_item_check label="Arbre" name="Tree"/>
-			<menu_item_check label="Avatars" name="Character"/>
-			<menu_item_check label="Patch de surface" name="Surface Patch"/>
-			<menu_item_check label="Ciel" name="Sky"/>
-			<menu_item_check label="Eau" name="Water"/>
-			<menu_item_check label="Sol" name="Ground"/>
-			<menu_item_check label="Volume" name="Volume"/>
-			<menu_item_check label="Herbe" name="Grass"/>
-			<menu_item_check label="Nuages" name="Clouds"/>
-			<menu_item_check label="Particules" name="Particles"/>
-			<menu_item_check label="Placage de relief" name="Bump"/>
+			<menu_item_check label="Simple" name="Rendering Type Simple"/>
+			<menu_item_check label="Alpha" name="Rendering Type Alpha"/>
+			<menu_item_check label="Arbre" name="Rendering Type Tree"/>
+			<menu_item_check label="Avatars" name="Rendering Type Character"/>
+			<menu_item_check label="Patch de surface" name="Rendering Type Surface Patch"/>
+			<menu_item_check label="Ciel" name="Rendering Type Sky"/>
+			<menu_item_check label="Eau" name="Rendering Type Water"/>
+			<menu_item_check label="Sol" name="Rendering Type Ground"/>
+			<menu_item_check label="Volume" name="Rendering Type Volume"/>
+			<menu_item_check label="Herbe" name="Rendering Type Grass"/>
+			<menu_item_check label="Nuages" name="Rendering Type Clouds"/>
+			<menu_item_check label="Particules" name="Rendering Type Particles"/>
+			<menu_item_check label="Placage de relief" name="Rendering Type Bump"/>
 		</menu>
 		<menu label="Fonctionnalités de rendu" name="Rendering Features">
-			<menu_item_check label="Interface" name="UI"/>
+			<menu_item_check label="Interface" name="ToggleUI"/>
 			<menu_item_check label="Sélection" name="Selected"/>
 			<menu_item_check label="En surbrillance" name="Highlighted"/>
 			<menu_item_check label="Textures dynamiques" name="Dynamic Textures"/>
@@ -199,11 +205,8 @@
 		<menu_item_check label="Utiliser le thread de lecture de plug-in" name="Use Plugin Read Thread"/>
 		<menu_item_call label="Effacer le cache du groupe" name="ClearGroupCache"/>
 		<menu_item_check label="Effet de lissage de la souris" name="Mouse Smoothing"/>
+		<menu_item_call label="Libérer les touches" name="Release Keys"/>
 		<menu label="Raccourcis" name="Shortcuts">
-			<menu_item_call label="Image ([COST] L$)..." name="Upload Image"/>
-			<menu_item_check label="Rechercher" name="Search"/>
-			<menu_item_call label="Relâcher les touches" name="Release Keys"/>
-			<menu_item_call label="Taille de l&apos;interface par défaut" name="Set UI Size to Default"/>
 			<menu_item_check label="Afficher le menu Avancé - raccourci existant" name="Show Advanced Menu - legacy shortcut"/>
 			<menu_item_call label="Fermer la fenêtre" name="Close Window"/>
 			<menu_item_call label="Fermer toutes les fenêtres" name="Close All Windows"/>
@@ -212,13 +215,6 @@
 			<menu_item_check label="Joystick Flycam" name="Joystick Flycam"/>
 			<menu_item_call label="Réinitialiser la vue" name="Reset View"/>
 			<menu_item_call label="Regarder la dernière conversation" name="Look at Last Chatter"/>
-			<menu label="Sélectionner un outil de construction" name="Select Tool">
-				<menu_item_call label="Outil de mise au point" name="Focus"/>
-				<menu_item_call label="Outil de déplacement" name="Move"/>
-				<menu_item_call label="Outil de modification" name="Edit"/>
-				<menu_item_call label="Outil de création" name="Create"/>
-				<menu_item_call label="Outil Terrain" name="Land"/>
-			</menu>
 			<menu_item_call label="Zoomer en avant" name="Zoom In"/>
 			<menu_item_call label="Zoom par défaut" name="Zoom Default"/>
 			<menu_item_call label="Zoomer en arrière" name="Zoom Out"/>
@@ -289,7 +285,9 @@
 			<menu_item_check label="Lumières" name="Lights"/>
 			<menu_item_check label="Squelette de collision" name="Collision Skeleton"/>
 			<menu_item_check label="Rayons" name="Raycast"/>
+			<menu_item_check label="Vecteurs de vent" name="Wind Vectors"/>
 			<menu_item_check label="Complexité du rendu" name="rendercomplexity"/>
+			<menu_item_check label="Octets d&apos;éléments attachés" name="attachment bytes"/>
 			<menu_item_check label="Sculpture" name="Sculpt"/>
 		</menu>
 		<menu label="Rendu" name="Rendering">
@@ -301,7 +299,6 @@
 			<menu_item_check label="Éclairage et ombres" name="Lighting and Shadows"/>
 			<menu_item_check label="Ombres du soleil/de la lune/des projecteurs" name="Shadows from Sun/Moon/Projectors"/>
 			<menu_item_check label="SSAO et lissage des ombres" name="SSAO and Shadow Smoothing"/>
-			<menu_item_check label="Illumination globale (expérimental)" name="Global Illumination"/>
 			<menu_item_check label="Débogage GL" name="Debug GL"/>
 			<menu_item_check label="Débogage pipeline" name="Debug Pipeline"/>
 			<menu_item_check label="Masques alpha automatiques (différés)" name="Automatic Alpha Masks (deferred)"/>
@@ -319,7 +316,7 @@
 			<menu_item_check label="Pauser l&apos;avatar" name="AgentPause"/>
 			<menu_item_call label="Activer le journal des messages" name="Enable Message Log"/>
 			<menu_item_call label="Désactiver le journal des messages" name="Disable Message Log"/>
-			<menu_item_check label="Velocity Interpolate Objects" name="Velocity Interpolate Objects"/>
+			<menu_item_check label="Objets d&apos;interpolation de vitesse" name="Velocity Interpolate Objects"/>
 			<menu_item_check label="Interpolation ping des positions des objets" name="Ping Interpolate Object Positions"/>
 			<menu_item_call label="Abandonner un paquet" name="Drop a Packet"/>
 		</menu>
@@ -332,11 +329,10 @@
 			<menu_item_call label="Commencer l&apos;enregistrement" name="Start Record"/>
 			<menu_item_call label="Arrêter l&apos;enregistrement" name="Stop Record"/>
 		</menu>
-		<menu label="Monde" name="World">
+		<menu label="Monde" name="DevelopWorld">
 			<menu_item_check label="Ignorer les paramètres du soleil de la sim" name="Sim Sun Override"/>
-			<menu_item_check label="Balise animée" name="Cheesy Beacon"/>
 			<menu_item_check label="Météo fixe" name="Fixed Weather"/>
-			<menu_item_call label="Dump Region Object Cache" name="Dump Region Object Cache"/>
+			<menu_item_call label="Vidage de cache d&apos;objet de la région" name="Dump Region Object Cache"/>
 		</menu>
 		<menu label="Interface" name="UI">
 			<menu_item_call label="Test du navigateur de médias" name="Web Browser Test"/>
@@ -366,11 +362,11 @@
 		</menu>
 		<menu label="Avatar" name="Character">
 			<menu label="Récupérer la texture fixée" name="Grab Baked Texture">
-				<menu_item_call label="Iris" name="Iris"/>
-				<menu_item_call label="Tête" name="Head"/>
-				<menu_item_call label="Haut du corps" name="Upper Body"/>
-				<menu_item_call label="Bas du corps" name="Lower Body"/>
-				<menu_item_call label="Jupe" name="Skirt"/>
+				<menu_item_call label="Iris" name="Grab Iris"/>
+				<menu_item_call label="Tête" name="Grab Head"/>
+				<menu_item_call label="Haut du corps" name="Grab Upper Body"/>
+				<menu_item_call label="Bas du corps" name="Grab Lower Body"/>
+				<menu_item_call label="Jupe" name="Grab Skirt"/>
 			</menu>
 			<menu label="Tests personnages" name="Character Tests">
 				<menu_item_call label="Apparence dans XML" name="Appearance To XML"/>
@@ -398,20 +394,28 @@
 		<menu_item_check label="Textures HTTP" name="HTTP Textures"/>
 		<menu_item_check label="Inventaire HTTP" name="HTTP Inventory"/>
 		<menu_item_call label="Compresser les images" name="Compress Images"/>
+		<menu_item_call label="Activer Visual Leak Detector" name="Enable Visual Leak Detector"/>
 		<menu_item_check label="Output Debug Minidump" name="Output Debug Minidump"/>
 		<menu_item_check label="Console Window on next Run" name="Console Window"/>
+		<menu label="Définir le niveau de connexion" name="Set Logging Level">
+			<menu_item_check label="Débogage" name="Debug"/>
+			<menu_item_check label="Infos" name="Info"/>
+			<menu_item_check label="Avertissement" name="Warning"/>
+			<menu_item_check label="Erreur" name="Error"/>
+			<menu_item_check label="Aucun" name="None"/>
+		</menu>
 		<menu_item_call label="Demander le statut Admin" name="Request Admin Options"/>
 		<menu_item_call label="Quitter le statut Admin" name="Leave Admin Options"/>
 		<menu_item_check label="Afficher le menu Admin" name="View Admin Options"/>
 	</menu>
 	<menu label="Admin" name="Admin">
-		<menu label="Object">
-			<menu_item_call label="Prendre une copie" name="Take Copy"/>
-			<menu_item_call label="Téléporter le propriétaire" name="Force Owner To Me"/>
+		<menu label="Objet" name="AdminObject">
+			<menu_item_call label="Prendre une copie" name="Admin Take Copy"/>
+			<menu_item_call label="Me faire devenir propriétaire" name="Force Owner To Me"/>
 			<menu_item_call label="Forcer la permission du propriétaire" name="Force Owner Permissive"/>
 			<menu_item_call label="Supprimer" name="Delete"/>
 			<menu_item_call label="Verrouiller" name="Lock"/>
-			<menu_item_call label="Obtenir les ID d&apos;actifs" name="Get Assets IDs"/>
+			<menu_item_call label="Obtenir les ID des actifs" name="Get Assets IDs"/>
 		</menu>
 		<menu label="Parcelle" name="Parcel">
 			<menu_item_call label="Téléporter le propriétaire" name="Owner To Me"/>
@@ -442,10 +446,10 @@
 			<menu_item_call label="Propriétés physiques" name="Physics"/>
 			<menu_item_call label="Tous les habits" name="All Clothes"/>
 		</menu>
-		<menu label="Aide" name="Help">
+		<menu label="Aide" name="DeprecatedHelp">
 			<menu_item_call label="Blog officiel des Linden" name="Official Linden Blog"/>
 			<menu_item_call label="Portail d&apos;écriture de scripts" name="Scripting Portal"/>
-			<menu label="Signaler des bugs" name="Bug Reporting">
+			<menu label="Signaler un bug" name="Bug Reporting">
 				<menu_item_call label="JIRA" name="Public Issue Tracker"/>
 				<menu_item_call label="Aide du JIRA" name="Publc Issue Tracker Help"/>
 				<menu_item_call label="Comment signaler des bugs" name="Bug Reporing 101"/>
diff --git a/indra/newview/skins/default/xui/fr/notifications.xml b/indra/newview/skins/default/xui/fr/notifications.xml
index 31c29029b56290a50efb99c49ec8f5b932f8afe9..746a4b1d5552800f2ebb6a18a6956a070f0b2494 100644
--- a/indra/newview/skins/default/xui/fr/notifications.xml
+++ b/indra/newview/skins/default/xui/fr/notifications.xml
@@ -86,16 +86,37 @@ Veuillez vérifier votre connexion Internet.
 		<usetemplate canceltext="Cancel" name="yesnocancelbuttons" notext="Ne pas enregistrer" yestext="Enregistrer"/>
 	</notification>
 	<notification name="ConfirmNoCopyToOutbox">
-		Vous n&apos;êtes pas autorisé à copier cet article dans la boîte d&apos;envoi vers la Place du marché. Voulez-vous vraiment déplacer l&apos;article suivant ?
-        [ITEM_NAME]
-		<usetemplate name="okcancelbuttons" notext="Non" yestext="Oui"/>
+		Vous n&apos;êtes pas autorisé à copier un ou plusieurs de ces articles dans la boîte d&apos;envoi vendeur. Vous pouvez les déplacer ou les laisser.
+		<usetemplate name="okcancelbuttons" notext="Ne pas déplacer les articles" yestext="Déplacer les articles"/>
+	</notification>
+	<notification name="OutboxFolderCreated">
+		Un nouveau dossier a été créé pour chaque article que vous avez transféré vers le niveau supérieur de votre boîte d&apos;envoi vendeur.
+		<usetemplate ignoretext="Un nouveau dossier a été créé dans la boîte d&apos;envoi vendeur." name="okignore" yestext="OK"/>
+	</notification>
+	<notification name="OutboxImportComplete">
+		Transfert réussi
+
+Tous les dossiers ont été envoyés vers la Place du marché.
+		<usetemplate ignoretext="Tous les dossiers envoyés vers la Place du marché" name="okignore" yestext="OK"/>
+	</notification>
+	<notification name="OutboxImportHadErrors">
+		Impossible de transférer certains dossiers
+
+Des erreurs se sont produites lors de l&apos;envoi de certains dossiers vers la Place du marché. Ces dossiers sont toujours disponibles dans votre boîte d&apos;envoi vendeur.
+
+Pour plus d&apos;informations, consultez le [[MARKETPLACE_IMPORTS_URL] journal des erreurs].
+		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
-	<notification name="OutboxUploadComplete">
-		Chargement sur la Place du marché terminé.
-		<usetemplate name="okbutton" yestext="Hourra !"/>
+	<notification name="OutboxImportFailed">
+		Échec de transfert
+
+Aucun dossier n&apos;a été envoyé vers la Place du marché en raison d&apos;une erreur système ou réseau. Veuillez réessayer ultérieurement.
+		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
-	<notification name="OutboxUploadHadErrors">
-		Chargement sur la Place du marché effectué avec des erreurs ! Corrigez les problèmes dans votre boîte d&apos;envoi et réessayez. Merci !
+	<notification name="OutboxInitFailed">
+		Échec d&apos;initialisation de la Place du marché
+
+L&apos;initialisation de la Place du marché a échoué en raison d&apos;une erreur système ou réseau. Veuillez réessayer ultérieurement.
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="CompileQueueSaveText">
@@ -648,7 +669,7 @@ Assurez-vous que le fichier a l&apos;extension correcte.
 		Impossible de créer le fichier de sortie : [FILE]
 	</notification>
 	<notification name="DoNotSupportBulkAnimationUpload">
-		Actuellement, [APP_NAME] ne prend pas en charge le chargement de lots de fichiers d&apos;animation.
+		Actuellement, [APP_NAME] ne prend pas en charge le chargement par lot de fichiers d&apos;animation au format BVH.
 	</notification>
 	<notification name="CannotUploadReason">
 		Impossible de charger [FILE] suite au problème suivant : [REASON]
@@ -980,7 +1001,7 @@ Proposer à [NAME] de devenir votre ami(e) ?
 		</form>
 	</notification>
 	<notification name="RemoveFromFriends">
-		Voulez-vous supprimer [NAME] de votre liste d&apos;amis ?
+		Voulez-vous supprimer &lt;nolink&gt;[NAME]&lt;/nolink&gt; de votre liste d&apos;amis ?
 		<usetemplate name="okcancelbuttons" notext="Annuler" yestext="OK"/>
 	</notification>
 	<notification name="RemoveMultipleFromFriends">
@@ -1105,8 +1126,13 @@ Céder ces [AREA] m² de terrain au groupe [GROUP_NAME] ?
 	<notification name="DisplaySetToSafe">
 		Les paramètres d&apos;affichage sont au niveau le plus sûr, comme vous l&apos;aviez indiqué.
 	</notification>
-	<notification name="DisplaySetToRecommended">
-		Vos paramètres d&apos;affichage ont été réglés avec une marge de sécurité en fonction de votre configuration système.
+	<notification name="DisplaySetToRecommendedGPUChange">
+		Les paramètres d&apos;affichage ont été modifiés selon les niveaux recommandés car votre carte graphique
+[LAST_GPU] a été remplacée
+par une carte [THIS_GPU].
+	</notification>
+	<notification name="DisplaySetToRecommendedFeatureChange">
+		Les paramètres d&apos;affichage ont été modifiés selon les niveaux recommandés en raison d&apos;un changement relatif au sous-système de rendu.
 	</notification>
 	<notification name="ErrorMessage">
 		[ERROR_MESSAGE]
@@ -1428,8 +1454,8 @@ Version [VERSION]
 		<usetemplate ignoretext="Confirmer avant de rendre les objets à leurs propriétaires" name="okcancelignore" notext="Annuler" yestext="OK"/>
 	</notification>
 	<notification name="GroupLeaveConfirmMember">
-		Vous êtes actuellement membre du groupe [GROUP].
-Quitter le groupe ?
+		Vous êtes actuellement membre du groupe &lt;nolink&gt;[GROUP]&lt;/nolink&gt;.
+Quitter le groupe ?
 		<usetemplate name="okcancelbuttons" notext="Annuler" yestext="OK"/>
 	</notification>
 	<notification name="ConfirmKick">
@@ -1910,9 +1936,15 @@ Déplacer les objets de l&apos;inventaire ?
 		<usetemplate ignoretext="Confirmer avant de quitter" name="okcancelignore" notext="Ne pas quitter" yestext="Quitter"/>
 	</notification>
 	<notification name="ConfirmRestoreToybox">
-		Etes-vous certain de vouloir restaurer vos boutons et barres d&apos;outils par défaut ? 
+		Cette action rétablira vos boutons et barres d&apos;outils par défaut.
+
+Vous ne pouvez pas l&apos;annuler.
+		<usetemplate name="okcancelbuttons" notext="Annuler" yestext="OK"/>
+	</notification>
+	<notification name="ConfirmClearAllToybox">
+		Cette action replacera tous les boutons dans la boîte à outils de sorte que vos barres d&apos;outils seront vides.
     
-Vous ne pouvez pas annuler cette action.
+Vous ne pouvez pas l&apos;annuler.
 		<usetemplate name="okcancelbuttons" notext="Annuler" yestext="OK"/>
 	</notification>
 	<notification name="DeleteItems">
@@ -2119,10 +2151,10 @@ Cette opération lancera votre navigateur Web.
 		Sujet : [SUBJECT], Message : [MESSAGE]
 	</notification>
 	<notification name="FriendOnline">
-		[NAME] est en ligne
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; est en ligne
 	</notification>
 	<notification name="FriendOffline">
-		[NAME] est hors ligne
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; est hors ligne
 	</notification>
 	<notification name="AddSelfFriend">
 		Même si vous êtes extrêmement sympathique, vous ne pouvez pas devenir ami avec vous-même.
@@ -2236,14 +2268,16 @@ Veuillez sélectionner un seul objet.
 		Votre carte de visite a été refusée.
 	</notification>
 	<notification name="TeleportToLandmark">
-		Vous pouvez vous téléporter vers des endroits comme [NAME] en ouvrant le panneau Lieux sur le côté droit de votre écran, puis en sélectionnant l&apos;onglet Repères.
-Cliquez sur le repère de votre choix pour le sélectionner, puis sur Téléporter en bas du panneau.
-(Vous pouvez aussi double-cliquer sur le repère ou cliquer dessus avec le bouton droit de la souris et sélectionner Téléporter.)
+		Pour vous téléporter vers un lieu tel que [NAME], cliquez sur le bouton Endroits,
+    puis sélectionnez l&apos;onglet Repères dans la fenêtre qui s&apos;ouvre. Cliquez sur n&apos;importe quel
+    repère pour le sélectionner, puis sur Téléportation en bas de la fenêtre.
+    (Vous pouvez aussi double-cliquer sur le repère ou cliquer-droit dessus et
+    choisir Téléportation).
 	</notification>
 	<notification name="TeleportToPerson">
-		Vous pouvez contacter des résidents comme [NAME] en ouvrant le panneau Résidents sur le côté droit de votre écran.
-Sélectionnez le résident de votre choix dans la liste, puis cliquez sur IM en bas du panneau.
-(Vous pouvez aussi double-cliquer sur le nom du résident dans la liste ou cliquer dessus avec le bouton droit de la souris et sélectionner IM.)
+		Pour contacter un résident tel que [NAME], cliquez sur le bouton Personnes, sélectionnez le résident dans la fenêtre qui s&apos;ouvre, puis cliquez sur IM en
+    bas de la fenêtre.
+    (Vous pouvez aussi double-cliquer sur le nom du résident dans la liste ou cliquer-droit dessus et choisir IM.)
 	</notification>
 	<notification name="CantSelectLandFromMultipleRegions">
 		Vous ne pouvez pas sélectionner de terrain en dehors des limites du serveur.
@@ -2264,6 +2298,9 @@ Veuillez sélectionner un terrain plus petit.
 	<notification name="PaymentSent">
 		[MESSAGE]
 	</notification>
+	<notification name="PaymentFailure">
+		[MESSAGE]
+	</notification>
 	<notification name="EventNotification">
 		Avis d&apos;événement :
 
@@ -2518,10 +2555,10 @@ Veuillez réessayer dans quelques minutes.
 		</form>
 	</notification>
 	<notification name="FriendshipAccepted">
-		[NAME] a accepté votre amitié.
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; a accepté votre amitié.
 	</notification>
 	<notification name="FriendshipDeclined">
-		[NAME] a refusé votre amitié.
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; a refusé votre amitié.
 	</notification>
 	<notification name="FriendshipAcceptedByMe">
 		Amitié acceptée.
@@ -2593,16 +2630,16 @@ Accepter cette requête ?
 		&lt;nolink&gt;[TITLE]&lt;/nolink&gt; de [NAME]
 [MESSAGE]
 		<form name="form">
-			<button name="Mute" text="Ignorer"/>
-			<button name="Ignore" text="Ignorer"/>
+			<button name="Client_Side_Mute" text="Bloquer"/>
+			<button name="Client_Side_Ignore" text="Ignorer"/>
 		</form>
 	</notification>
 	<notification name="ScriptDialogGroup">
 		&lt;nolink&gt;[TITLE]&lt;/nolink&gt; de [GROUPNAME]
 [MESSAGE]
 		<form name="form">
-			<button name="Mute" text="Ignorer"/>
-			<button name="Ignore" text="Ignorer"/>
+			<button name="Client_Side_Mute" text="Bloquer"/>
+			<button name="Client_Side_Ignore" text="Ignorer"/>
 		</form>
 	</notification>
 	<notification name="BuyLindenDollarSuccess">
@@ -2797,6 +2834,18 @@ Voir le fichier journal pour plus de détails.
 
 avec les résidents suivants :
 
+[RESIDENTS] ?
+		<usetemplate name="okcancelbuttons" notext="Annuler" yestext="OK"/>
+	</notification>
+	<notification name="ShareFolderConfirmation">
+		Vous ne pouvez partager qu&apos;un dossier à la fois.
+
+Voulez-vous vraiment partager les articles suivants :
+
+&lt;nolink&gt;[ITEMS]&lt;/nolink&gt;
+
+avec les résidents suivants :
+
 [RESIDENTS] ?
 		<usetemplate name="okcancelbuttons" notext="Annuler" yestext="Ok"/>
 	</notification>
@@ -2888,7 +2937,7 @@ Les résidents rejoignant l&apos;appel ultérieurement seront également
 ignorés, même si vous quittez l&apos;appel.
 
 Ignorer les autres ?
-		<usetemplate ignoretext="Confirmer avant d&apos;ignorer les autres lors d&apos;un appel de groupe" name="okcancelignore" notext="Annuler" yestext="Ok"/>
+		<usetemplate ignoretext="Confirmer avant d&apos;ignorer les autres lors d&apos;un appel de groupe" name="okcancelignore" notext="Annuler" yestext="OK"/>
 	</notification>
 	<notification label="Chat" name="HintChat">
 		Pour participer à la conversation, saisissez du texte dans le champ de chat situé en dessous.
@@ -3046,8 +3095,8 @@ Cliquez sur un point dans le monde et faites glisser votre souris pour faire tou
 		<usetemplate name="okcancelbuttons" notext="Ne pas quitter" yestext="Quitter"/>
 	</notification>
 	<notification label="" name="ConfirmHideUI">
-		Cette action cachera tous les objets des menus et boutons. Pour les récupérer, cliquez de nouveau sur [SHORTCUT].
-		<usetemplate ignoretext="Confimer avant de cacher l&apos;interface" name="okcancelignore" notext="Annuler" yestext="OK"/>
+		Cette action masquera tous les boutons et articles de menu. Pour les récupérer, cliquez de nouveau sur [SHORTCUT].
+		<usetemplate ignoretext="Confirmer avant de masquer l&apos;interface" name="okcancelignore" notext="Annuler" yestext="OK"/>
 	</notification>
 	<global name="UnsupportedGLRequirements">
 		Vous semblez ne pas avoir le matériel requis pour utiliser [APP_NAME]. [APP_NAME] requiert une carte graphique OpenGL avec une prise en charge du multitexturing. Si vous avez une telle carte, assurez-vous que vous avez aussi les pilotes les plus récents pour la carte, ainsi que les service packs et les patchs pour votre système d&apos;exploitation.
diff --git a/indra/newview/skins/default/xui/fr/panel_edit_skin.xml b/indra/newview/skins/default/xui/fr/panel_edit_skin.xml
index 9640adcdf82cdad68fa1154d394efc6529af9037..f5f27383197fa9143793a3637a37d677e2ce1184 100644
--- a/indra/newview/skins/default/xui/fr/panel_edit_skin.xml
+++ b/indra/newview/skins/default/xui/fr/panel_edit_skin.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="edit_skin_panel">
 	<panel name="avatar_skin_color_panel">
-		<texture_picker label="Tatouage tête" name="Head Tattoos" tool_tip="Cliquez pour sélectionner une image" width="76"/>
-		<texture_picker label="Tatouage haut" name="Upper Tattoos" tool_tip="Cliquez pour sélectionner une image" width="80"/>
-		<texture_picker label="Tatouage bas" name="Lower Tattoos" tool_tip="Cliquez pour sélectionner une image"/>
+		<texture_picker label="Tête" name="Head" tool_tip="Cliquer pour sélectionner une image."/>
+		<texture_picker label="Haut du corps" name="Upper Body" tool_tip="Cliquer pour sélectionner une image."/>
+		<texture_picker label="Bas du corps" name="Lower Body" tool_tip="Cliquer pour sélectionner une image."/>
 	</panel>
 	<panel name="accordion_panel">
 		<accordion name="wearable_accordion">
diff --git a/indra/newview/skins/default/xui/fr/panel_my_profile.xml b/indra/newview/skins/default/xui/fr/panel_my_profile.xml
deleted file mode 100644
index 5207c5a28e7967fa8d961c1323a4430decdf0635..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/fr/panel_my_profile.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Profil" name="panel_profile">
-	<string name="CaptionTextAcctInfo">
-		[ACCTTYPE]
-[PAYMENTINFO] [AGEVERIFICATION]
-	</string>
-	<string name="payment_update_link_url">
-		http://www.secondlife.com/account/billing.php?lang=en
-	</string>
-	<string name="partner_edit_link_url">
-		http://www.secondlife.com/account/partners.php?lang=en
-	</string>
-	<string name="my_account_link_url" value="http://secondlife.com/account"/>
-	<string name="no_partner_text" value="Aucun"/>
-	<string name="no_group_text" value="Aucun"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="scroll_content_panel">
-					<panel name="second_life_image_panel">
-						<text name="display_name_descr_text">
-							Nom d&apos;utilisateur
-						</text>
-						<text name="name_descr_text">
-							Nom d&apos;affichage
-						</text>
-						<button label="Profil" name="see_profile_btn" tool_tip="Afficher le profil de cet avatar."/>
-					</panel>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_nearby_chat.xml b/indra/newview/skins/default/xui/fr/panel_nearby_chat.xml
index 31cb3308e3584fee839eeeb6a8c096f45baa5df4..b02e53269b07266948ca5b25e5e002f79e842167 100644
--- a/indra/newview/skins/default/xui/fr/panel_nearby_chat.xml
+++ b/indra/newview/skins/default/xui/fr/panel_nearby_chat.xml
@@ -1,4 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="nearby_chat">
-	<check_box label="Traduction du chat" name="translate_chat_checkbox"/>
+	<layout_stack name="stack">
+		<layout_panel name="translate_chat_checkbox_lp">
+			<check_box label="Traduire le chat" name="translate_chat_checkbox"/>
+		</layout_panel>
+	</layout_stack>
 </panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_notes.xml b/indra/newview/skins/default/xui/fr/panel_notes.xml
deleted file mode 100644
index 1b44bc4b73c7bc63ffc8b14e5a8cc4cb6a05a411..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/fr/panel_notes.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Notes/Perso" name="panel_notes">
-	<layout_stack name="layout">
-		<layout_panel name="notes_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<text name="status_message" value="Mes notes perso :"/>
-					<text name="status_message2" value="Autoriser cette personne à :"/>
-					<check_box label="Afficher mon statut en ligne" name="status_check"/>
-					<check_box label="Me situer sur la carte" name="map_check"/>
-					<check_box label="Modifier, supprimer ou prendre mes objets" name="objects_check"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-		<layout_panel name="notes_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="Devenir amis" name="add_friend" tool_tip="Proposer à ce résident de devenir votre ami"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="IM" name="im" tool_tip="Ouvrir une session IM"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="Appeler" name="call" tool_tip="Appeler ce résident"/>
-				</layout_panel>
-				<layout_panel name="show_on_map_btn_lp">
-					<button label="Carte" name="show_on_map_btn" tool_tip="Afficher le résident sur la carte"/>
-				</layout_panel>
-				<layout_panel name="teleport_btn_lp">
-					<button label="Téléporter" name="teleport" tool_tip="Proposer une téléportation"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_postcard_message.xml b/indra/newview/skins/default/xui/fr/panel_postcard_message.xml
new file mode 100644
index 0000000000000000000000000000000000000000..0f8397cfb4e748675b4de577ccd7c2870f4c6d05
--- /dev/null
+++ b/indra/newview/skins/default/xui/fr/panel_postcard_message.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_postcard_message">
+	<text name="to_label">
+		À :
+	</text>
+	<text name="name_label">
+		De :
+	</text>
+	<text name="subject_label">
+		Objet :
+	</text>
+	<line_editor label="Saisir ici votre objet" name="subject_form"/>
+	<text name="msg_label">
+		Message :
+	</text>
+	<text_editor name="msg_form">
+		Saisir ici votre message
+	</text_editor>
+	<button label="Annuler" name="cancel_btn"/>
+	<button label="Envoyer" name="send_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_postcard_settings.xml b/indra/newview/skins/default/xui/fr/panel_postcard_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6f4e9c23f9c25b8eee022c9b460d49d5dc5914fc
--- /dev/null
+++ b/indra/newview/skins/default/xui/fr/panel_postcard_settings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_postcard_settings">
+	<combo_box label="Résolution" name="postcard_size_combo">
+		<combo_box.item label="Fenêtre actuelle" name="CurrentWindow"/>
+		<combo_box.item label="640 x 480" name="640x480"/>
+		<combo_box.item label="800 x 600" name="800x600"/>
+		<combo_box.item label="1 024 x 768" name="1024x768"/>
+		<combo_box.item label="Personnalisée" name="Custom"/>
+	</combo_box>
+	<layout_stack name="postcard_image_params_ls">
+		<layout_panel name="postcard_image_size_lp">
+			<spinner label="Largeur" name="postcard_snapshot_width"/>
+			<spinner label="Hauteur" name="postcard_snapshot_height"/>
+			<check_box label="Conserver les proportions" name="postcard_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="postcard_image_format_quality_lp">
+			<slider label="Qualité de l&apos;image" name="image_quality_slider"/>
+			<text name="image_quality_level">
+				([QLVL])
+			</text>
+		</layout_panel>
+	</layout_stack>
+</panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_preferences_chat.xml b/indra/newview/skins/default/xui/fr/panel_preferences_chat.xml
index fa026d810679a4372b6f4b95a4fedc3aa1582261..76ed23745129825e9776fbb194c5647b926394e8 100644
--- a/indra/newview/skins/default/xui/fr/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/fr/panel_preferences_chat.xml
@@ -29,30 +29,5 @@
 	<check_box label="Chats IM" name="EnableIMChatPopups" tool_tip="Cocher cette case pour qu&apos;un popup s&apos;affiche à réception d&apos;un message instantané."/>
 	<spinner label="Durée de vie du popup Chat près de moi :" name="nearby_toasts_lifetime"/>
 	<spinner label="Disparition progressive du popup Chat près de moi :" name="nearby_toasts_fadingtime"/>
-	<check_box name="translate_chat_checkbox"/>
-	<text name="translate_chb_label">
-		Utiliser la traduction automatique lors des chats
-	</text>
-	<text name="translate_language_text">
-		Traduire le chat en :
-	</text>
-	<combo_box name="translate_language_combobox">
-		<combo_box.item label="Choix par défaut" name="System Default Language"/>
-		<combo_box.item label="English (Anglais)" name="English"/>
-		<combo_box.item label="Dansk (Danois)" name="Danish"/>
-		<combo_box.item label="Deutsch (Allemand)" name="German"/>
-		<combo_box.item label="Español (Espagnol)" name="Spanish"/>
-		<combo_box.item label="Français" name="French"/>
-		<combo_box.item label="Italiano (Italien)" name="Italian"/>
-		<combo_box.item label="Magyar (Hongrois)" name="Hungarian"/>
-		<combo_box.item label="Nederlands (Néerlandais)" name="Dutch"/>
-		<combo_box.item label="Polski (Polonais)" name="Polish"/>
-		<combo_box.item label="Português (Portugais)" name="Portugese"/>
-		<combo_box.item label="Русский (Russe)" name="Russian"/>
-		<combo_box.item label="Türkçe (Turc)" name="Turkish"/>
-		<combo_box.item label="Українська (Ukrainien)" name="Ukrainian"/>
-		<combo_box.item label="中文 (正體) (Chinois)" name="Chinese"/>
-		<combo_box.item label="日本語 (Japonais)" name="Japanese"/>
-		<combo_box.item label="한국어 (Coréen)" name="Korean"/>
-	</combo_box>
+	<button label="Traduction automatique" name="ok_btn"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_preferences_move.xml b/indra/newview/skins/default/xui/fr/panel_preferences_move.xml
index efb520bfd381310335f7479729f56eff562f1154..94d7322b228687355a96f59fb224516750dd54b2 100644
--- a/indra/newview/skins/default/xui/fr/panel_preferences_move.xml
+++ b/indra/newview/skins/default/xui/fr/panel_preferences_move.xml
@@ -24,16 +24,16 @@
 		Clic simple sur le terrain :
 	</text>
 	<combo_box name="single_click_action_combo">
-		<combo_box.item label="Pas d&apos;action" name="0"/>
-		<combo_box.item label="Bouger vers le point cliqué" name="1"/>
+		<combo_box.item label="Aucune action" name="0"/>
+		<combo_box.item label="Déplacement vers le clic" name="1"/>
 	</combo_box>
 	<text name="double_click_action_lbl">
 		Double-clic sur le terrain :
 	</text>
 	<combo_box name="double_click_action_combo">
-		<combo_box.item label="Pas d&apos;action" name="0"/>
-		<combo_box.item label="Bouger vers le point cliqué" name="1"/>
-		<combo_box.item label="Téléporter vers le point cliqué" name="2"/>
+		<combo_box.item label="Aucune action" name="0"/>
+		<combo_box.item label="Déplacement vers le double clic" name="1"/>
+		<combo_box.item label="Téléportation vers le double clic" name="2"/>
 	</combo_box>
 	<button label="Autres accessoires" name="joystick_setup_button"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_preferences_privacy.xml b/indra/newview/skins/default/xui/fr/panel_preferences_privacy.xml
index 3123a4c6fe167489d5394ef338cf95a7a19720b1..cf1a374da687d0b1574de3627be352fd82c4cba7 100644
--- a/indra/newview/skins/default/xui/fr/panel_preferences_privacy.xml
+++ b/indra/newview/skins/default/xui/fr/panel_preferences_privacy.xml
@@ -20,7 +20,7 @@
 	<check_box label="Inclure la date et l&apos;heure pour chaque ligne du journal de chat" name="show_timestamps_check_im"/>
 	<check_box label="Inclure la date dans le nom du fichier journal" name="logfile_name_datestamp"/>
 	<text name="log_path_desc">
-		Emplacement :
+		Emplacement journaux :
 	</text>
 	<line_editor left="308" name="log_path_string" right="-20"/>
 	<button label="Parcourir" label_selected="Parcourir" name="log_path_button" width="150"/>
diff --git a/indra/newview/skins/default/xui/fr/panel_preferences_setup.xml b/indra/newview/skins/default/xui/fr/panel_preferences_setup.xml
index 82780c27c5980765012ec4b91345658ef000b7c3..83303950dcdea36d1cfdd364df93b90493c1aac6 100644
--- a/indra/newview/skins/default/xui/fr/panel_preferences_setup.xml
+++ b/indra/newview/skins/default/xui/fr/panel_preferences_setup.xml
@@ -15,7 +15,7 @@
 		Web :
 	</text>
 	<radio_group name="use_external_browser">
-		<radio_item label="Utiliser mon navigateur (IE, Firefox, Safari)" name="external" tool_tip="Utiliser le navigateur web système par défaut pour l&apos;aide, les liens etc. Non recommandé en mode plein écran." value="1"/>
+		<radio_item label="Utiliser mon navigateur (IE, Firefox, Safari)" name="external" tool_tip="Utiliser le navigateur web système par défaut pour l&apos;aide, les liens etc. Non recommandé en mode plein écran." value="true"/>
 		<radio_item label="Utiliser le navigateur intégré" name="internal" tool_tip="Utilisez le navigateur intégré pour obtenir de l&apos;aide, ouvrir des liens, etc. Ce navigateur s&apos;ouvre dans [APP_NAME]." value=""/>
 	</radio_group>
 	<check_box initial_value="true" label="Activer les plugins" name="browser_plugins_enabled"/>
diff --git a/indra/newview/skins/default/xui/fr/panel_preferences_sound.xml b/indra/newview/skins/default/xui/fr/panel_preferences_sound.xml
index deaec2e14fa7f46962e8f724aedb8d856e53c52d..37eb6bbeb03a735c71b1423c526519b4d706af31 100644
--- a/indra/newview/skins/default/xui/fr/panel_preferences_sound.xml
+++ b/indra/newview/skins/default/xui/fr/panel_preferences_sound.xml
@@ -17,9 +17,9 @@
 	<check_box label="Activé" name="enable_media"/>
 	<slider label="Chat vocal" name="Voice Volume"/>
 	<check_box label="Activé" name="enable_voice_check"/>
-	<check_box label="Autoriser la lecture automatique du média" name="media_auto_play_btn" tool_tip="Cochez pour autoriser la lecture automatique du média" value="true"/>
-	<check_box label="Lecture du média aux autres avatars" name="media_show_on_others_btn" tool_tip="Décochez pour masquer le média aux autres avatars près de vous" value="true"/>
-	<check_box label="Lire les sons des gestes" name="gesture_audio_play_btn" tool_tip="Cochez cette case pour entendre les sons associés aux gestes." value="true"/>
+	<check_box label="Autoriser la lecture automatique du média" name="media_auto_play_btn" tool_tip="Cocher pour autoriser la lecture automatique du média." value="true"/>
+	<check_box label="Lire le média attaché aux autres avatars" name="media_show_on_others_btn" tool_tip="Décocher pour masquer le média attaché aux autres avatars près de vous." value="true"/>
+	<check_box label="Lire les sons des gestes" name="gesture_audio_play_btn" tool_tip="Cocher cette case pour entendre les sons associés aux gestes." value="true"/>
 	<text name="voice_chat_settings">
 		Paramètres du chat vocal
 	</text>
diff --git a/indra/newview/skins/default/xui/fr/panel_prim_media_controls.xml b/indra/newview/skins/default/xui/fr/panel_prim_media_controls.xml
index f16fcebd023ee3a050e03cfde787003aa3786a99..ad744b77608cf37edf37768e7a8290aa06301d1f 100644
--- a/indra/newview/skins/default/xui/fr/panel_prim_media_controls.xml
+++ b/indra/newview/skins/default/xui/fr/panel_prim_media_controls.xml
@@ -13,10 +13,10 @@
 	</layout_stack>
 	<layout_stack name="media_controls">
 		<layout_panel name="back">
-			<button name="back_btn" tool_tip="Naviguer en arrière"/>
+			<button name="back_btn" tool_tip="Précédente"/>
 		</layout_panel>
 		<layout_panel name="fwd">
-			<button name="fwd_btn" tool_tip="Naviguer vers l&apos;avant"/>
+			<button name="fwd_btn" tool_tip="Suivante"/>
 		</layout_panel>
 		<layout_panel name="home">
 			<button name="home_btn" tool_tip="Page d&apos;accueil"/>
@@ -34,7 +34,7 @@
 			<button name="play_btn" tool_tip="Lire le média"/>
 		</layout_panel>
 		<layout_panel name="pause">
-			<button name="pause_btn" tool_tip="Pauser le média"/>
+			<button name="pause_btn" tool_tip="Mettre le média sur pause"/>
 		</layout_panel>
 		<layout_panel name="media_address">
 			<line_editor name="media_address_url" tool_tip="URL du média"/>
@@ -48,7 +48,7 @@
 			</layout_stack>
 		</layout_panel>
 		<layout_panel name="media_play_position">
-			<slider_bar initial_value="0.5" name="media_play_slider" tool_tip="Progrès de la lecture du film"/>
+			<slider_bar initial_value="0.5" name="media_play_slider" tool_tip="Progression de la lecture du film"/>
 		</layout_panel>
 		<layout_panel name="skip_back">
 			<button name="skip_back_btn" tool_tip="Reculer"/>
diff --git a/indra/newview/skins/default/xui/fr/panel_profile.xml b/indra/newview/skins/default/xui/fr/panel_profile.xml
deleted file mode 100644
index 9aa6fe97a1e7b1c4c09edb5345467682b0781337..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/fr/panel_profile.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Profil" name="panel_profile">
-	<string name="CaptionTextAcctInfo">
-		[ACCTTYPE]
-[PAYMENTINFO] [AGEVERIFICATION]
-	</string>
-	<string name="payment_update_link_url">
-		http://www.secondlife.com/account/billing.php?lang=fr-FR
-	</string>
-	<string name="partner_edit_link_url">
-		http://www.secondlife.com/account/partners.php?lang=fr
-	</string>
-	<string name="my_account_link_url" value="http://secondlife.com/my/account/index.php?lang=fr-FR"/>
-	<string name="no_partner_text" value="Aucun"/>
-	<string name="no_group_text" value="Aucun"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<panel name="second_life_image_panel">
-						<text name="title_sl_descr_text" value="[SECOND_LIFE]:"/>
-					</panel>
-					<panel name="first_life_image_panel">
-						<text name="title_rw_descr_text" value="Vie réelle :"/>
-					</panel>
-					<text name="title_member_text" value="Résident depuis :"/>
-					<text name="title_acc_status_text" value="Statut du compte :"/>
-					<text_editor name="acc_status_text">
-						Résident. Aucune info de paiement enregistrée.
-              Linden.
-					</text_editor>
-					<text name="title_partner_text" value="Partenaire :"/>
-					<panel name="partner_data_panel">
-						<text initial_value="(récupération en cours)" name="partner_text"/>
-					</panel>
-					<text name="title_groups_text" value="Groupes :"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-	<layout_stack name="layout_verb_buttons">
-		<layout_panel name="profile_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="Devenir amis" name="add_friend" tool_tip="Proposer à ce résident de devenir votre ami"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="IM" name="im" tool_tip="Ouvrir une session IM"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="Appeler" name="call" tool_tip="Appeler ce résident"/>
-				</layout_panel>
-				<layout_panel name="chat_btn_lp">
-					<button label="Téléporter" name="teleport" tool_tip="Proposer une téléportation"/>
-				</layout_panel>
-				<layout_panel name="overflow_btn_lp">
-					<menu_button label="▼" name="overflow_btn" tool_tip="Payer le résident ou partager l&apos;inventaire avec lui"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-		<layout_panel name="profile_me_buttons_panel">
-			<button label="Modifier le profil" name="edit_profile_btn" tool_tip="Modifier vos informations personnelles"/>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_profile_view.xml b/indra/newview/skins/default/xui/fr/panel_profile_view.xml
deleted file mode 100644
index 76ba44e8990a492d337af9bb9530feb447eef2e9..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/fr/panel_profile_view.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel name="panel_target_profile">
-	<string name="status_online">
-		En ligne
-	</string>
-	<string name="status_offline">
-		Hors ligne
-	</string>
-	<text name="display_name_label" value="Nom d&apos;affichage :"/>
-	<text name="solo_username_label" value="Nom d&apos;utilisateur :"/>
-	<text name="status" value="En ligne"/>
-	<text name="user_name_small" value="Jack oh look at me this is a super duper long name"/>
-	<button name="copy_to_clipboard" tool_tip="Copier dans le presse-papiers"/>
-	<text name="user_label" value="Nom d&apos;utilisateur :"/>
-	<tab_container name="tabs">
-		<panel label="PROFIL" name="panel_profile"/>
-		<panel label="FAVORIS" name="panel_picks"/>
-		<panel label="NOTES/PERSO" name="panel_notes"/>
-	</tab_container>
-</panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_region_debug.xml b/indra/newview/skins/default/xui/fr/panel_region_debug.xml
index cb4a74e1424321c22341be752ea1cdb31817a9ff..733c3f9a22cfb716f9cb1a36c46194c5ea880e7d 100644
--- a/indra/newview/skins/default/xui/fr/panel_region_debug.xml
+++ b/indra/newview/skins/default/xui/fr/panel_region_debug.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Débugger" name="Debug">
+<panel label="Débogage" name="Debug">
 	<text name="region_text_lbl">
 		Région :
 	</text>
diff --git a/indra/newview/skins/default/xui/fr/panel_region_estate.xml b/indra/newview/skins/default/xui/fr/panel_region_estate.xml
index fb650ff6462d2d5ebdc67669e8b1051cf436cd0b..9d97d1bf298375a74ae58260652bf129bc854b9b 100644
--- a/indra/newview/skins/default/xui/fr/panel_region_estate.xml
+++ b/indra/newview/skins/default/xui/fr/panel_region_estate.xml
@@ -18,10 +18,10 @@ domaine.
 		(inconnu)
 	</text>
 	<text name="Only Allow">
-		Limiter l&apos;accès aux comptes vérifiés par :
+		Conditions d&apos;accès des résidents :
 	</text>
-	<check_box label="Infos de paiement enregistrées" name="limit_payment" tool_tip="Bannir les résidents non identifiés"/>
-	<check_box label="Vérification de l&apos;âge" name="limit_age_verified" tool_tip="Bannir les résidents qui n&apos;ont pas vérifié leur âge. Consultez la page [SUPPORT_SITE] pour plus d&apos;informations."/>
+	<check_box label="Informations de paiement enregistrées" name="limit_payment" tool_tip="Pour pouvoir accéder à ce domaine, les résidents doivent avoir enregistré des informations de paiement. Consultez le [SUPPORT_SITE] pour plus d&apos;informations."/>
+	<check_box label="Âge vérifié" name="limit_age_verified" tool_tip="Pour que les résidents puissent accéder à ce domaine, leur âge doit avoir fait l&apos;objet d&apos;une vérification. Consultez le [SUPPORT_SITE] pour plus d&apos;informations."/>
 	<check_box label="Autoriser les chats vocaux" name="voice_chat_check"/>
 	<button label="?" name="voice_chat_help"/>
 	<text name="abuse_email_text">
diff --git a/indra/newview/skins/default/xui/fr/panel_script_ed.xml b/indra/newview/skins/default/xui/fr/panel_script_ed.xml
index 2b08ae56c55885d15656e1782d986ccfa8c46b9e..29fbe3c7e7d7d1c2f184d5b028b676113a87c183 100644
--- a/indra/newview/skins/default/xui/fr/panel_script_ed.xml
+++ b/indra/newview/skins/default/xui/fr/panel_script_ed.xml
@@ -22,6 +22,8 @@
 		<menu label="Fichier" name="File">
 			<menu_item_call label="Enregistrer" name="Save"/>
 			<menu_item_call label="Annuler tous les changements" name="Revert All Changes"/>
+			<menu_item_call label="Charger depuis un fichier..." name="LoadFromFile"/>
+			<menu_item_call label="Enregistrer sous..." name="SaveToFile"/>
 		</menu>
 		<menu label="Modifier" name="Edit">
 			<menu_item_call label="Annuler" name="Undo"/>
diff --git a/indra/newview/skins/default/xui/fr/panel_snapshot_inventory.xml b/indra/newview/skins/default/xui/fr/panel_snapshot_inventory.xml
new file mode 100644
index 0000000000000000000000000000000000000000..4454d2475ef1e8a8b165927930c66c2897195c0d
--- /dev/null
+++ b/indra/newview/skins/default/xui/fr/panel_snapshot_inventory.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_inventory">
+	<text name="title">
+		Enregistrer dans mon inventaire
+	</text>
+	<text name="hint_lbl">
+		L&apos;enregistrement d&apos;une image dans votre inventaire coûte [UPLOAD_COST] L$. Pour enregistrer votre image sous forme de texture, sélectionnez l&apos;un des formats carrés.
+	</text>
+	<combo_box label="Résolution" name="texture_size_combo">
+		<combo_box.item label="Fenêtre actuelle" name="CurrentWindow"/>
+		<combo_box.item label="Petite (128 x 128)" name="Small(128x128)"/>
+		<combo_box.item label="Moyenne (256 x 256)" name="Medium(256x256)"/>
+		<combo_box.item label="Grande (512 x 512)" name="Large(512x512)"/>
+		<combo_box.item label="Personnalisée" name="Custom"/>
+	</combo_box>
+	<spinner label="Largeur" name="inventory_snapshot_width"/>
+	<spinner label="Hauteur" name="inventory_snapshot_height"/>
+	<check_box label="Conserver les proportions" name="inventory_keep_aspect_check"/>
+	<button label="Annuler" name="cancel_btn"/>
+	<button label="Enregistrer" name="save_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_snapshot_local.xml b/indra/newview/skins/default/xui/fr/panel_snapshot_local.xml
new file mode 100644
index 0000000000000000000000000000000000000000..41264521fd7c0f096750ae17c0e27ecf2f79a93d
--- /dev/null
+++ b/indra/newview/skins/default/xui/fr/panel_snapshot_local.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_local">
+	<text name="title">
+		Enregistrer sur mon ordinateur
+	</text>
+	<combo_box label="Résolution" name="local_size_combo">
+		<combo_box.item label="Fenêtre actuelle" name="CurrentWindow"/>
+		<combo_box.item label="320 x 240" name="320x240"/>
+		<combo_box.item label="640 x 480" name="640x480"/>
+		<combo_box.item label="800 x 600" name="800x600"/>
+		<combo_box.item label="1 024 x 768" name="1024x768"/>
+		<combo_box.item label="1 280 x 1 024" name="1280x1024"/>
+		<combo_box.item label="1 600 x 1 200" name="1600x1200"/>
+		<combo_box.item label="Personnalisée" name="Custom"/>
+	</combo_box>
+	<layout_stack name="local_image_params_ls">
+		<layout_panel name="local_image_size_lp">
+			<spinner label="Largeur" name="local_snapshot_width"/>
+			<spinner label="Hauteur" name="local_snapshot_height"/>
+			<check_box label="Conserver les proportions" name="local_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="local_image_format_quality_lp">
+			<combo_box label="Format" name="local_format_combo">
+				<combo_box.item label="PNG (sans perte)" name="PNG"/>
+				<combo_box.item label="JPEG" name="JPEG"/>
+				<combo_box.item label="BMP (sans perte)" name="BMP"/>
+			</combo_box>
+			<slider label="Qualité de l&apos;image" name="image_quality_slider"/>
+			<text name="image_quality_level">
+				([QLVL])
+			</text>
+		</layout_panel>
+	</layout_stack>
+	<button label="Annuler" name="cancel_btn"/>
+	<flyout_button label="Enregistrer" name="save_btn" tool_tip="Enregistrer l&apos;image dans un fichier.">
+		<flyout_button.item label="Enregistrer" name="save_item"/>
+		<flyout_button.item label="Enregistrer sous..." name="saveas_item"/>
+	</flyout_button>
+</panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_snapshot_options.xml b/indra/newview/skins/default/xui/fr/panel_snapshot_options.xml
new file mode 100644
index 0000000000000000000000000000000000000000..db3fcbeac9cf2a31d2548a1fd68e64a86d686ad9
--- /dev/null
+++ b/indra/newview/skins/default/xui/fr/panel_snapshot_options.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_options">
+	<button label="Publier sur le flux de mon profil" name="save_to_profile_btn"/>
+	<button label="Envoyer par e-mail" name="save_to_email_btn"/>
+	<button label="Enregistrer dans mon inventaire ([AMOUNT] L$)" name="save_to_inventory_btn"/>
+	<button label="Enregistrer sur mon ordinateur" name="save_to_computer_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_snapshot_postcard.xml b/indra/newview/skins/default/xui/fr/panel_snapshot_postcard.xml
new file mode 100644
index 0000000000000000000000000000000000000000..bb23b5285078a73d67ad0ad5366cff3edecdd1b4
--- /dev/null
+++ b/indra/newview/skins/default/xui/fr/panel_snapshot_postcard.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_postcard">
+	<string name="default_subject">
+		Carte postale de [SECOND_LIFE].
+	</string>
+	<string name="default_message">
+		Ouvrez-moi !
+	</string>
+	<string name="upload_message">
+		Envoi en cours...
+	</string>
+	<text name="title">
+		Envoyer par e-mail
+	</text>
+	<button label="Message" name="message_btn"/>
+	<button label="Paramètres" name="settings_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_snapshot_profile.xml b/indra/newview/skins/default/xui/fr/panel_snapshot_profile.xml
new file mode 100644
index 0000000000000000000000000000000000000000..427ffe211316b8a86f204ac39d677386416858b3
--- /dev/null
+++ b/indra/newview/skins/default/xui/fr/panel_snapshot_profile.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_profile">
+	<text name="title">
+		Publier sur le flux de mon profil
+	</text>
+	<combo_box label="Résolution" name="profile_size_combo">
+		<combo_box.item label="Fenêtre actuelle" name="CurrentWindow"/>
+		<combo_box.item label="640 x 480" name="640x480"/>
+		<combo_box.item label="800 x 600" name="800x600"/>
+		<combo_box.item label="1 024 x 768" name="1024x768"/>
+		<combo_box.item label="Personnalisée" name="Custom"/>
+	</combo_box>
+	<layout_stack name="profile_image_params_ls">
+		<layout_panel name="profile_image_size_lp">
+			<spinner label="Largeur" name="profile_snapshot_width"/>
+			<spinner label="Hauteur" name="profile_snapshot_height"/>
+			<check_box label="Conserver les proportions" name="profile_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="profile_image_metadata_lp">
+			<text name="caption_label">
+				Légende :
+			</text>
+			<check_box initial_value="true" label="Inclure l&apos;endroit" name="add_location_cb"/>
+		</layout_panel>
+	</layout_stack>
+	<button label="Annuler" name="cancel_btn"/>
+	<button label="Publier" name="post_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_status_bar.xml b/indra/newview/skins/default/xui/fr/panel_status_bar.xml
index e836c24a9499c261aa770e79842a784901dab0d9..ba36a7d2991f5f49f344a32bd45a51848422d851 100644
--- a/indra/newview/skins/default/xui/fr/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/fr/panel_status_bar.xml
@@ -15,14 +15,14 @@
 	<panel.string name="buycurrencylabel">
 		[AMT] L$
 	</panel.string>
-	<panel name="balance_bg">
+	<panel left="-405" name="balance_bg" width="195">
 		<text name="balance" tool_tip="Cliquer sur ce bouton pour actualiser votre solde en L$." value="20 L$"/>
-		<button label="Achat de L$" name="buyL" tool_tip="Cliquer pour acheter plus de L$"/>
-		<button label="Achats" name="goShop" tool_tip="Ouvrir la Place du marché Second Life"/>
+		<button label="Acheter L$" name="buyL" tool_tip="Cliquer pour acheter plus de L$."/>
+		<button label="Achats" name="goShop" tool_tip="Ouvrir la Place du marché Second Life." width="75"/>
 	</panel>
 	<text name="TimeText" tool_tip="Heure actuelle (Pacifique)">
 		00h00 PST
 	</text>
-	<button name="media_toggle_btn" tool_tip="Arrêter tous les médias (musique, vidéo, pages web)"/>
-	<button name="volume_btn" tool_tip="Contrôle du volume global"/>
+	<button name="media_toggle_btn" tool_tip="Arrêter tous les médias (musique, vidéo, pages web)."/>
+	<button name="volume_btn" tool_tip="Régler le volume global."/>
 </panel>
diff --git a/indra/newview/skins/default/xui/fr/sidepanel_inventory.xml b/indra/newview/skins/default/xui/fr/sidepanel_inventory.xml
index 969bd1ac447809e7d8a40646df89240ef97b8336..1b9c8326799883a2d5423be00fffb56507475b4b 100644
--- a/indra/newview/skins/default/xui/fr/sidepanel_inventory.xml
+++ b/indra/newview/skins/default/xui/fr/sidepanel_inventory.xml
@@ -2,47 +2,24 @@
 <panel label="Choses" name="objects panel">
 	<panel label="" name="sidepanel__inventory_panel">
 		<layout_stack name="inventory_layout_stack">
-			<layout_panel name="inbox_outbox_layout_panel">
-				<layout_stack name="inbox_outbox_layout_stack">
-					<layout_panel name="inbox_layout_panel">
-						<panel label="" name="marketplace_inbox">
-							<string name="InboxLabelWithArg">
-								Articles reçus ([NUM])
-							</string>
-							<string name="InboxLabelNoArg">
-								Articles reçus
-							</string>
-							<button label="Articles reçus" name="inbox_btn"/>
-							<text name="inbox_fresh_new_count">
-								[NUM] nouv.
-							</text>
-							<panel tool_tip="Drag and drop items to your inventory to manage and use them">
-								<text name="inbox_inventory_placeholder">
-									Ici seront livrés les achats effectués sur la Place du marché.
-								</text>
-							</panel>
-						</panel>
-					</layout_panel>
-					<layout_panel name="outbox_layout_panel">
-						<panel label="" name="marketplace_outbox">
-							<string name="OutboxLabelWithArg">
-								Boîte d&apos;envoi vendeur ([NUM])
-							</string>
-							<string name="OutboxLabelNoArg">
-								Boîte d&apos;envoi vendeur
-							</string>
-							<button label="Boîte d&apos;envoi vendeur" name="outbox_btn"/>
-							<button label="" name="outbox_sync_btn" tool_tip="Vers ma vitrine de la Place du marché"/>
-							<panel>
-								<panel name="outbox_inventory_placeholder_panel">
-									<text name="outbox_inventory_placeholder_title">
-										Chargement...
-									</text>
-								</panel>
-							</panel>
-						</panel>
-					</layout_panel>
-				</layout_stack>
+			<layout_panel name="inbox_layout_panel">
+				<panel label="" name="marketplace_inbox">
+					<string name="InboxLabelWithArg">
+						Articles reçus ([NUM])
+					</string>
+					<string name="InboxLabelNoArg">
+						Articles reçus
+					</string>
+					<button label="Articles reçus" name="inbox_btn"/>
+					<text name="inbox_fresh_new_count">
+						[NUM] nouv.
+					</text>
+					<panel name="inbox_inventory_placeholder_panel" tool_tip="Glisser-déposer des articles dans votre inventaire pour les utiliser.">
+						<text name="inbox_inventory_placeholder">
+							Ici seront livrés les achats effectués sur la Place du marché.
+						</text>
+					</panel>
+				</panel>
 			</layout_panel>
 		</layout_stack>
 		<panel name="button_panel">
diff --git a/indra/newview/skins/default/xui/fr/strings.xml b/indra/newview/skins/default/xui/fr/strings.xml
index daa31c980a7bab5a50ca5647807887316e8a44b3..3eebed450f6eaa48843ad77c49cd9a9a593f3320 100644
--- a/indra/newview/skins/default/xui/fr/strings.xml
+++ b/indra/newview/skins/default/xui/fr/strings.xml
@@ -181,8 +181,8 @@ Consultez la page www.secondlife.com/status pour plus d&apos;informations.
 	</string>
 	<string name="LoginFailedPremiumOnly">
 		Les connexions à Second Life sont temporairement limitées afin de s&apos;assurer que l&apos;expérience des utilisateurs présents dans le monde virtuel soit optimale.
-	 	
-Les personnes disposant de comptes gratuits ne pourront pas accéder à Second Life pendant ce temps afin de permettre à celles qui ont payé pour pouvoir utiliser Second Life puissent le faire.
+
+Les personnes disposant de comptes gratuits ne pourront pas accéder à Second Life pendant ce temps afin de permettre à celles qui ont payé pour pouvoir utiliser Second Life de le faire.
 	</string>
 	<string name="LoginFailedComputerProhibited">
 		Impossible d&apos;accéder à Second Life depuis cet ordinateur.
@@ -339,17 +339,35 @@ Veuillez réessayer de vous connecter dans une minute.
 		Impossible de faire glisser plus d&apos;un objet ici
 	</string>
 	<string name="TooltipPrice" value="[AMOUNT] L$ :"/>
+	<string name="TooltipOutboxDragToWorld">
+		Impossible de rezzer des articles dans la boîte d&apos;envoi vendeur
+	</string>
 	<string name="TooltipOutboxNoTransfer">
-		Impossible de vendre ou de transférer un ou plusieurs de ces objets à un autre utilisateur.
+		Impossible de vendre ou de transférer un ou plusieurs de ces objets.
+	</string>
+	<string name="TooltipOutboxNotInInventory">
+		La boîte d&apos;envoi vendeur n&apos;accepte que les articles directement issus de votre inventaire.
 	</string>
 	<string name="TooltipOutboxWorn">
-		Vous portez un ou plusieurs de ces objets. Retirez-les de votre avatar, puis réessayez de les déplacer.
+		Impossible de placer des articles que vous portez dans votre boîte d&apos;envoi vendeur
+	</string>
+	<string name="TooltipOutboxCallingCard">
+		Impossible de placer des cartes de visite dans votre boîte d&apos;envoi vendeur
 	</string>
 	<string name="TooltipOutboxFolderLevels">
-		Trop de niveaux de sous-dossiers dans ce dossier. Réorganisez-le de sorte qu&apos;un maximum de 4 niveaux soit utilisé (dossier racine contenant A contenant B contenant C).
+		Il existe plus de 3 niveaux de dossiers imbriqués.
+	</string>
+	<string name="TooltipOutboxTooManyFolders">
+		Le dossier de niveau supérieur contient plus de 20 sous-dossiers.
 	</string>
 	<string name="TooltipOutboxTooManyObjects">
-		Ce dossier contient plus de 200 objets. Regroupez une partie des articles dans un paquet afin de réduire le nombre d&apos;objets.
+		Le dossier de niveau supérieur contient plus de 200 articles.
+	</string>
+	<string name="TooltipDragOntoOwnChild">
+		Impossible de déplacer un dossier vers son enfant
+	</string>
+	<string name="TooltipDragOntoSelf">
+		Impossible de déplacer un dossier vers lui-même
 	</string>
 	<string name="TooltipHttpUrl">
 		Cliquez pour afficher cette page web
@@ -817,6 +835,9 @@ Veuillez réessayer de vous connecter dans une minute.
 	<string name="anim_yes_head">
 		Oui
 	</string>
+	<string name="multiple_textures">
+		Multiples
+	</string>
 	<string name="texture_loading">
 		Chargement...
 	</string>
@@ -976,6 +997,9 @@ Veuillez réessayer de vous connecter dans une minute.
 	<string name="choose_the_directory">
 		Choisir le répertoire
 	</string>
+	<string name="script_files">
+		Scripts
+	</string>
 	<string name="AvatarSetNotAway">
 		Présent
 	</string>
@@ -1214,43 +1238,36 @@ Veuillez réessayer de vous connecter dans une minute.
 		Vous n&apos;avez pas de copie de cette texture dans votre inventaire
 	</string>
 	<string name="InventoryInboxNoItems">
-		Ici seront livrés les articles achetés sur la Place du marché.
+		Les achats que vous avez effectués sur la Place du marché s&apos;affichent ici. Vous pouvez alors les faire glisser vers votre inventaire afin de les utiliser.
 	</string>
 	<string name="MarketplaceURL">
-		http://marketplace.[DOMAIN_NAME]
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/
 	</string>
 	<string name="MarketplaceURL_CreateStore">
-		http://marketplace.[DOMAIN_NAME]/create_store
+		http://community.secondlife.com/t5/English-Knowledge-Base/Selling-in-the-Marketplace/ta-p/700193#Section_.4
 	</string>
-	<string name="MarketplaceURL_LearnMore">
-		http://marketplace.[DOMAIN_NAME]/learn_more
-	</string>
-	<string name="InventoryOutboxCreationErrorTitle">
-		Configuration incorrecte de votre boîte d&apos;envoi vendeur
+	<string name="MarketplaceURL_Dashboard">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/merchants/store/dashboard
 	</string>
-	<string name="InventoryOutboxCreationErrorTooltip">
-		Erreur de configuration de la boîte d&apos;envoi vendeur
+	<string name="MarketplaceURL_Imports">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/merchants/store/imports
 	</string>
-	<string name="InventoryOutboxCreationError">
-		Veuillez contacter le service clientèle pour résoudre le problème.
+	<string name="MarketplaceURL_LearnMore">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/learn_more
 	</string>
 	<string name="InventoryOutboxNotMerchantTitle">
-		Tout le monde peut vendre des articles sur la Place du marché
-	</string>
-	<string name="InventoryOutboxNotMerchantTooltip">
-		Devenez vendeur !
+		Tout le monde peut vendre des articles sur la Place du marché.
 	</string>
+	<string name="InventoryOutboxNotMerchantTooltip"/>
 	<string name="InventoryOutboxNotMerchant">
-		[[MARKETPLACE_URL] La Place du marché Second Life] comprend plus d&apos;un million de produits virtuels à vendre, tous créés par des résidents. Vous aussi pouvez vendre les articles que vous créez, ainsi que certains articles que vous avez achetés. Le processus est simple et la configuration gratuite. [[LEARN_MORE_URL] En savoir plus] ou [[CREATE_STORE_URL] créer une boutique] sur la Place du marché pour démarrer
+		Pour devenir vendeur, vous devez [[MARKETPLACE_CREATE_STORE_URL] créer une boutique sur la Place du marché].
 	</string>
 	<string name="InventoryOutboxNoItemsTitle">
-		Un nouveau moyen d&apos;envoyer des articles sur la Place du marché
-	</string>
-	<string name="InventoryOutboxNoItemsTooltip">
-		Glisser-déposer des articles ici afin de les préparer à la vente sur la Place du marché.
+		Votre boîte d&apos;envoi est vide.
 	</string>
+	<string name="InventoryOutboxNoItemsTooltip"/>
 	<string name="InventoryOutboxNoItems">
-		Faites glisser les articles ou dossiers d&apos;articles à vendre dans cette zone. Une copie de l&apos;article s&apos;affiche, sans que votre inventaire ne soit modifié, sauf si vous avez fait glisser un article pour lequel la copie est interdite. Une fois prêt à envoyer les articles vers la Place du marché, cliquez sur le bouton Charger. Les articles disparaissent de ce dossier lorsqu&apos;ils ont été déplacés vers l&apos;inventaire de la Place du marché.
+		Pour mettre des dossiers en vente sur la [[MARKETPLACE_DASHBOARD_URL] Place du marché], faites-les glisser vers cette zone et cliquez sur &quot;Envoyer vers la Place du marché&quot;.
 	</string>
 	<string name="Marketplace Error None">
 		Aucune erreur
@@ -1412,6 +1429,9 @@ Veuillez réessayer de vous connecter dans une minute.
 	<string name="no_attachments">
 		Aucun élément attaché porté
 	</string>
+	<string name="Attachments remain">
+		Éléments attachés ([COUNT] emplacements restants)
+	</string>
 	<string name="Buy">
 		Acheter
 	</string>
@@ -1538,6 +1558,12 @@ Veuillez réessayer de vous connecter dans une minute.
 	<string name="Right Pec">
 		Pectoral droit
 	</string>
+	<string name="Neck">
+		Cou
+	</string>
+	<string name="Avatar Center">
+		Centre de l&apos;avatar
+	</string>
 	<string name="Invalid Attachment">
 		Point d&apos;attache non valide
 	</string>
@@ -3898,6 +3924,9 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 	<string name="Saved_message">
 		(Enregistrement : [LONG_TIMESTAMP])
 	</string>
+	<string name="IM_unblock_only_groups_friends">
+		Pour afficher ce message, vous devez désactiver la case Seuls mes amis et groupes peuvent m&apos;appeler ou m&apos;envoyer un IM, sous Préférences/Confidentialité.
+	</string>
 	<string name="answered_call">
 		Votre appel a fait l&apos;objet d&apos;une réponse
 	</string>
@@ -4030,6 +4059,18 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 	<string name="you_paid_ldollars_no_name">
 		Vous avez payé à [AMOUNT] L$ [REASON].
 	</string>
+	<string name="you_paid_failure_ldollars">
+		Votre paiement de [AMOUNT] L$ à [NAME] [REASON] a échoué.
+	</string>
+	<string name="you_paid_failure_ldollars_no_info">
+		Votre paiement de [AMOUNT] L$ a échoué.
+	</string>
+	<string name="you_paid_failure_ldollars_no_reason">
+		Votre paiement de [AMOUNT] L$ à [NAME] a échoué.
+	</string>
+	<string name="you_paid_failure_ldollars_no_name">
+		Votre paiement de [AMOUNT] L$ [REASON] a échoué.
+	</string>
 	<string name="for item">
 		pour l&apos;article suivant : [ITEM]
 	</string>
@@ -4082,9 +4123,9 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 		En ligne
 	</string>
 	<string name="uploading_abuse_report">
-		Chargement en cours... 
+		Chargement...
 
-de l&apos;infraction signalée
+du rapport d&apos;infraction
 	</string>
 	<string name="New Shape">
 		Nouvelle silhouette
@@ -4351,7 +4392,7 @@ de l&apos;infraction signalée
 	<string name="server_is_down">
 		Malgré nos efforts, une erreur inattendue s&apos;est produite.
 
-	Veuillez vous reporter à status.secondlifegrid.net afin de déterminer si un problème connu existe avec ce service.  
+	Veuillez vous reporter à status.secondlifegrid.net afin de déterminer si un problème connu existe avec ce service.
         Si le problème persiste, vérifiez la configuration de votre réseau et de votre pare-feu.
 	</string>
 	<string name="dateTimeWeekdaysNames">
@@ -4440,6 +4481,12 @@ Essayez avec le chemin d&apos;accès à l&apos;éditeur entre guillemets doubles
 	<string name="ExternalEditorFailedToRun">
 		Échec d&apos;exécution de l&apos;éditeur externe.
 	</string>
+	<string name="TranslationFailed">
+		Échec de traduction : [REASON]
+	</string>
+	<string name="TranslationResponseParseError">
+		Erreur lors de l&apos;analyse de la réponse relative à la traduction.
+	</string>
 	<string name="Esc">
 		Échap
 	</string>
@@ -4810,7 +4857,10 @@ Essayez avec le chemin d&apos;accès à l&apos;éditeur entre guillemets doubles
 		Mini-carte
 	</string>
 	<string name="Command_Move_Label">
-		Bouger
+		Marcher / Courir / Voler
+	</string>
+	<string name="Command_Outbox_Label">
+		Boîte d&apos;envoi vendeur
 	</string>
 	<string name="Command_People_Label">
 		Personnes
@@ -4837,10 +4887,10 @@ Essayez avec le chemin d&apos;accès à l&apos;éditeur entre guillemets doubles
 		Parler
 	</string>
 	<string name="Command_View_Label">
-		Vue
+		Paramètres de la caméra
 	</string>
 	<string name="Command_Voice_Label">
-		Chat près de vous
+		Paramètres vocaux
 	</string>
 	<string name="Command_AboutLand_Tooltip">
 		Information sur le terrain que vous visitez
@@ -4884,6 +4934,9 @@ Essayez avec le chemin d&apos;accès à l&apos;éditeur entre guillemets doubles
 	<string name="Command_Move_Tooltip">
 		Faire bouger votre avatar
 	</string>
+	<string name="Command_Outbox_Tooltip">
+		Transférer des articles vers votre place de marché afin de les vendre.
+	</string>
 	<string name="Command_People_Tooltip">
 		Amis, groupes et personnes près de vous
 	</string>
@@ -4912,7 +4965,16 @@ Essayez avec le chemin d&apos;accès à l&apos;éditeur entre guillemets doubles
 		Changer l&apos;angle de la caméra
 	</string>
 	<string name="Command_Voice_Tooltip">
-		Personnes près de vous avec le chat vocal
+		Commandes de réglage du volume des appels et des personnes près de vous dans Second Life.
+	</string>
+	<string name="Toolbar_Bottom_Tooltip">
+		actuellement dans la barre d&apos;outils du bas
+	</string>
+	<string name="Toolbar_Left_Tooltip">
+		actuellement dans la barre d&apos;outils de gauche
+	</string>
+	<string name="Toolbar_Right_Tooltip">
+		actuellement dans la barre d&apos;outils de droite
 	</string>
 	<string name="Retain%">
 		Garder%
@@ -4938,4 +5000,19 @@ Essayez avec le chemin d&apos;accès à l&apos;éditeur entre guillemets doubles
 	<string name="Normal">
 		Normal
 	</string>
+	<string name="snapshot_quality_very_low">
+		Très faible
+	</string>
+	<string name="snapshot_quality_low">
+		Faible
+	</string>
+	<string name="snapshot_quality_medium">
+		Moyenne
+	</string>
+	<string name="snapshot_quality_high">
+		Élevée
+	</string>
+	<string name="snapshot_quality_very_high">
+		Très élevée
+	</string>
 </strings>
diff --git a/indra/newview/skins/default/xui/fr/teleport_strings.xml b/indra/newview/skins/default/xui/fr/teleport_strings.xml
index 401b272c81360c746e735cc2d741a623a06d0685..d0c74ff353013fab606fc4c08193abe0d91bda50 100644
--- a/indra/newview/skins/default/xui/fr/teleport_strings.xml
+++ b/indra/newview/skins/default/xui/fr/teleport_strings.xml
@@ -21,8 +21,8 @@ Si vous ne parvenez toujours pas à être téléporté, déconnectez-vous puis r
 Veuillez réessayer dans un moment.
 		</message>
 		<message name="NoHelpIslandTP">
-		Vous ne pouvez pas retourner sur Welcome Island.
-Pour répéter le didacticiel, veuillez aller sur Welcome Island Public.
+			Vous ne pouvez pas vous téléporter à nouveau vers Welcome Island.
+Pour recommencer le didacticiel, accédez à Welcome Island Public.
 		</message>
 		<message name="noaccess_tport">
 			Désolé, vous n&apos;avez pas accès à cette destination.
diff --git a/indra/newview/skins/default/xui/it/floater_about.xml b/indra/newview/skins/default/xui/it/floater_about.xml
index 68d073a7669ae99be87e459b67f41ded0bb74437..39114b7bf73d2cf3874b3d940f17a2a0bcdf1985 100644
--- a/indra/newview/skins/default/xui/it/floater_about.xml
+++ b/indra/newview/skins/default/xui/it/floater_about.xml
@@ -67,32 +67,34 @@ Versione Server voice: [VOICE_VERSION]
 		<panel label="Licenze" name="licenses_panel">
 			<text_editor name="credits_editor">
 				3Dconnexion SDK Copyright (C) 1992-2007 3Dconnexion
-APR Copyright (C) 2000-2004 The Apache Software Foundation
-Collada DOM Copyright 2005 Sony Computer Entertainment Inc.
-cURL Copyright (C) 1996-2002, Daniel Stenberg, (daniel@haxx.se)
-DBus/dbus-glib Copyright (C) 2002, 2003  CodeFactory AB / Copyright (C) 2003, 2004 Red Hat, Inc.
-expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
-FreeType Copyright (C) 1996-2002, The FreeType Project (www.freetype.org).
-GL Copyright (C) 1999-2004 Brian Paul.
-GLOD Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University and David Luebke, Brenden Schubert, University of Virginia.
-google-perftools Copyright (c) 2005, Google Inc.
-Havok.com(TM) Copyright (C) 1999-2001, Telekinesys Research Limited.
-jpeg2000 Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW)
-jpeglib Copyright (C) 1991-1998, Thomas G. Lane.
-ogg/vorbis Copyright (C) 2001, Xiphophorus
-OpenSSL Copyright (C) 1998-2002 The OpenSSL Project.
-PCRE Copyright (c) 1997-2008 University of Cambridge
-SDL Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
-SSLeay Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
-xmlrpc-epi Copyright (C) 2000 Epinions, Inc.
-zlib Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler.
-google-perftools Copyright (c) 2005, Google Inc.
+        APR Copyright (C) 2000-2004 The Apache Software Foundation
+        Collada DOM Copyright 2005 Sony Computer Entertainment Inc.
+        cURL Copyright (C) 1996-2002, Daniel Stenberg, (daniel@haxx.se)
+        DBus/dbus-glib Copyright (C) 2002, 2003  CodeFactory AB / Copyright (C) 2003, 2004 Red Hat, Inc.
+        expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
+        FreeType Copyright (C) 1996-2002, The FreeType Project (www.freetype.org).
+        GL Copyright (C) 1999-2004 Brian Paul.
+        GLOD Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University and David Luebke, Brenden Schubert, University of Virginia.
+        google-perftools Copyright (c) 2005, Google Inc.
+        Havok.com(TM) Copyright (C) 1999-2001, Telekinesys Research Limited.
+        jpeg2000 Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW)
+        jpeglib Copyright (C) 1991-1998, Thomas G. Lane.
+        ogg/vorbis Copyright (C) 2001, Xiphophorus
+        OpenSSL Copyright (C) 1998-2002 The OpenSSL Project.
+        PCRE Copyright (c) 1997-2008 University of Cambridge
+        SDL Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
+        SSLeay Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+        xmlrpc-epi Copyright (C) 2000 Epinions, Inc.
+        zlib Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler.
+        google-perftools Copyright (c) 2005, Google Inc.
 
-Il Viewer Second Life utilizza Havok (TM) Physics. (c)Copyright 1999-2010 Havok.com Inc. (e licenziatari). Tutti i diritti riservati. Per informazioni dettagliate, vedere www.havok.com.
+        Il Viewer Second Life utilizza Havok (TM) Physics. (c)Copyright 1999-2010 Havok.com Inc. (e licenziatari). Tutti i diritti riservati. Per informazioni dettagliate, vedere www.havok.com.
 
-Tutti i diritti riservati.  Per informazioni dettagliate, vedere licenses.txt.
+        Questo software contiene codice sorgente fornito da NVIDIA Corporation.
 
-Codifica audio chat vocale: Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C)
+        Tutti i diritti riservati.  Per informazioni dettagliate, vedere licenses.txt.
+
+        Codifica audio chat vocale: Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C)
 			</text_editor>
 		</panel>
 	</tab_container>
diff --git a/indra/newview/skins/default/xui/it/floater_about_land.xml b/indra/newview/skins/default/xui/it/floater_about_land.xml
index b6bfb4aadf11a6fb2adf5236120d9a7905f68865..cfc3ad8fdb538f4a28241ed9af6951614c28fa8c 100644
--- a/indra/newview/skins/default/xui/it/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/it/floater_about_land.xml
@@ -133,7 +133,7 @@ Vai al menu Mondo &gt; Informazioni sul terreno oppure seleziona un altro appezz
 				Traffico:
 			</text>
 			<text name="DwellText" width="140">
-				0
+				Caricamento in corso...
 			</text>
 			<button label="Acquista il terreno..." label_selected="Acquista il terreno..." left="130" name="Buy Land..." width="125"/>
 			<button label="Vendita Linden" name="Linden Sale..." tool_tip="La terra deve essere di proprietà, con contenuto impostato, e non già messa all&apos;asta."/>
@@ -314,13 +314,15 @@ Solamente terreni più grandi possono essere abilitati nella ricerca.
 				Nessuna spinta (Impostazione regionale)
 			</panel.string>
 			<panel.string name="see_avs_text">
-				Vedi i residenti in questo lotto e chatta con loro
+				Gli avatar in altri lotti possono vedere
 			</panel.string>
 			<text name="allow_label">
 				Permetti ad altri residenti di:
 			</text>
-			<check_box label="Modificare il terreno" name="edit land check" tool_tip="Se spuntata, chiunque può terraformare il tuo terreno. È preferibile lasciare questa opzione non spuntata, dato che sarai comunque in grado di modificare il tuo terreno."/>
-			<check_box label="Permetti il volo" name="check fly" tool_tip="Se spuntato, gli altri residenti potranno volare sul tuo terreno. Se non spuntato, potranno solamente arrivare in volo o sorvolare il terreno."/>
+			<text name="allow_label0">
+				Vola:
+			</text>
+			<check_box label="Tutti" name="check fly" tool_tip="Se spuntato, gli altri residenti potranno volare sul tuo terreno. Se non spuntato, potranno solamente arrivare in volo o sorvolare il terreno."/>
 			<text name="allow_label2">
 				Creare oggetti:
 			</text>
@@ -336,9 +338,6 @@ Solamente terreni più grandi possono essere abilitati nella ricerca.
 			</text>
 			<check_box label="Tutti i residenti" name="check other scripts"/>
 			<check_box label="Gruppo" name="check group scripts"/>
-			<text name="land_options_label">
-				Opzioni per il terreno:
-			</text>
 			<check_box label="Sicuro (senza danno)" name="check safe" tool_tip="Se spuntato, imposta il terreno su &apos;sicuro&apos;, disabilitando i danni da combattimento. Se non spuntato, viene abilitato il combattimento con danni."/>
 			<check_box label="Nessuna spinta" name="PushRestrictCheck" tool_tip="Previeni i colpi. Selezionare questa opzione può essere utile per prevenire comportamenti dannosi sul tuo terreno."/>
 			<check_box label="Mostra luogo nella ricerca (30 L$/settimana)" name="ShowDirectoryCheck" tool_tip="Consenti che il lotto sia visto nei risultati di ricerca"/>
@@ -379,9 +378,9 @@ Solamente terreni più grandi possono essere abilitati nella ricerca.
 			</text>
 			<texture_picker label="" name="snapshot_ctrl" tool_tip="Clicca per scegliere una immagine"/>
 			<text name="allow_label5">
-				Permetti ai residenti in altri lotti di:
+				Gli avatar su altri lotti possono vedere gli avatar su questo lotto e chattare con loro
 			</text>
-			<check_box label="Vedi avatar" name="SeeAvatarsCheck" tool_tip="Consente ai residenti in altri lotti di vedere i residenti in questo lotto e chattare con loro, e ti consente di vederli e chattare con loro."/>
+			<check_box label="Vedi avatar" name="SeeAvatarsCheck" tool_tip="Consente ad avatar in altri lotti di vedere e chattare con avatar in questo lotto e viceversa."/>
 			<text name="landing_point">
 				Punto di atterraggio: [LANDING]
 			</text>
@@ -466,12 +465,12 @@ Media:
 			<text name="Limit access to this parcel to:">
 				Accesso a questo terreno
 			</text>
-			<check_box label="Consenti l&apos;accesso pubblico [MATURITY]" name="public_access"/>
+			<check_box label="Consenti l&apos;accesso pubblico (se si rimuove la selezione vengono create linee di espulsione)" name="public_access"/>
 			<text name="Only Allow">
-				Consenti l&apos;accesso soltanto ai residenti verificati tramite:
+				Consenti l&apos;accesso solo ai Residenti che:
 			</text>
-			<check_box label="Informazioni di pagamento in archivio [ESTATE_PAYMENT_LIMIT]" name="limit_payment" tool_tip="Espelli i residenti non identificati."/>
-			<check_box label="Verifica dell&apos;età [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="Espelli i residenti che non hanno la loro età verificata. Vedi [SUPPORT_SITE] per maggiori informazioni."/>
+			<check_box label="Hanno informazioni di pagamento in archivio [ESTATE_PAYMENT_LIMIT]" name="limit_payment" tool_tip="Per poter visitare questo lotto i Residenti devono aver fornito informazioni di pagamento a Linden Lab.  Vedi [SUPPORT_SITE] per maggiori informazioni."/>
+			<check_box label="Hanno verificato l&apos;età [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="Per poter visitare questo lotto i Residenti devono aver verificato la propria età. Vedi [SUPPORT_SITE] per maggiori informazioni."/>
 			<check_box label="Permetti accesso al gruppo: [GROUP]" name="GroupCheck" tool_tip="Imposta il gruppo nel pannello generale."/>
 			<check_box label="Vendi pass a:" name="PassCheck" tool_tip="Permetti in questo terreno l&apos;accesso temporaneo"/>
 			<combo_box name="pass_combo">
diff --git a/indra/newview/skins/default/xui/it/floater_animation_anim_preview.xml b/indra/newview/skins/default/xui/it/floater_animation_anim_preview.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a2bce0014175004bb05fa8a4c8d9b61881d99ac4
--- /dev/null
+++ b/indra/newview/skins/default/xui/it/floater_animation_anim_preview.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Anim Preview" title="ANIMATION.ANIM">
+	<text name="name_label">
+		Nome:
+	</text>
+	<text name="description_label">
+		Descrizione:
+	</text>
+	<button label="Carica ([AMOUNT] L$)" name="ok_btn"/>
+	<button label="Annulla" label_selected="Annulla" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/it/floater_animation_bvh_preview.xml b/indra/newview/skins/default/xui/it/floater_animation_bvh_preview.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a4319f2e77ed253209ebd5f0732adbdd46bfcbc6
--- /dev/null
+++ b/indra/newview/skins/default/xui/it/floater_animation_bvh_preview.xml
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Animation Preview">
+	<floater.string name="failed_to_initialize">
+		Movimento non inizializzato
+	</floater.string>
+	<floater.string name="anim_too_long">
+		La lunghezza del file di animazione è di [LENGTH] secondi.
+
+La lunghezza massima dell&apos;animazione è [MAX_LENGTH] secondi.
+	</floater.string>
+	<floater.string name="failed_file_read">
+		Impossibile leggere il file di animazione.
+
+[STATUS]
+	</floater.string>
+	<floater.string name="E_ST_OK">
+		Ok
+	</floater.string>
+	<floater.string name="E_ST_EOF">
+		Fine prematura del file.
+	</floater.string>
+	<floater.string name="E_ST_NO_CONSTRAINT">
+		Impossibile leggere la definizione del vincolo.
+	</floater.string>
+	<floater.string name="E_ST_NO_FILE">
+		Impossibile aprire il file BVH.
+	</floater.string>
+	<floater.string name="E_ST_NO_HIER">
+		Intestazione HIERARCHY non valida.
+	</floater.string>
+	<floater.string name="E_ST_NO_JOINT">
+		Impossibile trovare la ROOT o JOINT.
+	</floater.string>
+	<floater.string name="E_ST_NO_NAME">
+		Impossibile trovare il nome JOINT.
+	</floater.string>
+	<floater.string name="E_ST_NO_OFFSET">
+		Impossibile trovare OFFSET.
+	</floater.string>
+	<floater.string name="E_ST_NO_CHANNELS">
+		Impossibile trovare CHANNELS.
+	</floater.string>
+	<floater.string name="E_ST_NO_ROTATION">
+		Impossibile ottenere un ordine di rotazione.
+	</floater.string>
+	<floater.string name="E_ST_NO_AXIS">
+		Rotazione dell&apos;asse non disponibile.
+	</floater.string>
+	<floater.string name="E_ST_NO_MOTION">
+		Impossibile trovare MOTION.
+	</floater.string>
+	<floater.string name="E_ST_NO_FRAMES">
+		Impossibile ottenere il numero dei frame.
+	</floater.string>
+	<floater.string name="E_ST_NO_FRAME_TIME">
+		Impossibile ottenere il tempo del frame.
+	</floater.string>
+	<floater.string name="E_ST_NO_POS">
+		Impossibile ottenere i valori della posizione.
+	</floater.string>
+	<floater.string name="E_ST_NO_ROT">
+		Impossibile ottenere i valori di rotazione.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_FILE">
+		Impossibile aprire il file di traduzione.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_HEADER">
+		Impossibile leggere l&apos;intestazione della traduzione.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_NAME">
+		Impossibile leggere i nomi della traduzione.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_IGNORE">
+		Impossibile leggere la traduzione, ignora il valore.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_RELATIVE">
+		Impossibile leggere la traduzione del valore relativo.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_OUTNAME">
+		Valore non trovato.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MATRIX">
+		Impossibile leggere la matrice di traduzione.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MERGECHILD">
+		Impossibile trovare il nome mergechild.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MERGEPARENT">
+		Impossibile ottenere il nome mergeparent.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_PRIORITY">
+		Impossibile ottenere il valore di priorità.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_LOOP">
+		Impossibile ottenere il valore di ripetizione.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EASEIN">
+		Impossibile ottenere i valori easeIn.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EASEOUT">
+		Cannot get ease Out values.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_HAND">
+		Impossibile ottenere il valore morph della mano.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EMOTE">
+		Impossibile leggere il nome emote.
+	</floater.string>
+	<floater.string name="E_ST_BAD_ROOT">
+		Nome non corretto del root joint, usa &quot;hip&quot;.
+	</floater.string>
+	<text name="name_label">
+		Nome:
+	</text>
+	<text name="description_label">
+		Descrizione:
+	</text>
+	<spinner label="Priorità" name="priority" tool_tip="Definisce quali altre animazioni possono essere sostituite da questa animazione"/>
+	<check_box label="Ripetizione" name="loop_check" tool_tip="Riproduce questa animazione in ripetizione"/>
+	<spinner label="Dentro(%)" name="loop_in_point" tool_tip="Imposta il punto sul quale ritorna l&apos;animazione"/>
+	<spinner label="Fuori(%)" name="loop_out_point" tool_tip="Imposta il punto sul quale termina l&apos;animazione"/>
+	<text name="hand_label">
+		Posa delle mani
+	</text>
+	<combo_box name="hand_pose_combo" tool_tip="Definisce ciò che fanno le mani durante l&apos;animazione">
+		<combo_box.item label="Estese" name="Spread"/>
+		<combo_box.item label="Rilassate" name="Relaxed"/>
+		<combo_box.item label="Indicano entrambe" name="PointBoth"/>
+		<combo_box.item label="Pugno" name="Fist"/>
+		<combo_box.item label="Sinistra rilassata" name="RelaxedLeft"/>
+		<combo_box.item label="Indica sinistra" name="PointLeft"/>
+		<combo_box.item label="Pugno con la sinistra" name="FistLeft"/>
+		<combo_box.item label="Destra rilassata" name="RelaxedRight"/>
+		<combo_box.item label="Indica destra" name="PointRight"/>
+		<combo_box.item label="Pugno destro" name="FistRight"/>
+		<combo_box.item label="Saluta a destra" name="SaluteRight"/>
+		<combo_box.item label="Battitura" name="Typing"/>
+		<combo_box.item label="Pace a destra" name="PeaceRight"/>
+	</combo_box>
+	<text name="emote_label">
+		Espressione
+	</text>
+	<combo_box name="emote_combo" tool_tip="Definisce ciò che fa il viso durante l&apos;animazione">
+		<item label="(Nulla)" name="[None]" value=""/>
+		<item label="Aaaaah" name="Aaaaah" value="Aaaaah"/>
+		<item label="Spavento" name="Afraid" value="Spavento"/>
+		<item label="Arrabbiato" name="Angry" value="Arrabbiato"/>
+		<item label="Grande sorriso" name="BigSmile" value="Grande sorriso"/>
+		<item label="Annoiato" name="Bored" value="Annoiato"/>
+		<item label="Pianto" name="Cry" value="Pianto"/>
+		<item label="Disdegno" name="Disdain" value="Disdegno"/>
+		<item label="Imbarazzato" name="Embarrassed" value="Imbarazzato"/>
+		<item label="Accigliato" name="Frown" value="Accigliato"/>
+		<item label="Bacio" name="Kiss" value="Bacio"/>
+		<item label="Risata" name="Laugh" value="Risata"/>
+		<item label="Linguaccia" name="Plllppt" value="Linguaccia"/>
+		<item label="Repulsione" name="Repulsed" value="Repulsione"/>
+		<item label="Triste" name="Sad" value="Triste"/>
+		<item label="Scrollata di spalle" name="Shrug" value="Scrollata di spalle"/>
+		<item label="Sorriso" name="Smile" value="Sorriso"/>
+		<item label="Stupore" name="Surprise" value="Stupore"/>
+		<item label="Occhiolino" name="Wink" value="Occhiolino"/>
+		<item label="Preoccupato" name="Worry" value="Preoccupato"/>
+	</combo_box>
+	<text name="preview_label">
+		Anteprima mentre
+	</text>
+	<combo_box name="preview_base_anim" tool_tip="Prova il comportamento dell&apos;animazione mentre l&apos;avatar esegue attività comuni.">
+		<item label="In piedi" name="Standing" value="In piedi"/>
+		<item label="Camminare" name="Walking" value="Camminare"/>
+		<item label="Seduto" name="Sitting" value="Seduto"/>
+		<item label="Volare" name="Flying" value="Volare"/>
+	</combo_box>
+	<spinner label="Transizione in ingresso (sec)" name="ease_in_time" tool_tip="Durata (in secondi) della fusione in entrata delle animazioni"/>
+	<spinner label="Transizione in uscita (sec)" name="ease_out_time" tool_tip="Durata (in secondi) della fusione in uscita delle animazioni"/>
+	<button name="play_btn" tool_tip="Riproduci la tua animazione"/>
+	<button name="pause_btn" tool_tip="Metti in pausa la tua animazione"/>
+	<button name="stop_btn" tool_tip="Interrompi la riproduzione dell&apos;animazione"/>
+	<text name="bad_animation_text">
+		Impossibile leggere il file di animazione.
+
+Consigliamo file BVH esportati da Poser 4.
+	</text>
+	<button label="Carica ([AMOUNT] L$)" name="ok_btn"/>
+	<button label="Annulla" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/it/floater_avatar.xml b/indra/newview/skins/default/xui/it/floater_avatar.xml
index 1587c347a541c6d189e02268e5fe8d872558e82c..d7445cfb2bf4f1302f1197157f3aeb08c2096b31 100644
--- a/indra/newview/skins/default/xui/it/floater_avatar.xml
+++ b/indra/newview/skins/default/xui/it/floater_avatar.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Avatar" title="SCELTA AVATAR"/>
+<floater name="Avatar" title="SELEZIONA UN AVATAR"/>
diff --git a/indra/newview/skins/default/xui/it/floater_buy_currency.xml b/indra/newview/skins/default/xui/it/floater_buy_currency.xml
index 635b56d37a2ec2c028fe52ff0c6ebd06b07687b9..743969f557147272de279dfea872257c402f775e 100644
--- a/indra/newview/skins/default/xui/it/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/it/floater_buy_currency.xml
@@ -46,7 +46,7 @@
 		[AMT]L$
 	</text>
 	<text name="currency_links">
-		[http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] | [http://www.secondlife.com/my/account/exchange_rates.php exchange rate]
+		[http://www.secondlife.com/my/account/payment_method_management.php metodo di pagamento] | [http://www.secondlife.com/my/account/currency.php valuta]
 	</text>
 	<text name="exchange_rate_note">
 		Riscrivi l&apos;importo per vedere l&apos;ultimo tasso al cambio.
diff --git a/indra/newview/skins/default/xui/it/floater_camera.xml b/indra/newview/skins/default/xui/it/floater_camera.xml
index be4b8e210d671fc4d9e8348f56dcfe0fab5495b9..be03857bc9659a1fd6e8932caba814d32a0a348b 100644
--- a/indra/newview/skins/default/xui/it/floater_camera.xml
+++ b/indra/newview/skins/default/xui/it/floater_camera.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="camera_floater" title="VISTA">
+<floater name="camera_floater" title="CONTROLLI FOTOCAMERA">
 	<floater.string name="rotate_tooltip">
 		Ruota la telecamera Intorno all&apos;Inquadratura
 	</floater.string>
@@ -9,15 +9,6 @@
 	<floater.string name="move_tooltip">
 		Muovi la telecamera su e giù e a sinistra e destra
 	</floater.string>
-	<floater.string name="camera_modes_title">
-		Modalità della fotocamera
-	</floater.string>
-	<floater.string name="pan_mode_title">
-		Ruota visuale - Ingrandisci - Panoramica
-	</floater.string>
-	<floater.string name="presets_mode_title">
-		Visuali predefinite
-	</floater.string>
 	<floater.string name="free_mode_title">
 		Vedi oggetto
 	</floater.string>
diff --git a/indra/newview/skins/default/xui/it/floater_chat_bar.xml b/indra/newview/skins/default/xui/it/floater_chat_bar.xml
index 6c5c8fbea0fe2553f610651b12fd47c12c5a1d16..94c85b50c812bdef345c99adf8e8da0f6d2e68c0 100644
--- a/indra/newview/skins/default/xui/it/floater_chat_bar.xml
+++ b/indra/newview/skins/default/xui/it/floater_chat_bar.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="chat_bar" title="CHAT NEI DINTORNI">
-	<panel>
+	<panel name="bottom_panel">
 		<line_editor label="Clicca qui per la chat." name="chat_box" tool_tip="Premi Invio per parlare, Ctrl+Invio per gridare"/>
 		<button name="show_nearby_chat" tool_tip="Mostra/Nasconde il registro della chat nei dintorni"/>
 	</panel>
diff --git a/indra/newview/skins/default/xui/it/floater_hardware_settings.xml b/indra/newview/skins/default/xui/it/floater_hardware_settings.xml
index 561f8dbf347cc4e032ebb35ed6da966a04c497fc..5d3ae04a4d847649efe5792f3d2f015145d13e3a 100644
--- a/indra/newview/skins/default/xui/it/floater_hardware_settings.xml
+++ b/indra/newview/skins/default/xui/it/floater_hardware_settings.xml
@@ -4,7 +4,7 @@
 		Filtraggio:
 	</text>
 	<check_box label="Filtraggio Anisotropico (rallenta se attivato)" name="ani"/>
-	<text name="Antialiasing:">
+	<text name="antialiasing label">
 		Antialiasing:
 	</text>
 	<combo_box label="Antialiasing" name="fsaa" width="94">
diff --git a/indra/newview/skins/default/xui/it/floater_merchant_outbox.xml b/indra/newview/skins/default/xui/it/floater_merchant_outbox.xml
new file mode 100644
index 0000000000000000000000000000000000000000..02f257d4664dc25750cb3f142fd7f45f878db1e2
--- /dev/null
+++ b/indra/newview/skins/default/xui/it/floater_merchant_outbox.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_merchant_outbox" title="CASELLA IN USCITA DEL RIVENDITORE">
+	<string name="OutboxFolderCount1">
+		1 cartella
+	</string>
+	<string name="OutboxFolderCountN">
+		[NUM] cartelle
+	</string>
+	<string name="OutboxImporting">
+		Invio cartelle...
+	</string>
+	<string name="OutboxInitializing">
+		Inizializzazione...
+	</string>
+	<panel label="">
+		<panel>
+			<panel name="outbox_inventory_placeholder_panel">
+				<text name="outbox_inventory_placeholder_title">
+					Caricamento...
+				</text>
+			</panel>
+		</panel>
+		<panel>
+			<button label="Invia a Marketplace" name="outbox_import_btn" tool_tip="Push su negozio Marketplace"/>
+		</panel>
+	</panel>
+</floater>
diff --git a/indra/newview/skins/default/xui/it/floater_model_preview.xml b/indra/newview/skins/default/xui/it/floater_model_preview.xml
index 03102f5f81f57bfad88bb2649b26a7b5f60b14e5..ca36fd2defc5a9a2a7be471367eec62570b43c9b 100644
--- a/indra/newview/skins/default/xui/it/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/it/floater_model_preview.xml
@@ -4,6 +4,9 @@
 	<string name="status_parse_error">
 		Errore: Errore elaborazione Dae - vedere il registro per informazioni dettagliate.
 	</string>
+	<string name="status_material_mismatch">
+		Errore: il materiale del modello non è un sottoinsieme del modello di riferimento.
+	</string>
 	<string name="status_reading_file">
 		Caricamento in corso...
 	</string>
diff --git a/indra/newview/skins/default/xui/it/floater_model_wizard.xml b/indra/newview/skins/default/xui/it/floater_model_wizard.xml
index e6d0a7c4bccd5a60eac1e167a68c313a6b8ca87d..ab5fdb29e4a36deb6a150e80588946c6675b0ee7 100644
--- a/indra/newview/skins/default/xui/it/floater_model_wizard.xml
+++ b/indra/newview/skins/default/xui/it/floater_model_wizard.xml
@@ -6,12 +6,12 @@
 	<button label="2. Ottimizza" name="optimize_btn"/>
 	<button label="1. Seleziona file" name="choose_file_btn"/>
 	<panel name="choose_file_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="choose_file_header_panel">
+			<text name="choose_file_header_text">
 				Seleziona file modello
 			</text>
 		</panel>
-		<panel name="content">
+		<panel name="choose_file_content">
 			<text name="advanced_users_text">
 				Utenti avanzati: Gli utenti che hanno dimestichezza con gli strumenti di creazione 3D possono usare le opzioni di caricamento avanzate.
 			</text>
@@ -20,6 +20,9 @@
 				Scegli il file del modello da caricare
 			</text>
 			<button label="Sfoglia..." label_selected="Sfoglia..." name="browse"/>
+			<text name="Model types">
+				Second Life supporta file COLLADA (.dae)
+			</text>
 			<text name="dimensions">
 				X         Y         Z
 			</text>
@@ -32,15 +35,15 @@
 		</panel>
 	</panel>
 	<panel name="optimize_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="optimize_header_panel">
+			<text name="optimize_header_text">
 				Ottimizza modello
 			</text>
 		</panel>
-		<text name="description">
+		<text name="optimize_description">
 			Abbiamo ottimizzato il modello per migliorare le prestazioni. Se necessario, può essere regolato ulteriormente.
 		</text>
-		<panel name="content">
+		<panel name="optimize_content">
 			<text name="high_detail_text">
 				Genera livello di dettaglio: Alto
 			</text>
@@ -76,15 +79,15 @@
 		</panel>
 	</panel>
 	<panel name="physics_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="physics_header_panel">
+			<text name="physics_header_text">
 				Modifica fisica
 			</text>
 		</panel>
-		<text name="description">
+		<text name="physics_description">
 			Verrà creata una forma per lo scafo esterno del modello. Regola il livello di dettaglio della forma in base al fine desiderato del modello.
 		</text>
-		<panel name="content">
+		<panel name="physics_content">
 			<button label="Ricalcola fisica" name="recalculate_physics_btn"/>
 			<button label="Ricalcolo in corso..." name="recalculating_physics_btn"/>
 			<text name="lod_label">
@@ -107,12 +110,12 @@
 		</panel>
 	</panel>
 	<panel name="review_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="review_header_panel">
+			<text name="review_header_text">
 				Rivedi
 			</text>
 		</panel>
-		<panel name="content">
+		<panel name="review_content">
 			<text name="review_prim_equiv">
 				Impatto sul lotto o sulla regione: [EQUIV] prim equivalenti
 			</text>
@@ -125,8 +128,8 @@
 		</panel>
 	</panel>
 	<panel name="upload_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="upload_header_panel">
+			<text name="upload_header_text">
 				Caricamento completato
 			</text>
 		</panel>
diff --git a/indra/newview/skins/default/xui/it/floater_moveview.xml b/indra/newview/skins/default/xui/it/floater_moveview.xml
index 6e820a335c5a98fa1c1e86d50821816b4bb404f1..1237bd06a9073044854b339b3cbe9c45e46361c7 100644
--- a/indra/newview/skins/default/xui/it/floater_moveview.xml
+++ b/indra/newview/skins/default/xui/it/floater_moveview.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="move_floater" title="SPOSTA">
+<floater name="move_floater" title="CAMMINA / CORRI / VOLA">
 	<string name="walk_forward_tooltip">
 		Cammina in avanti (premi freccia su o W)
 	</string>
diff --git a/indra/newview/skins/default/xui/it/floater_preview_animation.xml b/indra/newview/skins/default/xui/it/floater_preview_animation.xml
index 73082c952686bcd9ab11c5b86bf60078eae46747..ed609c70fa228381969fb146c9ccc6b4ad17995f 100644
--- a/indra/newview/skins/default/xui/it/floater_preview_animation.xml
+++ b/indra/newview/skins/default/xui/it/floater_preview_animation.xml
@@ -6,6 +6,6 @@
 	<text name="desc txt">
 		Descrizione:
 	</text>
-	<button label="Riproduci in Second Life" label_selected="Ferma" left="20" name="Anim play btn" tool_tip="Riproduci questa animazione così che gli altri possano vederla" width="131"/>
-	<button label="Esegui localmente" label_selected="Ferma" left="162" name="Anim audition btn" tool_tip="Riproduci questa animazione così che solo tu possa vederla" width="125"/>
+	<button label="Riproduci in Second Life" label_selected="Ferma" name="Inworld" tool_tip="Riproduci questa animazione così che gli altri possano vederla"/>
+	<button label="Riproduci localmente" label_selected="Ferma" name="Locally" tool_tip="Riproduci questa animazione così che solo tu possa vederla"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/it/floater_snapshot.xml b/indra/newview/skins/default/xui/it/floater_snapshot.xml
index 5bff19e8d75647e1b3042630ef0ecd8383dae9e7..bff6081bdf688af5d322639e66ab79975a0b7e30 100644
--- a/indra/newview/skins/default/xui/it/floater_snapshot.xml
+++ b/indra/newview/skins/default/xui/it/floater_snapshot.xml
@@ -1,75 +1,65 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Snapshot" title="ANTEPRIMA FOTOGRAFIA" width="247">
+<floater name="Snapshot" title="ANTEPRIMA FOTOGRAFIA">
 	<floater.string name="unknown">
 		sconosciuto
 	</floater.string>
-	<radio_group label="Tipo di fotografia" name="snapshot_type_radio">
-		<radio_item label="E-mail" name="postcard"/>
-		<radio_item label="Il mio inventario (L$[AMOUNT])" name="texture"/>
-		<radio_item label="Salva sul mio computer" name="local"/>
-	</radio_group>
+	<string name="postcard_progress_str">
+		Invio e-mail in corso
+	</string>
+	<string name="profile_progress_str">
+		Caricamento post
+	</string>
+	<string name="inventory_progress_str">
+		Salva nell&apos;inventario
+	</string>
+	<string name="local_progress_str">
+		Salvataggio sul computer in corso
+	</string>
+	<string name="profile_succeeded_str">
+		Immagine caricata
+	</string>
+	<string name="postcard_succeeded_str">
+		E-mail inviata.
+	</string>
+	<string name="inventory_succeeded_str">
+		Salvato nell&apos;inventario.
+	</string>
+	<string name="local_succeeded_str">
+		Salvato sul computer.
+	</string>
+	<string name="profile_failed_str">
+		Caricamento immagine sul feed del profilo non riuscito.
+	</string>
+	<string name="postcard_failed_str">
+		Invio e-mail non riuscito.
+	</string>
+	<string name="inventory_failed_str">
+		Non salvato nell&apos;inventario.
+	</string>
+	<string name="local_failed_str">
+		Non salvato sul computer.
+	</string>
+	<button name="advanced_options_btn" tool_tip="Opzioni Avanzate"/>
+	<text name="image_res_text">
+		[WIDTH] x [HEIGHT] px
+	</text>
 	<text name="file_size_label">
 		[SIZE] KB
 	</text>
-	<button label="Aggiorna la fotografia" name="new_snapshot_btn"/>
-	<button label="Invia" name="send_btn"/>
-	<button label="Salva ([AMOUNT] L$)" name="upload_btn"/>
-	<flyout_button label="Salva" name="save_btn" tool_tip="Salva immagine come file">
-		<flyout_button.item label="Salva" name="save_item"/>
-		<flyout_button.item label="Salva con nome..." name="saveas_item"/>
-	</flyout_button>
-	<button label="Altro" name="more_btn" tool_tip="Opzioni Avanzate"/>
-	<button label="Meno" name="less_btn" tool_tip="Opzioni Avanzate"/>
-	<button label="Annulla" name="discard_btn"/>
-	<text name="type_label2">
-		Dimensioni
-	</text>
-	<text name="format_label">
-		Formato
-	</text>
-	<combo_box label="Risoluzione" name="postcard_size_combo">
-		<combo_box.item label="Finestra attuale" name="CurrentWindow"/>
-		<combo_box.item label="640x480" name="640x480"/>
-		<combo_box.item label="800x600" name="800x600"/>
-		<combo_box.item label="1024x768" name="1024x768"/>
-		<combo_box.item label="Personalizza" name="Custom"/>
-	</combo_box>
-	<combo_box label="Risoluzione" name="texture_size_combo">
-		<combo_box.item label="Finestra attuale" name="CurrentWindow"/>
-		<combo_box.item label="Piccola (128x128)" name="Small(128x128)"/>
-		<combo_box.item label="Media (256x256)" name="Medium(256x256)"/>
-		<combo_box.item label="Grande (512x512)" name="Large(512x512)"/>
-		<combo_box.item label="Personalizza" name="Custom"/>
-	</combo_box>
-	<combo_box label="Risoluzione" name="local_size_combo">
-		<combo_box.item label="Finestra attuale" name="CurrentWindow"/>
-		<combo_box.item label="320x240" name="320x240"/>
-		<combo_box.item label="640x480" name="640x480"/>
-		<combo_box.item label="800x600" name="800x600"/>
-		<combo_box.item label="1024x768" name="1024x768"/>
-		<combo_box.item label="1280x1024" name="1280x1024"/>
-		<combo_box.item label="1600x1200" name="1600x1200"/>
-		<combo_box.item label="Personalizza" name="Custom"/>
-	</combo_box>
-	<combo_box label="Formato" name="local_format_combo">
-		<combo_box.item label="PNG" name="PNG"/>
-		<combo_box.item label="JPEG" name="JPEG"/>
-		<combo_box.item label="BMP" name="BMP"/>
-	</combo_box>
-	<spinner label="Larghezza" name="snapshot_width"/>
-	<spinner label="Altezza" name="snapshot_height"/>
-	<check_box label="Mantieni le proporzioni" name="keep_aspect_check"/>
-	<slider label="Qualità dell&apos;immagine" name="image_quality_slider"/>
-	<text name="layer_type_label">
-		Cattura:
-	</text>
-	<combo_box label="Layer dell&apos;immagine" name="layer_types">
-		<combo_box.item label="Colori" name="Colors"/>
-		<combo_box.item label="Profondità" name="Depth"/>
-	</combo_box>
-	<check_box label="Interfaccia" name="ui_check"/>
-	<check_box label="HUD" name="hud_check"/>
-	<check_box label="Tieni aperta dopo il salvataggio" name="keep_open_check"/>
-	<check_box label="Congela il frame (tutto schermo)" name="freeze_frame_check"/>
-	<check_box label="Aggiornamento automatico" name="auto_snapshot_check"/>
+	<panel name="advanced_options_panel">
+		<text name="advanced_options_label">
+			OPZIONI AVANZATE
+		</text>
+		<text name="layer_type_label">
+			Cattura:
+		</text>
+		<combo_box label="Layer dell&apos;immagine" name="layer_types">
+			<combo_box.item label="Colori" name="Colors"/>
+			<combo_box.item label="Profondità" name="Depth"/>
+		</combo_box>
+		<check_box label="Interfaccia" name="ui_check"/>
+		<check_box label="HUD" name="hud_check"/>
+		<check_box label="Congela il frame (tutto schermo)" name="freeze_frame_check"/>
+		<check_box label="Aggiornamento automatico" name="auto_snapshot_check"/>
+	</panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/it/floater_test_layout_stacks.xml b/indra/newview/skins/default/xui/it/floater_test_layout_stacks.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b479d5f6d6bbc342a4c4bb9a33199290356156d9
--- /dev/null
+++ b/indra/newview/skins/default/xui/it/floater_test_layout_stacks.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Test Floater" title="LAYOUTSTACK TESTS"/>
diff --git a/indra/newview/skins/default/xui/it/floater_test_text_vertical_aligment.xml b/indra/newview/skins/default/xui/it/floater_test_text_vertical_aligment.xml
new file mode 100644
index 0000000000000000000000000000000000000000..23da6f7588fc9f0d9da40a9be826c32c3ebf932e
--- /dev/null
+++ b/indra/newview/skins/default/xui/it/floater_test_text_vertical_aligment.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Test Floater" title="FINESTRA DI TEST"/>
diff --git a/indra/newview/skins/default/xui/it/floater_tools.xml b/indra/newview/skins/default/xui/it/floater_tools.xml
index 0d981e2424ea46933aee29dcb9813b95f5484130..c963ac72e6a414df3430a9c49a91786a4555ed14 100644
--- a/indra/newview/skins/default/xui/it/floater_tools.xml
+++ b/indra/newview/skins/default/xui/it/floater_tools.xml
@@ -1,5 +1,20 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="toolbox floater" short_title="STRUMENTI PER COSTRUZIONE">
+	<floater.string name="grid_screen_text">
+		Schermo
+	</floater.string>
+	<floater.string name="grid_local_text">
+		Locale
+	</floater.string>
+	<floater.string name="grid_world_text">
+		Mondo
+	</floater.string>
+	<floater.string name="grid_reference_text">
+		Riferimento
+	</floater.string>
+	<floater.string name="grid_attachment_text">
+		Allegato
+	</floater.string>
 	<floater.string name="status_rotate">
 		Sposta le fasce colorate per ruotare l&apos;oggetto
 	</floater.string>
@@ -63,7 +78,12 @@
 	</text>
 	<check_box initial_value="true" label="Ridimensiona le texture" name="checkbox stretch textures"/>
 	<check_box initial_value="true" label="Scatto" name="checkbox snap to grid"/>
-	<button label="Opzioni..." label_selected="Opzioni..." name="Options..." tool_tip="Vedi più opzioni della griglia"/>
+	<combo_box name="combobox grid mode" tool_tip="Scegli il tipo di righello per posizionare l&apos;oggetto">
+		<combo_box.item label="Mondo" name="World"/>
+		<combo_box.item label="Locale" name="Local"/>
+		<combo_box.item label="Riferimento" name="Reference"/>
+	</combo_box>
+	<button label="" label_selected="Opzioni..." name="Options..." tool_tip="Vedi più opzioni della griglia"/>
 	<button label="" label_selected="" name="ToolCube" tool_tip="Cubo"/>
 	<button label="" label_selected="" name="ToolPrism" tool_tip="Prisma"/>
 	<button label="" label_selected="" name="ToolPyramid" tool_tip="Piramide"/>
diff --git a/indra/newview/skins/default/xui/it/floater_toybox.xml b/indra/newview/skins/default/xui/it/floater_toybox.xml
index c8d5f1ed7c53c6fc5abd7153800b3397d92bf110..269e2831d06a75ae2db2f1782d43454f34e8baf5 100644
--- a/indra/newview/skins/default/xui/it/floater_toybox.xml
+++ b/indra/newview/skins/default/xui/it/floater_toybox.xml
@@ -1,10 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Toybox" title="PERSONALIZZA BARRE STRUMENTI">
+<floater name="Toybox" title="PULSANTI BARRA STRUMENTI">
 	<text name="toybox label 1">
 		Aggiungere o rimuovere pulsanti trascinandoli dentro o fuori dalle barre strumenti.
 	</text>
 	<text name="toybox label 2">
 		I pulsanti verranno visualizzati come mostrato o solo come icone, a seconda delle impostazioni della singola barra degli strumenti.
 	</text>
+	<button label="Cancella tutte le barre strumenti" label_selected="Cancella tutte le barre strumenti" name="btn_clear_all"/>
 	<button label="Ripristina predefiniti" label_selected="Ripristina predefiniti" name="btn_restore_defaults"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/it/floater_translation_settings.xml b/indra/newview/skins/default/xui/it/floater_translation_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a0a34da723ed395dc2e4bf0a1b167996c59e1c7f
--- /dev/null
+++ b/indra/newview/skins/default/xui/it/floater_translation_settings.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_translation_settings" title="IMPOSTAZIONI TRADUZIONE CHAT">
+	<string name="bing_api_key_not_verified">
+		appID Bing non verificato. Riprova.
+	</string>
+	<string name="google_api_key_not_verified">
+		Chiave API Google non verificata. Riprova.
+	</string>
+	<string name="bing_api_key_verified">
+		appID Bing verificato.
+	</string>
+	<string name="google_api_key_verified">
+		Chiave API Google verificata.
+	</string>
+	<check_box label="Usa la traduzione meccanica durante le chat" name="translate_chat_checkbox"/>
+	<text name="translate_language_label">
+		Traduci chat in:
+	</text>
+	<combo_box name="translate_language_combo">
+		<combo_box.item label="Predefinito di sistema" name="System Default Language"/>
+		<combo_box.item label="English (Inglese)" name="English"/>
+		<combo_box.item label="Dansk (Danese)" name="Danish"/>
+		<combo_box.item label="Deutsch (Tedesco)" name="German"/>
+		<combo_box.item label="Español (Spagnolo)" name="Spanish"/>
+		<combo_box.item label="Français (Francese)" name="French"/>
+		<combo_box.item label="Italiano" name="Italian"/>
+		<combo_box.item label="Magyar (Ungherese)" name="Hungarian"/>
+		<combo_box.item label="Nederlands (Olandese)" name="Dutch"/>
+		<combo_box.item label="Polski (Polacco)" name="Polish"/>
+		<combo_box.item label="Português (Portoghese)" name="Portugese"/>
+		<combo_box.item label="Русский (Russo)" name="Russian"/>
+		<combo_box.item label="Türkçe (Turco)" name="Turkish"/>
+		<combo_box.item label="Українська (Ucraino)" name="Ukrainian"/>
+		<combo_box.item label="中文 (正體) (Cinese)" name="Chinese"/>
+		<combo_box.item label="日本語 (Giapponese)" name="Japanese"/>
+		<combo_box.item label="한국어 (Coreano)" name="Korean"/>
+	</combo_box>
+	<text name="tip">
+		Seleziona il servizio di traduzione:
+	</text>
+	<radio_group name="translation_service_rg">
+		<radio_item initial_value="bing" label="Bing Translator" name="bing"/>
+		<radio_item initial_value="google" label="Google Translate" name="google"/>
+	</radio_group>
+	<text name="bing_api_key_label">
+		Bing [http://www.bing.com/developers/createapp.aspx AppID]:
+	</text>
+	<button label="Verifica" name="verify_bing_api_key_btn"/>
+	<text name="google_api_key_label">
+		Google [http://code.google.com/apis/language/translate/v2/getting_started.html#auth API key]:
+	</text>
+	<button label="Verifica" name="verify_google_api_key_btn"/>
+	<text name="google_links_text">
+		[http://code.google.com/apis/language/translate/v2/pricing.html Prezzi] | [https://code.google.com/apis/console Statistiche]
+	</text>
+	<button label="OK" name="ok_btn"/>
+	<button label="Annulla" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/it/floater_voice_controls.xml b/indra/newview/skins/default/xui/it/floater_voice_controls.xml
index d0ac815b8b3320437bfdac01ebbb8c6805ab43a8..77973eef1e0cb914f51e03d5d065010b30313cd7 100644
--- a/indra/newview/skins/default/xui/it/floater_voice_controls.xml
+++ b/indra/newview/skins/default/xui/it/floater_voice_controls.xml
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="floater_voice_controls" title="CONTROLLI VOCE">
 	<string name="title_nearby">
-		Voce vicina
+		IMPOSTAZIONI VOCE
 	</string>
 	<string name="title_group">
-		Chiamata di gruppo con [GROUP]
+		CHIAMATA DI GRUPPO CON [GROUP]
 	</string>
 	<string name="title_adhoc">
-		Chiamata in conferenza
+		CHIAMATA IN CONFERENZA
 	</string>
 	<string name="title_peer_2_peer">
-		Chiamata con [NAME]
+		CHIAMATA CON [NAME]
 	</string>
 	<string name="no_one_near">
 		Nessuno nei dintorni ha attivato la funzione voce
diff --git a/indra/newview/skins/default/xui/it/floater_voice_effect.xml b/indra/newview/skins/default/xui/it/floater_voice_effect.xml
index a0e49525ea648dbfaa42d25ab16ba448d7487b60..c83b11f698a2b4c08a54c04b32ff93fe9ea431a9 100644
--- a/indra/newview/skins/default/xui/it/floater_voice_effect.xml
+++ b/indra/newview/skins/default/xui/it/floater_voice_effect.xml
@@ -42,13 +42,16 @@
 	<string name="effect_Demon">
 		Demonio
 	</string>
+	<string name="effect_Female Elf">
+		Elfo donna
+	</string>
 	<string name="effect_Flirty">
 		Civettuolo
 	</string>
 	<string name="effect_Foxy">
 		Scaltro
 	</string>
-	<string name="effect_Halloween_2010_Bonus">
+	<string name="effect_Halloween 2010 Bonus">
 		Halloween_2010_Bonus
 	</string>
 	<string name="effect_Helium">
@@ -57,9 +60,18 @@
 	<string name="effect_Husky">
 		Fusto
 	</string>
+	<string name="effect_Husky Whisper">
+		Sospiro rauco
+	</string>
 	<string name="effect_Intercom">
 		Interfono
 	</string>
+	<string name="effect_Julia">
+		Julia
+	</string>
+	<string name="effect_Lo Lilt">
+		Inflessione bassa
+	</string>
 	<string name="effect_Macho">
 		Macho
 	</string>
@@ -69,6 +81,9 @@
 	<string name="effect_Mini">
 		Mini
 	</string>
+	<string name="effect_Model">
+		Modella
+	</string>
 	<string name="effect_Nano">
 		Nano
 	</string>
@@ -90,6 +105,9 @@
 	<string name="effect_Roxanne">
 		Rosanna
 	</string>
+	<string name="effect_Rumble">
+		Rombo
+	</string>
 	<string name="effect_Sabrina">
 		Sabrina
 	</string>
@@ -102,6 +120,9 @@
 	<string name="effect_Shorty">
 		Bassotto
 	</string>
+	<string name="effect_Smaller">
+		Più piccolo
+	</string>
 	<string name="effect_Sneaky">
 		Vile
 	</string>
diff --git a/indra/newview/skins/default/xui/it/menu_inspect_object_gear.xml b/indra/newview/skins/default/xui/it/menu_inspect_object_gear.xml
index ede4a507c02e25307a77685989fbe9b00e344188..4740c9bf67042f323e6e5598f737a3efbb693249 100644
--- a/indra/newview/skins/default/xui/it/menu_inspect_object_gear.xml
+++ b/indra/newview/skins/default/xui/it/menu_inspect_object_gear.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<menu name="Gear Menu">
+<toggleable_menu name="Gear Menu">
 	<menu_item_call label="Tocca" name="touch"/>
 	<menu_item_call label="Siediti" name="sit"/>
 	<menu_item_call label="Paga" name="pay"/>
@@ -12,7 +12,8 @@
 	<menu_item_call label="Aggiungi" name="add"/>
 	<menu_item_call label="Segnala" name="report"/>
 	<menu_item_call label="Blocca" name="block"/>
+	<menu_item_call label="Sblocca" name="unblock"/>
 	<menu_item_call label="Zoom avanti" name="zoom_in"/>
 	<menu_item_call label="Rimuovi" name="remove"/>
 	<menu_item_call label="Maggiori informazioni" name="more_info"/>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/it/menu_inventory.xml b/indra/newview/skins/default/xui/it/menu_inventory.xml
index 57aa4dc97dc4097295781514ae0806fe477c6251..4bf6be82fd8afd067f0e0d0ed512f548deb2996a 100644
--- a/indra/newview/skins/default/xui/it/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/it/menu_inventory.xml
@@ -59,6 +59,7 @@
 	<menu_item_call label="Proprietà" name="Properties"/>
 	<menu_item_call label="Rinomina" name="Rename"/>
 	<menu_item_call label="Copia UUID dell&apos;oggetto" name="Copy Asset UUID"/>
+	<menu_item_call label="Taglia" name="Cut"/>
 	<menu_item_call label="Copia" name="Copy"/>
 	<menu_item_call label="Incolla" name="Paste"/>
 	<menu_item_call label="Incolla come link" name="Paste As Link"/>
@@ -84,6 +85,6 @@
 	<menu_item_call label="Aggiungi" name="Wearable Add"/>
 	<menu_item_call label="Togli" name="Take Off"/>
 	<menu_item_call label="Copia nella casella venditore in uscita" name="Merchant Copy"/>
-	<menu_item_call label="Passa alla casella venditore in uscita" name="Merchant Move"/>
+	<menu_item_call label="Invia a Marketplace" name="Marketplace Send"/>
 	<menu_item_call label="--nessuna opzione--" name="--no options--"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/it/menu_login.xml b/indra/newview/skins/default/xui/it/menu_login.xml
index 834db974dafc0eeca1bf3e1e10d4a7d037a73b07..7b060e65654074640e9042ac16031fdcb8ad12fb 100644
--- a/indra/newview/skins/default/xui/it/menu_login.xml
+++ b/indra/newview/skins/default/xui/it/menu_login.xml
@@ -16,8 +16,8 @@
 		<menu_item_call label="Imposta dimensioni della finestra..." name="Set Window Size..."/>
 		<menu_item_call label="Mostra i Termini del servizio (TOS)" name="TOS"/>
 		<menu_item_call label="Mostra messaggio critico" name="Critical"/>
-		<menu_item_call label="Test browser multimedia" name="Web Browser Test"/>
 		<menu_item_call label="Test debug finestra contenuti Web" name="Web Content Floater Debug Test"/>
+		<menu label="Imposta livello di registrazione" name="Set Logging Level"/>
 		<menu_item_check label="Mostra selettore griglia" name="Show Grid Picker"/>
 		<menu_item_call label="Mostra Console notifiche" name="Show Notifications Console"/>
 	</menu>
diff --git a/indra/newview/skins/default/xui/it/menu_toolbars.xml b/indra/newview/skins/default/xui/it/menu_toolbars.xml
index 784ecd262c5ebb6e244444e5b8d053f6aae686f8..604ca763d13f10e0d96e5d2e3d4b73d486cab2be 100644
--- a/indra/newview/skins/default/xui/it/menu_toolbars.xml
+++ b/indra/newview/skins/default/xui/it/menu_toolbars.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Toolbars Popup">
-	<menu_item_call label="Seleziona pulsanti..." name="Chose Buttons"/>
+	<menu_item_call label="Rimuovi questo pulsante" name="Remove button"/>
+	<menu_item_call label="Pulsanti barra strumenti..." name="Choose Buttons"/>
 	<menu_item_check label="Icone ed etichette" name="icons_with_text"/>
 	<menu_item_check label="Solo icone" name="icons_only"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/it/menu_viewer.xml b/indra/newview/skins/default/xui/it/menu_viewer.xml
index 815f6f58ed7e26ae158ddf39ac467991d5cfc209..99b7e3c4e6b5f5e75167e7f19840b5ae0f8fb9e3 100644
--- a/indra/newview/skins/default/xui/it/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/it/menu_viewer.xml
@@ -1,55 +1,60 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu_bar name="Main Menu">
 	<menu label="Io" name="Me">
-		<menu_item_call label="Dashboard..." name="Manage My Account">
-			<menu_item_call.on_click name="ManageMyAccount_url" parameter="WebLaunchJoinNow,http://secondlife.com/account/index.php?lang=it"/>
-		</menu_item_call>
 		<menu_item_call label="Profilo..." name="Profile"/>
 		<menu_item_call label="Aspetto fisico..." name="ChangeOutfit"/>
+		<menu_item_call label="Scegli un avatar..." name="Avatar Picker"/>
 		<menu_item_check label="Inventario..." name="Inventory"/>
-		<menu_item_check label="Gesture..." name="Gestures"/>
-		<menu_item_check label="Voce..." name="ShowVoice"/>
+		<menu_item_call label="Nuova finestra inventario" name="NewInventoryWindow"/>
+		<menu_item_call label="Luoghi..." name="Places"/>
+		<menu_item_call label="Preferiti..." name="Picks"/>
+		<menu_item_call label="Controlli fotocamera..." name="Camera Controls"/>
 		<menu label="Spostamento" name="Movement">
 			<menu_item_call label="Siedi" name="Sit Down Here"/>
 			<menu_item_check label="Vola" name="Fly"/>
 			<menu_item_check label="Corri sempre" name="Always Run"/>
 			<menu_item_call label="Ferma animazione" name="Stop Animating My Avatar"/>
+			<menu_item_call label="Cammina / corri / vola..." name="Walk / run / fly"/>
 		</menu>
 		<menu label="Stato" name="Status">
 			<menu_item_call label="Assente" name="Set Away"/>
 			<menu_item_call label="Non disponibile" name="Set Busy"/>
 		</menu>
-		<menu_item_call label="Richiedi diritti Admin" name="Request Admin Options"/>
-		<menu_item_call label="Lascia stato Admin" name="Leave Admin Options"/>
-		<menu_item_call label="Compra L$" name="Buy and Sell L$"/>
+		<menu_item_call label="Acquista L$..." name="Buy and Sell L$"/>
+		<menu_item_call label="Casella venditore in uscita..." name="MerchantOutbox"/>
+		<menu_item_call label="Dashboard dell&apos;account..." name="Manage My Account">
+			<menu_item_call.on_click name="ManageMyAccount_url" parameter="WebLaunchJoinNow,http://secondlife.com/account/index.php?lang=it"/>
+		</menu_item_call>
 		<menu_item_call label="Preferenze..." name="Preferences"/>
-		<menu_item_call label="Barre strumenti..." name="Toolbars"/>
+		<menu_item_call label="Pulsanti barra strumenti..." name="Toolbars"/>
 		<menu_item_call label="Nascondi tutti i controlli" name="Hide UI"/>
 		<menu_item_call label="Esci da [APP_NAME]" name="Quit"/>
 	</menu>
 	<menu label="Comunica" name="Communicate">
-		<menu_item_call label="I miei amici..." name="My Friends"/>
-		<menu_item_call label="I miei gruppi" name="My Groups"/>
-		<menu_item_check label="Chat nei dintorni" name="Nearby Chat"/>
+		<menu_item_check label="Chat..." name="Nearby Chat"/>
+		<menu_item_check label="Parla" name="Speak"/>
+		<menu_item_check label="Impostazioni voce..." name="Nearby Voice"/>
+		<menu_item_check label="Manipolazione voce..." name="ShowVoice"/>
+		<menu_item_check label="Gesture..." name="Gestures"/>
+		<menu_item_call label="Amici" name="My Friends"/>
+		<menu_item_call label="Gruppi" name="My Groups"/>
 		<menu_item_call label="Persone vicine" name="Active Speakers"/>
-		<menu_item_check label="Voce nei dintorni" name="Nearby Voice"/>
 	</menu>
 	<menu label="Mondo" name="World">
+		<menu_item_call label="Crea punto di riferimento per questo luogo" name="Create Landmark Here"/>
+		<menu_item_call label="Destinazioni..." name="Destinations"/>
+		<menu_item_check label="Mappamondo" name="World Map"/>
 		<menu_item_check label="Mini mappa" name="Mini-Map"/>
-		<menu_item_check label="Mappa del mondo" name="World Map"/>
 		<menu_item_check label="Cerca" name="Search"/>
+		<menu_item_call label="Teleport a Casa" name="Teleport Home"/>
+		<menu_item_call label="Imposta come Casa mia" name="Set Home to Here"/>
 		<menu_item_call label="Istantanea" name="Take Snapshot"/>
-		<menu_item_call label="Crea punto di riferimento per questo luogo" name="Create Landmark Here"/>
-		<menu label="Profilo del luogo" name="Land">
-			<menu_item_call label="Profilo del luogo" name="Place Profile"/>
-			<menu_item_call label="Informazioni sui terreni" name="About Land"/>
-			<menu_item_call label="Regione/proprietà immobiliare" name="Region/Estate"/>
-		</menu>
+		<menu_item_call label="Profilo del luogo" name="Place Profile"/>
+		<menu_item_call label="Informazioni sul terreno" name="About Land"/>
+		<menu_item_call label="Regione/proprietà immobiliare" name="Region/Estate"/>
+		<menu_item_call label="Terreni posseduti..." name="My Land"/>
 		<menu_item_call label="Acquista questo terreno" name="Buy Land"/>
-		<menu_item_call label="Il mio terreno" name="My Land"/>
 		<menu label="Mostra" name="LandShow">
-			<menu_item_check label="Comandi del movimento" name="Movement Controls"/>
-			<menu_item_check label="Comandi visualizzazione" name="Camera Controls"/>
 			<menu_item_check label="Linee di divieto" name="Ban Lines"/>
 			<menu_item_check label="Marcatori" name="beacons"/>
 			<menu_item_check label="Linee di confine" name="Property Lines"/>
@@ -58,29 +63,28 @@
 			<menu_item_check label="Proprietà del lotto" name="Parcel Properties"/>
 			<menu_item_check label="Menu Avanzato" name="Show Advanced Menu"/>
 		</menu>
-		<menu_item_call label="Teleport a Casa" name="Teleport Home"/>
-		<menu_item_call label="Imposta come Casa mia" name="Set Home to Here"/>
-		<menu label="Sole" name="Environment Settings">
+		<menu label="Sole" name="Sun">
 			<menu_item_call label="Alba" name="Sunrise"/>
 			<menu_item_call label="Mezzogiorno" name="Noon"/>
 			<menu_item_call label="Tramonto" name="Sunset"/>
 			<menu_item_call label="Mezzanotte" name="Midnight"/>
+			<menu_item_call label="Usa impostazioni regione" name="Use Region Settings"/>
 		</menu>
-		<menu label="Editor ambiente" name="Enviroment Editor">
-			<menu_item_call label="Impostazioni ambiente..." name="Enviroment Settings"/>
+		<menu label="Editor ambiente" name="Environment Editor">
+			<menu_item_call label="Impostazioni ambiente..." name="Environment Settings"/>
 			<menu label="Valori predefiniti acqua" name="Water Presets">
 				<menu_item_call label="Nuovo valore predefinito..." name="new_water_preset"/>
-				<menu_item_call label="Modifica valori predefiniti..." name="edit_water_preset"/>
+				<menu_item_call label="Modifica valore predefinito..." name="edit_water_preset"/>
 				<menu_item_call label="Cancella valore predefinito..." name="delete_water_preset"/>
 			</menu>
 			<menu label="Valori predefiniti cielo" name="Sky Presets">
 				<menu_item_call label="Nuovo valore predefinito..." name="new_sky_preset"/>
-				<menu_item_call label="Modifica valori predefiniti..." name="edit_sky_preset"/>
+				<menu_item_call label="Modifica valore predefinito..." name="edit_sky_preset"/>
 				<menu_item_call label="Cancella valore predefinito..." name="delete_sky_preset"/>
 			</menu>
-			<menu label="Valori predefiniti giornata" name="Day Presets">
+			<menu label="Valori predefiniti giorno" name="Day Presets">
 				<menu_item_call label="Nuovo valore predefinito..." name="new_day_preset"/>
-				<menu_item_call label="Modifica valori predefiniti..." name="edit_day_preset"/>
+				<menu_item_call label="Modifica valore predefinito..." name="edit_day_preset"/>
 				<menu_item_call label="Cancella valore predefinito..." name="delete_day_preset"/>
 			</menu>
 		</menu>
@@ -140,11 +144,13 @@
 			<menu_item_call label="Animazione ([COST] L$)..." name="Upload Animation"/>
 			<menu_item_call label="Modella..." name="Upload Model"/>
 			<menu_item_call label="In blocco ([COST] L$ per file)..." name="Bulk Upload"/>
+			<menu_item_call label="Definisci diritti di caricamento predefiniti" name="perm prefs"/>
 		</menu>
 		<menu_item_call label="Annulla" name="Undo"/>
 		<menu_item_call label="Ripeti" name="Redo"/>
 	</menu>
 	<menu label="Aiuto" name="Help">
+		<menu_item_call label="Istruzioni..." name="How To"/>
 		<menu_item_call label="Aiuto di [SECOND_LIFE]" name="Second Life Help"/>
 		<menu_item_call label="Segnala abuso" name="Report Abuse"/>
 		<menu_item_call label="Segnala bug" name="Report Bug"/>
@@ -172,22 +178,22 @@
 			<menu_item_check label="Mostra mirino visuale soggettiva" name="ShowCrosshairs"/>
 		</menu>
 		<menu label="Modalità di rendering" name="Rendering Types">
-			<menu_item_check label="Semplice" name="Simple"/>
-			<menu_item_check label="Alpha (Trasparenza)" name="Alpha"/>
-			<menu_item_check label="Albero" name="Tree"/>
-			<menu_item_check label="Avatar" name="Character"/>
-			<menu_item_check label="Superficie chiusa" name="Surface Patch"/>
-			<menu_item_check label="Cielo" name="Sky"/>
-			<menu_item_check label="Acqua" name="Water"/>
-			<menu_item_check label="Suolo" name="Ground"/>
-			<menu_item_check label="Volume" name="Volume"/>
-			<menu_item_check label="Erba" name="Grass"/>
-			<menu_item_check label="Nuvole" name="Clouds"/>
-			<menu_item_check label="Particelle" name="Particles"/>
-			<menu_item_check label="Urti" name="Bump"/>
+			<menu_item_check label="Semplice" name="Rendering Type Simple"/>
+			<menu_item_check label="Alpha (Trasparenza)" name="Rendering Type Alpha"/>
+			<menu_item_check label="Albero" name="Rendering Type Tree"/>
+			<menu_item_check label="Avatar" name="Rendering Type Character"/>
+			<menu_item_check label="Toppa superficie" name="Rendering Type Surface Patch"/>
+			<menu_item_check label="Cielo" name="Rendering Type Sky"/>
+			<menu_item_check label="Acqua" name="Rendering Type Water"/>
+			<menu_item_check label="Suolo" name="Rendering Type Ground"/>
+			<menu_item_check label="Volume" name="Rendering Type Volume"/>
+			<menu_item_check label="Erba" name="Rendering Type Grass"/>
+			<menu_item_check label="Nuvole" name="Rendering Type Clouds"/>
+			<menu_item_check label="Particelle" name="Rendering Type Particles"/>
+			<menu_item_check label="Urto" name="Rendering Type Bump"/>
 		</menu>
 		<menu label="Caratteristiche di rendering" name="Rendering Features">
-			<menu_item_check label="Interfaccia utente" name="UI"/>
+			<menu_item_check label="Interfaccia utente" name="ToggleUI"/>
 			<menu_item_check label="Selezionati" name="Selected"/>
 			<menu_item_check label="Evidenziato" name="Highlighted"/>
 			<menu_item_check label="Texture dinamiche" name="Dynamic Textures"/>
@@ -198,11 +204,8 @@
 		<menu_item_check label="Usa thread lettura plugin" name="Use Plugin Read Thread"/>
 		<menu_item_call label="Pulisci cache di gruppo" name="ClearGroupCache"/>
 		<menu_item_check label="Fluidità mouse" name="Mouse Smoothing"/>
+		<menu_item_call label="Rilascia tasti" name="Release Keys"/>
 		<menu label="Scorciatoie" name="Shortcuts">
-			<menu_item_call label="Immagine ([COST]L$)..." name="Upload Image"/>
-			<menu_item_check label="Cerca" name="Search"/>
-			<menu_item_call label="Rilascia tasti" name="Release Keys"/>
-			<menu_item_call label="Imposta dimensioni dell&apos;interfaccia sui valori predefiniti" name="Set UI Size to Default"/>
 			<menu_item_check label="Mostra menu Avanzato - tasti di scelta rapida esistenti" name="Show Advanced Menu - legacy shortcut"/>
 			<menu_item_call label="Chiudi finestra" name="Close Window"/>
 			<menu_item_call label="Chiudi tutte le finestre" name="Close All Windows"/>
@@ -211,13 +214,6 @@
 			<menu_item_check label="Joystick Flycam" name="Joystick Flycam"/>
 			<menu_item_call label="Reimposta vista" name="Reset View"/>
 			<menu_item_call label="Guarda l&apos;ultima conversazione" name="Look at Last Chatter"/>
-			<menu label="Seleziona strumento di costruzione" name="Select Tool">
-				<menu_item_call label="Strumento Ingrandisci" name="Focus"/>
-				<menu_item_call label="Strumento Movimento" name="Move"/>
-				<menu_item_call label="Strumento Modifica" name="Edit"/>
-				<menu_item_call label="Strumento Crea" name="Create"/>
-				<menu_item_call label="Strumento Terreno" name="Land"/>
-			</menu>
 			<menu_item_call label="Zoom avanti" name="Zoom In"/>
 			<menu_item_call label="Zoom predefinito" name="Zoom Default"/>
 			<menu_item_call label="Zoom indietro" name="Zoom Out"/>
@@ -271,7 +267,9 @@
 			<menu_item_check label="Aggiorna tipo" name="Update Type"/>
 			<menu_item_check label="Info livello dettaglio" name="LOD Info"/>
 			<menu_item_check label="Crea coda" name="Build Queue"/>
+			<menu_item_check label="Vettori vento" name="Wind Vectors"/>
 			<menu_item_check label="Complessità rendering" name="rendercomplexity"/>
+			<menu_item_check label="Byte collegamento" name="attachment bytes"/>
 			<menu_item_check label="Scolpisci" name="Sculpt"/>
 		</menu>
 		<menu label="Rendering" name="Rendering">
@@ -280,7 +278,6 @@
 			<menu_item_check label="Luci e ombre" name="Lighting and Shadows"/>
 			<menu_item_check label="Ombra dal sole, dalla luna e dai proiettori" name="Shadows from Sun/Moon/Projectors"/>
 			<menu_item_check label="SSAO e ombre fluide" name="SSAO and Shadow Smoothing"/>
-			<menu_item_check label="Illuminazione globale (sperimentale)" name="Global Illumination"/>
 			<menu_item_check label="Maschera alfa automatica (differita)" name="Automatic Alpha Masks (deferred)"/>
 			<menu_item_check label="Maschera alfa automatica (non differita)" name="Automatic Alpha Masks (non-deferred)"/>
 			<menu_item_check label="Texture delle animazioni" name="Animation Textures"/>
@@ -295,9 +292,8 @@
 			<menu_item_call label="Lascia un pacchetto" name="Drop a Packet"/>
 		</menu>
 		<menu_item_call label="Urti, spinte e contatti" name="Bumps, Pushes &amp;amp; Hits"/>
-		<menu label="Mondo" name="World">
-			<menu_item_check label="Esclusione al sole della regione" name="Sim Sun Override"/>
-			<menu_item_check label="Effetto marcatore lampeggiante" name="Cheesy Beacon"/>
+		<menu label="Mondo" name="DevelopWorld">
+			<menu_item_check label="Esclusione al sole della simulazione" name="Sim Sun Override"/>
 			<menu_item_check label="Clima fisso" name="Fixed Weather"/>
 			<menu_item_call label="Dump della cache oggetti regione" name="Dump Region Object Cache"/>
 		</menu>
@@ -319,11 +315,11 @@
 		</menu>
 		<menu label="Avatar" name="Character">
 			<menu label="Grab Baked Texture" name="Grab Baked Texture">
-				<menu_item_call label="Iride" name="Iris"/>
-				<menu_item_call label="Testa" name="Head"/>
-				<menu_item_call label="Parte superiore del corpo" name="Upper Body"/>
-				<menu_item_call label="Parte inferiore del corpo" name="Lower Body"/>
-				<menu_item_call label="Gonna" name="Skirt"/>
+				<menu_item_call label="Iride" name="Grab Iris"/>
+				<menu_item_call label="Testa" name="Grab Head"/>
+				<menu_item_call label="Parte superiore del corpo" name="Grab Upper Body"/>
+				<menu_item_call label="Parte inferiore del corpo" name="Grab Lower Body"/>
+				<menu_item_call label="Gonna" name="Grab Skirt"/>
 			</menu>
 			<menu label="Test personaggio" name="Character Tests">
 				<menu_item_call label="Alterna la geometria dei personaggi" name="Toggle Character Geometry"/>
@@ -339,18 +335,27 @@
 		</menu>
 		<menu_item_check label="Texture HTTP" name="HTTP Textures"/>
 		<menu_item_check label="Inventario HTTP" name="HTTP Inventory"/>
+		<menu_item_call label="Attiva Visual Leak Detector" name="Enable Visual Leak Detector"/>
 		<menu_item_check label="Finestra Console al prossimo lancio" name="Console Window"/>
+		<menu label="Imposta livello di registrazione" name="Set Logging Level">
+			<menu_item_check label="Debug" name="Debug"/>
+			<menu_item_check label="Informazioni" name="Info"/>
+			<menu_item_check label="Attenzione" name="Warning"/>
+			<menu_item_check label="Errore" name="Error"/>
+			<menu_item_check label="Nessuno" name="None"/>
+		</menu>
 		<menu_item_call label="Richiedi diritti Admin" name="Request Admin Options"/>
 		<menu_item_call label="Lascia stato Admin" name="Leave Admin Options"/>
 		<menu_item_check label="Mostra menu Admin" name="View Admin Options"/>
 	</menu>
 	<menu label="Admin" name="Admin">
-		<menu label="Object">
-			<menu_item_call label="Prendi copia" name="Take Copy"/>
+		<menu label="Oggetto" name="AdminObject">
+			<menu_item_call label="Prendi copia" name="Admin Take Copy"/>
 			<menu_item_call label="Rendimi proprietario" name="Force Owner To Me"/>
 			<menu_item_call label="Forza permesso proprietario" name="Force Owner Permissive"/>
 			<menu_item_call label="Elimina" name="Delete"/>
 			<menu_item_call label="Blocca" name="Lock"/>
+			<menu_item_call label="Ottieni ID asset" name="Get Assets IDs"/>
 		</menu>
 		<menu label="Lotto" name="Parcel">
 			<menu_item_call label="Rendimi proprietario" name="Owner To Me"/>
@@ -367,5 +372,16 @@
 		<menu label="Take Off Clothing" name="Take Off Clothing">
 			<menu_item_call label="Fisica" name="Physics"/>
 		</menu>
+		<menu label="Guida" name="DeprecatedHelp">
+			<menu_item_call label="Blog ufficiale Linden" name="Official Linden Blog"/>
+			<menu_item_call label="Portale script" name="Scripting Portal"/>
+			<menu label="Segnalazione bug" name="Bug Reporting">
+				<menu_item_call label="Monitoraggio problemi pubblici" name="Public Issue Tracker"/>
+				<menu_item_call label="Guida Monitoraggio problemi pubblici" name="Publc Issue Tracker Help"/>
+				<menu_item_call label="Guida alla segnalazione di bug" name="Bug Reporing 101"/>
+				<menu_item_call label="Problemi sicurezza" name="Security Issues"/>
+				<menu_item_call label="Wiki domande e risposte" name="QA Wiki"/>
+			</menu>
+		</menu>
 	</menu>
 </menu_bar>
diff --git a/indra/newview/skins/default/xui/it/notifications.xml b/indra/newview/skins/default/xui/it/notifications.xml
index e19b84912a5694a80a77759a82980bb8dea2473e..0e6fee60d16a99587936c5aedb44874e42124ddb 100644
--- a/indra/newview/skins/default/xui/it/notifications.xml
+++ b/indra/newview/skins/default/xui/it/notifications.xml
@@ -86,17 +86,38 @@ Accertati che la tua connessione Internet stia funzionando correttamente.
 		<usetemplate canceltext="Annulla" name="yesnocancelbuttons" notext="Non salvare" yestext="Salva"/>
 	</notification>
 	<notification name="ConfirmNoCopyToOutbox">
-		Non hai l&apos;autorizzazione necessaria per copiare questo oggetto nella casella in uscita di Marketplace. Sei sicuro di volere spostare gli oggetti seguenti?
-        [ITEM_NAME]
-		<usetemplate name="okcancelbuttons" notext="No" yestext="Sì"/>
+		Non hai l&apos;autorizzazione necessaria per copiare almeno uno di questi elementi nella casella in uscita del rivenditore.  Puoi spostarli o lasciarli indietro.
+		<usetemplate name="okcancelbuttons" notext="Non spostare gli oggetti" yestext="Sposta oggetti"/>
 	</notification>
-	<notification name="OutboxUploadComplete">
-		Caricamento di Marketplace completato.
-		<usetemplate name="okbutton" yestext="Ottimo!"/>
+	<notification name="OutboxFolderCreated">
+		Una nuova cartella è stata creata per ciascun elemento trasferito nel livello superiore della casella in uscita del rivenditore.
+		<usetemplate ignoretext="Una nuova cartella è stata creata nella casella in uscita del rivenditore" name="okignore" yestext="OK"/>
 	</notification>
-	<notification name="OutboxUploadHadErrors">
-		Caricamento di Marketplace completato senza errori.  Correggi i problemi nella casella in uscita e riprova. Grazie.
-		<usetemplate name="okbutton" yestext="Riprova"/>
+	<notification name="OutboxImportComplete">
+		Successo
+
+Tutte le cartelle sono state inviate a Marketplace correttamente.
+		<usetemplate ignoretext="Tutte le cartelle inviate a Marketplace" name="okignore" yestext="OK"/>
+	</notification>
+	<notification name="OutboxImportHadErrors">
+		Alcune cartelle non sono state trasferite
+
+Si sono verificati degli errori durante l&apos;invio di alcune cartelle a Marketplace.  Tali cartelle sono ancora nella casella in uscita del rivenditore.
+
+Per ulteriori informazioni consulta il [[MARKETPLACE_IMPORTS_URL] registro errori].
+		<usetemplate name="okbutton" yestext="OK"/>
+	</notification>
+	<notification name="OutboxImportFailed">
+		Trasferimento non riuscito
+
+Nessuna cartella è stata inviata a Marketplace, a causa di un errore di sistema o di rete.  Riprova più tardi.
+		<usetemplate name="okbutton" yestext="OK"/>
+	</notification>
+	<notification name="OutboxInitFailed">
+		Inizializzazione Marketplace non riuscita
+
+L&apos;inizializzazione con il Marketplace non ha avuto successo a causa di un errore di sistema o di rete.  Riprova più tardi.
+		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="CompileQueueSaveText">
 		C&apos;è stato un problema importando il testo di uno script per la seguente ragione: [REASON]. Riprova più tardi.
@@ -647,7 +668,7 @@ Attese [VALIDS]
 		Impossibile creare il file in uscita: [FILE]
 	</notification>
 	<notification name="DoNotSupportBulkAnimationUpload">
-		[APP_NAME] non supporta ancora il caricamento in blocco di file di animazione.
+		[APP_NAME] non supporta ancora il caricamento in blocco di file di animazione in formato BVH.
 	</notification>
 	<notification name="CannotUploadReason">
 		Impossibile importare il file [FILE] a causa del seguente motivo: [REASON]
@@ -978,7 +999,7 @@ Offri l&apos;amicizia a [NAME]?
 		</form>
 	</notification>
 	<notification name="RemoveFromFriends">
-		Vuoi rimuovere [NAME] dalla lista dei tuoi amici?
+		Vuoi rimuovere &lt;nolink&gt;[NAME]&lt;/nolink&gt; dalla lista dei tuoi amici?
 		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="RemoveMultipleFromFriends">
@@ -1110,8 +1131,13 @@ Cedere questi [AREA] m² di terreno al gruppo &apos;[GROUP_NAME]&apos;?
 	<notification name="DisplaySetToSafe">
 		Le impostazioni dello schermo sono state impostate a valori di sicurezza perchè hai specificato l&apos;opzione -safe.
 	</notification>
-	<notification name="DisplaySetToRecommended">
-		Le impostazioni dello schermo sono state impostate a valori ottimali basati sulla tua configurazione di sistema.
+	<notification name="DisplaySetToRecommendedGPUChange">
+		Le impostazioni di visualizzazione sono ai livelli consigliati a causa di un cambiamento nella scheda grafica
+da &apos;[LAST_GPU]&apos;
+a &apos;[THIS_GPU]&apos;
+	</notification>
+	<notification name="DisplaySetToRecommendedFeatureChange">
+		Le impostazioni di visualizzazione sono ai livelli consigliati a causa di un cambiamento nel sottosistema di rendering.
 	</notification>
 	<notification name="ErrorMessage">
 		[ERROR_MESSAGE]
@@ -1432,8 +1458,8 @@ Per installare l&apos;aggiornamento è necessario riavviare [APP_NAME].
 		<usetemplate ignoretext="Conferma prima di restituire gli oggetti ai relativi proprietari" name="okcancelignore" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="GroupLeaveConfirmMember">
-		Sei attualmente un membro del gruppo [GROUP].
-Vuoi lasciare il gruppo?
+		Attualmente sei un membro del gruppo &lt;nolink&gt;[GROUP]&lt;/nolink&gt;.
+Lasciare il gruppo?
 		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="ConfirmKick">
@@ -1916,7 +1942,13 @@ Trasferisci gli elementi nell&apos;inventario?
 		<usetemplate ignoretext="Conferma prima di uscire" name="okcancelignore" notext="Non uscire" yestext="Esci"/>
 	</notification>
 	<notification name="ConfirmRestoreToybox">
-		Passare ai pulsanti e alle barre strumenti predefinite? 
+		Questa azione ripristina pulsanti e barre degli strumenti predefinite.
+
+Questa azione non può essere ripristinata
+		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="OK"/>
+	</notification>
+	<notification name="ConfirmClearAllToybox">
+		Questa azione riporterà tutti i pulsanti nella casella strumenti. Le barre degli strumenti saranno vuote.
     
 Questa azione non può essere ripristinata
 		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="OK"/>
@@ -2125,10 +2157,10 @@ Verrà avviato il browser Web.
 		Oggetto: [SUBJECT], Messaggio: [MESSAGE]
 	</notification>
 	<notification name="FriendOnline">
-		[NAME] è Online
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; è online
 	</notification>
 	<notification name="FriendOffline">
-		[NAME] è Offline
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; è offline
 	</notification>
 	<notification name="AddSelfFriend">
 		Anche se sei molto simpatico, non puoi aggiungere te stesso all&apos;elenco degli amici.
@@ -2241,14 +2273,16 @@ Seleziona solo un oggetto.
 		Il tuo biglietto da visita non è stato accettato.
 	</notification>
 	<notification name="TeleportToLandmark">
-		Puoi teleportarti alle ubicazioni come &apos;[NAME]&apos; aprendo il pannello Luoghi sul lato destro dello schermo, quindi selezionare la scheda Punti di riferimento.
-Clicca su un punto di riferimento per selezionarlo, quindi clicca su Teleport sul lato inferiore del pannello.
-(Puoi anche fare doppio clic sul punto di riferimento oppure cliccare su di esso con il tasto destro del mouse e scegliere Teleport.)
+		Per teleportarti a luoghi come &apos;[NAME]&apos;, clicca sul pulsante &quot;Luoghi&quot;,
+    quindi seleziona la scheda Punti di riferimento nel pannello che viene aperto. Clicca su qualsiasi
+    unto di riferimento per selezionarlo, quindi clicca su Teleport sul lato inferiore del pannello.
+    (Puoi anche fare doppio clic sul punto di riferimento oppure cliccare su di esso con il tasto destro del mouse e 
+    scegliere Teleport.)
 	</notification>
 	<notification name="TeleportToPerson">
-		Puoi contattare il residente &apos;[NAME]&apos; aprendo il pannello Persone nel lato destro del tuo schermo.
-Seleziona il residente dall&apos;elenco, clicca su &apos;IM&apos; in basso nel pannello.
-(Puoi anche fare doppio clic sul nome nell&apos;elenco oppure fare clic con il pulsante destro del mouse e selezionare &apos;IM&apos;).
+		Per contattare Residenti come &apos;[NAME]&apos;, clicca sul pulsante &quot;Persone&quot;, seleziona un Residente nel pannello che viene aperto, quindi clicca su &apos;IM&apos; in
+    basso nel pannello.
+    (Puoi anche fare doppio clic sul nome nell&apos;elenco oppure fare clic con il pulsante destro del mouse e selezionare &apos;IM&apos;).
 	</notification>
 	<notification name="CantSelectLandFromMultipleRegions">
 		Non è possibile selezionare il terreno attraverso i confini del server.
@@ -2269,6 +2303,9 @@ Prova a selezionare una parte di terreno più piccola.
 	<notification name="PaymentSent">
 		[MESSAGE]
 	</notification>
+	<notification name="PaymentFailure">
+		[MESSAGE]
+	</notification>
 	<notification name="EventNotification">
 		Notifica eventi:
 
@@ -2520,10 +2557,10 @@ Riprova tra qualche istante.
 		</form>
 	</notification>
 	<notification name="FriendshipAccepted">
-		[NAME] ha accettato la tua offerta di amicizia.
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; ha accettato la tua richiesta di amicizia.
 	</notification>
 	<notification name="FriendshipDeclined">
-		[NAME] ha rifiutato la tua offerta di amicizia.
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; ha rifiutato la tua richiesta di amicizia.
 	</notification>
 	<notification name="FriendshipAcceptedByMe">
 		Offerta di amicizia accettata.
@@ -2595,16 +2632,16 @@ Concedi questa richiesta?
 		&apos;&lt;nolink&gt;[TITLE]&lt;/nolink&gt;&apos; di [NAME]
 [MESSAGE]
 		<form name="form">
-			<button name="Mute" text="Blocca"/>
-			<button name="Ignore" text="Ignora"/>
+			<button name="Client_Side_Mute" text="Blocca"/>
+			<button name="Client_Side_Ignore" text="Ignora"/>
 		</form>
 	</notification>
 	<notification name="ScriptDialogGroup">
 		&apos;&lt;nolink&gt;[TITLE]&lt;/nolink&gt;&apos; di [GROUPNAME]
 [MESSAGE]
 		<form name="form">
-			<button name="Mute" text="Blocca"/>
-			<button name="Ignore" text="Ignora"/>
+			<button name="Client_Side_Mute" text="Blocca"/>
+			<button name="Client_Side_Ignore" text="Ignora"/>
 		</form>
 	</notification>
 	<notification name="BuyLindenDollarSuccess">
@@ -2799,6 +2836,18 @@ Per informazioni dettagliate, vedi il file del registro.
 
 Con i seguenti residenti?
 
+[RESIDENTS]
+		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="OK"/>
+	</notification>
+	<notification name="ShareFolderConfirmation">
+		Si può condividere solo una cartella alla volta.
+
+Sei sicuro di volere condividere gli oggetti seguenti:
+
+&lt;nolink&gt;[ITEMS]&lt;/nolink&gt;
+
+Con i seguenti residenti:
+
 [RESIDENTS]
 		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="Ok"/>
 	</notification>
@@ -2890,7 +2939,7 @@ In questo modo verrà disattivato l&apos;audio anche di tutti i residenti che si
 uniscono alla chiamata in un secondo momento, anche dopo che tu ti fossi scollegato.
 
 Disattiva audio di tutti?
-		<usetemplate ignoretext="Conferma prima di disattivare l&apos;audio di tutti i partecipanti alla chiamata di gruppo" name="okcancelignore" notext="Annulla" yestext="Ok"/>
+		<usetemplate ignoretext="Conferma prima di disattivare l&apos;audio di tutti i partecipanti alla chiamata di gruppo" name="okcancelignore" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification label="Chat" name="HintChat">
 		Per partecipare alla conversazione, digita nel campo chat in basso.
diff --git a/indra/newview/skins/default/xui/it/panel_edit_skin.xml b/indra/newview/skins/default/xui/it/panel_edit_skin.xml
index a15489b333a9dfe9ef759d9ad0dc429497211d5a..466eff27080bcedbe990baa105ef2a3c00528279 100644
--- a/indra/newview/skins/default/xui/it/panel_edit_skin.xml
+++ b/indra/newview/skins/default/xui/it/panel_edit_skin.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="edit_skin_panel">
 	<panel name="avatar_skin_color_panel">
-		<texture_picker label="Tatuaggi testa" name="Head Tattoos" tool_tip="Clicca per scegliere una fotografia"/>
-		<texture_picker label="Tatuaggi superiori" name="Upper Tattoos" tool_tip="Clicca per scegliere una fotografia"/>
-		<texture_picker label="Tatuaggi inferiori" name="Lower Tattoos" tool_tip="Clicca per scegliere una fotografia"/>
+		<texture_picker label="Testa" name="Head" tool_tip="Clicca per scegliere una fotografia"/>
+		<texture_picker label="Parte superiore del corpo" name="Upper Body" tool_tip="Clicca per scegliere una fotografia"/>
+		<texture_picker label="Parte inferiore del corpo" name="Lower Body" tool_tip="Clicca per scegliere una fotografia"/>
 	</panel>
 	<panel name="accordion_panel">
 		<accordion name="wearable_accordion">
diff --git a/indra/newview/skins/default/xui/it/panel_my_profile.xml b/indra/newview/skins/default/xui/it/panel_my_profile.xml
deleted file mode 100644
index 094b97962f4ecff95d33b5d3050bffbdf4db3d68..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/it/panel_my_profile.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Profilo" name="panel_profile">
-	<string name="no_partner_text" value="Nessuno"/>
-	<string name="no_group_text" value="Nessuno"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="scroll_content_panel">
-					<panel name="second_life_image_panel">
-						<text name="display_name_descr_text">
-							Nome utente
-						</text>
-						<text name="name_descr_text">
-							Nome visualizzato
-						</text>
-						<button label="Profilo" name="see_profile_btn" tool_tip="Visualizza profilo per questo avatar"/>
-					</panel>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/it/panel_nearby_chat.xml b/indra/newview/skins/default/xui/it/panel_nearby_chat.xml
index 1b529e2737cf403c303ac640efc6d406d1424dbc..d46a15c735637fb6dcb804d7ffcfd21860498af4 100644
--- a/indra/newview/skins/default/xui/it/panel_nearby_chat.xml
+++ b/indra/newview/skins/default/xui/it/panel_nearby_chat.xml
@@ -1,4 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="nearby_chat">
-	<check_box label="Traduci chat" name="translate_chat_checkbox"/>
+	<layout_stack name="stack">
+		<layout_panel name="translate_chat_checkbox_lp">
+			<check_box label="Traduci chat" name="translate_chat_checkbox"/>
+		</layout_panel>
+	</layout_stack>
 </panel>
diff --git a/indra/newview/skins/default/xui/it/panel_notes.xml b/indra/newview/skins/default/xui/it/panel_notes.xml
deleted file mode 100644
index e1271382778eac78893d8d87a1d16fbe11f301d2..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/it/panel_notes.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Note e Privacy" name="panel_notes">
-	<layout_stack name="layout">
-		<layout_panel name="notes_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<text name="status_message" value="Le mie note private:"/>
-					<text name="status_message2" value="Consenti a questa persona di:"/>
-					<check_box label="Vedere se sono online" name="status_check"/>
-					<check_box label="Vedermi sulla mappa" name="map_check"/>
-					<check_box label="Modificare, eliminare o prendere i miei oggetti" name="objects_check"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-		<layout_panel name="notes_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="Aggiungi come amico" name="add_friend" tool_tip="Offri amicizia a questo residente"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="IM" name="im" tool_tip="Apri una sessione messaggio istantaneo"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="Chiama" name="call" tool_tip="Chiama questo residente"/>
-				</layout_panel>
-				<layout_panel name="show_on_map_btn_lp">
-					<button label="Mappa" name="show_on_map_btn" tool_tip="Mostra il residente sulla mappa"/>
-				</layout_panel>
-				<layout_panel name="teleport_btn_lp">
-					<button label="Teleport" name="teleport" tool_tip="Offri teleport"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/it/panel_postcard_message.xml b/indra/newview/skins/default/xui/it/panel_postcard_message.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c720f4822dcc0f6ed703236164e748cbac7ab260
--- /dev/null
+++ b/indra/newview/skins/default/xui/it/panel_postcard_message.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_postcard_message">
+	<text name="to_label">
+		A:
+	</text>
+	<text name="name_label">
+		Da:
+	</text>
+	<text name="subject_label">
+		Oggetto:
+	</text>
+	<line_editor label="Digita qui l&apos;oggetto." name="subject_form"/>
+	<text name="msg_label">
+		Messaggio:
+	</text>
+	<text_editor name="msg_form">
+		Digita qui il messaggio.
+	</text_editor>
+	<button label="Annulla" name="cancel_btn"/>
+	<button label="Invia" name="send_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/it/panel_postcard_settings.xml b/indra/newview/skins/default/xui/it/panel_postcard_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6a586c44155ee3b7dbc07da87a8c82ed5f21596f
--- /dev/null
+++ b/indra/newview/skins/default/xui/it/panel_postcard_settings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_postcard_settings">
+	<combo_box label="Risoluzione" name="postcard_size_combo">
+		<combo_box.item label="Finestra attuale" name="CurrentWindow"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="Personalizza" name="Custom"/>
+	</combo_box>
+	<layout_stack name="postcard_image_params_ls">
+		<layout_panel name="postcard_image_size_lp">
+			<spinner label="Larghezza" name="postcard_snapshot_width"/>
+			<spinner label="Altezza" name="postcard_snapshot_height"/>
+			<check_box label="Mantieni le proporzioni" name="postcard_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="postcard_image_format_quality_lp">
+			<slider label="Qualità dell&apos;immagine" name="image_quality_slider"/>
+			<text name="image_quality_level">
+				([QLVL])
+			</text>
+		</layout_panel>
+	</layout_stack>
+</panel>
diff --git a/indra/newview/skins/default/xui/it/panel_preferences_chat.xml b/indra/newview/skins/default/xui/it/panel_preferences_chat.xml
index 1a0a1d8434eacc04950ce1afaab796c7635bfc64..7f5992b58452499f316203aafa23b76fcda099a0 100644
--- a/indra/newview/skins/default/xui/it/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/it/panel_preferences_chat.xml
@@ -29,30 +29,5 @@
 	<check_box label="Chat IM" name="EnableIMChatPopups" tool_tip="Seleziona per vedere una finestra popup quando arriva un messaggio IM"/>
 	<spinner label="Durata chat vicine:" name="nearby_toasts_lifetime"/>
 	<spinner label="Durata dissolvenza chat vicine:" name="nearby_toasts_fadingtime"/>
-	<check_box label="Use machine translation while chatting" name="translate_chat_checkbox"/>
-	<text name="translate_chb_label">
-		Usa la traduzione meccanica durante le chat
-	</text>
-	<text name="translate_language_text" width="110">
-		Traduci chat in:
-	</text>
-	<combo_box name="translate_language_combobox" width="146">
-		<combo_box.item label="Default di sistema" name="System Default Language"/>
-		<combo_box.item label="English (Inglese)" name="English"/>
-		<combo_box.item label="Dansk (Danese)" name="Danish"/>
-		<combo_box.item label="Deutsch (Tedesco)" name="German"/>
-		<combo_box.item label="Español (Spagnolo)" name="Spanish"/>
-		<combo_box.item label="Français (Francese)" name="French"/>
-		<combo_box.item label="Italiano" name="Italian"/>
-		<combo_box.item label="Magyar (Ungherese)" name="Hungarian"/>
-		<combo_box.item label="Nederlands (Olandese)" name="Dutch"/>
-		<combo_box.item label="Polski (Polacco)" name="Polish"/>
-		<combo_box.item label="Português (Portoghese)" name="Portugese"/>
-		<combo_box.item label="Русский (Russo)" name="Russian"/>
-		<combo_box.item label="Türkçe (Turco)" name="Turkish"/>
-		<combo_box.item label="Українська (Ucraino)" name="Ukrainian"/>
-		<combo_box.item label="中文 (正體) (Cinese)" name="Chinese"/>
-		<combo_box.item label="日本語 (Giapponese)" name="Japanese"/>
-		<combo_box.item label="한국어 (Coreano)" name="Korean"/>
-	</combo_box>
+	<button label="Impostazioni traduzione chat" name="ok_btn"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/it/panel_preferences_setup.xml b/indra/newview/skins/default/xui/it/panel_preferences_setup.xml
index bf784321108185a0385d5ce212469861bd1cf38e..0189d47f45e6bdd5976403693bc0989b6b4dbd70 100644
--- a/indra/newview/skins/default/xui/it/panel_preferences_setup.xml
+++ b/indra/newview/skins/default/xui/it/panel_preferences_setup.xml
@@ -15,7 +15,7 @@
 		Web:
 	</text>
 	<radio_group name="use_external_browser">
-		<radio_item label="Usa il mio browser (IE, Firefox, Safari)" name="external" tool_tip="Utilizza il browser Web predefinito di sistema per l&apos;aiuto, per i link Web e così via. Sconsigliato durante l&apos;esecuzione a tutto schermo." value="1"/>
+		<radio_item label="Usa il mio browser (IE, Firefox, Safari)" name="external" tool_tip="Utilizza il browser Web predefinito di sistema per l&apos;aiuto, per i link Web e così via. Sconsigliato durante l&apos;esecuzione a tutto schermo." value="true"/>
 		<radio_item label="Utilizza il browser Web integrato" name="internal" tool_tip="Utilizza il browser Web integrato per l&apos;aiuto, per i link Web e così via. Questo browser si apre in una nuova finestra in [APP_NAME]." value=""/>
 	</radio_group>
 	<check_box initial_value="true" label="Abilita plugin" name="browser_plugins_enabled"/>
diff --git a/indra/newview/skins/default/xui/it/panel_profile.xml b/indra/newview/skins/default/xui/it/panel_profile.xml
deleted file mode 100644
index 309937c5a01a84bb35240a7ff87ecb7dde658d99..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/it/panel_profile.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Profilo" name="panel_profile">
-	<string name="CaptionTextAcctInfo">
-		[ACCTTYPE]
-[PAYMENTINFO] [AGEVERIFICATION]
-	</string>
-	<string name="payment_update_link_url">
-		http://www.secondlife.com/account/billing.php?lang=it-IT
-	</string>
-	<string name="partner_edit_link_url">
-		http://www.secondlife.com/account/partners.php?lang=it
-	</string>
-	<string name="my_account_link_url" value="http://secondlife.com/my/account/index.php?lang=it-IT"/>
-	<string name="no_partner_text" value="Nessuno"/>
-	<string name="no_group_text" value="Nessuno"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<panel name="second_life_image_panel">
-						<text name="title_sl_descr_text" value="[SECOND_LIFE]:"/>
-					</panel>
-					<panel name="first_life_image_panel">
-						<text name="title_rw_descr_text" value="Mondo reale:"/>
-					</panel>
-					<text name="title_member_text" value="Residente dal:"/>
-					<text name="title_acc_status_text" value="Stato account:"/>
-					<text name="title_partner_text" value="Partner:"/>
-					<panel name="partner_data_panel">
-						<text initial_value="(recupero)" name="partner_text"/>
-					</panel>
-					<text name="title_groups_text" value="Gruppi:"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-	<layout_stack name="layout_verb_buttons">
-		<layout_panel name="profile_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="Aggiungi come amico" name="add_friend" tool_tip="Offri amicizia a questo residente"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="IM" name="im" tool_tip="Apri una sessione messaggio istantaneo"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="Chiama" name="call" tool_tip="Chiama questo residente"/>
-				</layout_panel>
-				<layout_panel name="chat_btn_lp">
-					<button label="Teleport" name="teleport" tool_tip="Offri teleport"/>
-				</layout_panel>
-				<layout_panel name="overflow_btn_lp">
-					<menu_button label="â–¼" name="overflow_btn" tool_tip="Paga del denaro o condividi qualcosa dall&apos;inventario con il residente"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-		<layout_panel name="profile_me_buttons_panel">
-			<button label="Modifica profilo" name="edit_profile_btn" tool_tip="Modifica le tue informazioni personali"/>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/it/panel_profile_view.xml b/indra/newview/skins/default/xui/it/panel_profile_view.xml
deleted file mode 100644
index 409eb5d1f40ade32789337ef63c3f83dff59d5de..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/it/panel_profile_view.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel name="panel_target_profile">
-	<string name="status_online">
-		Online
-	</string>
-	<string name="status_offline">
-		Offline
-	</string>
-	<text name="display_name_label" value="Nome visualizzato:"/>
-	<text name="solo_username_label" value="Nome utente:"/>
-	<text name="status" value="Online"/>
-	<text name="user_name_small" value="Jack guarda quanto è lungo questo splendido nome"/>
-	<text name="user_name" value="Jack Linden"/>
-	<button name="copy_to_clipboard" tool_tip="Copia negli appunti"/>
-	<text name="user_label" value="Nome utente:"/>
-	<text name="user_slid" value="jack.linden"/>
-	<tab_container name="tabs">
-		<panel label="PROFILO" name="panel_profile"/>
-		<panel label="LUOGHI CONSIGLIATI" name="panel_picks"/>
-		<panel label="NOTE E PRIVACY" name="panel_notes"/>
-	</tab_container>
-</panel>
diff --git a/indra/newview/skins/default/xui/it/panel_region_estate.xml b/indra/newview/skins/default/xui/it/panel_region_estate.xml
index 61e3f310243ef748bbe6c8bda3ad19ee652dbf78..da6b6b277f58df3ca042c5292322a53a46161ea2 100644
--- a/indra/newview/skins/default/xui/it/panel_region_estate.xml
+++ b/indra/newview/skins/default/xui/it/panel_region_estate.xml
@@ -23,10 +23,10 @@
 	<check_box label="Permetti accesso pubblico" name="externally_visible_check"/>
 	<button label="?" name="externally_visible_help"/>
 	<text name="Only Allow">
-		Limita l&apos;accesso agli account verificati con:
+		Consenti l&apos;accesso solo ai Residenti che:
 	</text>
-	<check_box label="Informazioni di pagamento in archivio" name="limit_payment" tool_tip="Espelli i residenti non identificati"/>
-	<check_box label="Verifica età" name="limit_age_verified" tool_tip="Espelli i residenti che non hanno la loro età verificata. Vedi [SUPPORT_SITE] per maggiori informazioni."/>
+	<check_box label="Hanno memorizzato le informazioni per l&apos;addebito" name="limit_payment" tool_tip="Per poter visitare questa proprietà immobiliare i Residenti devono aver fornito informazioni di pagamento a Linden Lab.  Vedi [SUPPORT_SITE] per maggiori informazioni."/>
+	<check_box label="Hanno verificato l&apos;età" name="limit_age_verified" tool_tip="Per poter visitare questa proprietà immobiliare i Residenti devono aver verificato la propria età. Vedi [SUPPORT_SITE] per maggiori informazioni."/>
 	<check_box label="Permetti la chat voice" name="voice_chat_check"/>
 	<button label="?" name="voice_chat_help"/>
 	<check_box label="Permetti teleport diretto" name="allow_direct_teleport"/>
diff --git a/indra/newview/skins/default/xui/it/panel_script_ed.xml b/indra/newview/skins/default/xui/it/panel_script_ed.xml
index 950dfacf3a429af30ff4914ccedeee09aff97936..d7ee8230b354fffbdfd0088c1c67eed40723ec3b 100644
--- a/indra/newview/skins/default/xui/it/panel_script_ed.xml
+++ b/indra/newview/skins/default/xui/it/panel_script_ed.xml
@@ -22,6 +22,8 @@
 		<menu label="File" name="File">
 			<menu_item_call label="Salva" name="Save"/>
 			<menu_item_call label="Annulla tutte le modifiche" name="Revert All Changes"/>
+			<menu_item_call label="Carica da file..." name="LoadFromFile"/>
+			<menu_item_call label="Salva su file..." name="SaveToFile"/>
 		</menu>
 		<menu label="Modifica" name="Edit">
 			<menu_item_call label="Annulla" name="Undo"/>
diff --git a/indra/newview/skins/default/xui/it/panel_snapshot_inventory.xml b/indra/newview/skins/default/xui/it/panel_snapshot_inventory.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c9245029b71c5a4094c512e0a2aea5ff2bcc6954
--- /dev/null
+++ b/indra/newview/skins/default/xui/it/panel_snapshot_inventory.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_inventory">
+	<text name="title">
+		Salva nell&apos;inventario
+	</text>
+	<text name="hint_lbl">
+		Salvare un&apos;immagine nell&apos;inventario costa L$[UPLOAD_COST]. Per salvare l&apos;immagine come texture, selezionare uno dei formati quadrati.
+	</text>
+	<combo_box label="Risoluzione" name="texture_size_combo">
+		<combo_box.item label="Finestra attuale" name="CurrentWindow"/>
+		<combo_box.item label="Piccola (128x128)" name="Small(128x128)"/>
+		<combo_box.item label="Media (256x256)" name="Medium(256x256)"/>
+		<combo_box.item label="Grande (512x512)" name="Large(512x512)"/>
+		<combo_box.item label="Personalizza" name="Custom"/>
+	</combo_box>
+	<spinner label="Larghezza" name="inventory_snapshot_width"/>
+	<spinner label="Altezza" name="inventory_snapshot_height"/>
+	<check_box label="Mantieni le proporzioni" name="inventory_keep_aspect_check"/>
+	<button label="Annulla" name="cancel_btn"/>
+	<button label="Salva" name="save_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/it/panel_snapshot_local.xml b/indra/newview/skins/default/xui/it/panel_snapshot_local.xml
new file mode 100644
index 0000000000000000000000000000000000000000..4b725b68f97455031673cf47dee6e895ab82f118
--- /dev/null
+++ b/indra/newview/skins/default/xui/it/panel_snapshot_local.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_local">
+	<text name="title">
+		Salva sul mio computer
+	</text>
+	<combo_box label="Risoluzione" name="local_size_combo">
+		<combo_box.item label="Finestra attuale" name="CurrentWindow"/>
+		<combo_box.item label="320x240" name="320x240"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="1280x1024" name="1280x1024"/>
+		<combo_box.item label="1600x1200" name="1600x1200"/>
+		<combo_box.item label="Personalizza" name="Custom"/>
+	</combo_box>
+	<layout_stack name="local_image_params_ls">
+		<layout_panel name="local_image_size_lp">
+			<spinner label="Larghezza" name="local_snapshot_width"/>
+			<spinner label="Altezza" name="local_snapshot_height"/>
+			<check_box label="Mantieni le proporzioni" name="local_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="local_image_format_quality_lp">
+			<combo_box label="Formato" name="local_format_combo">
+				<combo_box.item label="PNG (senza perdite)" name="PNG"/>
+				<combo_box.item label="JPEG" name="JPEG"/>
+				<combo_box.item label="BMP (senza perdite)" name="BMP"/>
+			</combo_box>
+			<slider label="Qualità dell&apos;immagine" name="image_quality_slider"/>
+			<text name="image_quality_level">
+				([QLVL])
+			</text>
+		</layout_panel>
+	</layout_stack>
+	<button label="Annulla" name="cancel_btn"/>
+	<flyout_button label="Salva" name="save_btn" tool_tip="Salva immagine come file">
+		<flyout_button.item label="Salva" name="save_item"/>
+		<flyout_button.item label="Salva con nome..." name="saveas_item"/>
+	</flyout_button>
+</panel>
diff --git a/indra/newview/skins/default/xui/it/panel_snapshot_options.xml b/indra/newview/skins/default/xui/it/panel_snapshot_options.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f2d42c5197b09c722770b7da6c1d23c32a4917c2
--- /dev/null
+++ b/indra/newview/skins/default/xui/it/panel_snapshot_options.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_options">
+	<button label="Invia post al feed del mio profilo" name="save_to_profile_btn"/>
+	<button label="E-mail" name="save_to_email_btn"/>
+	<button label="Salva nell&apos;inventario (L$[AMOUNT])" name="save_to_inventory_btn"/>
+	<button label="Salva sul mio computer" name="save_to_computer_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/it/panel_snapshot_postcard.xml b/indra/newview/skins/default/xui/it/panel_snapshot_postcard.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3703b97e6cef9d78e354c3f64e0a6b98e8e20c2f
--- /dev/null
+++ b/indra/newview/skins/default/xui/it/panel_snapshot_postcard.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_postcard">
+	<string name="default_subject">
+		Cartolina da [SECOND_LIFE].
+	</string>
+	<string name="default_message">
+		Dai un&apos;occhiata!
+	</string>
+	<string name="upload_message">
+		Invio...
+	</string>
+	<text name="title">
+		E-mail
+	</text>
+	<button label="Messaggio" name="message_btn"/>
+	<button label="Impostazioni" name="settings_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/it/panel_snapshot_profile.xml b/indra/newview/skins/default/xui/it/panel_snapshot_profile.xml
new file mode 100644
index 0000000000000000000000000000000000000000..2cdbf970498b53004b48b7e0a31e485eb26b6d93
--- /dev/null
+++ b/indra/newview/skins/default/xui/it/panel_snapshot_profile.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_profile">
+	<text name="title">
+		Invia post al feed del mio profilo
+	</text>
+	<combo_box label="Risoluzione" name="profile_size_combo">
+		<combo_box.item label="Finestra attuale" name="CurrentWindow"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="Personalizza" name="Custom"/>
+	</combo_box>
+	<layout_stack name="profile_image_params_ls">
+		<layout_panel name="profile_image_size_lp">
+			<spinner label="Larghezza" name="profile_snapshot_width"/>
+			<spinner label="Altezza" name="profile_snapshot_height"/>
+			<check_box label="Mantieni le proporzioni" name="profile_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="profile_image_metadata_lp">
+			<text name="caption_label">
+				Didascalia:
+			</text>
+			<check_box initial_value="true" label="Includi luogo" name="add_location_cb"/>
+		</layout_panel>
+	</layout_stack>
+	<button label="Annulla" name="cancel_btn"/>
+	<button label="Post" name="post_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/it/panel_status_bar.xml b/indra/newview/skins/default/xui/it/panel_status_bar.xml
index fadaa575ea758c66b47063ba4d797fb17592875b..0aaf89d8c89d8788645d40ddb59183d925bb41b2 100644
--- a/indra/newview/skins/default/xui/it/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/it/panel_status_bar.xml
@@ -15,10 +15,10 @@
 	<panel.string name="buycurrencylabel">
 		L$ [AMT]
 	</panel.string>
-	<panel name="balance_bg">
+	<panel left="-405" name="balance_bg" width="195">
 		<text name="balance" tool_tip="Clicca per aggiornare il tuo saldo in L$" value="L$ 20"/>
 		<button label="Acquista L$" name="buyL" tool_tip="Clicca per acquistare più L$"/>
-		<button label="Acquisti" name="goShop" tool_tip="Apri Mercato Second Life"/>
+		<button label="Acquisti" name="goShop" tool_tip="Apri Mercato Second Life" width="75"/>
 	</panel>
 	<text name="TimeText" tool_tip="Orario attuale (Pacifico)">
 		24:00, ora del Pacifico
diff --git a/indra/newview/skins/default/xui/it/sidepanel_inventory.xml b/indra/newview/skins/default/xui/it/sidepanel_inventory.xml
index 5d6c7681f9a00b94db714083ad68d940688fb2fc..5ac0961bd754b5be842130b6c4edefd08835538d 100644
--- a/indra/newview/skins/default/xui/it/sidepanel_inventory.xml
+++ b/indra/newview/skins/default/xui/it/sidepanel_inventory.xml
@@ -2,47 +2,24 @@
 <panel label="Cose" name="objects panel">
 	<panel label="" name="sidepanel__inventory_panel">
 		<layout_stack name="inventory_layout_stack">
-			<layout_panel name="inbox_outbox_layout_panel">
-				<layout_stack name="inbox_outbox_layout_stack">
-					<layout_panel name="inbox_layout_panel">
-						<panel label="" name="marketplace_inbox">
-							<string name="InboxLabelWithArg">
-								Oggetti ricevuti ([NUM])
-							</string>
-							<string name="InboxLabelNoArg">
-								Oggetti ricevuti
-							</string>
-							<button label="Oggetti ricevuti" name="inbox_btn"/>
-							<text name="inbox_fresh_new_count">
-								[NUM] nuovi
-							</text>
-							<panel tool_tip="Drag and drop items to your inventory to manage and use them">
-								<text name="inbox_inventory_placeholder">
-									Gli acquisti dal mercato verranno consegnati qui.
-								</text>
-							</panel>
-						</panel>
-					</layout_panel>
-					<layout_panel name="outbox_layout_panel">
-						<panel label="" name="marketplace_outbox">
-							<string name="OutboxLabelWithArg">
-								Casella venditore in uscita ([NUM])
-							</string>
-							<string name="OutboxLabelNoArg">
-								Casella venditore in uscita
-							</string>
-							<button label="Casella venditore in uscita" name="outbox_btn"/>
-							<button label="" name="outbox_sync_btn" tool_tip="Push su negozio Marketplace"/>
-							<panel>
-								<panel name="outbox_inventory_placeholder_panel">
-									<text name="outbox_inventory_placeholder_title">
-										Caricamento in corso...
-									</text>
-								</panel>
-							</panel>
-						</panel>
-					</layout_panel>
-				</layout_stack>
+			<layout_panel name="inbox_layout_panel">
+				<panel label="" name="marketplace_inbox">
+					<string name="InboxLabelWithArg">
+						Oggetti ricevuti ([NUM])
+					</string>
+					<string name="InboxLabelNoArg">
+						Oggetti ricevuti
+					</string>
+					<button label="Oggetti ricevuti" name="inbox_btn"/>
+					<text name="inbox_fresh_new_count">
+						[NUM] nuovi
+					</text>
+					<panel name="inbox_inventory_placeholder_panel" tool_tip="Trascina gli elementi nell&apos;inventario per usarli">
+						<text name="inbox_inventory_placeholder">
+							Gli acquisti dal mercato verranno consegnati qui.
+						</text>
+					</panel>
+				</panel>
 			</layout_panel>
 		</layout_stack>
 		<panel name="button_panel">
diff --git a/indra/newview/skins/default/xui/it/strings.xml b/indra/newview/skins/default/xui/it/strings.xml
index e58ce0cd70c5e3f58467274884bbda26cea1b57c..8529fadd7def85ed002bfef479bb0a54b158a81c 100644
--- a/indra/newview/skins/default/xui/it/strings.xml
+++ b/indra/newview/skins/default/xui/it/strings.xml
@@ -178,8 +178,8 @@ Visita www.secondlife.com/status per aggiornamenti.
 	</string>
 	<string name="LoginFailedPremiumOnly">
 		L&apos;accesso a Second Life è temporaneamente limitato per garantire che chi è nel mondo virtuale abbia la migliore esperienza possibile.
-	 	
-Le persona con account gratuiti non potrenno accedere a Second Life durante questo periodo, per lasciare spazio alle persone che hanno pagato per Second Life.
+
+Le persone con account gratuiti non potranno accedere a Second Life durante questo periodo, per lasciare spazio alle persone che hanno pagato per Second Life.
 	</string>
 	<string name="LoginFailedComputerProhibited">
 		Non si può accedere a Second Life da questo computer.
@@ -336,17 +336,35 @@ Prova ad accedere nuovamente tra un minuto.
 		Solo un singolo oggetto può essere creato qui
 	</string>
 	<string name="TooltipPrice" value="L$ [AMOUNT]:"/>
+	<string name="TooltipOutboxDragToWorld">
+		Non puoi rezzare elementi nella tua casella in uscita del rivenditore
+	</string>
 	<string name="TooltipOutboxNoTransfer">
-		Almeno un oggetto non può essere venduto o trasferito a un altro utente.
+		Almeno uno di questi oggetti non può essere venduto o trasferito.
+	</string>
+	<string name="TooltipOutboxNotInInventory">
+		La tua casella in uscita del rivenditore può accettare solo elementi provenienti dal tuo inventario
 	</string>
 	<string name="TooltipOutboxWorn">
-		Stai indossando almeno uno degli oggetti. Rimuovili dall&apos;avatar e prova nuovamente a spostarli.
+		Non puoi mettere gli elementi che indossi nella casella in uscita del rivenditore
+	</string>
+	<string name="TooltipOutboxCallingCard">
+		Non puoi inserire il tuo biglietto da visita nella tua casella in uscita del rivenditore
 	</string>
 	<string name="TooltipOutboxFolderLevels">
-		Questa cartella contiene troppi livelli di cartelle nidificate. Riordina le cartelle interne in modo che non ci siano più di 4 livelli (cartella principale che contiene la cartella A, che contiene la cartella B, che contiene la cartella C).
+		La profondità delle caselle nidificate è maggiore di 3
+	</string>
+	<string name="TooltipOutboxTooManyFolders">
+		Il numero di sottocartelle nella cartella al livello più alto è maggiore di 20
 	</string>
 	<string name="TooltipOutboxTooManyObjects">
-		Questa cartella contiene più di 200 oggetti. Inserisci alcuni oggetti in scatole per ridurne il numero.
+		Il numero di elementi nella cartella al livello più alto è maggiore di 200
+	</string>
+	<string name="TooltipDragOntoOwnChild">
+		Non puoi spostare una cartella nella relativa cartella secondaria
+	</string>
+	<string name="TooltipDragOntoSelf">
+		Non puoi spostare una cartella in se stessa
 	</string>
 	<string name="TooltipHttpUrl">
 		Clicca per visitare questa pagina web
@@ -592,6 +610,9 @@ Prova ad accedere nuovamente tra un minuto.
 	<string name="mesh">
 		reticolo
 	</string>
+	<string name="AvatarEditingAppearance">
+		(Modifica Aspetto)
+	</string>
 	<string name="AvatarAway">
 		Assente
 	</string>
@@ -808,6 +829,9 @@ Prova ad accedere nuovamente tra un minuto.
 	<string name="anim_yes_head">
 		Si
 	</string>
+	<string name="multiple_textures">
+		Multiple
+	</string>
 	<string name="texture_loading">
 		Caricamento in corso...
 	</string>
@@ -964,6 +988,9 @@ Prova ad accedere nuovamente tra un minuto.
 	<string name="choose_the_directory">
 		Scegli la cartella
 	</string>
+	<string name="script_files">
+		Script
+	</string>
 	<string name="AvatarSetNotAway">
 		Imposta come non assente
 	</string>
@@ -1202,43 +1229,36 @@ Prova ad accedere nuovamente tra un minuto.
 		Non hai una copia di questa texture nel tuo inventario
 	</string>
 	<string name="InventoryInboxNoItems">
-		Gli elementi acquistati attraverso il mercato verranno consegnati qui
+		Gli acquissti dal mercato verranno mostrati qui. Potrai quindi trascinarli nel tuo inventario per usarli.
 	</string>
 	<string name="MarketplaceURL">
-		http://marketplace.[DOMAIN_NAME]/learn_more
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/
 	</string>
 	<string name="MarketplaceURL_CreateStore">
-		http://marketplace.[DOMAIN_NAME]/create_store
-	</string>
-	<string name="MarketplaceURL_LearnMore">
-		http://marketplace.[DOMAIN_NAME]/learn_more
+		http://community.secondlife.com/t5/English-Knowledge-Base/Selling-in-the-Marketplace/ta-p/700193#Section_.4
 	</string>
-	<string name="InventoryOutboxCreationErrorTitle">
-		La casella in uscita del rivenditore non è configurata correttamente
+	<string name="MarketplaceURL_Dashboard">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/merchants/store/dashboard
 	</string>
-	<string name="InventoryOutboxCreationErrorTooltip">
-		Errore di configurazione della casella in uscita del rivenditore
+	<string name="MarketplaceURL_Imports">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/merchants/store/imports
 	</string>
-	<string name="InventoryOutboxCreationError">
-		Contatta l&apos;Assistenza clienti per correggere il problema.
+	<string name="MarketplaceURL_LearnMore">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/learn_more
 	</string>
 	<string name="InventoryOutboxNotMerchantTitle">
-		Chiunque può vendere oggetti nel Marketplace
-	</string>
-	<string name="InventoryOutboxNotMerchantTooltip">
-		Diventa un rivenditore!
+		Chiunque può vendere oggetti nel Marketplace.
 	</string>
+	<string name="InventoryOutboxNotMerchantTooltip"/>
 	<string name="InventoryOutboxNotMerchant">
-		[[MARKETPLACE_URL] Second Life Marketplace] offre in vendita più di un milione di prodotti virtuali, tutti creati da Residenti. Anche tu puoi vendere gli oggetti che crei, oltre ad alcuni degli oggetti che hai acquistato. È facile da usare e l&apos;impostazione è gratuita. [[LEARN_MORE_URL] Leggi ulteriori informazioni] oppure [[CREATE_STORE_URL] crea un negozio] sul Marketplace per cominciare.
+		Per diventare un venditore, devi [[MARKETPLACE_CREATE_STORE_URL] creare un negozio nel Marketplace].
 	</string>
 	<string name="InventoryOutboxNoItemsTitle">
-		Un nuovo modo di inviare oggetti al Marketplace
-	</string>
-	<string name="InventoryOutboxNoItemsTooltip">
-		Trascina gli oggetti qui per prepararli per la vendita nel Marketplace
+		La tua casella in uscita è vuota.
 	</string>
+	<string name="InventoryOutboxNoItemsTooltip"/>
 	<string name="InventoryOutboxNoItems">
-		Trascina elementi o cartelle che desideri vendere in quest&apos;area. Verrà visualizzata una copia dell&apos;elemento, senza che venga modificato l&apos;inventario, tranne nel caso in cui venga trascinato un oggetto per cui non è permessa la copia. Clicca sul pulsante Carica per caricare gli elementi su Marketplace. Dopo aver spostato gli elementi nell&apos;inventario di Marketplace, non saranno più visibili in questa cartella.
+		Trascina le cartelle in questa area e clicca su &quot;Invia a Marketplace&quot; per metterle in vendita su [[MARKETPLACE_DASHBOARD_URL] Marketplace].
 	</string>
 	<string name="Marketplace Error None">
 		Nessun errore
@@ -1250,7 +1270,7 @@ Prova ad accedere nuovamente tra un minuto.
 		Errore: questa cartella non include alcun contenuto.
 	</string>
 	<string name="Marketplace Error Unassociated Products">
-		Errore: Oggetto non caricato perché il tuo account venditore ha troppi oggetti che non sono associati con dei prodotti. Per risolvere questo errore, esegui l&apos;accesso al sito di Marketplace e riduci il numero di oggetti non associati.
+		Errore: Oggetto non caricato perché il tuo account venditore ha troppi oggetti che non sono associati con dei prodotti.  Per risolvere questo errore, esegui l&apos;accesso al sito di Marketplace e riduci il numero di oggetti non associati.
 	</string>
 	<string name="Marketplace Error Object Limit">
 		Errore: questo elemento contiene troppi oggetti. Per risolvere questo problema, inserisci più oggetti insieme in una scatola per ridurre a meno di 200 il numero totale di oggetti.
@@ -1394,6 +1414,9 @@ Prova ad accedere nuovamente tra un minuto.
 	<string name="no_attachments">
 		Nessun allegato indossato
 	</string>
+	<string name="Attachments remain">
+		Allegati ([COUNT] spazi restanti)
+	</string>
 	<string name="Buy">
 		Acquista
 	</string>
@@ -1520,6 +1543,12 @@ Prova ad accedere nuovamente tra un minuto.
 	<string name="Right Pec">
 		Petto destro
 	</string>
+	<string name="Neck">
+		Collo
+	</string>
+	<string name="Avatar Center">
+		Centro avatar
+	</string>
 	<string name="Invalid Attachment">
 		Punto di collegamento non valido
 	</string>
@@ -3817,6 +3846,9 @@ Se il messaggio persiste, contatta [SUPPORT_SITE].
 	<string name="Saved_message">
 		(Salvato [LONG_TIMESTAMP])
 	</string>
+	<string name="IM_unblock_only_groups_friends">
+		Per vedere questo messaggio, devi deselezionare &apos;Solo amici e gruppi possono chiamarmi o mandarmi IM&apos; in Preferenze/Privacy.
+	</string>
 	<string name="answered_call">
 		Risposto alla chiamata
 	</string>
@@ -3937,6 +3969,18 @@ Se il messaggio persiste, contatta [SUPPORT_SITE].
 	<string name="you_paid_ldollars_no_name">
 		Hai pagato L$ [AMOUNT] [REASON].
 	</string>
+	<string name="you_paid_failure_ldollars">
+		Non hai pagato [NAME] L$[AMOUNT] [REASON].
+	</string>
+	<string name="you_paid_failure_ldollars_no_info">
+		Non hai pagato L$ [AMOUNT].
+	</string>
+	<string name="you_paid_failure_ldollars_no_reason">
+		Non hai pagato [NAME] L$[AMOUNT].
+	</string>
+	<string name="you_paid_failure_ldollars_no_name">
+		Non hai pagato L$ [AMOUNT] [REASON].
+	</string>
 	<string name="for item">
 		per [ITEM]
 	</string>
@@ -3990,7 +4034,7 @@ Se il messaggio persiste, contatta [SUPPORT_SITE].
 	</string>
 	<string name="uploading_abuse_report">
 		Caricamento in corso...
-  
+
 Segnala abuso
 	</string>
 	<string name="New Shape">
@@ -4258,7 +4302,7 @@ Segnala abuso
 	<string name="server_is_down">
 		Nonostante i nostri tentativi, si è verificato un errore imprevisto.
 
-	Consulta la pagina status.secondlifegrid.net per determinare se si sia verificato un problema noto con il servizio.  
+	Consulta la pagina status.secondlifegrid.net per determinare se si sia verificato un problema noto con il servizio.
         Se il problema continua, ti consigliamo di controllare le tue impostazioni di rete e della firewall.
 	</string>
 	<string name="dateTimeWeekdaysNames">
@@ -4347,6 +4391,12 @@ Prova a racchiudere il percorso dell&apos;editor in doppie virgolette.
 	<string name="ExternalEditorFailedToRun">
 		L&apos;editor esterno non è stato avviato.
 	</string>
+	<string name="TranslationFailed">
+		Traduzione non riuscita: [REASON]
+	</string>
+	<string name="TranslationResponseParseError">
+		Errore di elaborazione della risposta della traduzione.
+	</string>
 	<string name="Esc">
 		Esc
 	</string>
@@ -4717,7 +4767,10 @@ Prova a racchiudere il percorso dell&apos;editor in doppie virgolette.
 		Mini mappa
 	</string>
 	<string name="Command_Move_Label">
-		Movimento
+		Cammina / corri / vola
+	</string>
+	<string name="Command_Outbox_Label">
+		Casella in uscita del rivenditore
 	</string>
 	<string name="Command_People_Label">
 		Persone
@@ -4744,10 +4797,10 @@ Prova a racchiudere il percorso dell&apos;editor in doppie virgolette.
 		Parla
 	</string>
 	<string name="Command_View_Label">
-		Visuale
+		Controlli fotocamera
 	</string>
 	<string name="Command_Voice_Label">
-		Voce vicina
+		Impostazioni voce
 	</string>
 	<string name="Command_AboutLand_Tooltip">
 		Informazioni sul terreno che visiti
@@ -4791,6 +4844,9 @@ Prova a racchiudere il percorso dell&apos;editor in doppie virgolette.
 	<string name="Command_Move_Tooltip">
 		Movimento avatar
 	</string>
+	<string name="Command_Outbox_Tooltip">
+		Trasferisci elementi al tuo mercato per la vendita
+	</string>
 	<string name="Command_People_Tooltip">
 		Amici, gruppi e persone vicine
 	</string>
@@ -4819,7 +4875,16 @@ Prova a racchiudere il percorso dell&apos;editor in doppie virgolette.
 		Modifica angolo fotocamera
 	</string>
 	<string name="Command_Voice_Tooltip">
-		Persona vicine con funzioni voce
+		I controlli per il volume per le chiamate e per le persone nelle vicinanze nel mondo virtuale
+	</string>
+	<string name="Toolbar_Bottom_Tooltip">
+		attualmente nella barra degli strumenti in basso
+	</string>
+	<string name="Toolbar_Left_Tooltip">
+		attualmente nella barra degli strumenti a sinistra
+	</string>
+	<string name="Toolbar_Right_Tooltip">
+		attualmente nella barra degli strumenti a destra
 	</string>
 	<string name="Retain%">
 		Mantieni%
@@ -4845,4 +4910,19 @@ Prova a racchiudere il percorso dell&apos;editor in doppie virgolette.
 	<string name="Normal">
 		Normale
 	</string>
+	<string name="snapshot_quality_very_low">
+		Molto basso
+	</string>
+	<string name="snapshot_quality_low">
+		Basso
+	</string>
+	<string name="snapshot_quality_medium">
+		Medio
+	</string>
+	<string name="snapshot_quality_high">
+		Alto
+	</string>
+	<string name="snapshot_quality_very_high">
+		Molto alto
+	</string>
 </strings>
diff --git a/indra/newview/skins/default/xui/it/teleport_strings.xml b/indra/newview/skins/default/xui/it/teleport_strings.xml
index a0b324d8fbeebd3c53eb889377d68590be02646a..f485212290921ca70e8f3b3c5bc172c05c2be700 100644
--- a/indra/newview/skins/default/xui/it/teleport_strings.xml
+++ b/indra/newview/skins/default/xui/it/teleport_strings.xml
@@ -19,8 +19,8 @@ Se si continua a visualizzare questo messaggio, consulta la pagina [SUPPORT_SITE
 			Spiacenti, il sistema non riesce a completare il teletrasporto. Riprova tra un attimo.
 		</message>
 		<message name="NoHelpIslandTP">
-		Non è possibile per te ritornare all&apos;Welcome Island.
-Vai alla &apos;Welcome Island Public&apos; per ripetere il tutorial.
+			Non puoi teleportarti nuovamente a Welcome Island.
+Per ripetere l&apos;esercitazione, visita &apos;Welcome Island Public&apos;.
 		</message>
 		<message name="noaccess_tport">
 			Spiacenti, ma non hai accesso nel luogo di destinazione richiesto.
diff --git a/indra/newview/skins/default/xui/ja/floater_about.xml b/indra/newview/skins/default/xui/ja/floater_about.xml
index c628ade43e75c02b7c91c146fac03ccb36fbc0af..3c7a210a22b331416ccb18fa2e4ee1ed7923ae60 100644
--- a/indra/newview/skins/default/xui/ja/floater_about.xml
+++ b/indra/newview/skins/default/xui/ja/floater_about.xml
@@ -90,6 +90,8 @@ google-perftools Copyright (c) 2005, Google Inc.
 
 Second Life ビューワでは Havok (TM) Physics が使用されています。(c)Copyright 1999-2010 Havok.com Inc. (and its Licensors).無断複写・複製・転載を禁じます。詳細については www.havok.com をご参照ください。
 
+このソフトウェアには、NVIDIA Corporation によるソースコードが含まれます。
+
 無断複写・複製・転載を禁じます。詳細については licenses.txt をご参照ください。
 
 ボイスチャットのオーディオコーディング:Polycom(R) Siren14(TM) (ITU-T Rec.G.722.1 Annex C)
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 3c88c902f88c8f8757ffdea00c8197733d0c88af..7c87bad5a347de64c590bae6654e257a297ff674 100644
--- a/indra/newview/skins/default/xui/ja/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/ja/floater_about_land.xml
@@ -130,7 +130,7 @@
 				交通量:
 			</text>
 			<text name="DwellText">
-				誤
+				ローディング...
 			</text>
 			<button label="土地の購入" label_selected="土地を購入..." left="130" name="Buy Land..." width="100"/>
 			<button label="リンデンセール" label_selected="Linden セール..." name="Linden Sale..." tool_tip="土地が所有されており、コンテンツが設定されている必要があります。オークションの対象になっていないことも必要条件です。"/>
@@ -311,13 +311,15 @@
 				プッシュ禁止 (地域設定優先)
 			</panel.string>
 			<panel.string name="see_avs_text">
-				この区画にいる住人と会ってチャットする
+				他の区画にいるアバターは、
 			</panel.string>
 			<text name="allow_label">
 				他の住人への許可:
 			</text>
-			<check_box label="地形を編集" name="edit land check" tool_tip="チェックを入れると、他人があなたの土地の地形編集を行うことが可能となります。このオプションのチェックを外しておくことをおすすめします。外した状態であなたの土地の地形編集が可能です。"/>
-			<check_box label="飛行" name="check fly" tool_tip="チェックを入れるとこの土地での飛行が可能となります。チェックを外すと土地に入る際と通り過ぎるときのみ飛行可能となります。"/>
+			<text name="allow_label0">
+				飛行:
+			</text>
+			<check_box label="全員" name="check fly" tool_tip="チェックを入れるとこの土地での飛行が可能となります。チェックを外すと土地に入る際と通り過ぎるときのみ飛行可能となります。"/>
 			<text name="allow_label2">
 				制作:
 			</text>
@@ -333,9 +335,6 @@
 			</text>
 			<check_box label="全員" name="check other scripts"/>
 			<check_box label="グループ" name="check group scripts"/>
-			<text name="land_options_label">
-				土地オプション:
-			</text>
 			<check_box label="安全(ダメージなし)" name="check safe" tool_tip="チェックを入れるとこの土地でのダメージコンバットが無効になり、「安全」に設定されます。 チェックを外すとダメージコンバットが有効になります。"/>
 			<check_box label="プッシュ禁止" name="PushRestrictCheck" tool_tip="スクリプトによるプッシュを禁止します。 このオプションを選択することにより、あなたの土地での破壊的行動を防ぐことができます。"/>
 			<check_box label="検索に区画を表示(週 L$ 30)" name="ShowDirectoryCheck" tool_tip="この区画を検索結果に表示します"/>
@@ -376,9 +375,9 @@
 			</text>
 			<texture_picker label="" name="snapshot_ctrl" tool_tip="写真をクリックして選択"/>
 			<text name="allow_label5">
-				他の区画にいる住人への許可:
+				他の区画にいるアバターがこの区画にいるアバターに会ってチャットできる
 			</text>
-			<check_box label="アバターを表示" name="SeeAvatarsCheck" tool_tip="他の区画の住人が、この区画にいる住人に会ってチャットすることを許可し、あなたもそれら住人に会ってチャットできるようにします。"/>
+			<check_box label="アバターを表示" name="SeeAvatarsCheck" tool_tip="他の区画のアバターが、この区画にいるアバターに会ってチャットすることを許可し、あなたもそれらアバターに会ってチャットできるようにします。"/>
 			<text name="landing_point">
 				着地点: [LANDING]
 			</text>
@@ -460,12 +459,12 @@
 			<text name="Limit access to this parcel to:">
 				この区画へのアクセス
 			</text>
-			<check_box label="パブリックアクセスを許可する [MATURITY]" name="public_access"/>
+			<check_box label="パブリックアクセスを許可(このオプションをオフにすると立入禁止ラインが作成されます)" name="public_access"/>
 			<text name="Only Allow">
-				次の住人のアクセスを許可:
+				次の住人にのみアクセスを許可:
 			</text>
-			<check_box label="支払情報登録済 [ESTATE_PAYMENT_LIMIT]" name="limit_payment" tool_tip="未確認の住人の立入を禁止します。"/>
-			<check_box label="年齢確認 [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="年齢確認を済ませていない住人の立入を禁止します。 詳しい情報は [SUPPORT_SITE] をご覧下さい。"/>
+			<check_box label="支払情情報が登録されている [ESTATE_PAYMENT_LIMIT]" name="limit_payment" tool_tip="支払情報が登録されていないと、この区画にアクセスすることはできません。詳細については、[SUPPORT_SITE] をご覧ください。"/>
+			<check_box label="年齢確認が済んでいる [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="この区画にアクセスするには、年齢確認を済ませる必要があります。詳細については、[SUPPORT_SITE] をご覧ください。"/>
 			<check_box label="グループのアクセスを許可:[GROUP]" name="GroupCheck" tool_tip="「一般」タブで、グループを選択してください。"/>
 			<check_box label="入場許可を販売:" name="PassCheck" tool_tip="この区画への一時的なアクセスを許可します。"/>
 			<combo_box name="pass_combo">
diff --git a/indra/newview/skins/default/xui/ja/floater_animation_anim_preview.xml b/indra/newview/skins/default/xui/ja/floater_animation_anim_preview.xml
new file mode 100644
index 0000000000000000000000000000000000000000..2bada303ae0b690dc7d23e7cdc0a3c6380193ec0
--- /dev/null
+++ b/indra/newview/skins/default/xui/ja/floater_animation_anim_preview.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Anim Preview" title="ANIMATION.ANIM">
+	<text name="name_label">
+		名前:
+	</text>
+	<text name="description_label">
+		説明:
+	</text>
+	<button label="アップロード(L$[AMOUNT])" name="ok_btn"/>
+	<button label="取り消し" label_selected="取り消し" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/ja/floater_animation_bvh_preview.xml b/indra/newview/skins/default/xui/ja/floater_animation_bvh_preview.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f74bab3598941114a511e624ff75419eb0908cd5
--- /dev/null
+++ b/indra/newview/skins/default/xui/ja/floater_animation_bvh_preview.xml
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Animation Preview">
+	<floater.string name="failed_to_initialize">
+		動きを初期化できませんでした
+	</floater.string>
+	<floater.string name="anim_too_long">
+		アニメーションファイルの長さは [LENGTH] 秒です。
+
+アニメーションの最大長は [MAX_LENGTH] 秒です。
+	</floater.string>
+	<floater.string name="failed_file_read">
+		アニメーションファイルを読み取れません。
+
+[STATUS]
+	</floater.string>
+	<floater.string name="E_ST_OK">
+		Ok
+	</floater.string>
+	<floater.string name="E_ST_EOF">
+		ファイルの終端が不完全です。
+	</floater.string>
+	<floater.string name="E_ST_NO_CONSTRAINT">
+		制約定義を読み取れません。
+	</floater.string>
+	<floater.string name="E_ST_NO_FILE">
+		BVH ファイルを開けません。
+	</floater.string>
+	<floater.string name="E_ST_NO_HIER">
+		HIERARCHY ヘッダーが無効です。
+	</floater.string>
+	<floater.string name="E_ST_NO_JOINT">
+		ROOT または JOINT が見つかりません。
+	</floater.string>
+	<floater.string name="E_ST_NO_NAME">
+		JOINT 名を取得できません。
+	</floater.string>
+	<floater.string name="E_ST_NO_OFFSET">
+		OFFSET が見つかりません。
+	</floater.string>
+	<floater.string name="E_ST_NO_CHANNELS">
+		CHANNELS が見つかりません。
+	</floater.string>
+	<floater.string name="E_ST_NO_ROTATION">
+		回転順序を取得できません。
+	</floater.string>
+	<floater.string name="E_ST_NO_AXIS">
+		回転軸を取得できません。
+	</floater.string>
+	<floater.string name="E_ST_NO_MOTION">
+		MOTION が見つかりません。
+	</floater.string>
+	<floater.string name="E_ST_NO_FRAMES">
+		フレーム数を取得できません。
+	</floater.string>
+	<floater.string name="E_ST_NO_FRAME_TIME">
+		フレーム時間を取得できません。
+	</floater.string>
+	<floater.string name="E_ST_NO_POS">
+		位置の値を取得できません。
+	</floater.string>
+	<floater.string name="E_ST_NO_ROT">
+		回転値を取得できません。
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_FILE">
+		変換ファイルを開けません。
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_HEADER">
+		変換ヘッダーを読み取れません。
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_NAME">
+		変換名を読み取れません。
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_IGNORE">
+		変換無視値を読み取れません。
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_RELATIVE">
+		変換相対値を読み取れません。
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_OUTNAME">
+		変換 outname 値を読み取れません。
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MATRIX">
+		変換行列を読み取れません。
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MERGECHILD">
+		Mergechild 名を取得できません。
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MERGEPARENT">
+		Mergeparent 名を取得できません。
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_PRIORITY">
+		priority 値を取得できません。
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_LOOP">
+		loop 値を取得できません。
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EASEIN">
+		easeln 値を取得できません。
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EASEOUT">
+		easeOut 値を取得できません。
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_HAND">
+		Hand morph 値を取得できません。
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EMOTE">
+		emote 名を読みとれません。
+	</floater.string>
+	<floater.string name="E_ST_BAD_ROOT">
+		ルートジョイント名が不正です。「hip」を使用してください。
+	</floater.string>
+	<text name="name_label">
+		名前:
+	</text>
+	<text name="description_label">
+		説明:
+	</text>
+	<spinner label="優先度" name="priority" tool_tip="このアニメーションでどのアニメーションを上書きできるかを決めます"/>
+	<check_box label="ループ" name="loop_check" tool_tip="このアニメーションをループ再生にします"/>
+	<spinner label="イン(%)" name="loop_in_point" tool_tip="アニメーションのループ復帰点を設定します"/>
+	<spinner label="アウト(%)" name="loop_out_point" tool_tip="アニメーションのループ終了点を設定します"/>
+	<text name="hand_label">
+		手のポーズ
+	</text>
+	<combo_box name="hand_pose_combo" tool_tip="アニメーション再生中の手の動きを決めます">
+		<combo_box.item label="広げる" name="Spread"/>
+		<combo_box.item label="リラックス" name="Relaxed"/>
+		<combo_box.item label="指を指す・両手" name="PointBoth"/>
+		<combo_box.item label="拳" name="Fist"/>
+		<combo_box.item label="リラックス・左" name="RelaxedLeft"/>
+		<combo_box.item label="指を指す・左" name="PointLeft"/>
+		<combo_box.item label="拳を上げる・左" name="FistLeft"/>
+		<combo_box.item label="リラックス・右" name="RelaxedRight"/>
+		<combo_box.item label="指を指す・右" name="PointRight"/>
+		<combo_box.item label="拳を上げる・右" name="FistRight"/>
+		<combo_box.item label="敬礼・右" name="SaluteRight"/>
+		<combo_box.item label="タイピング" name="Typing"/>
+		<combo_box.item label="ピース・右" name="PeaceRight"/>
+	</combo_box>
+	<text name="emote_label">
+		表情
+	</text>
+	<combo_box name="emote_combo" tool_tip="アニメーション再生中の顔の表情を決めます">
+		<item label="(なし)" name="[None]" value=""/>
+		<item label="アーーーーー" name="Aaaaah" value="アーーーーー"/>
+		<item label="恐れる" name="Afraid" value="恐れる"/>
+		<item label="怒る" name="Angry" value="怒る"/>
+		<item label="満面の笑み" name="BigSmile" value="満面の笑み"/>
+		<item label="退屈" name="Bored" value="退屈"/>
+		<item label="泣く" name="Cry" value="泣く"/>
+		<item label="軽蔑" name="Disdain" value="軽蔑"/>
+		<item label="恥ずかしがる" name="Embarrassed" value="恥ずかしがる"/>
+		<item label="しかめっ面" name="Frown" value="しかめっ面"/>
+		<item label="キス" name="Kiss" value="キス"/>
+		<item label="笑う" name="Laugh" value="笑う"/>
+		<item label="むかつく" name="Plllppt" value="むかつく"/>
+		<item label="嫌悪感" name="Repulsed" value="嫌悪感"/>
+		<item label="悲しい" name="Sad" value="悲しい"/>
+		<item label="肩をすくめる" name="Shrug" value="肩をすくめる"/>
+		<item label="微笑む" name="Smile" value="微笑む"/>
+		<item label="驚く" name="Surprise" value="驚く"/>
+		<item label="ウィンク" name="Wink" value="ウィンク"/>
+		<item label="心配する" name="Worry" value="心配する"/>
+	</combo_box>
+	<text name="preview_label">
+		プレビュー中の動作
+	</text>
+	<combo_box name="preview_base_anim" tool_tip="これを使用して、アバターが一般的なアクションを実行している間にアニメーションの動作をテストします。">
+		<item label="立つ" name="Standing" value="立つ"/>
+		<item label="歩く" name="Walking" value="歩く"/>
+		<item label="座る" name="Sitting" value="座る"/>
+		<item label="飛ぶ" name="Flying" value="飛ぶ"/>
+	</combo_box>
+	<spinner label="イーズイン(秒)" name="ease_in_time" tool_tip="アニメーションのブレンドイン時間(秒)"/>
+	<spinner label="イーズアウト(秒)" name="ease_out_time" tool_tip="アニメーションのブレンドアウト時間(秒)"/>
+	<button name="play_btn" tool_tip="アニメーションを再生する"/>
+	<button name="pause_btn" tool_tip="アニメーションを一時停止する"/>
+	<button name="stop_btn" tool_tip="アニメーションの再生を停止する"/>
+	<text name="bad_animation_text">
+		アニメーションファイルを読み取れません。
+
+Poser 4 からエクスポートした BVH ファイルをお勧めします。
+	</text>
+	<button label="アップロード(L$[AMOUNT])" name="ok_btn"/>
+	<button label="取り消し" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/ja/floater_avatar.xml b/indra/newview/skins/default/xui/ja/floater_avatar.xml
index c4455282d2baddb28cef0a27a7c117ff695b522c..d28958050652b9fcf6ac1d13bcb84659fa914a2a 100644
--- a/indra/newview/skins/default/xui/ja/floater_avatar.xml
+++ b/indra/newview/skins/default/xui/ja/floater_avatar.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Avatar" title="アバターピッカー"/>
+<floater name="Avatar" title="アバターを選択"/>
diff --git a/indra/newview/skins/default/xui/ja/floater_buy_currency.xml b/indra/newview/skins/default/xui/ja/floater_buy_currency.xml
index 22af6e0ea2695329b926f3d601c8a73c1740b912..a472f163e3f97e55c2e42e109c82bff017c4ef2f 100644
--- a/indra/newview/skins/default/xui/ja/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/ja/floater_buy_currency.xml
@@ -46,7 +46,7 @@
 		L$ [AMT]
 	</text>
 	<text name="currency_links">
-		[http://www.secondlife.com/my/account/payment_method_management.php?lang=ja-JP 支払方法] | [http://www.secondlife.com/my/account/currency.php?lang=ja-JP 通貨] | [http://www.secondlife.com/my/account/exchange_rates.php?lang=ja-JP 換算レート]
+		[http://www.secondlife.com/my/account/payment_method_management.php 支払方法] | [http://www.secondlife.com/my/account/currency.php 通貨]
 	</text>
 	<text name="exchange_rate_note">
 		金額を再入力して最新換算レートを確認します。
diff --git a/indra/newview/skins/default/xui/ja/floater_camera.xml b/indra/newview/skins/default/xui/ja/floater_camera.xml
index 5d3a048975617f76cd2c4db3dcd165e078c3965f..982e5ce42bf941dca4880b4b366f704ee032ce55 100644
--- a/indra/newview/skins/default/xui/ja/floater_camera.xml
+++ b/indra/newview/skins/default/xui/ja/floater_camera.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="camera_floater" title="表示">
+<floater name="camera_floater" title="カメラのコントロール">
 	<floater.string name="rotate_tooltip">
 		フォーカスを中心にカメラを回転
 	</floater.string>
@@ -9,15 +9,6 @@
 	<floater.string name="move_tooltip">
 		カメラを上下左右に移動
 	</floater.string>
-	<floater.string name="camera_modes_title">
-		カメラモード
-	</floater.string>
-	<floater.string name="pan_mode_title">
-		旋回 - ズーム - 水平・垂直移動
-	</floater.string>
-	<floater.string name="presets_mode_title">
-		事前設定の視野
-	</floater.string>
 	<floater.string name="free_mode_title">
 		オブジェクトを見る
 	</floater.string>
diff --git a/indra/newview/skins/default/xui/ja/floater_chat_bar.xml b/indra/newview/skins/default/xui/ja/floater_chat_bar.xml
index 9735afb101edd670be8fe9047e747378a4996589..11f223ade63011c4ff19b9a7ca1a894fbb560a89 100644
--- a/indra/newview/skins/default/xui/ja/floater_chat_bar.xml
+++ b/indra/newview/skins/default/xui/ja/floater_chat_bar.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="chat_bar" title="近くのチャット">
-	<panel>
+	<panel name="bottom_panel">
 		<line_editor label="ここをクリックしてチャットを開始します。" name="chat_box" tool_tip="Enter キーを押して話し、Ctrl + Enter キーで叫びます。"/>
-		<button name="show_nearby_chat" tool_tip="近くのチャットログを表示・非表示"/>
+		<button name="show_nearby_chat" tool_tip="近くのチャットログを表示/非表示"/>
 	</panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/ja/floater_hardware_settings.xml b/indra/newview/skins/default/xui/ja/floater_hardware_settings.xml
index ffafbaf3b67f1685a6b82cc758d7e75a5f84feec..1b6558a9eb329c591c60bebbcf159856631d2ae4 100644
--- a/indra/newview/skins/default/xui/ja/floater_hardware_settings.xml
+++ b/indra/newview/skins/default/xui/ja/floater_hardware_settings.xml
@@ -4,8 +4,8 @@
 		フィルタリング:
 	</text>
 	<check_box label="異方的フィルタリング(有効にすると速度が低下します)" name="ani"/>
-	<text name="Antialiasing:">
-		アンチエイリアシング:
+	<text name="antialiasing label">
+		アンチエイリアシング:
 	</text>
 	<combo_box label="アンチエイリアシング" name="fsaa">
 		<combo_box.item label="無効" name="FSAADisabled"/>
diff --git a/indra/newview/skins/default/xui/ja/floater_inventory_item_properties.xml b/indra/newview/skins/default/xui/ja/floater_inventory_item_properties.xml
index 725214086a57ca1878349298e6fe762b991b6bef..c01c46211ec323c51780c404f5c9e2f1c96e60ed 100644
--- a/indra/newview/skins/default/xui/ja/floater_inventory_item_properties.xml
+++ b/indra/newview/skins/default/xui/ja/floater_inventory_item_properties.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="item properties" title="持ち物アイテムのプロパティ">
+<floater name="item properties" title="インベントリアイテムのプロパティ">
 	<floater.string name="unknown">
 		(不明)
 	</floater.string>
@@ -24,11 +24,11 @@
 	<text name="LabelCreatorTitle">
 		クリエーター
 	</text>
-	<button label="情報" label_selected="" name="BtnCreator"/>
+	<button label="プロフィール..." label_selected="" name="BtnCreator"/>
 	<text name="LabelOwnerTitle">
 		オーナー:
 	</text>
-	<button label="情報" label_selected="" name="BtnOwner"/>
+	<button label="プロフィール..." label_selected="" name="BtnOwner"/>
 	<text name="LabelAcquiredTitle">
 		入手日時:
 	</text>
diff --git a/indra/newview/skins/default/xui/ja/floater_inventory_view_finder.xml b/indra/newview/skins/default/xui/ja/floater_inventory_view_finder.xml
index 47d57da0310451c1888e0e7a9762d2263f09d522..af96edda79bbf8cc5082f29c00ed9d247cca6c7c 100644
--- a/indra/newview/skins/default/xui/ja/floater_inventory_view_finder.xml
+++ b/indra/newview/skins/default/xui/ja/floater_inventory_view_finder.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Inventory Finder" title="最近取得した持ち物アイテム">
+<floater name="Inventory Finder" title="インベントリ最近取得したアイテム">
 	<check_box label="アニメーション" name="check_animation"/>
 	<check_box label="コーリング・カード" name="check_calling_card"/>
 	<check_box label="服" name="check_clothing"/>
diff --git a/indra/newview/skins/default/xui/ja/floater_merchant_outbox.xml b/indra/newview/skins/default/xui/ja/floater_merchant_outbox.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c59a3dc0ab7e4544e02368ceccfe85fb3df734ed
--- /dev/null
+++ b/indra/newview/skins/default/xui/ja/floater_merchant_outbox.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_merchant_outbox" title="マーチャントアウトボックス">
+	<string name="OutboxFolderCount1">
+		1 個のフォルダ
+	</string>
+	<string name="OutboxFolderCountN">
+		[NUM] 個のフォルダ
+	</string>
+	<string name="OutboxImporting">
+		フォルダを送信中...
+	</string>
+	<string name="OutboxInitializing">
+		初期化中...
+	</string>
+	<panel label="">
+		<panel>
+			<panel name="outbox_inventory_placeholder_panel">
+				<text name="outbox_inventory_placeholder_title">
+					ロード中...
+				</text>
+			</panel>
+		</panel>
+		<panel>
+			<button label="マーケットプレイスに送信" name="outbox_import_btn" tool_tip="自分のマーケットプレイス店頭に移動"/>
+		</panel>
+	</panel>
+</floater>
diff --git a/indra/newview/skins/default/xui/ja/floater_model_preview.xml b/indra/newview/skins/default/xui/ja/floater_model_preview.xml
index 157c68a5705bd9e282ea57c7a2ea75773f08b3d4..c9ff0e29cbc9b76ecd92a97e10c9d19a4e1cf57a 100644
--- a/indra/newview/skins/default/xui/ja/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/ja/floater_model_preview.xml
@@ -4,6 +4,9 @@
 	<string name="status_parse_error">
 		エラー:Dae に問題が見つかりました - 詳細についてはログをご参照ください。
 	</string>
+	<string name="status_material_mismatch">
+		エラー:モデルの材料は参考モデルのサブセットではありません。
+	</string>
 	<string name="status_reading_file">
 		ローディング...
 	</string>
diff --git a/indra/newview/skins/default/xui/ja/floater_model_wizard.xml b/indra/newview/skins/default/xui/ja/floater_model_wizard.xml
index 915b37557f89a3bb2190d41b2bdbc278d8f68b9c..746bd8553c8f3b6b8a0b0806a26274d7d963edcc 100644
--- a/indra/newview/skins/default/xui/ja/floater_model_wizard.xml
+++ b/indra/newview/skins/default/xui/ja/floater_model_wizard.xml
@@ -6,20 +6,23 @@
 	<button label="2. 最適化" name="optimize_btn"/>
 	<button label="1. ファイルを選択" name="choose_file_btn"/>
 	<panel name="choose_file_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="choose_file_header_panel">
+			<text name="choose_file_header_text">
 				モデルファイルを選択
 			</text>
 		</panel>
-		<panel name="content">
+		<panel name="choose_file_content">
 			<text name="advanced_users_text">
-				上級ユーザーの場合:3D コンテンツの制作ツールを使い慣れた方は、高度なアップローダーもお試しください。
+				上級ユーザーの場合:3D コンテンツ制作ツールの使用に慣れている方は、高度なアップローダーもお試しください。
 			</text>
 			<button label="アドバンスモードに切り替える" name="switch_to_advanced"/>
 			<text name="Cache location">
-				アップロードするモデルファイルの選択
+				アップロードするモデルファイルを選択
+			</text>
+			<button label="参照..." label_selected="参照..." name="browse"/>
+			<text name="Model types">
+				Second Life は COLLADA (.dae) ファイルをサポートします。
 			</text>
-			<button label="参照" label_selected="参照" name="browse"/>
 			<text name="dimensions">
 				X         Y         Z
 			</text>
@@ -32,15 +35,15 @@
 		</panel>
 	</panel>
 	<panel name="optimize_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="optimize_header_panel">
+			<text name="optimize_header_text">
 				モデルを最適化
 			</text>
 		</panel>
-		<text name="description">
-			パフォーマンスを重視してモデルを最適化しました。必要に応じて調整してください。
+		<text name="optimize_description">
+			モデルはパフォーマンスを重視して最適化されています。必要に応じて調整してください。
 		</text>
-		<panel name="content">
+		<panel name="optimize_content">
 			<text name="high_detail_text">
 				次の描画詳細度を作成:高
 			</text>
@@ -76,16 +79,16 @@
 		</panel>
 	</panel>
 	<panel name="physics_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="physics_header_panel">
+			<text name="physics_header_text">
 				物理作用の調整
 			</text>
 		</panel>
-		<text name="description">
+		<text name="physics_description">
 			モデルの外殻構造のシェイプは弊社が作成します。モデルの目的に応じてシェイプの詳細度を調整してください。
 		</text>
-		<panel name="content">
-			<button label="物理演算ウェイトを再計算" name="recalculate_physics_btn"/>
+		<panel name="physics_content">
+			<button label="物理作用を再計算" name="recalculate_physics_btn"/>
 			<button label="再計算中..." name="recalculating_physics_btn"/>
 			<text name="lod_label">
 				物理作用のプレビュー
@@ -107,12 +110,12 @@
 		</panel>
 	</panel>
 	<panel name="review_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="review_header_panel">
+			<text name="review_header_text">
 				確認
 			</text>
 		</panel>
-		<panel name="content">
+		<panel name="review_content">
 			<text name="review_prim_equiv">
 				区画/リージョンへの負荷:[EQUIV] プリム換算値
 			</text>
@@ -120,13 +123,13 @@
 				L$ [FEE] のアップロード料金があなたのアカウントに請求されます。
 			</text>
 			<text name="review_confirmation">
-				アップロードボタンをクリックすると、モデルに含まれるマテリアルの所有権や使用許可を所持することを認めたことになります。
+				アップロードボタンをクリックすることにより、モデルに含まれるマテリアルの所有権や使用許可の所持を認めたことになります。
 			</text>
 		</panel>
 	</panel>
 	<panel name="upload_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="upload_header_panel">
+			<text name="upload_header_text">
 				アップロード完了
 			</text>
 		</panel>
@@ -134,7 +137,7 @@
 			モデルがアップロードされました。
 		</text>
 		<text name="inventory_text">
-			それは持ち物の「オブジェクト」フォルダにあります。
+			それはインベントリの「オブジェクト」フォルダにあります。
 		</text>
 		<text name="charged_fee">
 			あなたのアカウントに L$ [FEE] が請求されました。
diff --git a/indra/newview/skins/default/xui/ja/floater_moveview.xml b/indra/newview/skins/default/xui/ja/floater_moveview.xml
index 88c1905b8a763adcb9b50c8884a0c32e41884cad..aed3b78a1448542d869770fd28c7c659aa8fa0ce 100644
--- a/indra/newview/skins/default/xui/ja/floater_moveview.xml
+++ b/indra/newview/skins/default/xui/ja/floater_moveview.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="move_floater" title="移動">
+<floater name="move_floater" title="歩行 / 走行 / 飛行">
 	<string name="walk_forward_tooltip">
 		前に進む(上矢印か W を押す)
 	</string>
diff --git a/indra/newview/skins/default/xui/ja/floater_my_inventory.xml b/indra/newview/skins/default/xui/ja/floater_my_inventory.xml
index c6a789b63b19e73f4b2d82e93271666c5a4cac98..d708fc3decb93b1f3cefec84dd2b61893743c1f5 100644
--- a/indra/newview/skins/default/xui/ja/floater_my_inventory.xml
+++ b/indra/newview/skins/default/xui/ja/floater_my_inventory.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="floater_my_inventory" title="持ち物"/>
+<floater name="floater_my_inventory" title="インベントリ"/>
diff --git a/indra/newview/skins/default/xui/ja/floater_object_weights.xml b/indra/newview/skins/default/xui/ja/floater_object_weights.xml
index 3bd9b6b069e232660631e482e7a3f50a34a0e2b7..d727a268fb676151ff18241a546b2e8bd5ca5985 100644
--- a/indra/newview/skins/default/xui/ja/floater_object_weights.xml
+++ b/indra/newview/skins/default/xui/ja/floater_object_weights.xml
@@ -6,7 +6,7 @@
 	<text name="objects_label" value="オブジェクト"/>
 	<text name="prims" value="--"/>
 	<text name="prims_label" value="プリム"/>
-	<text name="weights_of_selected_text" value="選択済み項目のウエイト"/>
+	<text name="weights_of_selected_text" value="選択済みアイテムのウエイト"/>
 	<text name="download" value="--"/>
 	<text name="download_label" value="ダウンロード"/>
 	<text name="physics" value="--"/>
diff --git a/indra/newview/skins/default/xui/ja/floater_openobject.xml b/indra/newview/skins/default/xui/ja/floater_openobject.xml
index bd1b650f9855fd24c8c661a412f18064e46c6b42..af02ffedda1091d2874fba0bfa47a6913a418458 100644
--- a/indra/newview/skins/default/xui/ja/floater_openobject.xml
+++ b/indra/newview/skins/default/xui/ja/floater_openobject.xml
@@ -3,6 +3,6 @@
 	<text name="object_name">
 		[DESC]:
 	</text>
-	<button label="持ち物にコピー" label_selected="持ち物にコピー" name="copy_to_inventory_button"/>
+	<button label="インベントリにコピー" label_selected="インベントリにコピー" name="copy_to_inventory_button"/>
 	<button label="コピーして装着" label_selected="コピーして装着" name="copy_and_wear_button"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/ja/floater_people.xml b/indra/newview/skins/default/xui/ja/floater_people.xml
index 08bee881034d19b182f8b99a1e51bee518ffae53..b180658ab721e4bac0b9989c828f2dd630d47809 100644
--- a/indra/newview/skins/default/xui/ja/floater_people.xml
+++ b/indra/newview/skins/default/xui/ja/floater_people.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="floater_people" title="人">
 	<panel_container name="main_panel">
-		<panel label="グループ情報" name="panel_group_info_sidetray"/>
+		<panel label="グループプロフィール" name="panel_group_info_sidetray"/>
 		<panel label="ブロックされた住人とオブジェクト" name="panel_block_list_sidetray"/>
 	</panel_container>
 </floater>
diff --git a/indra/newview/skins/default/xui/ja/floater_preview_animation.xml b/indra/newview/skins/default/xui/ja/floater_preview_animation.xml
index 4fc59e16d336026dd219cf379b687595f581f0af..a3042f66ea3d51329837ba8faf3075ec1c7ad2ee 100644
--- a/indra/newview/skins/default/xui/ja/floater_preview_animation.xml
+++ b/indra/newview/skins/default/xui/ja/floater_preview_animation.xml
@@ -6,6 +6,6 @@
 	<text name="desc txt">
 		説明:
 	</text>
-	<button label="インワールドで再生" label_selected="停止" name="Anim play btn" tool_tip="他人にも見えるように再生します"/>
-	<button label="ローカル再生" label_selected="停止" name="Anim audition btn" tool_tip="自分だけが見えるように再生します"/>
+	<button label="インワールドで再生" label_selected="停止" name="Inworld" tool_tip="他人に見えるように再生"/>
+	<button label="ローカル再生" label_selected="停止" name="Locally" tool_tip="自分だけが見えるように再生"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/ja/floater_preview_texture.xml b/indra/newview/skins/default/xui/ja/floater_preview_texture.xml
index 6ea1d79cfcfcc6b3d10e038b3c065b2cdbca8974..4617fd1d92c76bbc95f90985cfcfb0d3fc7aab0c 100644
--- a/indra/newview/skins/default/xui/ja/floater_preview_texture.xml
+++ b/indra/newview/skins/default/xui/ja/floater_preview_texture.xml
@@ -4,7 +4,7 @@
 		テクスチャ: [NAME]
 	</floater.string>
 	<floater.string name="Copy">
-		持ち物にコピー
+		インベントリにコピー
 	</floater.string>
 	<text name="desc txt">
 		説明:
diff --git a/indra/newview/skins/default/xui/ja/floater_snapshot.xml b/indra/newview/skins/default/xui/ja/floater_snapshot.xml
index 05a10f9f6d9ad60cbbf48a4705ca70c66183095c..f145a2e8b887ea45df8009b814c4d3576b391b7b 100644
--- a/indra/newview/skins/default/xui/ja/floater_snapshot.xml
+++ b/indra/newview/skins/default/xui/ja/floater_snapshot.xml
@@ -3,73 +3,63 @@
 	<floater.string name="unknown">
 		不明
 	</floater.string>
-	<radio_group label="スナップショットの種類" name="snapshot_type_radio">
-		<radio_item label="メール" name="postcard"/>
-		<radio_item label="持ち物(L$[AMOUNT])" name="texture"/>
-		<radio_item label="コンピューターに保存" name="local"/>
-	</radio_group>
+	<string name="postcard_progress_str">
+		メールの送信
+	</string>
+	<string name="profile_progress_str">
+		投稿
+	</string>
+	<string name="inventory_progress_str">
+		インベントリに保存
+	</string>
+	<string name="local_progress_str">
+		コンピュータに保存
+	</string>
+	<string name="profile_succeeded_str">
+		画像がアップロードされました
+	</string>
+	<string name="postcard_succeeded_str">
+		メールが送信されました
+	</string>
+	<string name="inventory_succeeded_str">
+		インベントリに保存されました
+	</string>
+	<string name="local_succeeded_str">
+		コンピュータに保存されました
+	</string>
+	<string name="profile_failed_str">
+		プロフィールフィードに画像をアップロードできませんでした。
+	</string>
+	<string name="postcard_failed_str">
+		メールを送信できませんでした。
+	</string>
+	<string name="inventory_failed_str">
+		インベントリに保存できませんでした。
+	</string>
+	<string name="local_failed_str">
+		コンピュータに保存できませんでした。
+	</string>
+	<button name="advanced_options_btn" tool_tip="詳しい設定"/>
+	<text name="image_res_text">
+		[WIDTH] x [HEIGHT] px
+	</text>
 	<text name="file_size_label">
 		[SIZE] キロバイト
 	</text>
-	<button label="スナップショットを更新" name="new_snapshot_btn"/>
-	<button label="送信" name="send_btn"/>
-	<button label="保存(L$[AMOUNT])" name="upload_btn"/>
-	<flyout_button label="保存" name="save_btn" tool_tip="画像をファイルに保存">
-		<flyout_button.item label="保存" name="save_item"/>
-		<flyout_button.item label="別名で保存..." name="saveas_item"/>
-	</flyout_button>
-	<button label="詳細" name="more_btn" tool_tip="詳しい設定"/>
-	<button label="簡易" name="less_btn" tool_tip="詳しい設定"/>
-	<button label="取り消し" name="discard_btn"/>
-	<text name="type_label2">
-		サイズ
-	</text>
-	<text name="format_label">
-		書式
-	</text>
-	<combo_box label="解像度" name="postcard_size_combo">
-		<combo_box.item label="現在のウィンドウ" name="CurrentWindow"/>
-		<combo_box.item label="640x480" name="640x480"/>
-		<combo_box.item label="800x600" name="800x600"/>
-		<combo_box.item label="1024x768" name="1024x768"/>
-		<combo_box.item label="カスタム" name="Custom"/>
-	</combo_box>
-	<combo_box label="解像度" name="texture_size_combo">
-		<combo_box.item label="現在のウィンドウ" name="CurrentWindow"/>
-		<combo_box.item label="小(128x128)" name="Small(128x128)"/>
-		<combo_box.item label="中(256x256)" name="Medium(256x256)"/>
-		<combo_box.item label="大(512x512)" name="Large(512x512)"/>
-		<combo_box.item label="カスタム" name="Custom"/>
-	</combo_box>
-	<combo_box label="解像度" name="local_size_combo">
-		<combo_box.item label="現在のウィンドウ" name="CurrentWindow"/>
-		<combo_box.item label="320x240" name="320x240"/>
-		<combo_box.item label="640x480" name="640x480"/>
-		<combo_box.item label="800x600" name="800x600"/>
-		<combo_box.item label="1024x768" name="1024x768"/>
-		<combo_box.item label="1280x1024" name="1280x1024"/>
-		<combo_box.item label="1600x1200" name="1600x1200"/>
-		<combo_box.item label="カスタム" name="Custom"/>
-	</combo_box>
-	<combo_box label="書式" name="local_format_combo">
-		<combo_box.item label="PNG" name="PNG"/>
-		<combo_box.item label="JPEG" name="JPEG"/>
-		<combo_box.item label="BMP" name="BMP"/>
-	</combo_box>
-	<spinner label="å¹…" name="snapshot_width"/>
-	<spinner label="高さ" name="snapshot_height"/>
-	<check_box label="縦横比の固定" name="keep_aspect_check"/>
-	<slider label="画質" name="image_quality_slider"/>
-	<text name="layer_type_label">
-		キャプチャ:
-	</text>
-	<combo_box label="画像レイヤー" name="layer_types">
-		<combo_box.item label="色" name="Colors"/>
-		<combo_box.item label="深度" name="Depth"/>
-	</combo_box>
-	<check_box label="インターフェース" name="ui_check"/>
-	<check_box label="HUD" name="hud_check"/>
-	<check_box label="保存後もこのまま" name="keep_open_check"/>
-	<check_box label="画面全体を静止" name="freeze_frame_check"/>
-	<check_box label="自動更新" name="auto_snapshot_check"/>
+	<panel name="advanced_options_panel">
+		<text name="advanced_options_label">
+			詳しい設定
+		</text>
+		<text name="layer_type_label">
+			キャプチャ:
+		</text>
+		<combo_box label="画像レイヤー" name="layer_types">
+			<combo_box.item label="色" name="Colors"/>
+			<combo_box.item label="深度" name="Depth"/>
+		</combo_box>
+		<check_box label="インターフェース" name="ui_check"/>
+		<check_box label="HUD" name="hud_check"/>
+		<check_box label="画面全体を静止" name="freeze_frame_check"/>
+		<check_box label="自動更新" name="auto_snapshot_check"/>
+	</panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/ja/floater_test_layout_stacks.xml b/indra/newview/skins/default/xui/ja/floater_test_layout_stacks.xml
new file mode 100644
index 0000000000000000000000000000000000000000..31b5bbd3bff774197078aa4bf3a96ad5efaff94a
--- /dev/null
+++ b/indra/newview/skins/default/xui/ja/floater_test_layout_stacks.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Test Floater" title="レイアウトスタックテスト"/>
diff --git a/indra/newview/skins/default/xui/ja/floater_test_text_vertical_aligment.xml b/indra/newview/skins/default/xui/ja/floater_test_text_vertical_aligment.xml
new file mode 100644
index 0000000000000000000000000000000000000000..40fd8e9f93f0c5e74637b8674e7809803bb8345c
--- /dev/null
+++ b/indra/newview/skins/default/xui/ja/floater_test_text_vertical_aligment.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Test Floater" title="テスト用ウィンドウ"/>
diff --git a/indra/newview/skins/default/xui/ja/floater_tools.xml b/indra/newview/skins/default/xui/ja/floater_tools.xml
index 8eddf55a44b680da114fa52cf81a07d6d64a178b..2d12a5e56a4592781546b1c31b9cafa718e288eb 100644
--- a/indra/newview/skins/default/xui/ja/floater_tools.xml
+++ b/indra/newview/skins/default/xui/ja/floater_tools.xml
@@ -1,5 +1,20 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="toolbox floater" short_title="制作ツール" title="">
+	<floater.string name="grid_screen_text">
+		画面
+	</floater.string>
+	<floater.string name="grid_local_text">
+		ローカル
+	</floater.string>
+	<floater.string name="grid_world_text">
+		世界
+	</floater.string>
+	<floater.string name="grid_reference_text">
+		リファレンス
+	</floater.string>
+	<floater.string name="grid_attachment_text">
+		アタッチメント
+	</floater.string>
 	<floater.string name="status_rotate">
 		色の付いたバンドをドラッグしてオブジェクトを回転
 	</floater.string>
@@ -63,7 +78,12 @@
 	</text>
 	<check_box initial_value="true" label="テクスチャを引き延ばす" name="checkbox stretch textures"/>
 	<check_box initial_value="true" label="スナップ" name="checkbox snap to grid"/>
-	<button label="オプション..." label_selected="オプション" name="Options..." tool_tip="グリッドオプションを表示します"/>
+	<combo_box name="combobox grid mode" tool_tip="オブジェクトの配置に使うグリッドルーラの種類を選択">
+		<combo_box.item label="世界" name="World"/>
+		<combo_box.item label="ローカル" name="Local"/>
+		<combo_box.item label="リファレンス" name="Reference"/>
+	</combo_box>
+	<button label="" label_selected="オプション" name="Options..." tool_tip="グリッドオプションを表示します"/>
 	<button label="" label_selected="" name="ToolCube" tool_tip="キューブ"/>
 	<button label="" label_selected="" name="ToolPrism" tool_tip="プリズム"/>
 	<button label="" label_selected="" name="ToolPyramid" tool_tip="ピラミッド"/>
diff --git a/indra/newview/skins/default/xui/ja/floater_toybox.xml b/indra/newview/skins/default/xui/ja/floater_toybox.xml
index d7056f806c62e6543b8149eb16074ff88d4bac5f..682352ec827f2e3adff1f2853b4a25d65d505e50 100644
--- a/indra/newview/skins/default/xui/ja/floater_toybox.xml
+++ b/indra/newview/skins/default/xui/ja/floater_toybox.xml
@@ -1,10 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Toybox" title="ツールバーをカスタマイズ">
+<floater name="Toybox" title="ツールバーのボタン">
 	<text name="toybox label 1">
 		ボタンをツールバーに追加または削除するにはボタンをドラッグします。
 	</text>
 	<text name="toybox label 2">
 		各ツールバーの設定に応じて、ボタンは以下のように表示されたり、アイコンのみで表示されます。
 	</text>
+	<button label="ツールバーを全てクリア" label_selected="ツールバーを全てクリア" name="btn_clear_all"/>
 	<button label="デフォルト設定を復元" label_selected="デフォルト設定を復元" name="btn_restore_defaults"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/ja/floater_translation_settings.xml b/indra/newview/skins/default/xui/ja/floater_translation_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..27143086ac44d23d205acbc6e5467e42268abb8e
--- /dev/null
+++ b/indra/newview/skins/default/xui/ja/floater_translation_settings.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_translation_settings" title="チャットの翻訳設定">
+	<string name="bing_api_key_not_verified">
+		Bing appID を認証できませんでした。もう一度お試しください。
+	</string>
+	<string name="google_api_key_not_verified">
+		Google API キーを認証できませんでした。もう一度お試しください。
+	</string>
+	<string name="bing_api_key_verified">
+		Bing appID が認証されました。
+	</string>
+	<string name="google_api_key_verified">
+		Google API キーが認証されました。
+	</string>
+	<check_box label="チャット中の機械翻訳機能を有効にする" name="translate_chat_checkbox"/>
+	<text name="translate_language_label">
+		翻訳する言語:
+	</text>
+	<combo_box name="translate_language_combo">
+		<combo_box.item label="システム標準" name="System Default Language"/>
+		<combo_box.item label="英語" name="English"/>
+		<combo_box.item label="Dansk(デンマーク語)" name="Danish"/>
+		<combo_box.item label="Deutsch(ドイツ語)" name="German"/>
+		<combo_box.item label="Español(スペイン語)" name="Spanish"/>
+		<combo_box.item label="Français(フランス語)" name="French"/>
+		<combo_box.item label="Italiano(イタリア語)" name="Italian"/>
+		<combo_box.item label="Magyar(ハンガリー語)" name="Hungarian"/>
+		<combo_box.item label="Nederlands(オランダ語)" name="Dutch"/>
+		<combo_box.item label="Polski(ポーランド語)" name="Polish"/>
+		<combo_box.item label="Português(ポルトガル語)" name="Portugese"/>
+		<combo_box.item label="Русский(ロシア語)" name="Russian"/>
+		<combo_box.item label="Türkçe(トルコ語)" name="Turkish"/>
+		<combo_box.item label="Українська (ウクライナ語)" name="Ukrainian"/>
+		<combo_box.item label="中文 (正體) (中国語)" name="Chinese"/>
+		<combo_box.item label="日本語(日本語)" name="Japanese"/>
+		<combo_box.item label="한국어(韓国語)" name="Korean"/>
+	</combo_box>
+	<text name="tip">
+		翻訳サービスを選択してください:
+	</text>
+	<radio_group name="translation_service_rg">
+		<radio_item initial_value="bing" label="Bing Translator" name="bing"/>
+		<radio_item initial_value="google" label="Google Translate" name="google"/>
+	</radio_group>
+	<text name="bing_api_key_label">
+		Bing AppID [http://www.bing.com/developers/createapp.aspx AppID]:
+	</text>
+	<button label="認証" name="verify_bing_api_key_btn"/>
+	<text name="google_api_key_label">
+		Google API key [http://code.google.com/apis/language/translate/v2/getting_started.html#auth API key]:
+	</text>
+	<button label="認証" name="verify_google_api_key_btn"/>
+	<text name="google_links_text">
+		[http://code.google.com/apis/language/translate/v2/pricing.html 価格] | [https://code.google.com/apis/console 統計]
+	</text>
+	<button label="OK" name="ok_btn"/>
+	<button label="取り消し" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/ja/floater_voice_controls.xml b/indra/newview/skins/default/xui/ja/floater_voice_controls.xml
index f12648f208ce59195501e7c0fa08f8f2cd22f272..f7d3fd11e09885fca620dd206f58d00587401af8 100644
--- a/indra/newview/skins/default/xui/ja/floater_voice_controls.xml
+++ b/indra/newview/skins/default/xui/ja/floater_voice_controls.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="floater_voice_controls" title="ボイスコントロール">
 	<string name="title_nearby">
-		近くのボイス
+		ボイス設定
 	</string>
 	<string name="title_group">
 		[GROUP] とグループコール
@@ -10,7 +10,7 @@
 		コンファレンスコール
 	</string>
 	<string name="title_peer_2_peer">
-		[NAME] でコール
+		[NAME] とコール
 	</string>
 	<string name="no_one_near">
 		近くにボイスを有効にしている人はいません。
diff --git a/indra/newview/skins/default/xui/ja/floater_voice_effect.xml b/indra/newview/skins/default/xui/ja/floater_voice_effect.xml
index 801b7a9db09d3c2ed0a3c182125d1235a3a058c7..ee675e143b00e1c45fea1ad0d50ef51bdd6e30f7 100644
--- a/indra/newview/skins/default/xui/ja/floater_voice_effect.xml
+++ b/indra/newview/skins/default/xui/ja/floater_voice_effect.xml
@@ -42,13 +42,16 @@
 	<string name="effect_Demon">
 		デーモン
 	</string>
+	<string name="effect_Female Elf">
+		女性のエルフ
+	</string>
 	<string name="effect_Flirty">
 		気のありそうな
 	</string>
 	<string name="effect_Foxy">
 		魅惑的
 	</string>
-	<string name="effect_Halloween_2010_Bonus">
+	<string name="effect_Halloween 2010 Bonus">
 		ハロウィン_2010_ボーナス
 	</string>
 	<string name="effect_Helium">
@@ -57,9 +60,18 @@
 	<string name="effect_Husky">
 		ハスキー
 	</string>
+	<string name="effect_Husky Whisper">
+		スモーキーウィスパー
+	</string>
 	<string name="effect_Intercom">
 		インターホン
 	</string>
+	<string name="effect_Julia">
+		ジュリア
+	</string>
+	<string name="effect_Lo Lilt">
+		軽快
+	</string>
 	<string name="effect_Macho">
 		マッチョ
 	</string>
@@ -69,6 +81,9 @@
 	<string name="effect_Mini">
 		ミニ
 	</string>
+	<string name="effect_Model">
+		モデル
+	</string>
 	<string name="effect_Nano">
 		ナノ
 	</string>
@@ -90,6 +105,9 @@
 	<string name="effect_Roxanne">
 		ロクサン
 	</string>
+	<string name="effect_Rumble">
+		ランブル
+	</string>
 	<string name="effect_Sabrina">
 		サブリナ
 	</string>
@@ -102,6 +120,9 @@
 	<string name="effect_Shorty">
 		チビ
 	</string>
+	<string name="effect_Smaller">
+		小さめ
+	</string>
 	<string name="effect_Sneaky">
 		コソコソ
 	</string>
diff --git a/indra/newview/skins/default/xui/ja/menu_inspect_object_gear.xml b/indra/newview/skins/default/xui/ja/menu_inspect_object_gear.xml
index 2edade70bfc1b17d1b8fd6ec03ff4cc59549abcd..5a0519ba192b8dff7bc1ab9bcdd935f8657b2358 100644
--- a/indra/newview/skins/default/xui/ja/menu_inspect_object_gear.xml
+++ b/indra/newview/skins/default/xui/ja/menu_inspect_object_gear.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<menu name="Gear Menu">
+<toggleable_menu name="Gear Menu">
 	<menu_item_call label="触る" name="touch"/>
 	<menu_item_call label="座る" name="sit"/>
 	<menu_item_call label="支払う" name="pay"/>
@@ -12,7 +12,8 @@
 	<menu_item_call label="追加" name="add"/>
 	<menu_item_call label="報告" name="report"/>
 	<menu_item_call label="ブロック" name="block"/>
+	<menu_item_call label="ブロック解除" name="unblock"/>
 	<menu_item_call label="ズームイン" name="zoom_in"/>
 	<menu_item_call label="削除" name="remove"/>
 	<menu_item_call label="詳細" name="more_info"/>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/ja/menu_inventory.xml b/indra/newview/skins/default/xui/ja/menu_inventory.xml
index 9449e61274036d51ab2a16c74632703bae41460f..d1893a0fc86184b27b30d5f7b3c275ad3acbb34f 100644
--- a/indra/newview/skins/default/xui/ja/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/ja/menu_inventory.xml
@@ -59,6 +59,7 @@
 	<menu_item_call label="プロパティ" name="Properties"/>
 	<menu_item_call label="名前を変更する" name="Rename"/>
 	<menu_item_call label="UUID をコピーする" name="Copy Asset UUID"/>
+	<menu_item_call label="カット" name="Cut"/>
 	<menu_item_call label="コピー" name="Copy"/>
 	<menu_item_call label="貼り付け" name="Paste"/>
 	<menu_item_call label="リンクを貼り付ける" name="Paste As Link"/>
@@ -84,6 +85,6 @@
 	<menu_item_call label="追加" name="Wearable Add"/>
 	<menu_item_call label="取り外す" name="Take Off"/>
 	<menu_item_call label="マーチャントのアウトボックスにコピー" name="Merchant Copy"/>
-	<menu_item_call label="マーチャントのアウトボックスに移動" name="Merchant Move"/>
+	<menu_item_call label="マーケットプレイスに送信" name="Marketplace Send"/>
 	<menu_item_call label="--オプションなし--" name="--no options--"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/ja/menu_inventory_gear_default.xml b/indra/newview/skins/default/xui/ja/menu_inventory_gear_default.xml
index 1f425df83c0fa87d7430c7f9b7aa2c15bad19556..f38dbc71a8a33ac580afdb126dd1ea1df1339e96 100644
--- a/indra/newview/skins/default/xui/ja/menu_inventory_gear_default.xml
+++ b/indra/newview/skins/default/xui/ja/menu_inventory_gear_default.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <toggleable_menu name="menu_gear_default">
-	<menu_item_call label="新しい持ち物ウィンドウ" name="new_window"/>
+	<menu_item_call label="新しいインベントリウィンドウ" name="new_window"/>
 	<menu_item_check label="名前で並べ替え" name="sort_by_name"/>
 	<menu_item_check label="新しい順に並べ替え" name="sort_by_recent"/>
 	<menu_item_check label="フォルダを常に名前順に並べる" name="sort_folders_by_name"/>
diff --git a/indra/newview/skins/default/xui/ja/menu_login.xml b/indra/newview/skins/default/xui/ja/menu_login.xml
index 4c88f17f3dbdaec8e840b448b7cf1d7b662714ce..ab6d9e3546d560f24e16dfed4da7be0488c45822 100644
--- a/indra/newview/skins/default/xui/ja/menu_login.xml
+++ b/indra/newview/skins/default/xui/ja/menu_login.xml
@@ -17,8 +17,8 @@
 		<menu_item_call label="ウィンドウのサイズを設定..." name="Set Window Size..."/>
 		<menu_item_call label="利用規約を表示" name="TOS"/>
 		<menu_item_call label="クリティカルメッセージを表示" name="Critical"/>
-		<menu_item_call label="メディアブラウザのテスト" name="Web Browser Test"/>
 		<menu_item_call label="Web コンテンツフローターのデバッグテスト" name="Web Content Floater Debug Test"/>
+		<menu label="ログレベルを設定" name="Set Logging Level"/>
 		<menu_item_check label="グリッドピッカーを表示する" name="Show Grid Picker"/>
 		<menu_item_call label="通知コンソールを表示する" name="Show Notifications Console"/>
 	</menu>
diff --git a/indra/newview/skins/default/xui/ja/menu_places_gear_folder.xml b/indra/newview/skins/default/xui/ja/menu_places_gear_folder.xml
index e64f97fda54be3bdd3566b9ba942ad026705c52c..c45520472273f84849795d18087ef3b7e47a46fd 100644
--- a/indra/newview/skins/default/xui/ja/menu_places_gear_folder.xml
+++ b/indra/newview/skins/default/xui/ja/menu_places_gear_folder.xml
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <toggleable_menu name="menu_folder_gear">
 	<menu_item_call label="ランドマークを追加" name="add_landmark"/>
 	<menu_item_call label="フォルダを追加" name="add_folder"/>
-	<menu_item_call label="商品を復元" name="restore_item"/>
+	<menu_item_call label="アイテムを復元" name="restore_item"/>
 	<menu_item_call label="切り取り" name="cut"/>
 	<menu_item_call label="コピー" name="copy_folder"/>
 	<menu_item_call label="貼り付け" name="paste"/>
diff --git a/indra/newview/skins/default/xui/ja/menu_places_gear_landmark.xml b/indra/newview/skins/default/xui/ja/menu_places_gear_landmark.xml
index f416b5b1f66a653572a7cddd124eb357c378aff9..579f2c2cbd10005438ab513b068d174a5951b003 100644
--- a/indra/newview/skins/default/xui/ja/menu_places_gear_landmark.xml
+++ b/indra/newview/skins/default/xui/ja/menu_places_gear_landmark.xml
@@ -1,11 +1,11 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <toggleable_menu name="menu_ladmark_gear">
 	<menu_item_call label="テレポート" name="teleport"/>
 	<menu_item_call label="もっと詳しく" name="more_info"/>
 	<menu_item_call label="地図に表示" name="show_on_map"/>
 	<menu_item_call label="ランドマークを追加" name="add_landmark"/>
 	<menu_item_call label="フォルダを追加" name="add_folder"/>
-	<menu_item_call label="商品を復元" name="restore_item"/>
+	<menu_item_call label="アイテムを復元" name="restore_item"/>
 	<menu_item_call label="切り取り" name="cut"/>
 	<menu_item_call label="ランドマークをコピー" name="copy_landmark"/>
 	<menu_item_call label="SLurl をコピー" name="copy_slurl"/>
diff --git a/indra/newview/skins/default/xui/ja/menu_toolbars.xml b/indra/newview/skins/default/xui/ja/menu_toolbars.xml
index e911ca4a1341da48c02da31dd7cbbceebe4ea024..d5363a5131d62464add5b824cba226f79d73c5aa 100644
--- a/indra/newview/skins/default/xui/ja/menu_toolbars.xml
+++ b/indra/newview/skins/default/xui/ja/menu_toolbars.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Toolbars Popup">
-	<menu_item_call label="ボタンを選択..." name="Chose Buttons"/>
+	<menu_item_call label="このボタンを削除" name="Remove button"/>
+	<menu_item_call label="ツールバーのボタン..." name="Choose Buttons"/>
 	<menu_item_check label="アイコンとラベル" name="icons_with_text"/>
 	<menu_item_check label="アイコンのみ" name="icons_only"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/ja/menu_url_inventory.xml b/indra/newview/skins/default/xui/ja/menu_url_inventory.xml
index 7af2f9e2cd866262c8f7290218f6ffc74e12c08b..147ab44a1b1f1f2e0258bae03c8d72635cfbf487 100644
--- a/indra/newview/skins/default/xui/ja/menu_url_inventory.xml
+++ b/indra/newview/skins/default/xui/ja/menu_url_inventory.xml
@@ -1,6 +1,6 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Url Popup">
-	<menu_item_call label="持ち物アイテムを表示" name="show_item"/>
+	<menu_item_call label="インベントリアイテムを表示" name="show_item"/>
 	<menu_item_call label="名前をクリップボードにコピー" name="url_copy_label"/>
 	<menu_item_call label="SLurl をクリップボードにコピー" name="url_copy"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/ja/menu_viewer.xml b/indra/newview/skins/default/xui/ja/menu_viewer.xml
index b9dbb81c0ad4510db6d802ae6a5e0b2175f575bf..8496dfb1dbff3e9a9ad50a24370555ad8c4c0248 100644
--- a/indra/newview/skins/default/xui/ja/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/ja/menu_viewer.xml
@@ -1,55 +1,60 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu_bar name="Main Menu">
 	<menu label="ミー" name="Me">
-		<menu_item_call label="マイアカウント..." name="Manage My Account">
-			<menu_item_call.on_click name="ManageMyAccount_url" parameter="WebLaunchJoinNow,http://secondlife.com/account/index.php?lang=ja"/>
-		</menu_item_call>
 		<menu_item_call label="プロフィール..." name="Profile"/>
 		<menu_item_call label="容姿..." name="ChangeOutfit"/>
-		<menu_item_check label="持ち物..." name="Inventory"/>
-		<menu_item_check label="ジェスチャー..." name="Gestures"/>
-		<menu_item_check label="ボイス..." name="ShowVoice"/>
+		<menu_item_call label="アバターを選択..." name="Avatar Picker"/>
+		<menu_item_check label="インベントリ..." name="Inventory"/>
+		<menu_item_call label="新しいインベントリウィンドウ" name="NewInventoryWindow"/>
+		<menu_item_call label="場所..." name="Places"/>
+		<menu_item_call label="ピック..." name="Picks"/>
+		<menu_item_call label="カメラコントロール..." name="Camera Controls"/>
 		<menu label="ムーブメント" name="Movement">
 			<menu_item_call label="座る" name="Sit Down Here"/>
 			<menu_item_check label="飛ぶ" name="Fly"/>
 			<menu_item_check label="常に走る" name="Always Run"/>
 			<menu_item_call label="私のアニメーションを停止する" name="Stop Animating My Avatar"/>
+			<menu_item_call label="歩行/走行/飛行..." name="Walk / run / fly"/>
 		</menu>
 		<menu label="ログイン" name="Status">
 			<menu_item_call label="一時退席中" name="Set Away"/>
 			<menu_item_call label="取り込み中" name="Set Busy"/>
 		</menu>
-		<menu_item_call label="管理者権限のリクエスト" name="Request Admin Options"/>
-		<menu_item_call label="管理者ステータス解除" name="Leave Admin Options"/>
-		<menu_item_call label="L$ の購入" name="Buy and Sell L$"/>
+		<menu_item_call label="L$ の購入..." name="Buy and Sell L$"/>
+		<menu_item_call label="マーチャントアウトボックス..." name="MerchantOutbox"/>
+		<menu_item_call label="マイアカウント..." name="Manage My Account">
+			<menu_item_call.on_click name="ManageMyAccount_url" parameter="WebLaunchJoinNow,http://secondlife.com/account/index.php?lang=ja"/>
+		</menu_item_call>
 		<menu_item_call label="環境設定..." name="Preferences"/>
-		<menu_item_call label="ツールバー..." name="Toolbars"/>
+		<menu_item_call label="ツールバーのボタン..." name="Toolbars"/>
 		<menu_item_call label="全てのコントロールを非表示にする" name="Hide UI"/>
 		<menu_item_call label="[APP_NAME] を終了" name="Quit"/>
 	</menu>
 	<menu label="コミュニケーション" name="Communicate">
+		<menu_item_check label="チャット..." name="Nearby Chat"/>
+		<menu_item_check label="話す" name="Speak"/>
+		<menu_item_check label="ボイス設定..." name="Nearby Voice"/>
+		<menu_item_check label="ボイスモーフィング..." name="ShowVoice"/>
+		<menu_item_check label="ジェスチャー..." name="Gestures"/>
 		<menu_item_call label="フレンド" name="My Friends"/>
-		<menu_item_call label="所属グループ" name="My Groups"/>
-		<menu_item_check label="近くのチャット" name="Nearby Chat"/>
+		<menu_item_call label="グループ" name="My Groups"/>
 		<menu_item_call label="近くにいる人" name="Active Speakers"/>
-		<menu_item_check label="近くのボイス" name="Nearby Voice"/>
 	</menu>
 	<menu label="世界" name="World">
-		<menu_item_check label="ミニマップ" name="Mini-Map"/>
+		<menu_item_call label="現在地をランドマーク" name="Create Landmark Here"/>
+		<menu_item_call label="行き先..." name="Destinations"/>
 		<menu_item_check label="世界地図" name="World Map"/>
+		<menu_item_check label="ミニマップ" name="Mini-Map"/>
 		<menu_item_check label="検索" name="Search"/>
+		<menu_item_call label="ホームにテレポート" name="Teleport Home"/>
+		<menu_item_call label="現在地をホームに設定" name="Set Home to Here"/>
 		<menu_item_call label="スナップショット" name="Take Snapshot"/>
-		<menu_item_call label="現在地をランドマーク" name="Create Landmark Here"/>
-		<menu label="場所のプロフィール" name="Land">
-			<menu_item_call label="場所のプロフィール" name="Place Profile"/>
-			<menu_item_call label="土地情報" name="About Land"/>
-			<menu_item_call label="地域 / 不動産" name="Region/Estate"/>
-		</menu>
+		<menu_item_call label="場所のプロフィール" name="Place Profile"/>
+		<menu_item_call label="土地情報" name="About Land"/>
+		<menu_item_call label="地域 / 不動産" name="Region/Estate"/>
+		<menu_item_call label="保有地..." name="My Land"/>
 		<menu_item_call label="この土地を購入" name="Buy Land"/>
-		<menu_item_call label="自分の土地" name="My Land"/>
 		<menu label="表示" name="LandShow">
-			<menu_item_check label="移動コントロール" name="Movement Controls"/>
-			<menu_item_check label="カメラコントロール" name="Camera Controls"/>
 			<menu_item_check label="立入禁止ライン" name="Ban Lines"/>
 			<menu_item_check label="ビーコン(標識)" name="beacons"/>
 			<menu_item_check label="プロパティ境界線" name="Property Lines"/>
@@ -58,16 +63,15 @@
 			<menu_item_check label="区画プロパティ" name="Parcel Properties"/>
 			<menu_item_check label="アドバンスメニュー" name="Show Advanced Menu"/>
 		</menu>
-		<menu_item_call label="ホームにテレポート" name="Teleport Home"/>
-		<menu_item_call label="現在地をホームに設定" name="Set Home to Here"/>
-		<menu label="太陽" name="Environment Settings">
+		<menu label="太陽" name="Sun">
 			<menu_item_call label="日の出" name="Sunrise"/>
 			<menu_item_call label="正午" name="Noon"/>
 			<menu_item_call label="日没" name="Sunset"/>
-			<menu_item_call label="深夜" name="Midnight"/>
+			<menu_item_call label="真夜中" name="Midnight"/>
+			<menu_item_call label="リージョンの設定を使用" name="Use Region Settings"/>
 		</menu>
-		<menu label="自然環境エディター" name="Enviroment Editor">
-			<menu_item_call label="環境の設定..." name="Enviroment Settings"/>
+		<menu label="自然環境エディター" name="Environment Editor">
+			<menu_item_call label="自然環境の設定..." name="Environment Settings"/>
 			<menu label="水の事前設定" name="Water Presets">
 				<menu_item_call label="新しい事前設定..." name="new_water_preset"/>
 				<menu_item_call label="事前設定を編集..." name="edit_water_preset"/>
@@ -109,7 +113,7 @@
 			<menu_item_call label="買う" name="Menu Object Buy"/>
 			<menu_item_call label="取る" name="Menu Object Take"/>
 			<menu_item_call label="コピーを取る" name="Take Copy"/>
-			<menu_item_call label="「持ち物」に保存" name="Save Object Back to My Inventory"/>
+			<menu_item_call label="マイインベントリに保存" name="Save Object Back to My Inventory"/>
 			<menu_item_call label="オブジェクトの中身に保存" name="Save Object Back to Object Contents"/>
 			<menu_item_call label="オブジェクトを返却する" name="Return Object back to Owner"/>
 		</menu>
@@ -140,11 +144,13 @@
 			<menu_item_call label="アニメーション(L$[COST])..." name="Upload Animation"/>
 			<menu_item_call label="モデル" name="Upload Model"/>
 			<menu_item_call label="一括 (ファイルにつきL$[COST])..." name="Bulk Upload"/>
+			<menu_item_call label="デフォルトのアップロード権限を設定" name="perm prefs"/>
 		</menu>
 		<menu_item_call label="元に戻す" name="Undo"/>
 		<menu_item_call label="やり直し" name="Redo"/>
 	</menu>
 	<menu label="ヘルプ" name="Help">
+		<menu_item_call label="ハウツー..." name="How To"/>
 		<menu_item_call label="[SECOND_LIFE] ヘルプ" name="Second Life Help"/>
 		<menu_item_call label="嫌がらせを報告する" name="Report Abuse"/>
 		<menu_item_call label="バグを報告する" name="Report Bug"/>
@@ -172,22 +178,22 @@
 			<menu_item_check label="一人称視点のときに十字線を表示する" name="ShowCrosshairs"/>
 		</menu>
 		<menu label="レンダリング(種類)" name="Rendering Types">
-			<menu_item_check label="シンプル" name="Simple"/>
-			<menu_item_check label="アルファ" name="Alpha"/>
-			<menu_item_check label="木" name="Tree"/>
-			<menu_item_check label="アバター" name="Character"/>
-			<menu_item_check label="サーフェスパッチ" name="Surface Patch"/>
-			<menu_item_check label="空" name="Sky"/>
-			<menu_item_check label="æ°´" name="Water"/>
-			<menu_item_check label="地面" name="Ground"/>
-			<menu_item_check label="ボリューム" name="Volume"/>
-			<menu_item_check label="草" name="Grass"/>
-			<menu_item_check label="雲" name="Clouds"/>
-			<menu_item_check label="パーティクル" name="Particles"/>
-			<menu_item_check label="衝突" name="Bump"/>
+			<menu_item_check label="シンプル" name="Rendering Type Simple"/>
+			<menu_item_check label="アルファ" name="Rendering Type Alpha"/>
+			<menu_item_check label="木" name="Rendering Type Tree"/>
+			<menu_item_check label="アバター" name="Rendering Type Character"/>
+			<menu_item_check label="サーフェスパッチ" name="Rendering Type Surface Patch"/>
+			<menu_item_check label="空" name="Rendering Type Sky"/>
+			<menu_item_check label="æ°´" name="Rendering Type Water"/>
+			<menu_item_check label="地面" name="Rendering Type Ground"/>
+			<menu_item_check label="取引高" name="Rendering Type Volume"/>
+			<menu_item_check label="草" name="Rendering Type Grass"/>
+			<menu_item_check label="雲" name="Rendering Type Clouds"/>
+			<menu_item_check label="パーティクル" name="Rendering Type Particles"/>
+			<menu_item_check label="衝突" name="Rendering Type Bump"/>
 		</menu>
 		<menu label="レンダリング(機能)" name="Rendering Features">
-			<menu_item_check label="UI" name="UI"/>
+			<menu_item_check label="UI" name="ToggleUI"/>
 			<menu_item_check label="選択済" name="Selected"/>
 			<menu_item_check label="ハイライト" name="Highlighted"/>
 			<menu_item_check label="ダイナミックテクスチャ" name="Dynamic Textures"/>
@@ -199,11 +205,8 @@
 		<menu_item_check label="Use Plugin Read Thread" name="Use Plugin Read Thread"/>
 		<menu_item_call label="グループキャッシュのクリア" name="ClearGroupCache"/>
 		<menu_item_check label="マウスの平滑化" name="Mouse Smoothing"/>
+		<menu_item_call label="リリースキー" name="Release Keys"/>
 		<menu label="ショートカット" name="Shortcuts">
-			<menu_item_call label="画像 (L$ [COST] )..." name="Upload Image"/>
-			<menu_item_check label="検索" name="Search"/>
-			<menu_item_call label="キーをリリース" name="Release Keys"/>
-			<menu_item_call label="UI のサイズをデフォルトに設定する" name="Set UI Size to Default"/>
 			<menu_item_check label="アドバンスメニューを表示 - レガシーのショートカット" name="Show Advanced Menu - legacy shortcut"/>
 			<menu_item_call label="ウィンドウを閉じる" name="Close Window"/>
 			<menu_item_call label="全てのウィンドウを閉じる" name="Close All Windows"/>
@@ -212,13 +215,6 @@
 			<menu_item_check label="ジョイスティックフライカム" name="Joystick Flycam"/>
 			<menu_item_call label="表示をリセットする" name="Reset View"/>
 			<menu_item_call label="最後の発言者を見る" name="Look at Last Chatter"/>
-			<menu label="制作ツールを選択する" name="Select Tool">
-				<menu_item_call label="焦点ツール" name="Focus"/>
-				<menu_item_call label="移動ツール" name="Move"/>
-				<menu_item_call label="編集ツール" name="Edit"/>
-				<menu_item_call label="作成ツール" name="Create"/>
-				<menu_item_call label="土地ツール" name="Land"/>
-			</menu>
 			<menu_item_call label="ズームイン" name="Zoom In"/>
 			<menu_item_call label="ズーム(デフォルト)" name="Zoom Default"/>
 			<menu_item_call label="ズームアウト" name="Zoom Out"/>
@@ -289,7 +285,9 @@
 			<menu_item_check label="å…‰" name="Lights"/>
 			<menu_item_check label="骨組みの衝突判定" name="Collision Skeleton"/>
 			<menu_item_check label="レイキャスト" name="Raycast"/>
+			<menu_item_check label="風のベクトル" name="Wind Vectors"/>
 			<menu_item_check label="描画の詳細度" name="rendercomplexity"/>
+			<menu_item_check label="添付アイテムのバイト数" name="attachment bytes"/>
 			<menu_item_check label="スカルプト" name="Sculpt"/>
 		</menu>
 		<menu label="レンダリング" name="Rendering">
@@ -301,7 +299,6 @@
 			<menu_item_check label="光と影" name="Lighting and Shadows"/>
 			<menu_item_check label="太陽・月・プロジェクタからの影" name="Shadows from Sun/Moon/Projectors"/>
 			<menu_item_check label="SSAO と影の平滑化" name="SSAO and Shadow Smoothing"/>
-			<menu_item_check label="グローバルイルミネーション(試験段階)" name="Global Illumination"/>
 			<menu_item_check label="GL デバッグ" name="Debug GL"/>
 			<menu_item_check label="経路をデバッグ" name="Debug Pipeline"/>
 			<menu_item_check label="自動アルファマスク(遅延)" name="Automatic Alpha Masks (deferred)"/>
@@ -332,17 +329,16 @@
 			<menu_item_call label="記録開始" name="Start Record"/>
 			<menu_item_call label="記録停止" name="Stop Record"/>
 		</menu>
-		<menu label="世界" name="World">
+		<menu label="世界" name="DevelopWorld">
 			<menu_item_check label="シムの太陽の設定を無視する" name="Sim Sun Override"/>
-			<menu_item_check label="ビーコンを強調表示する" name="Cheesy Beacon"/>
 			<menu_item_check label="固定された天気" name="Fixed Weather"/>
-			<menu_item_call label="リージョンオブジェクトのキャッシュをダンプする" name="Dump Region Object Cache"/>
+			<menu_item_call label="リージョンオブジェクトのキャッシュをダンプ" name="Dump Region Object Cache"/>
 		</menu>
 		<menu label="UI" name="UI">
 			<menu_item_call label="メディアブラウザのテスト" name="Web Browser Test"/>
 			<menu_item_call label="Web コンテンツブラウザ" name="Web Content Browser"/>
 			<menu_item_call label="SelectMgr をダンプ" name="Dump SelectMgr"/>
-			<menu_item_call label="持ち物の出力" name="Dump Inventory"/>
+			<menu_item_call label="インベントリの出力" name="Dump Inventory"/>
 			<menu_item_call label="タイマーをダンプ" name="Dump Timers"/>
 			<menu_item_call label="フォーカスホールダーをダンプ" name="Dump Focus Holder"/>
 			<menu_item_call label="選択したオブジェクト情報をプリント" name="Print Selected Object Info"/>
@@ -366,11 +362,11 @@
 		</menu>
 		<menu label="アバター" name="Character">
 			<menu label="ベークドテクスチャを取得する" name="Grab Baked Texture">
-				<menu_item_call label="çž³" name="Iris"/>
-				<menu_item_call label="é ­" name="Head"/>
-				<menu_item_call label="上半身" name="Upper Body"/>
-				<menu_item_call label="下半身" name="Lower Body"/>
-				<menu_item_call label="スカート" name="Skirt"/>
+				<menu_item_call label="çž³" name="Grab Iris"/>
+				<menu_item_call label="é ­" name="Grab Head"/>
+				<menu_item_call label="上半身" name="Grab Upper Body"/>
+				<menu_item_call label="下半身" name="Grab Lower Body"/>
+				<menu_item_call label="スカート" name="Grab Skirt"/>
 			</menu>
 			<menu label="キャラクターテスト" name="Character Tests">
 				<menu_item_call label="容姿を XML に保存する" name="Appearance To XML"/>
@@ -396,22 +392,30 @@
 			<menu_item_call label="ローカルテクスチャをダンプ" name="Dump Local Textures"/>
 		</menu>
 		<menu_item_check label="HTTP Texture" name="HTTP Textures"/>
-		<menu_item_check label="HTTP 持ち物" name="HTTP Inventory"/>
+		<menu_item_check label="HTTP インベントリ" name="HTTP Inventory"/>
 		<menu_item_call label="圧縮画像" name="Compress Images"/>
+		<menu_item_call label="Visual Leak Detector を有効にする" name="Enable Visual Leak Detector"/>
 		<menu_item_check label="デバッグ用のミニダンプを出力する" name="Output Debug Minidump"/>
 		<menu_item_check label="次回の起動時にコンソールウィンドウを表示する" name="Console Window"/>
+		<menu label="ログレベルを設定" name="Set Logging Level">
+			<menu_item_check label="デバッグ" name="Debug"/>
+			<menu_item_check label="情報" name="Info"/>
+			<menu_item_check label="警告" name="Warning"/>
+			<menu_item_check label="エラー" name="Error"/>
+			<menu_item_check label="なし" name="None"/>
+		</menu>
 		<menu_item_call label="管理者ステータスの呼び出し" name="Request Admin Options"/>
 		<menu_item_call label="管理者ステータス解除" name="Leave Admin Options"/>
 		<menu_item_check label="管理者メニューを表示する" name="View Admin Options"/>
 	</menu>
 	<menu label="管理者" name="Admin">
-		<menu label="Object">
-			<menu_item_call label="コピーを取る" name="Take Copy"/>
+		<menu label="オブジェクト" name="AdminObject">
+			<menu_item_call label="コピーを取る" name="Admin Take Copy"/>
 			<menu_item_call label="私を所有者にする" name="Force Owner To Me"/>
-			<menu_item_call label="所有者権限を実行する" name="Force Owner Permissive"/>
+			<menu_item_call label="所有者権限の実行" name="Force Owner Permissive"/>
 			<menu_item_call label="削除" name="Delete"/>
 			<menu_item_call label="ロック" name="Lock"/>
-			<menu_item_call label="アセット ID を取得する" name="Get Assets IDs"/>
+			<menu_item_call label="アセット ID を取得" name="Get Assets IDs"/>
 		</menu>
 		<menu label="区画" name="Parcel">
 			<menu_item_call label="私を所有者にする" name="Owner To Me"/>
@@ -442,7 +446,7 @@
 			<menu_item_call label="物理作用" name="Physics"/>
 			<menu_item_call label="すべての衣類" name="All Clothes"/>
 		</menu>
-		<menu label="ヘルプ" name="Help">
+		<menu label="ヘルプ" name="DeprecatedHelp">
 			<menu_item_call label="リンデン公式ブログ" name="Official Linden Blog"/>
 			<menu_item_call label="スクリプトポータル" name="Scripting Portal"/>
 			<menu label="バグの報告" name="Bug Reporting">
diff --git a/indra/newview/skins/default/xui/ja/notifications.xml b/indra/newview/skins/default/xui/ja/notifications.xml
index 85f09b450098e4b8ccf2bd33ca7c3473ff2dfd1a..54031ccf12411652d0b297ea31b304e7a9cde947 100644
--- a/indra/newview/skins/default/xui/ja/notifications.xml
+++ b/indra/newview/skins/default/xui/ja/notifications.xml
@@ -85,17 +85,38 @@
 		<usetemplate canceltext="キャンセル" name="yesnocancelbuttons" notext="保存しない" yestext="保存"/>
 	</notification>
 	<notification name="ConfirmNoCopyToOutbox">
-		マーチャントのアウトボックスにこれをコピーする権限があります。次のアイテムを移動しますか?
-[ITEM_NAME]
-		<usetemplate name="okcancelbuttons" notext="いいえ" yestext="はい"/>
+		これらのアイテムの 1 つまたは複数をマーチャントアウトボックスにコピーする許可がありません。移動するか、置き去りにすることはできます。
+		<usetemplate name="okcancelbuttons" notext="アイテムを移動しない" yestext="アイテムを移動"/>
+	</notification>
+	<notification name="OutboxFolderCreated">
+		マーチャントアウトボックスの最上位に転送した各アイテムにつき、それぞれ 1 つの新しいフォルダが作成されました。
+		<usetemplate ignoretext="新しいフォルダがマーチャントアウトボックス内に作成されました" name="okignore" yestext="OK"/>
+	</notification>
+	<notification name="OutboxImportComplete">
+		成功
+
+マーケットプレイスに正常に送信されたすべてのフォルダ
+		<usetemplate ignoretext="マーケットプレイスに送信されたすべてのフォルダ" name="okignore" yestext="OK"/>
+	</notification>
+	<notification name="OutboxImportHadErrors">
+		一部のフォルダは転送されませんでした
+
+一部のフォルダがマーケットプレイスに送信されたときにエラーが発生しました。これらのフォルダはまだマーチャントアウトボックス内にあります。
+
+詳細については、[[MARKETPLACE_IMPORTS_URL] エラーログ]をご覧ください。
+		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
-	<notification name="OutboxUploadComplete">
-		マーケットプレイスへのアップロードが完了しました。
-		<usetemplate name="okbutton" yestext="やったあ!"/>
+	<notification name="OutboxImportFailed">
+		転送に失敗
+
+システムまたはネットワークのエラーのため、フォルダはマーケットプレイスに送信されませんでした。後でもう一度お試しください。
+		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
-	<notification name="OutboxUploadHadErrors">
-		マーケットプレイスへのアップロードの完了時にエラーが発生しました。アウトボックスの問題を解決して、もう一度お試しください。ありがとうございます。
-		<usetemplate name="okbutton" yestext="再トライ!"/>
+	<notification name="OutboxInitFailed">
+		マーケットプレイスの初期化に失敗
+
+システムまたはネットワークのエラーのため、マーケットプレイスの初期化に失敗しました。後でもう一度お試しください。
+		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="CompileQueueSaveText">
 		次の理由で、スクリプト用テキストのアップロード時に問題が起こりました。
@@ -243,7 +264,7 @@ L$ が不足しているのでこのグループに参加することができ
 		<usetemplate name="okcancelbuttons" notext="キャンセル" yestext="OK"/>
 	</notification>
 	<notification name="ReturnObjectsDeededToGroup">
-		この区画のグループ [NAME] 共有のすべてのオブジェクトを、以前の所有者の「持ち物」に戻そうとしています。
+		この区画のグループ [NAME] 共有のすべてのオブジェクトを、以前の所有者のインベントリに戻そうとしています。
 操作を続行しますか?
 
 *警告* これにより、
@@ -254,21 +275,21 @@ L$ が不足しているのでこのグループに参加することができ
 	<notification name="ReturnObjectsOwnedByUser">
 		この区画で、
 住人 [NAME] が所有する全てのオブジェクトを
-本人の「持ち物」に本当に返却してもよいですか?
+本人のインベントリに本当に返却してもよいですか?
 
 オブジェクト: [N]
 		<usetemplate name="okcancelbuttons" notext="取り消し" yestext="OK"/>
 	</notification>
 	<notification name="ReturnObjectsOwnedBySelf">
 		この土地区画内にある、あなたが所有するすべてのオブジェクトを、
-あなたの「持ち物」に戻そうとしています。続けますか?
+あなたのインベントリに戻そうとしています。続けますか?
 
 オブジェクト: [N]
 		<usetemplate name="okcancelbuttons" notext="取り消し" yestext="OK"/>
 	</notification>
 	<notification name="ReturnObjectsNotOwnedBySelf">
 		この土地区画内にある、あなた以外が所有するすべてのオブジェクトを、
-それぞれの所有者の「持ち物」に戻そうとしています。
+それぞれの所有者のインベントリに戻そうとしています。
 操作を続行しますか?
 グループに譲渡された「再販・プレゼント可」のオブジェクトは、以前の所有者に返却されます。
 
@@ -279,7 +300,7 @@ L$ が不足しているのでこのグループに参加することができ
 	</notification>
 	<notification name="ReturnObjectsNotOwnedByUser">
 		この土地区画内にある、
-[NAME]以外による所有のオブジェクトをすべてそれぞれの所有者の「持ち物」に返却しようとしています。
+[NAME]以外による所有のオブジェクトをすべてそれぞれの所有者のインベントリに返却しようとしています。
 操作を続行しますか?グループに譲渡された「再販・プレゼント可」のオブジェクトは、以前の所有者に返却されます。
 
 *警告* これにより、
@@ -443,14 +464,14 @@ L$ が不足しているのでこのグループに参加することができ
 		ジェスチャーの保存に失敗しました。少し待ってからもう一度試してください。
 	</notification>
 	<notification name="GestureSaveFailedObjectNotFound">
-		ジェスチャーの保存に失敗しました。オブジェクト、または関連するオブジェクト持ち物が見つかりません。
+		ジェスチャーの保存に失敗しました。オブジェクト、または関連するオブジェクトインベントリが見つかりません。
 オブジェクトが範囲内に存在しないか、または削除された可能性があります。
 	</notification>
 	<notification name="GestureSaveFailedReason">
 		次の理由で、ジェスチャーの保存時に問題が起こりました。 [REASON]。  後でもう一度試してください。
 	</notification>
 	<notification name="SaveNotecardFailObjectNotFound">
-		ノートカードの保存に失敗しました。オブジェクト、または関連するオブジェクト持ち物が見つかりません。
+		ノートカードの保存に失敗しました。オブジェクト、または関連するオブジェクトインベントリが見つかりません。
 オブジェクトが範囲内に存在しないか、または削除された可能性があります。
 	</notification>
 	<notification name="SaveNotecardFailReason">
@@ -514,11 +535,11 @@ L$ が不足しているのでこのグループに参加することができ
 		[REGION] では、地形の変更ができません。
 	</notification>
 	<notification name="CannotCopyWarning">
-		あなたには[ITEMS]というアイテムをコピーする許可がありません。他の住人に提供すると、そのアイテムはあなたの「持ち物」から削除されます。本当にこれらのアイテムを譲りますか?
+		あなたには[ITEMS]というアイテムをコピーする許可がありません。他の住人に提供すると、そのアイテムはあなたのインベントリから削除されます。本当にこれらのアイテムを譲りますか?
 		<usetemplate name="okcancelbuttons" notext="いいえ" yestext="はい"/>
 	</notification>
 	<notification name="CannotGiveItem">
-		持ち物のアイテムを渡せません。
+		インベントリのアイテムを渡せません。
 	</notification>
 	<notification name="TransactionCancelled">
 		取引がキャンセルされました。
@@ -531,7 +552,7 @@ L$ が不足しているのでこのグループに参加することができ
 	</notification>
 	<notification name="CannotCopyCountItems">
 		あなたは選択した [COUNT] 個のアイテムののコピーを許されていません。
-これらのアイテムはあなたの「持ち物」から失われます。
+これらのアイテムはあなたのインベントリから失われます。
 本当にアイテムを渡したいですか?
 		<usetemplate name="okcancelbuttons" notext="いいえ" yestext="はい"/>
 	</notification>
@@ -672,7 +693,7 @@ L$ が不足しているのでこのグループに参加することができ
 		出力ファイルを作成できません: [FILE]
 	</notification>
 	<notification name="DoNotSupportBulkAnimationUpload">
-		現在 [APP_NAME] では、アニメーションの一括アップロードはサポートされていません。
+		現在 [APP_NAME] では、BVH 形式のアニメーションファイルの一括アップロードはサポートされていません。
 	</notification>
 	<notification name="CannotUploadReason">
 		次の理由で、「 [FILE] 」をアップロードできません: [REASON]
@@ -775,7 +796,7 @@ L$ が不足しているのでこのグループに参加することができ
 		テレポート目的地を見つけられません。目的地が一時的に利用できない状態か、すでに消滅している可能性があります。数分後にやり直してください。
 	</notification>
 	<notification name="no_inventory_host">
-		持ち物システムは現在利用できません。
+		インベントリシステムは現在利用できません。
 	</notification>
 	<notification name="CannotSetLandOwnerNothingSelected">
 		土地所有者設定ができません:
@@ -938,7 +959,7 @@ L$ は返金されません。
 		<usetemplate name="okcancelbuttons" notext="取り消し" yestext="OK"/>
 	</notification>
 	<notification name="ConfirmItemCopy">
-		このアイテムをあなたの持ち物にコピーしますか?
+		このアイテムをあなたのインベントリにコピーしますか?
 		<usetemplate name="okcancelbuttons" notext="取り消し" yestext="コピー"/>
 	</notification>
 	<notification name="ResolutionSwitchFail">
@@ -990,7 +1011,7 @@ L$ は返金されません。
 		</form>
 	</notification>
 	<notification label="着用物を保存" name="SaveWearableAs">
-		アイテムを別名で持ち物に保存:
+		アイテムを別名でインベントリに保存:
 		<form name="form">
 			<input name="message">
 				[DESC](新規)
@@ -1010,7 +1031,7 @@ L$ は返金されません。
 		</form>
 	</notification>
 	<notification name="RemoveFromFriends">
-		フレンドリストから [NAME] を削除しますか?
+		フレンドリストから &lt;nolink&gt;[NAME]&lt;/nolink&gt; を削除しますか?
 		<usetemplate name="okcancelbuttons" notext="取り消し" yestext="OK"/>
 	</notification>
 	<notification name="RemoveMultipleFromFriends">
@@ -1144,8 +1165,13 @@ L$ は返金されません。
 		-safe オプションを指定したので、
 表示設定はセーフレベルに設定されています。
 	</notification>
-	<notification name="DisplaySetToRecommended">
-		表示設定は、あなたのシステム構成に基づいて推奨されたレベルに設定されています。
+	<notification name="DisplaySetToRecommendedGPUChange">
+		グラフィックの変更により、画面設定は推奨レベルに設定されました。
+&apos;[LAST_GPU]&apos; から
+&apos;[THIS_GPU]&apos; まで
+	</notification>
+	<notification name="DisplaySetToRecommendedFeatureChange">
+		レンダリングサブシステムの変更により、画面設定は推奨レベルに設定されました。
 	</notification>
 	<notification name="ErrorMessage">
 		[ERROR_MESSAGE]
@@ -1467,8 +1493,8 @@ http://secondlife.com/download から最新バージョンをダウンロード
 		<usetemplate ignoretext="オブジェクトを所有者に返却する前の確認" name="okcancelignore" notext="取り消し" yestext="OK"/>
 	</notification>
 	<notification name="GroupLeaveConfirmMember">
-		現在あなたは [GROUP] のメンバーです。
-このグループを抜けますか?
+		現在、あなたは &lt;nolink&gt;[GROUP]&lt;/nolink&gt; グループのメンバーです。
+グループから脱退しますか?
 		<usetemplate name="okcancelbuttons" notext="取り消し" yestext="OK"/>
 	</notification>
 	<notification name="ConfirmKick">
@@ -1870,7 +1896,7 @@ Adult 専用リージョンに入るには、住人のアカウントが年齢
 	</notification>
 	<notification name="BuyCopy">
 		コピーを [OWNER] から L$ [PRICE] で購入しますか?
-購入したオブジェクトは、あなたの「持ち物」にコピーされます。
+購入したオブジェクトは、あなたのインベントリにコピーされます。
 可能な操作は、
 修正:[MODIFYPERM]、コピー:[COPYPERM]、
 再販・プレゼント:[RESELLPERM] です。
@@ -1878,7 +1904,7 @@ Adult 専用リージョンに入るには、住人のアカウントが年齢
 	</notification>
 	<notification name="BuyCopyNoOwner">
 		L$ [PRICE] でコピーを購入しますか?
-購入したオブジェクトは、あなたの「持ち物」にコピーされます。
+購入したオブジェクトは、あなたのインベントリにコピーされます。
 可能な操作は、
 修正:[MODIFYPERM]、コピー:[COPYPERM]、
 再販・プレゼント:[RESELLPERM] です。
@@ -1886,12 +1912,12 @@ Adult 専用リージョンに入るには、住人のアカウントが年齢
 	</notification>
 	<notification name="BuyContents">
 		中身を [OWNER] から L$ [PRICE] で購入しますか?
-購入した中身は、あなたの「持ち物」にコピーされます。
+購入した中身は、あなたのインベントリにコピーされます。
 		<usetemplate name="okcancelbuttons" notext="取り消し" yestext="OK"/>
 	</notification>
 	<notification name="BuyContentsNoOwner">
 		L$ [PRICE] で中身を購入しますか?
-購入した中身は、あなたの「持ち物」にコピーされます。
+購入した中身は、あなたのインベントリにコピーされます。
 		<usetemplate name="okcancelbuttons" notext="取り消し" yestext="OK"/>
 	</notification>
 	<notification name="ConfirmPurchase">
@@ -1920,20 +1946,20 @@ Adult 専用リージョンに入るには、住人のアカウントが年齢
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="MoveInventoryFromObject">
-		「コピー不可」の持ち物アイテムを選択しました。
-これらのアイテムはコピーされないまま、あなたの「持ち物」に移動されます。
+		「コピー不可」のインベントリアイテムを選択しました。
+これらのアイテムはコピーされないまま、あなたのインベントリに移動されます。
 
 
 アイテムを動かしますか?
 		<usetemplate ignoretext="「コピー不可」のアイテムをオブジェクトから動かす前の警告" name="okcancelignore" notext="キャンセル" yestext="OK"/>
 	</notification>
 	<notification name="MoveInventoryFromScriptedObject">
-		「コピー不可」の持ち物アイテムを選択しました。
-これらのアイテムはコピーされずに、あなたの「持ち物」に移動されます。
-このオブジェクトはスクリプト付きなので、「持ち物」に移動させると
+		「コピー不可」のインベントリアイテムを選択しました。
+これらのアイテムはコピーされずに、あなたのインベントリに移動されます。
+このオブジェクトはスクリプト付きなので、インベントリに移動させると
 スクリプトに誤動作が起きる可能性があります。
 
-持ち物アイテムを移動しますか?
+インベントリアイテムを移動しますか?
 		<usetemplate ignoretext="スクリプト入りのオブジェクトを壊す恐れのある「コピー不可」のアイテムを動かす前の警告" name="okcancelignore" notext="キャンセル" yestext="OK"/>
 	</notification>
 	<notification name="ClickActionNotPayable">
@@ -1954,7 +1980,13 @@ Adult 専用リージョンに入るには、住人のアカウントが年齢
 		<usetemplate ignoretext="終了時の確認" name="okcancelignore" notext="終了しない" yestext="終了"/>
 	</notification>
 	<notification name="ConfirmRestoreToybox">
-		デフォルトのボタンとツールバーを復元しますか? 
+		この操作を実行すると、デフォルト設定のボタンとツールバーが復元されます。
+
+この操作は元に戻せません。
+		<usetemplate name="okcancelbuttons" notext="取り消し" yestext="OK"/>
+	</notification>
+	<notification name="ConfirmClearAllToybox">
+		この操作により、全てのボタンはツールボックスに戻り、ツールバーは空になります。
     
 この操作は元に戻せません。
 		<usetemplate name="okcancelbuttons" notext="取り消し" yestext="OK"/>
@@ -2036,7 +2068,7 @@ Linden Lab
 	</notification>
 	<notification name="ConfirmEmptyTrash">
 		ごみ箱の中身をすべて削除しますか?
-		<usetemplate ignoretext="持ち物のごみ箱フォルダを空にする前の確認" name="okcancelignore" notext="キャンセル" yestext="OK"/>
+		<usetemplate ignoretext="インベントリのごみ箱フォルダを空にする前の確認" name="okcancelignore" notext="キャンセル" yestext="OK"/>
 	</notification>
 	<notification name="ConfirmClearBrowserCache">
 		トラベル、Web、検索の履歴をすべて削除しますか?
@@ -2167,10 +2199,10 @@ Web ページにリンクすると、他人がこの場所に簡単にアクセ
 		件名: [SUBJECT]、メッセージ: [MESSAGE]
 	</notification>
 	<notification name="FriendOnline">
-		[NAME] はオンライン中です
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; はオンラインです
 	</notification>
 	<notification name="FriendOffline">
-		[NAME] はオフライン中です
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; はオフラインです
 	</notification>
 	<notification name="AddSelfFriend">
 		残念ながら自分自身をフレンド登録することはできません。
@@ -2220,7 +2252,7 @@ Web ページにリンクすると、他人がこの場所に簡単にアクセ
 		親エステート間では IM を送信できません。
 	</notification>
 	<notification name="TransferInventoryAcrossParentEstates">
-		親エステート間で持ち物を移動することはできません。
+		親エステート間でインベントリを移動することはできません。
 	</notification>
 	<notification name="UnableToLoadNotecard">
 		ノートカードを読み込めません。あとで再度お試しください。
@@ -2272,7 +2304,7 @@ Web ページにリンクすると、他人がこの場所に簡単にアクセ
 		[NAME] は、あなたが渡したアイテムを受け取りました。
 	</notification>
 	<notification name="InventoryDeclined">
-		[NAME] は、持ち物の提供を断りました。
+		[NAME] は、インベントリの提供を断りました。
 	</notification>
 	<notification name="ObjectMessage">
 		[NAME]: [MESSAGE]
@@ -2284,13 +2316,15 @@ Web ページにリンクすると、他人がこの場所に簡単にアクセ
 		コーリングカードが拒否されました。
 	</notification>
 	<notification name="TeleportToLandmark">
-		画面右の「場所」パネルを開いて、「ランドマーク」タブを選ぶと、[NAME] といった場所にテレポートできます。 
-好きなランドマークをクリックして選び、次にパネル下の「テレポート」をクリックします。
-(ランドマークをダブルクリック、または右クリックして「テレポート」を選んでも同じです。)
+		[NAME] などの場所にテレポートするには、「場所」ボタンをクリックしてから、
+表示されたウィンドウで「ランドマーク」タブを選択します。ランドマークを
+いずれか 1 つ選択してから、ウィンドウ下部にある「テレポート」をクリックします。
+(この操作は、ランドマークをダブルクリックするか、右クリックして
+「テレポート」を選択して実行することもできます。)
 	</notification>
 	<notification name="TeleportToPerson">
-		画面右の「人」パネルを開いて、[NAME] といった住人に連絡を取ることができます。
-リストから住人を選択して、パネル下の「IM」をクリックします。
+		[NAME] のような住人に連絡をとるには、「人」ボタンをクリックし、表示されるウィンドウで「住人」を選択してから、
+ウィンドウ下部にある「IM」をクリックします。
 (リストの名前をダブルクリック、または右クリックして「IM」を選んでも同じです。)
 	</notification>
 	<notification name="CantSelectLandFromMultipleRegions">
@@ -2312,6 +2346,9 @@ Web ページにリンクすると、他人がこの場所に簡単にアクセ
 	<notification name="PaymentSent">
 		[MESSAGE]
 	</notification>
+	<notification name="PaymentFailure">
+		[MESSAGE]
+	</notification>
 	<notification name="EventNotification">
 		イベント通知:
 
@@ -2352,16 +2389,16 @@ Web ページにリンクすると、他人がこの場所に簡単にアクセ
 		</form>
 	</notification>
 	<notification name="OwnedObjectsReturned">
-		選択した土地の区画上にあったあなたのオブジェクトは、すべてあなたの「持ち物」に返却されました。
+		選択した土地の区画上にあったあなたのオブジェクトは、すべてあなたのインベントリに返却されました。
 	</notification>
 	<notification name="OtherObjectsReturned">
-		[NAME] が所有する、選択した区画にあるオブジェクトは、所有者の持ち物に返却されました。
+		[NAME] が所有する、選択した区画にあるオブジェクトは、所有者のインベントリに返却されました。
 	</notification>
 	<notification name="OtherObjectsReturned2">
 		「 [NAME] 」という名前の住人が所有する、選択した区画上のオブジェクトは、本人に返却されました。
 	</notification>
 	<notification name="GroupObjectsReturned">
-		選択した区画上の、[GROUPNAME] というグループと共有していたオブジェクトは、それぞれの所有者の「持ち物」に返却されました。
+		選択した区画上の、[GROUPNAME] というグループと共有していたオブジェクトは、それぞれの所有者のインベントリに返却されました。
 譲渡されていた「再販・プレゼント可」のオブジェクトは、以前の所有者に返却されました。
 グループに譲渡されていた「再販・プレゼント不可」のオブジェクトは、削除されました。
 	</notification>
@@ -2567,10 +2604,10 @@ Web ページにリンクすると、他人がこの場所に簡単にアクセ
 		</form>
 	</notification>
 	<notification name="FriendshipAccepted">
-		[NAME]は、フレンド登録を受け入れました。
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; はあなたからの友人登録リクエストを受諾しました。
 	</notification>
 	<notification name="FriendshipDeclined">
-		[NAME]は、フレンド登録を断りました。
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; はあなたからの友人登録リクエストを拒否しました。
 	</notification>
 	<notification name="FriendshipAcceptedByMe">
 		フレンドの登録依頼が承認されました。
@@ -2580,7 +2617,7 @@ Web ページにリンクすると、他人がこの場所に簡単にアクセ
 	</notification>
 	<notification name="OfferCallingCard">
 		[NAME] がコーリングカードを渡そうとしています。
-あなたの持ち物にブックマークが追加され、この住人に素早く IM を送ることができます。
+あなたのインベントリにブックマークが追加され、この住人に素早く IM を送ることができます。
 		<form name="form">
 			<button name="Accept" text="受け入れる"/>
 			<button name="Decline" text="辞退"/>
@@ -2642,16 +2679,16 @@ Web ページにリンクすると、他人がこの場所に簡単にアクセ
 		[NAME] の「&lt;nolink&gt;[TITLE]&lt;/nolink&gt;」
 [MESSAGE]
 		<form name="form">
-			<button name="Mute" text="ブロック"/>
-			<button name="Ignore" text="無視する"/>
+			<button name="Client_Side_Mute" text="ブロック"/>
+			<button name="Client_Side_Ignore" text="無視"/>
 		</form>
 	</notification>
 	<notification name="ScriptDialogGroup">
 		[GROUPNAME] の「&lt;nolink&gt;[TITLE]&lt;/nolink&gt;」
 [MESSAGE]
 		<form name="form">
-			<button name="Mute" text="ブロック"/>
-			<button name="Ignore" text="無視する"/>
+			<button name="Client_Side_Mute" text="ブロック"/>
+			<button name="Client_Side_Ignore" text="無視"/>
 		</form>
 	</notification>
 	<notification name="BuyLindenDollarSuccess">
@@ -2670,7 +2707,7 @@ M キーを押して変更します。
 	<notification name="FirstSandbox">
 		ここはサンドボックスエリアです。住人が制作を学ぶことができます。
 
-ここで制作されたものは時間が経つと削除されます。制作したアイテムを右クリックして「取る」を選び、持ち物に入れてお持ち帰りするのをお忘れなく。
+ここで制作されたものは時間が経つと削除されます。制作したアイテムを右クリックして「取る」を選び、インベントリに入れてお持ち帰りするのをお忘れなく。
 	</notification>
 	<notification name="MaxListSelectMessage">
 		このリストから [MAX_SELECT] 個までのアイテムを選択できます。
@@ -2691,7 +2728,7 @@ M キーを押して変更します。
 		[NAME] はお金を受け取り、自動的にブロックが解除されました。
 	</notification>
 	<notification name="AutoUnmuteByInventory">
-		[NAME] は持ち物を受け取り、自動的にブロックが解除されました。
+		[NAME] はインベントリを受け取り、自動的にブロックが解除されました。
 	</notification>
 	<notification name="VoiceInviteGroup">
 		[NAME] は [GROUP] のボイスチャットコールに参加しました。
@@ -2846,6 +2883,18 @@ M キーを押して変更します。
 [RESIDENTS]
 		<usetemplate name="okcancelbuttons" notext="取り消し" yestext="OK"/>
 	</notification>
+	<notification name="ShareFolderConfirmation">
+		フォルダは一度に 1 つしか共有できません。
+
+次のアイテムを共有しますか?
+
+&lt;nolink&gt;[ITEMS]&lt;/nolink&gt;
+
+次の住人と共有:
+
+[RESIDENTS]
+		<usetemplate name="okcancelbuttons" notext="取り消し" yestext="Ok"/>
+	</notification>
 	<notification name="ItemsShared">
 		アイテムが共有されました。
 	</notification>
@@ -2972,7 +3021,7 @@ M キーを押して変更します。
 		カメラの視点を変更するには、水平・垂直コントロールを使います。Escape を押すか、または歩行すると、視点がリセットされます。
 	</notification>
 	<notification label="インベントリ" name="HintInventory">
-		持ち物にはあなたのアイテムがすべて含まれます。新しく追加されたアイテムは「最新」タブに一覧表示されています。
+		インベントリにはあなたのアイテムがすべて含まれます。新しく追加されたアイテムは「最新」タブに一覧表示されています。
 	</notification>
 	<notification label="あなたのリンデンドル" name="HintLindenDollar">
 		これがあなたの L$ 残高です。リンデンドルを購入するには「L$ の購入」をクリックします。
@@ -3080,7 +3129,7 @@ M キーを押して変更します。
 		<usetemplate name="okcancelbuttons" notext="終了しない" yestext="終了"/>
 	</notification>
 	<notification label="" name="NoInventory">
-		持ち物の表示はアドバンスモードでのみ利用できます。ログアウトしてモードを変更しますか?
+		インベントリの表示はアドバンスモードでのみ利用できます。ログアウトしてモードを変更しますか?
 		<usetemplate name="okcancelbuttons" notext="終了しない" yestext="終了"/>
 	</notification>
 	<notification label="" name="NoAppearance">
diff --git a/indra/newview/skins/default/xui/ja/panel_edit_skin.xml b/indra/newview/skins/default/xui/ja/panel_edit_skin.xml
index 2c554dad94da1d16d05091e26d4098d3dc447666..7573132576bb8bc0bfbb6f271b81a3cb3a8c733d 100644
--- a/indra/newview/skins/default/xui/ja/panel_edit_skin.xml
+++ b/indra/newview/skins/default/xui/ja/panel_edit_skin.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="edit_skin_panel">
 	<panel name="avatar_skin_color_panel">
-		<texture_picker label="頭部のタトゥー" name="Head Tattoos" tool_tip="クリックして写真を選択"/>
-		<texture_picker label="上部のタトゥー" name="Upper Tattoos" tool_tip="クリックして写真を選択"/>
-		<texture_picker label="下部のタトゥー" name="Lower Tattoos" tool_tip="クリックして写真を選択"/>
+		<texture_picker label="頭" name="Head" tool_tip="クリックして写真を選択します"/>
+		<texture_picker label="上半身" name="Upper Body" tool_tip="クリックして写真を選択します"/>
+		<texture_picker label="下半身" name="Lower Body" tool_tip="クリックして写真を選択します"/>
 	</panel>
 	<panel name="accordion_panel">
 		<accordion name="wearable_accordion">
diff --git a/indra/newview/skins/default/xui/ja/panel_group_control_panel.xml b/indra/newview/skins/default/xui/ja/panel_group_control_panel.xml
index f7f575206abffaaf18d05558e0c81fb2a2d42e13..49749732c96eec279c8c310eb5ba1978359ba36a 100644
--- a/indra/newview/skins/default/xui/ja/panel_group_control_panel.xml
+++ b/indra/newview/skins/default/xui/ja/panel_group_control_panel.xml
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="panel_im_control_panel">
 	<layout_stack name="vertical_stack">
 		<layout_panel name="group_info_btn_panel">
-			<button label="グループ情報" name="group_info_btn"/>
+			<button label="グループプロフィール" name="group_info_btn"/>
 		</layout_panel>
 		<layout_panel name="call_btn_panel">
 			<button label="グループコール" name="call_btn"/>
diff --git a/indra/newview/skins/default/xui/ja/panel_group_info_sidetray.xml b/indra/newview/skins/default/xui/ja/panel_group_info_sidetray.xml
index 85406702bcc6337ceb87f4433b248e38da617e54..7aa1aec6d0e551bda507fb60cab710774d51fa3d 100644
--- a/indra/newview/skins/default/xui/ja/panel_group_info_sidetray.xml
+++ b/indra/newview/skins/default/xui/ja/panel_group_info_sidetray.xml
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="グループ情報" name="GroupInfo">
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel label="グループインベントリ" name="GroupInfo">
 	<panel.string name="default_needs_apply_text">
 		保存していない変更があります
 	</panel.string>
diff --git a/indra/newview/skins/default/xui/ja/panel_group_notices.xml b/indra/newview/skins/default/xui/ja/panel_group_notices.xml
index 96e038297554dc76f92afcdead0de681a228e983..ddad6c1f9b024d13772b9d6199a7295c41a3b3c9 100644
--- a/indra/newview/skins/default/xui/ja/panel_group_notices.xml
+++ b/indra/newview/skins/default/xui/ja/panel_group_notices.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel label="通知" name="notices_tab">
 	<panel.string name="help_text">
 		通知でメッセージを送ることができ、通知にアイテムを添付することができます。
@@ -39,10 +39,10 @@
 		<text name="string">
 			ここにアイテムをドラッグ&ドロップして添付してください:
 		</text>
-		<button label="持ち物" name="open_inventory" tool_tip="持ち物を開きます"/>
+		<button label="インベントリ" name="open_inventory" tool_tip="インベントリを開きます"/>
 		<button label="取り外す" label_selected="添付物を削除" name="remove_attachment" tool_tip="あなたの通知から添付されたアイテムを削除します"/>
 		<button label="送信" label_selected="送信" name="send_notice"/>
-		<group_drop_target name="drop_target" tool_tip="持ち物のアイテムをこのボックスにドラッグして、通知と一緒に送ります。 添付するには、そのアイテムのコピーと再販・プレゼントの権限があなたにある必要があります。"/>
+		<group_drop_target name="drop_target" tool_tip="インベントリのアイテムをこのボックスにドラッグして、通知と一緒に送ります。 添付するには、そのアイテムのコピーと再販・プレゼントの権限があなたにある必要があります。"/>
 	</panel>
 	<panel label="過去の通知を表示" name="panel_view_past_notice">
 		<text name="lbl">
diff --git a/indra/newview/skins/default/xui/ja/panel_landmarks.xml b/indra/newview/skins/default/xui/ja/panel_landmarks.xml
index e3b716c35bf7c95d95b938e532620c15b0877371..24d6ff23aedeca8dc7e2c307321fad8827a7ae31 100644
--- a/indra/newview/skins/default/xui/ja/panel_landmarks.xml
+++ b/indra/newview/skins/default/xui/ja/panel_landmarks.xml
@@ -1,9 +1,9 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="Landmarks">
 	<accordion name="landmarks_accordion">
 		<accordion_tab name="tab_favorites" title="お気に入りバー"/>
 		<accordion_tab name="tab_landmarks" title="マイ ランドマーク"/>
-		<accordion_tab name="tab_inventory" title="持ち物"/>
+		<accordion_tab name="tab_inventory" title="インベントリ"/>
 		<accordion_tab name="tab_library" title="ライブラリ"/>
 	</accordion>
 	<panel name="bottom_panel">
diff --git a/indra/newview/skins/default/xui/ja/panel_main_inventory.xml b/indra/newview/skins/default/xui/ja/panel_main_inventory.xml
index ff968696b7bb61007a35cf612da9a03281afc66d..f908262f4f0ecfb670034b8fbfd300819d080edf 100644
--- a/indra/newview/skins/default/xui/ja/panel_main_inventory.xml
+++ b/indra/newview/skins/default/xui/ja/panel_main_inventory.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel label="もの" name="main inventory panel">
 	<panel.string name="ItemcountFetching">
 		[ITEM_COUNT] 個のアイテムを取得中です... [FILTER]
@@ -9,9 +9,9 @@
 	<text name="ItemcountText">
 		アイテム:
 	</text>
-	<filter_editor label="持ち物をフィルター" name="inventory search editor"/>
+	<filter_editor label="インベントリをフィルター" name="inventory search editor"/>
 	<tab_container name="inventory filter tabs">
-		<inventory_panel label="持ち物" name="All Items"/>
+		<inventory_panel label="インベントリ" name="All Items"/>
 		<recent_inventory_panel label="最新" name="Recent Items"/>
 	</tab_container>
 	<layout_stack name="bottom_panel">
diff --git a/indra/newview/skins/default/xui/ja/panel_me.xml b/indra/newview/skins/default/xui/ja/panel_me.xml
index 896bbff0ee3abea6c5e007d7df179ff6bdc669c0..3df1ae804870c69914a595f59e64e364394e524e 100644
--- a/indra/newview/skins/default/xui/ja/panel_me.xml
+++ b/indra/newview/skins/default/xui/ja/panel_me.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel label="マイ プロフィール" name="panel_me">
-	<panel label="マイ ピック" name="panel_picks"/>
+	<panel label="マイ-ピック" name="panel_picks"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/ja/panel_my_profile.xml b/indra/newview/skins/default/xui/ja/panel_my_profile.xml
deleted file mode 100644
index a0d99ba5a8f598437ef430237b98509a8994dcca..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/ja/panel_my_profile.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="プロフィール" name="panel_profile">
-	<string name="CaptionTextAcctInfo">
-		[ACCTTYPE]
-[PAYMENTINFO] [AGEVERIFICATION]
-	</string>
-	<string name="payment_update_link_url">
-		http://www.secondlife.com/account/billing.php?lang=ja
-	</string>
-	<string name="partner_edit_link_url">
-		http://www.secondlife.com/account/billing.php?lang=ja
-	</string>
-	<string name="my_account_link_url" value="http://secondlife.com/account"/>
-	<string name="no_partner_text" value="なし"/>
-	<string name="no_group_text" value="なし"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="scroll_content_panel">
-					<panel name="second_life_image_panel">
-						<text name="display_name_descr_text">
-							ユーザー名
-						</text>
-						<text name="name_descr_text">
-							表示名
-						</text>
-						<button label="プロフィール" name="see_profile_btn" tool_tip="このアバターのプロフィールを表示"/>
-					</panel>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/ja/panel_nearby_chat.xml b/indra/newview/skins/default/xui/ja/panel_nearby_chat.xml
index aca055bb438fc1614ee41a02c6f7bd55a823b4d1..4048b48d3a59922a01be80605874bb2754b4130d 100644
--- a/indra/newview/skins/default/xui/ja/panel_nearby_chat.xml
+++ b/indra/newview/skins/default/xui/ja/panel_nearby_chat.xml
@@ -1,4 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="nearby_chat">
-	<check_box label="チャットを翻訳" name="translate_chat_checkbox"/>
+	<layout_stack name="stack">
+		<layout_panel name="translate_chat_checkbox_lp">
+			<check_box label="チャットを翻訳" name="translate_chat_checkbox"/>
+		</layout_panel>
+	</layout_stack>
 </panel>
diff --git a/indra/newview/skins/default/xui/ja/panel_notes.xml b/indra/newview/skins/default/xui/ja/panel_notes.xml
deleted file mode 100644
index aa6d823c59f0aeb4c56345c91b5ca06a12a06039..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/ja/panel_notes.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="メモとプライバシー" name="panel_notes">
-	<layout_stack name="layout">
-		<layout_panel name="notes_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<text name="status_message" value="個人的メモ:"/>
-					<text name="status_message2" value="この人に許可:"/>
-					<check_box label="オンライン状態の確認" name="status_check"/>
-					<check_box label="地図で居場所を確認" name="map_check"/>
-					<check_box label="私のオブジェクトの編集・削除・取得" name="objects_check"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-		<layout_panel name="notes_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="フレンド登録" name="add_friend" tool_tip="フレンド登録を申し出ます"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="IM" name="im" tool_tip="インスタントメッセージを開きます"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="コール" name="call" tool_tip="この住人にコールする"/>
-				</layout_panel>
-				<layout_panel name="show_on_map_btn_lp">
-					<button label="地図" name="show_on_map_btn" tool_tip="住人を地図上で表示する"/>
-				</layout_panel>
-				<layout_panel name="teleport_btn_lp">
-					<button label="テレポート" name="teleport" tool_tip="テレポートを送ります"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/ja/panel_outbox_inventory.xml b/indra/newview/skins/default/xui/ja/panel_outbox_inventory.xml
index 47f570ab86afe2a9a80f8cdd4ab2d3214749662f..1a142831134257c67698fb7ed4bb2b2a398389ca 100644
--- a/indra/newview/skins/default/xui/ja/panel_outbox_inventory.xml
+++ b/indra/newview/skins/default/xui/ja/panel_outbox_inventory.xml
@@ -1,2 +1,2 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<outbox_inventory_panel name="inventory_outbox" tool_tip="商品をここにドラッグアンドドロップすると、あなたの店頭に並びます"/>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<outbox_inventory_panel name="inventory_outbox" tool_tip="アイテムをここにドラッグアンドドロップすると、あなたの店頭に並びます"/>
diff --git a/indra/newview/skins/default/xui/ja/panel_outfit_edit.xml b/indra/newview/skins/default/xui/ja/panel_outfit_edit.xml
index 6897660214750f703e0f8efd8feb7db2b59e1e4a..e89ce0c47931297eed6ab8ae512eb5b009cb9d1b 100644
--- a/indra/newview/skins/default/xui/ja/panel_outfit_edit.xml
+++ b/indra/newview/skins/default/xui/ja/panel_outfit_edit.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <!-- Side tray Outfit Edit panel -->
 <panel label="アウトフットの編集" name="outfit_edit">
 	<string name="No Outfit" value="アウトフィットなし"/>
@@ -30,7 +30,7 @@
 					<button label="さらに追加..." name="show_add_wearables_btn" tool_tip="開く/閉じる"/>
 				</layout_panel>
 				<layout_panel name="filter_panel">
-					<filter_editor label="持ち物の着用物をフィルター" name="look_item_filter"/>
+					<filter_editor label="インベントリの着用物をフィルター" name="look_item_filter"/>
 				</layout_panel>
 			</layout_stack>
 		</layout_panel>
diff --git a/indra/newview/skins/default/xui/ja/panel_outfits_inventory.xml b/indra/newview/skins/default/xui/ja/panel_outfits_inventory.xml
index 2a0647653de25b946161213ebe6838e627800f08..93df0ba2bd41de1c9a10d640ceca1d27fe691106 100644
--- a/indra/newview/skins/default/xui/ja/panel_outfits_inventory.xml
+++ b/indra/newview/skins/default/xui/ja/panel_outfits_inventory.xml
@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel label="もの" name="Outfits">
 	<panel.string name="wear_outfit_tooltip">
 		選択したアウトフィットを着用する
 	</panel.string>
 	<panel.string name="wear_items_tooltip">
-		選択した商品を着用
+		選択したアイテムを着用
 	</panel.string>
 	<tab_container name="appearance_tabs">
 		<panel label="マイ アウトフィット" name="outfitslist_tab"/>
diff --git a/indra/newview/skins/default/xui/ja/panel_people.xml b/indra/newview/skins/default/xui/ja/panel_people.xml
index 1c90f7327eed51c75228c57a7d9594ac377363e1..88c31451b51cc1d6caf98795e094a9488f604285 100644
--- a/indra/newview/skins/default/xui/ja/panel_people.xml
+++ b/indra/newview/skins/default/xui/ja/panel_people.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <!-- Side tray panel -->
 <panel label="人" name="people_panel">
 	<string name="no_recent_people" value="最近交流した人はいません。 一緒に何かする仲間をお探しですか? [secondlife:///app/search/people 検索] か [secondlife:///app/worldmap 世界地図] をお試しください。"/>
@@ -73,7 +73,7 @@
 				<button label="コール" name="call_btn" tool_tip="この住人にコールする"/>
 			</layout_panel>
 			<layout_panel name="share_btn_lp">
-				<button label="共有" name="share_btn" tool_tip="「持ち物」のアイテムを共有する"/>
+				<button label="共有" name="share_btn" tool_tip="インベントリのアイテムを共有する"/>
 			</layout_panel>
 			<layout_panel name="teleport_btn_lp">
 				<button label="テレポート" name="teleport_btn" tool_tip="テレポートを送ります"/>
@@ -81,7 +81,7 @@
 		</layout_stack>
 		<layout_stack name="bottom_bar_ls1">
 			<layout_panel name="group_info_btn_lp">
-				<button label="グループ情報" name="group_info_btn" tool_tip="グループ情報を表示します"/>
+				<button label="グループプロフィール" name="group_info_btn" tool_tip="グループプロフィールを表示します"/>
 			</layout_panel>
 			<layout_panel name="chat_btn_lp">
 				<button label="グループチャット" name="chat_btn" tool_tip="チャットを開始します"/>
diff --git a/indra/newview/skins/default/xui/ja/panel_postcard_message.xml b/indra/newview/skins/default/xui/ja/panel_postcard_message.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b7c3f48557ef1d44001adabdf9b5a35d5999ee24
--- /dev/null
+++ b/indra/newview/skins/default/xui/ja/panel_postcard_message.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_postcard_message">
+	<text name="to_label">
+		終:
+	</text>
+	<text name="name_label">
+		始:
+	</text>
+	<text name="subject_label">
+		件名:
+	</text>
+	<line_editor label="件名をここに入力してください。" name="subject_form"/>
+	<text name="msg_label">
+		メッセージ:
+	</text>
+	<text_editor name="msg_form">
+		メッセージをここに入力してください。
+	</text_editor>
+	<button label="取り消し" name="cancel_btn"/>
+	<button label="送信" name="send_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/ja/panel_postcard_settings.xml b/indra/newview/skins/default/xui/ja/panel_postcard_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..314aaef7fd674913b3c677519b27c81ce643a0be
--- /dev/null
+++ b/indra/newview/skins/default/xui/ja/panel_postcard_settings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_postcard_settings">
+	<combo_box label="解像度" name="postcard_size_combo">
+		<combo_box.item label="現在のウィンドウ" name="CurrentWindow"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="カスタム" name="Custom"/>
+	</combo_box>
+	<layout_stack name="postcard_image_params_ls">
+		<layout_panel name="postcard_image_size_lp">
+			<spinner label="å¹…" name="postcard_snapshot_width"/>
+			<spinner label="高さ" name="postcard_snapshot_height"/>
+			<check_box label="縦横比の固定" name="postcard_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="postcard_image_format_quality_lp">
+			<slider label="画質" name="image_quality_slider"/>
+			<text name="image_quality_level">
+				([QLVL])
+			</text>
+		</layout_panel>
+	</layout_stack>
+</panel>
diff --git a/indra/newview/skins/default/xui/ja/panel_preferences_chat.xml b/indra/newview/skins/default/xui/ja/panel_preferences_chat.xml
index 1502442a06a37a65ea10256ee39921e5dc914588..75bf28a3c8bbb3b85bfd6aa96ada4dd5ec005ec0 100644
--- a/indra/newview/skins/default/xui/ja/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/ja/panel_preferences_chat.xml
@@ -29,30 +29,5 @@
 	<check_box label="IM チャット" name="EnableIMChatPopups" tool_tip="これを選択すると、インスタントメッセージを受信した際にポップアップが表示されます"/>
 	<spinner label="近くのチャットメッセージが表示される長さ:" name="nearby_toasts_lifetime"/>
 	<spinner label="近くのチャットメッセージが消えるまでの長さ:" name="nearby_toasts_fadingtime"/>
-	<check_box label="Use machine translation while chatting" name="translate_chat_checkbox"/>
-	<text name="translate_chb_label">
-		チャット中に内容を機械翻訳する
-	</text>
-	<text name="translate_language_text">
-		翻訳する言語:
-	</text>
-	<combo_box name="translate_language_combobox">
-		<combo_box.item label="システム標準" name="System Default Language"/>
-		<combo_box.item label="English(英語)" name="English"/>
-		<combo_box.item label="Dansk(デンマーク語)" name="Danish"/>
-		<combo_box.item label="Deutsch(ドイツ語)" name="German"/>
-		<combo_box.item label="Español(スペイン語)" name="Spanish"/>
-		<combo_box.item label="Français(フランス語)" name="French"/>
-		<combo_box.item label="Italiano(イタリア語)" name="Italian"/>
-		<combo_box.item label="Magyar(ハンガリー語)" name="Hungarian"/>
-		<combo_box.item label="Nederlands(オランダ語)" name="Dutch"/>
-		<combo_box.item label="Polski(ポーランド語)" name="Polish"/>
-		<combo_box.item label="Português(ポルトガル語)" name="Portugese"/>
-		<combo_box.item label="Русский(ロシア語)" name="Russian"/>
-		<combo_box.item label="Türkçe(トルコ語)" name="Turkish"/>
-		<combo_box.item label="Українська(ウクライナ語)" name="Ukrainian"/>
-		<combo_box.item label="中文 (正體) (Chinese)" name="Chinese"/>
-		<combo_box.item label="日本語" name="Japanese"/>
-		<combo_box.item label="한국어(韓国語)" name="Korean"/>
-	</combo_box>
+	<button label="チャットの翻訳設定" name="ok_btn"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/ja/panel_preferences_general.xml b/indra/newview/skins/default/xui/ja/panel_preferences_general.xml
index 1bafa52fbe1fbcc9ce2f77039e14a6028b7b6a1b..91e1514e496d38ceb43a79512c8191c846418b65 100644
--- a/indra/newview/skins/default/xui/ja/panel_preferences_general.xml
+++ b/indra/newview/skins/default/xui/ja/panel_preferences_general.xml
@@ -16,7 +16,7 @@
 		<combo_box.item label="Русский (ロシア語) - ベータ" name="Russian"/>
 		<combo_box.item label="Türkçe (トルコ語) - ベータ" name="Turkish"/>
 		<combo_box.item label="日本語 – ベータ" name="(Japanese)"/>
-		<combo_box.item label="正體中文 (中国語 - 繁体字) - ベータ" name="Traditional Chinese"/>
+		<combo_box.item label="正體中文(簡体字中国語)- ベータ版" name="Traditional Chinese"/>
 	</combo_box>
 	<text name="language_textbox2">
 		(再起動後に反映)
diff --git a/indra/newview/skins/default/xui/ja/panel_preferences_setup.xml b/indra/newview/skins/default/xui/ja/panel_preferences_setup.xml
index 7877c0495ff77b0010b8a7dd5a812644e453fb56..d90a1632ab6172cef0b93fbb1d93aeec8855bb0a 100644
--- a/indra/newview/skins/default/xui/ja/panel_preferences_setup.xml
+++ b/indra/newview/skins/default/xui/ja/panel_preferences_setup.xml
@@ -15,7 +15,7 @@
 		Web:
 	</text>
 	<radio_group name="use_external_browser">
-		<radio_item label="指定のブラウザ(IE や Firefox)を使用" name="external" tool_tip="デフォルトのシステム Web ブラウザでヘルプや Web リンク先などを見ます。全画面で起動中にはおすすめしません。" value="1"/>
+		<radio_item label="指定のブラウザ(IE や Firefox)を使用" name="external" tool_tip="デフォルトのシステム Web ブラウザでヘルプや Web リンク先などを見ます。全画面で起動中にはおすすめしません。" value="true"/>
 		<radio_item label="内蔵ブラウザを使用" name="internal" tool_tip="内蔵ブラウザでヘルプや Web リンクなどを見ます。[APP_NAME] 内に新しいウィンドウでこのブラウザが開きます。" value=""/>
 	</radio_group>
 	<check_box initial_value="true" label="プラグインを有効にする" name="browser_plugins_enabled"/>
diff --git a/indra/newview/skins/default/xui/ja/panel_profile.xml b/indra/newview/skins/default/xui/ja/panel_profile.xml
deleted file mode 100644
index 1acad9f81aa8a844fba045e1f3699bfcc20b8ba6..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/ja/panel_profile.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="プロフィール" name="panel_profile">
-	<string name="CaptionTextAcctInfo">
-		[ACCTTYPE]
-[PAYMENTINFO] [AGEVERIFICATION]
-	</string>
-	<string name="payment_update_link_url">
-		http://www.secondlife.com/account/billing.php?lang=ja-JP
-	</string>
-	<string name="partner_edit_link_url">
-		http://www.secondlife.com/account/partners.php?lang=ja
-	</string>
-	<string name="my_account_link_url" value="http://secondlife.com/my/account/index.php?lang=ja-JP"/>
-	<string name="no_partner_text" value="なし"/>
-	<string name="no_group_text" value="なし"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<panel name="second_life_image_panel">
-						<text name="title_sl_descr_text" value="[SECOND_LIFE]:"/>
-					</panel>
-					<panel name="first_life_image_panel">
-						<text name="title_rw_descr_text" value="現実世界:"/>
-					</panel>
-					<text name="title_member_text" value="住人登録:"/>
-					<text name="title_acc_status_text" value="アカウントの状態:"/>
-					<text_editor name="acc_status_text">
-						住人。 支払情報未登録。
-              リンデン。
-					</text_editor>
-					<text name="title_partner_text" value="パートナー:"/>
-					<panel name="partner_data_panel">
-						<text initial_value="(取得中)" name="partner_text"/>
-					</panel>
-					<text name="title_groups_text" value="グループ:"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-	<layout_stack name="layout_verb_buttons">
-		<layout_panel name="profile_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="フレンド登録" name="add_friend" tool_tip="フレンド登録を申し出ます"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="IM" name="im" tool_tip="インスタントメッセージを開きます"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="コール" name="call" tool_tip="この住人にコールする"/>
-				</layout_panel>
-				<layout_panel name="chat_btn_lp">
-					<button label="テレポート" name="teleport" tool_tip="テレポートを送ります"/>
-				</layout_panel>
-				<layout_panel name="overflow_btn_lp">
-					<menu_button label="▼" name="overflow_btn" tool_tip="住人にお金を渡すか持ち物を共有します"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-		<layout_panel name="profile_me_buttons_panel">
-			<button label="プロフィールの編集" name="edit_profile_btn" tool_tip="個人的な情報を編集します"/>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/ja/panel_profile_view.xml b/indra/newview/skins/default/xui/ja/panel_profile_view.xml
deleted file mode 100644
index 5cb65757731a18c1326e00fe201a6978a72b7764..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/ja/panel_profile_view.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel name="panel_target_profile">
-	<string name="status_online">
-		オンライン
-	</string>
-	<string name="status_offline">
-		オフライン
-	</string>
-	<text name="display_name_label" value="表示名:"/>
-	<text name="solo_username_label" value="ユーザー名:"/>
-	<text name="status" value="オンライン"/>
-	<text name="user_name_small" value="Jack oh look at me this is a super duper long name"/>
-	<text name="user_name" value="Jack Linden"/>
-	<button name="copy_to_clipboard" tool_tip="クリップボードにコピー"/>
-	<text name="user_label" value="ユーザー名:"/>
-	<text name="user_slid" value="jack.linden"/>
-	<tab_container name="tabs">
-		<panel label="プロフィール" name="panel_profile"/>
-		<panel label="ピック" name="panel_picks"/>
-		<panel label="メモとプライバシー" name="panel_notes"/>
-	</tab_container>
-</panel>
diff --git a/indra/newview/skins/default/xui/ja/panel_region_estate.xml b/indra/newview/skins/default/xui/ja/panel_region_estate.xml
index 5b2ef3604531412eb1ebf26db56e256b7c2f49c3..2e58c5a8f1d75d850ff23f99ee07eafc6d48363f 100644
--- a/indra/newview/skins/default/xui/ja/panel_region_estate.xml
+++ b/indra/newview/skins/default/xui/ja/panel_region_estate.xml
@@ -16,10 +16,10 @@
 		(不明)
 	</text>
 	<text name="Only Allow">
-		次のアカウントのみアクセスを許可:
+		次の住人にのみアクセスを許可:
 	</text>
-	<check_box label="支払情報登録済" name="limit_payment" tool_tip="未確認の住人の立入を禁止します"/>
-	<check_box label="年齢確認済" name="limit_age_verified" tool_tip="年齢確認を済ませていない住人の立入を禁止します。 詳しい情報は [SUPPORT_SITE] をご覧下さい。"/>
+	<check_box label="支払情情報が登録されている" name="limit_payment" tool_tip="支払情報が登録されていないと、この不動産にアクセスすることはできません。詳細については、[SUPPORT_SITE] をご覧ください。"/>
+	<check_box label="年齢確認が済んでいる" name="limit_age_verified" tool_tip="この不動産にアクセスするには、年齢確認を済ませる必要があります。詳細については、[SUPPORT_SITE] をご覧ください。"/>
 	<check_box label="ボイスチャットを許可" name="voice_chat_check"/>
 	<button label="?" name="voice_chat_help"/>
 	<text name="abuse_email_text">
diff --git a/indra/newview/skins/default/xui/ja/panel_script_ed.xml b/indra/newview/skins/default/xui/ja/panel_script_ed.xml
index 9fdd16d567c1a405da70c8ea8f66ec6322ad9e77..14d55002a386af0637085f1b4a611626aa01c8f6 100644
--- a/indra/newview/skins/default/xui/ja/panel_script_ed.xml
+++ b/indra/newview/skins/default/xui/ja/panel_script_ed.xml
@@ -22,6 +22,8 @@
 		<menu label="ファイル" name="File">
 			<menu_item_call label="保存" name="Save"/>
 			<menu_item_call label="変更を元に戻す" name="Revert All Changes"/>
+			<menu_item_call label="ファイルからロード..." name="LoadFromFile"/>
+			<menu_item_call label="ファイルに保存..." name="SaveToFile"/>
 		</menu>
 		<menu label="編集" name="Edit">
 			<menu_item_call label="元に戻す" name="Undo"/>
diff --git a/indra/newview/skins/default/xui/ja/panel_snapshot_inventory.xml b/indra/newview/skins/default/xui/ja/panel_snapshot_inventory.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e496e6602b1d2cf2a02e4e19f383c34caab8d9d4
--- /dev/null
+++ b/indra/newview/skins/default/xui/ja/panel_snapshot_inventory.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_inventory">
+	<text name="title">
+		インベントリに保存
+	</text>
+	<text name="hint_lbl">
+		画像をインベントリに保存するには L$[UPLOAD_COST] の費用がかかります。画像をテクスチャとして保存するには平方形式の 1 つを選択してください。
+	</text>
+	<combo_box label="解像度" name="texture_size_combo">
+		<combo_box.item label="現在のウィンドウ" name="CurrentWindow"/>
+		<combo_box.item label="小(128x128)" name="Small(128x128)"/>
+		<combo_box.item label="中(256x256)" name="Medium(256x256)"/>
+		<combo_box.item label="大(512x512)" name="Large(512x512)"/>
+		<combo_box.item label="カスタム" name="Custom"/>
+	</combo_box>
+	<spinner label="å¹…" name="inventory_snapshot_width"/>
+	<spinner label="高さ" name="inventory_snapshot_height"/>
+	<check_box label="縦横比の固定" name="inventory_keep_aspect_check"/>
+	<button label="取り消し" name="cancel_btn"/>
+	<button label="保存" name="save_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/ja/panel_snapshot_local.xml b/indra/newview/skins/default/xui/ja/panel_snapshot_local.xml
new file mode 100644
index 0000000000000000000000000000000000000000..cb658fb6c9af640aa74ad65d44461044ebcf3a17
--- /dev/null
+++ b/indra/newview/skins/default/xui/ja/panel_snapshot_local.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_local">
+	<text name="title">
+		コンピューターに保存
+	</text>
+	<combo_box label="解像度" name="local_size_combo">
+		<combo_box.item label="現在のウィンドウ" name="CurrentWindow"/>
+		<combo_box.item label="320x240" name="320x240"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="1280x1024" name="1280x1024"/>
+		<combo_box.item label="1600x1200" name="1600x1200"/>
+		<combo_box.item label="カスタム" name="Custom"/>
+	</combo_box>
+	<layout_stack name="local_image_params_ls">
+		<layout_panel name="local_image_size_lp">
+			<spinner label="å¹…" name="local_snapshot_width"/>
+			<spinner label="高さ" name="local_snapshot_height"/>
+			<check_box label="縦横比の固定" name="local_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="local_image_format_quality_lp">
+			<combo_box label="書式" name="local_format_combo">
+				<combo_box.item label="PNG(可逆圧縮)" name="PNG"/>
+				<combo_box.item label="JPEG" name="JPEG"/>
+				<combo_box.item label="BMP(可逆圧縮)" name="BMP"/>
+			</combo_box>
+			<slider label="画質" name="image_quality_slider"/>
+			<text name="image_quality_level">
+				([QLVL])
+			</text>
+		</layout_panel>
+	</layout_stack>
+	<button label="取り消し" name="cancel_btn"/>
+	<flyout_button label="保存" name="save_btn" tool_tip="画像をファイルに保存">
+		<flyout_button.item label="保存" name="save_item"/>
+		<flyout_button.item label="別名で保存..." name="saveas_item"/>
+	</flyout_button>
+</panel>
diff --git a/indra/newview/skins/default/xui/ja/panel_snapshot_options.xml b/indra/newview/skins/default/xui/ja/panel_snapshot_options.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c3b1cd91e7349dca8fdb254755f30ba00bdacb9e
--- /dev/null
+++ b/indra/newview/skins/default/xui/ja/panel_snapshot_options.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_options">
+	<button label="プロフィールフィードに投稿する" name="save_to_profile_btn"/>
+	<button label="メール" name="save_to_email_btn"/>
+	<button label="インベントリに保存(L$[Amount])" name="save_to_inventory_btn"/>
+	<button label="コンピューターに保存" name="save_to_computer_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/ja/panel_snapshot_postcard.xml b/indra/newview/skins/default/xui/ja/panel_snapshot_postcard.xml
new file mode 100644
index 0000000000000000000000000000000000000000..1ddd723840070afac6a8a3f983a60056e3a6bfb6
--- /dev/null
+++ b/indra/newview/skins/default/xui/ja/panel_snapshot_postcard.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_postcard">
+	<string name="default_subject">
+		[SECOND_LIFE] からのポストカードです。
+	</string>
+	<string name="default_message">
+		ぜひご覧ください!
+	</string>
+	<string name="upload_message">
+		送信中...
+	</string>
+	<text name="title">
+		メール
+	</text>
+	<button label="メッセージ" name="message_btn"/>
+	<button label="設定" name="settings_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/ja/panel_snapshot_profile.xml b/indra/newview/skins/default/xui/ja/panel_snapshot_profile.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b860a6afe91089bef433dba2b4d99cd5fc67671e
--- /dev/null
+++ b/indra/newview/skins/default/xui/ja/panel_snapshot_profile.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_profile">
+	<text name="title">
+		プロフィールフィードに投稿する
+	</text>
+	<combo_box label="解像度" name="profile_size_combo">
+		<combo_box.item label="現在のウィンドウ" name="CurrentWindow"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="カスタム" name="Custom"/>
+	</combo_box>
+	<layout_stack name="profile_image_params_ls">
+		<layout_panel name="profile_image_size_lp">
+			<spinner label="å¹…" name="profile_snapshot_width"/>
+			<spinner label="高さ" name="profile_snapshot_height"/>
+			<check_box label="縦横比の固定" name="profile_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="profile_image_metadata_lp">
+			<text name="caption_label">
+				キャプション:
+			</text>
+			<check_box initial_value="true" label="場所を含む" name="add_location_cb"/>
+		</layout_panel>
+	</layout_stack>
+	<button label="取り消し" name="cancel_btn"/>
+	<button label="投稿" name="post_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/ja/panel_status_bar.xml b/indra/newview/skins/default/xui/ja/panel_status_bar.xml
index 93689b81af778d67ab21b7d49d8c9557a3262a28..f09643d56223817b68da9a208b260e7d6dd2b830 100644
--- a/indra/newview/skins/default/xui/ja/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/ja/panel_status_bar.xml
@@ -15,10 +15,10 @@
 	<panel.string name="buycurrencylabel">
 		L$ [AMT]
 	</panel.string>
-	<panel name="balance_bg">
+	<panel left="-370" name="balance_bg" width="160">
 		<text name="balance" tool_tip="クリックして L$ 残高を更新" value="L$20"/>
 		<button label="L$ の購入" name="buyL" tool_tip="クリックして L$ を購入します"/>
-		<button label="店" name="goShop" tool_tip="Second Life マーケットプレイスを開く"/>
+		<button label="店" name="goShop" tool_tip="Second Life マーケットプレイスを開く"  width="40"/>
 	</panel>
 	<text name="TimeText" tool_tip="現在時刻(太平洋)">
 		24:00 AM PST
diff --git a/indra/newview/skins/default/xui/ja/role_actions.xml b/indra/newview/skins/default/xui/ja/role_actions.xml
index c53ad838f74390fdce9c77c8bdca4fc57d12c1d7..896ed556ae4de38d4515b216837dec531081fdd8 100644
--- a/indra/newview/skins/default/xui/ja/role_actions.xml
+++ b/indra/newview/skins/default/xui/ja/role_actions.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <role_actions>
 	<action_set description="これらの能力には、グループメンバーを追加、排除し、招待状なしに新メンバーの参加を認める権限が含まれます。" name="Membership">
 		<action description="このグループに人を招待" longdescription="「役割」セクションの「メンバー」タブ内にある「招待」ボタンを押して、このグループにメンバーを招待します。" name="member invite" value="1"/>
@@ -51,7 +51,7 @@
 		<action description="グループ所有オブジェクトの返却" longdescription="グループ所有の区画上のオブジェクトのうち、グループ所有のオブジェクトを返却するには、「土地情報」>「オブジェクト」タブを使います。" name="land return group owned" value="48"/>
 		<action description="グループに設定されているオブジェクトを返却" longdescription="グループ所有の区画上のオブジェクトのうち、グループに設定されているオブジェクトを返却するには、「土地情報」>「オブジェクト」タブを使います。" name="land return group set" value="33"/>
 		<action description="非グループオブジェクトの返却" longdescription="グループ所有の区画上のオブジェクトのうち、グループ以外のオブジェクトを返却するには、「土地情報」>「オブジェクト」タブを使います。" name="land return non group" value="34"/>
-		<action description="リンデン製の植物を使用して景観作成" longdescription="リンデン製の樹木、植物、草を植える、景観づくりの能力です。 これらの植物はあなたの持ち物内の「ライブラリ」 &gt; 「オブジェクト」フォルダにあります。「制作」メニューで作成することもできます。" name="land gardening" value="35"/>
+		<action description="リンデン製の植物を使用して景観作成" longdescription="リンデン製の樹木、植物、草を植える、景観づくりの能力です。 これらの植物はあなたのインベントリ内の「ライブラリ」 &gt; 「オブジェクト」フォルダにあります。「制作」メニューで作成することもできます。" name="land gardening" value="35"/>
 	</action_set>
 	<action_set description="これらの「能力」には、グループ所有のオブジェクトを譲渡、修正、販売する権限が含まれます。 変更は「制作ツール」 &gt; 「一般」タブで行います。 オブジェクトを右クリックして「編集」を開くと設定内容を確認できます。" name="Object Management">
 		<action description="グループにオブジェクトを譲渡" longdescription="「制作ツール」 &gt; 「一般」タブで、オブジェクトをグループに譲渡します。" name="object deed" value="36"/>
diff --git a/indra/newview/skins/default/xui/ja/sidepanel_inventory.xml b/indra/newview/skins/default/xui/ja/sidepanel_inventory.xml
index fc0293307bfa76ad2d7f6adc65a521825d325b04..51d6d48f90aad1a93597759a8ab6a3f2174d2481 100644
--- a/indra/newview/skins/default/xui/ja/sidepanel_inventory.xml
+++ b/indra/newview/skins/default/xui/ja/sidepanel_inventory.xml
@@ -2,47 +2,24 @@
 <panel label="もの" name="objects panel">
 	<panel label="" name="sidepanel__inventory_panel">
 		<layout_stack name="inventory_layout_stack">
-			<layout_panel name="inbox_outbox_layout_panel">
-				<layout_stack name="inbox_outbox_layout_stack">
-					<layout_panel name="inbox_layout_panel">
-						<panel label="" name="marketplace_inbox">
-							<string name="InboxLabelWithArg">
-								受け取った商品([NUM])
-							</string>
-							<string name="InboxLabelNoArg">
-								受け取った商品
-							</string>
-							<button label="受け取った商品" name="inbox_btn"/>
-							<text name="inbox_fresh_new_count">
-								[NUM] 個の新商品
-							</text>
-							<panel tool_tip="Drag and drop items to your inventory to manage and use them">
-								<text name="inbox_inventory_placeholder">
-									マーケットプレイスから購入した商品はここに配達されます。
-								</text>
-							</panel>
-						</panel>
-					</layout_panel>
-					<layout_panel name="outbox_layout_panel">
-						<panel label="" name="marketplace_outbox">
-							<string name="OutboxLabelWithArg">
-								マーチャントのアウトボックス ([NUM])
-							</string>
-							<string name="OutboxLabelNoArg">
-								マーチャントのアウトボックス
-							</string>
-							<button label="マーチャントのアウトボックス" name="outbox_btn"/>
-							<button label="" name="outbox_sync_btn" tool_tip="自分のマーケットプレイス店頭に移動"/>
-							<panel>
-								<panel name="outbox_inventory_placeholder_panel">
-									<text name="outbox_inventory_placeholder_title">
-										ローディング...
-									</text>
-								</panel>
-							</panel>
-						</panel>
-					</layout_panel>
-				</layout_stack>
+			<layout_panel name="inbox_layout_panel">
+				<panel label="" name="marketplace_inbox">
+					<string name="InboxLabelWithArg">
+						受け取ったアイテム([NUM])
+					</string>
+					<string name="InboxLabelNoArg">
+						受け取ったアイテム
+					</string>
+					<button label="受け取ったアイテム" name="inbox_btn"/>
+					<text name="inbox_fresh_new_count">
+						[NUM] 個の新アイテム
+					</text>
+					<panel name="inbox_inventory_placeholder_panel" tool_tip="アイテムを使用するには、そのアイテムをインベントリにドラッグアンドドロップ">
+						<text name="inbox_inventory_placeholder">
+							マーケットプレイスから購入した商品はここに配達されます。
+						</text>
+					</panel>
+				</panel>
 			</layout_panel>
 		</layout_stack>
 		<panel name="button_panel">
@@ -51,7 +28,7 @@
 					<button label="プロフィール" name="info_btn" tool_tip="オブジェクトのプロフィールを表示する"/>
 				</layout_panel>
 				<layout_panel name="share_btn_lp">
-					<button label="共有" name="share_btn" tool_tip="「持ち物」のアイテムを共有する"/>
+					<button label="共有" name="share_btn" tool_tip="インベントリのアイテムを共有する"/>
 				</layout_panel>
 				<layout_panel name="shop_btn_lp">
 					<button label="店" name="shop_btn" tool_tip="マーケットプレイスのサイトを開く"/>
diff --git a/indra/newview/skins/default/xui/ja/sidepanel_item_info.xml b/indra/newview/skins/default/xui/ja/sidepanel_item_info.xml
index d820994b59029cfa67e344219c757fe344e775b8..6931e448b312c26218ea8ebfb24059c8822be5cf 100644
--- a/indra/newview/skins/default/xui/ja/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/ja/sidepanel_item_info.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="item properties" title="アイテムのプロフィール">
 	<panel.string name="unknown">
 		(不明)
@@ -16,13 +16,13 @@
 		[year,datetime,local] [mth,datetime,local] [day,datetime,local] [wkday,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local]
 	</panel.string>
 	<panel.string name="origin_inventory">
-		(持ち物)
+		(インベントリ)
 	</panel.string>
 	<panel.string name="origin_inworld">
 		(インワールド)
 	</panel.string>
 	<text name="title" value="アイテムのプロフィール"/>
-	<text name="origin" value="(持ち物)"/>
+	<text name="origin" value="(インベントリ)"/>
 	<scroll_container name="item_profile_scroll">
 		<panel label="" name="item_profile">
 			<text name="LabelItemNameTitle">
diff --git a/indra/newview/skins/default/xui/ja/strings.xml b/indra/newview/skins/default/xui/ja/strings.xml
index f611b965020e69a1037e1fb69d3cb0d900164ced..680ef608909e84b8687a3396d92aad455f44c72f 100644
--- a/indra/newview/skins/default/xui/ja/strings.xml
+++ b/indra/newview/skins/default/xui/ja/strings.xml
@@ -181,8 +181,8 @@ http://secondlife.com/viewer-access-faq
 	</string>
 	<string name="LoginFailedPremiumOnly">
 		既にログインしているユーザーに最上のインワールド体験を提供するため、Second Life へのログインは一時的に制限されています。
-	 	
-申し訳ございませんが、有料アカウントのユーザーを優先するために、現時点のところ無料アカウントのユーザーには Second Life へのアクセスをご遠慮いただいています。
+
+申し訳ございませんが、有料アカウントのユーザーを優先するため、現在のところ無料アカウントのユーザーには Second Life へのアクセスをご遠慮いただいています。
 	</string>
 	<string name="LoginFailedComputerProhibited">
 		このパソコンからは Second Life にアクセスできません。
@@ -339,17 +339,35 @@ support@secondlife.com にお問い合わせください。
 		アイテムは 1 つだけここにドラッグできます
 	</string>
 	<string name="TooltipPrice" value="L$[AMOUNT]:"/>
+	<string name="TooltipOutboxDragToWorld">
+		マーチャントボックス内のアイテムを Rez することはできません
+	</string>
 	<string name="TooltipOutboxNoTransfer">
-		これらオブジェクトの 1 つまたは複数は、別のユーザーに売り渡したり譲渡できないものです。
+		これらオブジェクトの 1 つまたは複数は売り渡したり譲渡したりできないものです。
+	</string>
+	<string name="TooltipOutboxNotInInventory">
+		マーチャントアウトボックスでは、ご自分のインベントリからのアイテムしか受け入れることができません
 	</string>
 	<string name="TooltipOutboxWorn">
-		あなたはこれらオブジェクトの 1 つまたは複数を装着しています。アバターからそれらを取り外し、再び移動してみてください。
+		着用しているアイテムをマーチャントアウトボックスに入れることはできません
+	</string>
+	<string name="TooltipOutboxCallingCard">
+		コーリングカードをマーチャントアウトボックスに入れることはできません
 	</string>
 	<string name="TooltipOutboxFolderLevels">
-		このフォルダにあるサブフォルダの階層が多すぎます。サブフォルダは4階層以内(ルートフォルダの下にA、その下にB、その下にCという風に)にまとめ直してください。
+		ネスト入りフォルダの深さが 3 を超えています
+	</string>
+	<string name="TooltipOutboxTooManyFolders">
+		最上位フォルダ内のサブフォルダ数が 20 を超えています
 	</string>
 	<string name="TooltipOutboxTooManyObjects">
-		このフォルダには 200 個以上のオブジェクトが含まれます。商品のいつかをボックスに入れ、オブジェクト数を減らしてください。
+		最上位フォルダ内のアイテム数が 200 を超えています
+	</string>
+	<string name="TooltipDragOntoOwnChild">
+		フォルダをその子フォルダに移動することはできません
+	</string>
+	<string name="TooltipDragOntoSelf">
+		フォルダをそのフォルダ自身に移動することはできません
 	</string>
 	<string name="TooltipHttpUrl">
 		クリックしてこの Web ページを見ます
@@ -817,6 +835,9 @@ support@secondlife.com にお問い合わせください。
 	<string name="anim_yes_head">
 		頷く
 	</string>
+	<string name="multiple_textures">
+		複数
+	</string>
 	<string name="texture_loading">
 		ローディング...
 	</string>
@@ -976,6 +997,9 @@ support@secondlife.com にお問い合わせください。
 	<string name="choose_the_directory">
 		参照
 	</string>
+	<string name="script_files">
+		スクリプト
+	</string>
 	<string name="AvatarSetNotAway">
 		一時退席中解除
 	</string>
@@ -1211,70 +1235,63 @@ support@secondlife.com にお問い合わせください。
 		ここにランドマークをドラッグしてお気に入りに追加します。
 	</string>
 	<string name="InventoryNoTexture">
-		「持ち物」内にこのテクスチャのコピーがありません
+		インベントリ内にこのテクスチャのコピーがありません
 	</string>
 	<string name="InventoryInboxNoItems">
-		マーケットプレイスで購入した商品はここに配達されます。
+		マーケットプレイスで購入した商品はここに表示されます。その後、アイテムをインベントリにドラッグすれば、それらのアイテムを使用できます。
 	</string>
 	<string name="MarketplaceURL">
-		http://marketplace.[DOMAIN_NAME]
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/
 	</string>
 	<string name="MarketplaceURL_CreateStore">
-		http://marketplace.[DOMAIN_NAME]/create_store
+		http://community.secondlife.com/t5/English-Knowledge-Base/Selling-in-the-Marketplace/ta-p/700193#Section_.4
 	</string>
-	<string name="MarketplaceURL_LearnMore">
-		http://marketplace.[DOMAIN_NAME]/learn_more
-	</string>
-	<string name="InventoryOutboxCreationErrorTitle">
-		マーチャントアウトボックスが正しく設定されていません
+	<string name="MarketplaceURL_Dashboard">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/merchants/store/dashboard
 	</string>
-	<string name="InventoryOutboxCreationErrorTooltip">
-		マーチャントアウトボックスの設定エラー
+	<string name="MarketplaceURL_Imports">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/merchants/store/imports
 	</string>
-	<string name="InventoryOutboxCreationError">
-		問題を解決するにはカスタマーサービスにお問い合わせください。
+	<string name="MarketplaceURL_LearnMore">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/learn_more
 	</string>
 	<string name="InventoryOutboxNotMerchantTitle">
-		マーケットプレイスは皆の売り場です
-	</string>
-	<string name="InventoryOutboxNotMerchantTooltip">
-		あなたもマーチャントに!
+		マーケットプレイスでは誰でもアイテムを売ることができます。
 	</string>
+	<string name="InventoryOutboxNotMerchantTooltip"/>
 	<string name="InventoryOutboxNotMerchant">
-		[[MARKETPLACE_URL] Second Life マーケットプレイス] では、SL 住人が制作した商品 100 万点以上が販売されています。あなたもご自分の自信作や、あなたが購入したアイテムを商品として売ってみませんか。その手順は簡単で、セットアップは無料です。[[LEARN_MORE_URL] こちらで詳細を確かめ]、マーケットプレイスに[[CREATE_STORE_URL] ストアを作成] しましょう。
+		マーチャントになりたい方は、[[MARKETPLACE_CREATE_STORE_URL] マーケットプレイスストアを作成]する必要があります。
 	</string>
 	<string name="InventoryOutboxNoItemsTitle">
-		マーケットプレイスへの新しい出荷方法
-	</string>
-	<string name="InventoryOutboxNoItemsTooltip">
-		商品をここにドラッグアンドドロップするだけで、マーケットプレイスの売り物となります
+		アウトボックスは空です。
 	</string>
+	<string name="InventoryOutboxNoItemsTooltip"/>
 	<string name="InventoryOutboxNoItems">
-		販売する商品またはフォルダをこのエリアにドラッグします。コピー不可のアイテムでない限り、ドラッグした商品のコピーが表示されるだけで、あなたの持ち物から商品が実際に移動するわけではありません。マーケットプレイスに商品を送る準備が整ったら、「アップロード」ボタンをクリックします。商品はマーケットプレイスインベントリに移動した時点でこのフォルダから削除されます。
+		[[MARKETPLACE_DASHBOARD_URL] マーケットプレイス]に販売するアイテムを一覧するには、フォルダをこのエリアにドラッグし、「マーケットプレイスに送信」をクリックします。
 	</string>
 	<string name="Marketplace Error None">
 		エラーなし
 	</string>
 	<string name="Marketplace Error Not Merchant">
-		エラー:マーケットプレイスに商品を送る前に、あなた自身をマーチャント登録する必要があります(登録は無料です)。
+		エラー:マーケットプレイスにアイテムを送る前に、あなた自身をマーチャント登録する必要があります(登録は無料です)。
 	</string>
 	<string name="Marketplace Error Empty Folder">
 		エラー:このフォルダは空です。
 	</string>
 	<string name="Marketplace Error Unassociated Products">
-		エラー:あなたのマーチャントアカウントには、商品と無関係のアイテムが多すぎるため、このアイテムをアップロードできませんでした。このエラーを解消するには、マーケットプレイスのウェブサイトにログインし、商品に関係のないアイテム数を減らしてください。
+		エラー:あなたのマーチャントアカウントには、商品に関連付けられていないアイテムが多すぎるため、このアイテムをアップロードできませんでした。このエラーを解消するには、マーケットプレイスの Web サイトにログインし、関連付けられていないアイテムの数を減らしてください。
 	</string>
 	<string name="Marketplace Error Object Limit">
-		エラー:この商品に含まれるオブジェクトが多すぎます。オブジェクトをいくつかボックスにまとめ、オブジェクト数を200以下に減らしてください。
+		エラー:このアイテムに含まれるオブジェクトが多すぎます。オブジェクトをいくつかボックスにまとめ、オブジェクト数を200以下に減らしてください。
 	</string>
 	<string name="Marketplace Error Folder Depth">
-		エラー:この商品はネスト入りフォルダの階層が多すぎます。ネスト入りフォルダを 3 階層以内にまとめ直してください。
+		エラー:このアイテムはネスト入りフォルダの階層が多すぎます。ネスト入りフォルダを 3 階層以内にまとめ直してください。
 	</string>
 	<string name="Marketplace Error Unsellable Item">
-		エラー:この項目をマーケットプレイスで販売することはできません。
+		エラー:このアイテムをマーケットプレイスで販売することはできません。
 	</string>
 	<string name="Marketplace Error Internal Import">
-		エラー:この商品に関して問題が発生しました。しばらくしてからお試しください。
+		エラー:このアイテムに関して問題が発生しました。しばらくしてからお試しください。
 	</string>
 	<string name="Open landmarks">
 		ランドマークを開く
@@ -1323,7 +1340,7 @@ support@secondlife.com にお問い合わせください。
 	<string name="No Filters" value="いいえ "/>
 	<string name="Since Logoff" value=" - ログオフ以来"/>
 	<string name="InvFolder My Inventory">
-		持ち物
+		インベントリ
 	</string>
 	<string name="InvFolder Library">
 		ライブラリ
@@ -1356,7 +1373,7 @@ support@secondlife.com にお問い合わせください。
 		新規フォルダ
 	</string>
 	<string name="InvFolder Inventory">
-		持ち物
+		インベントリ
 	</string>
 	<string name="InvFolder Uncompressed Images">
 		圧縮されていない画像
@@ -1412,6 +1429,9 @@ support@secondlife.com にお問い合わせください。
 	<string name="no_attachments">
 		着用しているアタッチメントはありません
 	</string>
+	<string name="Attachments remain">
+		アタッチメント(残りのスロット数:[COUNT])
+	</string>
 	<string name="Buy">
 		買う
 	</string>
@@ -1538,6 +1558,12 @@ support@secondlife.com にお問い合わせください。
 	<string name="Right Pec">
 		右胸筋
 	</string>
+	<string name="Neck">
+		首
+	</string>
+	<string name="Avatar Center">
+		アバターの中央
+	</string>
 	<string name="Invalid Attachment">
 		装着先が正しくありません
 	</string>
@@ -3898,6 +3924,9 @@ www.secondlife.com から最新バージョンをダウンロードしてくだ
 	<string name="Saved_message">
 		(保存日時:[LONG_TIMESTAMP])
 	</string>
+	<string name="IM_unblock_only_groups_friends">
+		このメッセージを表示するには、「環境設定」の「プライバシー」で「フレンドとグループ以外からはコールと IM を受信しない」チェックボックスをオフにします。
+	</string>
 	<string name="answered_call">
 		相手がコールを受けました
 	</string>
@@ -3929,10 +3958,10 @@ www.secondlife.com から最新バージョンをダウンロードしてくだ
 		[AGENT_NAME] とコンファレンスする
 	</string>
 	<string name="inventory_item_offered-im">
-		持ち物アイテムを送りました
+		インベントリアイテムを送りました
 	</string>
 	<string name="share_alert">
-		持ち物からここにアイテムをドラッグします
+		インベントリからここにアイテムをドラッグします
 	</string>
 	<string name="no_session_message">
 		(IM セッションが存在しません)
@@ -4030,6 +4059,18 @@ www.secondlife.com から最新バージョンをダウンロードしてくだ
 	<string name="you_paid_ldollars_no_name">
 		L$ [AMOUNT] を支払いました:[REASON]
 	</string>
+	<string name="you_paid_failure_ldollars">
+		[NAME] に [REASON] の代金 L$ [AMOUNT] を支払えませんでした。
+	</string>
+	<string name="you_paid_failure_ldollars_no_info">
+		L$ [AMOUNT] を支払えませんでした。
+	</string>
+	<string name="you_paid_failure_ldollars_no_reason">
+		[NAME] に L$ [AMOUNT] を支払えませんでした。
+	</string>
+	<string name="you_paid_failure_ldollars_no_name">
+		[REASON] の 代金 L$ [AMOUNT] を支払えませんでした。
+	</string>
 	<string name="for item">
 		[ITEM] 向け
 	</string>
@@ -4083,7 +4124,7 @@ www.secondlife.com から最新バージョンをダウンロードしてくだ
 	</string>
 	<string name="uploading_abuse_report">
 		アップロード中...
-  
+
 嫌がらせの報告
 	</string>
 	<string name="New Shape">
@@ -4349,10 +4390,10 @@ www.secondlife.com から最新バージョンをダウンロードしてくだ
 	</string>
 	<string name="words_separator" value=","/>
 	<string name="server_is_down">
-		大変申し訳ございませんが、予期せぬ問題が発生しました。
+		大変申し訳ございませんが、予期しない問題が発生しました。
 
-	status.secondlifegrid.netで、サービスに関する既知の問題についてお調べください。
-        問題が引き続き発生する場合は、お使いのネットワークやファイアウォールの設定を確認してください。
+	サービスに関する既知の問題については、status.secondlifegrid.net をご覧ください。
+問題が引き続き発生する場合は、お使いのネットワークやファイアウォールの設定を調べてください。
 	</string>
 	<string name="dateTimeWeekdaysNames">
 		日曜日:月曜日:火曜日:水曜日:木曜日:金曜日:土曜日
@@ -4440,6 +4481,12 @@ www.secondlife.com から最新バージョンをダウンロードしてくだ
 	<string name="ExternalEditorFailedToRun">
 		外部エディターを実行できませんでした。
 	</string>
+	<string name="TranslationFailed">
+		翻訳できませんでした:[REASON]
+	</string>
+	<string name="TranslationResponseParseError">
+		翻訳の応答にエラーが発生しました。
+	</string>
 	<string name="Esc">
 		Esc
 	</string>
@@ -4798,7 +4845,7 @@ www.secondlife.com から最新バージョンをダウンロードしてくだ
 		ハウツー
 	</string>
 	<string name="Command_Inventory_Label">
-		持ち物
+		インベントリ
 	</string>
 	<string name="Command_Map_Label">
 		地図
@@ -4810,7 +4857,10 @@ www.secondlife.com から最新バージョンをダウンロードしてくだ
 		ミニマップ
 	</string>
 	<string name="Command_Move_Label">
-		移動
+		歩行 / 走行 / 飛行
+	</string>
+	<string name="Command_Outbox_Label">
+		マーチャントアウトボックス
 	</string>
 	<string name="Command_People_Label">
 		人
@@ -4837,10 +4887,10 @@ www.secondlife.com から最新バージョンをダウンロードしてくだ
 		話す
 	</string>
 	<string name="Command_View_Label">
-		視界
+		カメラコントロール
 	</string>
 	<string name="Command_Voice_Label">
-		近くのボイス
+		ボイス設定
 	</string>
 	<string name="Command_AboutLand_Tooltip">
 		訪問先に関する情報
@@ -4870,7 +4920,7 @@ www.secondlife.com から最新バージョンをダウンロードしてくだ
 		一般的タスクの実行方法
 	</string>
 	<string name="Command_Inventory_Tooltip">
-		持ち物を表示・使用
+		インベントリを表示・使用
 	</string>
 	<string name="Command_Map_Tooltip">
 		世界地図
@@ -4884,6 +4934,9 @@ www.secondlife.com から最新バージョンをダウンロードしてくだ
 	<string name="Command_Move_Tooltip">
 		アバターの移動
 	</string>
+	<string name="Command_Outbox_Tooltip">
+		販売用にアイテムをマーケットプレイスに転送
+	</string>
 	<string name="Command_People_Tooltip">
 		フレンド、グループ、近くの人
 	</string>
@@ -4912,7 +4965,16 @@ www.secondlife.com から最新バージョンをダウンロードしてくだ
 		カメラの角度を変更
 	</string>
 	<string name="Command_Voice_Tooltip">
-		ボイスチャット機能を持つ近くの人
+		インワールドでのコールや近くにいる人の音量調整
+	</string>
+	<string name="Toolbar_Bottom_Tooltip">
+		現在、下のツールバーにあります
+	</string>
+	<string name="Toolbar_Left_Tooltip">
+		現在、左のツールバーにあります
+	</string>
+	<string name="Toolbar_Right_Tooltip">
+		現在、右のツールバーにあります
 	</string>
 	<string name="Retain%">
 		維持率
@@ -4938,4 +5000,19 @@ www.secondlife.com から最新バージョンをダウンロードしてくだ
 	<string name="Normal">
 		普通
 	</string>
+	<string name="snapshot_quality_very_low">
+		非常に低い
+	</string>
+	<string name="snapshot_quality_low">
+		低
+	</string>
+	<string name="snapshot_quality_medium">
+		中
+	</string>
+	<string name="snapshot_quality_high">
+		高
+	</string>
+	<string name="snapshot_quality_very_high">
+		非常に高い
+	</string>
 </strings>
diff --git a/indra/newview/skins/default/xui/ja/teleport_strings.xml b/indra/newview/skins/default/xui/ja/teleport_strings.xml
index 04ea1c24385e8fc303e18aa99ded5dfaff22e02d..64f01f4030cde9c26968a5bc6a7eab56708cca03 100644
--- a/indra/newview/skins/default/xui/ja/teleport_strings.xml
+++ b/indra/newview/skins/default/xui/ja/teleport_strings.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <teleport_messages>
 	<message_set name="errors">
 		<message name="invalid_tport">
@@ -21,8 +21,8 @@
 もう少し後でやり直してください。
 		</message>
 		<message name="NoHelpIslandTP">
-		Welcome Islandには戻ることができません。
-「Welcome Island Public」に行き、
+			ウェルカムアイランドにテレポートで戻ることはできません。
+「Welcome Island Public」に行き再度チュートリアルを行ってください。
 		</message>
 		<message name="noaccess_tport">
 			残念ながら、そのテレポート目的地へのアクセスがありません。
@@ -45,7 +45,7 @@
 			テレポートの目的地を見つけられません。目的地が一時的に利用できない状態か、またはすでに消滅している可能性があります。数分後にやり直してください。
 		</message>
 		<message name="no_inventory_host">
-			持ち物システムは現在利用できません。
+			インベントリシステムは現在利用できません。
 		</message>
 	</message_set>
 	<message_set name="progress">
diff --git a/indra/newview/skins/default/xui/pl/floater_buy_currency.xml b/indra/newview/skins/default/xui/pl/floater_buy_currency.xml
index f2a6579dc37181eedc74074c72b4474582f42738..3e51761b37e9daa430c1dade09ba890244d50589 100644
--- a/indra/newview/skins/default/xui/pl/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/pl/floater_buy_currency.xml
@@ -46,7 +46,7 @@
 		[AMT]L$
 	</text>
 	<text name="currency_links">
-		[http://www.secondlife.com/my/account/payment_method_management.php metoda płatności] | [http://www.secondlife.com/my/account/currency.php waluta] | [http://www.secondlife.com/my/account/exchange_rates.php kurs wymiany]
+		[http://www.secondlife.com/my/account/payment_method_management.php metoda płatności] | [http://www.secondlife.com/my/account/currency.php waluta]
 	</text>
 	<text name="exchange_rate_note">
 		Wpisz ponownie kwotę aby zobaczyć ostatni kurs wymiany.
diff --git a/indra/newview/skins/default/xui/pl/floater_camera.xml b/indra/newview/skins/default/xui/pl/floater_camera.xml
index 5b9dd476160be1619e0ac4f9a28820d726ba8df5..60f3cd0fffda088f6bfaee9f83e32e0bc71deb27 100644
--- a/indra/newview/skins/default/xui/pl/floater_camera.xml
+++ b/indra/newview/skins/default/xui/pl/floater_camera.xml
@@ -9,15 +9,6 @@
 	<floater.string name="move_tooltip">
 		Poruszaj kamerą w dół/górę oraz w prawo/lewo
 	</floater.string>
-	<floater.string name="camera_modes_title">
-		Ustawienia
-	</floater.string>
-	<floater.string name="pan_mode_title">
-		W prawo lub w lewo
-	</floater.string>
-	<floater.string name="presets_mode_title">
-		Ustaw widok
-	</floater.string>
 	<floater.string name="free_mode_title">
 		Zobacz obiekt
 	</floater.string>
diff --git a/indra/newview/skins/default/xui/pl/menu_viewer.xml b/indra/newview/skins/default/xui/pl/menu_viewer.xml
index fe4662c5a2462321731258cc196ced8a5a7ded53..24c961fa2659b0096c9563329c12831a0d7d9f62 100644
--- a/indra/newview/skins/default/xui/pl/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/pl/menu_viewer.xml
@@ -20,8 +20,6 @@
 			<menu_item_call label="Tryb oddalenia" name="Set Away"/>
 			<menu_item_call label="Tryb pracy" name="Set Busy"/>
 		</menu>
-		<menu_item_call label="Zażądaj statusu administratora" name="Request Admin Options"/>
-		<menu_item_call label="Wyłącz atatus administratora" name="Leave Admin Options"/>
 		<menu_item_call label="Wyłącz [APP_NAME]" name="Quit"/>
 	</menu>
 	<menu label="Komunikacja" name="Communicate">
@@ -36,11 +34,10 @@
 		<menu_item_check label="Szukaj" name="Search"/>
 		<menu_item_call label="Zrób zdjęcie" name="Take Snapshot"/>
 		<menu_item_call label="Zapamiętaj to miejsce (LM)" name="Create Landmark Here"/>
-		<menu label="Miejsce" name="Land">
-			<menu_item_call label="Profil miejsca" name="Place Profile"/>
-			<menu_item_call label="O posiadłości" name="About Land"/>
-			<menu_item_call label="Region/MajÄ…tek" name="Region/Estate"/>
-		</menu>
+		<menu_item_separator/>
+		<menu_item_call label="Profil miejsca" name="Place Profile"/>
+		<menu_item_call label="O posiadłości" name="About Land"/>
+		<menu_item_call label="Region/MajÄ…tek" name="Region/Estate"/>
 		<menu_item_call label="Kup posiadłość" name="Buy Land"/>
 		<menu_item_call label="Moje posiadłości" name="My Land"/>
 		<menu label="Pokaż" name="LandShow">
@@ -56,7 +53,7 @@
 		</menu>
 		<menu_item_call label="Teleportuj do Miejsca Startu" name="Teleport Home"/>
 		<menu_item_call label="Ustaw Miejsce Startu" name="Set Home to Here"/>
-		<menu label="Słońce" name="Environment Settings">
+		<menu label="Słońce" name="Sun">
 			<menu_item_call label="Wschód Słońca" name="Sunrise"/>
 			<menu_item_call label="Południe" name="Noon"/>
 			<menu_item_call label="Zachód Słońca" name="Sunset"/>
@@ -119,6 +116,7 @@
 			<menu_item_call label="dźwięk (L$[COST])..." name="Upload Sound"/>
 			<menu_item_call label="animacjÄ™ (L$[COST])..." name="Upload Animation"/>
 			<menu_item_call label="zbiór plików (L$[COST] za jeden plik)..." name="Bulk Upload"/>
+			<menu_item_call label="Ustaw domyślne pozwolenia ładowania" name="perm prefs"/>
 		</menu>
 		<menu_item_call label="Cofnij" name="Undo"/>
 		<menu_item_call label="Ponów" name="Redo"/>
@@ -152,22 +150,22 @@
 			<menu_item_check label="Pokaż celownik myszki" name="ShowCrosshairs"/>
 		</menu>
 		<menu label="Rodzaje renderowania" name="Rendering Types">
-			<menu_item_check label="Podstawowe" name="Simple"/>
-			<menu_item_check label="Maska alpha" name="Alpha"/>
-			<menu_item_check label="Drzewo" name="Tree"/>
-			<menu_item_check label="Awatary" name="Character"/>
-			<menu_item_check label="PÅ‚aszczyzna powierzchni" name="SurfacePath"/>
-			<menu_item_check label="Niebo" name="Sky"/>
-			<menu_item_check label="Woda" name="Water"/>
-			<menu_item_check label="Ziemia" name="Ground"/>
-			<menu_item_check label="Głośność" name="Volume"/>
-			<menu_item_check label="Trawa" name="Grass"/>
-			<menu_item_check label="Chmury" name="Clouds"/>
-			<menu_item_check label="CzÄ…steczki" name="Particles"/>
-			<menu_item_check label="Zderzenie" name="Bump"/>
+			<menu_item_check label="Podstawowe" name="Rendering Type Simple"/>
+			<menu_item_check label="Maska alpha" name="Rendering Type Alpha"/>
+			<menu_item_check label="Drzewo" name="Rendering Type Tree"/>
+			<menu_item_check label="Awatary" name="Rendering Type Character"/>
+			<menu_item_check label="PÅ‚aszczyzna powierzchni" name="Rendering Type Surface Patch"/>
+			<menu_item_check label="Niebo" name="Rendering Type Sky"/>
+			<menu_item_check label="Woda" name="Rendering Type Water"/>
+			<menu_item_check label="Ziemia" name="Rendering Type Ground"/>
+			<menu_item_check label="Głośność" name="Rendering Type Volume"/>
+			<menu_item_check label="Trawa" name="Rendering Type Grass"/>
+			<menu_item_check label="Chmury" name="Rendering Type Clouds"/>
+			<menu_item_check label="CzÄ…steczki" name="Rendering Type Particles"/>
+			<menu_item_check label="Zderzenie" name="Rendering Type Bump"/>
 		</menu>
 		<menu label="Opcje renderowania" name="Rendering Features">
-			<menu_item_check label="UI" name="UI"/>
+			<menu_item_check label="UI" name="ToggleUI"/>
 			<menu_item_check label="Zaznaczone" name="Selected"/>
 			<menu_item_check label="Podświetlenie" name="Highlighted"/>
 			<menu_item_check label="Tekstury dynamiczne" name="Dynamic Textures"/>
@@ -179,10 +177,7 @@
 		<menu_item_call label="Wyczyść bufor danych grupy" name="ClearGroupCache"/>
 		<menu_item_check label="Wygładzanie ruchu myszki" name="Mouse Smoothing"/>
 		<menu label="Skróty" name="Shortcuts">
-			<menu_item_call label="Obraz (L$[COST])..." name="Upload Image"/>
-			<menu_item_check label="Szukaj" name="Search"/>
 			<menu_item_call label="Zwolnij klawisze" name="Release Keys"/>
-			<menu_item_call label="Domyślne ustawienia rozmiaru interfejsu" name="Set UI Size to Default"/>
 			<menu_item_check label="Pokaż menu Zaawansowane - skrót" name="Show Advanced Menu - legacy shortcut"/>
 			<menu_item_call label="Zamknij okno" name="Close Window"/>
 			<menu_item_call label="Zamknij wszystkie okna" name="Close All Windows"/>
@@ -191,13 +186,6 @@
 			<menu_item_check label="Wolna kamera" name="Joystick Flycam"/>
 			<menu_item_call label="Reset widoku" name="Reset View"/>
 			<menu_item_call label="Zobacz ostatniego rozmówcę" name="Look at Last Chatter"/>
-			<menu label="Wybierz narzędzie budowania" name="Select Tool">
-				<menu_item_call label="Narzędzie ogniskowej" name="Focus"/>
-				<menu_item_call label="Narzędzie ruchu" name="Move"/>
-				<menu_item_call label="Narzędzie edycji" name="Edit"/>
-				<menu_item_call label="Stwórz narzędzie" name="Create"/>
-				<menu_item_call label="Narzędzia posiadłości" name="Land"/>
-			</menu>
 			<menu_item_call label="Przybliż" name="Zoom In"/>
 			<menu_item_call label="Domyślne przybliżenie" name="Zoom Default"/>
 			<menu_item_call label="Oddal" name="Zoom Out"/>
@@ -266,9 +254,8 @@
 			<menu_item_call label="Upuść pakiet pamięci" name="Drop a Packet"/>
 		</menu>
 		<menu_item_call label="Zderzenia, popchnięcia &amp;  uderzenia" name="Bumps, Pushes &amp;amp; Hits"/>
-		<menu label="Åšwiat" name="World">
+		<menu label="Åšwiat" name="DevelopWorld">
 			<menu_item_check label="Domyślne ustawienia środowiska Regionu" name="Sim Sun Override"/>
-			<menu_item_check label="Efekty emiterów" name="Cheesy Beacon"/>
 			<menu_item_check label="Ustalona pogoda" name="Fixed Weather"/>
 			<menu_item_call label="Zachowaj bufor pamięci obiektów regionu" name="Dump Region Object Cache"/>
 		</menu>
@@ -290,11 +277,11 @@
 		</menu>
 		<menu label="Awatar" name="Character">
 			<menu label="Przesuń bakowaną teksturę" name="Grab Baked Texture">
-				<menu_item_call label="Tęczówka oka" name="Iris"/>
-				<menu_item_call label="GÅ‚owa" name="Head"/>
-				<menu_item_call label="Górna część ciała" name="Upper Body"/>
-				<menu_item_call label="Dolna część ciała" name="Lower Body"/>
-				<menu_item_call label="Spódnica" name="Skirt"/>
+				<menu_item_call label="Tęczówka oka" name="Grab Iris"/>
+				<menu_item_call label="GÅ‚owa" name="Grab Head"/>
+				<menu_item_call label="Górna część ciała" name="Grab Upper Body"/>
+				<menu_item_call label="Dolna część ciała" name="Grab Lower Body"/>
+				<menu_item_call label="Spódnica" name="Grab Skirt"/>
 			</menu>
 			<menu label="Testy postaci" name="Character Tests">
 				<menu_item_call label="Przesuń geometrię postaci" name="Toggle Character Geometry"/>
@@ -315,8 +302,8 @@
 		<menu_item_check label="Pokaż menu administratora" name="View Admin Options"/>
 	</menu>
 	<menu label="Administrator" name="Admin">
-		<menu label="Object">
-			<menu_item_call label="Weź kopię" name="Take Copy"/>
+		<menu label="Object" name="AdminObject">
+			<menu_item_call label="Weź kopię" name="Admin Take Copy"/>
 			<menu_item_call label="Reset właściciela" name="Force Owner To Me"/>
 			<menu_item_call label="Reset przyzwolenia właściciela" name="Force Owner Permissive"/>
 			<menu_item_call label="Usuń" name="Delete"/>
diff --git a/indra/newview/skins/default/xui/pl/notifications.xml b/indra/newview/skins/default/xui/pl/notifications.xml
index 7d3225ea317839b66700c36c29f78e301ad21ecc..019429364226712b613395ea9700cc8589a824e3 100644
--- a/indra/newview/skins/default/xui/pl/notifications.xml
+++ b/indra/newview/skins/default/xui/pl/notifications.xml
@@ -946,7 +946,7 @@ Zaproponować znajomość [NAME]?
 		</form>
 	</notification>
 	<notification name="RemoveFromFriends">
-		Czy chcesz usunąć [NAME] z listy znajomych?
+		Czy chcesz usunąć &lt;nolink&gt;[NAME]&lt;/nolink&gt; z listy znajomych?
 		<usetemplate name="okcancelbuttons" notext="Anuluj" yestext="OK"/>
 	</notification>
 	<notification name="RemoveMultipleFromFriends">
@@ -1385,7 +1385,7 @@ W celu instalacji aktualizacji musi zostać wykonany restart [APP_NAME].
 		<usetemplate ignoretext="Potwierdź zanim zwrócisz obiekty do ich właścicieli" name="okcancelignore" notext="Anuluj" yestext="OK"/>
 	</notification>
 	<notification name="GroupLeaveConfirmMember">
-		Jesteś członkiem grupy [GROUP].
+		Jesteś członkiem grupy &lt;nolink&gt;[GROUP]&lt;/nolink&gt;.
 Chcesz opuścić grupę?
 		<usetemplate name="okcancelbuttons" notext="Anuluj" yestext="OK"/>
 	</notification>
@@ -2078,10 +2078,10 @@ Zamieść go na stronie internetowej żeby umożliwić innym łatwy dostęp do t
 		Temat: [SUBJECT], Treść: [MESSAGE]
 	</notification>
 	<notification name="FriendOnline">
-		[NAME] jest w Second Life
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; jest w Second Life
 	</notification>
 	<notification name="FriendOffline">
-		[NAME] opuszcza Second Life
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; opuszcza Second Life
 	</notification>
 	<notification name="AddSelfFriend">
 		Nie możesz dodać siebie do listy znajomych.
@@ -2458,10 +2458,10 @@ Spróbuj ponowanie za kilka minut.
 		</form>
 	</notification>
 	<notification name="FriendshipAccepted">
-		Twoja propozycja znajomości została przyjęta przez [NAME].
+		Twoja propozycja znajomości została przyjęta przez &lt;nolink&gt;[NAME]&lt;/nolink&gt;.
 	</notification>
 	<notification name="FriendshipDeclined">
-		Twoja propozycja znajomości została odrzucona przez [NAME].
+		Twoja propozycja znajomości została odrzucona przez &lt;nolink&gt;[NAME]&lt;/nolink&gt;.
 	</notification>
 	<notification name="FriendshipAcceptedByMe">
 		Propozycja znajomości została zaakceptowana.
diff --git a/indra/newview/skins/default/xui/pl/panel_my_profile.xml b/indra/newview/skins/default/xui/pl/panel_my_profile.xml
deleted file mode 100644
index cdc833241d650d51815debdb80f2d59b37a65bce..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/pl/panel_my_profile.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Profil" name="panel_profile">
-	<string name="no_partner_text" value="Żadne"/>
-	<string name="no_group_text" value="Żadne"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="scroll_content_panel">
-					<panel name="second_life_image_panel">
-						<text name="display_name_descr_text">
-							Nazwa użytkownika
-						</text>
-						<text name="name_descr_text">
-							Wyświetlana nazwa
-						</text>
-						<button label="Profil" name="see_profile_btn" tool_tip="Zobacz profil tego awatara"/>
-					</panel>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_notes.xml b/indra/newview/skins/default/xui/pl/panel_notes.xml
deleted file mode 100644
index 571171d64c73f4a9eff1bda49fe5069b63410c39..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/pl/panel_notes.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Notatki &amp; Prywatność" name="panel_notes">
-	<layout_stack name="layout">
-		<layout_panel name="notes_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<text name="status_message" value="Notatki:"/>
-					<text name="status_message2" value="Pozwól tej osobie na:"/>
-					<check_box label="Widzenie mojego statusu" name="status_check"/>
-					<check_box label="Lokalizowanie mnie na mapie" name="map_check"/>
-					<check_box label="Edytowanie, kasowanie lub zabieranie moich obiektów" name="objects_check"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-		<layout_panel name="notes_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="Dodaj do Znajomych" name="add_friend" tool_tip="Zaoferuj znajomość Rezydentowi"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="IM" name="im" tool_tip="Otwórz wiadomości IM"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="Dzwoń" name="call" tool_tip="Zadzwoń do Rezydenta"/>
-				</layout_panel>
-				<layout_panel name="show_on_map_btn_lp">
-					<button label="Mapa" name="show_on_map_btn" tool_tip="Pokaż Rezydenta na mapie"/>
-				</layout_panel>
-				<layout_panel name="teleport_btn_lp">
-					<button label="Teleportuj" name="teleport" tool_tip="Teleportuj"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_profile.xml b/indra/newview/skins/default/xui/pl/panel_profile.xml
deleted file mode 100644
index 77dd951bc42b9acd8842beae2dc97ef3b5b96704..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/pl/panel_profile.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Profil" name="panel_profile">
-	<string name="no_partner_text" value="Brak"/>
-	<string name="no_group_text" value="Żadne"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<panel name="second_life_image_panel">
-						<text name="title_sl_descr_text" value="[SECOND_LIFE]:"/>
-					</panel>
-					<panel name="first_life_image_panel">
-						<text name="title_rw_descr_text" value="Życie#1:"/>
-					</panel>
-					<text name="title_member_text" value="Urodziny:"/>
-					<text name="title_acc_status_text" value="Konto:"/>
-					<text name="title_partner_text" value="Partner:"/>
-					<panel name="partner_data_panel">
-						<text initial_value="(przetwarzanie)" name="partner_text"/>
-					</panel>
-					<text name="title_groups_text" value="Grupy:"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-	<layout_stack name="layout_verb_buttons">
-		<layout_panel name="profile_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="Poznaj" name="add_friend" tool_tip="Zaproponuj znajomość Rezydentowi"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="IM" name="im" tool_tip="Otwórz wiadomości IM"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="Dzwoń" name="call" tool_tip="Zadzwoń do tego Rezydenta"/>
-				</layout_panel>
-				<layout_panel name="chat_btn_lp">
-					<button label="Teleportuj" name="teleport" tool_tip="Teleportuj"/>
-				</layout_panel>
-				<layout_panel name="overflow_btn_lp">
-					<menu_button label="▼" name="overflow_btn" tool_tip="Zapłać lub udostępnij obiekt Rezydentowi"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-		<layout_panel name="profile_me_buttons_panel">
-			<button label="Edytuj profil" name="edit_profile_btn" tool_tip="Edytuj informacje o sobie"/>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_profile_view.xml b/indra/newview/skins/default/xui/pl/panel_profile_view.xml
deleted file mode 100644
index 1fd6bc1d109140f31d380d12552cd86e9a85338f..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/pl/panel_profile_view.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel name="panel_target_profile">
-	<string name="status_online">
-		Obecnie w SL
-	</string>
-	<string name="status_offline">
-		Nieaktywny
-	</string>
-	<text name="display_name_label" value="Wyświetlana nazwa:"/>
-	<text name="solo_username_label" value="Nazwa użytkownika:"/>
-	<text name="status" value="Obecnie w SL"/>
-	<text name="user_name_small" value="Jack oh look at me this is a super duper long name"/>
-	<button name="copy_to_clipboard" tool_tip="Kopiuj do schowka"/>
-	<text name="user_label" value="Nazwa użytkownika:"/>
-	<tab_container name="tabs">
-		<panel label="PROFIL" name="panel_profile"/>
-		<panel label="ULUBIONE" name="panel_picks"/>
-		<panel label="NOTATKI &amp; PRYWATNOŚĆ" name="panel_notes"/>
-	</tab_container>
-</panel>
diff --git a/indra/newview/skins/default/xui/pl/strings.xml b/indra/newview/skins/default/xui/pl/strings.xml
index 6a8309cca52800f3e8b7fe772e92921adeedb653..f6dec8536bae4e6805f145fb49057482825528ff 100644
--- a/indra/newview/skins/default/xui/pl/strings.xml
+++ b/indra/newview/skins/default/xui/pl/strings.xml
@@ -423,6 +423,9 @@
 	<string name="symbolic folder link">
 		link folderu
 	</string>
+	<string name="AvatarEditingAppearance">
+		(Edycja WyglÄ…d)
+	</string>
 	<string name="AvatarAway">
 		Åšpi
 	</string>
diff --git a/indra/newview/skins/default/xui/pt/floater_about.xml b/indra/newview/skins/default/xui/pt/floater_about.xml
index c374264c4ad2f881fc48a4c4994ce73c7d0e5040..e843e56090b46fb7bb0df99835e6fd98ba49d316 100644
--- a/indra/newview/skins/default/xui/pt/floater_about.xml
+++ b/indra/newview/skins/default/xui/pt/floater_about.xml
@@ -65,13 +65,35 @@ Versão do servidor de voz: [VOICE_VERSION]
 		</panel>
 		<panel label="Licenças" name="licenses_panel">
 			<text_editor name="credits_editor">
-				3Dconnexion SDK Copyright (C) 1992-2007 3Dconnexion APR Copyright (C) 2000-2004 The Apache Software Foundation Collada DOM Copyright 2005 Sony Computer Entertainment Inc. cURL Copyright (C) 1996-2002, Daniel Stenberg, (daniel@haxx.se) DBus/dbus-glib Copyright (C) 2002, 2003  CodeFactory AB / Copyright (C) 2003, 2004 Red Hat, Inc. expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd. FreeType Copyright (C) 1996-2002, The FreeType Project (www.freetype.org). GL Copyright (C) 1999-2004 Brian Paul. GLOD Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University and David Luebke, Brenden Schubert, University of Virginia. google-perftools Copyright (c) 2005, Google Inc. Havok.com(TM) Copyright (C) 1999-2001, Telekinesys Research Limited. jpeg2000 Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW) jpeglib Copyright (C) 1991-1998, Thomas G. Lane. ogg/vorbis Copyright (C) 2001, Xiphophorus OpenSSL Copyright (C) 1998-2002 The OpenSSL Project. PCRE Copyright (c) 1997-2008 University of Cambridge SDL Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga SSLeay Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) xmlrpc-epi Copyright (C) 2000 Epinions, Inc. zlib Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler. google-perftools Copyright (c) 2005, Google Inc.
+				3Dconnexion SDK Copyright (C) 1992-2007 3Dconnexion
+        APR Copyright (C) 2000-2004 The Apache Software Foundation
+        Collada DOM Copyright 2005 Sony Computer Entertainment Inc.
+        cURL Copyright (C) 1996-2002, Daniel Stenberg, (daniel@haxx.se)
+        DBus/dbus-glib Copyright (C) 2002, 2003  CodeFactory AB / Copyright (C) 2003, 2004 Red Hat, Inc.
+        expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
+        FreeType Copyright (C) 1996-2002, The FreeType Project (www.freetype.org).
+        GL Copyright (C) 1999-2004 Brian Paul.
+        GLOD Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University e David Luebke, Brenden Schubert, University of Virginia.
+        google-perftools Copyright (c) 2005, Google Inc.
+        Havok.com(TM) Copyright (C) 1999-2001, Telekinesys Research Limited.
+        jpeg2000 Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW)
+        jpeglib Copyright (C) 1991-1998, Thomas G. Lane.
+        ogg/vorbis Copyright (C) 2001, Xiphophorus
+        OpenSSL Copyright (C) 1998-2002 The OpenSSL Project.
+        PCRE Copyright (c) 1997-2008 University of Cambridge
+        SDL Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
+        SSLeay Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+        xmlrpc-epi Copyright (C) 2000 Epinions, Inc.
+        zlib Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler.
+        google-perftools Copyright (c) 2005, Google Inc.
 
-O Second Life Viewer usa Havok (TM) Physics. (c)Copyright 1999-2010 Havok.com Inc. (e licenciadores). Todos os direitos reservados. Mais detalhes em www.havok.com
+        O Visualizador do Second Life usa Havok (TM) Physics. (c)Copyright 1999-2010 Havok.com Inc. (e seus Licenciantes). Todos os direitos reservados. Consulte www.havok.com para obter detalhes.
 
-Todos os direitos reservados.  Mais detalhes em licenses.txt.
+        Este software contém código fonte fornecido pela NVIDIA Corporation.
 
-Codificação do áudio de bate-papo de voz: Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C)
+        Todos os direitos reservados.  Consulte licenses.txt para obter detalhes.
+
+        Codificação de áudio da conversa com voz: Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C)
 			</text_editor>
 		</panel>
 	</tab_container>
diff --git a/indra/newview/skins/default/xui/pt/floater_about_land.xml b/indra/newview/skins/default/xui/pt/floater_about_land.xml
index cc098889942a3df2a6fe7f7647f21b0939ab08e4..cd0fb4c41bf222df311c46f23ef6359884946891 100644
--- a/indra/newview/skins/default/xui/pt/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/pt/floater_about_land.xml
@@ -130,7 +130,7 @@ Vá para o menu Mundo &gt; Sobre o terreno ou selecione outro lote para mostrar
 				Tráfego:
 			</text>
 			<text name="DwellText">
-				0
+				Carregando...
 			</text>
 			<button label="Comprar terreno..." label_selected="Comprar terreno..." left="130" name="Buy Land..." width="125"/>
 			<button label="Venda Linden" name="Linden Sale..." tool_tip="O terreno precisa ser possuído, estar com o conteúdo configurado e não estar pronto para leilão."/>
@@ -309,13 +309,15 @@ Apenas lotes maiores podem ser listados na busca.
 				Proibido empurrar (regulamento da região)
 			</panel.string>
 			<panel.string name="see_avs_text">
-				Veja e bata papo com os residentes deste terreno
+				Avatares em outros lotes podem ver
 			</panel.string>
 			<text name="allow_label">
 				Autorizar outros residentes a:
 			</text>
-			<check_box label="Editar terreno" name="edit land check" tool_tip="Se ativado, qualquer um pode modificar o terreno. É melhor deixar esta opção desativada, uma vez que você sempre pode editar seu próprio terreno."/>
-			<check_box label="Voar" name="check fly" tool_tip="Se ativado,  residentes podem voar sobre seu terreno. Se desativado, eles podem voar apenas até chegar ou sobrevoar o seu terreno."/>
+			<text name="allow_label0">
+				Voar:
+			</text>
+			<check_box label="Todos" name="check fly" tool_tip="Se ativado,  residentes podem voar sobre seu terreno. Se desativado, eles podem voar apenas até chegar ou sobrevoar o seu terreno."/>
 			<text name="allow_label2">
 				Criar objetos:
 			</text>
@@ -331,9 +333,6 @@ Apenas lotes maiores podem ser listados na busca.
 			</text>
 			<check_box label="Residentes" name="check other scripts"/>
 			<check_box label="Grupo" name="check group scripts"/>
-			<text name="land_options_label">
-				Opções do terreno:
-			</text>
 			<check_box label="Seguro (sem danos)" name="check safe" tool_tip="Se ativado, ajusta o terreno para Seguro, impedindo lutas com danos. Se não ativado, lutas com danos é habilitado."/>
 			<check_box label="Proibido empurrar" name="PushRestrictCheck" tool_tip="Evita scripts que empurram. Ativar essa opção ajuda a prevenir comportamentos desordeiros no seu terreno."/>
 			<check_box label="Mostrar terreno nos resultados de busca (L$30/semana)" name="ShowDirectoryCheck" tool_tip="Permitir que as pessoas vejam este terreno nos resultados de busca"/>
@@ -374,9 +373,9 @@ Apenas lotes maiores podem ser listados na busca.
 			</text>
 			<texture_picker label="" name="snapshot_ctrl" tool_tip="Clique para escolher uma imagem"/>
 			<text name="allow_label5">
-				Permitir que residentes de outros terrenos:
+				Avatares em outros lotes podem ver e conversar com avatares neste lote
 			</text>
-			<check_box label="Ver avatares" name="SeeAvatarsCheck" tool_tip="Permite que residentes de outros terrenos vejam e conversem com os residentes deste terreno e vice-versa."/>
+			<check_box label="Ver avatares" name="SeeAvatarsCheck" tool_tip="Permite que os avatares em outros lotes vejam e batam papo com avatares neste lote. Você poderá vê-los e conversar com eles."/>
 			<text name="landing_point">
 				Ponto de Aterrissagem: [LANDING]
 			</text>
@@ -461,12 +460,12 @@ Mídia:
 			<text name="Limit access to this parcel to:">
 				Acesso a este lote
 			</text>
-			<check_box label="Acesso para público categoria [MATURITY]" name="public_access"/>
+			<check_box label="Permitir acesso público (Desmarcar esse item cria limites)" name="public_access"/>
 			<text name="Only Allow">
-				Restringir acesso a contas confirmardas por:
+				Permitir acesso apenas para residentes que:
 			</text>
-			<check_box label="Dados de pagamento fornecidos [ESTATE_PAYMENT_LIMIT]" name="limit_payment" tool_tip="Banir residentes sem identificação."/>
-			<check_box label="Idade comprovada: [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="Banir residentes que não comprovaram a idade. Consulte o [SUPPORT_SITE] para saber mais."/>
+			<check_box label="Possuam Dados de pagamento fornecidos [ESTATE_PAYMENT_LIMIT]" name="limit_payment" tool_tip="Os residentes devem ter seus dados de pagamento cadastrados para acessar este lote.  Consulte o [SUPPORT_SITE] para saber mais."/>
+			<check_box label="Tiveram sua idade verificada [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="Os residentes devem ter a idade verificada para acessar este lote. Consulte o [SUPPORT_SITE] para saber mais."/>
 			<check_box label="Permitir acesso do grupo: [GROUP]" name="GroupCheck" tool_tip="Definir grupo na aba Geral."/>
 			<check_box label="Vender passes para:" name="PassCheck" tool_tip="Permite acesso temporário a este terreno"/>
 			<combo_box name="pass_combo">
diff --git a/indra/newview/skins/default/xui/pt/floater_animation_anim_preview.xml b/indra/newview/skins/default/xui/pt/floater_animation_anim_preview.xml
new file mode 100644
index 0000000000000000000000000000000000000000..05326d85948bf96fba298ce69d7bc50f6a59b5ee
--- /dev/null
+++ b/indra/newview/skins/default/xui/pt/floater_animation_anim_preview.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Anim Preview" title="ANIMATION.ANIM">
+	<text name="name_label">
+		Nome:
+	</text>
+	<text name="description_label">
+		Descrição:
+	</text>
+	<button label="Envio (L$[AMOUNT])" name="ok_btn"/>
+	<button label="Cancelar" label_selected="Cancelar" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/pt/floater_animation_bvh_preview.xml b/indra/newview/skins/default/xui/pt/floater_animation_bvh_preview.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5cae581045eb6dd0be3446da7a41ecdc231c1eac
--- /dev/null
+++ b/indra/newview/skins/default/xui/pt/floater_animation_bvh_preview.xml
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Animation Preview">
+	<floater.string name="failed_to_initialize">
+		Falha ao iniciar animação
+	</floater.string>
+	<floater.string name="anim_too_long">
+		O arquivo de animação possui [LENGTH] segundos de duração.
+
+A duração máxima da animação é de [MAX_LENGTH] segundos.
+	</floater.string>
+	<floater.string name="failed_file_read">
+		Não foi possível ler o arquivo de animação.
+
+[STATUS]
+	</floater.string>
+	<floater.string name="E_ST_OK">
+		Ok
+	</floater.string>
+	<floater.string name="E_ST_EOF">
+		Fim de arquivo prematuro.
+	</floater.string>
+	<floater.string name="E_ST_NO_CONSTRAINT">
+		Impossível ler definição constraint.
+	</floater.string>
+	<floater.string name="E_ST_NO_FILE">
+		Impossível abrir arquivo BVH.
+	</floater.string>
+	<floater.string name="E_ST_NO_HIER">
+		Invalid HIERARCHY header.
+	</floater.string>
+	<floater.string name="E_ST_NO_JOINT">
+		RAIZ ou JUNTA não encontrados.
+	</floater.string>
+	<floater.string name="E_ST_NO_NAME">
+		Impossível obter nome JOINT.
+	</floater.string>
+	<floater.string name="E_ST_NO_OFFSET">
+		Impossível localizar OFFSET.
+	</floater.string>
+	<floater.string name="E_ST_NO_CHANNELS">
+		Impossível localizar CHANNELS.
+	</floater.string>
+	<floater.string name="E_ST_NO_ROTATION">
+		Impossível obter ordem de rotação.
+	</floater.string>
+	<floater.string name="E_ST_NO_AXIS">
+		Impossível obter eixo de rotação.
+	</floater.string>
+	<floater.string name="E_ST_NO_MOTION">
+		Impossível localizar MOTION.
+	</floater.string>
+	<floater.string name="E_ST_NO_FRAMES">
+		Impossível determinar número de quadros.
+	</floater.string>
+	<floater.string name="E_ST_NO_FRAME_TIME">
+		Impossível determinar tempo dos quadros.
+	</floater.string>
+	<floater.string name="E_ST_NO_POS">
+		Impossível definir posicionamento.
+	</floater.string>
+	<floater.string name="E_ST_NO_ROT">
+		Impossível definir valores da rotação.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_FILE">
+		Impossível abrir arquivo de tradução.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_HEADER">
+		Impossível ler cabeçalho de tradução.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_NAME">
+		Impossível ler nomes traduzidos.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_IGNORE">
+		Impossível obter valor traduzido a ignorar.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_RELATIVE">
+		Impossível obter valor traduzido relativo.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_OUTNAME">
+		Impossível obter valor traduzido.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MATRIX">
+		Impossível ler matriz de tradução.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MERGECHILD">
+		Impossível obter nome mergechild.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MERGEPARENT">
+		Impossível obter nome mergeparent.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_PRIORITY">
+		Impossível obter valor prioritário.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_LOOP">
+		Impossível obter valor do loop.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EASEIN">
+		Impossível obter valor easeIn.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EASEOUT">
+		Impossível obter valor easeOut.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_HAND">
+		Impossível obter valor de morph da mão.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EMOTE">
+		Impossível ler nome do emote.
+	</floater.string>
+	<floater.string name="E_ST_BAD_ROOT">
+		Nome da junta incorreto, use &quot;quadril&quot;.
+	</floater.string>
+	<text name="name_label">
+		Nome:
+	</text>
+	<text name="description_label">
+		Descrição:
+	</text>
+	<spinner label="Prioridade" name="priority" tool_tip="Controla quais animações podem ser interrompidas por esta animação"/>
+	<check_box label="Loop" name="loop_check" tool_tip="Executa esta animação sem parar"/>
+	<spinner label="Dentro(%)" name="loop_in_point" tool_tip="Define o ponto em que a animação em loop reinicia"/>
+	<spinner label="Fora(%)" name="loop_out_point" tool_tip="Define o ponto em que a animação em loop acaba"/>
+	<text name="hand_label">
+		Pose das mãos
+	</text>
+	<combo_box name="hand_pose_combo" tool_tip="Controla os gestos das mãos durante a animação">
+		<combo_box.item label="Abrir" name="Spread"/>
+		<combo_box.item label="Relaxado" name="Relaxed"/>
+		<combo_box.item label="Apontar ambas" name="PointBoth"/>
+		<combo_box.item label="Punho" name="Fist"/>
+		<combo_box.item label="E relaxada" name="RelaxedLeft"/>
+		<combo_box.item label="Apontar E" name="PointLeft"/>
+		<combo_box.item label="Punho E" name="FistLeft"/>
+		<combo_box.item label="D relaxada" name="RelaxedRight"/>
+		<combo_box.item label="Apontar D" name="PointRight"/>
+		<combo_box.item label="Punho D" name="FistRight"/>
+		<combo_box.item label="Saudação D" name="SaluteRight"/>
+		<combo_box.item label="Escrevendo" name="Typing"/>
+		<combo_box.item label="Paz D" name="PeaceRight"/>
+	</combo_box>
+	<text name="emote_label">
+		Expressão
+	</text>
+	<combo_box name="emote_combo" tool_tip="Controla as expressões faciais durante a animação">
+		<item label="(nenhum)" name="[None]" value=""/>
+		<item label="Aaaaah" name="Aaaaah" value="Aaaaah"/>
+		<item label="Com medo" name="Afraid" value="Com medo"/>
+		<item label="Bravo" name="Angry" value="Bravo"/>
+		<item label="Sorriso contagiante" name="BigSmile" value="Sorriso contagiante"/>
+		<item label="À toa" name="Bored" value="À toa"/>
+		<item label="Chorar" name="Cry" value="Chorar"/>
+		<item label="Desdenho" name="Disdain" value="Desdenho"/>
+		<item label="Com vergonha" name="Embarrassed" value="Com vergonha"/>
+		<item label="Franzir testa" name="Frown" value="Franzir testa"/>
+		<item label="Beijo" name="Kiss" value="Beijo"/>
+		<item label="Rir" name="Laugh" value="Rir"/>
+		<item label="Mostrar a língua" name="Plllppt" value="Mostrar a língua"/>
+		<item label="Asco" name="Repulsed" value="Asco"/>
+		<item label="Triste" name="Sad" value="Triste"/>
+		<item label="Encolher os ombros" name="Shrug" value="Encolher os ombros"/>
+		<item label="Sorriso" name="Smile" value="Sorriso"/>
+		<item label="Surpresa" name="Surprise" value="Surpresa"/>
+		<item label="Piscar" name="Wink" value="Piscar"/>
+		<item label="Preocupado" name="Worry" value="Preocupado"/>
+	</combo_box>
+	<text name="preview_label">
+		Visualizar enquanto
+	</text>
+	<combo_box name="preview_base_anim" tool_tip="Use para testar o comportamento de sua animação enquanto seu avatar executa ações comuns.">
+		<item label="Em pé" name="Standing" value="Em pé"/>
+		<item label="Andar" name="Walking" value="Andar"/>
+		<item label="Sentado" name="Sitting" value="Sentado"/>
+		<item label="Voar" name="Flying" value="Voar"/>
+	</combo_box>
+	<spinner label="Aproximação (seg)" name="ease_in_time" tool_tip="Tempo (em segundos) da transição inicial da animação"/>
+	<spinner label="Afastamento (seg)" name="ease_out_time" tool_tip="Tempo (em segundos) da transição de saída da animação"/>
+	<button name="play_btn" tool_tip="Executar animação"/>
+	<button name="pause_btn" tool_tip="Pausar a animação"/>
+	<button name="stop_btn" tool_tip="Interromper a execução da animação"/>
+	<text name="bad_animation_text">
+		Não foi possível ler o arquivo de animação.
+
+Recomendamos que os arquivos BVH sejam exportados do Poser 4.
+	</text>
+	<button label="Envio (L$[AMOUNT])" name="ok_btn"/>
+	<button label="Cancelar" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/pt/floater_avatar.xml b/indra/newview/skins/default/xui/pt/floater_avatar.xml
index f51b76510545fd89869b2314c91fd5675c505318..168cdacae1ea4c586de670ec3503dbf6a703560f 100644
--- a/indra/newview/skins/default/xui/pt/floater_avatar.xml
+++ b/indra/newview/skins/default/xui/pt/floater_avatar.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Avatar" title="SELETOR DE AVATAR"/>
+<floater name="Avatar" title="ESCOLHA UM AVATAR"/>
diff --git a/indra/newview/skins/default/xui/pt/floater_buy_currency.xml b/indra/newview/skins/default/xui/pt/floater_buy_currency.xml
index a737212b50c4d0815489e9c4782b074747a5966f..2845a29e1da5c19a03d6c295bc2f8da3c8d43b2d 100644
--- a/indra/newview/skins/default/xui/pt/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/pt/floater_buy_currency.xml
@@ -46,7 +46,7 @@
 		L$ [AMT]
 	</text>
 	<text name="currency_links">
-		[http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] | [http://www.secondlife.com/my/account/exchange_rates.php exchange rate]
+		[http://www.secondlife.com/my/account/payment_method_management.php método de pagamento] | [http://www.secondlife.com/my/account/currency.php moeda]
 	</text>
 	<text name="exchange_rate_note">
 		Digite o valor novamente para ver o câmbio atual.
diff --git a/indra/newview/skins/default/xui/pt/floater_camera.xml b/indra/newview/skins/default/xui/pt/floater_camera.xml
index 0e4fc1b45580482fcace6ff3a914ad29e20afb2f..9cda01c187d1a0d318a93237ffbc4dc609f132be 100644
--- a/indra/newview/skins/default/xui/pt/floater_camera.xml
+++ b/indra/newview/skins/default/xui/pt/floater_camera.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="camera_floater" title="EXIBIR">
+<floater name="camera_floater" title="CONTROLES DA CÂMERA">
 	<floater.string name="rotate_tooltip">
 		Girar a Câmera ao redor do Foco
 	</floater.string>
@@ -9,15 +9,6 @@
 	<floater.string name="move_tooltip">
 		Mover a Câmera para Cima e para Baixo, para a Esquerda e para a Direita
 	</floater.string>
-	<floater.string name="camera_modes_title">
-		Modos de câmera
-	</floater.string>
-	<floater.string name="pan_mode_title">
-		Pan zoom orbital
-	</floater.string>
-	<floater.string name="presets_mode_title">
-		Ângulos predefinidos
-	</floater.string>
 	<floater.string name="free_mode_title">
 		Visualizar objeto
 	</floater.string>
diff --git a/indra/newview/skins/default/xui/pt/floater_chat_bar.xml b/indra/newview/skins/default/xui/pt/floater_chat_bar.xml
index c089ab93f2bfe73b8c48866221aecc278dfe8ff8..72016c6b40627ace932c2d865fd552350187ce6f 100644
--- a/indra/newview/skins/default/xui/pt/floater_chat_bar.xml
+++ b/indra/newview/skins/default/xui/pt/floater_chat_bar.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="chat_bar" title="BATE-PAPO LOCAL">
-	<panel>
+	<panel name="bottom_panel">
 		<line_editor label="Clique aqui para bater papo." name="chat_box" tool_tip="Tecle Enter para falar, Ctrl+Enter para gritar"/>
 		<button name="show_nearby_chat" tool_tip="Mostra/oculta o histórico do bate-papo local"/>
 	</panel>
diff --git a/indra/newview/skins/default/xui/pt/floater_hardware_settings.xml b/indra/newview/skins/default/xui/pt/floater_hardware_settings.xml
index 8c95a3b5482e6302a2000dea0a26f9951a5c81de..1bc2bce76856766925cae3862232ff10eda78943 100644
--- a/indra/newview/skins/default/xui/pt/floater_hardware_settings.xml
+++ b/indra/newview/skins/default/xui/pt/floater_hardware_settings.xml
@@ -4,7 +4,7 @@
 		Filtragem:
 	</text>
 	<check_box label="Filtragem Anisotrópica (mais lento quando habilitada)" name="ani"/>
-	<text name="Antialiasing:">
+	<text name="antialiasing label">
 		Suavização:
 	</text>
 	<combo_box label="Suavização" name="fsaa" width="94">
diff --git a/indra/newview/skins/default/xui/pt/floater_merchant_outbox.xml b/indra/newview/skins/default/xui/pt/floater_merchant_outbox.xml
new file mode 100644
index 0000000000000000000000000000000000000000..bb6113671beda020f6ba16d8a93597d04f2399c3
--- /dev/null
+++ b/indra/newview/skins/default/xui/pt/floater_merchant_outbox.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_merchant_outbox" title="CAIXA DE SAÍDA DO LOJISTA">
+	<string name="OutboxFolderCount1">
+		1 pasta
+	</string>
+	<string name="OutboxFolderCountN">
+		[NUM] pasta(s)
+	</string>
+	<string name="OutboxImporting">
+		Enviando pastas...
+	</string>
+	<string name="OutboxInitializing">
+		Iniciando...
+	</string>
+	<panel label="">
+		<panel>
+			<panel name="outbox_inventory_placeholder_panel">
+				<text name="outbox_inventory_placeholder_title">
+					Carregando...
+				</text>
+			</panel>
+		</panel>
+		<panel>
+			<button label="Enviar para Mercado" name="outbox_import_btn" tool_tip="Enviar para a Frente da loja do meu Mercado"/>
+		</panel>
+	</panel>
+</floater>
diff --git a/indra/newview/skins/default/xui/pt/floater_model_preview.xml b/indra/newview/skins/default/xui/pt/floater_model_preview.xml
index 17abe72173d5249781705899cc5411a5ca49d0f7..89605008313663e229ac6554b080686ac6b9cda3 100644
--- a/indra/newview/skins/default/xui/pt/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/pt/floater_model_preview.xml
@@ -4,6 +4,9 @@
 	<string name="status_parse_error">
 		Erro: Problema ao analisar .dae - consulte log para obter detalhes.
 	</string>
+	<string name="status_material_mismatch">
+		Erro: o material do modelo não é um subconjunto do modelo de referência.
+	</string>
 	<string name="status_reading_file">
 		Carregando...
 	</string>
diff --git a/indra/newview/skins/default/xui/pt/floater_model_wizard.xml b/indra/newview/skins/default/xui/pt/floater_model_wizard.xml
index d9195adbf9e75334cab5482e78345abfb3a012aa..0d07303c910fdd7e9b7ccb989be610ba85fda348 100644
--- a/indra/newview/skins/default/xui/pt/floater_model_wizard.xml
+++ b/indra/newview/skins/default/xui/pt/floater_model_wizard.xml
@@ -6,12 +6,12 @@
 	<button label="2. Otimizar" name="optimize_btn"/>
 	<button label="1. Selecionra arquivo" name="choose_file_btn"/>
 	<panel name="choose_file_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="choose_file_header_panel">
+			<text name="choose_file_header_text">
 				Escolher arquivo de modelo
 			</text>
 		</panel>
-		<panel name="content">
+		<panel name="choose_file_content">
 			<text name="advanced_users_text">
 				Usuários avançados: se você estiver familiarizado com ferramentas de criação de conteúdo 3D, use o Advanced Uploader.
 			</text>
@@ -20,6 +20,9 @@
 				Escolha o arquivo de modelo para upload
 			</text>
 			<button label="Procurar..." label_selected="Procurar..." name="browse"/>
+			<text name="Model types">
+				O Second Life oferece suporte a arquivos COLLADA (.dae)
+			</text>
 			<text name="dimensions">
 				X         Y         Z
 			</text>
@@ -32,15 +35,15 @@
 		</panel>
 	</panel>
 	<panel name="optimize_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="optimize_header_panel">
+			<text name="optimize_header_text">
 				Otimizar modelo
 			</text>
 		</panel>
-		<text name="description">
+		<text name="optimize_description">
 			O modelo foi ajustado para desempenho. Faça novos ajustes, se desejar.
 		</text>
-		<panel name="content">
+		<panel name="optimize_content">
 			<text name="high_detail_text">
 				Gerar nível de detalhes: Alto
 			</text>
@@ -51,7 +54,7 @@
 				Gerar nível de detalhes: Baixo
 			</text>
 			<text name="lowest_detail_text">
-				Gerar nível de detalhes: mais baixo
+				Gerar nível de detalhes: Mais baixo
 			</text>
 		</panel>
 		<panel name="content2">
@@ -76,15 +79,15 @@
 		</panel>
 	</panel>
 	<panel name="physics_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="physics_header_panel">
+			<text name="physics_header_text">
 				Ajustar físico
 			</text>
 		</panel>
-		<text name="description">
+		<text name="physics_description">
 			Criaremos uma forma para o corpo externo do modelo. Ajuste o nível de detalhes como necessário para a finalidade desejada de seu modelo.
 		</text>
-		<panel name="content">
+		<panel name="physics_content">
 			<button label="Recalcular físico" name="recalculate_physics_btn"/>
 			<button label="Recalculando..." name="recalculating_physics_btn"/>
 			<text name="lod_label">
@@ -107,12 +110,12 @@
 		</panel>
 	</panel>
 	<panel name="review_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="review_header_panel">
+			<text name="review_header_text">
 				Revisar
 			</text>
 		</panel>
-		<panel name="content">
+		<panel name="review_content">
 			<text name="review_prim_equiv">
 				Impacto no lote/região: [EQUIV] equivalentes de prim
 			</text>
@@ -125,8 +128,8 @@
 		</panel>
 	</panel>
 	<panel name="upload_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="upload_header_panel">
+			<text name="upload_header_text">
 				Upload concluído
 			</text>
 		</panel>
diff --git a/indra/newview/skins/default/xui/pt/floater_moveview.xml b/indra/newview/skins/default/xui/pt/floater_moveview.xml
index 0cb6f9a98e5895aee394f0dd2a06f353f7a98c48..728357a400fd18083ade4587bb4e22b2fa08876c 100644
--- a/indra/newview/skins/default/xui/pt/floater_moveview.xml
+++ b/indra/newview/skins/default/xui/pt/floater_moveview.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="move_floater" title="MOVER">
+<floater name="move_floater" title="ANDAR/CORRER/VOAR">
 	<string name="walk_forward_tooltip">
 		Andar para frente (flecha para cima ou W)
 	</string>
diff --git a/indra/newview/skins/default/xui/pt/floater_preview_animation.xml b/indra/newview/skins/default/xui/pt/floater_preview_animation.xml
index b650b7945c3764e30ea55a670583f7d74ab4cfba..19474d80996288a2dd7bc323a89428be56344b0a 100644
--- a/indra/newview/skins/default/xui/pt/floater_preview_animation.xml
+++ b/indra/newview/skins/default/xui/pt/floater_preview_animation.xml
@@ -6,6 +6,6 @@
 	<text name="desc txt">
 		Descrição:
 	</text>
-	<button label="Tocar inworld" label_selected="Parar" name="Anim play btn" tool_tip="Tocar essa animação de forma que outros possam ver" width="131"/>
-	<button label="Executar localmente" label_selected="Parar" left="162" name="Anim audition btn" tool_tip="Tocar essa animação de forma que apenas você possa ver" width="120"/>
+	<button label="Tocar inworld" label_selected="Parar" name="Inworld" tool_tip="Executar essa animação de forma que outros possam ver"/>
+	<button label="Tocar localmente" label_selected="Parar" name="Locally" tool_tip="Executar animação de forma que apenas você possa ver"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/pt/floater_snapshot.xml b/indra/newview/skins/default/xui/pt/floater_snapshot.xml
index d62fe3dd20ae1f3866d4448a3f19ab3b1da04a5b..4110e690686ea8185f31f255f02bd944034ca8bb 100644
--- a/indra/newview/skins/default/xui/pt/floater_snapshot.xml
+++ b/indra/newview/skins/default/xui/pt/floater_snapshot.xml
@@ -3,73 +3,63 @@
 	<floater.string name="unknown">
 		desconhecido
 	</floater.string>
-	<radio_group label="Tipo de foto" name="snapshot_type_radio">
-		<radio_item label="Email" name="postcard"/>
-		<radio_item label="Meu inventário (L$[AMOUNT])" name="texture"/>
-		<radio_item label="Salvar no meu PC" name="local"/>
-	</radio_group>
+	<string name="postcard_progress_str">
+		Enviando e-mail
+	</string>
+	<string name="profile_progress_str">
+		Postando
+	</string>
+	<string name="inventory_progress_str">
+		Salvando no inventário
+	</string>
+	<string name="local_progress_str">
+		Salvo no computador
+	</string>
+	<string name="profile_succeeded_str">
+		Imagem carregada
+	</string>
+	<string name="postcard_succeeded_str">
+		E-mail enviado!
+	</string>
+	<string name="inventory_succeeded_str">
+		Salvo no inventário!
+	</string>
+	<string name="local_succeeded_str">
+		Salvo no computador!
+	</string>
+	<string name="profile_failed_str">
+		Falha ao carregar a imagem no feed do seu perfil.
+	</string>
+	<string name="postcard_failed_str">
+		Falha ao enviar e-mail.
+	</string>
+	<string name="inventory_failed_str">
+		Falha ao salvar no inventário.
+	</string>
+	<string name="local_failed_str">
+		Falha ao salvar no computador.
+	</string>
+	<button name="advanced_options_btn" tool_tip="Opções avançadas"/>
+	<text name="image_res_text">
+		[WIDTH] x [HEIGHT] px
+	</text>
 	<text name="file_size_label">
 		[TAMANHO] KB
 	</text>
-	<button label="Atualizar a foto" name="new_snapshot_btn"/>
-	<button label="Enviar" name="send_btn"/>
-	<button label="Economize (L$[AMOUNT])" name="upload_btn"/>
-	<flyout_button label="Salvar" name="save_btn" tool_tip="Salvar imagem em um arquivo">
-		<flyout_button.item label="Salvar" name="save_item"/>
-		<flyout_button.item label="Salvar como..." name="saveas_item"/>
-	</flyout_button>
-	<button label="Mais" name="more_btn" tool_tip="Opções avançadas"/>
-	<button label="Menos" name="less_btn" tool_tip="Opções avançadas"/>
-	<button label="Cancelar" name="discard_btn"/>
-	<text name="type_label2">
-		Tamanho
-	</text>
-	<text name="format_label">
-		Formato
-	</text>
-	<combo_box label="Resolução" name="postcard_size_combo">
-		<combo_box.item label="Janela atual" name="CurrentWindow"/>
-		<combo_box.item label="640x480" name="640x480"/>
-		<combo_box.item label="800x600" name="800x600"/>
-		<combo_box.item label="1024x768" name="1024x768"/>
-		<combo_box.item label="Customizado" name="Custom"/>
-	</combo_box>
-	<combo_box label="Resolução" name="texture_size_combo">
-		<combo_box.item label="Janela atual" name="CurrentWindow"/>
-		<combo_box.item label="Pequeno (128x128)" name="Small(128x128)"/>
-		<combo_box.item label="Médio (256x256)" name="Medium(256x256)"/>
-		<combo_box.item label="Grande (512x512)" name="Large(512x512)"/>
-		<combo_box.item label="Customizado" name="Custom"/>
-	</combo_box>
-	<combo_box label="Resolução" name="local_size_combo">
-		<combo_box.item label="Janela atual" name="CurrentWindow"/>
-		<combo_box.item label="320x240" name="320x240"/>
-		<combo_box.item label="640x480" name="640x480"/>
-		<combo_box.item label="800x600" name="800x600"/>
-		<combo_box.item label="1024x768" name="1024x768"/>
-		<combo_box.item label="1280x1024" name="1280x1024"/>
-		<combo_box.item label="1600x1200" name="1600x1200"/>
-		<combo_box.item label="Customizado" name="Custom"/>
-	</combo_box>
-	<combo_box label="Formato" name="local_format_combo">
-		<combo_box.item label="PNG" name="PNG"/>
-		<combo_box.item label="JPEG" name="JPEG"/>
-		<combo_box.item label="BMP" name="BMP"/>
-	</combo_box>
-	<spinner label="Largura" name="snapshot_width"/>
-	<spinner label="Altura" name="snapshot_height"/>
-	<check_box label="Limitar proproções" name="keep_aspect_check"/>
-	<slider label="Qualidade da imagem" name="image_quality_slider"/>
-	<text name="layer_type_label">
-		Capturar:
-	</text>
-	<combo_box label="Camadas da imagem" name="layer_types">
-		<combo_box.item label="Cores" name="Colors"/>
-		<combo_box.item label="Profundidade" name="Depth"/>
-	</combo_box>
-	<check_box label="Interface" name="ui_check"/>
-	<check_box label="HUDs" name="hud_check"/>
-	<check_box label="Deixar aberto depois de salvo" name="keep_open_check"/>
-	<check_box label="Gerar quadro (tela inteira)" name="freeze_frame_check"/>
-	<check_box label="Atualizar" name="auto_snapshot_check"/>
+	<panel name="advanced_options_panel">
+		<text name="advanced_options_label">
+			OPÇÕES AVANÇADAS
+		</text>
+		<text name="layer_type_label">
+			Capturar:
+		</text>
+		<combo_box label="Camadas da imagem" name="layer_types">
+			<combo_box.item label="Cores" name="Colors"/>
+			<combo_box.item label="Profundidade" name="Depth"/>
+		</combo_box>
+		<check_box label="Interface" name="ui_check"/>
+		<check_box label="HUDs" name="hud_check"/>
+		<check_box label="Gerar quadro (tela inteira)" name="freeze_frame_check"/>
+		<check_box label="Atualização automática" name="auto_snapshot_check"/>
+	</panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/pt/floater_test_layout_stacks.xml b/indra/newview/skins/default/xui/pt/floater_test_layout_stacks.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b479d5f6d6bbc342a4c4bb9a33199290356156d9
--- /dev/null
+++ b/indra/newview/skins/default/xui/pt/floater_test_layout_stacks.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Test Floater" title="LAYOUTSTACK TESTS"/>
diff --git a/indra/newview/skins/default/xui/pt/floater_test_text_vertical_aligment.xml b/indra/newview/skins/default/xui/pt/floater_test_text_vertical_aligment.xml
new file mode 100644
index 0000000000000000000000000000000000000000..dd282bf1fce726874ada239d75b48eda59c1b07a
--- /dev/null
+++ b/indra/newview/skins/default/xui/pt/floater_test_text_vertical_aligment.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Test Floater" title="JANELA DE TESTE"/>
diff --git a/indra/newview/skins/default/xui/pt/floater_tools.xml b/indra/newview/skins/default/xui/pt/floater_tools.xml
index f35f31f5f7e067996887a72ec1865372a4287a02..4b318336021dba31ac55a5f5eb05f935131dc19c 100644
--- a/indra/newview/skins/default/xui/pt/floater_tools.xml
+++ b/indra/newview/skins/default/xui/pt/floater_tools.xml
@@ -1,5 +1,20 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="toolbox floater" short_title="BUILD TOOLS" title="">
+	<floater.string name="grid_screen_text">
+		Tela
+	</floater.string>
+	<floater.string name="grid_local_text">
+		Local
+	</floater.string>
+	<floater.string name="grid_world_text">
+		Mundo
+	</floater.string>
+	<floater.string name="grid_reference_text">
+		Referência
+	</floater.string>
+	<floater.string name="grid_attachment_text">
+		Anexo
+	</floater.string>
 	<floater.string name="status_rotate">
 		Arrastar as faixas coloridas para girar o objeto
 	</floater.string>
@@ -63,7 +78,12 @@
 	</text>
 	<check_box initial_value="true" label="Esticar texturas" name="checkbox stretch textures"/>
 	<check_box initial_value="true" label="Ajustar" name="checkbox snap to grid"/>
-	<button label="Opções..." label_selected="Opções..." name="Options..." tool_tip="Mais opções de grade"/>
+	<combo_box name="combobox grid mode" tool_tip="Selecione o tipo de régua da grade onde o objeto será colocado">
+		<combo_box.item label="Mundo" name="World"/>
+		<combo_box.item label="Local" name="Local"/>
+		<combo_box.item label="Referência" name="Reference"/>
+	</combo_box>
+	<button label="" label_selected="Opções..." name="Options..." tool_tip="Mais opções de grade"/>
 	<button label="" label_selected="" name="ToolCube" tool_tip="Cubo"/>
 	<button label="" label_selected="" name="ToolPrism" tool_tip="Prisma"/>
 	<button label="" label_selected="" name="ToolPyramid" tool_tip="Pirâmide"/>
diff --git a/indra/newview/skins/default/xui/pt/floater_toybox.xml b/indra/newview/skins/default/xui/pt/floater_toybox.xml
index 67076beb0f785f00f038bade5b3a4435e9320fd1..3677c3b1f5523b308d9f9b8b51ca84087626825f 100644
--- a/indra/newview/skins/default/xui/pt/floater_toybox.xml
+++ b/indra/newview/skins/default/xui/pt/floater_toybox.xml
@@ -1,10 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Toybox" title="PERSONALIZAR BARRAS DE FERRAMENTA">
+<floater name="Toybox" title="BOTÕES DA BARRA DE FERRAMENTAS">
 	<text name="toybox label 1">
 		Adicione ou remova botões arrastando-os para dentro ou para fora das barras de ferramentas.
 	</text>
 	<text name="toybox label 2">
 		Os botões aparecerão como mostrado ou somente como ícone, dependendo das configurações de cada barra de ferramentas.
 	</text>
+	<button label="Limpar todas as barras de ferramentas" label_selected="Limpar todas as barras de ferramentas" name="btn_clear_all"/>
 	<button label="Restaurar padrão" label_selected="Restaurar padrão" name="btn_restore_defaults"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/pt/floater_translation_settings.xml b/indra/newview/skins/default/xui/pt/floater_translation_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..1955599a8182244d8ac8c7e966fbdcf1c10fffbc
--- /dev/null
+++ b/indra/newview/skins/default/xui/pt/floater_translation_settings.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_translation_settings" title="CONFIGURAÇÕES DE TRADUÇÃO DE BATE-PAPO">
+	<string name="bing_api_key_not_verified">
+		appID do Bing não verificada. Tente novamente.
+	</string>
+	<string name="google_api_key_not_verified">
+		Chave do API do Google não verificada. Tente novamente.
+	</string>
+	<string name="bing_api_key_verified">
+		appID do Bing verificada.
+	</string>
+	<string name="google_api_key_verified">
+		Chave do API do Google verificada.
+	</string>
+	<check_box label="Permitir a tradução de máquina durante o bate-papo" name="translate_chat_checkbox"/>
+	<text name="translate_language_label">
+		Traduzir bate-papo para:
+	</text>
+	<combo_box name="translate_language_combo">
+		<combo_box.item label="Padrão" name="System Default Language"/>
+		<combo_box.item label="Inglês" name="English"/>
+		<combo_box.item label="Dansk (Dinamarquês)" name="Danish"/>
+		<combo_box.item label="Deutsch (Alemão)" name="German"/>
+		<combo_box.item label="Español (Espanhol)" name="Spanish"/>
+		<combo_box.item label="Français (Francês)" name="French"/>
+		<combo_box.item label="Italiano (Italiano)" name="Italian"/>
+		<combo_box.item label="Magyar (Húngaro)" name="Hungarian"/>
+		<combo_box.item label="Nederlands (Holandês)" name="Dutch"/>
+		<combo_box.item label="Polski (Polonês)" name="Polish"/>
+		<combo_box.item label="Português (Português)" name="Portugese"/>
+		<combo_box.item label="Русский (Russo)" name="Russian"/>
+		<combo_box.item label="Türkçe (Turco)" name="Turkish"/>
+		<combo_box.item label="Українська (Ucraniano)" name="Ukrainian"/>
+		<combo_box.item label="中文 (简体) (Chinês)" name="Chinese"/>
+		<combo_box.item label="日本語 (Japonês)" name="Japanese"/>
+		<combo_box.item label="한국어 (Coreano)" name="Korean"/>
+	</combo_box>
+	<text name="tip">
+		Escolha o serviço de tradução:
+	</text>
+	<radio_group name="translation_service_rg">
+		<radio_item initial_value="bing" label="Bing Translator" name="bing"/>
+		<radio_item initial_value="google" label="Google Translate" name="google"/>
+	</radio_group>
+	<text name="bing_api_key_label">
+		[http://www.bing.com/developers/createapp.aspx AppID] do Bing:
+	</text>
+	<button label="Verificar" name="verify_bing_api_key_btn"/>
+	<text name="google_api_key_label">
+		[http://code.google.com/apis/language/translate/v2/getting_started.html#auth Chave API] do Google:
+	</text>
+	<button label="Verificar" name="verify_google_api_key_btn"/>
+	<text name="google_links_text">
+		[http://code.google.com/apis/language/translate/v2/pricing.html Preços] | [https://code.google.com/apis/console Estatísticas]
+	</text>
+	<button label="OK" name="ok_btn"/>
+	<button label="Cancelar" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/pt/floater_voice_controls.xml b/indra/newview/skins/default/xui/pt/floater_voice_controls.xml
index 61324790410ddb5fd04f620363821fc6bcbb9942..745a7d0e00bb4ef6993fb69a43ecfbccb63d2a5a 100644
--- a/indra/newview/skins/default/xui/pt/floater_voice_controls.xml
+++ b/indra/newview/skins/default/xui/pt/floater_voice_controls.xml
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="floater_voice_controls" title="CONTROLES DE VOZ">
 	<string name="title_nearby">
-		Voz próxima
+		CONFIGURAÇÕES DE VOZ
 	</string>
 	<string name="title_group">
-		Ligação de grupo com [GROUP]
+		LIGAÇÃO DE GRUPO COM [GROUP]
 	</string>
 	<string name="title_adhoc">
-		Teleconferência
+		TELECONFERÊNCIA
 	</string>
 	<string name="title_peer_2_peer">
-		Ligação para [NAME]
+		LIGAÇÃO PARA [NAME]
 	</string>
 	<string name="no_one_near">
 		Ninguém por perto ativou a voz
diff --git a/indra/newview/skins/default/xui/pt/floater_voice_effect.xml b/indra/newview/skins/default/xui/pt/floater_voice_effect.xml
index 4f01600d9fce4f8d65c8afb6f469407776baa9cc..b29ca3d699fff88bb9221975865bcf138fce9a10 100644
--- a/indra/newview/skins/default/xui/pt/floater_voice_effect.xml
+++ b/indra/newview/skins/default/xui/pt/floater_voice_effect.xml
@@ -42,13 +42,16 @@
 	<string name="effect_Demon">
 		Demônio
 	</string>
+	<string name="effect_Female Elf">
+		Elfa
+	</string>
 	<string name="effect_Flirty">
 		Paquerador
 	</string>
 	<string name="effect_Foxy">
 		Sensual
 	</string>
-	<string name="effect_Halloween_2010_Bonus">
+	<string name="effect_Halloween 2010 Bonus">
 		Bônus_Halloween_2010
 	</string>
 	<string name="effect_Helium">
@@ -57,9 +60,18 @@
 	<string name="effect_Husky">
 		Rouco
 	</string>
+	<string name="effect_Husky Whisper">
+		Sussurro rouco
+	</string>
 	<string name="effect_Intercom">
 		Interfone
 	</string>
+	<string name="effect_Julia">
+		Julia
+	</string>
+	<string name="effect_Lo Lilt">
+		Cantarolado baixo
+	</string>
 	<string name="effect_Macho">
 		Macho
 	</string>
@@ -69,6 +81,9 @@
 	<string name="effect_Mini">
 		Mini
 	</string>
+	<string name="effect_Model">
+		Modelo
+	</string>
 	<string name="effect_Nano">
 		Nano
 	</string>
@@ -90,6 +105,9 @@
 	<string name="effect_Roxanne">
 		Roxanne
 	</string>
+	<string name="effect_Rumble">
+		Ronco
+	</string>
 	<string name="effect_Sabrina">
 		Sabrina
 	</string>
@@ -102,6 +120,9 @@
 	<string name="effect_Shorty">
 		Baixinho
 	</string>
+	<string name="effect_Smaller">
+		Menor
+	</string>
 	<string name="effect_Sneaky">
 		Sorrateiro
 	</string>
diff --git a/indra/newview/skins/default/xui/pt/inspect_avatar.xml b/indra/newview/skins/default/xui/pt/inspect_avatar.xml
index a199c58c152ebbe58c9ad5de78a8044ff1d85f6b..19244d9b279d8f4c437afca929c420ba3db3d0f0 100644
--- a/indra/newview/skins/default/xui/pt/inspect_avatar.xml
+++ b/indra/newview/skins/default/xui/pt/inspect_avatar.xml
@@ -5,10 +5,10 @@
 -->
 <floater name="inspect_avatar">
 	<string name="Subtitle">
-		[IDADE]
+		[AGE]
 	</string>
 	<string name="Details">
-		[PERFIL_SL]
+		[SL_PROFILE]
 	</string>
 	<text name="user_details">
 		This is my second life description and I really think it is great. But for some reason my description is super extra long because I like to talk a whole lot
diff --git a/indra/newview/skins/default/xui/pt/menu_inspect_object_gear.xml b/indra/newview/skins/default/xui/pt/menu_inspect_object_gear.xml
index 184db26538def0c429cf94c9c994e7f4f9ada8db..7e271904e9caa7d5958eeda89fc0b7aa7734ddd4 100644
--- a/indra/newview/skins/default/xui/pt/menu_inspect_object_gear.xml
+++ b/indra/newview/skins/default/xui/pt/menu_inspect_object_gear.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<menu name="Gear Menu">
+<toggleable_menu name="Gear Menu">
 	<menu_item_call label="Tocar" name="touch"/>
 	<menu_item_call label="Sentar" name="sit"/>
 	<menu_item_call label="Pagar" name="pay"/>
@@ -12,7 +12,8 @@
 	<menu_item_call label="Adicionar" name="add"/>
 	<menu_item_call label="Denunciar" name="report"/>
 	<menu_item_call label="Bloquear" name="block"/>
+	<menu_item_call label="Desbloquear" name="unblock"/>
 	<menu_item_call label="Mais zoom" name="zoom_in"/>
 	<menu_item_call label="Tirar" name="remove"/>
 	<menu_item_call label="Mais informações" name="more_info"/>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/pt/menu_inventory.xml b/indra/newview/skins/default/xui/pt/menu_inventory.xml
index ba3879b5a160fbe6ec52990367623a3803bf47e4..09e1fbf72ea8d5dc97c8dae88fff93f40f0446d5 100644
--- a/indra/newview/skins/default/xui/pt/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/pt/menu_inventory.xml
@@ -59,6 +59,7 @@
 	<menu_item_call label="Propriedades" name="Properties"/>
 	<menu_item_call label="Renomear" name="Rename"/>
 	<menu_item_call label="Copiar item UUID" name="Copy Asset UUID"/>
+	<menu_item_call label="Cortar" name="Cut"/>
 	<menu_item_call label="Copiar" name="Copy"/>
 	<menu_item_call label="Colar" name="Paste"/>
 	<menu_item_call label="Colar como link" name="Paste As Link"/>
@@ -84,6 +85,6 @@
 	<menu_item_call label="Adicionar" name="Wearable Add"/>
 	<menu_item_call label="Tirar" name="Take Off"/>
 	<menu_item_call label="Copiar para Caixa de saída do lojista" name="Merchant Copy"/>
-	<menu_item_call label="Mover para Caixa de saída do lojista" name="Merchant Move"/>
+	<menu_item_call label="Enviar para Mercado" name="Marketplace Send"/>
 	<menu_item_call label="--Sem opções--" name="--no options--"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pt/menu_login.xml b/indra/newview/skins/default/xui/pt/menu_login.xml
index 94195f1b8c5c42a4e0681c9518a93c58d121bc8d..be94ad49dbeba0f08598de1764b9f4cb3e583f26 100644
--- a/indra/newview/skins/default/xui/pt/menu_login.xml
+++ b/indra/newview/skins/default/xui/pt/menu_login.xml
@@ -16,8 +16,8 @@
 		<menu_item_call label="Definir tamanho da janela:" name="Set Window Size..."/>
 		<menu_item_call label="Mostrar TOS" name="TOS"/>
 		<menu_item_call label="Mostrar mensagem crítica" name="Critical"/>
-		<menu_item_call label="Teste de mídia do navegador" name="Web Browser Test"/>
 		<menu_item_call label="Test de Bugs de Conteúdo Web" name="Web Content Floater Debug Test"/>
+		<menu label="Configurar nível de registro em log" name="Set Logging Level"/>
 		<menu_item_check label="Exibir seletor da grade" name="Show Grid Picker"/>
 		<menu_item_call label="Exibir painel de notificações" name="Show Notifications Console"/>
 	</menu>
diff --git a/indra/newview/skins/default/xui/pt/menu_toolbars.xml b/indra/newview/skins/default/xui/pt/menu_toolbars.xml
index f1e41aaea970c98384c54bbb8e4b9912995a2c7e..b58a1a6e4f5775c1031b8ac2889aed5e4a2fe1fd 100644
--- a/indra/newview/skins/default/xui/pt/menu_toolbars.xml
+++ b/indra/newview/skins/default/xui/pt/menu_toolbars.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Toolbars Popup">
-	<menu_item_call label="Escolher botões..." name="Chose Buttons"/>
+	<menu_item_call label="Remover este botão" name="Remove button"/>
+	<menu_item_call label="Botões da barra de ferramentas..." name="Choose Buttons"/>
 	<menu_item_check label="Ícones e rótulos" name="icons_with_text"/>
 	<menu_item_check label="Somente ícones" name="icons_only"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/pt/menu_viewer.xml b/indra/newview/skins/default/xui/pt/menu_viewer.xml
index 9b5711d4028f6fb93ac696c00fa7f7333a81fd18..d7d5d59a3326141ac91934ccbbac9fe1cc45c14c 100644
--- a/indra/newview/skins/default/xui/pt/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/pt/menu_viewer.xml
@@ -1,55 +1,60 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu_bar name="Main Menu">
 	<menu label="Eu" name="Me">
-		<menu_item_call label="Painel..." name="Manage My Account">
-			<menu_item_call.on_click name="ManageMyAccount_url" parameter="WebLaunchJoinNow,http://secondlife.com/account/index.php?lang=pt"/>
-		</menu_item_call>
 		<menu_item_call label="Perfil..." name="Profile"/>
 		<menu_item_call label="Aparência..." name="ChangeOutfit"/>
+		<menu_item_call label="Selecione um avatar..." name="Avatar Picker"/>
 		<menu_item_check label="Inventário..." name="Inventory"/>
-		<menu_item_check label="Gestos..." name="Gestures"/>
-		<menu_item_check label="Voz..." name="ShowVoice"/>
+		<menu_item_call label="Nova janela de inventário" name="NewInventoryWindow"/>
+		<menu_item_call label="Lugares..." name="Places"/>
+		<menu_item_call label="Destaques..." name="Picks"/>
+		<menu_item_call label="Controles da câmera..." name="Camera Controls"/>
 		<menu label="Movimentos" name="Movement">
 			<menu_item_call label="Sentar" name="Sit Down Here"/>
 			<menu_item_check label="Voar" name="Fly"/>
 			<menu_item_check label="Correr sempre" name="Always Run"/>
 			<menu_item_call label="Parar minha animação" name="Stop Animating My Avatar"/>
+			<menu_item_call label="Andar/correr/voar..." name="Walk / run / fly"/>
 		</menu>
 		<menu label="Status" name="Status">
 			<menu_item_call label="Ausente" name="Set Away"/>
 			<menu_item_call label="Ocupado" name="Set Busy"/>
 		</menu>
-		<menu_item_call label="Request Admin Status" name="Request Admin Options"/>
-		<menu_item_call label="Sair do modo admin" name="Leave Admin Options"/>
-		<menu_item_call label="Comprar L$" name="Buy and Sell L$"/>
+		<menu_item_call label="Comprar L$..." name="Buy and Sell L$"/>
+		<menu_item_call label="Caixa de saída do lojista..." name="MerchantOutbox"/>
+		<menu_item_call label="Painel da conta..." name="Manage My Account">
+			<menu_item_call.on_click name="ManageMyAccount_url" parameter="WebLaunchJoinNow,http://secondlife.com/account/index.php?lang=pt"/>
+		</menu_item_call>
 		<menu_item_call label="Preferências..." name="Preferences"/>
-		<menu_item_call label="Barras de ferramentas..." name="Toolbars"/>
+		<menu_item_call label="Botões da barra de ferramentas..." name="Toolbars"/>
 		<menu_item_call label="Ocultar todos os controles" name="Hide UI"/>
 		<menu_item_call label="Sair do [APP_NAME]" name="Quit"/>
 	</menu>
 	<menu label="Comunicar" name="Communicate">
-		<menu_item_call label="Meus amigos" name="My Friends"/>
-		<menu_item_call label="Meus grupos" name="My Groups"/>
-		<menu_item_check label="Bate-papo local" name="Nearby Chat"/>
-		<menu_item_call label="Pessoas por perto" name="Active Speakers"/>
-		<menu_item_check label="Voz por perto" name="Nearby Voice"/>
+		<menu_item_check label="Bate-papo..." name="Nearby Chat"/>
+		<menu_item_check label="Falar" name="Speak"/>
+		<menu_item_check label="Configurações de voz..." name="Nearby Voice"/>
+		<menu_item_check label="Distorção de voz..." name="ShowVoice"/>
+		<menu_item_check label="Gestos..." name="Gestures"/>
+		<menu_item_call label="Amigos" name="My Friends"/>
+		<menu_item_call label="Grupos" name="My Groups"/>
+		<menu_item_call label="Pessoas próximas" name="Active Speakers"/>
 	</menu>
 	<menu label="Mundo" name="World">
-		<menu_item_check label="Mini Mapa" name="Mini-Map"/>
+		<menu_item_call label="Criar marco deste lugar" name="Create Landmark Here"/>
+		<menu_item_call label="Destinos..." name="Destinations"/>
 		<menu_item_check label="Mapa-múndi" name="World Map"/>
+		<menu_item_check label="Mini Mapa" name="Mini-Map"/>
 		<menu_item_check label="Busca" name="Search"/>
+		<menu_item_call label="Teletransportar para início" name="Teleport Home"/>
+		<menu_item_call label="Definir como casa" name="Set Home to Here"/>
 		<menu_item_call label="Foto" name="Take Snapshot"/>
-		<menu_item_call label="Criar marco deste lugar" name="Create Landmark Here"/>
-		<menu label="Perfil da região" name="Land">
-			<menu_item_call label="Perfil da região" name="Place Profile"/>
-			<menu_item_call label="Sobre terrenos" name="About Land"/>
-			<menu_item_call label="Região/Propriedade" name="Region/Estate"/>
-		</menu>
+		<menu_item_call label="Perfil da região" name="Place Profile"/>
+		<menu_item_call label="Sobre terrenos" name="About Land"/>
+		<menu_item_call label="Região/Propriedade" name="Region/Estate"/>
+		<menu_item_call label="Meus terrenos..." name="My Land"/>
 		<menu_item_call label="Comprar este terreno" name="Buy Land"/>
-		<menu_item_call label="Meus terrenos" name="My Land"/>
 		<menu label="Mostrar" name="LandShow">
-			<menu_item_check label="Controles de movimento" name="Movement Controls"/>
-			<menu_item_check label="Ver controles" name="Camera Controls"/>
 			<menu_item_check label="Limites" name="Ban Lines"/>
 			<menu_item_check label="Balizas" name="beacons"/>
 			<menu_item_check label="Limites do imóvel" name="Property Lines"/>
@@ -58,30 +63,29 @@
 			<menu_item_check label="Propriedades do lote" name="Parcel Properties"/>
 			<menu_item_check label="Menu avançado" name="Show Advanced Menu"/>
 		</menu>
-		<menu_item_call label="Teletransportar para meu início" name="Teleport Home"/>
-		<menu_item_call label="Definir como Início" name="Set Home to Here"/>
-		<menu label="Sol" name="Environment Settings">
+		<menu label="Sol" name="Sun">
 			<menu_item_call label="Amanhecer" name="Sunrise"/>
 			<menu_item_call label="Meio-dia" name="Noon"/>
-			<menu_item_call label="Pôr-do-Sol" name="Sunset"/>
+			<menu_item_call label="Pôr-do-sol" name="Sunset"/>
 			<menu_item_call label="Meia-noite" name="Midnight"/>
-		</menu>
-		<menu label="Editor de ambientes" name="Enviroment Editor">
-			<menu_item_call label="Configurações de ambiente..." name="Enviroment Settings"/>
-			<menu label="Pré-configurações de água" name="Water Presets">
-				<menu_item_call label="Nova pré-configuração..." name="new_water_preset"/>
-				<menu_item_call label="Editar pré-configuração..." name="edit_water_preset"/>
-				<menu_item_call label="Excluir pré-configuração..." name="delete_water_preset"/>
+			<menu_item_call label="Usar configurações da região" name="Use Region Settings"/>
+		</menu>
+		<menu label="Editor de ambientes" name="Environment Editor">
+			<menu_item_call label="Configurações do ambiente..." name="Environment Settings"/>
+			<menu label="Predefinições da água" name="Water Presets">
+				<menu_item_call label="Nova predefinição..." name="new_water_preset"/>
+				<menu_item_call label="Editar predefinição..." name="edit_water_preset"/>
+				<menu_item_call label="Excluir predefinição..." name="delete_water_preset"/>
 			</menu>
-			<menu label="Pré-configurações de céu" name="Sky Presets">
-				<menu_item_call label="Nova pré-configuração..." name="new_sky_preset"/>
-				<menu_item_call label="Editar pré-configuração..." name="edit_sky_preset"/>
-				<menu_item_call label="Excluir pré-configuração..." name="delete_sky_preset"/>
+			<menu label="Predefinições de céu" name="Sky Presets">
+				<menu_item_call label="Nova predefinição..." name="new_sky_preset"/>
+				<menu_item_call label="Editar predefinição..." name="edit_sky_preset"/>
+				<menu_item_call label="Excluir predefinição..." name="delete_sky_preset"/>
 			</menu>
-			<menu label="Pré-configurações de dias" name="Day Presets">
-				<menu_item_call label="Nova pré-configuração..." name="new_day_preset"/>
-				<menu_item_call label="Editar pré-configuração..." name="edit_day_preset"/>
-				<menu_item_call label="Excluir pré-configuração..." name="delete_day_preset"/>
+			<menu label="Predefinições do dia" name="Day Presets">
+				<menu_item_call label="Nova predefinição..." name="new_day_preset"/>
+				<menu_item_call label="Editar predefinição..." name="edit_day_preset"/>
+				<menu_item_call label="Excluir predefinição..." name="delete_day_preset"/>
 			</menu>
 		</menu>
 	</menu>
@@ -96,7 +100,7 @@
 		</menu>
 		<menu_item_call label="Link" name="Link"/>
 		<menu_item_call label="Desconectar links" name="Unlink"/>
-		<menu_item_check label="Edit Linked Parts" name="Edit Linked Parts"/>
+		<menu_item_check label="Editar partes linkadas" name="Edit Linked Parts"/>
 		<menu label="Selecionar partes conectadas" name="Select Linked Parts">
 			<menu_item_call label="Selecionar próxima parte" name="Select Next Part"/>
 			<menu_item_call label="Selecionar parte anterior" name="Select Previous Part"/>
@@ -110,7 +114,7 @@
 			<menu_item_call label="Pegar" name="Menu Object Take"/>
 			<menu_item_call label="Pegar uma cópia" name="Take Copy"/>
 			<menu_item_call label="Salvar no meu inventário" name="Save Object Back to My Inventory"/>
-			<menu_item_call label="Save Back to Object Contents" name="Save Object Back to Object Contents"/>
+			<menu_item_call label="Salvar objeto de volta aos conteúdos do objeto" name="Save Object Back to Object Contents"/>
 			<menu_item_call label="Devolver objeto" name="Return Object back to Owner"/>
 		</menu>
 		<menu label="Scripts" name="Scripts">
@@ -140,11 +144,13 @@
 			<menu_item_call label="Animação (L$[COST])..." name="Upload Animation"/>
 			<menu_item_call label="Modelar..." name="Upload Model"/>
 			<menu_item_call label="Volume (L$[COST] por arquivo)..." name="Bulk Upload"/>
+			<menu_item_call label="Autorizações de upload padrão" name="perm prefs"/>
 		</menu>
 		<menu_item_call label="Desfazer" name="Undo"/>
 		<menu_item_call label="Repetir" name="Redo"/>
 	</menu>
 	<menu label="Ajuda" name="Help">
+		<menu_item_call label="Como..." name="How To"/>
 		<menu_item_call label="[SECOND_LIFE] Ajuda" name="Second Life Help"/>
 		<menu_item_call label="Denunciar abuso" name="Report Abuse"/>
 		<menu_item_call label="Relatar bug" name="Report Bug"/>
@@ -165,29 +171,29 @@
 		</menu>
 		<menu label="Realces e visibilidade" name="Highlighting and Visibility">
 			<menu_item_check label="Efeito baliza piscando" name="Cheesy Beacon"/>
-			<menu_item_check label="Hide Particles" name="Hide Particles"/>
+			<menu_item_check label="Esconder partículas" name="Hide Particles"/>
 			<menu_item_check label="Ocultar seleções" name="Hide Selected"/>
 			<menu_item_check label="Realçar transparentes" name="Highlight Transparent"/>
 			<menu_item_check label="Mostrar anexos HUD" name="Show HUD Attachments"/>
 			<menu_item_check label="Mostrar retículo na vista subjetiva" name="ShowCrosshairs"/>
 		</menu>
 		<menu label="Tipos de renderização" name="Rendering Types">
-			<menu_item_check label="Simples" name="Simple"/>
-			<menu_item_check label="Alpha" name="Alpha"/>
-			<menu_item_check label="Árvore" name="Tree"/>
-			<menu_item_check label="Avatares" name="Character"/>
-			<menu_item_check label="Patch de superfície" name="Surface Patch"/>
-			<menu_item_check label="Céu" name="Sky"/>
-			<menu_item_check label="Água" name="Water"/>
-			<menu_item_check label="Chão" name="Ground"/>
-			<menu_item_check label="Volume" name="Volume"/>
-			<menu_item_check label="Grama" name="Grass"/>
-			<menu_item_check label="Nuvens" name="Clouds"/>
-			<menu_item_check label="Particles" name="Particles"/>
-			<menu_item_check label="Elevação" name="Bump"/>
+			<menu_item_check label="Simples" name="Rendering Type Simple"/>
+			<menu_item_check label="Alpha" name="Rendering Type Alpha"/>
+			<menu_item_check label="Árvore" name="Rendering Type Tree"/>
+			<menu_item_check label="Avatares" name="Rendering Type Character"/>
+			<menu_item_check label="Patch de superfície" name="Rendering Type Surface Patch"/>
+			<menu_item_check label="Céu" name="Rendering Type Sky"/>
+			<menu_item_check label="Água" name="Rendering Type Water"/>
+			<menu_item_check label="Chão" name="Rendering Type Ground"/>
+			<menu_item_check label="Volume" name="Rendering Type Volume"/>
+			<menu_item_check label="Grama" name="Rendering Type Grass"/>
+			<menu_item_check label="Nuvens" name="Rendering Type Clouds"/>
+			<menu_item_check label="Partículas" name="Rendering Type Particles"/>
+			<menu_item_check label="Elevação" name="Rendering Type Bump"/>
 		</menu>
 		<menu label="Recursos de renderização" name="Rendering Features">
-			<menu_item_check label="Interface" name="UI"/>
+			<menu_item_check label="Interface" name="ToggleUI"/>
 			<menu_item_check label="Selecionado" name="Selected"/>
 			<menu_item_check label="Realçado" name="Highlighted"/>
 			<menu_item_check label="Texturas dinâmicas" name="Dynamic Textures"/>
@@ -198,11 +204,8 @@
 		<menu_item_check label="Usar plugin de leitura de threads" name="Use Plugin Read Thread"/>
 		<menu_item_call label="Limpar cache de grupo" name="ClearGroupCache"/>
 		<menu_item_check label="Smoothing de mouse" name="Mouse Smoothing"/>
+		<menu_item_call label="Liberar teclas" name="Release Keys"/>
 		<menu label="Atalhos" name="Shortcuts">
-			<menu_item_call label="Imagem (L$[COST])..." name="Upload Image"/>
-			<menu_item_check label="Busca" name="Search"/>
-			<menu_item_call label="Soltar objeto" name="Release Keys"/>
-			<menu_item_call label="Interface tamanho padrão" name="Set UI Size to Default"/>
 			<menu_item_check label="Mostrar menu avançado - atalho antigo" name="Show Advanced Menu - legacy shortcut"/>
 			<menu_item_call label="Fechar janela" name="Close Window"/>
 			<menu_item_call label="Fechar todas as janelas" name="Close All Windows"/>
@@ -211,13 +214,6 @@
 			<menu_item_check label="Flycam Joystick" name="Joystick Flycam"/>
 			<menu_item_call label="Visão padrão" name="Reset View"/>
 			<menu_item_call label="Olhar para quem fala por último" name="Look at Last Chatter"/>
-			<menu label="Selecionar ferramenta de construção" name="Select Tool">
-				<menu_item_call label="Ferramenta enfoque" name="Focus"/>
-				<menu_item_call label="Ferramenta de movimentação" name="Move"/>
-				<menu_item_call label="Ferramenta de edição" name="Edit"/>
-				<menu_item_call label="Ferramenta criar" name="Create"/>
-				<menu_item_call label="Ferramenta de terrenos" name="Land"/>
-			</menu>
 			<menu_item_call label="Mais zoom" name="Zoom In"/>
 			<menu_item_call label="Zoom padrão" name="Zoom Default"/>
 			<menu_item_call label="Menos zoom" name="Zoom Out"/>
@@ -271,7 +267,9 @@
 			<menu_item_check label="Tipo de atualização" name="Update Type"/>
 			<menu_item_check label="Dados LOD" name="LOD Info"/>
 			<menu_item_check label="Fila de construção" name="Build Queue"/>
+			<menu_item_check label="Vetores de vento" name="Wind Vectors"/>
 			<menu_item_check label="Renderizar complexidade" name="rendercomplexity"/>
+			<menu_item_check label="Bytes do anexo" name="attachment bytes"/>
 			<menu_item_check label="Esculpir" name="Sculpt"/>
 		</menu>
 		<menu label="Rendering" name="Rendering">
@@ -280,7 +278,6 @@
 			<menu_item_check label="Iluminação e sombras" name="Lighting and Shadows"/>
 			<menu_item_check label="Sombras da projeção do sol/lua" name="Shadows from Sun/Moon/Projectors"/>
 			<menu_item_check label="SSAO e sombra suave" name="SSAO and Shadow Smoothing"/>
-			<menu_item_check label="Iluminação global (fase experimental)" name="Global Illumination"/>
 			<menu_item_check label="Máscaras alpha automáticas (adiadas)" name="Automatic Alpha Masks (deferred)"/>
 			<menu_item_check label="Máscaras alpha automáticas (sem adiar)" name="Automatic Alpha Masks (non-deferred)"/>
 			<menu_item_check label="Texturas de animação" name="Animation Textures"/>
@@ -295,11 +292,10 @@
 			<menu_item_call label="Drop a Packet" name="Drop a Packet"/>
 		</menu>
 		<menu_item_call label="Empurrões, trombadas e tapas" name="Bumps, Pushes &amp;amp; Hits"/>
-		<menu label="Mundo" name="World">
-			<menu_item_check label="Impor sobre sol regional" name="Sim Sun Override"/>
-			<menu_item_check label="Efeito baliza piscando" name="Cheesy Beacon"/>
-			<menu_item_check label="Fixed Weather" name="Fixed Weather"/>
-			<menu_item_call label="Dump Region Object Cache" name="Dump Region Object Cache"/>
+		<menu label="Mundo" name="DevelopWorld">
+			<menu_item_check label="Impor sobre sol de simulação" name="Sim Sun Override"/>
+			<menu_item_check label="Clima fixo" name="Fixed Weather"/>
+			<menu_item_call label="Descartar cache do objeto de região" name="Dump Region Object Cache"/>
 		</menu>
 		<menu label="Interface" name="UI">
 			<menu_item_call label="Teste de mídia do navegador" name="Web Browser Test"/>
@@ -319,11 +315,11 @@
 		</menu>
 		<menu label="Avatar" name="Character">
 			<menu label="Grab Baked Texture" name="Grab Baked Texture">
-				<menu_item_call label="Íris" name="Iris"/>
-				<menu_item_call label="Cabeça" name="Head"/>
-				<menu_item_call label="Cintura acima" name="Upper Body"/>
-				<menu_item_call label="Cintura para baixo" name="Lower Body"/>
-				<menu_item_call label="Saia" name="Skirt"/>
+				<menu_item_call label="Íris" name="Grab Iris"/>
+				<menu_item_call label="Cabeça" name="Grab Head"/>
+				<menu_item_call label="Cintura acima" name="Grab Upper Body"/>
+				<menu_item_call label="Cintura para baixo" name="Grab Lower Body"/>
+				<menu_item_call label="Saia" name="Grab Skirt"/>
 			</menu>
 			<menu label="Testes de personagem" name="Character Tests">
 				<menu_item_call label="Toggle Character Geometry" name="Toggle Character Geometry"/>
@@ -339,18 +335,27 @@
 		</menu>
 		<menu_item_check label="Texturas HTTP" name="HTTP Textures"/>
 		<menu_item_check label="Inventário HTTP" name="HTTP Inventory"/>
+		<menu_item_call label="Habilitar Visual Leak Detector" name="Enable Visual Leak Detector"/>
 		<menu_item_check label="Console Window on next Run" name="Console Window"/>
+		<menu label="Configurar nível de registro em log" name="Set Logging Level">
+			<menu_item_check label="Depurar" name="Debug"/>
+			<menu_item_check label="Info" name="Info"/>
+			<menu_item_check label="Aviso" name="Warning"/>
+			<menu_item_check label="Error" name="Error"/>
+			<menu_item_check label="Nenhum" name="None"/>
+		</menu>
 		<menu_item_call label="Request Admin Status" name="Request Admin Options"/>
 		<menu_item_call label="Sair do modo admin" name="Leave Admin Options"/>
 		<menu_item_check label="Mostrar menu admin" name="View Admin Options"/>
 	</menu>
 	<menu label="Admin" name="Admin">
-		<menu label="Object">
-			<menu_item_call label="Pegar uma cópia" name="Take Copy"/>
-			<menu_item_call label="Force Owner To Me" name="Force Owner To Me"/>
-			<menu_item_call label="Force Owner Permissive" name="Force Owner Permissive"/>
+		<menu label="Objeto" name="AdminObject">
+			<menu_item_call label="Pegar uma cópia" name="Admin Take Copy"/>
+			<menu_item_call label="Forçar propriedade para mim" name="Force Owner To Me"/>
+			<menu_item_call label="Forçar permissão de proprietário" name="Force Owner Permissive"/>
 			<menu_item_call label="Excluir" name="Delete"/>
 			<menu_item_call label="Bloquear" name="Lock"/>
+			<menu_item_call label="Obter IDs dos bens" name="Get Assets IDs"/>
 		</menu>
 		<menu label="Lote" name="Parcel">
 			<menu_item_call label="Force Owner To Me" name="Owner To Me"/>
@@ -367,5 +372,16 @@
 		<menu label="Take Off Clothing" name="Take Off Clothing">
 			<menu_item_call label="Físico" name="Physics"/>
 		</menu>
+		<menu label="Ajuda" name="DeprecatedHelp">
+			<menu_item_call label="Blog oficial da Linden" name="Official Linden Blog"/>
+			<menu_item_call label="Portal de scripts" name="Scripting Portal"/>
+			<menu label="Relatar bugs" name="Bug Reporting">
+				<menu_item_call label="Monitor de problemas" name="Public Issue Tracker"/>
+				<menu_item_call label="Ajuda do monitor de problemas" name="Publc Issue Tracker Help"/>
+				<menu_item_call label="Relatório de bugs 101" name="Bug Reporing 101"/>
+				<menu_item_call label="Problemas de segurança" name="Security Issues"/>
+				<menu_item_call label="Página Wiki" name="QA Wiki"/>
+			</menu>
+		</menu>
 	</menu>
 </menu_bar>
diff --git a/indra/newview/skins/default/xui/pt/notifications.xml b/indra/newview/skins/default/xui/pt/notifications.xml
index 4bd9f86e0f9d5feb8365a114084123cb825ebc8c..3b39c0f92cb1948b836a7a29e48e1ff686958d66 100644
--- a/indra/newview/skins/default/xui/pt/notifications.xml
+++ b/indra/newview/skins/default/xui/pt/notifications.xml
@@ -85,17 +85,38 @@ Verifique se a conexão à internet está funcionando.
 		<usetemplate canceltext="Cancelar" name="yesnocancelbuttons" notext="Não salvar" yestext="Salvar"/>
 	</notification>
 	<notification name="ConfirmNoCopyToOutbox">
-		Você não tem permissão para copiar este item para a Caixa de saída do lojista. Tem certeza de que deseja mover o itens a seguir?
-        [ITEM_NAME]
-		<usetemplate name="okcancelbuttons" notext="Não" yestext="Sim"/>
+		Você não possui permissão para copiar um ou mais destes itens para a Caixa de saída do lojista.  Você pode movê-los ou abandoná-los.
+		<usetemplate name="okcancelbuttons" notext="Não mover item(ns)" yestext="Mover item(ns)"/>
+	</notification>
+	<notification name="OutboxFolderCreated">
+		Uma nova pasta foi criada para cada item transferido para o nível superior de sua Caixa de saída do lojista.
+		<usetemplate ignoretext="Uma nova pasta foi criada na Caixa de saída do lojista" name="okignore" yestext="OK"/>
+	</notification>
+	<notification name="OutboxImportComplete">
+		Êxito
+
+Todas as pastas foram enviadas para o Mercado com êxito.
+		<usetemplate ignoretext="Todas as pastas enviadas para o Mercado" name="okignore" yestext="OK"/>
+	</notification>
+	<notification name="OutboxImportHadErrors">
+		Algumas pastas não foram transferidas
+
+Erro ao enviar algumas pastas para o Mercado.  Estas pastas ainda estão na sua Caixa de saída do lojista.
+
+Consulte o [[MARKETPLACE_IMPORTS_URL] log de erros] para mais informações.
+		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
-	<notification name="OutboxUploadComplete">
-		Envio para Mercado concluído.
-		<usetemplate name="okbutton" yestext="Viva!"/>
+	<notification name="OutboxImportFailed">
+		Falha de transferência
+
+Nenhuma pasta enviada para o Mercado devido a um erro do sistema ou da rede.  Tente novamente mais tarde.
+		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
-	<notification name="OutboxUploadHadErrors">
-		Envio para Mercado concluído com erros!  Corrija os problemas em sua caixa de saída e tente novamente. Obrigado.
-		<usetemplate name="okbutton" yestext="Tudo bem!"/>
+	<notification name="OutboxInitFailed">
+		Falha na inicialização do Mercado
+
+Falha na inicialização do mercado devido a um erro do sistema ou da rede.  Tente novamente mais tarde.
+		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="CompileQueueSaveText">
 		Houve um problema com o carregamento do texto para um script devido à seguinte razão: [REASON]. Por favor, tente novamente mais tarde.
@@ -643,7 +664,7 @@ Esperada [VALIDS]
 		Incapaz de criar arquivo de saída: [FILE]
 	</notification>
 	<notification name="DoNotSupportBulkAnimationUpload">
-		O [APP_NAME] ainda não faz o upload de vários arquivos de animação de uma vez.
+		O [APP_NAME] ainda não faz o upload de vários arquivos de animação no formato BVH de uma vez.
 	</notification>
 	<notification name="CannotUploadReason">
 		Incapaz de carregar [FILE] devido ao seguinte motivo: [REASON]
@@ -973,7 +994,7 @@ Oferecer amizade para [NAME]?
 		</form>
 	</notification>
 	<notification name="RemoveFromFriends">
-		Remover [NAME] da sua lista de amigos?
+		Deseja remover &lt;nolink&gt;[NAME]&lt;/nolink&gt; da sua lista de amigos?
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Remover"/>
 	</notification>
 	<notification name="RemoveMultipleFromFriends">
@@ -1099,8 +1120,13 @@ Doar este terreno de [AREA] m² para o grupo &apos;[GROUP_NAME]&apos;?
 	<notification name="DisplaySetToSafe">
 		Configurações de display foram ajustadas para níveis de segurança porque você especificou -- opção de segurança.
 	</notification>
-	<notification name="DisplaySetToRecommended">
-		Configurações de display foram ajustadas para nível recomendado baseado na configuração do seu sistema.
+	<notification name="DisplaySetToRecommendedGPUChange">
+		As configurações de tela foram definidas nos níveis recomendados porque sua placa de vídeo foi alterada
+de &apos;[LAST_GPU]&apos;
+para &apos;[THIS_GPU]&apos;
+	</notification>
+	<notification name="DisplaySetToRecommendedFeatureChange">
+		As configurações de tela foram definidas nos níveis recomendados por causa de uma alteração no subsistema de renderização.
 	</notification>
 	<notification name="ErrorMessage">
 		[ERROR_MESSAGE]
@@ -1419,8 +1445,7 @@ Para instalar a atualização, será preciso reiniciar o [APP_NAME].
 		<usetemplate ignoretext="Confirmar antes de devolver objetos a seus donos" name="okcancelignore" notext="Cancelar" yestext="Retornar"/>
 	</notification>
 	<notification name="GroupLeaveConfirmMember">
-		Você é atualmente um membro do grupo [GROUP].
-Sair do grupo?
+		Você é atualmente um membro do grupo
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Sair"/>
 	</notification>
 	<notification name="ConfirmKick">
@@ -1900,7 +1925,13 @@ Mover para o inventário o(s) item(s)?
 		<usetemplate ignoretext="Confirmar antes de sair" name="okcancelignore" notext="Não sair" yestext="Sair"/>
 	</notification>
 	<notification name="ConfirmRestoreToybox">
-		Tem certeza que deseja restaurar seus botões e barras de ferramenta padrão? 
+		Essa ação irá restaurar os botões e barras de ferramenta padrão.
+
+Não é possível desfazer essa ação.
+		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
+	</notification>
+	<notification name="ConfirmClearAllToybox">
+		Essa ação fará com que todos os botões voltem para a caixa de ferramentas e suas barras de ferramentas ficarão vazias.
     
 Não é possível desfazer essa ação.
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
@@ -2109,10 +2140,10 @@ Isso abrirá o seu navegador.
 		Assunto: [SUBJECT], Mensagem: [MESSAGE]
 	</notification>
 	<notification name="FriendOnline">
-		[NAME] está online
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; está online
 	</notification>
 	<notification name="FriendOffline">
-		[NAME] está offline
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; está offline
 	</notification>
 	<notification name="AddSelfFriend">
 		Você é o máximo! Mesmo assim, não dá para adicionar a si mesmo(a) como amigo(a).
@@ -2225,14 +2256,16 @@ Selecione só um objeto.
 		Seu cartão de visita foi negado.
 	</notification>
 	<notification name="TeleportToLandmark">
-		Para se teletransportar para lugares como &apos;[NAME]&apos;, abra o painel &apos;Lugares&apos; à direita da tela e selecione a guia Marcos.  
-Basta clicar em qualquer marco e depois clicar em &apos;Teletransportar&apos; na parte inferior da tela. 
-(Também é possível clicar duas vezes no marco, ou clicar no marco com o botão direito e selecionar &apos;Teletransportar&apos;.)
+		Para se teletransportar para locais como &apos;[NAME]&apos;, clique no botão &quot;Lugares&quot;,
+    e selecione a guia Marcos na janela que é exibida. Clique em qualquer
+    marco para selecioná-lo e em seguida em &apos;Teletransportar&apos; na parte inferior da tela.
+    (Também é possível clicar duas vezes sobre o marco ou clicar com o botão direito do mouse sobre ele
+    e selecionar &apos;Teletransportar&apos;.)
 	</notification>
 	<notification name="TeleportToPerson">
-		Para entrar em contato com residentes como &apos;&apos;[NAME]&apos;,  abra o painel &apos;Pessoas&apos; à direita da tela.
-Selecione o residente da lista e clique em &apos;MI&apos; na parte de baixo do painel.
-(Também é possível clicar duas vezes no nome, ou clicar no nome com o botão direito e selecionar &apos;MI&apos;.)
+		Para entrar em contato com residentes como &apos;[NAME]&apos;, clique no botão &quot;Pessoas&quot;, selecione um residente na janela que é exibida e clique em &apos;MI&apos; na
+    parte inferior da janela.
+    (Também é possível clicar duas vezes no nome, ou clicar no nome com o botão direito e selecionar &apos;MI&apos;.)
 	</notification>
 	<notification name="CantSelectLandFromMultipleRegions">
 		Impossível selecionar terra nas fronteiras do servidor. Tente selecionar um pedaço menor de terra.
@@ -2252,6 +2285,9 @@ Selecione o residente da lista e clique em &apos;MI&apos; na parte de baixo do p
 	<notification name="PaymentSent">
 		[MESSAGE]
 	</notification>
+	<notification name="PaymentFailure">
+		[MESSAGE]
+	</notification>
 	<notification name="EventNotification">
 		Notificação de evento:
 
@@ -2501,10 +2537,10 @@ Cada um pode ver o status do outro (definição padrão).
 		</form>
 	</notification>
 	<notification name="FriendshipAccepted">
-		[NAME] aceitou seu convite de amizade.
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; aceitou sua oferta de amizade.
 	</notification>
 	<notification name="FriendshipDeclined">
-		[NAME] recusou seu convite de amizade
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; rejeitou sua oferta de amizade.
 	</notification>
 	<notification name="FriendshipAcceptedByMe">
 		Oferta de amizada aceita.
@@ -2576,16 +2612,16 @@ Deseja aceitar?
 		&apos;&lt;nolink&gt;[TITLE]&lt;/nolink&gt;&apos; de [NAME]
 [MESSAGE]
 		<form name="form">
-			<button name="Mute" text="Bloquear"/>
-			<button name="Ignore" text="Ignorar"/>
+			<button name="Client_Side_Mute" text="Bloquear"/>
+			<button name="Client_Side_Ignore" text="Ignorar"/>
 		</form>
 	</notification>
 	<notification name="ScriptDialogGroup">
 		&lt;nolink&gt;[TITLE]&lt;/nolink&gt;&apos; de [GROUPNAME]&apos;
 [MESSAGE]
 		<form name="form">
-			<button name="Mute" text="Bloquear"/>
-			<button name="Ignore" text="Ignorar"/>
+			<button name="Client_Side_Mute" text="Bloquear"/>
+			<button name="Client_Side_Ignore" text="Ignorar"/>
 		</form>
 	</notification>
 	<notification name="BuyLindenDollarSuccess">
@@ -2783,6 +2819,12 @@ Com os seguintes residentes:
 [RESIDENTS]
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
 	</notification>
+	<notification name="ShareFolderConfirmation">
+		Apenas uma pasta pode ser compartilhada por vez.
+
+Tem certeza de que quer compartilhar os itens abaixo?
+		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
+	</notification>
 	<notification name="ItemsShared">
 		Itens compartilhados.
 	</notification>
diff --git a/indra/newview/skins/default/xui/pt/panel_edit_skin.xml b/indra/newview/skins/default/xui/pt/panel_edit_skin.xml
index f3d88123f2ebb4c46587b4153a98530b470984e0..d00aa2dc66247bad105db68d9187b7f2deb6382f 100644
--- a/indra/newview/skins/default/xui/pt/panel_edit_skin.xml
+++ b/indra/newview/skins/default/xui/pt/panel_edit_skin.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="edit_skin_panel">
 	<panel name="avatar_skin_color_panel">
-		<texture_picker label="Tatuagens na cabeça" name="Head Tattoos" tool_tip="Selecionar imagem"/>
-		<texture_picker label="Tatuagem parte de cima" name="Upper Tattoos" tool_tip="Selecionar imagem"/>
-		<texture_picker label="Tatuagem de baixo" name="Lower Tattoos" tool_tip="Selecionar imagem"/>
+		<texture_picker label="Cabeça" name="Head" tool_tip="Selecionar imagem"/>
+		<texture_picker label="Cintura acima" name="Upper Body" tool_tip="Selecionar imagem"/>
+		<texture_picker label="Cintura para baixo" name="Lower Body" tool_tip="Selecionar imagem"/>
 	</panel>
 	<panel name="accordion_panel">
 		<accordion name="wearable_accordion">
diff --git a/indra/newview/skins/default/xui/pt/panel_my_profile.xml b/indra/newview/skins/default/xui/pt/panel_my_profile.xml
deleted file mode 100644
index aa15a2445d236e491446f8b7aacfb7a0e6831510..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/pt/panel_my_profile.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Perfil" name="panel_profile">
-	<string name="no_partner_text" value="Nenhum"/>
-	<string name="no_group_text" value="Nenhum"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="scroll_content_panel">
-					<panel name="second_life_image_panel">
-						<text name="display_name_descr_text">
-							Nome de usuário
-						</text>
-						<text name="name_descr_text">
-							Nome de tela
-						</text>
-						<button label="Perfil" name="see_profile_btn" tool_tip="Ver o perfil deste avatar"/>
-					</panel>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_nearby_chat.xml b/indra/newview/skins/default/xui/pt/panel_nearby_chat.xml
index 15470dc94a182224a2f71ee6d7a7f192ec54fbc3..6828d41deeb583a182512e65a92638a1644f3760 100644
--- a/indra/newview/skins/default/xui/pt/panel_nearby_chat.xml
+++ b/indra/newview/skins/default/xui/pt/panel_nearby_chat.xml
@@ -1,4 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="nearby_chat">
-	<check_box label="Traduzir bate-papo" name="translate_chat_checkbox"/>
+	<layout_stack name="stack">
+		<layout_panel name="translate_chat_checkbox_lp">
+			<check_box label="Traduzir bate-papo" name="translate_chat_checkbox"/>
+		</layout_panel>
+	</layout_stack>
 </panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_notes.xml b/indra/newview/skins/default/xui/pt/panel_notes.xml
deleted file mode 100644
index c15e838b34f34ecfbd99d3c0b1301e822279db72..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/pt/panel_notes.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Anotações e Privacidade" name="panel_notes">
-	<layout_stack name="layout">
-		<layout_panel name="notes_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<text name="status_message" value="Minhas anotações privadas:"/>
-					<text name="status_message2" value="Deixar esta pessoa:"/>
-					<check_box label="Ver meu status" name="status_check"/>
-					<check_box label="Ver minha localização no mapa" name="map_check"/>
-					<check_box label="Pegar, editar ou excluir objetos meus" name="objects_check"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-		<layout_panel name="notes_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="Adicionar amigo" name="add_friend" tool_tip="Oferecer amizade ao residente"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="MI" name="im" tool_tip="Abrir sessão de mensagem instantânea"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="Ligar" name="call" tool_tip="Ligar para este residente"/>
-				</layout_panel>
-				<layout_panel name="show_on_map_btn_lp">
-					<button label="Mapa" name="show_on_map_btn" tool_tip="Exibir o residente no mapa"/>
-				</layout_panel>
-				<layout_panel name="teleport_btn_lp">
-					<button label="Teletransportar" name="teleport" tool_tip="Oferecer teletransporte"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_postcard_message.xml b/indra/newview/skins/default/xui/pt/panel_postcard_message.xml
new file mode 100644
index 0000000000000000000000000000000000000000..9cde81043028e5e839777ea48b399b70112babb4
--- /dev/null
+++ b/indra/newview/skins/default/xui/pt/panel_postcard_message.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_postcard_message">
+	<text name="to_label">
+		Para:
+	</text>
+	<text name="name_label">
+		De:
+	</text>
+	<text name="subject_label">
+		Assunto:
+	</text>
+	<line_editor label="Digite aqui o assunto." name="subject_form"/>
+	<text name="msg_label">
+		Mensagem:
+	</text>
+	<text_editor name="msg_form">
+		Digite aqui a mensagem.
+	</text_editor>
+	<button label="Cancelar" name="cancel_btn"/>
+	<button label="Enviar" name="send_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_postcard_settings.xml b/indra/newview/skins/default/xui/pt/panel_postcard_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3088b9a99626e1be6d9a6be46086da7ffac2bab8
--- /dev/null
+++ b/indra/newview/skins/default/xui/pt/panel_postcard_settings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_postcard_settings">
+	<combo_box label="Resolução" name="postcard_size_combo">
+		<combo_box.item label="Janela atual" name="CurrentWindow"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="Customizado" name="Custom"/>
+	</combo_box>
+	<layout_stack name="postcard_image_params_ls">
+		<layout_panel name="postcard_image_size_lp">
+			<spinner label="Largura" name="postcard_snapshot_width"/>
+			<spinner label="Altura" name="postcard_snapshot_height"/>
+			<check_box label="Limitar proporções" name="postcard_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="postcard_image_format_quality_lp">
+			<slider label="Qualidade da imagem" name="image_quality_slider"/>
+			<text name="image_quality_level">
+				([QLVL])
+			</text>
+		</layout_panel>
+	</layout_stack>
+</panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml b/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml
index f98659aa738bfd11dc34dd3fbbb2405d7bd07f20..c5a4febb0e3ced8e2480eb99cd1c48d1e9579464 100644
--- a/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml
@@ -29,30 +29,5 @@
 	<check_box label="Bate-papos de MI" name="EnableIMChatPopups" tool_tip="Exibir pop-up de mensagens instantâneas novas"/>
 	<spinner label="Transição de avisos de bate-papos por perto:" name="nearby_toasts_lifetime"/>
 	<spinner label="Transição de avisos de bate-papos por perto:" name="nearby_toasts_fadingtime"/>
-	<check_box name="translate_chat_checkbox"/>
-	<text name="translate_chb_label">
-		Traduzir bate-papo automaticamente
-	</text>
-	<text name="translate_language_text">
-		Traduzir bate-papo para:
-	</text>
-	<combo_box name="translate_language_combobox">
-		<combo_box.item label="Padrão" name="System Default Language"/>
-		<combo_box.item label="English (Inglês)" name="English"/>
-		<combo_box.item label="Dansk (Dinamarquês)" name="Danish"/>
-		<combo_box.item label="Deutsch (Alemão)" name="German"/>
-		<combo_box.item label="Español (Espanhol)" name="Spanish"/>
-		<combo_box.item label="Français (Francês)" name="French"/>
-		<combo_box.item label="Italiano (Italiano)" name="Italian"/>
-		<combo_box.item label="Magyar (Húngaro)" name="Hungarian"/>
-		<combo_box.item label="Nederlands (Holandês)" name="Dutch"/>
-		<combo_box.item label="Polski (Polonês)" name="Polish"/>
-		<combo_box.item label="Português (Português)" name="Portugese"/>
-		<combo_box.item label="Русский (Russo)" name="Russian"/>
-		<combo_box.item label="Türkçe (Turco)" name="Turkish"/>
-		<combo_box.item label="Українська (Ucraniano)" name="Ukrainian"/>
-		<combo_box.item label="中文 (简体) (Chinês)" name="Chinese"/>
-		<combo_box.item label="日本語 (Japonês)" name="Japanese"/>
-		<combo_box.item label="한국어 (Coreano)" name="Korean"/>
-	</combo_box>
+	<button label="Configurações de tradução de bate-papo" name="ok_btn"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_preferences_setup.xml b/indra/newview/skins/default/xui/pt/panel_preferences_setup.xml
index 9259c0ed5634f896f71b0ecb2d58dceb24da632b..ebbd63138a59bf6dba998400c8315588f4e21532 100644
--- a/indra/newview/skins/default/xui/pt/panel_preferences_setup.xml
+++ b/indra/newview/skins/default/xui/pt/panel_preferences_setup.xml
@@ -15,7 +15,7 @@
 		Web:
 	</text>
 	<radio_group name="use_external_browser">
-		<radio_item label="Usar meu navegador (IE, Firefox, Safari)" name="external" tool_tip="Use o navegador incluso para consultar a ajuda, abrir links da web, etc. Uso em tela inteira não recomendado." value="1"/>
+		<radio_item label="Usar meu navegador (IE, Firefox, Safari)" name="external" tool_tip="Use o navegador incluso para consultar a ajuda, abrir links da web, etc. Uso em tela inteira não recomendado." value="true"/>
 		<radio_item label="Usar navegador incluso" name="internal" tool_tip="Use este navegador para consultar a ajuda, abrir links da web, etc. As janelas abrem dentro do [APP_NAME]." value=""/>
 	</radio_group>
 	<check_box initial_value="true" label="Habilitar plugins" name="browser_plugins_enabled"/>
diff --git a/indra/newview/skins/default/xui/pt/panel_profile.xml b/indra/newview/skins/default/xui/pt/panel_profile.xml
deleted file mode 100644
index 075ef55dee56999f8b0972bb9dee0ea2dd353fb3..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/pt/panel_profile.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Perfil" name="panel_profile">
-	<string name="CaptionTextAcctInfo">
-		[ACCTTYPE]
-[PAYMENTINFO] [AGEVERIFICATION]
-	</string>
-	<string name="payment_update_link_url">
-		http://www.secondlife.com/account/billing.php?lang=pt-BR
-	</string>
-	<string name="partner_edit_link_url">
-		http://www.secondlife.com/account/partners.php?lang=pt
-	</string>
-	<string name="my_account_link_url" value="http://secondlife.com/my/account/index.php?lang=pt-BR"/>
-	<string name="no_partner_text" value="Ninguém"/>
-	<string name="no_group_text" value="Nenhum"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<panel name="second_life_image_panel">
-						<text name="title_sl_descr_text" value="[SECOND_LIFE]:"/>
-					</panel>
-					<panel name="first_life_image_panel">
-						<text name="title_rw_descr_text" value="Mundo real:"/>
-					</panel>
-					<text name="title_member_text" value="Residente desde:"/>
-					<text name="title_acc_status_text" value="Conta:"/>
-					<text name="title_partner_text" value="Parceiro(a):"/>
-					<panel name="partner_data_panel">
-						<text initial_value="(pesquisando)" name="partner_text"/>
-					</panel>
-					<text name="title_groups_text" value="Grupos:"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-	<layout_stack name="layout_verb_buttons">
-		<layout_panel name="profile_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="Adicionar amigo" name="add_friend" tool_tip="Oferecer amizade ao residente"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="MI" name="im" tool_tip="Abrir sessão de mensagem instantânea"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="Ligar" name="call" tool_tip="Ligar para este residente"/>
-				</layout_panel>
-				<layout_panel name="chat_btn_lp">
-					<button label="Teletransportar" name="teleport" tool_tip="Oferecer teletransporte"/>
-				</layout_panel>
-				<layout_panel name="overflow_btn_lp">
-					<menu_button label="▼" name="overflow_btn" tool_tip="Pagar ou compartilhar inventário com o residente"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-		<layout_panel name="profile_me_buttons_panel">
-			<button label="Editar perfil" name="edit_profile_btn" tool_tip="Editar dados pessoais"/>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_profile_view.xml b/indra/newview/skins/default/xui/pt/panel_profile_view.xml
deleted file mode 100644
index d81ee08e6cf8f3982ac3e3a0c1d11ff74d719bd0..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/pt/panel_profile_view.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel name="panel_target_profile">
-	<string name="status_online">
-		Conectado
-	</string>
-	<string name="status_offline">
-		Desconectado
-	</string>
-	<text name="display_name_label" value="Nome de tela:"/>
-	<text name="solo_username_label" value="Nome de usuário:"/>
-	<text name="status" value="Conectado"/>
-	<text name="user_name_small" value="Jack oh look at me this is a super duper long name"/>
-	<button name="copy_to_clipboard" tool_tip="Copiar para área de transferência"/>
-	<text name="user_label" value="Nome de usuário:"/>
-	<tab_container name="tabs">
-		<panel label="PERFIL" name="panel_profile"/>
-		<panel label="DESTAQUES" name="panel_picks"/>
-		<panel label="ANOTAÇÕES E PRIVACIDADE" name="panel_notes"/>
-	</tab_container>
-</panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_region_estate.xml b/indra/newview/skins/default/xui/pt/panel_region_estate.xml
index e5d394865cfda98fb9af01d56690c92abba4b82a..6c5945aa15ea552bb9c1537ce3af345fd7e69cb7 100644
--- a/indra/newview/skins/default/xui/pt/panel_region_estate.xml
+++ b/indra/newview/skins/default/xui/pt/panel_region_estate.xml
@@ -23,10 +23,10 @@
 	<check_box label="Permitir acesso público" name="externally_visible_check"/>
 	<button label="?" name="externally_visible_help"/>
 	<text name="Only Allow">
-		Restringir acesso a contas confirmardas por:
+		Permitir acesso apenas para residentes que:
 	</text>
-	<check_box label="Dados de pagamento fornecidos" name="limit_payment" tool_tip="Banir residentes sem identificação."/>
-	<check_box label="Verificação de idade" name="limit_age_verified" tool_tip="Banir residentes que não comprovaram a idade. Consulte o [SUPPORT_SITE] para saber mais."/>
+	<check_box label="Dados de pagamento constam no registro." name="limit_payment" tool_tip="Propriedade de acesso restrito a residentes que já cadastraram seus dados de pagamento  Consulte o [SUPPORT_SITE] para saber mais."/>
+	<check_box label="A idade foi verificada" name="limit_age_verified" tool_tip="Residentes devem ter a idade verificada para acessar esta propriedade. Consulte o [SUPPORT_SITE] para saber mais."/>
 	<check_box label="Permitir conversa de voz" name="voice_chat_check"/>
 	<button label="?" name="voice_chat_help"/>
 	<check_box label="Permitir Tele-transporte direto" name="allow_direct_teleport"/>
diff --git a/indra/newview/skins/default/xui/pt/panel_script_ed.xml b/indra/newview/skins/default/xui/pt/panel_script_ed.xml
index a1acb18cb4118879844d3f4ee14ae4a4168f9e13..de02aafe2fd1aaf8f5cd01875438f04e77e2bff4 100644
--- a/indra/newview/skins/default/xui/pt/panel_script_ed.xml
+++ b/indra/newview/skins/default/xui/pt/panel_script_ed.xml
@@ -22,6 +22,8 @@
 		<menu label="Arquivo" name="File">
 			<menu_item_call label="Salvar" name="Save"/>
 			<menu_item_call label="Reverter todas as alterações" name="Revert All Changes"/>
+			<menu_item_call label="Carregar do arquivo..." name="LoadFromFile"/>
+			<menu_item_call label="Salvar para o arquivo..." name="SaveToFile"/>
 		</menu>
 		<menu label="Editar" name="Edit">
 			<menu_item_call label="desfazer" name="Undo"/>
diff --git a/indra/newview/skins/default/xui/pt/panel_snapshot_inventory.xml b/indra/newview/skins/default/xui/pt/panel_snapshot_inventory.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3c4bb186877bd26353c29ce7d4d52853dd06d9ef
--- /dev/null
+++ b/indra/newview/skins/default/xui/pt/panel_snapshot_inventory.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_inventory">
+	<text name="title">
+		Salvar no meu inventário
+	</text>
+	<text name="hint_lbl">
+		Salvar uma imagem em seu inventário custa L$[UPLOAD_COST]. Para salvar sua imagem como uma textura, selecione um dos formatos quadrados.
+	</text>
+	<combo_box label="Resolução" name="texture_size_combo">
+		<combo_box.item label="Janela atual" name="CurrentWindow"/>
+		<combo_box.item label="Pequeno (128x128)" name="Small(128x128)"/>
+		<combo_box.item label="Médio (256x256)" name="Medium(256x256)"/>
+		<combo_box.item label="Grande (512x512)" name="Large(512x512)"/>
+		<combo_box.item label="Customizado" name="Custom"/>
+	</combo_box>
+	<spinner label="Largura" name="inventory_snapshot_width"/>
+	<spinner label="Altura" name="inventory_snapshot_height"/>
+	<check_box label="Limitar proporções" name="inventory_keep_aspect_check"/>
+	<button label="Cancelar" name="cancel_btn"/>
+	<button label="Salvar" name="save_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_snapshot_local.xml b/indra/newview/skins/default/xui/pt/panel_snapshot_local.xml
new file mode 100644
index 0000000000000000000000000000000000000000..36b5b0cbe6b46b0f7bd7902ba405be142ddd1abb
--- /dev/null
+++ b/indra/newview/skins/default/xui/pt/panel_snapshot_local.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_local">
+	<text name="title">
+		Salvar no meu PC
+	</text>
+	<combo_box label="Resolução" name="local_size_combo">
+		<combo_box.item label="Janela atual" name="CurrentWindow"/>
+		<combo_box.item label="320x240" name="320x240"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="1280x1024" name="1280x1024"/>
+		<combo_box.item label="1600x1200" name="1600x1200"/>
+		<combo_box.item label="Customizado" name="Custom"/>
+	</combo_box>
+	<layout_stack name="local_image_params_ls">
+		<layout_panel name="local_image_size_lp">
+			<spinner label="Largura" name="local_snapshot_width"/>
+			<spinner label="Altura" name="local_snapshot_height"/>
+			<check_box label="Limitar proporções" name="local_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="local_image_format_quality_lp">
+			<combo_box label="Formato" name="local_format_combo">
+				<combo_box.item label="PNG (sem perda)" name="PNG"/>
+				<combo_box.item label="JPEG" name="JPEG"/>
+				<combo_box.item label="BMP (sem perda)" name="BMP"/>
+			</combo_box>
+			<slider label="Qualidade da imagem" name="image_quality_slider"/>
+			<text name="image_quality_level">
+				([QLVL])
+			</text>
+		</layout_panel>
+	</layout_stack>
+	<button label="Cancelar" name="cancel_btn"/>
+	<flyout_button label="Salvar" name="save_btn" tool_tip="Salvar imagem em um arquivo">
+		<flyout_button.item label="Salvar" name="save_item"/>
+		<flyout_button.item label="Salvar como..." name="saveas_item"/>
+	</flyout_button>
+</panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_snapshot_options.xml b/indra/newview/skins/default/xui/pt/panel_snapshot_options.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7f1452e9926765e97adcfb7d6138d9d2b43e7c2c
--- /dev/null
+++ b/indra/newview/skins/default/xui/pt/panel_snapshot_options.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_options">
+	<button label="Postar no feed do meu perfil" name="save_to_profile_btn"/>
+	<button label="E-mail" name="save_to_email_btn"/>
+	<button label="Salvar em Meu inventário (L$[AMOUNT])" name="save_to_inventory_btn"/>
+	<button label="Salvar no meu PC" name="save_to_computer_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_snapshot_postcard.xml b/indra/newview/skins/default/xui/pt/panel_snapshot_postcard.xml
new file mode 100644
index 0000000000000000000000000000000000000000..12a648f600bc47c3f573caeb77c12023e55ea195
--- /dev/null
+++ b/indra/newview/skins/default/xui/pt/panel_snapshot_postcard.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_postcard">
+	<string name="default_subject">
+		Postal do [SECOND_LIFE].
+	</string>
+	<string name="default_message">
+		Confira!
+	</string>
+	<string name="upload_message">
+		Enviando...
+	</string>
+	<text name="title">
+		E-mail
+	</text>
+	<button label="Mensagem" name="message_btn"/>
+	<button label="Configurações" name="settings_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_snapshot_profile.xml b/indra/newview/skins/default/xui/pt/panel_snapshot_profile.xml
new file mode 100644
index 0000000000000000000000000000000000000000..095b8fc75d5c8c05ed40f5120d8d3637103a817f
--- /dev/null
+++ b/indra/newview/skins/default/xui/pt/panel_snapshot_profile.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_profile">
+	<text name="title">
+		Postar no feed do meu perfil
+	</text>
+	<combo_box label="Resolução" name="profile_size_combo">
+		<combo_box.item label="Janela atual" name="CurrentWindow"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="Customizado" name="Custom"/>
+	</combo_box>
+	<layout_stack name="profile_image_params_ls">
+		<layout_panel name="profile_image_size_lp">
+			<spinner label="Largura" name="profile_snapshot_width"/>
+			<spinner label="Altura" name="profile_snapshot_height"/>
+			<check_box label="Limitar proporções" name="profile_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="profile_image_metadata_lp">
+			<text name="caption_label">
+				Legenda:
+			</text>
+			<check_box initial_value="true" label="Incluir local" name="add_location_cb"/>
+		</layout_panel>
+	</layout_stack>
+	<button label="Cancelar" name="cancel_btn"/>
+	<button label="Postar" name="post_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_status_bar.xml b/indra/newview/skins/default/xui/pt/panel_status_bar.xml
index d5a3258ddc1b8e24315334ec0670da6300f90bbd..cb9a6eb757629b22f5b0e4fc9a3ed9dcaaa88638 100644
--- a/indra/newview/skins/default/xui/pt/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/pt/panel_status_bar.xml
@@ -15,10 +15,10 @@
 	<panel.string name="buycurrencylabel">
 		L$ [AMT]
 	</panel.string>
-	<panel name="balance_bg">
+	<panel left="-410" name="balance_bg" width="200">
 		<text name="balance" tool_tip="Atualizar saldo de L$" value="L$20"/>
 		<button label="Comprar L$" name="buyL" tool_tip="Comprar mais L$"/>
-		<button label="Comprar" name="goShop" tool_tip="Abrir Mercado do Second Life"/>
+		<button label="Comprar" name="goShop" tool_tip="Abrir Mercado do Second Life" width="80"/>
 	</panel>
 	<text name="TimeText" tool_tip="Hora atual (Pacífico)">
 		24:00 AM PST
diff --git a/indra/newview/skins/default/xui/pt/sidepanel_inventory.xml b/indra/newview/skins/default/xui/pt/sidepanel_inventory.xml
index 77c552a852dbaa2c2b167a1990bd1a20110af413..7908ea5f3a44430d3064d71d52c781766c61ed53 100644
--- a/indra/newview/skins/default/xui/pt/sidepanel_inventory.xml
+++ b/indra/newview/skins/default/xui/pt/sidepanel_inventory.xml
@@ -2,47 +2,24 @@
 <panel label="Coisas" name="objects panel">
 	<panel label="" name="sidepanel__inventory_panel">
 		<layout_stack name="inventory_layout_stack">
-			<layout_panel name="inbox_outbox_layout_panel">
-				<layout_stack name="inbox_outbox_layout_stack">
-					<layout_panel name="inbox_layout_panel">
-						<panel label="" name="marketplace_inbox">
-							<string name="InboxLabelWithArg">
-								Itens recebidos ([NUM])
-							</string>
-							<string name="InboxLabelNoArg">
-								Itens recebidos
-							</string>
-							<button label="Itens recebidos" name="inbox_btn"/>
-							<text name="inbox_fresh_new_count">
-								[NUM] novo(s)
-							</text>
-							<panel tool_tip="Drag and drop items to your inventory to manage and use them">
-								<text name="inbox_inventory_placeholder">
-									Compras do marketplace serão entregues aqui.
-								</text>
-							</panel>
-						</panel>
-					</layout_panel>
-					<layout_panel name="outbox_layout_panel">
-						<panel label="" name="marketplace_outbox">
-							<string name="OutboxLabelWithArg">
-								Caixa de saída do lojista ([NUM])
-							</string>
-							<string name="OutboxLabelNoArg">
-								Caixa de saída do lojista
-							</string>
-							<button label="Caixa de saída do lojista" name="outbox_btn"/>
-							<button label="" name="outbox_sync_btn" tool_tip="Enviar para a frente do meu mercado"/>
-							<panel>
-								<panel name="outbox_inventory_placeholder_panel">
-									<text name="outbox_inventory_placeholder_title">
-										Carregando...
-									</text>
-								</panel>
-							</panel>
-						</panel>
-					</layout_panel>
-				</layout_stack>
+			<layout_panel name="inbox_layout_panel">
+				<panel label="" name="marketplace_inbox">
+					<string name="InboxLabelWithArg">
+						Itens recebidos ([NUM])
+					</string>
+					<string name="InboxLabelNoArg">
+						Itens recebidos
+					</string>
+					<button label="Itens recebidos" name="inbox_btn"/>
+					<text name="inbox_fresh_new_count">
+						[NUM] novo(s)
+					</text>
+					<panel name="inbox_inventory_placeholder_panel" tool_tip="Arraste e solte itens para o seu inventário para usá-los">
+						<text name="inbox_inventory_placeholder">
+							As compras do marketplace serão entregues aqui.
+						</text>
+					</panel>
+				</panel>
 			</layout_panel>
 		</layout_stack>
 		<panel name="button_panel">
diff --git a/indra/newview/skins/default/xui/pt/strings.xml b/indra/newview/skins/default/xui/pt/strings.xml
index cc61ad76d7a9c51d51c92c303bf5e1b41ced76bd..342a52356b95e8360578272e0f1a039da7a481e5 100644
--- a/indra/newview/skins/default/xui/pt/strings.xml
+++ b/indra/newview/skins/default/xui/pt/strings.xml
@@ -157,9 +157,9 @@ Para saber mais, visite as perguntas frequentes abaixo: http://secondlife.com/vi
 		O Second Life está fechado para manutenção no momento.  Somente funcionários podem acessá-lo.  Consulte www.secondlife.com/status para as últimas atualizações.
 	</string>
 	<string name="LoginFailedPremiumOnly">
-		O acesso ao Second Life está sendo restrito por alguns instantes para que todos tenham a melhor experiência possível. 
-	 	
-Titulares de contas gratuitas não poderão acessar o Second Life para acomodar os assinantes do Second Life.
+		Logons do Second Life estão temporariamente restritos para garantir a melhor experiência possível para os usuários no mundo virtual.
+
+Pessoas com contas gratuitas não poderão acessar o Second Life no momento para dar espaço para aquelas que pagaram pelo Second Life.
 	</string>
 	<string name="LoginFailedComputerProhibited">
 		O Second Life não pode ser acessado deste computador.  Se você acredita que houve algum equívoco, contate support@secondlife.com.
@@ -291,17 +291,35 @@ Titulares de contas gratuitas não poderão acessar o Second Life para acomodar
 		Apenas um item único pode ser arrastado para este local
 	</string>
 	<string name="TooltipPrice" value="L$[AMOUNT]"/>
+	<string name="TooltipOutboxDragToWorld">
+		Não é possível fazer rez do itens em sua caixa de saída do lojista
+	</string>
 	<string name="TooltipOutboxNoTransfer">
-		Um ou mais objetos não podem ser vendidos ou transferidos para outros usuário.
+		Um ou mais destes objetos não podem ser vendidos ou transferidos.
+	</string>
+	<string name="TooltipOutboxNotInInventory">
+		Sua caixa de saída do lojista aceita apenas itens direto do seu inventário
 	</string>
 	<string name="TooltipOutboxWorn">
-		Você está usando um ou mais desses objetos. Remova-os de seu avatar e tente movê-los novamente.
+		Você não pode colocar os itens que está vestindo na sua caixa de saída do lojista
+	</string>
+	<string name="TooltipOutboxCallingCard">
+		Não é possível colocar cartões de visita em sua caixa de saída do lojista
 	</string>
 	<string name="TooltipOutboxFolderLevels">
-		Esta pasta tem muitos níveis de subpastas. Reorganize as pastas internas em até 4 níveis no máximo (Pasta raiz contém A que contém B que contém C).
+		A profundidade das pastas aninhadas excede 3
+	</string>
+	<string name="TooltipOutboxTooManyFolders">
+		A contagem de subpastas na pasta de nível superior excede 20
 	</string>
 	<string name="TooltipOutboxTooManyObjects">
-		Esta pasta contém mais de 200 objetos. Embale alguns dos itens para reduzir a contagem de objetos.
+		A contagem de itens na pasta de nível superior excede 200
+	</string>
+	<string name="TooltipDragOntoOwnChild">
+		Não é possível mover uma pasta para seu filho
+	</string>
+	<string name="TooltipDragOntoSelf">
+		Não é possível mover uma pasta para dentro dela mesma
 	</string>
 	<string name="TooltipHttpUrl">
 		Clique para ver a página web
@@ -547,6 +565,9 @@ Titulares de contas gratuitas não poderão acessar o Second Life para acomodar
 	<string name="mesh">
 		mesh
 	</string>
+	<string name="AvatarEditingAppearance">
+		(Edição Aparência)
+	</string>
 	<string name="AvatarAway">
 		Distante
 	</string>
@@ -763,6 +784,9 @@ Titulares de contas gratuitas não poderão acessar o Second Life para acomodar
 	<string name="anim_yes_head">
 		Sim
 	</string>
+	<string name="multiple_textures">
+		Múltiplo
+	</string>
 	<string name="texture_loading">
 		Carregando...
 	</string>
@@ -919,6 +943,9 @@ Titulares de contas gratuitas não poderão acessar o Second Life para acomodar
 	<string name="choose_the_directory">
 		Selecionar pasta
 	</string>
+	<string name="script_files">
+		Scripts
+	</string>
 	<string name="AvatarSetNotAway">
 		deixar como ausente
 	</string>
@@ -1157,43 +1184,36 @@ Titulares de contas gratuitas não poderão acessar o Second Life para acomodar
 		Você não possui uma cópia desta textura no seu inventário
 	</string>
 	<string name="InventoryInboxNoItems">
-		Compras do marketplace serão entregues aqui.
+		Suas compras do Marketplace aparecerão aqui. Depois, você poderá arrastá-las para seu inventário para usá-las.
 	</string>
 	<string name="MarketplaceURL">
-		http://marketplace.[DOMAIN_NAME]
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/
 	</string>
 	<string name="MarketplaceURL_CreateStore">
-		http://marketplace.[DOMAIN_NAME]/create_store
-	</string>
-	<string name="MarketplaceURL_LearnMore">
-		http://marketplace.[DOMAIN_NAME]/learn_more
+		http://community.secondlife.com/t5/English-Knowledge-Base/Selling-in-the-Marketplace/ta-p/700193#Section_.4
 	</string>
-	<string name="InventoryOutboxCreationErrorTitle">
-		Sua Caixa de saída do lojista não está configurada corretamente
+	<string name="MarketplaceURL_Dashboard">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/merchants/store/dashboard
 	</string>
-	<string name="InventoryOutboxCreationErrorTooltip">
-		Erro de configuração na Caixa de saída do lojista
+	<string name="MarketplaceURL_Imports">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/merchants/store/imports
 	</string>
-	<string name="InventoryOutboxCreationError">
-		Entre em contato com o Atendimento para corrigir o problema.
+	<string name="MarketplaceURL_LearnMore">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/learn_more
 	</string>
 	<string name="InventoryOutboxNotMerchantTitle">
-		Qualquer um pode vender itens no Mercado
-	</string>
-	<string name="InventoryOutboxNotMerchantTooltip">
-		Torne-se um lojista!
+		Qualquer um pode vender itens no Mercado.
 	</string>
+	<string name="InventoryOutboxNotMerchantTooltip"/>
 	<string name="InventoryOutboxNotMerchant">
-		[[MARKETPLACE_URL] O Mercado do Second Life] oferece mais de um milhão de produtos virtuais para venda, todos criados pelos residentes. Você também pode vender os itens que você cria, além de alguns itens que comprou. É fácil e a configuração é gratuita. [[LEARN_MORE_URL] Saiba mais] ou [[CREATE_STORE_URL] crie uma loja] no Mercado para começar.
+		Se você deseja se tornar um lojista, precisará [[MARKETPLACE_CREATE_STORE_URL] criar uma loja no Mercado].
 	</string>
 	<string name="InventoryOutboxNoItemsTitle">
-		Uma nova maneira de vender os itens no Mercado
-	</string>
-	<string name="InventoryOutboxNoItemsTooltip">
-		Arraste e solte os itens aqui para prepará-los para venda no Mercado
+		Sua caixa de saída está vazia
 	</string>
+	<string name="InventoryOutboxNoItemsTooltip"/>
 	<string name="InventoryOutboxNoItems">
-		Arraste os itens ou pastas que deseja vender para esta área. Será exibida uma cópia deles, deixando seu inventário inalterado, a menos que você arraste um item que não permita cópia. Quando estiver pronto para enviar os itens para o Mercado, clique no botão Enviar. Quando os itens tiverem sido movidos para seu Inventário de mercado, eles desaparecerão desta pasta.
+		Arraste as pastas para estas áreas e então clique em &quot;Enviar para Mercado&quot; para listar os itens para venda no [[MARKETPLACE_DASHBOARD_URL] Mercado].
 	</string>
 	<string name="Marketplace Error None">
 		Sem erros
@@ -1205,7 +1225,7 @@ Titulares de contas gratuitas não poderão acessar o Second Life para acomodar
 		Erro: esta pasta está vazia.
 	</string>
 	<string name="Marketplace Error Unassociated Products">
-		Erro: ocorreu uma falha ao enviar este item, pois sua conta de lojista tem muitos itens não associados a produtos. Para corrigir esse erro, faça o login no site do mercado e reduza a contagem de itens não associados.
+		Erro: ocorreu uma falha ao enviar este item, pois sua conta de lojista tem muitos itens não associados a produtos.  Para corrigir esse erro, faça o login no site do mercado e reduza a contagem de itens não associados.
 	</string>
 	<string name="Marketplace Error Object Limit">
 		Erro: este item contém muitos objetos. Corrija esse erro unindo os objetos em caixa para reduzir a contagem total a menos de 200.
@@ -1349,6 +1369,9 @@ Titulares de contas gratuitas não poderão acessar o Second Life para acomodar
 	<string name="no_attachments">
 		Nenhum anexo vestido
 	</string>
+	<string name="Attachments remain">
+		Anexos ([COUNT] slots permanecem)
+	</string>
 	<string name="Buy">
 		Comprar
 	</string>
@@ -1475,6 +1498,12 @@ Titulares de contas gratuitas não poderão acessar o Second Life para acomodar
 	<string name="Right Pec">
 		Peitoral D
 	</string>
+	<string name="Neck">
+		Pescoço
+	</string>
+	<string name="Avatar Center">
+		Centro do avatar
+	</string>
 	<string name="Invalid Attachment">
 		Ponto de encaixe inválido
 	</string>
@@ -3771,6 +3800,9 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 	<string name="Saved_message">
 		(Salvo em [LONG_TIMESTAMP])
 	</string>
+	<string name="IM_unblock_only_groups_friends">
+		Para visualizar esta mensagem, você deve desmarcar &quot;Apenas amigos e grupos podem me ligar ou enviar MIs&quot; em Preferências/Privacidade.
+	</string>
 	<string name="answered_call">
 		Ligação atendida
 	</string>
@@ -3883,16 +3915,28 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		[NAME] lhe pagou L$ [AMOUNT]
 	</string>
 	<string name="you_paid_ldollars">
-		You pagou L$[AMOUNT] por [REASON] a [NAME].
+		Você pagou L$[AMOUNT] por [REASON] a [NAME].
 	</string>
 	<string name="you_paid_ldollars_no_info">
 		Você acaba de pagar L$[AMOUNT].
 	</string>
 	<string name="you_paid_ldollars_no_reason">
-		You pagou L$[AMOUNT] a [NAME].
+		Você pagou L$[AMOUNT] a [NAME].
 	</string>
 	<string name="you_paid_ldollars_no_name">
-		You pagou L$[AMOUNT] por [REASON].
+		Você pagou L$[AMOUNT] por [REASON].
+	</string>
+	<string name="you_paid_failure_ldollars">
+		Você não pagou L$[AMOUNT] a [NAME] referentes a [REASON].
+	</string>
+	<string name="you_paid_failure_ldollars_no_info">
+		Você não pagou L$[AMOUNT].
+	</string>
+	<string name="you_paid_failure_ldollars_no_reason">
+		Você não pagou L$[AMOUNT] a [NAME].
+	</string>
+	<string name="you_paid_failure_ldollars_no_name">
+		Você não pagou L$[AMOUNT] referentes a [REASON].
 	</string>
 	<string name="for item">
 		por [ITEM]
@@ -3947,7 +3991,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 	</string>
 	<string name="uploading_abuse_report">
 		Carregando...
-  
+
 Denunciar abuso
 	</string>
 	<string name="New Shape">
@@ -4213,10 +4257,10 @@ Denunciar abuso
 	</string>
 	<string name="words_separator" value=","/>
 	<string name="server_is_down">
-		Aconteceu algo inesperado, apesar de termos tentador impedir isso.
+		Aconteceu algo inesperado, apesar de termos tentado impedir isso.
 
-	Cheque secondlifegrid.net para saber se foi detectado um problema com o serviço.   
-        Se o problema persisitr, cheque a configuração da sua rede e firewall.
+	Cheque secondlifegrid.net para saber se foi detectado um problema com o serviço.
+        Se o problema persistir, cheque a configuração da sua rede e firewall.
 	</string>
 	<string name="dateTimeWeekdaysNames">
 		Domingo:Segunda:Terça:Quarta:Quinta:Sexta:Sábado
@@ -4304,6 +4348,12 @@ Tente colocar o caminho do editor entre aspas.
 	<string name="ExternalEditorFailedToRun">
 		Falha de execução do editor externo.
 	</string>
+	<string name="TranslationFailed">
+		Falha na tradução: [REASON]
+	</string>
+	<string name="TranslationResponseParseError">
+		Erro ao analisar resposta de tradução.
+	</string>
 	<string name="Esc">
 		Esc
 	</string>
@@ -4674,7 +4724,10 @@ Tente colocar o caminho do editor entre aspas.
 		Mini Mapa
 	</string>
 	<string name="Command_Move_Label">
-		Mover
+		Andar/correr/voar
+	</string>
+	<string name="Command_Outbox_Label">
+		Caixa de saída do lojista
 	</string>
 	<string name="Command_People_Label">
 		Pessoas
@@ -4701,10 +4754,10 @@ Tente colocar o caminho do editor entre aspas.
 		Falar
 	</string>
 	<string name="Command_View_Label">
-		Exibir
+		Controles da câmera
 	</string>
 	<string name="Command_Voice_Label">
-		Voz próxima
+		Configurações de voz
 	</string>
 	<string name="Command_AboutLand_Tooltip">
 		Informações sobre o terreno que você está visitando
@@ -4748,6 +4801,9 @@ Tente colocar o caminho do editor entre aspas.
 	<string name="Command_Move_Tooltip">
 		Movendo seu avatar
 	</string>
+	<string name="Command_Outbox_Tooltip">
+		Transferir itens para o seu mercado para venda
+	</string>
 	<string name="Command_People_Tooltip">
 		Amigos, grupos e pessoas próximas
 	</string>
@@ -4776,7 +4832,16 @@ Tente colocar o caminho do editor entre aspas.
 		Alterar o ângulo da câmera
 	</string>
 	<string name="Command_Voice_Tooltip">
-		Pessoas próximas com recursos de voz
+		Controles de volume das chamadas e pessoas próximas a você no mundo virtual
+	</string>
+	<string name="Toolbar_Bottom_Tooltip">
+		atualmente na sua barra de ferramentas inferior
+	</string>
+	<string name="Toolbar_Left_Tooltip">
+		atualmente na sua barra de ferramentas esquerda
+	</string>
+	<string name="Toolbar_Right_Tooltip">
+		atualmente na sua barra de ferramentas direita
 	</string>
 	<string name="Retain%">
 		Reter%
@@ -4802,4 +4867,19 @@ Tente colocar o caminho do editor entre aspas.
 	<string name="Normal">
 		Normal
 	</string>
+	<string name="snapshot_quality_very_low">
+		Muito baixo
+	</string>
+	<string name="snapshot_quality_low">
+		Baixo
+	</string>
+	<string name="snapshot_quality_medium">
+		Médio
+	</string>
+	<string name="snapshot_quality_high">
+		Alto
+	</string>
+	<string name="snapshot_quality_very_high">
+		Muito alto
+	</string>
 </strings>
diff --git a/indra/newview/skins/default/xui/pt/teleport_strings.xml b/indra/newview/skins/default/xui/pt/teleport_strings.xml
index f8ded1ce690997b791aadfb8953169073d5f8be7..3fb77a02d26d59f10a3f75468bd1f68a98a47112 100644
--- a/indra/newview/skins/default/xui/pt/teleport_strings.xml
+++ b/indra/newview/skins/default/xui/pt/teleport_strings.xml
@@ -19,8 +19,8 @@ Se você continuar a receber esta mensagem, por favor consulte o [SUPPORT_SITE].
 			Desculpe, não foi possível para o sistema executar o teletransporte. Tente novamente dentro de alguns instantes.
 		</message>
 		<message name="NoHelpIslandTP">
-		Você não pode se tele-transportar de volta à Ilha de Welcome.
-Vá para a Ilha de Welcome Pública para repetir este tutorial.
+			Não é possível se teletransportar de volta à Ilha Welcome.
+Vá para a &apos;Ilha Welcome Pública&apos; para repetir o tutorial.
 		</message>
 		<message name="noaccess_tport">
 			Desculpe, você não tem acesso ao destino deste teletransporte.
diff --git a/indra/newview/skins/default/xui/ru/floater_about.xml b/indra/newview/skins/default/xui/ru/floater_about.xml
index deb6be319cf7e74945107d2c0c484c37ca626ddb..119f104906e3a956f162677815922f8f2e9d0714 100644
--- a/indra/newview/skins/default/xui/ru/floater_about.xml
+++ b/indra/newview/skins/default/xui/ru/floater_about.xml
@@ -63,32 +63,34 @@
 		<panel label="Лицензии" name="licenses_panel">
 			<text_editor name="credits_editor">
 				3Dconnexion SDK (C) 1992-2007 3Dconnexion
-APR (C) 2000-2004 The Apache Software Foundation
-Collada DOM (C) 2005 Sony Computer Entertainment Inc.cURL (C) 1996-2002, Daniel Stenberg, (daniel@haxx.se)
+        APR (C) 2000-2004 The Apache Software Foundation
+        Collada DOM (C) 2005 Sony Computer Entertainment Inc.
+        cURL (C) 1996-2002, Daniel Stenberg, (daniel@haxx.se)
+        DBus/dbus-glib (C) 2002, 2003  CodeFactory AB / (C) 2003, 2004 Red Hat, Inc.
+        expat (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
+        FreeType (C) 1996-2002, The FreeType Project (www.freetype.org).
+        GL (C) 1999-2004 Brian Paul.
+        GLOD (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Университет Джона Гопкинса и David Luebke, Brenden Schubert, Университет Вирджинии.
+        google-perftools (c) 2005, Google Inc.
+        Havok.com(TM) (C) 1999-2001, Telekinesys Research Limited.
+        jpeg2000 (C) 2001, David Taubman, Университет Нового Южного Уэльса (UNSW)
+        jpeglib (C) 1991-1998, Thomas G. Lane.
+        ogg/vorbis (C) 2001, Xiphophorus
+        OpenSSL (C) 1998-2002 The OpenSSL Project.
+        PCRE (c) 1997-2008, Кембриджский университет
+        SDL (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
+        SSLeay (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+        xmlrpc-epi (C) 2000 Epinions, Inc.
+        zlib (C) 1995-2002 Jean-loup Gailly и Mark Adler.
+        google-perftools (c) 2005, Google Inc.
 
-DBus/dbus-glib (C) 2002, 2003  CodeFactory AB / (C) 2003, 2004 Red Hat, Inc.
-expat (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
-FreeType (C) 1996-2002, The FreeType Project (www.freetype.org).
-GL (C) 1999-2004 Brian Paul.
-GLOD (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University и David Luebke, Brenden Schubert, Университет Вирджиинии.
-google-perftools (c) 2005, Google Inc.
-Havok.com(TM) (C) 1999-2001, Telekinesys Research Limited.
-jpeg2000 (C) 2001, David Taubman, Университет Нового Южного Уэльса (UNSW)
-jpeglib (C) 1991-1998, Thomas G. Lane.
-ogg/vorbis (C) 2001, Xiphophorus
-OpenSSL (C) 1998-2002 The OpenSSL Project.
-PCRE (c) 1997-2008, Кембриджский университет
-SDL (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
-SSLeay (C) 1995-1998 Eric Young (eay@cryptsoft.com)
-xmlrpc-epi (C) 2000 Epinions, Inc.
-zlib (C) 1995-2002 Jean-loup Gailly и Mark Adler.
-google-perftools (c) 2005, Google Inc.
+        В клиенте Second Life используется технология Havok (TM) Physics. (C) 1999-2010 Havok.com Inc. (и лицензиары компании). Все права защищены. Подробнее см. веб-сайт www.havok.com.
 
-В клиенте Second Life используется технология Havok (TM) Physics. (C) 1999-2010 Havok.com Inc. (и лицензиары компании). Все права защищены. Подробнее см. веб-сайт www.havok.com.
+        Это программное обеспечение содержит исходный код, предоставленный корпорацией NVIDIA.
 
-Все права защищены.  Подробные сведения см. в файле licenses.txt.
+        Все права защищены.  Подробные сведения см. в файле licenses.txt.
 
-Кодирование звука для голосового чата: Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1, Приложение C)
+        Кодирование звука для голосового чата: Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C)
 			</text_editor>
 		</panel>
 	</tab_container>
diff --git a/indra/newview/skins/default/xui/ru/floater_about_land.xml b/indra/newview/skins/default/xui/ru/floater_about_land.xml
index 3c278fce52ca926f34cb409122cf41926d90bfae..ee74aad5ccce7179db67416151eeda6a41edfb82 100644
--- a/indra/newview/skins/default/xui/ru/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/ru/floater_about_land.xml
@@ -129,7 +129,7 @@
 				Посещаемость:
 			</text>
 			<text name="DwellText">
-				0
+				Загрузка...
 			</text>
 			<button label="Купить землю" name="Buy Land..."/>
 			<button label="Продать для Linden" name="Linden Sale..." tool_tip="Земля должна быть в собственности, иметь заданное содержимое и не быть выставленной на аукцион,"/>
@@ -306,14 +306,13 @@
 			<panel.string name="push_restrict_region_text">
 				Не толкать (настройки региона)
 			</panel.string>
-			<panel.string name="see_avs_text">
-				Видеть жителей этого участка и общаться с ними в чате
-			</panel.string>
 			<text name="allow_label">
 				Позволить другим жителям:
 			</text>
-			<check_box label="Изменить ландшафт" name="edit land check" tool_tip="Если отмечено, вашу землю сможет терраформировать кто угодно. Лучше не отмечать, так как вы всегда можете изменить вашу землю."/>
-			<check_box label="Полет" name="check fly" tool_tip="Если отмечено, жители смогут летать над вашей землей. Если не отметить, они смогут только прилетать и пролетать мимо земли."/>
+			<text name="allow_label0">
+				Полет:
+			</text>
+			<check_box label="Все" name="check fly" tool_tip="Если отмечено, жители смогут летать над вашей землей. Если не отметить, они смогут только прилетать и пролетать мимо земли."/>
 			<text name="allow_label2">
 				Строительство:
 			</text>
@@ -329,9 +328,6 @@
 			</text>
 			<check_box label="Все" name="check other scripts"/>
 			<check_box label="Группа" name="check group scripts"/>
-			<text name="land_options_label">
-				Параметры земли:
-			</text>
 			<check_box label="Безопасно (нет повреждений)" name="check safe" tool_tip="Если отмечено, то земля считается безопасной, отключены боевые повреждения. Если не отмечено, то боевые повреждения включены."/>
 			<check_box label="Не толкать" name="PushRestrictCheck" tool_tip="Запрещает скриптам функцию толкания. Этот параметр может оказаться полезным для предотвращения нежелательного поведения на вашей земле."/>
 			<check_box label="Показать место в поиске (L$30/неделя)" name="ShowDirectoryCheck" tool_tip="Позволить людям видеть участок в результатах поиска"/>
@@ -372,9 +368,9 @@
 			</text>
 			<texture_picker name="snapshot_ctrl" tool_tip="Щелкните для выбора изображения"/>
 			<text name="allow_label5">
-				Позволить жителям с других участков:
+				Аватары с других участков могут видеть аватары на этом участке и общаться с ними
 			</text>
-			<check_box label="Видны аватары" name="SeeAvatarsCheck" tool_tip="Жители с других участков могут видеть жителей этого участка и общаться с ними в чате (вы также сможете видеть жителей с других участков и общаться с ними)."/>
+			<check_box label="Видны аватары" name="SeeAvatarsCheck" tool_tip="Аватары с других участков смогут видеть аватары на этом участке и общаться с ними в чате, а вы также сможете видеть их и общаться с ними."/>
 			<text name="landing_point">
 				В точку телепортации: [LANDING]
 			</text>
@@ -447,20 +443,15 @@
 			<panel.string name="access_estate_defined">
 				(Определено на землевладении)
 			</panel.string>
-			<panel.string name="allow_public_access">
-				Разрешить общий доступ ([MATURITY]) (Снятие приведет к созданию линий запрета)
-			</panel.string>
 			<panel.string name="estate_override">
 				Часть этих параметров установлена на уровне землевладения
 			</panel.string>
-			<text name="Limit access to this parcel to:">
-				Доступ на этот участок
-			</text>
+			<check_box label="Разрешить публичный доступ (снятие флажка приведет к созданию линий запрета)" name="public_access"/>
 			<text name="Only Allow">
-				Разрешить доступ только жителям, у которых:
+				Разрешить доступ только таким жителям:
 			</text>
-			<check_box label="Записана информация об оплате [ESTATE_PAYMENT_LIMIT]" name="limit_payment" tool_tip="Банить нераспознанных жителей."/>
-			<check_box label="Проверка возраста [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="Банить жителей, не прошедших проверку возраста. Более подробная информация находится здесь: [SUPPORT_SITE]."/>
+			<check_box label="Зарегистрирована информация об оплате [ESTATE_PAYMENT_LIMIT]" name="limit_payment" tool_tip="Для доступа к этому участку у жителя должна быть зарегистрирована информация об оплате.  Более подробная информация находится здесь: [SUPPORT_SITE]."/>
+			<check_box label="Подтвержден возраст [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="Для доступа к этому участку житель должен подтвердить свой возраст. Более подробная информация находится здесь: [SUPPORT_SITE]."/>
 			<check_box label="Разрешить доступ группе: [GROUP]" name="GroupCheck" tool_tip="Группа устанавливается на основной вкладке."/>
 			<check_box label="Продать доступ:" name="PassCheck" tool_tip="Разрешить временный доступ к участку."/>
 			<combo_box name="pass_combo">
diff --git a/indra/newview/skins/default/xui/ru/floater_animation_anim_preview.xml b/indra/newview/skins/default/xui/ru/floater_animation_anim_preview.xml
new file mode 100644
index 0000000000000000000000000000000000000000..711afc271723fadcf366921ba18afd1ff934632f
--- /dev/null
+++ b/indra/newview/skins/default/xui/ru/floater_animation_anim_preview.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Anim Preview" title="ANIMATION.ANIM">
+	<text name="name_label">
+		Название:
+	</text>
+	<text name="description_label">
+		Описание:
+	</text>
+	<button label="Передать (L$[AMOUNT])" name="ok_btn"/>
+	<button label="Отмена" label_selected="Отмена" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/ru/floater_animation_bvh_preview.xml b/indra/newview/skins/default/xui/ru/floater_animation_bvh_preview.xml
new file mode 100644
index 0000000000000000000000000000000000000000..8ad9d8657a154096af470401e2e3f2f5ba0bc261
--- /dev/null
+++ b/indra/newview/skins/default/xui/ru/floater_animation_bvh_preview.xml
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Animation Preview">
+	<floater.string name="failed_to_initialize">
+		Невозможно инициализировать движение
+	</floater.string>
+	<floater.string name="anim_too_long">
+		Длина файла анимации: [LENGTH] с.
+
+Максимальная длина анимации: [MAX_LENGTH] с.
+	</floater.string>
+	<floater.string name="failed_file_read">
+		Невозможно прочитать файл анимации.
+
+[STATUS]
+	</floater.string>
+	<floater.string name="E_ST_OK">
+		ОК
+	</floater.string>
+	<floater.string name="E_ST_EOF">
+		Преждевременный конец файла.
+	</floater.string>
+	<floater.string name="E_ST_NO_CONSTRAINT">
+		Не могу прочитать определение ограничений.
+	</floater.string>
+	<floater.string name="E_ST_NO_FILE">
+		Не удалось открыть BVH-файл.
+	</floater.string>
+	<floater.string name="E_ST_NO_HIER">
+		Неправильный заголовок HIERARCHY.
+	</floater.string>
+	<floater.string name="E_ST_NO_JOINT">
+		Не удалось найти ROOT или JOINT.
+	</floater.string>
+	<floater.string name="E_ST_NO_NAME">
+		Не удалось получить имя JOINT.
+	</floater.string>
+	<floater.string name="E_ST_NO_OFFSET">
+		Не удалось найти OFFSET.
+	</floater.string>
+	<floater.string name="E_ST_NO_CHANNELS">
+		Не удалось найти CHANNELS.
+	</floater.string>
+	<floater.string name="E_ST_NO_ROTATION">
+		Не удалось получить порядок вращения.
+	</floater.string>
+	<floater.string name="E_ST_NO_AXIS">
+		Не удалось получить оси вращения.
+	</floater.string>
+	<floater.string name="E_ST_NO_MOTION">
+		Не удалось найти MOTION.
+	</floater.string>
+	<floater.string name="E_ST_NO_FRAMES">
+		Не удалось получить количество кадров.
+	</floater.string>
+	<floater.string name="E_ST_NO_FRAME_TIME">
+		Не удалось получить время кадра.
+	</floater.string>
+	<floater.string name="E_ST_NO_POS">
+		Не удалось получить значения position.
+	</floater.string>
+	<floater.string name="E_ST_NO_ROT">
+		Не удалось получить значения rotation.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_FILE">
+		Не удалось открыть файл перевода.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_HEADER">
+		Не удалось прочитать заголовок перевода.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_NAME">
+		Не удалось прочитать имена перевода.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_IGNORE">
+		Не удалось прочитать значение перевода ignore.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_RELATIVE">
+		Не удалось прочитать значение перевода relative.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_OUTNAME">
+		Не удалось прочитать значение перевода outname.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MATRIX">
+		Не удалось прочитать матрицу перевода.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MERGECHILD">
+		Не удалось получить имя mergechild.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MERGEPARENT">
+		Не удалось получить имя mergeparent.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_PRIORITY">
+		Не удалось получить значение priority.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_LOOP">
+		Не удалось получить значение loop.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EASEIN">
+		Не удалось получить значения easeIn.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EASEOUT">
+		Не удалось получить значения easeOut.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_HAND">
+		Не удалось получить значение hand morph.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EMOTE">
+		Не удалось прочитать имя emote.
+	</floater.string>
+	<floater.string name="E_ST_BAD_ROOT">
+		Неверное имя корневого соединения, должно быть «hip».
+	</floater.string>
+	<text name="name_label">
+		Название:
+	</text>
+	<text name="description_label">
+		Описание:
+	</text>
+	<spinner label="Приоритет" name="priority" tool_tip="Управляет тем, как другие анимации могут перекрываться этой"/>
+	<check_box label="Цикл" name="loop_check" tool_tip="Делает анимацию зацикленной"/>
+	<spinner label="Начало(%)" name="loop_in_point" tool_tip="Устанавливает точку возврата цикла"/>
+	<spinner label="Конец(%)" name="loop_out_point" tool_tip="Устанавливает точку конца цикла"/>
+	<text name="hand_label">
+		Положение пальцев
+	</text>
+	<combo_box name="hand_pose_combo" tool_tip="Контролирует положение пальцев во время анимации">
+		<combo_box.item label="Разведены" name="Spread"/>
+		<combo_box.item label="Расслаблены" name="Relaxed"/>
+		<combo_box.item label="Указывают" name="PointBoth"/>
+		<combo_box.item label="Сжаты в кулак" name="Fist"/>
+		<combo_box.item label="Левые расслаблены" name="RelaxedLeft"/>
+		<combo_box.item label="Левые указывают" name="PointLeft"/>
+		<combo_box.item label="Левые в кулак" name="FistLeft"/>
+		<combo_box.item label="Правые расслаблены" name="RelaxedRight"/>
+		<combo_box.item label="Правые указывают" name="PointRight"/>
+		<combo_box.item label="Правые в кулак" name="FistRight"/>
+		<combo_box.item label="Правые в приветствии" name="SaluteRight"/>
+		<combo_box.item label="Печатают" name="Typing"/>
+		<combo_box.item label="Правые «V»" name="PeaceRight"/>
+	</combo_box>
+	<text name="emote_label">
+		Выражение лица
+	</text>
+	<combo_box name="emote_combo" tool_tip="Контролирует выражение лица во время анимации">
+		<item label="(нет)" name="[None]" value=""/>
+		<item label="Ааааах" name="Aaaaah" value="Ааааах"/>
+		<item label="Боится" name="Afraid" value="Боится"/>
+		<item label="Злится" name="Angry" value="Злится"/>
+		<item label="Широко улыбается" name="BigSmile" value="Широко улыбается"/>
+		<item label="Скучает" name="Bored" value="Скучает"/>
+		<item label="Плачет" name="Cry" value="Плачет"/>
+		<item label="Презирает" name="Disdain" value="Презирает"/>
+		<item label="Смущается" name="Embarrassed" value="Смущается"/>
+		<item label="Хмурится" name="Frown" value="Хмурится"/>
+		<item label="Целует" name="Kiss" value="Целует"/>
+		<item label="Смеется" name="Laugh" value="Смеется"/>
+		<item label="Дразнится" name="Plllppt" value="Дразнится"/>
+		<item label="Не соглашается" name="Repulsed" value="Не соглашается"/>
+		<item label="Грустит" name="Sad" value="Грустит"/>
+		<item label="Не понимает" name="Shrug" value="Не понимает"/>
+		<item label="Улыбается" name="Smile" value="Улыбается"/>
+		<item label="Удивляется" name="Surprise" value="Удивляется"/>
+		<item label="Подмигивает" name="Wink" value="Подмигивает"/>
+		<item label="Беспокоится" name="Worry" value="Беспокоится"/>
+	</combo_box>
+	<text name="preview_label">
+		Просмотр во время
+	</text>
+	<combo_box name="preview_base_anim" tool_tip="Просмотр вашей анимации во время выполнения аватаром действий.">
+		<item label="Стояние" name="Standing" value="Стояние"/>
+		<item label="Ходьба" name="Walking" value="Ходьба"/>
+		<item label="Сидение" name="Sitting" value="Сидение"/>
+		<item label="Полет" name="Flying" value="Полет"/>
+	</combo_box>
+	<spinner label="Вход (сек.)" name="ease_in_time" tool_tip="Количество времени (в секундах) для входа в стартовое положение"/>
+	<spinner label="Выход (сек.)" name="ease_out_time" tool_tip="Количество времени (в секундах) для выхода из анимации"/>
+	<button name="play_btn" tool_tip="Проиграть анимацию"/>
+	<button name="pause_btn" tool_tip="Приостановить анимацию"/>
+	<button name="stop_btn" tool_tip="Остановить проигрывание анимации"/>
+	<text name="bad_animation_text">
+		Невозможно прочитать файл анимации.
+
+Рекомендуется использовать BVH-файлы, экспортированные из Poser 4.
+	</text>
+	<button label="Передать (L$[AMOUNT])" name="ok_btn"/>
+	<button label="Отмена" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/ru/floater_avatar.xml b/indra/newview/skins/default/xui/ru/floater_avatar.xml
index 6bdf81988098e0d202aebc5089a6879c272b053a..b480af9345d3891a073f6b8229c0f9eb82f895b5 100644
--- a/indra/newview/skins/default/xui/ru/floater_avatar.xml
+++ b/indra/newview/skins/default/xui/ru/floater_avatar.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Avatar" title="ВЫБОР АВАТАРА"/>
+<floater name="Avatar" title="ВЫБЕРИТЕ АВАТАР"/>
diff --git a/indra/newview/skins/default/xui/ru/floater_buy_currency.xml b/indra/newview/skins/default/xui/ru/floater_buy_currency.xml
index 7690ff2a6c8f73e7c542581a7904728dfc9d67c3..87e8bd524e95b070fd4fb481a8296b252537591b 100644
--- a/indra/newview/skins/default/xui/ru/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/ru/floater_buy_currency.xml
@@ -46,7 +46,7 @@
 		L$ [AMT]
 	</text>
 	<text name="currency_links">
-		[http://www.secondlife.com/my/account/payment_method_management.php способ оплаты] | [http://www.secondlife.com/my/account/currency.php валюта] | [http://www.secondlife.com/my/account/exchange_rates.php обменный курс]
+		[http://www.secondlife.com/my/account/payment_method_management.php способ оплаты] | [http://www.secondlife.com/my/account/currency.php деньги]
 	</text>
 	<text name="exchange_rate_note">
 		Повторно введите сумму, чтобы увидеть новый обменный курс.
diff --git a/indra/newview/skins/default/xui/ru/floater_camera.xml b/indra/newview/skins/default/xui/ru/floater_camera.xml
index 7a1f530668a280e723af2d268b84fd6a4e0d8bbe..52e7c62e06edbe9ef76b84ca19c80ea6f09a0a67 100644
--- a/indra/newview/skins/default/xui/ru/floater_camera.xml
+++ b/indra/newview/skins/default/xui/ru/floater_camera.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="camera_floater" title="КАМЕРА">
+<floater name="camera_floater" title="УПРАВЛЕНИЕ КАМЕРОЙ">
 	<floater.string name="rotate_tooltip">
 		Повернуть камеру вокруг точки фокусировки
 	</floater.string>
@@ -9,15 +9,6 @@
 	<floater.string name="move_tooltip">
 		Переместить камеру вверх, вниз, влево или вправо
 	</floater.string>
-	<floater.string name="camera_modes_title">
-		Режимы камеры
-	</floater.string>
-	<floater.string name="pan_mode_title">
-		Вращение, приближение, сдвиг
-	</floater.string>
-	<floater.string name="presets_mode_title">
-		Стандартные настройки
-	</floater.string>
 	<floater.string name="free_mode_title">
 		Смотреть на объект
 	</floater.string>
diff --git a/indra/newview/skins/default/xui/ru/floater_chat_bar.xml b/indra/newview/skins/default/xui/ru/floater_chat_bar.xml
index eceab1775a59844aded11fa4b94ed19629fae759..79b7b033fb663933aed996d29ed3b561b3d4feb4 100644
--- a/indra/newview/skins/default/xui/ru/floater_chat_bar.xml
+++ b/indra/newview/skins/default/xui/ru/floater_chat_bar.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="chat_bar" title="ЛОКАЛЬНЫЙ ЧАТ">
-	<panel>
+	<panel name="bottom_panel">
 		<line_editor label="Щелкните здесь для общения." name="chat_box" tool_tip="Нажмите Enter, чтобы сказать, Ctrl+Enter, чтобы прокричать"/>
 		<button name="show_nearby_chat" tool_tip="Показать/скрыть лог локального чата"/>
 	</panel>
diff --git a/indra/newview/skins/default/xui/ru/floater_hardware_settings.xml b/indra/newview/skins/default/xui/ru/floater_hardware_settings.xml
index 0fefb76ea5284ebd0f3f160cb8da223d44e269af..7400f1df3b5fb48d5a26f4f3a4ecdf3ddeb280ad 100644
--- a/indra/newview/skins/default/xui/ru/floater_hardware_settings.xml
+++ b/indra/newview/skins/default/xui/ru/floater_hardware_settings.xml
@@ -4,7 +4,7 @@
 		Фильтрация:
 	</text>
 	<check_box label="Анизотропная фильтрация (медленнее, если включено)" name="ani"/>
-	<text name="Antialiasing:">
+	<text name="antialiasing label">
 		Сглаживание:
 	</text>
 	<combo_box label="Сглаживание" name="fsaa">
diff --git a/indra/newview/skins/default/xui/ru/floater_merchant_outbox.xml b/indra/newview/skins/default/xui/ru/floater_merchant_outbox.xml
new file mode 100644
index 0000000000000000000000000000000000000000..332fa3b82fc383c9e5ee348da53a8e3211de271d
--- /dev/null
+++ b/indra/newview/skins/default/xui/ru/floater_merchant_outbox.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_merchant_outbox" title="ТОРГОВЫЕ ИСХОДЯЩИЕ">
+	<string name="OutboxFolderCount1">
+		1 папка
+	</string>
+	<string name="OutboxFolderCountN">
+		[NUM] папки
+	</string>
+	<string name="OutboxImporting">
+		Отправка папок....
+	</string>
+	<string name="OutboxInitializing">
+		Инициализация...
+	</string>
+	<panel label="">
+		<panel>
+			<panel name="outbox_inventory_placeholder_panel">
+				<text name="outbox_inventory_placeholder_title">
+					Загрузка...
+				</text>
+			</panel>
+		</panel>
+		<panel>
+			<button label="Отправить в торговый центр" name="outbox_import_btn" tool_tip="Выставить на витрину моего магазина"/>
+		</panel>
+	</panel>
+</floater>
diff --git a/indra/newview/skins/default/xui/ru/floater_model_preview.xml b/indra/newview/skins/default/xui/ru/floater_model_preview.xml
index 31517e722d91024cfb0f5c9ca6baf6154f7d0b61..5bb96b8de450493f431869f587283d125aec663e 100644
--- a/indra/newview/skins/default/xui/ru/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/ru/floater_model_preview.xml
@@ -4,6 +4,9 @@
 	<string name="status_parse_error">
 		Ошибка. Проблема при анализе файла DAE – см. подробности в журнале.
 	</string>
+	<string name="status_material_mismatch">
+		Ошибка. Материал модели не входит в эталонную модель.
+	</string>
 	<string name="status_reading_file">
 		Загрузка...
 	</string>
@@ -137,7 +140,7 @@
 				</panel>
 				<panel name="physics analysis">
 					<text name="method_label">
-						Шаг 2. Анализ
+						2 этап. Анализ
 					</text>
 					<text name="analysis_method_label">
 						Метод:
diff --git a/indra/newview/skins/default/xui/ru/floater_model_wizard.xml b/indra/newview/skins/default/xui/ru/floater_model_wizard.xml
index ef2fe8e5a5fdece711cff6f4f2e7417d788744a9..c1a63bf7da652d1199fa0a16a0c2a607cd93a1a9 100644
--- a/indra/newview/skins/default/xui/ru/floater_model_wizard.xml
+++ b/indra/newview/skins/default/xui/ru/floater_model_wizard.xml
@@ -6,20 +6,23 @@
 	<button label="2. Оптимизировать" name="optimize_btn"/>
 	<button label="1. Выбрать файл" name="choose_file_btn"/>
 	<panel name="choose_file_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="choose_file_header_panel">
+			<text name="choose_file_header_text">
 				Выберите файл модели
 			</text>
 		</panel>
-		<panel name="content">
+		<panel name="choose_file_content">
 			<text name="advanced_users_text">
-				Пользователям в расширенном режиме: если вы умеете создавать трехмерные графические объекты, то, возможно, захотите воспользоваться средством Advanced Uploader, которое предоставляет расширенные возможности передачи объектов.
+				Пользователям, работающим в расширенном режиме: если вы умеете создавать трехмерные графические объекты, то, возможно, захотите воспользоваться средством Advanced Uploader, которое предоставляет расширенные возможности передачи объектов.
 			</text>
 			<button label="Перейти в расширенный режим" name="switch_to_advanced"/>
 			<text name="Cache location">
 				Выберите файл модели для передачи
 			</text>
 			<button label="Обзор..." label_selected="Обзор..." name="browse"/>
+			<text name="Model types">
+				В Second Life поддерживаются файлы COLLADA (.dae)
+			</text>
 			<text name="dimensions">
 				X         Y         Z
 			</text>
@@ -32,26 +35,26 @@
 		</panel>
 	</panel>
 	<panel name="optimize_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="optimize_header_panel">
+			<text name="optimize_header_text">
 				Оптимизировать модель
 			</text>
 		</panel>
-		<text name="description">
+		<text name="optimize_description">
 			Мы оптимизировали модель для повышения быстродействия. По желанию можно выполнить дополнительную настройку.
 		</text>
-		<panel name="content">
+		<panel name="optimize_content">
 			<text name="high_detail_text">
-				Создать уровень детализации: высокий
+				Создать уровень детализации: Высокий
 			</text>
 			<text name="medium_detail_text">
-				Создать уровень детализации: средний
+				Создать уровень детализации: Средний
 			</text>
 			<text name="low_detail_text">
-				Создать уровень детализации: низкий
+				Создать уровень детализации: Низкий
 			</text>
 			<text name="lowest_detail_text">
-				Создать уровень детализации: самый низкий
+				Создать уровень детализации: Самый низкий
 			</text>
 		</panel>
 		<panel name="content2">
@@ -76,19 +79,19 @@
 		</panel>
 	</panel>
 	<panel name="physics_panel">
-		<panel name="header_panel">
-			<text name="header_text">
-				Настроить физику
+		<panel name="physics_header_panel">
+			<text name="physics_header_text">
+				Настроить физические параметры
 			</text>
 		</panel>
-		<text name="description">
+		<text name="physics_description">
 			Мы создадим форму для внешнего каркаса модели. Настройте уровень детализации формы в соответствии с целями, для которых предназначена модель.
 		</text>
-		<panel name="content">
-			<button label="Пересчитать физику" name="recalculate_physics_btn"/>
+		<panel name="physics_content">
+			<button label="Пересчитать физические данные" name="recalculate_physics_btn"/>
 			<button label="Пересчет..." name="recalculating_physics_btn"/>
 			<text name="lod_label">
-				Просмотр физики
+				Просмотр физических данных
 			</text>
 			<combo_box name="preview_lod_combo2" tool_tip="Уровень детализации при предварительном просмотре">
 				<combo_item name="high">
@@ -107,12 +110,12 @@
 		</panel>
 	</panel>
 	<panel name="review_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="review_header_panel">
+			<text name="review_header_text">
 				Просмотр
 			</text>
 		</panel>
-		<panel name="content">
+		<panel name="review_content">
 			<text name="review_prim_equiv">
 				Воздействие на участок/регион: эквивалент в примитивах: [EQUIV]
 			</text>
@@ -125,8 +128,8 @@
 		</panel>
 	</panel>
 	<panel name="upload_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="upload_header_panel">
+			<text name="upload_header_text">
 				Передача завершена
 			</text>
 		</panel>
diff --git a/indra/newview/skins/default/xui/ru/floater_moveview.xml b/indra/newview/skins/default/xui/ru/floater_moveview.xml
index 6e01f997e18482d0a8721a7947350ca2467ce8c4..cb1fda1a1f3b7e040f459e425b2ffd7798cf75af 100644
--- a/indra/newview/skins/default/xui/ru/floater_moveview.xml
+++ b/indra/newview/skins/default/xui/ru/floater_moveview.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="move_floater" title="ПЕРЕМЕЩЕНИЕ">
+<floater name="move_floater" title="ХОДЬБА / БЕГ / ПОЛЕТ">
 	<string name="walk_forward_tooltip">
 		Идти вперед (нажмите стрелку вверх или клавишу W)
 	</string>
diff --git a/indra/newview/skins/default/xui/ru/floater_preview_animation.xml b/indra/newview/skins/default/xui/ru/floater_preview_animation.xml
index a1fabedb85f49a09cf9c6268593f8e81fff6d2ae..22c6bc59015697b7a5f48d3f5034cf6a7654d0ff 100644
--- a/indra/newview/skins/default/xui/ru/floater_preview_animation.xml
+++ b/indra/newview/skins/default/xui/ru/floater_preview_animation.xml
@@ -6,6 +6,6 @@
 	<text name="desc txt">
 		Описание:
 	</text>
-	<button label="Проиграть для всех" label_selected="Стоп" name="Anim play btn" tool_tip="Проигрывание этой анимации могут видеть другие участники"/>
-	<button label="Проиграть для себя" label_selected="Стоп" name="Anim audition btn" tool_tip="Проигрывание этой анимации можете видеть только вы"/>
+	<button label="Проиграть для всех" label_selected="Стоп" name="Inworld" tool_tip="Проигрывание этой анимации могут видеть другие участники"/>
+	<button label="Проиграть для себя" label_selected="Стоп" name="Locally" tool_tip="Проигрывание этой анимации можете видеть только вы"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/ru/floater_snapshot.xml b/indra/newview/skins/default/xui/ru/floater_snapshot.xml
index f85d602be72cf1cd628dcb00a1858a39996fd51c..7e88630b32ecf4bc713da041c2567896bb659625 100644
--- a/indra/newview/skins/default/xui/ru/floater_snapshot.xml
+++ b/indra/newview/skins/default/xui/ru/floater_snapshot.xml
@@ -3,72 +3,63 @@
 	<floater.string name="unknown">
 		неизвестно
 	</floater.string>
-	<radio_group label="Тип снимка" name="snapshot_type_radio">
-		<radio_item label="Электронная почта" name="postcard"/>
-		<radio_item label="Мой инвентарь (L$[AMOUNT])" name="texture"/>
-		<radio_item label="Сохранить на моем компьютере" name="local"/>
-	</radio_group>
+	<string name="postcard_progress_str">
+		Отправка письма
+	</string>
+	<string name="profile_progress_str">
+		Публикация
+	</string>
+	<string name="inventory_progress_str">
+		Сохранение в -инвентарь
+	</string>
+	<string name="local_progress_str">
+		Сохранение на компьютере
+	</string>
+	<string name="profile_succeeded_str">
+		Изображение отправлено
+	</string>
+	<string name="postcard_succeeded_str">
+		Письмо отправлено!
+	</string>
+	<string name="inventory_succeeded_str">
+		Сохранено в инвентаре!
+	</string>
+	<string name="local_succeeded_str">
+		Сохранено на компьютере!
+	</string>
+	<string name="profile_failed_str">
+		Не удалось передать изображение в ваш профиль.
+	</string>
+	<string name="postcard_failed_str">
+		Не удалось отправить письмо.
+	</string>
+	<string name="inventory_failed_str">
+		Не удалось сохранить в инвентаре.
+	</string>
+	<string name="local_failed_str">
+		Не удалось сохранить на компьютере.
+	</string>
+	<button name="advanced_options_btn" tool_tip="Дополнительные параметры"/>
+	<text name="image_res_text">
+		[WIDTH] x [HEIGHT] пикс.
+	</text>
 	<text name="file_size_label">
 		[SIZE] КБ
 	</text>
-	<button label="Послать" name="send_btn"/>
-	<button label="Сохранить (L$[AMOUNT])" name="upload_btn"/>
-	<flyout_button label="Сохранить" name="save_btn" tool_tip="Сохранить изображение в файл">
-		<flyout_button.item label="Сохранить" name="save_item"/>
-		<flyout_button.item label="Сохранить как..." name="saveas_item"/>
-	</flyout_button>
-	<button label="Больше" name="more_btn" tool_tip="Дополнительные параметры"/>
-	<button label="Меньше" name="less_btn" tool_tip="Дополнительные параметры"/>
-	<button label="Отмена" name="discard_btn"/>
-	<text name="type_label2">
-		Размер
-	</text>
-	<text name="format_label">
-		Формат
-	</text>
-	<combo_box label="Разрешение" name="postcard_size_combo">
-		<combo_box.item label="Текущее окно" name="CurrentWindow"/>
-		<combo_box.item label="640x480" name="640x480"/>
-		<combo_box.item label="800x600" name="800x600"/>
-		<combo_box.item label="1024x768" name="1024x768"/>
-		<combo_box.item label="Задать" name="Custom"/>
-	</combo_box>
-	<combo_box label="Разрешение" name="texture_size_combo">
-		<combo_box.item label="Текущее окно" name="CurrentWindow"/>
-		<combo_box.item label="Маленький (128x128)" name="Small(128x128)"/>
-		<combo_box.item label="Средний (256x256)" name="Medium(256x256)"/>
-		<combo_box.item label="Большой (512x512)" name="Large(512x512)"/>
-		<combo_box.item label="Задать" name="Custom"/>
-	</combo_box>
-	<combo_box label="Разрешение" name="local_size_combo">
-		<combo_box.item label="Текущее окно" name="CurrentWindow"/>
-		<combo_box.item label="320x240" name="320x240"/>
-		<combo_box.item label="640x480" name="640x480"/>
-		<combo_box.item label="800x600" name="800x600"/>
-		<combo_box.item label="1024x768" name="1024x768"/>
-		<combo_box.item label="1280x1024" name="1280x1024"/>
-		<combo_box.item label="1600x1200" name="1600x1200"/>
-		<combo_box.item label="Задать" name="Custom"/>
-	</combo_box>
-	<combo_box label="Формат" name="local_format_combo">
-		<combo_box.item label="PNG" name="PNG"/>
-		<combo_box.item label="JPEG" name="JPEG"/>
-		<combo_box.item label="BMP" name="BMP"/>
-	</combo_box>
-	<spinner label="Ширина" name="snapshot_width"/>
-	<spinner label="Высота" name="snapshot_height"/>
-	<check_box label="Сохранять пропорции" name="keep_aspect_check"/>
-	<slider label="Качество изображения" name="image_quality_slider"/>
-	<text name="layer_type_label">
-		Захват:
-	</text>
-	<combo_box label="Слои изображения" name="layer_types">
-		<combo_box.item label="Цвета" name="Colors"/>
-		<combo_box.item label="Глубина" name="Depth"/>
-	</combo_box>
-	<check_box label="Интерфейс" name="ui_check"/>
-	<check_box label="HUD" name="hud_check"/>
-	<check_box label="Оставить окно открытым" name="keep_open_check"/>
-	<check_box label="Стоп-кадр (полноэкранный)" name="freeze_frame_check"/>
-	<check_box label="Автообновление" name="auto_snapshot_check"/>
+	<panel name="advanced_options_panel">
+		<text name="advanced_options_label">
+			ДОПОЛНИТЕЛЬНЫЕ ПАРАМЕТРЫ
+		</text>
+		<text name="layer_type_label">
+			Захват:
+		</text>
+		<combo_box label="Слои изображения" name="layer_types">
+			<combo_box.item label="Цвета" name="Colors"/>
+			<combo_box.item label="Глубина" name="Depth"/>
+		</combo_box>
+		<check_box label="Интерфейс" name="ui_check"/>
+		<check_box label="Данные в игре" name="hud_check"/>
+		<check_box label="Стоп-кадр (полноэкранный)" name="freeze_frame_check"/>
+		<check_box label="Автообновление" name="auto_snapshot_check"/>
+	</panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/ru/floater_test_layout_stacks.xml b/indra/newview/skins/default/xui/ru/floater_test_layout_stacks.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b479d5f6d6bbc342a4c4bb9a33199290356156d9
--- /dev/null
+++ b/indra/newview/skins/default/xui/ru/floater_test_layout_stacks.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Test Floater" title="LAYOUTSTACK TESTS"/>
diff --git a/indra/newview/skins/default/xui/ru/floater_test_text_vertical_aligment.xml b/indra/newview/skins/default/xui/ru/floater_test_text_vertical_aligment.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d0bd86160e6898efabf651859aa6eb8f647ae81d
--- /dev/null
+++ b/indra/newview/skins/default/xui/ru/floater_test_text_vertical_aligment.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Test Floater" title="ТЕСТИРОВАТЬ ОКНО"/>
diff --git a/indra/newview/skins/default/xui/ru/floater_tools.xml b/indra/newview/skins/default/xui/ru/floater_tools.xml
index eb9083f7fc81f003399182f6cd0406c7970fbaf3..3d7d1198f083343e97fbabcb9456177ead3c3ab1 100644
--- a/indra/newview/skins/default/xui/ru/floater_tools.xml
+++ b/indra/newview/skins/default/xui/ru/floater_tools.xml
@@ -1,5 +1,20 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="toolbox floater" short_title="ИНСТРУМЕНТЫ ДЛЯ СТРОИТЕЛЬСТВА">
+	<floater.string name="grid_screen_text">
+		Экран
+	</floater.string>
+	<floater.string name="grid_local_text">
+		Локальная
+	</floater.string>
+	<floater.string name="grid_world_text">
+		Мировая
+	</floater.string>
+	<floater.string name="grid_reference_text">
+		Точка отсчета
+	</floater.string>
+	<floater.string name="grid_attachment_text">
+		Присоединение
+	</floater.string>
 	<floater.string name="status_rotate">
 		Перетягивайте цветные полосы для вращения объекта
 	</floater.string>
@@ -63,7 +78,12 @@
 	</text>
 	<check_box initial_value="истина" label="Растягивать текстуры" name="checkbox stretch textures"/>
 	<check_box initial_value="истина" label="Привязка" name="checkbox snap to grid"/>
-	<button label="Параметры..." name="Options..." tool_tip="Дополнительные параметры сетки"/>
+	<combo_box name="combobox grid mode" tool_tip="Выберите тип линейки сетки для размещения объекта">
+		<combo_box.item label="Мировая" name="World"/>
+		<combo_box.item label="Локальная" name="Local"/>
+		<combo_box.item label="Точка отсчета" name="Reference"/>
+	</combo_box>
+	<button label="" name="Options..." tool_tip="Дополнительные параметры сетки"/>
 	<button name="ToolCube" tool_tip="Куб"/>
 	<button name="ToolPrism" tool_tip="Призма"/>
 	<button name="ToolPyramid" tool_tip="Пирамида"/>
diff --git a/indra/newview/skins/default/xui/ru/floater_toybox.xml b/indra/newview/skins/default/xui/ru/floater_toybox.xml
index 8d7431d393ac0b7fb611c4c33d9c26fd740187ee..a4754ad7abf637eacdf157f0a4a2728cdf02a301 100644
--- a/indra/newview/skins/default/xui/ru/floater_toybox.xml
+++ b/indra/newview/skins/default/xui/ru/floater_toybox.xml
@@ -1,10 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Toybox" title="НАСТРОИТЬ ПАНЕЛИ ИНСТРУМЕНТОВ">
+<floater name="Toybox" title="КНОПКИ ПАНЕЛИ ИНСТРУМЕНТОВ">
 	<text name="toybox label 1">
 		Добавьте или удалите кнопки, перетягивая их на панели инструментов или с них.
 	</text>
 	<text name="toybox label 2">
 		Кнопки будут отображены в исходном виде или в виде значков, в зависимости от настроек каждой панели инструментов.
 	</text>
+	<button label="Очистить все панели" label_selected="Очистить все панели" name="btn_clear_all"/>
 	<button label="Вернуть стандартные" label_selected="Вернуть стандартные" name="btn_restore_defaults"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/ru/floater_translation_settings.xml b/indra/newview/skins/default/xui/ru/floater_translation_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..ad280a50dd6255e4e0ddc122aa01fe75beb17cf6
--- /dev/null
+++ b/indra/newview/skins/default/xui/ru/floater_translation_settings.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_translation_settings" title="НАСТРОЙКИ ПЕРЕВОДА ЧАТА">
+	<string name="bing_api_key_not_verified">
+		Bing appID не подтвержден. Повторите попытку.
+	</string>
+	<string name="google_api_key_not_verified">
+		Ключ Google API не подтвержден. Повторите попытку.
+	</string>
+	<string name="bing_api_key_verified">
+		Bing appID подтвержден.
+	</string>
+	<string name="google_api_key_verified">
+		Ключ Google API подтвержден.
+	</string>
+	<check_box label="Включить машинный перевод при чате" name="translate_chat_checkbox"/>
+	<text name="translate_language_label">
+		Переводить чат на:
+	</text>
+	<combo_box name="translate_language_combo">
+		<combo_box.item label="язык системы" name="System Default Language"/>
+		<combo_box.item label="английский" name="English"/>
+		<combo_box.item label="датский" name="Danish"/>
+		<combo_box.item label="немецкий" name="German"/>
+		<combo_box.item label="испанский" name="Spanish"/>
+		<combo_box.item label="французский" name="French"/>
+		<combo_box.item label="итальянский" name="Italian"/>
+		<combo_box.item label="венгерский" name="Hungarian"/>
+		<combo_box.item label="нидерландский" name="Dutch"/>
+		<combo_box.item label="польский" name="Polish"/>
+		<combo_box.item label="португальский" name="Portugese"/>
+		<combo_box.item label="русский" name="Russian"/>
+		<combo_box.item label="турецкий" name="Turkish"/>
+		<combo_box.item label="украинский" name="Ukrainian"/>
+		<combo_box.item label="китайский" name="Chinese"/>
+		<combo_box.item label="японский" name="Japanese"/>
+		<combo_box.item label="корейский" name="Korean"/>
+	</combo_box>
+	<text name="tip">
+		Выберите сервис перевода:
+	</text>
+	<radio_group name="translation_service_rg">
+		<radio_item initial_value="bing" label="Bing Translator" name="bing"/>
+		<radio_item initial_value="google" label="Google Translate" name="google"/>
+	</radio_group>
+	<text name="bing_api_key_label">
+		Bing [http://www.bing.com/developers/createapp.aspx AppID]:
+	</text>
+	<button label="Подтвердить" name="verify_bing_api_key_btn"/>
+	<text name="google_api_key_label">
+		Google [http://code.google.com/apis/language/translate/v2/getting_started.html#auth Ключ API]:
+	</text>
+	<button label="Подтвердить" name="verify_google_api_key_btn"/>
+	<text name="google_links_text">
+		[http://code.google.com/apis/language/translate/v2/pricing.html Цены] | [https://code.google.com/apis/console Статистика]
+	</text>
+	<button label="OK" name="ok_btn"/>
+	<button label="Отмена" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/ru/floater_voice_controls.xml b/indra/newview/skins/default/xui/ru/floater_voice_controls.xml
index c1fb858d48cf9b505abb7e6c9ebb893e99eaeea7..2b23086062483a1f435d7bc42ac2f2516c1920ae 100644
--- a/indra/newview/skins/default/xui/ru/floater_voice_controls.xml
+++ b/indra/newview/skins/default/xui/ru/floater_voice_controls.xml
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="floater_voice_controls" title="УПРАВЛЕНИЕ ГОЛОСОМ">
 	<string name="title_nearby">
-		Настройки голоса
+		НАСТРОЙКИ ГОЛОСА
 	</string>
 	<string name="title_group">
-		Звонок группе [GROUP]
+		ЗВОНОК ГРУППЕ [GROUP]
 	</string>
 	<string name="title_adhoc">
-		Конференция
+		КОНФЕРЕНЦИЯ
 	</string>
 	<string name="title_peer_2_peer">
-		Звонок пользователю [NAME]
+		ЗВОНОК ПОЛЬЗОВАТЕЛЮ [NAME]
 	</string>
 	<string name="no_one_near">
 		Нет никого с включенным голосом
diff --git a/indra/newview/skins/default/xui/ru/floater_voice_effect.xml b/indra/newview/skins/default/xui/ru/floater_voice_effect.xml
index d4bf615fe45b9f4b13cdd8a7a9115e31dacec812..1eb8a94d7a7bba4373e729057f601a01b83113d5 100644
--- a/indra/newview/skins/default/xui/ru/floater_voice_effect.xml
+++ b/indra/newview/skins/default/xui/ru/floater_voice_effect.xml
@@ -42,13 +42,16 @@
 	<string name="effect_Demon">
 		Demon
 	</string>
+	<string name="effect_Female Elf">
+		Фея
+	</string>
 	<string name="effect_Flirty">
 		Flirty
 	</string>
 	<string name="effect_Foxy">
 		Foxy
 	</string>
-	<string name="effect_Halloween_2010_Bonus">
+	<string name="effect_Halloween 2010 Bonus">
 		Бонус_за_Хэллоуин_2010
 	</string>
 	<string name="effect_Helium">
@@ -57,9 +60,18 @@
 	<string name="effect_Husky">
 		Husky
 	</string>
+	<string name="effect_Husky Whisper">
+		Хриплый шепот
+	</string>
 	<string name="effect_Intercom">
 		Внутренняя связь
 	</string>
+	<string name="effect_Julia">
+		Julia
+	</string>
+	<string name="effect_Lo Lilt">
+		Напев
+	</string>
 	<string name="effect_Macho">
 		Macho
 	</string>
@@ -69,6 +81,9 @@
 	<string name="effect_Mini">
 		Mini
 	</string>
+	<string name="effect_Model">
+		Модель
+	</string>
 	<string name="effect_Nano">
 		Nano
 	</string>
@@ -90,6 +105,9 @@
 	<string name="effect_Roxanne">
 		Roxanne
 	</string>
+	<string name="effect_Rumble">
+		Урчание
+	</string>
 	<string name="effect_Sabrina">
 		Sabrina
 	</string>
@@ -102,6 +120,9 @@
 	<string name="effect_Shorty">
 		Shorty
 	</string>
+	<string name="effect_Smaller">
+		Меньше
+	</string>
 	<string name="effect_Sneaky">
 		Sneaky
 	</string>
diff --git a/indra/newview/skins/default/xui/ru/menu_inspect_object_gear.xml b/indra/newview/skins/default/xui/ru/menu_inspect_object_gear.xml
index a72b2bef2392dedfe8597db4e03a84e31cfde443..30953e830bcaa30b1084adfb32508d23536c5fda 100644
--- a/indra/newview/skins/default/xui/ru/menu_inspect_object_gear.xml
+++ b/indra/newview/skins/default/xui/ru/menu_inspect_object_gear.xml
@@ -12,6 +12,7 @@
 	<menu_item_call label="Добавить" name="add"/>
 	<menu_item_call label="Пожаловаться" name="report"/>
 	<menu_item_call label="Заблокировать" name="block"/>
+	<menu_item_call label="Разблокировать" name="unblock"/>
 	<menu_item_call label="Приблизить" name="zoom_in"/>
 	<menu_item_call label="Удалить" name="remove"/>
 	<menu_item_call label="Дополнительная информация" name="more_info"/>
diff --git a/indra/newview/skins/default/xui/ru/menu_inventory.xml b/indra/newview/skins/default/xui/ru/menu_inventory.xml
index 4eeb1e46c2f40989f0b4b56de0f364f7f5c0967f..49f7281b4ebae7a58dd9e2d442c168565c9e39a4 100644
--- a/indra/newview/skins/default/xui/ru/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/ru/menu_inventory.xml
@@ -59,6 +59,7 @@
 	<menu_item_call label="Свойства" name="Properties"/>
 	<menu_item_call label="Переименовать" name="Rename"/>
 	<menu_item_call label="Копировать UUID актива" name="Copy Asset UUID"/>
+	<menu_item_call label="Вырезать" name="Cut"/>
 	<menu_item_call label="Копировать" name="Copy"/>
 	<menu_item_call label="Вставить" name="Paste"/>
 	<menu_item_call label="Вставить как ссылку" name="Paste As Link"/>
@@ -84,6 +85,6 @@
 	<menu_item_call label="Добавить" name="Wearable Add"/>
 	<menu_item_call label="Снять" name="Take Off"/>
 	<menu_item_call label="Копировать в «Торговые исходящие»" name="Merchant Copy"/>
-	<menu_item_call label="Переместить в «Торговые исходящие»" name="Merchant Move"/>
+	<menu_item_call label="Отправить в торговый центр" name="Marketplace Send"/>
 	<menu_item_call label="- нет действий -" name="--no options--"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/ru/menu_login.xml b/indra/newview/skins/default/xui/ru/menu_login.xml
index aa3570f1765557afaf7fe9abd946a02da3cf1a42..93a5ffbb25f96b1b09454eefdd3ec0f6da3f7579 100644
--- a/indra/newview/skins/default/xui/ru/menu_login.xml
+++ b/indra/newview/skins/default/xui/ru/menu_login.xml
@@ -17,8 +17,8 @@
 		<menu_item_call label="Задать размер окна..." name="Set Window Size..."/>
 		<menu_item_call label="Показать лицензионное соглашение" name="TOS"/>
 		<menu_item_call label="Показать сообщение об ошибке" name="Critical"/>
-		<menu_item_call label="Проверка медиабраузера" name="Web Browser Test"/>
 		<menu_item_call label="Тест отладки плавающего окна с веб-контентом" name="Web Content Floater Debug Test"/>
+		<menu label="Уровень журнала" name="Set Logging Level"/>
 		<menu_item_check label="Выбор сетки" name="Show Grid Picker"/>
 		<menu_item_call label="Консоль уведомлений" name="Show Notifications Console"/>
 	</menu>
diff --git a/indra/newview/skins/default/xui/ru/menu_toolbars.xml b/indra/newview/skins/default/xui/ru/menu_toolbars.xml
index e04a9ee57d2cbd09798cdb9dee3f21226c1bc5c6..aa05dbc390e87e53af646aa739d4b0cbd5270ee5 100644
--- a/indra/newview/skins/default/xui/ru/menu_toolbars.xml
+++ b/indra/newview/skins/default/xui/ru/menu_toolbars.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Toolbars Popup">
-	<menu_item_call label="Выбор кнопок..." name="Chose Buttons"/>
+	<menu_item_call label="Удалить эту кнопку" name="Remove button"/>
+	<menu_item_call label="Кнопки панели инструментов..." name="Choose Buttons"/>
 	<menu_item_check label="Значки и подписи" name="icons_with_text"/>
 	<menu_item_check label="Только значки" name="icons_only"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/ru/menu_viewer.xml b/indra/newview/skins/default/xui/ru/menu_viewer.xml
index b9f403c04b1021bdd8c6d1c3f668d12b52550ea1..0699314d971f643dffd13e1c8ffc10ab3b50bddf 100644
--- a/indra/newview/skins/default/xui/ru/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/ru/menu_viewer.xml
@@ -1,53 +1,58 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu_bar name="Main Menu">
 	<menu label="Я" name="Me">
-		<menu_item_call label="Информационная панель..." name="Manage My Account"/>
 		<menu_item_call label="Профиль…" name="Profile"/>
 		<menu_item_call label="Внешность..." name="ChangeOutfit"/>
+		<menu_item_call label="Выберите аватар..." name="Avatar Picker"/>
 		<menu_item_check label="Инвентарь..." name="Inventory"/>
-		<menu_item_check label="Жесты..." name="Gestures"/>
-		<menu_item_check label="Голос..." name="ShowVoice"/>
+		<menu_item_call label="Новое окно инвентаря" name="NewInventoryWindow"/>
+		<menu_item_call label="Места..." name="Places"/>
+		<menu_item_call label="Подборка..." name="Picks"/>
+		<menu_item_call label="Управление камерой..." name="Camera Controls"/>
 		<menu label="Движение" name="Movement">
 			<menu_item_call label="Сесть" name="Sit Down Here"/>
 			<menu_item_check label="Полет" name="Fly"/>
 			<menu_item_check label="Всегда бегать" name="Always Run"/>
 			<menu_item_call label="Остановить анимацию" name="Stop Animating My Avatar"/>
+			<menu_item_call label="Ходьба / бег / полет..." name="Walk / run / fly"/>
 		</menu>
 		<menu label="Статус" name="Status">
 			<menu_item_call label="Нет на месте" name="Set Away"/>
 			<menu_item_call label="Не беспокоить" name="Set Busy"/>
 		</menu>
-		<menu_item_call label="Запрос статуса администратора" name="Request Admin Options"/>
-		<menu_item_call label="Выход из статуса администратора" name="Leave Admin Options"/>
-		<menu_item_call label="Купить L$" name="Buy and Sell L$"/>
+		<menu_item_call label="Купить L$..." name="Buy and Sell L$"/>
+		<menu_item_call label="Торговые исходящие..." name="MerchantOutbox"/>
+		<menu_item_call label="Информационная панель аккаунта..." name="Manage My Account"/>
 		<menu_item_call label="Настройки..." name="Preferences"/>
-		<menu_item_call label="Панели инструментов..." name="Toolbars"/>
+		<menu_item_call label="Кнопки панели инструментов..." name="Toolbars"/>
 		<menu_item_call label="Скрыть все элементы управления" name="Hide UI"/>
 		<menu_item_call label="Выход из [APP_NAME]" name="Quit"/>
 	</menu>
 	<menu label="Общение" name="Communicate">
-		<menu_item_call label="Мои друзья" name="My Friends"/>
-		<menu_item_call label="Мои группы" name="My Groups"/>
-		<menu_item_check label="Локальный чат" name="Nearby Chat"/>
+		<menu_item_check label="Чат..." name="Nearby Chat"/>
+		<menu_item_check label="Говорить" name="Speak"/>
+		<menu_item_check label="Настройки голоса..." name="Nearby Voice"/>
+		<menu_item_check label="Изменение голоса..." name="ShowVoice"/>
+		<menu_item_check label="Жесты..." name="Gestures"/>
+		<menu_item_call label="Друзья" name="My Friends"/>
+		<menu_item_call label="Группы" name="My Groups"/>
 		<menu_item_call label="Люди неподалеку" name="Active Speakers"/>
-		<menu_item_check label="Голоса собеседников" name="Nearby Voice"/>
 	</menu>
 	<menu label="Мир" name="World">
-		<menu_item_check label="Миникарта" name="Mini-Map"/>
+		<menu_item_call label="Добавить закладку на это место" name="Create Landmark Here"/>
+		<menu_item_call label="Пункты..." name="Destinations"/>
 		<menu_item_check label="Карта мира" name="World Map"/>
+		<menu_item_check label="Миникарта" name="Mini-Map"/>
 		<menu_item_check label="Поиск" name="Search"/>
+		<menu_item_call label="Телепортация домой" name="Teleport Home"/>
+		<menu_item_call label="Установить дом здесь" name="Set Home to Here"/>
 		<menu_item_call label="Снимок" name="Take Snapshot"/>
-		<menu_item_call label="Добавить закладку на это место" name="Create Landmark Here"/>
-		<menu label="Профиль места" name="Land">
-			<menu_item_call label="Профиль места" name="Place Profile"/>
-			<menu_item_call label="О земле" name="About Land"/>
-			<menu_item_call label="Регион/землевладение" name="Region/Estate"/>
-		</menu>
+		<menu_item_call label="Профиль места" name="Place Profile"/>
+		<menu_item_call label="О земле" name="About Land"/>
+		<menu_item_call label="Регион/землевладение" name="Region/Estate"/>
+		<menu_item_call label="Мои владения..." name="My Land"/>
 		<menu_item_call label="Купить эту землю" name="Buy Land"/>
-		<menu_item_call label="Моя земля" name="My Land"/>
 		<menu label="Показать" name="LandShow">
-			<menu_item_check label="Панель движения" name="Movement Controls"/>
-			<menu_item_check label="Панель камеры" name="Camera Controls"/>
 			<menu_item_check label="Линии запрета" name="Ban Lines"/>
 			<menu_item_check label="Метки" name="beacons"/>
 			<menu_item_check label="Границы собственности" name="Property Lines"/>
@@ -56,16 +61,15 @@
 			<menu_item_check label="Свойства участка" name="Parcel Properties"/>
 			<menu_item_check label="Меню «Дополнительно»" name="Show Advanced Menu"/>
 		</menu>
-		<menu_item_call label="Телепортироваться домой" name="Teleport Home"/>
-		<menu_item_call label="Установить дом здесь" name="Set Home to Here"/>
-		<menu label="Солнце" name="Environment Settings">
+		<menu label="Солнце" name="Sun">
 			<menu_item_call label="Восход" name="Sunrise"/>
 			<menu_item_call label="Полдень" name="Noon"/>
 			<menu_item_call label="Закат" name="Sunset"/>
 			<menu_item_call label="Полночь" name="Midnight"/>
+			<menu_item_call label="Использовать настройки региона" name="Use Region Settings"/>
 		</menu>
-		<menu label="Редактор среды" name="Enviroment Editor">
-			<menu_item_call label="Настройки среды..." name="Enviroment Settings"/>
+		<menu label="Редактор среды" name="Environment Editor">
+			<menu_item_call label="Настройки среды..." name="Environment Settings"/>
 			<menu label="Настройки воды" name="Water Presets">
 				<menu_item_call label="Создать настройку..." name="new_water_preset"/>
 				<menu_item_call label="Изменить настройку..." name="edit_water_preset"/>
@@ -144,6 +148,7 @@
 		<menu_item_call label="Вернуть" name="Redo"/>
 	</menu>
 	<menu label="Справка" name="Help">
+		<menu_item_call label="Инструкции..." name="How To"/>
 		<menu_item_call label="Справка по [SECOND_LIFE]" name="Second Life Help"/>
 		<menu_item_call label="Жалоба" name="Report Abuse"/>
 		<menu_item_call label="Сообщить об ошибке" name="Report Bug"/>
@@ -171,22 +176,22 @@
 			<menu_item_check label="Показывать прицел при обзоре мышью" name="ShowCrosshairs"/>
 		</menu>
 		<menu label="Типы визуализации" name="Rendering Types">
-			<menu_item_check label="Обычная" name="Simple"/>
-			<menu_item_check label="Альфа" name="Alpha"/>
-			<menu_item_check label="Дерево" name="Tree"/>
-			<menu_item_check label="Аватары" name="Character"/>
-			<menu_item_check label="Исправление поверхности" name="Surface Patch"/>
-			<menu_item_check label="Небо" name="Sky"/>
-			<menu_item_check label="Вода" name="Water"/>
-			<menu_item_check label="Земля" name="Ground"/>
-			<menu_item_check label="Объем" name="Volume"/>
-			<menu_item_check label="Трава" name="Grass"/>
-			<menu_item_check label="Облака" name="Clouds"/>
-			<menu_item_check label="Частицы" name="Particles"/>
-			<menu_item_check label="Рельефное" name="Bump"/>
+			<menu_item_check label="Простой" name="Rendering Type Simple"/>
+			<menu_item_check label="Альфа" name="Rendering Type Alpha"/>
+			<menu_item_check label="Дерево" name="Rendering Type Tree"/>
+			<menu_item_check label="Аватары" name="Rendering Type Character"/>
+			<menu_item_check label="Исправление поверхности" name="Rendering Type Surface Patch"/>
+			<menu_item_check label="Небо" name="Rendering Type Sky"/>
+			<menu_item_check label="Вода" name="Rendering Type Water"/>
+			<menu_item_check label="Земля" name="Rendering Type Ground"/>
+			<menu_item_check label="Объем" name="Rendering Type Volume"/>
+			<menu_item_check label="Трава" name="Rendering Type Grass"/>
+			<menu_item_check label="Облака" name="Rendering Type Clouds"/>
+			<menu_item_check label="Частицы" name="Rendering Type Particles"/>
+			<menu_item_check label="Рельефное" name="Rendering Type Bump"/>
 		</menu>
 		<menu label="Функции визуализации" name="Rendering Features">
-			<menu_item_check label="Интерфейс пользователя" name="UI"/>
+			<menu_item_check label="Интерфейс пользователя" name="ToggleUI"/>
 			<menu_item_check label="Выбрано" name="Selected"/>
 			<menu_item_check label="Выделено" name="Highlighted"/>
 			<menu_item_check label="Динамические текстуры" name="Dynamic Textures"/>
@@ -198,11 +203,8 @@
 		<menu_item_check label="Использовать поток для чтения подключаемых модулей" name="Use Plugin Read Thread"/>
 		<menu_item_call label="Очистить кэш группы" name="ClearGroupCache"/>
 		<menu_item_check label="Сглаживание мышью" name="Mouse Smoothing"/>
+		<menu_item_call label="Освободить клавиши" name="Release Keys"/>
 		<menu label="Горячие клавиши" name="Shortcuts">
-			<menu_item_call label="Изображение (L$[COST])..." name="Upload Image"/>
-			<menu_item_check label="Поиск" name="Search"/>
-			<menu_item_call label="Освободить клавиши" name="Release Keys"/>
-			<menu_item_call label="Сбросить размер интерфейса" name="Set UI Size to Default"/>
 			<menu_item_check label="Показать меню «Дополнительно» - старое сочетание клавиш" name="Show Advanced Menu - legacy shortcut"/>
 			<menu_item_call label="Закрыть окно" name="Close Window"/>
 			<menu_item_call label="Закрыть все окна" name="Close All Windows"/>
@@ -211,13 +213,6 @@
 			<menu_item_check label="Обзор джойстиком" name="Joystick Flycam"/>
 			<menu_item_call label="Сброс обзора" name="Reset View"/>
 			<menu_item_call label="Смотреть на последнего говорившего" name="Look at Last Chatter"/>
-			<menu label="Выбрать инструменты" name="Select Tool">
-				<menu_item_call label="Фокус" name="Focus"/>
-				<menu_item_call label="Перемещение" name="Move"/>
-				<menu_item_call label="Редактирование" name="Edit"/>
-				<menu_item_call label="Создание" name="Create"/>
-				<menu_item_call label="Земля" name="Land"/>
-			</menu>
 			<menu_item_call label="Приблизить" name="Zoom In"/>
 			<menu_item_call label="Стандартный масштаб" name="Zoom Default"/>
 			<menu_item_call label="Отодвинуть" name="Zoom Out"/>
@@ -288,7 +283,9 @@
 			<menu_item_check label="Освещение" name="Lights"/>
 			<menu_item_check label="Каркас столкновений" name="Collision Skeleton"/>
 			<menu_item_check label="Лучи" name="Raycast"/>
+			<menu_item_check label="Направления ветра" name="Wind Vectors"/>
 			<menu_item_check label="Сложность визуализации" name="rendercomplexity"/>
+			<menu_item_check label="Байты присоединения" name="attachment bytes"/>
 			<menu_item_check label="Лепка" name="Sculpt"/>
 		</menu>
 		<menu label="Визуализация" name="Rendering">
@@ -300,7 +297,6 @@
 			<menu_item_check label="Освещение и тени" name="Lighting and Shadows"/>
 			<menu_item_check label="Тени от солнца, луны и прожекторов" name="Shadows from Sun/Moon/Projectors"/>
 			<menu_item_check label="SSAO и сглаживание теней" name="SSAO and Shadow Smoothing"/>
-			<menu_item_check label="Повсеместное освещение (экспериментальное)" name="Global Illumination"/>
 			<menu_item_check label="Отладка GL" name="Debug GL"/>
 			<menu_item_check label="Отладка конвейера" name="Debug Pipeline"/>
 			<menu_item_check label="Автоматические альфа-маски (отложенные)" name="Automatic Alpha Masks (deferred)"/>
@@ -331,9 +327,8 @@
 			<menu_item_call label="Начать запись" name="Start Record"/>
 			<menu_item_call label="Остановить запись" name="Stop Record"/>
 		</menu>
-		<menu label="Мир" name="World">
+		<menu label="Мир" name="DevelopWorld">
 			<menu_item_check label="Перекрытие солнца в симуляторе" name="Sim Sun Override"/>
-			<menu_item_check label="Мигающий маяк" name="Cheesy Beacon"/>
 			<menu_item_check label="Неизменная погода" name="Fixed Weather"/>
 			<menu_item_call label="Вывод кэша региональных объектов" name="Dump Region Object Cache"/>
 		</menu>
@@ -365,11 +360,11 @@
 		</menu>
 		<menu label="Аватар" name="Character">
 			<menu label="Захват запеченных текстур" name="Grab Baked Texture">
-				<menu_item_call label="Радужка" name="Iris"/>
-				<menu_item_call label="Голова" name="Head"/>
-				<menu_item_call label="Верхняя часть тела" name="Upper Body"/>
-				<menu_item_call label="Нижняя часть тела" name="Lower Body"/>
-				<menu_item_call label="Юбка" name="Skirt"/>
+				<menu_item_call label="Радужка" name="Grab Iris"/>
+				<menu_item_call label="Голова" name="Grab Head"/>
+				<menu_item_call label="Верхняя часть тела" name="Grab Upper Body"/>
+				<menu_item_call label="Нижняя часть тела" name="Grab Lower Body"/>
+				<menu_item_call label="Юбка" name="Grab Skirt"/>
 			</menu>
 			<menu label="Проверка персонажа" name="Character Tests">
 				<menu_item_call label="Внешний вид в XML" name="Appearance To XML"/>
@@ -397,16 +392,24 @@
 		<menu_item_check label="Текстуры HTTP" name="HTTP Textures"/>
 		<menu_item_check label="Инвентарь HTTP" name="HTTP Inventory"/>
 		<menu_item_call label="Сжатие изображений" name="Compress Images"/>
+		<menu_item_call label="Включить Visual Leak Detector" name="Enable Visual Leak Detector"/>
 		<menu_item_check label="Вывод минидампа при отладке" name="Output Debug Minidump"/>
 		<menu_item_check label="Окно консоли при следующем запуске" name="Console Window"/>
+		<menu label="Уровень журнала" name="Set Logging Level">
+			<menu_item_check label="Отладка" name="Debug"/>
+			<menu_item_check label="Информация" name="Info"/>
+			<menu_item_check label="Предупреждение" name="Warning"/>
+			<menu_item_check label="Ошибка" name="Error"/>
+			<menu_item_check label="Нет" name="None"/>
+		</menu>
 		<menu_item_call label="Запрос статуса администратора" name="Request Admin Options"/>
 		<menu_item_call label="Выход из статуса администратора" name="Leave Admin Options"/>
 		<menu_item_check label="Показать меню администратора" name="View Admin Options"/>
 	</menu>
 	<menu label="Администратор" name="Admin">
-		<menu label="Object">
-			<menu_item_call label="Взять копию" name="Take Copy"/>
-			<menu_item_call label="Назначить себя владельцем" name="Force Owner To Me"/>
+		<menu label="Объект" name="AdminObject">
+			<menu_item_call label="Сделать копию" name="Admin Take Copy"/>
+			<menu_item_call label="Назначить меня владельцем" name="Force Owner To Me"/>
 			<menu_item_call label="Назначить полноправным владельцем" name="Force Owner Permissive"/>
 			<menu_item_call label="Удалить" name="Delete"/>
 			<menu_item_call label="На месте" name="Lock"/>
@@ -441,7 +444,7 @@
 			<menu_item_call label="Физика" name="Physics"/>
 			<menu_item_call label="Вся одежда" name="All Clothes"/>
 		</menu>
-		<menu label="Справка" name="Help">
+		<menu label="Справка" name="DeprecatedHelp">
 			<menu_item_call label="Официальный блог Linden" name="Official Linden Blog"/>
 			<menu_item_call label="Портал скриптов" name="Scripting Portal"/>
 			<menu label="Сообщение об ошибке" name="Bug Reporting">
diff --git a/indra/newview/skins/default/xui/ru/notifications.xml b/indra/newview/skins/default/xui/ru/notifications.xml
index d43d90716419dfe7d091d299b0c17bc1846c137e..b4692385d185f4bef55731d65d59b4834aebd300 100644
--- a/indra/newview/skins/default/xui/ru/notifications.xml
+++ b/indra/newview/skins/default/xui/ru/notifications.xml
@@ -86,17 +86,38 @@
 		<usetemplate canceltext="Отмена" name="yesnocancelbuttons" notext="Не сохранять" yestext="Сохранить"/>
 	</notification>
 	<notification name="ConfirmNoCopyToOutbox">
-		У вас нет прав для копирования этого элемента в исходящую папку магазина. Вы действительно хотите переместить следующий элемент?
-        [ITEM_NAME]
-		<usetemplate name="okcancelbuttons" notext="Нет" yestext="Да"/>
+		У вас нет прав на копирование этих предметов в папку «Торговые исходящие».  Переместите их или оставьте здесь.
+		<usetemplate name="okcancelbuttons" notext="Не перемещать предмет(ы)" yestext="Переместить предмет(ы)"/>
+	</notification>
+	<notification name="OutboxFolderCreated">
+		Для каждого предмета, перенесенного на верхний уровень папки «Торговые исходящие», создана новая папка.
+		<usetemplate ignoretext="В папке «Торговые исходящие» создана новая папка" name="okignore" yestext="OK"/>
+	</notification>
+	<notification name="OutboxImportComplete">
+		Успешно
+
+Все папки успешно отправлены в торговый центр.
+		<usetemplate ignoretext="Все папки отправлены в торговый центр" name="okignore" yestext="OK"/>
+	</notification>
+	<notification name="OutboxImportHadErrors">
+		Некоторые папки не перенесены
+
+Ошибки при отправке некоторых папок в торговый центр.  Эти папки остались в вашей папке «Торговые исходящие».
+
+Подробнее см. в [[MARKETPLACE_IMPORTS_URL] журнале ошибок].
+		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
-	<notification name="OutboxUploadComplete">
-		Передача магазина завершена.
-		<usetemplate name="okbutton" yestext="Ура!"/>
+	<notification name="OutboxImportFailed">
+		Ошибка при передаче
+
+Папки не отправлены в торговый центр из-за ошибки системы или сети.  Повторите попытку позже.
+		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
-	<notification name="OutboxUploadHadErrors">
-		Передача магазина выполнена с ошибками!  Устраните проблемы в исходящей папке и повторите передачу.  Спасибо!
-		<usetemplate name="okbutton" yestext="Бу-у-у!"/>
+	<notification name="OutboxInitFailed">
+		Ошибка инициализации торгового центра
+
+Не удалось инициализировать торговый центр из-за ошибки системы или сети.  Повторите попытку позже.
+		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="CompileQueueSaveText">
 		Ошибка при передаче текста скрипта по следующей причине: [REASON]. Повторите попытку позже.
@@ -649,7 +670,7 @@
 		Невозможно создать выходной файл: [FILE]
 	</notification>
 	<notification name="DoNotSupportBulkAnimationUpload">
-		[APP_NAME] пока не поддерживает массовую передачу файлов анимации.
+		[APP_NAME] пока не поддерживает массовую передачу файлов анимации формата BVH.
 	</notification>
 	<notification name="CannotUploadReason">
 		Невозможно передать [FILE] по следующей причине: [REASON]
@@ -979,7 +1000,7 @@
 		</form>
 	</notification>
 	<notification name="RemoveFromFriends">
-		Удалить жителя [NAME] из вашего списка друзей?
+		Удалить жителя &lt;nolink&gt;[NAME]&lt;/nolink&gt; из вашего списка друзей?
 		<usetemplate name="okcancelbuttons" notext="Отмена" yestext="OK"/>
 	</notification>
 	<notification name="RemoveMultipleFromFriends">
@@ -1110,8 +1131,13 @@
 	<notification name="DisplaySetToSafe">
 		Установлен безопасный уровень настроек отображения, так как указан параметр -safe.
 	</notification>
-	<notification name="DisplaySetToRecommended">
-		Установлен рекомендуемый уровень настроек отображения в соответствии с вашей системной конфигурацией.
+	<notification name="DisplaySetToRecommendedGPUChange">
+		Установлен рекомендуемый уровень настроек отображения, так как графическая карта изменена:
+с «[LAST_GPU]»
+на «[THIS_GPU]»
+	</notification>
+	<notification name="DisplaySetToRecommendedFeatureChange">
+		Установлен рекомендуемый уровень настроек отображения, так как подсистема визуализации изменена.
 	</notification>
 	<notification name="ErrorMessage">
 		[ERROR_MESSAGE]
@@ -1431,7 +1457,7 @@ http://secondlife.com/download.
 		<usetemplate ignoretext="Подтверждать перед возвратом объектов владельцам" name="okcancelignore" notext="Отмена" yestext="OK"/>
 	</notification>
 	<notification name="GroupLeaveConfirmMember">
-		Вы являетесь участником группы [GROUP].
+		Вы сейчас входите в группу &lt;nolink&gt;[GROUP]&lt;/nolink&gt;.
 Хотите покинуть группу?
 		<usetemplate name="okcancelbuttons" notext="Отмена" yestext="OK"/>
 	</notification>
@@ -1910,7 +1936,13 @@ http://secondlife.com/download.
 		<usetemplate ignoretext="Подтверждать перед выходом" name="okcancelignore" notext="Не выходить" yestext="Выйти"/>
 	</notification>
 	<notification name="ConfirmRestoreToybox">
-		Вы действительно хотите восстановить принятые по умолчанию кнопки и панели инструментов? 
+		Это действие приведет к восстановлению стандартных кнопок и панелей инструментов.
+
+Это действие нельзя отменить.
+		<usetemplate name="okcancelbuttons" notext="Отмена" yestext="OK"/>
+	</notification>
+	<notification name="ConfirmClearAllToybox">
+		Это действие возвращает все кнопки в инструментарий, а панели инструментов становятся пустыми.
     
 Это действие нельзя отменить.
 		<usetemplate name="okcancelbuttons" notext="Отмена" yestext="OK"/>
@@ -2119,10 +2151,10 @@ http://secondlife.com/download.
 		Раздел: [SUBJECT], сообщение: [MESSAGE]
 	</notification>
 	<notification name="FriendOnline">
-		[NAME] в сети
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; в сети
 	</notification>
 	<notification name="FriendOffline">
-		[NAME] не в сети
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; не в сети
 	</notification>
 	<notification name="AddSelfFriend">
 		Вы лучше всех, но нельзя добавить в друзья себя самого.
@@ -2236,14 +2268,16 @@ http://secondlife.com/download.
 		Ваша визитка отклонена.
 	</notification>
 	<notification name="TeleportToLandmark">
-		Вы можете телепортироваться в такие места, как «[NAME]», открыв панель «Места» в правой части экрана и выбрав вкладку «Закладки».
-Щелкните любую закладку, чтобы выбрать ее, а затем нажмите кнопку «Телепортация» внизу панели.
-(Также можно дважды щелкнуть закладку или щелкнуть ее правой кнопкой мыши и выбрать команду «Телепортация».)
+		Для телепортации в другое место, например «[NAME]», нажмите кнопку «Места»,
+    затем в открывшемся окне выберите вкладку «Закладки». Щелкните любую
+    закладку, чтобы выбрать ее, а затем нажмите кнопку «Телепортация» внизу окна.
+    (Также можно дважды щелкнуть закладку или щелкнуть ее правой кнопкой мыши и
+    выбрать команду «Телепортация».)
 	</notification>
 	<notification name="TeleportToPerson">
-		Вы можете общаться с такими жителями, как «[NAME]», открыв панель «Люди» в правой части экрана.
-Выберите в списке нужного жителя, а затем нажмите кнопку «IM» внизу панели.
-(Также можно дважды щелкнуть имя жителя в списке или щелкнуть ее правой кнопкой мыши и выбрать команду «IM».)
+		Чтобы обратиться к жителю, например «[NAME]», нажмите кнопку «Люди», выберите жителя в появившемся окне и нажмите кнопку
+    «IM» внизу окна.
+    (Также можно дважды щелкнуть имя жителя в списке или щелкнуть его правой кнопкой мыши и выбрать команду «IM».)
 	</notification>
 	<notification name="CantSelectLandFromMultipleRegions">
 		Нельзя выбрать землю с обеих сторон границы между серверами.
@@ -2264,6 +2298,9 @@ http://secondlife.com/download.
 	<notification name="PaymentSent">
 		[MESSAGE]
 	</notification>
+	<notification name="PaymentFailure">
+		[MESSAGE]
+	</notification>
 	<notification name="EventNotification">
 		Уведомление о событии:
 
@@ -2518,10 +2555,10 @@ http://secondlife.com/download.
 		</form>
 	</notification>
 	<notification name="FriendshipAccepted">
-		[NAME] принял(а) ваше предложение дружить.
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; принял(а) ваше предложение дружить.
 	</notification>
 	<notification name="FriendshipDeclined">
-		[NAME] отклонил(а) ваше предложение дружить.
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; отклонил(а) ваше предложение дружить.
 	</notification>
 	<notification name="FriendshipAcceptedByMe">
 		Предложение дружить принято.
@@ -2593,16 +2630,16 @@ http://secondlife.com/download.
 		[NAME] – «&lt;nolink&gt;[TITLE]&lt;/nolink&gt;»
 [MESSAGE]
 		<form name="form">
-			<button name="Mute" text="Блокировать"/>
-			<button name="Ignore" text="Игнорировать"/>
+			<button name="Client_Side_Mute" text="Заблокировать"/>
+			<button name="Client_Side_Ignore" text="Игнорировать"/>
 		</form>
 	</notification>
 	<notification name="ScriptDialogGroup">
 		[GROUPNAME] – «&lt;nolink&gt;[TITLE]&lt;/nolink&gt;»
 [MESSAGE]
 		<form name="form">
-			<button name="Mute" text="Блокировать"/>
-			<button name="Ignore" text="Игнорировать"/>
+			<button name="Client_Side_Mute" text="Заблокировать"/>
+			<button name="Client_Side_Ignore" text="Игнорировать"/>
 		</form>
 	</notification>
 	<notification name="BuyLindenDollarSuccess">
@@ -2797,6 +2834,18 @@ http://secondlife.com/download.
 
 Со следующими жителями:
 
+[RESIDENTS]
+		<usetemplate name="okcancelbuttons" notext="Отмена" yestext="OK"/>
+	</notification>
+	<notification name="ShareFolderConfirmation">
+		Раздать можно только одну папку за раз.
+
+Вы действительно хотите поделиться предметами:
+
+&lt;nolink&gt;[ITEMS]&lt;/nolink&gt;
+
+Со следующими жителями:
+
 [RESIDENTS]
 		<usetemplate name="okcancelbuttons" notext="Отмена" yestext="ОК"/>
 	</notification>
@@ -2888,7 +2937,7 @@ http://secondlife.com/download.
 позже, даже после того, как вы покинули разговор.
 
 Заглушить всех?
-		<usetemplate ignoretext="Подтверждать перед заглушением всех участников группового разговора" name="okcancelignore" notext="Отмена" yestext="ОК"/>
+		<usetemplate ignoretext="Подтверждать перед заглушением всех участников группового разговора" name="okcancelignore" notext="Отмена" yestext="OK"/>
 	</notification>
 	<notification label="Чат" name="HintChat">
 		Чтобы присоединиться к чату, введите слова в поле чата ниже.
diff --git a/indra/newview/skins/default/xui/ru/panel_edit_skin.xml b/indra/newview/skins/default/xui/ru/panel_edit_skin.xml
index ac7e74316ed9be0d42b8a9e733aff312173ff602..f5a5339afe9ff08b57e69519b531cf3ed1670dfc 100644
--- a/indra/newview/skins/default/xui/ru/panel_edit_skin.xml
+++ b/indra/newview/skins/default/xui/ru/panel_edit_skin.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="edit_skin_panel">
 	<panel name="avatar_skin_color_panel">
-		<texture_picker label="Тату на голове" name="Head Tattoos" tool_tip="Щелкните для выбора изображения"/>
-		<texture_picker label="Тату на верхних частях тела" name="Upper Tattoos" tool_tip="Щелкните для выбора изображения"/>
-		<texture_picker label="Тату на нижних частях тела" name="Lower Tattoos" tool_tip="Щелкните для выбора изображения"/>
+		<texture_picker label="Голова" name="Head" tool_tip="Щелкните для выбора изображения"/>
+		<texture_picker label="Верхняя часть тела" name="Upper Body" tool_tip="Щелкните для выбора изображения"/>
+		<texture_picker label="Нижняя часть тела" name="Lower Body" tool_tip="Щелкните для выбора изображения"/>
 	</panel>
 	<panel name="accordion_panel">
 		<accordion name="wearable_accordion">
diff --git a/indra/newview/skins/default/xui/ru/panel_my_profile.xml b/indra/newview/skins/default/xui/ru/panel_my_profile.xml
deleted file mode 100644
index 9117bfec188e137a71891eb4dba9a9be2c8c8e2b..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/ru/panel_my_profile.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Профиль" name="panel_profile">
-	<string name="CaptionTextAcctInfo">
-		[ACCTTYPE]
-[PAYMENTINFO] [AGEVERIFICATION]
-	</string>
-	<string name="payment_update_link_url">
-		http://www.secondlife.com/account/billing.php?lang=en
-	</string>
-	<string name="partner_edit_link_url">
-		http://www.secondlife.com/account/partners.php?lang=en
-	</string>
-	<string name="my_account_link_url" value="http://secondlife.com/account"/>
-	<string name="no_partner_text" value="Нет"/>
-	<string name="no_group_text" value="Нет"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="scroll_content_panel">
-					<panel name="second_life_image_panel">
-						<text name="display_name_descr_text">
-							Имя пользователя
-						</text>
-						<text name="name_descr_text">
-							Экранное имя
-						</text>
-						<button label="Профиль" name="see_profile_btn" tool_tip="Посмотреть профиль этого аватара"/>
-					</panel>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/ru/panel_nearby_chat.xml b/indra/newview/skins/default/xui/ru/panel_nearby_chat.xml
index 1d26eecf87fb331ac3be6c797f28f3b75688b432..a8fdfde1c4bc1d6c1a4084eaa598847150d260e2 100644
--- a/indra/newview/skins/default/xui/ru/panel_nearby_chat.xml
+++ b/indra/newview/skins/default/xui/ru/panel_nearby_chat.xml
@@ -1,4 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="nearby_chat">
-	<check_box label="Перевод чата" name="translate_chat_checkbox"/>
+	<layout_stack name="stack">
+		<layout_panel name="translate_chat_checkbox_lp">
+			<check_box label="Переводить чат" name="translate_chat_checkbox"/>
+		</layout_panel>
+	</layout_stack>
 </panel>
diff --git a/indra/newview/skins/default/xui/ru/panel_notes.xml b/indra/newview/skins/default/xui/ru/panel_notes.xml
deleted file mode 100644
index aa7438334928877709b316b95f552e41393e3b51..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/ru/panel_notes.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Заметки и приватность" name="panel_notes">
-	<layout_stack name="layout">
-		<layout_panel name="notes_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<text name="status_message" value="Мои личные заметки:"/>
-					<text name="status_message2" value="Разрешить этому жителю:"/>
-					<check_box label="Видеть мой статус в сети" name="status_check"/>
-					<check_box label="Видеть меня на карте" name="map_check"/>
-					<check_box label="Редактировать, удалять или брать мои объекты" name="objects_check"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-		<layout_panel name="notes_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="Добавить в друзья" name="add_friend" tool_tip="Предложить дружбу этому жителю"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="IM" name="im" tool_tip="Начать сеанс IM"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="Звонок" name="call" tool_tip="Позвонить этому жителю"/>
-				</layout_panel>
-				<layout_panel name="show_on_map_btn_lp">
-					<button label="Карта" name="show_on_map_btn" tool_tip="Показать жителя на карте"/>
-				</layout_panel>
-				<layout_panel name="teleport_btn_lp">
-					<button label="Телепортация" name="teleport" tool_tip="Предложить телепортацию"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/ru/panel_postcard_message.xml b/indra/newview/skins/default/xui/ru/panel_postcard_message.xml
new file mode 100644
index 0000000000000000000000000000000000000000..70587d809003fe62d42dbf93421b0b65e906d038
--- /dev/null
+++ b/indra/newview/skins/default/xui/ru/panel_postcard_message.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_postcard_message">
+	<text name="to_label">
+		Кому:
+	</text>
+	<text name="name_label">
+		От:
+	</text>
+	<text name="subject_label">
+		Тема:
+	</text>
+	<line_editor label="Введите тему письма." name="subject_form"/>
+	<text name="msg_label">
+		Сообщение:
+	</text>
+	<text_editor name="msg_form">
+		Введите текст письма.
+	</text_editor>
+	<button label="Отмена" name="cancel_btn"/>
+	<button label="Послать" name="send_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/ru/panel_postcard_settings.xml b/indra/newview/skins/default/xui/ru/panel_postcard_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..dc9d59008f158635890d7df9a871501b5b6c3f12
--- /dev/null
+++ b/indra/newview/skins/default/xui/ru/panel_postcard_settings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_postcard_settings">
+	<combo_box label="Размер" name="postcard_size_combo">
+		<combo_box.item label="Текущее окно" name="CurrentWindow"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="Задать" name="Custom"/>
+	</combo_box>
+	<layout_stack name="postcard_image_params_ls">
+		<layout_panel name="postcard_image_size_lp">
+			<spinner label="Ширина" name="postcard_snapshot_width"/>
+			<spinner label="Высота" name="postcard_snapshot_height"/>
+			<check_box label="Сохранять пропорции" name="postcard_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="postcard_image_format_quality_lp">
+			<slider label="Качество изображения" name="image_quality_slider"/>
+			<text name="image_quality_level">
+				([QLVL])
+			</text>
+		</layout_panel>
+	</layout_stack>
+</panel>
diff --git a/indra/newview/skins/default/xui/ru/panel_preferences_chat.xml b/indra/newview/skins/default/xui/ru/panel_preferences_chat.xml
index a3ee5b78157d5621ff68c7ec1310ac08abca24dd..a9d5569c7f3da4933b736fe89302097d83f3dd8e 100644
--- a/indra/newview/skins/default/xui/ru/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/ru/panel_preferences_chat.xml
@@ -29,29 +29,5 @@
 	<check_box label="Текстовые чаты" name="EnableIMChatPopups" tool_tip="Отображать всплывающие уведомления при получении IM-сообщений"/>
 	<spinner label="Время отображения всплывающих реплик:" name="nearby_toasts_lifetime"/>
 	<spinner label="Время затухания всплывающих реплик:" name="nearby_toasts_fadingtime"/>
-	<text name="translate_chb_label">
-		Использовать машинный перевод при общении
-	</text>
-	<text name="translate_language_text">
-		Переводить чат на:
-	</text>
-	<combo_box name="translate_language_combobox">
-		<combo_box.item label="Язык системы" name="System Default Language"/>
-		<combo_box.item label="English" name="English"/>
-		<combo_box.item label="Dansk" name="Danish"/>
-		<combo_box.item label="Deutsch" name="German"/>
-		<combo_box.item label="Español" name="Spanish"/>
-		<combo_box.item label="Français" name="French"/>
-		<combo_box.item label="Italiano" name="Italian"/>
-		<combo_box.item label="Magyar" name="Hungarian"/>
-		<combo_box.item label="Nederlands" name="Dutch"/>
-		<combo_box.item label="Polski" name="Polish"/>
-		<combo_box.item label="Português" name="Portugese"/>
-		<combo_box.item label="Русский" name="Russian"/>
-		<combo_box.item label="Türkçe" name="Turkish"/>
-		<combo_box.item label="Українська" name="Ukrainian"/>
-		<combo_box.item label="中文 (简体) (китайский)" name="Chinese"/>
-		<combo_box.item label="日本語 (Japanese)" name="Japanese"/>
-		<combo_box.item label="한국어 (Korean)" name="Korean"/>
-	</combo_box>
+	<button label="Настройки перевода чата" name="ok_btn"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/ru/panel_preferences_general.xml b/indra/newview/skins/default/xui/ru/panel_preferences_general.xml
index 49f743a6bafb6e0a9b6d1fd6b4a701c927049dd5..d1bfedf2d85db2ff1d349c3820523aab63d9470f 100644
--- a/indra/newview/skins/default/xui/ru/panel_preferences_general.xml
+++ b/indra/newview/skins/default/xui/ru/panel_preferences_general.xml
@@ -16,7 +16,7 @@
 		<combo_box.item label="Русский (бета-версия)" name="Russian"/>
 		<combo_box.item label="Türkçe - турецкий (бета-версия)" name="Turkish"/>
 		<combo_box.item label="日本語 – японский (бета-версия)" name="(Japanese)"/>
-		<combo_box.item label="正體中文 - китайский, традиционное письмо (бета-версия)" name="Traditional Chinese"/>
+		<combo_box.item label="китайский, традиционное письмо - бета-версия" name="Traditional Chinese"/>
 	</combo_box>
 	<text name="language_textbox2">
 		(Требуется перезапуск)
diff --git a/indra/newview/skins/default/xui/ru/panel_preferences_setup.xml b/indra/newview/skins/default/xui/ru/panel_preferences_setup.xml
index db881891692cd7e3bd727ba6ebed018fda9debe9..8e7fc71f0d5503c41d3f96785e243808110e1c2f 100644
--- a/indra/newview/skins/default/xui/ru/panel_preferences_setup.xml
+++ b/indra/newview/skins/default/xui/ru/panel_preferences_setup.xml
@@ -15,7 +15,7 @@
 		Браузер:
 	</text>
 	<radio_group name="use_external_browser">
-		<radio_item label="Использовать мой браузер (IE, Firefox, Safari)" name="external" tool_tip="Будет использоваться браузер, заданный в системе по умолчанию. Не рекомендуется, если [APP_NAME] работает в полноэкранном режиме." value="1"/>
+		<radio_item label="Использовать мой браузер (IE, Firefox, Safari)" name="external" tool_tip="Будет использоваться браузер, заданный в системе по умолчанию. Не рекомендуется, если [APP_NAME] работает в полноэкранном режиме." value="true"/>
 		<radio_item label="Использовать встроенный браузер" name="internal" tool_tip="Для просмотра справки, ссылок на веб-страницы и т. д. будет использоваться встроенный браузер. Этот браузер открывается как новое окно в [APP_NAME]." value=""/>
 	</radio_group>
 	<check_box initial_value="истина" label="Разрешить плагины" name="browser_plugins_enabled"/>
diff --git a/indra/newview/skins/default/xui/ru/panel_profile.xml b/indra/newview/skins/default/xui/ru/panel_profile.xml
deleted file mode 100644
index fab57d678cf2390af3957554aebd4ecc3809cdc0..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/ru/panel_profile.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Профиль" name="panel_profile">
-	<string name="CaptionTextAcctInfo">
-		[ACCTTYPE]
-[PAYMENTINFO] [AGEVERIFICATION]
-	</string>
-	<string name="payment_update_link_url">
-		http://www.secondlife.com/account/billing.php?lang=en
-	</string>
-	<string name="partner_edit_link_url">
-		http://www.secondlife.com/account/partners.php?lang=en
-	</string>
-	<string name="my_account_link_url" value="http://secondlife.com/account"/>
-	<string name="no_partner_text" value="Нет"/>
-	<string name="no_group_text" value="Нет"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<panel name="second_life_image_panel">
-						<text name="title_sl_descr_text" value="[SECOND_LIFE]:"/>
-					</panel>
-					<panel name="first_life_image_panel">
-						<text name="title_rw_descr_text" value="Реальный мир:"/>
-					</panel>
-					<text name="title_member_text" value="Обитатель SL с:"/>
-					<text name="title_acc_status_text" value="Статус аккаунта:"/>
-					<text name="title_partner_text" value="Партнер:"/>
-					<panel name="partner_data_panel">
-						<text initial_value="(получение информации)" name="partner_text"/>
-					</panel>
-					<text name="title_groups_text" value="Группы:"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-	<layout_stack name="layout_verb_buttons">
-		<layout_panel name="profile_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="В друзья" name="add_friend" tool_tip="Предложить дружбу этому жителю"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="IM" name="im" tool_tip="Начать сеанс IM"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="Звонок" name="call" tool_tip="Позвонить этому жителю"/>
-				</layout_panel>
-				<layout_panel name="chat_btn_lp">
-					<button label="Телепортация" name="teleport" tool_tip="Предложить телепортацию"/>
-				</layout_panel>
-				<layout_panel name="overflow_btn_lp">
-					<menu_button label="▼" name="overflow_btn" tool_tip="Заплатить жителю или поделиться с ним вещами"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/ru/panel_profile_view.xml b/indra/newview/skins/default/xui/ru/panel_profile_view.xml
deleted file mode 100644
index c97c5afc018e0964523701f7a502ea7a95a40d0a..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/ru/panel_profile_view.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel name="panel_target_profile">
-	<string name="status_online">
-		Онлайн
-	</string>
-	<string name="status_offline">
-		Оффлайн
-	</string>
-	<text name="display_name_label" value="Экранное имя:"/>
-	<text name="solo_username_label" value="Имя пользователя:"/>
-	<text name="status" value="Онлайн"/>
-	<text name="user_name_small" value="Взгляни-ка, друг, какое длиннющее имя"/>
-	<button name="copy_to_clipboard" tool_tip="Копировать в буфер обмена"/>
-	<text name="user_label" value="Имя пользователя:"/>
-	<tab_container name="tabs">
-		<panel label="ПРОФИЛЬ" name="panel_profile"/>
-		<panel label="ПОДБОРКА" name="panel_picks"/>
-		<panel label="ЗАМЕТКИ И ДОСТУП" name="panel_notes"/>
-	</tab_container>
-</panel>
diff --git a/indra/newview/skins/default/xui/ru/panel_region_estate.xml b/indra/newview/skins/default/xui/ru/panel_region_estate.xml
index 27ec10b323e8c5cd019745bf06d2354103876188..93b21704bcd3ba4a8ad23fdf79ceaa89a2996edc 100644
--- a/indra/newview/skins/default/xui/ru/panel_region_estate.xml
+++ b/indra/newview/skins/default/xui/ru/panel_region_estate.xml
@@ -20,10 +20,10 @@
 	<slider label="Фаза" name="sun_hour_slider"/>
 	<check_box label="Разрешить общий доступ" name="externally_visible_check"/>
 	<text name="Only Allow">
-		Разрешить доступ только аккаунтам с подтверждением:
+		Разрешить доступ только таким жителям:
 	</text>
-	<check_box label="Информации об оплате в файле" name="limit_payment" tool_tip="Банить нераспознанных жителей"/>
-	<check_box label="Проверка возраста" name="limit_age_verified" tool_tip="Банить жителей, не прошедших проверку возраста. Более подробная информация находится здесь: [SUPPORT_SITE]."/>
+	<check_box label="Зарегистрирована информация об оплате" name="limit_payment" tool_tip="Для доступа к этому землевладению у жителя должна быть зарегистрирована информация об оплате.  Более подробная информация находится здесь: [SUPPORT_SITE]."/>
+	<check_box label="Подтвержден возраст" name="limit_age_verified" tool_tip="Для доступа к этому землевладению житель должен подтвердить свой возраст. Более подробная информация находится здесь: [SUPPORT_SITE]."/>
 	<check_box label="Разрешить голосовое общение" name="voice_chat_check"/>
 	<check_box label="Разрешить прямой телепорт" name="allow_direct_teleport"/>
 	<button label="Применить" name="apply_btn"/>
diff --git a/indra/newview/skins/default/xui/ru/panel_script_ed.xml b/indra/newview/skins/default/xui/ru/panel_script_ed.xml
index 1a9c512147901fb4dd263c70f23f1f7a95cfd410..05ccaeb54b3603b2a4224edfef8660637d42d2bd 100644
--- a/indra/newview/skins/default/xui/ru/panel_script_ed.xml
+++ b/indra/newview/skins/default/xui/ru/panel_script_ed.xml
@@ -22,6 +22,8 @@
 		<menu label="Файл" name="File">
 			<menu_item_call label="Сохранить" name="Save"/>
 			<menu_item_call label="Отменить все изменения" name="Revert All Changes"/>
+			<menu_item_call label="Загрузить из файла..." name="LoadFromFile"/>
+			<menu_item_call label="Сохранить в файл..." name="SaveToFile"/>
 		</menu>
 		<menu label="Изменить" name="Edit">
 			<menu_item_call label="Отменить" name="Undo"/>
diff --git a/indra/newview/skins/default/xui/ru/panel_snapshot_inventory.xml b/indra/newview/skins/default/xui/ru/panel_snapshot_inventory.xml
new file mode 100644
index 0000000000000000000000000000000000000000..53a150c9f9e0230122a1ca5f1a43bfc2f1529e67
--- /dev/null
+++ b/indra/newview/skins/default/xui/ru/panel_snapshot_inventory.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_inventory">
+	<text name="title">
+		Сохранить в моем инвентаре
+	</text>
+	<text name="hint_lbl">
+		Сохранение изображения в инвентаре стоит L$[UPLOAD_COST]. Чтобы сохранить его как текстуру, выберите один из квадратных форматов.
+	</text>
+	<combo_box label="Размер" name="texture_size_combo">
+		<combo_box.item label="Текущее окно" name="CurrentWindow"/>
+		<combo_box.item label="Маленький (128x128)" name="Small(128x128)"/>
+		<combo_box.item label="Средний (256x256)" name="Medium(256x256)"/>
+		<combo_box.item label="Большой (512x512)" name="Large(512x512)"/>
+		<combo_box.item label="Задать" name="Custom"/>
+	</combo_box>
+	<spinner label="Ширина" name="inventory_snapshot_width"/>
+	<spinner label="Высота" name="inventory_snapshot_height"/>
+	<check_box label="Сохранять пропорции" name="inventory_keep_aspect_check"/>
+	<button label="Отмена" name="cancel_btn"/>
+	<button label="Сохранить" name="save_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/ru/panel_snapshot_local.xml b/indra/newview/skins/default/xui/ru/panel_snapshot_local.xml
new file mode 100644
index 0000000000000000000000000000000000000000..446b9bb2fd367de13a0d71ec2cbcde61dc823c16
--- /dev/null
+++ b/indra/newview/skins/default/xui/ru/panel_snapshot_local.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_local">
+	<text name="title">
+		Сохранить на моем компьютере
+	</text>
+	<combo_box label="Размер" name="local_size_combo">
+		<combo_box.item label="Текущее окно" name="CurrentWindow"/>
+		<combo_box.item label="320x240" name="320x240"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="1280x1024" name="1280x1024"/>
+		<combo_box.item label="1600x1200" name="1600x1200"/>
+		<combo_box.item label="Задать" name="Custom"/>
+	</combo_box>
+	<layout_stack name="local_image_params_ls">
+		<layout_panel name="local_image_size_lp">
+			<spinner label="Ширина" name="local_snapshot_width"/>
+			<spinner label="Высота" name="local_snapshot_height"/>
+			<check_box label="Сохранять пропорции" name="local_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="local_image_format_quality_lp">
+			<combo_box label="Формат" name="local_format_combo">
+				<combo_box.item label="PNG (без потерь)" name="PNG"/>
+				<combo_box.item label="JPEG" name="JPEG"/>
+				<combo_box.item label="BMP (без потерь)" name="BMP"/>
+			</combo_box>
+			<slider label="Качество изображения" name="image_quality_slider"/>
+			<text name="image_quality_level">
+				([QLVL])
+			</text>
+		</layout_panel>
+	</layout_stack>
+	<button label="Отмена" name="cancel_btn"/>
+	<flyout_button label="Сохранить" name="save_btn" tool_tip="Сохранить изображение в файл">
+		<flyout_button.item label="Сохранить" name="save_item"/>
+		<flyout_button.item label="Сохранить как..." name="saveas_item"/>
+	</flyout_button>
+</panel>
diff --git a/indra/newview/skins/default/xui/ru/panel_snapshot_options.xml b/indra/newview/skins/default/xui/ru/panel_snapshot_options.xml
new file mode 100644
index 0000000000000000000000000000000000000000..250a76cd213ffd6bac5387e3db54902a04a4bda0
--- /dev/null
+++ b/indra/newview/skins/default/xui/ru/panel_snapshot_options.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_options">
+	<button label="Поместить в мой профиль" name="save_to_profile_btn"/>
+	<button label="Отправить по почте" name="save_to_email_btn"/>
+	<button label="Сохранить в моем инвентаре (L$[AMOUNT])" name="save_to_inventory_btn"/>
+	<button label="Сохранить на моем компьютере" name="save_to_computer_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/ru/panel_snapshot_postcard.xml b/indra/newview/skins/default/xui/ru/panel_snapshot_postcard.xml
new file mode 100644
index 0000000000000000000000000000000000000000..47f4caf8e385e2befb5b2c15435f504eeb1876e8
--- /dev/null
+++ b/indra/newview/skins/default/xui/ru/panel_snapshot_postcard.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_postcard">
+	<string name="default_subject">
+		Открытка из [SECOND_LIFE].
+	</string>
+	<string name="default_message">
+		Побывай здесь!
+	</string>
+	<string name="upload_message">
+		Отправка...
+	</string>
+	<text name="title">
+		Электронное письмо
+	</text>
+	<button label="Сообщение" name="message_btn"/>
+	<button label="Настройки" name="settings_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/ru/panel_snapshot_profile.xml b/indra/newview/skins/default/xui/ru/panel_snapshot_profile.xml
new file mode 100644
index 0000000000000000000000000000000000000000..79a9ef58d035b122640455b7d9f03bb047692473
--- /dev/null
+++ b/indra/newview/skins/default/xui/ru/panel_snapshot_profile.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_profile">
+	<text name="title">
+		Поместить в мой профиль
+	</text>
+	<combo_box label="Размер" name="profile_size_combo">
+		<combo_box.item label="Текущее окно" name="CurrentWindow"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="Задать" name="Custom"/>
+	</combo_box>
+	<layout_stack name="profile_image_params_ls">
+		<layout_panel name="profile_image_size_lp">
+			<spinner label="Ширина" name="profile_snapshot_width"/>
+			<spinner label="Высота" name="profile_snapshot_height"/>
+			<check_box label="Сохранять пропорции" name="profile_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="profile_image_metadata_lp">
+			<text name="caption_label">
+				Подпись:
+			</text>
+			<check_box initial_value="true" label="Включить расположение" name="add_location_cb"/>
+		</layout_panel>
+	</layout_stack>
+	<button label="Отмена" name="cancel_btn"/>
+	<button label="Опубликовать" name="post_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/ru/panel_status_bar.xml b/indra/newview/skins/default/xui/ru/panel_status_bar.xml
index 6822244196629c5cbd19839e6345f78b08af82b8..9c84ff1fd894e142e4a65e95c0e64b7128fd371d 100644
--- a/indra/newview/skins/default/xui/ru/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/ru/panel_status_bar.xml
@@ -15,10 +15,10 @@
 	<panel.string name="buycurrencylabel">
 		L$ [AMT]
 	</panel.string>
-	<panel name="balance_bg">
+	<panel left="-450" name="balance_bg" width="240">
 		<text name="balance" tool_tip="Щелкните для обновления вашего баланса L$" value="L$20"/>
 		<button label="Купить L$" name="buyL" tool_tip="Щелкните для покупки L$"/>
-		<button label="Торговый центр" name="goShop" tool_tip="Открыть торговый центр Second Life"/>
+		<button label="Торговый центр" name="goShop" tool_tip="Открыть торговый центр Second Life" width="121"/>
 	</panel>
 	<text name="TimeText" tool_tip="Текущее время (тихоокеанское)">
 		00:00 (тихоокеанское время)
diff --git a/indra/newview/skins/default/xui/ru/sidepanel_inventory.xml b/indra/newview/skins/default/xui/ru/sidepanel_inventory.xml
index a4150f6e2fdb5bcd3ef1720aa789af0a0396279a..c106c2de7943defc766a3ab1f64be175f7273cf6 100644
--- a/indra/newview/skins/default/xui/ru/sidepanel_inventory.xml
+++ b/indra/newview/skins/default/xui/ru/sidepanel_inventory.xml
@@ -2,47 +2,24 @@
 <panel label="Вещи" name="objects panel">
 	<panel label="" name="sidepanel__inventory_panel">
 		<layout_stack name="inventory_layout_stack">
-			<layout_panel name="inbox_outbox_layout_panel">
-				<layout_stack name="inbox_outbox_layout_stack">
-					<layout_panel name="inbox_layout_panel">
-						<panel label="" name="marketplace_inbox">
-							<string name="InboxLabelWithArg">
-								Полученные вещи ([NUM])
-							</string>
-							<string name="InboxLabelNoArg">
-								Полученные вещи
-							</string>
-							<button label="Полученные вещи" name="inbox_btn"/>
-							<text name="inbox_fresh_new_count">
-								Новых: [NUM]
-							</text>
-							<panel tool_tip="Drag and drop items to your inventory to manage and use them">
-								<text name="inbox_inventory_placeholder">
-									Покупки из торгового центра будут доставлены сюда.
-								</text>
-							</panel>
-						</panel>
-					</layout_panel>
-					<layout_panel name="outbox_layout_panel">
-						<panel label="" name="marketplace_outbox">
-							<string name="OutboxLabelWithArg">
-								Торговые исходящие ([NUM])
-							</string>
-							<string name="OutboxLabelNoArg">
-								Торговые исходящие
-							</string>
-							<button label="Торговые исходящие" name="outbox_btn"/>
-							<button label="" name="outbox_sync_btn" tool_tip="Выставить на витрину моего магазина"/>
-							<panel>
-								<panel name="outbox_inventory_placeholder_panel">
-									<text name="outbox_inventory_placeholder_title">
-										Загрузка...
-									</text>
-								</panel>
-							</panel>
-						</panel>
-					</layout_panel>
-				</layout_stack>
+			<layout_panel name="inbox_layout_panel">
+				<panel label="" name="marketplace_inbox">
+					<string name="InboxLabelWithArg">
+						Полученные вещи ([NUM])
+					</string>
+					<string name="InboxLabelNoArg">
+						Полученные вещи
+					</string>
+					<button label="Полученные вещи" name="inbox_btn"/>
+					<text name="inbox_fresh_new_count">
+						Новых: [NUM]
+					</text>
+					<panel name="inbox_inventory_placeholder_panel" tool_tip="Перетащите вещи в ваш инвентарь для их использования">
+						<text name="inbox_inventory_placeholder">
+							Покупки из торгового центра будут доставлены сюда.
+						</text>
+					</panel>
+				</panel>
 			</layout_panel>
 		</layout_stack>
 		<panel name="button_panel">
diff --git a/indra/newview/skins/default/xui/ru/strings.xml b/indra/newview/skins/default/xui/ru/strings.xml
index 7fef5797a93ed345393ce68329fc453a08630eac..8dbc4f092d05f7d3c4f7080857d8ff0a0825a6dd 100644
--- a/indra/newview/skins/default/xui/ru/strings.xml
+++ b/indra/newview/skins/default/xui/ru/strings.xml
@@ -180,8 +180,8 @@ http://secondlife.com/viewer-access-faq
 Обновление состояния см. на веб-странице www.secondlife.com/status.
 	</string>
 	<string name="LoginFailedPremiumOnly">
-		Вход в Second Life временно ограничен, чтобы обеспечить наилучшее времяпровождение в игровом мире.
-	 	
+		Вход в Second Life временно ограничен, чтобы сохранить наивысшее качество игрового мира для текущих пользователей.
+
 В это время у пользователей с бесплатными аккаунтами не будет доступа к Second Life, чтобы у тех, кто заплатил, было больше места.
 	</string>
 	<string name="LoginFailedComputerProhibited">
@@ -339,17 +339,35 @@ support@secondlife.com.
 		Сюда можно перетащить только одну вещь
 	</string>
 	<string name="TooltipPrice" value="L$[AMOUNT]:"/>
+	<string name="TooltipOutboxDragToWorld">
+		Нельзя выложить предметы из папке «Торговые исходящие»
+	</string>
 	<string name="TooltipOutboxNoTransfer">
-		Часть этих объектов нельзя продать, или они переданы другому пользователю.
+		Часть этих объектов нельзя продать или передать.
+	</string>
+	<string name="TooltipOutboxNotInInventory">
+		Ваша папка «Торговые исходящие» может получать вещи только непосредственно из вашего инвентаря
 	</string>
 	<string name="TooltipOutboxWorn">
-		Часть этих объектов на вас. Снимите их со своего аватара и попробуйте переместить их еще раз.
+		Носимые предметы нельзя поместить в папку «Торговые исходящие»
+	</string>
+	<string name="TooltipOutboxCallingCard">
+		Визитки нельзя поместить в папку «Торговые исходящие»
 	</string>
 	<string name="TooltipOutboxFolderLevels">
-		В этой папке слишком много уровней вложенных папок. Измените структуру вложенных папок, ограничив ее глубину 4 уровнями (корневая папка, вложенные папки уровня А, вложенные в них папки уровня Б, вложенные в них папки уровня В).
+		Глубина вложения папок превышает 3
+	</string>
+	<string name="TooltipOutboxTooManyFolders">
+		В папке верхнего уровня более 20 подпапок
 	</string>
 	<string name="TooltipOutboxTooManyObjects">
-		Эта папка содержит более 200 объектов. Сложите некоторые вещи в коробки, чтобы уменьшить число объектов.
+		В папке верхнего уровня более 200 предметов
+	</string>
+	<string name="TooltipDragOntoOwnChild">
+		Папку нельзя переместить в ее подпапку
+	</string>
+	<string name="TooltipDragOntoSelf">
+		Папку нельзя переместить саму в себя
 	</string>
 	<string name="TooltipHttpUrl">
 		Щелкните, чтобы просмотреть эту веб-страницу
@@ -814,6 +832,9 @@ support@secondlife.com.
 	<string name="anim_yes_head">
 		Согласие
 	</string>
+	<string name="multiple_textures">
+		Несколько
+	</string>
 	<string name="texture_loading">
 		Загрузка...
 	</string>
@@ -973,6 +994,9 @@ support@secondlife.com.
 	<string name="choose_the_directory">
 		Выбрать каталог
 	</string>
+	<string name="script_files">
+		Скрипты
+	</string>
 	<string name="AvatarSetNotAway">
 		На месте
 	</string>
@@ -1211,43 +1235,36 @@ support@secondlife.com.
 		В вашем инвентаре нет копии этой текстуры
 	</string>
 	<string name="InventoryInboxNoItems">
-		Покупки из торгового центра будут доставлены сюда.
+		Здесь будут показаны ваши покупки из торгового центра. Их можно будет перетащить в ваш инвентарь для использования.
 	</string>
 	<string name="MarketplaceURL">
-		http://marketplace.[DOMAIN_NAME]
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/
 	</string>
 	<string name="MarketplaceURL_CreateStore">
-		http://marketplace.[DOMAIN_NAME]/create_store
+		http://community.secondlife.com/t5/English-Knowledge-Base/Selling-in-the-Marketplace/ta-p/700193#Section_.4
 	</string>
-	<string name="MarketplaceURL_LearnMore">
-		http://marketplace.[DOMAIN_NAME]/learn_more
-	</string>
-	<string name="InventoryOutboxCreationErrorTitle">
-		Папка «Торговые исходящие» настроена неправильно
+	<string name="MarketplaceURL_Dashboard">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/merchants/store/dashboard
 	</string>
-	<string name="InventoryOutboxCreationErrorTooltip">
-		Ошибка конфигурации папки «Торговые исходящие»
+	<string name="MarketplaceURL_Imports">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/merchants/store/imports
 	</string>
-	<string name="InventoryOutboxCreationError">
-		Чтобы исправить эту проблему, обратитесь в службу поддержки.
+	<string name="MarketplaceURL_LearnMore">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/learn_more
 	</string>
 	<string name="InventoryOutboxNotMerchantTitle">
-		Продавать вещи в торговом центре может кто угодно
-	</string>
-	<string name="InventoryOutboxNotMerchantTooltip">
-		Станьте торговцем!
+		Продавать вещи в торговом центре может кто угодно.
 	</string>
+	<string name="InventoryOutboxNotMerchantTooltip"/>
 	<string name="InventoryOutboxNotMerchant">
-		[[MARKETPLACE_URL] Торговый центр Second Life] предлагает на продажу более миллиона виртуальных продуктов, и все они созданы жителями Second Life. Вы тоже можете продавать созданные вами вещи, а также некоторые из вещей, купленных вами. Это совсем несложно. Настройка выполняется бесплатно.  [[LEARN_MORE_URL] Узнайте подробности] или [[CREATE_STORE_URL] создайте магазин] в торговом центре, чтобы начать торговлю.
+		Если вы хотите стать торговцем, [[MARKETPLACE_CREATE_STORE_URL] создайте магазин].
 	</string>
 	<string name="InventoryOutboxNoItemsTitle">
-		Новый способ отправки вещей в торговый центр
-	</string>
-	<string name="InventoryOutboxNoItemsTooltip">
-		Перетащите вещи сюда, чтобы подготовить их для продажи в торговом центре
+		Ваша папка «Исходящие» пуста.
 	</string>
+	<string name="InventoryOutboxNoItemsTooltip"/>
 	<string name="InventoryOutboxNoItems">
-		Перетаскивайте в эту область вещи и папки, которые хотите продать.  При перетаскивании создается копия вещи (за исключением вещей, недоступных для копирования), поэтому инвентарь не изменяется.  Когда все готово для отправки вещей в торговый центр, нажмите кнопку «Передать». Вещи, перемещенные в инвентарь магазина, исчезают из этой папки.
+		Перетащите папки в эту область и щелкните «Отправить в торговый центр», чтобы выставить их на продажу в [[MARKETPLACE_DASHBOARD_URL] Торговом центре].
 	</string>
 	<string name="Marketplace Error None">
 		Ошибок нет
@@ -1409,6 +1426,9 @@ support@secondlife.com.
 	<string name="no_attachments">
 		Нет прикрепленных объектов
 	</string>
+	<string name="Attachments remain">
+		Присоединения (осталось гнезд: [COUNT])
+	</string>
 	<string name="Buy">
 		Купить
 	</string>
@@ -1535,6 +1555,12 @@ support@secondlife.com.
 	<string name="Right Pec">
 		Правая грудь
 	</string>
+	<string name="Neck">
+		Шея
+	</string>
+	<string name="Avatar Center">
+		Центр аватара
+	</string>
 	<string name="Invalid Attachment">
 		Неверная точка присоединения
 	</string>
@@ -3892,6 +3918,9 @@ support@secondlife.com.
 	<string name="Saved_message">
 		(Сохранено [LONG_TIMESTAMP])
 	</string>
+	<string name="IM_unblock_only_groups_friends">
+		Для просмотра этого сообщения снимите флажок «Только друзья и группы могут звонить мне и отправлять IM» в окне «Настройки/Приватность».
+	</string>
 	<string name="answered_call">
 		На ваш звонок ответили
 	</string>
@@ -4024,6 +4053,18 @@ support@secondlife.com.
 	<string name="you_paid_ldollars_no_name">
 		Вы заплатили L$[AMOUNT] за [REASON].
 	</string>
+	<string name="you_paid_failure_ldollars">
+		Вы не смогли заплатить пользователю [NAME] L$[AMOUNT]: [REASON].
+	</string>
+	<string name="you_paid_failure_ldollars_no_info">
+		Вы не смогли заплатить L$[AMOUNT]
+	</string>
+	<string name="you_paid_failure_ldollars_no_reason">
+		Вы не смогли заплатить пользователю [NAME] L$[AMOUNT]
+	</string>
+	<string name="you_paid_failure_ldollars_no_name">
+		Вы не смогли заплатить L$[AMOUNT]: [REASON].
+	</string>
 	<string name="for item">
 		за [ITEM]
 	</string>
@@ -4077,7 +4118,7 @@ support@secondlife.com.
 	</string>
 	<string name="uploading_abuse_report">
 		Загружается...
-  
+
 Жалоба
 	</string>
 	<string name="New Shape">
@@ -4344,7 +4385,8 @@ support@secondlife.com.
 	<string name="words_separator" value=","/>
 	<string name="server_is_down">
 		Несмотря на наши усилия, что-то неожиданно пошло не так.
-	Ознакомьтесь с описанием известных проблем в работе этой службы на сайте status.secondlifegrid.net.  
+
+	Ознакомьтесь с описанием известных проблем в работе этой службы на сайте status.secondlifegrid.net.
         Если проблемы продолжаются, то проверьте подключение к сети и настройки брандмауэра.
 	</string>
 	<string name="dateTimeWeekdaysNames">
@@ -4433,6 +4475,12 @@ support@secondlife.com.
 	<string name="ExternalEditorFailedToRun">
 		Не удалось запустить внешний редактор.
 	</string>
+	<string name="TranslationFailed">
+		Ошибка телепортации: [REASON]
+	</string>
+	<string name="TranslationResponseParseError">
+		Ошибка при анализе ответа переводчика.
+	</string>
 	<string name="Esc">
 		ESC
 	</string>
@@ -4815,7 +4863,10 @@ support@secondlife.com.
 		Миникарта
 	</string>
 	<string name="Command_Move_Label">
-		Переместить
+		Ходьба / бег / полет
+	</string>
+	<string name="Command_Outbox_Label">
+		Торговые исходящие
 	</string>
 	<string name="Command_People_Label">
 		Люди
@@ -4842,7 +4893,7 @@ support@secondlife.com.
 		Говорить
 	</string>
 	<string name="Command_View_Label">
-		Вид
+		Управление камерой
 	</string>
 	<string name="Command_Voice_Label">
 		Настройки голоса
@@ -4889,6 +4940,9 @@ support@secondlife.com.
 	<string name="Command_Move_Tooltip">
 		Перемещение аватара
 	</string>
+	<string name="Command_Outbox_Tooltip">
+		Перенести предметы в торговый центр для продажи
+	</string>
 	<string name="Command_People_Tooltip">
 		Друзья, группы и люди поблизости
 	</string>
@@ -4917,7 +4971,16 @@ support@secondlife.com.
 		Изменение угла камеры
 	</string>
 	<string name="Command_Voice_Tooltip">
-		Громкость звонков и голосов окружающих вас людей
+		Регулировка громкости вызовов и разговоров с людьми около вас
+	</string>
+	<string name="Toolbar_Bottom_Tooltip">
+		сейчас на нижней панели инструментов
+	</string>
+	<string name="Toolbar_Left_Tooltip">
+		сейчас на левой панели инструментов
+	</string>
+	<string name="Toolbar_Right_Tooltip">
+		сейчас на правой панели инструментов
 	</string>
 	<string name="Retain%">
 		Остаток%
@@ -4943,4 +5006,19 @@ support@secondlife.com.
 	<string name="Normal">
 		Нормальный
 	</string>
+	<string name="snapshot_quality_very_low">
+		Очень низкий
+	</string>
+	<string name="snapshot_quality_low">
+		Низкий
+	</string>
+	<string name="snapshot_quality_medium">
+		Средний
+	</string>
+	<string name="snapshot_quality_high">
+		Высокий
+	</string>
+	<string name="snapshot_quality_very_high">
+		Очень высокий
+	</string>
 </strings>
diff --git a/indra/newview/skins/default/xui/ru/teleport_strings.xml b/indra/newview/skins/default/xui/ru/teleport_strings.xml
index 296562e6f1c6166d313a352ee6a4446e848141e1..feff28611161a521f734e36be2934e262b9d26f2 100644
--- a/indra/newview/skins/default/xui/ru/teleport_strings.xml
+++ b/indra/newview/skins/default/xui/ru/teleport_strings.xml
@@ -21,8 +21,8 @@
 Повторите попытку позже.
 		</message>
 		<message name="NoHelpIslandTP">
-		Вы не можете телепортироваться обратно на Остров Помощи.
-Телепортируйтесь на Общественный Остров Помощи, чтобы повторить обучение
+			Телепортироваться назад на Остров прибытия нельзя.
+Для повторения учебника перейдите на «Остров прибытия - общий».
 		</message>
 		<message name="noaccess_tport">
 			У вас нет доступа к точке назначения этого телепорта.
diff --git a/indra/newview/skins/default/xui/tr/floater_about.xml b/indra/newview/skins/default/xui/tr/floater_about.xml
index 998890b85c89da1d6a0e243d40af62a502164657..8fa12ea759f43cdb51e7101e4311a74a2116751c 100644
--- a/indra/newview/skins/default/xui/tr/floater_about.xml
+++ b/indra/newview/skins/default/xui/tr/floater_about.xml
@@ -46,16 +46,16 @@ Ses Sunucusu Sürümü: [VOICE_VERSION]
 		</panel>
 		<panel label="Katkıda Bulunanlar" name="credits_panel">
 			<text name="linden_intro">
-				Second Life, Lindens&apos;lar tarafından geliştirilmiştir:
+				Second Life, Linden&apos;lar tarafından geliştirilmiştir:
 			</text>
 			<text name="contrib_intro">
-				açık kaynak kod katkısında bulunanlar:
+				Açık kaynak kod katkısında bulunanlar:
 			</text>
 			<text_editor name="contrib_names">
 				Geçici Ad çalıştırma sırasında değiştirilir
 			</text_editor>
 			<text name="trans_intro">
-				çevirileri yapanlar:
+				Çevirileri yapanlar:
 			</text>
 			<text_editor name="trans_names">
 				Geçici Ad çalıştırma sırasında değiştirilir
@@ -64,32 +64,34 @@ Ses Sunucusu Sürümü: [VOICE_VERSION]
 		<panel label="Lisanslar" name="licenses_panel">
 			<text_editor name="credits_editor">
 				3Dconnexion SDK Telif Hakkı (C) 1992-2007 3Dconnexion
-APR Telif Hakkı (C) 2000-2004 The Apache Software Foundation
-Collada DOM Telif Hakkı 2005 Sony Computer Entertainment Inc.
-cURL Telif Hakkı (C) 1996-2002, Daniel Stenberg, (daniel@haxx.se)
-DBus/dbus-glib Telif Hakkı (C) 2002, 2003  CodeFactory AB / Telif Hakkı (C) 2003, 2004 Red Hat, Inc.
-expat Telif Hakkı (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
-FreeType Telif Hakkı (C) 1996-2002, The FreeType Project (www.freetype.org).
-GL Telif Hakkı (C) 1999-2004 Brian Paul.
-GLOD Telif Hakkı (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University ve David Luebke, Brenden Schubert, University of Virginia.
-google-perftools Telif Hakkı (c) 2005, Google Inc.
-Havok.com(TM) Telif Hakkı (C) 1999-2001, Telekinesys Research Limited.
-jpeg2000 Telif Hakkı (C) 2001, David Taubman, The University of New South Wales (UNSW)
-jpeglib Telif Hakkı (C) 1991-1998, Thomas G. Lane.
-ogg/vorbis Telif Hakkı (C) 2001, Xiphophorus
-OpenSSL Telif Hakkı (C) 1998-2002 The OpenSSL Project.
-PCRE Telif Hakkı (c) 1997-2008 University of Cambridge
-SDL Telif Hakkı (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
-SSLeay Telif Hakkı (C) 1995-1998 Eric Young (eay@cryptsoft.com)
-xmlrpc-epi Telif Hakkı (C) 2000 Epinions, Inc.
-zlib Telif Hakkı (C) 1995-2002 Jean-loup Gailly ve Mark Adler.
-google-perftools Telif Hakkı (c) 2005, Google Inc.
+        APR Telif Hakkı (C) 2000-2004 The Apache Software Foundation
+        Collada DOM Telif Hakkı 2005 Sony Computer Entertainment Inc.
+        cURL Telif Hakkı (C) 1996-2002, Daniel Stenberg, (daniel@haxx.se)
+        DBus/dbus-glib Telif Hakkı (C) 2002, 2003  CodeFactory AB / Telif Hakkı (C) 2003, 2004 Red Hat, Inc.
+        expat Telif Hakkı (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
+        FreeType Telif Hakkı (C) 1996-2002, The FreeType Project (www.freetype.org).
+        GL Telif Hakkı (C) 1999-2004 Brian Paul.
+        GLOD Telif Hakkı (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University ve David Luebke, Brenden Schubert, University of Virginia.
+        google-perftools Telif Hakkı (c) 2005, Google Inc.
+        Havok.com(TM) Telif Hakkı (C) 1999-2001, Telekinesys Research Limited.
+        jpeg2000 Telif Hakkı (C) 2001, David Taubman, The University of New South Wales (UNSW)
+        jpeglib Telif Hakkı (C) 1991-1998, Thomas G. Lane.
+        ogg/vorbis Telif Hakkı (C) 2001, Xiphophorus
+        OpenSSL Telif Hakkı (C) 1998-2002 The OpenSSL Project.
+        PCRE Telif Hakkı (c) 1997-2008 University of Cambridge
+        SDL Telif Hakkı (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
+        SSLeay Telif Hakkı (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+        xmlrpc-epi Telif Hakkı (C) 2000 Epinions, Inc.
+        zlib Telif Hakkı (C) 1995-2002 Jean-loup Gailly ve Mark Adler.
+        google-perftools Telif Hakkı (c) 2005, Google Inc.
 
-Second Life Görüntüleyicisi Havok (TM) Fizik motorunu kullanmaktadır. (c)Telif Hakkı 1999-2010 Havok.com Inc. (ve Lisans Verenleri). Tüm Hakları Saklıdır. Ayrıntılı bilgi için bkz. www.havok.com
+        Second Life Görüntüleyicisi Havok (TM) Fizik motorunu kullanmaktadır. (c)Telif Hakkı 1999-2010 Havok.com Inc. (ve Lisans Verenleri). Tüm Hakları Saklıdır. Ayrıntılı bilgi için bkz. www.havok.com
 
-Tüm hakları saklıdır.  Ayrıntılı bilgi için bkz. licenses.txt
+        Bu yazılımda NVIDIA Corporation tarafından sağlanan kaynak kod yer almaktadır.
 
-Sesli sohbet için Ses kodlaması: Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C)
+        Tüm hakları saklıdır.  Ayrıntılı bilgi için bkz. licenses.txt
+
+        Sesli sohbet için Ses kodlaması: Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C)
 			</text_editor>
 		</panel>
 	</tab_container>
diff --git a/indra/newview/skins/default/xui/tr/floater_about_land.xml b/indra/newview/skins/default/xui/tr/floater_about_land.xml
index c44722f4baa0b81d2390c207d91120806cdc7115..a478d347a8bad49d4447de678123098d9ca4fb9f 100644
--- a/indra/newview/skins/default/xui/tr/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/tr/floater_about_land.xml
@@ -102,7 +102,7 @@
 			<text name="For Sale: Price L$[PRICE].">
 				Fiyat: L$[PRICE] (L$[PRICE_PER_SQM]/m²)
 			</text>
-			<button label="Arazi Sat" name="Sell Land..."/>
+			<button label="Araziyi Sat" name="Sell Land..."/>
 			<text name="For sale to">
 				Şu Alıcıya Satılık: [BUYER]
 			</text>
@@ -129,7 +129,7 @@
 				Trafik:
 			</text>
 			<text name="DwellText">
-				0
+				Yükleniyor...
 			</text>
 			<button label="Arazi Satın Al" name="Buy Land..."/>
 			<button label="Linden Satışı" name="Linden Sale..." tool_tip="Arazinin sahip olunması, içeriğinin ayarlanması ve ihaleye çıkmamış olması gerekir"/>
@@ -306,14 +306,13 @@ Sadece büyük parseller aramada görünür.
 			<panel.string name="push_restrict_region_text">
 				İtme Yok (Bölge Geçersiz Kılma)
 			</panel.string>
-			<panel.string name="see_avs_text">
-				Bu parseldeki sakinleri gör ve onlarla sohbet et
-			</panel.string>
 			<text name="allow_label">
 				Sakinlere şunun için izin ver:
 			</text>
-			<check_box label="Yüzeyi Düzenle" name="edit land check" tool_tip="İşaretliyse herkes arazinizi şekillendirebilir. en iyisi bunu işaretlememektir, çünkü kendi arazinizi her zaman düzenleyebilirsiniz."/>
-			<check_box label="Uç" name="check fly" tool_tip="İşaretliyse Sakinler arazinizden uçabilir. İşaretli değilse, sadece arazinize ve arazinizin üzerinde uçabilir."/>
+			<text name="allow_label0">
+				Uçma:
+			</text>
+			<check_box label="Herkes" name="check fly" tool_tip="İşaretliyse Sakinler arazinizden uçabilir. İşaretli değilse, sadece arazinize ve arazinizin üzerinde uçabilir."/>
 			<text name="allow_label2">
 				Ä°nÅŸa Et:
 			</text>
@@ -329,14 +328,11 @@ Sadece büyük parseller aramada görünür.
 			</text>
 			<check_box label="Herkes" name="check other scripts"/>
 			<check_box label="Grup" name="check group scripts"/>
-			<text name="land_options_label">
-				Arazi Seçenekleri:
-			</text>
 			<check_box label="Güvenli (hasar yok)" name="check safe" tool_tip="İşaretliyse, araziyi Güvenli moda getirerek hasar çarpışmasını etkinsizleştirir İşaretli değilse hasar çarpışması etkinleşir."/>
 			<check_box label="İtme Yok" name="PushRestrictCheck" tool_tip="Komut dosyalarının itmesini önler Bu seçeneğin işaretlenmesi arazinizdeki bozucu davranışları önlemeye yardımcı olabilir."/>
 			<check_box label="Konumu Arama sonuçlarında göster (L$30/hafta)" name="ShowDirectoryCheck" tool_tip="Arama sonuçlarında bu parsel görünsün"/>
 			<combo_box name="land category with adult">
-				<combo_box.item label="Herhangi Bir Kategori" name="item0"/>
+				<combo_box.item label="Herh. Bir Kategori" name="item0"/>
 				<combo_box.item label="Linden Konumu" name="item1"/>
 				<combo_box.item label="YetiÅŸkin" name="item2"/>
 				<combo_box.item label="Sanat ve Kültür" name="item3"/>
@@ -352,7 +348,7 @@ Sadece büyük parseller aramada görünür.
 				<combo_box.item label="DiÄŸer" name="item12"/>
 			</combo_box>
 			<combo_box name="land category">
-				<combo_box.item label="Herhangi Bir Kategori" name="item0"/>
+				<combo_box.item label="Herh. Bir Kategori" name="item0"/>
 				<combo_box.item label="Linden Konumu" name="item1"/>
 				<combo_box.item label="Sanat ve Kültür" name="item3"/>
 				<combo_box.item label="Ä°ÅŸ" name="item4"/>
@@ -372,9 +368,9 @@ Sadece büyük parseller aramada görünür.
 			</text>
 			<texture_picker name="snapshot_ctrl" tool_tip="Bir resim seçmek için tıklayın"/>
 			<text name="allow_label5">
-				Diğer parsellerdeki Sakinlere şunun için izin verin:
+				Başka parsellerdeki avatarlar bu parseldeki avatarları görebilir ve onlarla sohbet edebilir
 			</text>
-			<check_box label="Avatarları Gör" name="SeeAvatarsCheck" tool_tip="Diğer parsellerdeki sakinlerin bu parseldeki sakinleri görmesine ve onlarla sohbet etmesine, sizin de onları görüp, onlarla sohbet etmenize imkan tanır."/>
+			<check_box label="Avatarları Gör" name="SeeAvatarsCheck" tool_tip="Diğer parsellerdeki avatarların bu parseldeki avatarları görmesine ve onlarla sohbet etmesine, sizin de onları görüp, onlarla sohbet etmenize imkan tanır."/>
 			<text name="landing_point">
 				İniş Noktası: [LANDING]
 			</text>
@@ -419,7 +415,7 @@ Sadece büyük parseller aramada görünür.
 				piksel
 			</text>
 			<text name="Options:">
-				Seçenekler:
+				Seçenklr.:
 			</text>
 			<check_box label="Döngü" name="media_loop" tool_tip="Ortamı döngüsel olarak oynat.  Ortamın oynatılması bittiğinde baştan tekrar başlayacaktır."/>
 		</panel>
@@ -447,22 +443,17 @@ Sadece büyük parseller aramada görünür.
 			<panel.string name="access_estate_defined">
 				(Gayrimenkul tarafından tanımlanır)
 			</panel.string>
-			<panel.string name="allow_public_access">
-				Kamusal Erişime İzin Ver ([MATURITY]) (Not: Bunun işaretinin kaldırılması yasaklama çizgileri oluşturacaktır)
-			</panel.string>
 			<panel.string name="estate_override">
 				Bu seçeneklerden biri veya daha fazlası gayrimenkul düzeyinde ayarlanır
 			</panel.string>
-			<text name="Limit access to this parcel to:">
-				Bu Parsele EriÅŸim
-			</text>
+			<check_box label="Kamusal Erişime İzin Ver (Bunun işaretinin kaldırılması yasaklama çizgileri oluşturacaktır)" name="public_access"/>
 			<text name="Only Allow">
-				Erişimi şununla doğrulanan Sakinlerle Sınırla:
+				Sadece ÅŸu Sakinlere eriÅŸim izni verin:
 			</text>
-			<check_box label="Dosyadaki ödeme bilgileri [ESTATE_PAYMENT_LIMIT]" name="limit_payment" tool_tip="Tanınmayan Sakinleri Yasakla."/>
-			<check_box label="Yaş doğrulama [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="Yaşını doğrulamayan Sakinleri yasakla Daha fazla bilgi için [SUPPORT_SITE] adresini ziyaret edin."/>
+			<check_box label="Ödeme bilgileri kayıtlı [ESTATE_PAYMENT_LIMIT]" name="limit_payment" tool_tip="Sakinlerin bu parsele erişebilmesi için ödeme bilgilerinin kayıtlı olması gerekir.  Daha fazla bilgi için [SUPPORT_SITE] adresini ziyaret edin."/>
+			<check_box label="Yaş doğrulaması yapılmış [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="Sakinlerin bu parsele erişebilmesi için yaş doğrulamalarının yapılmış olması gerekir. Daha fazla bilgi için [SUPPORT_SITE] adresini ziyaret edin."/>
 			<check_box label="Grup EriÅŸimine Ä°zin Ver: [GROUP]" name="GroupCheck" tool_tip="Genel sekmesinde grup ayarla."/>
-			<check_box label="Geçiş haklarını şuna sat:" name="PassCheck" tool_tip="Bu parsele geçici erişim verir"/>
+			<check_box label="Geçiş haklr. şuna sat:" name="PassCheck" tool_tip="Bu parsele geçici erişim verir"/>
 			<combo_box name="pass_combo">
 				<combo_box.item label="Herkes" name="Anyone"/>
 				<combo_box.item label="Grup" name="Group"/>
diff --git a/indra/newview/skins/default/xui/tr/floater_animation_anim_preview.xml b/indra/newview/skins/default/xui/tr/floater_animation_anim_preview.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a63e1e107e4afb5bc7bf377c41bc73a76c36f9d4
--- /dev/null
+++ b/indra/newview/skins/default/xui/tr/floater_animation_anim_preview.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Anim Preview" title="ANIMATION.ANIM">
+	<text name="name_label">
+		Ad:
+	</text>
+	<text name="description_label">
+		Açıklama:
+	</text>
+	<button label="Karşıya Yükle (L$[AMOUNT])" name="ok_btn"/>
+	<button label="Ä°ptal" label_selected="Ä°ptal" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/tr/floater_animation_bvh_preview.xml b/indra/newview/skins/default/xui/tr/floater_animation_bvh_preview.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f8800c674d0b54dceae778ef1daea45410e581f0
--- /dev/null
+++ b/indra/newview/skins/default/xui/tr/floater_animation_bvh_preview.xml
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Animation Preview">
+	<floater.string name="failed_to_initialize">
+		Hareket başlatılamadı
+	</floater.string>
+	<floater.string name="anim_too_long">
+		Animasyon dosyası [LENGTH] saniye uzunluğunda.
+
+Maksimum animasyon uzunluÄŸu [LENGTH] saniye.
+	</floater.string>
+	<floater.string name="failed_file_read">
+		Animasyon dosyası okunamadı.
+
+[STATUS]
+	</floater.string>
+	<floater.string name="E_ST_OK">
+		Tamam
+	</floater.string>
+	<floater.string name="E_ST_EOF">
+		Dosyanın zamanından önce sonu.
+	</floater.string>
+	<floater.string name="E_ST_NO_CONSTRAINT">
+		Kısıtlama tanımı okunamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_FILE">
+		BVH dosyası açılamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_HIER">
+		Geçersiz HİYERARŞİ üst bilgisi.
+	</floater.string>
+	<floater.string name="E_ST_NO_JOINT">
+		KÖK veya EKLEM bulunamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_NAME">
+		EKLEM adı alınamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_OFFSET">
+		OFSET bulunamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_CHANNELS">
+		KANALLAR bulunamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_ROTATION">
+		Döndürme sırası alınamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_AXIS">
+		Döndürme ekseni alınamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_MOTION">
+		HAREKET bulunamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_FRAMES">
+		kARE SAYISI alınamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_FRAME_TIME">
+		Kare zamanı alınamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_POS">
+		Konum değerleri alınamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_ROT">
+		Döndürme değerleri alınamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_FILE">
+		Çeviri dosyası açılamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_HEADER">
+		Çeviri üst bilgisi okunamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_NAME">
+		Çeviri adları okunamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_IGNORE">
+		Çeviri yoksay değeri okunamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_RELATIVE">
+		Çeviri nisbi değeri okunamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_OUTNAME">
+		Çeviri çıkış adı değeri okunamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MATRIX">
+		Çeviri matrisi okunamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MERGECHILD">
+		Birleştirme alt birim adı alınamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_MERGEPARENT">
+		Birleştirme üst birim adı alınamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_PRIORITY">
+		Öncelik değerleri alınamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_LOOP">
+		Döngü (tekrar) değerleri alınamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EASEIN">
+		Easln (Yavaş Başlangıç) değerleri alınamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EASEOUT">
+		EaseOut (Yavaş Bitiş) değerleri alınamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_HAND">
+		El şekillendirme değeri alınamadı.
+	</floater.string>
+	<floater.string name="E_ST_NO_XLT_EMOTE">
+		Duygu ifadesi adı okunamadı.
+	</floater.string>
+	<floater.string name="E_ST_BAD_ROOT">
+		Yanlış kök eklem adı, &quot;kalça&quot; kullanın
+	</floater.string>
+	<text name="name_label">
+		Ad:
+	</text>
+	<text name="description_label">
+		Açıklama:
+	</text>
+	<spinner label="Öncelik" name="priority" tool_tip="Bu animasyonun diğer animasyonları geçersiz kılabileceği kontrolleri"/>
+	<check_box label="Döngü" name="loop_check" tool_tip="Bu animasyonun döngülenmesini (tekrarlanmasını) sağlar"/>
+	<spinner label="İç (%)" name="loop_in_point" tool_tip="Döngünün döndüğü animasyon noktasını belirler"/>
+	<spinner label="Dış (%)" name="loop_out_point" tool_tip="Animasyonda döngünün bittiği noktayı belirler"/>
+	<text name="hand_label">
+		El DuruÅŸu
+	</text>
+	<combo_box name="hand_pose_combo" tool_tip="Ellerin animasyon sırasında neler yaptığını kontrol eder">
+		<combo_box.item label="Yayılım" name="Spread"/>
+		<combo_box.item label="Rahat" name="Relaxed"/>
+		<combo_box.item label="Her Ä°kisi de Ä°ÅŸaret Ediyor" name="PointBoth"/>
+		<combo_box.item label="Yumruk" name="Fist"/>
+		<combo_box.item label="Sol Rahat" name="RelaxedLeft"/>
+		<combo_box.item label="Sol Ä°ÅŸaret Ediyor" name="PointLeft"/>
+		<combo_box.item label="Sol Yumruk" name="FistLeft"/>
+		<combo_box.item label="SaÄŸ Rahat" name="RelaxedRight"/>
+		<combo_box.item label="SaÄŸ Ä°ÅŸaret Ediyor" name="PointRight"/>
+		<combo_box.item label="SaÄŸ Yumruk" name="FistRight"/>
+		<combo_box.item label="Sağı Selamlıyor" name="SaluteRight"/>
+		<combo_box.item label="Yazı Yazıyor" name="Typing"/>
+		<combo_box.item label="Sağ Barış" name="PeaceRight"/>
+	</combo_box>
+	<text name="emote_label">
+		Ä°fade
+	</text>
+	<combo_box name="emote_combo" tool_tip="Yüzün animasyon sırasındaki ifadesini kontrol eder">
+		<item label="(Hiçbiri)" name="[None]" value=""/>
+		<item label="Aaaaah" name="Aaaaah" value="Aaaaah"/>
+		<item label="KorkmuÅŸ" name="Afraid" value="KorkmuÅŸ"/>
+		<item label="Kızgın" name="Angry" value="Kızgın"/>
+		<item label="Yaygın Gülümseyiş" name="BigSmile" value="Yaygın Gülümseyiş"/>
+		<item label="Canı Sıkılmış" name="Bored" value="Canı Sıkılmış"/>
+		<item label="AÄŸlama" name="Cry" value="AÄŸlama"/>
+		<item label="Dudak Bükme" name="Disdain" value="Dudak Bükme"/>
+		<item label="Utanmış" name="Embarrassed" value="Utanmış"/>
+		<item label="Kaş Çatma" name="Frown" value="Kaş Çatma"/>
+		<item label="Öpücük" name="Kiss" value="Öpücük"/>
+		<item label="Gülme" name="Laugh" value="Gülme"/>
+		<item label="Kahkaha" name="Plllppt" value="Kahkaha"/>
+		<item label="TiksinmiÅŸ" name="Repulsed" value="TiksinmiÅŸ"/>
+		<item label="Üzgün" name="Sad" value="Üzgün"/>
+		<item label="Omuz Silkme" name="Shrug" value="Omuz Silkme"/>
+		<item label="Gülümseme" name="Smile" value="Gülümseme"/>
+		<item label="Sürpriz" name="Surprise" value="Sürpriz"/>
+		<item label="Göz Kırpma" name="Wink" value="Göz Kırpma"/>
+		<item label="EndiÅŸelenme" name="Worry" value="EndiÅŸelenme"/>
+	</combo_box>
+	<text name="preview_label">
+		Şu sırada önizle
+	</text>
+	<combo_box name="preview_base_anim" tool_tip="Animasyon davranışınızı avatarınız genel hareketleri yaparken test etmek için bunu kullanın.">
+		<item label="Ayakta Duruyor" name="Standing" value="Ayakta Duruyor"/>
+		<item label="Yürüyor" name="Walking" value="Yürüyor"/>
+		<item label="Oturuyor" name="Sitting" value="Oturuyor"/>
+		<item label="Uçuyor" name="Flying" value="Uçuyor"/>
+	</combo_box>
+	<spinner label="Yavaş Başlangıç (saniye)" name="ease_in_time" tool_tip="Animasyonun kaynaştığı süre (saniye olarak)"/>
+	<spinner label="Yavaş Bitiş (saniye)" name="ease_out_time" tool_tip="Animasyonun ayrıştığı süre (saniye olarak)"/>
+	<button name="play_btn" tool_tip="Animasyonunu oynat"/>
+	<button name="pause_btn" tool_tip="Animasyonunu duraklat"/>
+	<button name="stop_btn" tool_tip="Animasyo oynatmayı durdur"/>
+	<text name="bad_animation_text">
+		Animasyon dosyası okunamadı.
+
+Poser 4&apos;ten aktarılan BHV dosyalarını tavsiye ederiz.
+	</text>
+	<button label="Karşıya Yükle (L$[AMOUNT])" name="ok_btn"/>
+	<button label="Ä°ptal" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/tr/floater_avatar.xml b/indra/newview/skins/default/xui/tr/floater_avatar.xml
index fc9e3c8a9b5c272c2d5336005c5a8fa9bdf5301f..c6b14ba710565ba39ad9bb34bcb49de95cafe102 100644
--- a/indra/newview/skins/default/xui/tr/floater_avatar.xml
+++ b/indra/newview/skins/default/xui/tr/floater_avatar.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Avatar" title="AVATAR SEÇİCİ"/>
+<floater name="Avatar" title="BİR AVATAR SEÇİN"/>
diff --git a/indra/newview/skins/default/xui/tr/floater_buy_currency.xml b/indra/newview/skins/default/xui/tr/floater_buy_currency.xml
index 48cd93ccf9ce0a076c40a526a5ffa2a19bbf177a..d90985dcffeae13f9e372a1b2cf51e66bf7b8e5d 100644
--- a/indra/newview/skins/default/xui/tr/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/tr/floater_buy_currency.xml
@@ -46,7 +46,7 @@
 		L$ [AMT]
 	</text>
 	<text name="currency_links">
-		[http://www.secondlife.com/my/account/payment_method_management.php ödeme yöntemi] | [http://www.secondlife.com/my/account/currency.php para birimi | [http://www.secondlife.com/my/account/exchange_rates.php döviz kurları]
+		[http://www.secondlife.com/my/account/payment_method_management.php ödeme yöntemi] | [http://www.secondlife.com/my/account/currency.php para birimi]
 	</text>
 	<text name="exchange_rate_note">
 		En son döviz kurunu görmek için miktarı yeniden girin.
diff --git a/indra/newview/skins/default/xui/tr/floater_buy_land.xml b/indra/newview/skins/default/xui/tr/floater_buy_land.xml
index 4d43157f99d2037f6e1a758835ac8aa2f58094d6..7b43af2ea483092629c8ae8060d8393fcb2d7037 100644
--- a/indra/newview/skins/default/xui/tr/floater_buy_land.xml
+++ b/indra/newview/skins/default/xui/tr/floater_buy_land.xml
@@ -53,7 +53,7 @@ Daha küçük bir alan seçmeyi deneyin.
 		Arazi alma bilgileri çekilirken hata oluştu.
 	</floater.string>
 	<floater.string name="buying_will">
-		Bu arazinin satın alınması sonucu:
+		Arazinin satın alınması sonucu:
 	</floater.string>
 	<floater.string name="buying_for_group">
 		Bu arazinin grup için satın alınması sonucu:
@@ -185,7 +185,7 @@ Daha küçük bir alan seçmeyi deneyin.
 nesnelerle satılır
 	</text>
 	<text name="info_action">
-		Bu arazinin satın alınması sonucu:
+		Arazinin satın alınması sonucu:
 	</text>
 	<text name="error_message">
 		Bir ÅŸeyler yolunda deÄŸil.
diff --git a/indra/newview/skins/default/xui/tr/floater_camera.xml b/indra/newview/skins/default/xui/tr/floater_camera.xml
index 4161e6ea52a6feba219f00d034b023dc98bf251f..22e2aa52c6ba26ca619307a6c4f9db638038a20f 100644
--- a/indra/newview/skins/default/xui/tr/floater_camera.xml
+++ b/indra/newview/skins/default/xui/tr/floater_camera.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="camera_floater" title="GÖSTER">
+<floater name="camera_floater" title="KAMERA DENETÄ°MLERÄ°">
 	<floater.string name="rotate_tooltip">
 		Odak Etrafında Kamerayı Döndür
 	</floater.string>
@@ -9,15 +9,6 @@
 	<floater.string name="move_tooltip">
 		Kamerayı Yukarı ve Aşağı, Sola ve Sağa Hareket Ettir
 	</floater.string>
-	<floater.string name="camera_modes_title">
-		Kamera modları
-	</floater.string>
-	<floater.string name="pan_mode_title">
-		Yörünge - Yakınlş. - Kamerayı Çvr.
-	</floater.string>
-	<floater.string name="presets_mode_title">
-		Ön Ayarlı Görünümler
-	</floater.string>
 	<floater.string name="free_mode_title">
 		Nesneyi Göster
 	</floater.string>
diff --git a/indra/newview/skins/default/xui/tr/floater_chat_bar.xml b/indra/newview/skins/default/xui/tr/floater_chat_bar.xml
index d2385e6be39ca6cf7b894b3f5400e020b628f7cd..988c845982f4500c27e933bc7ea17828267eb701 100644
--- a/indra/newview/skins/default/xui/tr/floater_chat_bar.xml
+++ b/indra/newview/skins/default/xui/tr/floater_chat_bar.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="chat_bar" title="YAKINDAKÄ° SOHBET">
-	<panel>
+	<panel name="bottom_panel">
 		<line_editor label="Sohbet etmek için buraya tıklayın." name="chat_box" tool_tip="Söylemek için Enter, bağırmak için Ctrl+Enter yapın"/>
-		<button name="show_nearby_chat" tool_tip="yakın sohbet günlüğünü gösterir/gizler"/>
+		<button name="show_nearby_chat" tool_tip="Yakın sohbet günlüğünü gösterir/gizler"/>
 	</panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/tr/floater_edit_day_cycle.xml b/indra/newview/skins/default/xui/tr/floater_edit_day_cycle.xml
index e2e87ddf1e7efa93883b305693dbbea723395db0..4be1068dcc4abcd74675f1fe3c876fe2d02f9fc2 100644
--- a/indra/newview/skins/default/xui/tr/floater_edit_day_cycle.xml
+++ b/indra/newview/skins/default/xui/tr/floater_edit_day_cycle.xml
@@ -22,10 +22,10 @@
 		Not: Ön ayarınızın adını değiştirirseniz, yeni bir ön ayar oluşturursunuz ve mevcut ön ayar değişmez.
 	</text>
 	<text name="hint_item1">
-		- Belirli gökyüzü ayarlarını ve zamanı düzenlemek için bir sekmeye tıklayın.
+		- Birine tıklayarak gökyüzü ayarlarını/zamanı düzenleyin.
 	</text>
 	<text name="hint_item2">
-		- Geçiş sürelerini ayarlamak için sekmelere tıklayın ve bunları sürükleyin.
+		- Sekmelere tıklayıp sürükleyerek geçiş sürlrn. ayarlayın.
 	</text>
 	<text name="hint_item3">
 		- Gün döngünüzü önizlemek için fırçayı kullanın.
diff --git a/indra/newview/skins/default/xui/tr/floater_environment_settings.xml b/indra/newview/skins/default/xui/tr/floater_environment_settings.xml
index 943e1e810d8af04da39fe22deba633ab4cd65c5a..e702da7e1b010703089018e76ad79951779fa277 100644
--- a/indra/newview/skins/default/xui/tr/floater_environment_settings.xml
+++ b/indra/newview/skins/default/xui/tr/floater_environment_settings.xml
@@ -18,7 +18,7 @@
 			<combo_box.item label="-Bir ön ayar seçin-" name="item0"/>
 		</combo_box>
 		<text name="sky_dayc_settings_title">
-			Gökyüzü / Gün Döngüsü
+			Gökyüzü/Gün Dön.
 		</text>
 		<radio_group name="sky_dayc_settings_radio_group">
 			<radio_item label="Sabit gökyüzü" name="my_sky_settings"/>
diff --git a/indra/newview/skins/default/xui/tr/floater_god_tools.xml b/indra/newview/skins/default/xui/tr/floater_god_tools.xml
index ce7f7badcc99cfb0ef7dc0f177311e6d53b7232a..26e5ebd18b8c6789d2be88ef875761b28dda6a88 100644
--- a/indra/newview/skins/default/xui/tr/floater_god_tools.xml
+++ b/indra/newview/skins/default/xui/tr/floater_god_tools.xml
@@ -67,7 +67,7 @@
 			<button label="Hedefin *Herhangi Bir* Arazideki Komut Dosyalı Nesnelerini Sil" label_selected="Hedefin *Herhangi Bir* Arazideki Komut Dosyalı Nesnelerini Sil" name="Delete Target&apos;s Scripted Objects On *Any* Land" tool_tip="Bu bölgede hedefe ait olan tüm komut dosyalı nesneleri silin. (kopya yok) nesneler geri döndürülür."/>
 			<button label="Hedefin *TÜM* Nesnelerini Sil" label_selected="Hedefin *TÜM* Nesnelerini Sil" name="Delete *ALL* Of Target&apos;s Objects" tool_tip="Bu bölgede hedefe ait olan tüm nesneleri silin. (kopya yok) nesneler geri döndürülür."/>
 			<button label="En Çok Çarpışanlar" label_selected="En Çok Çarpışanlar" name="Get Top Colliders" tool_tip="En dar fazda geri aramaları yaşayan nesnelerin listesini alır"/>
-			<button label="En Çok Komut Dosyası Çalıştıranlar" label_selected="En Çok Komut Dosyası Çalıştıranlar" name="Get Top Scripts" tool_tip="Komut dosyalarını çalıştırırken en çok zaman harcayan nesnelerin listesini alır"/>
+			<button label="En Çok Komut Dsy. Çalştr." label_selected="En Çok Komut Dsy. Çalştr." name="Get Top Scripts" tool_tip="Komut dosyalarını çalıştırırken en çok zaman harcayan nesnelerin listesini alır"/>
 			<button label="Komut dosyaları özeti" label_selected="Komut dosyaları özeti" name="Scripts digest" tool_tip="Tüm komut dosyalarının ve her birinin ne kadar kullanıldığının listesini alır"/>
 		</panel>
 		<panel label="Talep" name="request">
diff --git a/indra/newview/skins/default/xui/tr/floater_hardware_settings.xml b/indra/newview/skins/default/xui/tr/floater_hardware_settings.xml
index 12927dcaebbc54313818229a83b8292b61ccac17..8e056b9b0d0353bfe45d6c5e389fddcdb2ab5934 100644
--- a/indra/newview/skins/default/xui/tr/floater_hardware_settings.xml
+++ b/indra/newview/skins/default/xui/tr/floater_hardware_settings.xml
@@ -4,8 +4,8 @@
 		Filtreleme:
 	</text>
 	<check_box label="Anisotropik Filtreleme (etkinken daha yavaÅŸ)" name="ani"/>
-	<text name="Antialiasing:">
-		Antialiasing:
+	<text name="antialiasing label">
+		Düzgünleştirme:
 	</text>
 	<combo_box label="Antialiasing" name="fsaa">
 		<combo_box.item label="Devre dışı" name="FSAADisabled"/>
diff --git a/indra/newview/skins/default/xui/tr/floater_joystick.xml b/indra/newview/skins/default/xui/tr/floater_joystick.xml
index 31d819743ca7642a6bdc462425313327a7f914d7..4a27aac3c193f0f73ea9fc8ce68950c8756b6c69 100644
--- a/indra/newview/skins/default/xui/tr/floater_joystick.xml
+++ b/indra/newview/skins/default/xui/tr/floater_joystick.xml
@@ -3,10 +3,10 @@
 	<floater.string name="NoDevice">
 		cihaz tespit edilmedi
 	</floater.string>
-	<check_box label="Oyun Çubuğunu Etkinleştir:" name="enable_joystick"/>
-	<spinner label="X Eksen Haritalama" name="JoystickAxis1"/>
-	<spinner label="Y Eksen Haritalama" name="JoystickAxis2"/>
-	<spinner label="Z Eksen Haritalama" name="JoystickAxis0"/>
+	<check_box label="Oyun Çub. Etkşt:" name="enable_joystick"/>
+	<spinner label="X Eks. Haritalama" name="JoystickAxis1"/>
+	<spinner label="Y Eks. Haritalama" name="JoystickAxis2"/>
+	<spinner label="Z Eks. Haritalama" name="JoystickAxis0"/>
 	<spinner label="EÄŸim Haritalama" name="JoystickAxis4"/>
 	<spinner label="Düşey Sapma Haritalama" name="JoystickAxis5"/>
 	<spinner label="Tilt Haritalama" name="JoystickAxis3"/>
diff --git a/indra/newview/skins/default/xui/tr/floater_merchant_outbox.xml b/indra/newview/skins/default/xui/tr/floater_merchant_outbox.xml
new file mode 100644
index 0000000000000000000000000000000000000000..325d1d9ed97a28b841dfb48f8cd5dc5c82dc34b1
--- /dev/null
+++ b/indra/newview/skins/default/xui/tr/floater_merchant_outbox.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_merchant_outbox" title="SATICI GÄ°DEN KUTUSU">
+	<string name="OutboxFolderCount1">
+		1 klasör
+	</string>
+	<string name="OutboxFolderCountN">
+		[NUM] klasör
+	</string>
+	<string name="OutboxImporting">
+		Klasörler gönderiliyor...
+	</string>
+	<string name="OutboxInitializing">
+		Başlatılıyor...
+	</string>
+	<panel label="">
+		<panel>
+			<panel name="outbox_inventory_placeholder_panel">
+				<text name="outbox_inventory_placeholder_title">
+					Yükleniyor...
+				</text>
+			</panel>
+		</panel>
+		<panel>
+			<button label="Pazaryerine Gönder" name="outbox_import_btn" tool_tip="Pazaryeri Vitrinime Gönder"/>
+		</panel>
+	</panel>
+</floater>
diff --git a/indra/newview/skins/default/xui/tr/floater_model_preview.xml b/indra/newview/skins/default/xui/tr/floater_model_preview.xml
index 339545f96e994cd5730a20fdbca58b627a596c3d..0c7cabc6ea31456c9901c594f3b2d4ba1df0d944 100644
--- a/indra/newview/skins/default/xui/tr/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/tr/floater_model_preview.xml
@@ -4,6 +4,9 @@
 	<string name="status_parse_error">
 		Hata: Tarih ayrıştırma sorunu - ayrıntılar için günlüğe bakın.
 	</string>
+	<string name="status_material_mismatch">
+		Hata: Modelin malzemesi, referans modelin bir alt kümesi değil.
+	</string>
 	<string name="status_reading_file">
 		Yükleniyor...
 	</string>
diff --git a/indra/newview/skins/default/xui/tr/floater_model_wizard.xml b/indra/newview/skins/default/xui/tr/floater_model_wizard.xml
index 108d20cfac4473b68d7493de1d566a84fdd503a7..9d8b982c249d768a4a212e7fff5e79816229b4fd 100644
--- a/indra/newview/skins/default/xui/tr/floater_model_wizard.xml
+++ b/indra/newview/skins/default/xui/tr/floater_model_wizard.xml
@@ -6,12 +6,12 @@
 	<button label="2. Optimize et" name="optimize_btn"/>
 	<button label="1. Dosya Seç" name="choose_file_btn"/>
 	<panel name="choose_file_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="choose_file_header_panel">
+			<text name="choose_file_header_text">
 				Model dosyasını seçin
 			</text>
 		</panel>
-		<panel name="content">
+		<panel name="choose_file_content">
 			<text name="advanced_users_text">
 				Gelişmiş kullanıcılar: Eğer 3B içerik oluşturma araçlarını kullanmayı biliyorsanız, Gelişmiş Karşıya Yükleyiciyi kullanmak isteyebilirsiniz.
 			</text>
@@ -20,6 +20,9 @@
 				Karşıya yüklenecek model dosyasını seçin
 			</text>
 			<button label="Gözat..." label_selected="Gözat..." name="browse"/>
+			<text name="Model types">
+				Second Life, COLLADA (.dae) dosyalarını destekler
+			</text>
 			<text name="dimensions">
 				X         Y         Z
 			</text>
@@ -32,15 +35,15 @@
 		</panel>
 	</panel>
 	<panel name="optimize_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="optimize_header_panel">
+			<text name="optimize_header_text">
 				Modeli optimize et
 			</text>
 		</panel>
-		<text name="description">
+		<text name="optimize_description">
 			Modeli performans için optimize ettik. İstiyorsanız daha da ayarlayabilirsiniz.
 		</text>
-		<panel name="content">
+		<panel name="optimize_content">
 			<text name="high_detail_text">
 				Ayrıntı Seviyesi Oluştur: Yüksek
 			</text>
@@ -76,15 +79,15 @@
 		</panel>
 	</panel>
 	<panel name="physics_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="physics_header_panel">
+			<text name="physics_header_text">
 				Fizik ayarlarını yap
 			</text>
 		</panel>
-		<text name="description">
+		<text name="physics_description">
 			Modelin dış gövdesi için bir şekil oluşturacağız. Modelinizin amacına uygun olarak şeklin ayrıntı seviyesini belirleyin.
 		</text>
-		<panel name="content">
+		<panel name="physics_content">
 			<button label="Fizik hesaplarını tekrar yap" name="recalculate_physics_btn"/>
 			<button label="Tekrar hesaplanıyor..." name="recalculating_physics_btn"/>
 			<text name="lod_label">
@@ -107,12 +110,12 @@
 		</panel>
 	</panel>
 	<panel name="review_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="review_header_panel">
+			<text name="review_header_text">
 				Ä°ncele
 			</text>
 		</panel>
-		<panel name="content">
+		<panel name="review_content">
 			<text name="review_prim_equiv">
 				Parsele/bölgeye etkisi: [EQUIV] prim eşdeğerleri
 			</text>
@@ -125,8 +128,8 @@
 		</panel>
 	</panel>
 	<panel name="upload_panel">
-		<panel name="header_panel">
-			<text name="header_text">
+		<panel name="upload_header_panel">
+			<text name="upload_header_text">
 				Karşıya yükleme bitti
 			</text>
 		</panel>
diff --git a/indra/newview/skins/default/xui/tr/floater_moveview.xml b/indra/newview/skins/default/xui/tr/floater_moveview.xml
index 74ed613a62a36ca834e5bc4f97c8fd8876ed45ce..9226218a240d425c71f4e6632966583be9949e3b 100644
--- a/indra/newview/skins/default/xui/tr/floater_moveview.xml
+++ b/indra/newview/skins/default/xui/tr/floater_moveview.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="move_floater" title="HAREKET ET">
+<floater name="move_floater" title="YÜRÜ / KOŞ / UÇ">
 	<string name="walk_forward_tooltip">
 		İleri Yürü (Yukarı Okuna veya W&apos;ye basın)
 	</string>
diff --git a/indra/newview/skins/default/xui/tr/floater_preferences.xml b/indra/newview/skins/default/xui/tr/floater_preferences.xml
index a0be9dc53f03c3361880062b49228936f26447bb..edb3c19b81f04f5d6be58e5fbce45b6624519890 100644
--- a/indra/newview/skins/default/xui/tr/floater_preferences.xml
+++ b/indra/newview/skins/default/xui/tr/floater_preferences.xml
@@ -7,7 +7,7 @@
 		<panel label="Grafikler" name="display"/>
 		<panel label="Ses ve Ortamlar" name="audio"/>
 		<panel label="Sohbet" name="chat"/>
-		<panel label="Hareketler ve Görünümler" name="move"/>
+		<panel label="Hareket ve Görünümler" name="move"/>
 		<panel label="Bildirimler" name="msgs"/>
 		<panel label="Renkler" name="colors"/>
 		<panel label="Gizlilik" name="im"/>
diff --git a/indra/newview/skins/default/xui/tr/floater_preview_animation.xml b/indra/newview/skins/default/xui/tr/floater_preview_animation.xml
index 1c526c75f9bd73a95f7006ff635183ea0f4d08e0..23b484833378add7b6832740b23b464045c321db 100644
--- a/indra/newview/skins/default/xui/tr/floater_preview_animation.xml
+++ b/indra/newview/skins/default/xui/tr/floater_preview_animation.xml
@@ -6,6 +6,6 @@
 	<text name="desc txt">
 		Açıklama:
 	</text>
-	<button label="SL Dünyasında Oynat" label_selected="Durdur" name="Anim play btn" tool_tip="Bu animasyonu başkaları görebilecek şekilde oynatın"/>
-	<button label="Yerel Olarak Oynat" label_selected="Durdur" name="Anim audition btn" tool_tip="Bu animasyonu sadece kendinizin görebileceği şekilde oynatın"/>
+	<button label="SL Dünyasında Oynat" label_selected="Durdur" name="Inworld" tool_tip="Bu animasyonu başkaları görebilecek şekilde oynatın"/>
+	<button label="Yerel Olarak Oynat" label_selected="Durdur" name="Locally" tool_tip="Bu animasyonu sadece kendinizin görebileceği şekilde oynatın"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/tr/floater_preview_gesture.xml b/indra/newview/skins/default/xui/tr/floater_preview_gesture.xml
index fa9fd37e6c517f546bdcc80a1f449d8add7b3f10..dc6f66f65718867cdfb66ff81c3295e023717fa2 100644
--- a/indra/newview/skins/default/xui/tr/floater_preview_gesture.xml
+++ b/indra/newview/skins/default/xui/tr/floater_preview_gesture.xml
@@ -65,7 +65,7 @@
 	<check_box label="tüm animasyonlar bitinceye kadar" name="wait_anim_check"/>
 	<check_box label="saniye olarak zaman:" name="wait_time_check"/>
 	<text name="help_label">
-		Bekleme adımlar eklemediğiniz sürece tüm adımlar aynı anda gerçekleşir.
+		Bekleme adımları eklemediğiniz sürece tüm adımlar aynı anda gerçekleşir.
 	</text>
 	<check_box label="Etkin" name="active_check" tool_tip="Etkin mimikleri tetiklemek için tetikleme fazları için sohbet gerçekleştirebilir veya kısayol tuşlarına basabilirsiniz.  Bir anahtar bağlama ihtilafı olduğunda mimikler genellikle inaktif hale geçer."/>
 	<button label="Önizleme" name="preview_btn"/>
diff --git a/indra/newview/skins/default/xui/tr/floater_report_abuse.xml b/indra/newview/skins/default/xui/tr/floater_report_abuse.xml
index ae4c3cc75e4f241c55a10996fb7c8eacc21dd994..c5765883c43ec510f4d1d95b7af7d7b23b215164 100644
--- a/indra/newview/skins/default/xui/tr/floater_report_abuse.xml
+++ b/indra/newview/skins/default/xui/tr/floater_report_abuse.xml
@@ -81,7 +81,7 @@
 		Özet:
 	</text>
 	<text name="dscr_title">
-		Ayrıntılar:
+		Ayrıntl:
 	</text>
 	<text name="bug_aviso">
 		Mümkün olduğunca spesifik olun
diff --git a/indra/newview/skins/default/xui/tr/floater_snapshot.xml b/indra/newview/skins/default/xui/tr/floater_snapshot.xml
index 492ec4b5886cf3e6b6ec41f8a7ccfce9bd0d6623..fa51f15d16acb348408d5c4bbca1d59cf7f8e8d3 100644
--- a/indra/newview/skins/default/xui/tr/floater_snapshot.xml
+++ b/indra/newview/skins/default/xui/tr/floater_snapshot.xml
@@ -3,72 +3,63 @@
 	<floater.string name="unknown">
 		bilinmiyor
 	</floater.string>
-	<radio_group label="Anlık görüntü türü" name="snapshot_type_radio">
-		<radio_item label="E-posta" name="postcard"/>
-		<radio_item label="Envanterim (L$[AMOUNT])" name="texture"/>
-		<radio_item label="Bilgisayarıma kaydet" name="local"/>
-	</radio_group>
+	<string name="postcard_progress_str">
+		E-posta Gönderiliyor
+	</string>
+	<string name="profile_progress_str">
+		Yayınlanıyor
+	</string>
+	<string name="inventory_progress_str">
+		Envantere Kaydediliyor
+	</string>
+	<string name="local_progress_str">
+		Bilgisayara Kaydediliyor
+	</string>
+	<string name="profile_succeeded_str">
+		Görüntü yüklendi
+	</string>
+	<string name="postcard_succeeded_str">
+		E-posta Gönderildi!
+	</string>
+	<string name="inventory_succeeded_str">
+		Envantere Kaydedildi!
+	</string>
+	<string name="local_succeeded_str">
+		Bilgisayara Kaydedildi!
+	</string>
+	<string name="profile_failed_str">
+		Görüntü Profil Akışınıza yüklenemedi.
+	</string>
+	<string name="postcard_failed_str">
+		E-posta gönderilemedi.
+	</string>
+	<string name="inventory_failed_str">
+		Envantere kaydedilemedi.
+	</string>
+	<string name="local_failed_str">
+		Bilgisayara kaydedilemedi.
+	</string>
+	<button name="advanced_options_btn" tool_tip="Gelişmiş seçenekler"/>
+	<text name="image_res_text">
+		[WIDTH] x [HEIGHT] px
+	</text>
 	<text name="file_size_label">
 		[SIZE] KB
 	</text>
-	<button label="Gönder" name="send_btn"/>
-	<button label="Kaydet (L$[AMOUNT])" name="upload_btn"/>
-	<flyout_button label="Kaydet" name="save_btn" tool_tip="Görüntüyü bir dosyaya kaydet">
-		<flyout_button.item label="Kaydet" name="save_item"/>
-		<flyout_button.item label="Farklı Kaydet..." name="saveas_item"/>
-	</flyout_button>
-	<button label="Daha Fazla" name="more_btn" tool_tip="Gelişmiş seçenekler"/>
-	<button label="Daha Az" name="less_btn" tool_tip="Gelişmiş seçenekler"/>
-	<button label="Ä°ptal" name="discard_btn"/>
-	<text name="type_label2">
-		Büyüklük
-	</text>
-	<text name="format_label">
-		Format
-	</text>
-	<combo_box label="Çözünürlük" name="postcard_size_combo">
-		<combo_box.item label="Mevcut Pencere" name="CurrentWindow"/>
-		<combo_box.item label="640x480" name="640x480"/>
-		<combo_box.item label="800x600" name="800x600"/>
-		<combo_box.item label="1024x768" name="1024x768"/>
-		<combo_box.item label="Özel" name="Custom"/>
-	</combo_box>
-	<combo_box label="Çözünürlük" name="texture_size_combo">
-		<combo_box.item label="Mevcut Pencere" name="CurrentWindow"/>
-		<combo_box.item label="Küçük (128x128)" name="Small(128x128)"/>
-		<combo_box.item label="Orta (256x256)" name="Medium(256x256)"/>
-		<combo_box.item label="Büyük (512x512)" name="Large(512x512)"/>
-		<combo_box.item label="Özel" name="Custom"/>
-	</combo_box>
-	<combo_box label="Çözünürlük" name="local_size_combo">
-		<combo_box.item label="Mevcut Pencere" name="CurrentWindow"/>
-		<combo_box.item label="320x240" name="320x240"/>
-		<combo_box.item label="640x480" name="640x480"/>
-		<combo_box.item label="800x600" name="800x600"/>
-		<combo_box.item label="1024x768" name="1024x768"/>
-		<combo_box.item label="1280x1024" name="1280x1024"/>
-		<combo_box.item label="1600x1200" name="1600x1200"/>
-		<combo_box.item label="Özel" name="Custom"/>
-	</combo_box>
-	<combo_box label="Format" name="local_format_combo">
-		<combo_box.item label="PNG" name="PNG"/>
-		<combo_box.item label="JPEG" name="JPEG"/>
-		<combo_box.item label="BMP" name="BMP"/>
-	</combo_box>
-	<spinner label="GeniÅŸlik" name="snapshot_width"/>
-	<spinner label="Yükseklik" name="snapshot_height"/>
-	<check_box label="Oranları Koru" name="keep_aspect_check"/>
-	<slider label="Görüntü kalitesi" name="image_quality_slider"/>
-	<text name="layer_type_label">
-		Yakala:
-	</text>
-	<combo_box label="Görüntü Katmanları" name="layer_types">
-		<combo_box.item label="Renkler" name="Colors"/>
-		<combo_box.item label="Derinlik" name="Depth"/>
-	</combo_box>
-	<check_box label="Arayüz" name="ui_check"/>
-	<check_box label="BÃœG&apos;ler" name="hud_check"/>
-	<check_box label="Kaydettikten sonra açık tut" name="keep_open_check"/>
-	<check_box label="Kare dondur (tam ekran)" name="freeze_frame_check"/>
-	<check_box label="Otomatik yenile" name="auto_snapshot_check"/>
+	<panel name="advanced_options_panel">
+		<text name="advanced_options_label">
+			GELİŞMİŞ SEÇENEKLER
+		</text>
+		<text name="layer_type_label">
+			Yakala:
+		</text>
+		<combo_box label="Görüntü Katmanları" name="layer_types">
+			<combo_box.item label="Renkler" name="Colors"/>
+			<combo_box.item label="Derinlik" name="Depth"/>
+		</combo_box>
+		<check_box label="Arayüz" name="ui_check"/>
+		<check_box label="BÃœG&apos;ler" name="hud_check"/>
+		<check_box label="Kare dondur (tam ekran)" name="freeze_frame_check"/>
+		<check_box label="Otomatik yenile" name="auto_snapshot_check"/>
+	</panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/tr/floater_test_layout_stacks.xml b/indra/newview/skins/default/xui/tr/floater_test_layout_stacks.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b479d5f6d6bbc342a4c4bb9a33199290356156d9
--- /dev/null
+++ b/indra/newview/skins/default/xui/tr/floater_test_layout_stacks.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Test Floater" title="LAYOUTSTACK TESTS"/>
diff --git a/indra/newview/skins/default/xui/tr/floater_test_text_vertical_aligment.xml b/indra/newview/skins/default/xui/tr/floater_test_text_vertical_aligment.xml
new file mode 100644
index 0000000000000000000000000000000000000000..fcb7d87287f2196460d32533789b674e4998404e
--- /dev/null
+++ b/indra/newview/skins/default/xui/tr/floater_test_text_vertical_aligment.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="Test Floater" title="TEST PENCERESÄ°"/>
diff --git a/indra/newview/skins/default/xui/tr/floater_tools.xml b/indra/newview/skins/default/xui/tr/floater_tools.xml
index cd5e6b7fac4912a79810f62a223922136d246377..b0c59ced42444b0af0a60f499909e84c49695f4a 100644
--- a/indra/newview/skins/default/xui/tr/floater_tools.xml
+++ b/indra/newview/skins/default/xui/tr/floater_tools.xml
@@ -1,5 +1,20 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="toolbox floater" short_title="İNŞA ET ARAÇLARI">
+	<floater.string name="grid_screen_text">
+		Ekran
+	</floater.string>
+	<floater.string name="grid_local_text">
+		Yerel
+	</floater.string>
+	<floater.string name="grid_world_text">
+		Dünya
+	</floater.string>
+	<floater.string name="grid_reference_text">
+		Referans
+	</floater.string>
+	<floater.string name="grid_attachment_text">
+		Aksesuar
+	</floater.string>
 	<floater.string name="status_rotate">
 		Nesneyi döndürmek için renkli bantları sürükleyin
 	</floater.string>
@@ -55,7 +70,7 @@
 		<radio_item label="Uzat (Ctrl+Shift)" name="radio stretch"/>
 		<radio_item label="Yüzü Seç" name="radio select face"/>
 	</radio_group>
-	<check_box label="Bağlantılı olanları düzenle" name="checkbox edit linked parts"/>
+	<check_box label="Bağlantılıları düzenle" name="checkbox edit linked parts"/>
 	<button label="BaÄŸla" name="link_btn"/>
 	<button label="Bağlantıyı Kopar" name="unlink_btn"/>
 	<text label="Her İki Tarafı Uzat" name="checkbox uniform label">
@@ -63,7 +78,12 @@
 	</text>
 	<check_box initial_value="true" label="Dokuları Uzat" name="checkbox stretch textures"/>
 	<check_box initial_value="true" label="Yasla" name="checkbox snap to grid"/>
-	<button label="Seçenekler..." name="Options..." tool_tip="İlave ağ seçeneklerine bak"/>
+	<combo_box name="combobox grid mode" tool_tip="Nesneyi konumlandırmak için ağ cetvelini seçin">
+		<combo_box.item label="Dünya" name="World"/>
+		<combo_box.item label="Yerel" name="Local"/>
+		<combo_box.item label="Referans" name="Reference"/>
+	</combo_box>
+	<button label="" name="Options..." tool_tip="İlave ağ seçeneklerine bak"/>
 	<button name="ToolCube" tool_tip="Küp"/>
 	<button name="ToolPrism" tool_tip="Prizma"/>
 	<button name="ToolPyramid" tool_tip="Piramit"/>
@@ -81,7 +101,7 @@
 	<button name="ToolGrass" tool_tip="Çimen"/>
 	<check_box label="Seçili Aracı tut" name="checkbox sticky"/>
 	<check_box label="Seçimi kopyala" name="checkbox copy selection"/>
-	<check_box initial_value="true" label="Kopyayı Merkeze Al" name="checkbox copy centers"/>
+	<check_box initial_value="true" label="Kopyayı Merkezle" name="checkbox copy centers"/>
 	<check_box label="Kopyayı Döndür" name="checkbox copy rotates"/>
 	<radio_group name="land_radio_group">
 		<radio_item label="Araziyi Seç" name="radio select land"/>
@@ -376,7 +396,7 @@
 			</combo_box>
 			<spinner label="Yerçekimi" name="Physics Gravity"/>
 			<spinner label="Sürtünme" name="Physics Friction"/>
-			<spinner label="100 kg/m^3 cinsinden yoÄŸunluk" name="Physics Density"/>
+			<spinner label="100 kg/m3 cinsinden yoÄŸunluk" name="Physics Density"/>
 			<spinner label="Restitüsyon" name="Physics Restitution"/>
 		</panel>
 		<panel label="Doku" name="Texture">
diff --git a/indra/newview/skins/default/xui/tr/floater_toybox.xml b/indra/newview/skins/default/xui/tr/floater_toybox.xml
index 05d3633df073095c7d22401f6e55293ecd215a62..e60e176643906795ee9138e8426d8b0ca5b18ac8 100644
--- a/indra/newview/skins/default/xui/tr/floater_toybox.xml
+++ b/indra/newview/skins/default/xui/tr/floater_toybox.xml
@@ -1,10 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Toybox" title="ARAÇ ÇUBUKLARINI ÖZELLEŞTİR">
+<floater name="Toybox" title="ARAÇ ÇUBUĞU DÜĞMELERİ">
 	<text name="toybox label 1">
 		Düğmeleri araç çubuklarına veya araç çubuklarından sürükleyerek ekleyin ya da kaldırın.
 	</text>
 	<text name="toybox label 2">
 		Her bir araç çubuğunun ayarına göre düğmeler gösterilir veya sadece simgeleri yer alır.
 	</text>
+	<button label="Tüm araç çubuklarını temizle" label_selected="Tüm araç çubuklarını temizle" name="btn_clear_all"/>
 	<button label="Varsayılanları geri yükle" label_selected="Varsayılanları geri yükle" name="btn_restore_defaults"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/tr/floater_translation_settings.xml b/indra/newview/skins/default/xui/tr/floater_translation_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..33ce76bd9a64e7e666fea31fba5ead400db0bb19
--- /dev/null
+++ b/indra/newview/skins/default/xui/tr/floater_translation_settings.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_translation_settings" title="SOHBET ÇEVİRİSİ AYARLARI">
+	<string name="bing_api_key_not_verified">
+		Bing uygulama kimliği doğrulanmadı. Lütfen tekrar deneyin.
+	</string>
+	<string name="google_api_key_not_verified">
+		Google API anahtarı doğrulanmadı. Lütfen tekrar deneyin.
+	</string>
+	<string name="bing_api_key_verified">
+		Bing uygulama kimliği doğrulandı.
+	</string>
+	<string name="google_api_key_verified">
+		Google API anahtarı doğrulandı.
+	</string>
+	<check_box label="Sohbet ederken makine çevirisini etkinleştirin" name="translate_chat_checkbox"/>
+	<text name="translate_language_label">
+		Sohbeti şu dile çevir:
+	</text>
+	<combo_box name="translate_language_combo">
+		<combo_box.item label="Sistem Varsayılanı" name="System Default Language"/>
+		<combo_box.item label="Ä°ngilizce" name="English"/>
+		<combo_box.item label="Dansk (Danca)" name="Danish"/>
+		<combo_box.item label="Deutsch (Almanca)" name="German"/>
+		<combo_box.item label="Español (İspanyolca)" name="Spanish"/>
+		<combo_box.item label="Français (Fransızca)" name="French"/>
+		<combo_box.item label="Italiano (Ä°talyanca)" name="Italian"/>
+		<combo_box.item label="Magyar (Macarca)" name="Hungarian"/>
+		<combo_box.item label="Nederlands (Flemenkçe)" name="Dutch"/>
+		<combo_box.item label="Polski (Lehçe)" name="Polish"/>
+		<combo_box.item label="Português (Portekizce)" name="Portugese"/>
+		<combo_box.item label="Русский (Rusça)" name="Russian"/>
+		<combo_box.item label="Türkçe (Türkçe)" name="Turkish"/>
+		<combo_box.item label="Українська (Ukraynaca)" name="Ukrainian"/>
+		<combo_box.item label="中文 (正體) (Çince)" name="Chinese"/>
+		<combo_box.item label="日本語 (Japonca)" name="Japanese"/>
+		<combo_box.item label="한국어 (Korece)" name="Korean"/>
+	</combo_box>
+	<text name="tip">
+		Çeviri hizmetini seçin:
+	</text>
+	<radio_group name="translation_service_rg">
+		<radio_item initial_value="bing" label="Bing Çevirmeni" name="bing"/>
+		<radio_item initial_value="google" label="Google Translate" name="google"/>
+	</radio_group>
+	<text name="bing_api_key_label">
+		Bing [http://www.bing.com/developers/createapp.aspx Uygulama KimliÄŸi]:
+	</text>
+	<button label="DoÄŸrula" name="verify_bing_api_key_btn"/>
+	<text name="google_api_key_label">
+		Google [http://code.google.com/apis/language/translate/v2/getting_started.html#auth API anahtarı]:
+	</text>
+	<button label="DoÄŸrula" name="verify_google_api_key_btn"/>
+	<text name="google_links_text">
+		[http://code.google.com/apis/language/translate/v2/pricing.html Fiyatlandırma] | [https://code.google.com/apis/console İstatistikler]
+	</text>
+	<button label="Tamam" name="ok_btn"/>
+	<button label="Ä°ptal" name="cancel_btn"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/tr/floater_voice_controls.xml b/indra/newview/skins/default/xui/tr/floater_voice_controls.xml
index dac05d83273113af286a2904e6ebb4614bcdc8ca..5ff0804f177ae5644b6844b4f2655621577b9f4e 100644
--- a/indra/newview/skins/default/xui/tr/floater_voice_controls.xml
+++ b/indra/newview/skins/default/xui/tr/floater_voice_controls.xml
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="floater_voice_controls" title="SES DENETÄ°MLERÄ°">
 	<string name="title_nearby">
-		Yakındaki ses
+		SES AYARLARI
 	</string>
 	<string name="title_group">
-		[GROUP] ile grup araması
+		[GROUP] Ä°LE GRUP ARAMASI
 	</string>
 	<string name="title_adhoc">
-		Konferans araması
+		KONFERANS ARAMASI
 	</string>
 	<string name="title_peer_2_peer">
-		[NAME] ile arama
+		[NAME] Ä°LE ARAMA
 	</string>
 	<string name="no_one_near">
 		Yakındaki kimsede ses etkin değil
diff --git a/indra/newview/skins/default/xui/tr/floater_voice_effect.xml b/indra/newview/skins/default/xui/tr/floater_voice_effect.xml
index a10da39a69ec04599e3dffbc3dc657e4524ddeba..3534a3fe906a58ac7f33f5b6ed8e0b96e44704fb 100644
--- a/indra/newview/skins/default/xui/tr/floater_voice_effect.xml
+++ b/indra/newview/skins/default/xui/tr/floater_voice_effect.xml
@@ -42,13 +42,16 @@
 	<string name="effect_Demon">
 		Ä°blis
 	</string>
+	<string name="effect_Female Elf">
+		DiÅŸi Cin
+	</string>
 	<string name="effect_Flirty">
 		Cilveli
 	</string>
 	<string name="effect_Foxy">
 		Alımlı
 	</string>
-	<string name="effect_Halloween_2010_Bonus">
+	<string name="effect_Halloween 2010 Bonus">
 		Halloween_2010_Bonus
 	</string>
 	<string name="effect_Helium">
@@ -57,9 +60,18 @@
 	<string name="effect_Husky">
 		Güçlü
 	</string>
+	<string name="effect_Husky Whisper">
+		Boğuk Fısıltı
+	</string>
 	<string name="effect_Intercom">
 		Ä°nterkom
 	</string>
+	<string name="effect_Julia">
+		Julia
+	</string>
+	<string name="effect_Lo Lilt">
+		Yavaş Mırıltı
+	</string>
 	<string name="effect_Macho">
 		Maço
 	</string>
@@ -69,6 +81,9 @@
 	<string name="effect_Mini">
 		Mini
 	</string>
+	<string name="effect_Model">
+		Model
+	</string>
 	<string name="effect_Nano">
 		Nano
 	</string>
@@ -90,6 +105,9 @@
 	<string name="effect_Roxanne">
 		Roxanne
 	</string>
+	<string name="effect_Rumble">
+		Gurultu
+	</string>
 	<string name="effect_Sabrina">
 		Sabrina
 	</string>
@@ -102,6 +120,9 @@
 	<string name="effect_Shorty">
 		Bücür
 	</string>
+	<string name="effect_Smaller">
+		Daha Küçük
+	</string>
 	<string name="effect_Sneaky">
 		Sinsi
 	</string>
diff --git a/indra/newview/skins/default/xui/tr/menu_inspect_object_gear.xml b/indra/newview/skins/default/xui/tr/menu_inspect_object_gear.xml
index 02e541559801592ce494893bbb91792ca6f6549b..d1d3f9ac8dd8b512ccf8015195d814c8502728ee 100644
--- a/indra/newview/skins/default/xui/tr/menu_inspect_object_gear.xml
+++ b/indra/newview/skins/default/xui/tr/menu_inspect_object_gear.xml
@@ -12,6 +12,7 @@
 	<menu_item_call label="Ekle" name="add"/>
 	<menu_item_call label="Raporla" name="report"/>
 	<menu_item_call label="Engelle" name="block"/>
+	<menu_item_call label="Engellemeyi Kaldır" name="unblock"/>
 	<menu_item_call label="Yakınlaştır" name="zoom_in"/>
 	<menu_item_call label="Kaldır" name="remove"/>
 	<menu_item_call label="Ek Bilgi" name="more_info"/>
diff --git a/indra/newview/skins/default/xui/tr/menu_inventory.xml b/indra/newview/skins/default/xui/tr/menu_inventory.xml
index f14066fd7b51244acef4daaa36bf6c5d19bac155..170cdebd24ca5e23a34bb8508253a950ac3f07f6 100644
--- a/indra/newview/skins/default/xui/tr/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/tr/menu_inventory.xml
@@ -59,6 +59,7 @@
 	<menu_item_call label="Özellikler" name="Properties"/>
 	<menu_item_call label="Yeniden Adlandır" name="Rename"/>
 	<menu_item_call label="Varlık UUID&apos;sini Kopyala" name="Copy Asset UUID"/>
+	<menu_item_call label="Kes" name="Cut"/>
 	<menu_item_call label="Kopyala" name="Copy"/>
 	<menu_item_call label="Yapıştır" name="Paste"/>
 	<menu_item_call label="Bağlantı Olarak Yapıştır" name="Paste As Link"/>
@@ -84,6 +85,6 @@
 	<menu_item_call label="Ekle" name="Wearable Add"/>
 	<menu_item_call label="Çıkar" name="Take Off"/>
 	<menu_item_call label="Satıcı Giden Kutusuna Kopyala" name="Merchant Copy"/>
-	<menu_item_call label="Satıcı Giden Kutusuna Taşı" name="Merchant Move"/>
+	<menu_item_call label="Pazaryerine Gönder" name="Marketplace Send"/>
 	<menu_item_call label="--seçenek yok--" name="--no options--"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/tr/menu_login.xml b/indra/newview/skins/default/xui/tr/menu_login.xml
index 4c3539b38b87181f5fe9db17db60ffb4942edd7f..f27908bf7ae2071d39ca5695df940fc9a56bf01d 100644
--- a/indra/newview/skins/default/xui/tr/menu_login.xml
+++ b/indra/newview/skins/default/xui/tr/menu_login.xml
@@ -17,8 +17,8 @@
 		<menu_item_call label="Pencere Büyüklüğünü Ayarla..." name="Set Window Size..."/>
 		<menu_item_call label="Hizmet Şartlarını Göster" name="TOS"/>
 		<menu_item_call label="Kritik İletiyi Göster" name="Critical"/>
-		<menu_item_call label="Ortam Tarayıcı Testi" name="Web Browser Test"/>
 		<menu_item_call label="Web İçeriği Gezdiricisi Hata Ayıklama Testi" name="Web Content Floater Debug Test"/>
+		<menu label="Günlük Tutma Seviyesini Seç" name="Set Logging Level"/>
 		<menu_item_check label="Izgara Seçiciyi Göster" name="Show Grid Picker"/>
 		<menu_item_call label="Bildirimler Konsolunu Göster" name="Show Notifications Console"/>
 	</menu>
diff --git a/indra/newview/skins/default/xui/tr/menu_toolbars.xml b/indra/newview/skins/default/xui/tr/menu_toolbars.xml
index 7cb3192ec49764292867e4e879f51b6f027fce8d..c8523a6ec948f903ddaf5f48fb277b4847c58cee 100644
--- a/indra/newview/skins/default/xui/tr/menu_toolbars.xml
+++ b/indra/newview/skins/default/xui/tr/menu_toolbars.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Toolbars Popup">
-	<menu_item_call label="Düğmeleri seç..." name="Chose Buttons"/>
+	<menu_item_call label="Bu düğmeyi kaldır" name="Remove button"/>
+	<menu_item_call label="Araç çubuğu düğmeleri..." name="Choose Buttons"/>
 	<menu_item_check label="Simgeler ve etiketler" name="icons_with_text"/>
 	<menu_item_check label="Sadece simgeler" name="icons_only"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/tr/menu_viewer.xml b/indra/newview/skins/default/xui/tr/menu_viewer.xml
index efeed833a56264c641544b0402b4cfa8dd3fab44..d7b20bac4b4ef248562ad776de00ad683fdcbca8 100644
--- a/indra/newview/skins/default/xui/tr/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/tr/menu_viewer.xml
@@ -1,53 +1,58 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu_bar name="Main Menu">
 	<menu label="Ben" name="Me">
-		<menu_item_call label="Kontrol Paneli..." name="Manage My Account"/>
 		<menu_item_call label="Profil..." name="Profile"/>
 		<menu_item_call label="Görünüm..." name="ChangeOutfit"/>
+		<menu_item_call label="Bir avatar seçin..." name="Avatar Picker"/>
 		<menu_item_check label="Envanter..." name="Inventory"/>
-		<menu_item_check label="Mimikler..." name="Gestures"/>
-		<menu_item_check label="Ses..." name="ShowVoice"/>
+		<menu_item_call label="Yeni Envanter Penceresi" name="NewInventoryWindow"/>
+		<menu_item_call label="Yerler..." name="Places"/>
+		<menu_item_call label="Favoriler..." name="Picks"/>
+		<menu_item_call label="Kamera Denetimleri..." name="Camera Controls"/>
 		<menu label="Hareket" name="Movement">
 			<menu_item_call label="Otur" name="Sit Down Here"/>
 			<menu_item_check label="Uç" name="Fly"/>
 			<menu_item_check label="Daima KoÅŸ" name="Always Run"/>
 			<menu_item_call label="Beni Anime Etmeyi Durdur" name="Stop Animating My Avatar"/>
+			<menu_item_call label="Yürü / koş / uç..." name="Walk / run / fly"/>
 		</menu>
 		<menu label="Durum" name="Status">
 			<menu_item_call label="Uzakta" name="Set Away"/>
 			<menu_item_call label="MeÅŸgul" name="Set Busy"/>
 		</menu>
-		<menu_item_call label="Yönetici Durumu Talep Et" name="Request Admin Options"/>
-		<menu_item_call label="Yönetici Durumundan Ayrıl" name="Leave Admin Options"/>
-		<menu_item_call label="L$ Satın Al" name="Buy and Sell L$"/>
+		<menu_item_call label="L$ Satın Al..." name="Buy and Sell L$"/>
+		<menu_item_call label="Satıcı Giden Kutusu..." name="MerchantOutbox"/>
+		<menu_item_call label="Hesap kontrol paneli..." name="Manage My Account"/>
 		<menu_item_call label="Tercihler..." name="Preferences"/>
-		<menu_item_call label="Araç çubukları..." name="Toolbars"/>
+		<menu_item_call label="Araç çubuğu düğmeleri..." name="Toolbars"/>
 		<menu_item_call label="Tüm denetimleri sakla" name="Hide UI"/>
 		<menu_item_call label="[APP_NAME]&apos;den Çık" name="Quit"/>
 	</menu>
 	<menu label="Ä°letiÅŸim Kur" name="Communicate">
-		<menu_item_call label="Arkadaşlarım" name="My Friends"/>
-		<menu_item_call label="Gruplarım" name="My Groups"/>
-		<menu_item_check label="Yakındaki Sohbet" name="Nearby Chat"/>
-		<menu_item_call label="Yakındaki Kişiler" name="Active Speakers"/>
-		<menu_item_check label="Yakındaki Ses" name="Nearby Voice"/>
+		<menu_item_check label="Sohbet..." name="Nearby Chat"/>
+		<menu_item_check label="KonuÅŸ" name="Speak"/>
+		<menu_item_check label="Ses ayarları..." name="Nearby Voice"/>
+		<menu_item_check label="Ses ÅŸekillendirme..." name="ShowVoice"/>
+		<menu_item_check label="Mimikler..." name="Gestures"/>
+		<menu_item_call label="ArkadaÅŸlar" name="My Friends"/>
+		<menu_item_call label="Gruplar" name="My Groups"/>
+		<menu_item_call label="Yakındaki kişiler" name="Active Speakers"/>
 	</menu>
 	<menu label="Dünya" name="World">
+		<menu_item_call label="Bu Yeri Yer Ä°mlerine Ekle" name="Create Landmark Here"/>
+		<menu_item_call label="Hedef Konumlar..." name="Destinations"/>
+		<menu_item_check label="Dünya haritası" name="World Map"/>
 		<menu_item_check label="Mini-harita" name="Mini-Map"/>
-		<menu_item_check label="Dünya Haritası" name="World Map"/>
 		<menu_item_check label="Ara" name="Search"/>
+		<menu_item_call label="Ana konuma ışınlan" name="Teleport Home"/>
+		<menu_item_call label="Ana konumu burası olarak seç" name="Set Home to Here"/>
 		<menu_item_call label="Anlık Görüntü" name="Take Snapshot"/>
-		<menu_item_call label="Bu Yeri Yer Ä°mlerine Ekle" name="Create Landmark Here"/>
-		<menu label="Profili YerleÅŸtir" name="Land">
-			<menu_item_call label="Profili YerleÅŸtir" name="Place Profile"/>
-			<menu_item_call label="Arazi Hakkında" name="About Land"/>
-			<menu_item_call label="Bölge/Gayrimenkul" name="Region/Estate"/>
-		</menu>
-		<menu_item_call label="Bu Araziyi Satın Al" name="Buy Land"/>
-		<menu_item_call label="Arazim" name="My Land"/>
+		<menu_item_call label="Profili yerleÅŸtir" name="Place Profile"/>
+		<menu_item_call label="Arazi hakkında" name="About Land"/>
+		<menu_item_call label="Bölge / Gayrimenkul" name="Region/Estate"/>
+		<menu_item_call label="Sahip olduğum arazi parçaları..." name="My Land"/>
+		<menu_item_call label="Bu araziyi satın al" name="Buy Land"/>
 		<menu label="Göster" name="LandShow">
-			<menu_item_check label="Denetimleri Hareket Ettir" name="Movement Controls"/>
-			<menu_item_check label="Denetimleri Göster" name="Camera Controls"/>
 			<menu_item_check label="Yasaklama Çizgileri" name="Ban Lines"/>
 			<menu_item_check label="Ä°ÅŸaretler" name="beacons"/>
 			<menu_item_check label="Mülkiyet Çizgileri" name="Property Lines"/>
@@ -56,16 +61,15 @@
 			<menu_item_check label="Parsel Özellikleri" name="Parcel Properties"/>
 			<menu_item_check label="Gelişmiş Menü" name="Show Advanced Menu"/>
 		</menu>
-		<menu_item_call label="Ana Konuma Işınla" name="Teleport Home"/>
-		<menu_item_call label="Ana Konumu Burası Olarak Seç" name="Set Home to Here"/>
-		<menu label="Güneş" name="Environment Settings">
+		<menu label="Güneş" name="Sun">
 			<menu_item_call label="Gün Doğumu" name="Sunrise"/>
 			<menu_item_call label="Gün Ortası" name="Noon"/>
 			<menu_item_call label="Gün Batımı" name="Sunset"/>
 			<menu_item_call label="Gece Yarısı" name="Midnight"/>
+			<menu_item_call label="Bölge Ayarlarını Kullan" name="Use Region Settings"/>
 		</menu>
-		<menu label="Ortam Düzenleyici" name="Enviroment Editor">
-			<menu_item_call label="Ortam Ayarları..." name="Enviroment Settings"/>
+		<menu label="Ortam Düzenleyici" name="Environment Editor">
+			<menu_item_call label="Ortam Ayarları..." name="Environment Settings"/>
 			<menu label="Su Ön Ayarları" name="Water Presets">
 				<menu_item_call label="Yeni ön ayar..." name="new_water_preset"/>
 				<menu_item_call label="Ön ayarı düzenle..." name="edit_water_preset"/>
@@ -93,7 +97,7 @@
 			<menu_item_call label="Arazi Aracı" name="Land"/>
 		</menu>
 		<menu_item_call label="BaÄŸla" name="Link"/>
-		<menu_item_call label="Bağlantıyı Kopar" name="Unlink"/>
+		<menu_item_call label="BaÄŸlnty. Kopar" name="Unlink"/>
 		<menu_item_check label="Bağlantılı Parçaları Düzenle" name="Edit Linked Parts"/>
 		<menu label="Bağlantılı Parçaları Seç" name="Select Linked Parts">
 			<menu_item_call label="Sonraki Parçayı Seç" name="Select Next Part"/>
@@ -118,7 +122,7 @@
 			<menu_item_call label="Komut Dosyalarını Çalışıyor Olarak Ayarla" name="Set Scripts to Running"/>
 			<menu_item_call label="Komut Dosyalarını Çalışmıyor Olarak Ayarla" name="Set Scripts to Not Running"/>
 		</menu>
-		<menu label="Seçenekler" name="Options">
+		<menu label="Seçenklr." name="Options">
 			<menu_item_check label="Gelişmiş İzinleri Göster" name="DebugPermissions"/>
 			<menu_item_check label="Sadece Nesnelerimi Seç" name="Select Only My Objects"/>
 			<menu_item_check label="Sadece Hareket Ettirilebilir Nesneleri Seç" name="Select Only Movable Objects"/>
@@ -144,6 +148,7 @@
 		<menu_item_call label="Yinele" name="Redo"/>
 	</menu>
 	<menu label="Yardım" name="Help">
+		<menu_item_call label="Nasıl yapılır..." name="How To"/>
 		<menu_item_call label="[SECOND_LIFE] Yardımı" name="Second Life Help"/>
 		<menu_item_call label="Kötüye Kullanımı Bildir" name="Report Abuse"/>
 		<menu_item_call label="Hata Bildir" name="Report Bug"/>
@@ -171,22 +176,22 @@
 			<menu_item_check label="Fare Üzerinden Görünüm Artı İşaretini Göster" name="ShowCrosshairs"/>
 		</menu>
 		<menu label="İşleme Türleri" name="Rendering Types">
-			<menu_item_check label="Basit" name="Simple"/>
-			<menu_item_check label="Alfa" name="Alpha"/>
-			<menu_item_check label="Ağaç" name="Tree"/>
-			<menu_item_check label="Avatarlar" name="Character"/>
-			<menu_item_check label="Yüzey Yaması" name="Surface Patch"/>
-			<menu_item_check label="Gökyüzü" name="Sky"/>
-			<menu_item_check label="Su" name="Water"/>
-			<menu_item_check label="Toprak" name="Ground"/>
-			<menu_item_check label="Hacim" name="Volume"/>
-			<menu_item_check label="Çimen" name="Grass"/>
-			<menu_item_check label="Bulutlar" name="Clouds"/>
-			<menu_item_check label="Parçacıklar" name="Particles"/>
-			<menu_item_check label="Tümsek" name="Bump"/>
+			<menu_item_check label="Basit" name="Rendering Type Simple"/>
+			<menu_item_check label="Alfa" name="Rendering Type Alpha"/>
+			<menu_item_check label="Ağaç" name="Rendering Type Tree"/>
+			<menu_item_check label="Avatarlar" name="Rendering Type Character"/>
+			<menu_item_check label="Yüzey Yaması" name="Rendering Type Surface Patch"/>
+			<menu_item_check label="Gökyüzü" name="Rendering Type Sky"/>
+			<menu_item_check label="Su" name="Rendering Type Water"/>
+			<menu_item_check label="Toprak" name="Rendering Type Ground"/>
+			<menu_item_check label="Hacim" name="Rendering Type Volume"/>
+			<menu_item_check label="Çimen" name="Rendering Type Grass"/>
+			<menu_item_check label="Bulutlar" name="Rendering Type Clouds"/>
+			<menu_item_check label="Parçacıklar" name="Rendering Type Particles"/>
+			<menu_item_check label="Tümsek" name="Rendering Type Bump"/>
 		</menu>
 		<menu label="İşleme Özellikleri" name="Rendering Features">
-			<menu_item_check label="KA" name="UI"/>
+			<menu_item_check label="KA" name="ToggleUI"/>
 			<menu_item_check label="Seçili" name="Selected"/>
 			<menu_item_check label="Vurgulanmış" name="Highlighted"/>
 			<menu_item_check label="Dinamik Dokular" name="Dynamic Textures"/>
@@ -198,11 +203,8 @@
 		<menu_item_check label="İş Parçacığı Okuma Eklentisini Kullan" name="Use Plugin Read Thread"/>
 		<menu_item_call label="Grup Ön Belleğini Temizle" name="ClearGroupCache"/>
 		<menu_item_check label="Fare Düzleştirme" name="Mouse Smoothing"/>
+		<menu_item_call label="Bırakma Anahtarları" name="Release Keys"/>
 		<menu label="Kısa Yollar" name="Shortcuts">
-			<menu_item_call label="Görüntü (L$[COST])..." name="Upload Image"/>
-			<menu_item_check label="Ara" name="Search"/>
-			<menu_item_call label="Bırakma Anahtarları" name="Release Keys"/>
-			<menu_item_call label="KA Büyüklüğünü Varsayılana Ayarla" name="Set UI Size to Default"/>
 			<menu_item_check label="Gelişmiş Menüyü Göster - eski kısayol" name="Show Advanced Menu - legacy shortcut"/>
 			<menu_item_call label="Pencereyi Kapat" name="Close Window"/>
 			<menu_item_call label="Tüm Pencereleri Kapat" name="Close All Windows"/>
@@ -211,13 +213,6 @@
 			<menu_item_check label="Oyun Çubuğu Flycam" name="Joystick Flycam"/>
 			<menu_item_call label="Görünümü Sıfırla" name="Reset View"/>
 			<menu_item_call label="Son Sohbet Edene Bak" name="Look at Last Chatter"/>
-			<menu label="İnşa Et Aracını Seç" name="Select Tool">
-				<menu_item_call label="Odaklanma Aracı" name="Focus"/>
-				<menu_item_call label="Hareket Ettirme Aracı" name="Move"/>
-				<menu_item_call label="Düzenleme Aracı" name="Edit"/>
-				<menu_item_call label="Oluşturma Aracı" name="Create"/>
-				<menu_item_call label="Arazi Aracı" name="Land"/>
-			</menu>
 			<menu_item_call label="Yakınlaştır" name="Zoom In"/>
 			<menu_item_call label="Varsayılan Yakınlaştırma" name="Zoom Default"/>
 			<menu_item_call label="Uzaklaştırma" name="Zoom Out"/>
@@ -288,7 +283,9 @@
 			<menu_item_check label="Işıklar" name="Lights"/>
 			<menu_item_check label="Çarpışma İskeleti" name="Collision Skeleton"/>
 			<menu_item_check label="Işın Yayını" name="Raycast"/>
+			<menu_item_check label="Rüzgar Vektörleri" name="Wind Vectors"/>
 			<menu_item_check label="İşleme Karmaşıklığı" name="rendercomplexity"/>
+			<menu_item_check label="Aksesuar Bayt Büyüklüğü" name="attachment bytes"/>
 			<menu_item_check label="Åžekillendir" name="Sculpt"/>
 		</menu>
 		<menu label="Ä°ÅŸleme" name="Rendering">
@@ -300,7 +297,6 @@
 			<menu_item_check label="Işıklandırma ve Gölgeler" name="Lighting and Shadows"/>
 			<menu_item_check label="Güneş/Ay/Projektörlerden Gelen Gölgeler" name="Shadows from Sun/Moon/Projectors"/>
 			<menu_item_check label="SSAO ve Gölge Yumuşatma" name="SSAO and Shadow Smoothing"/>
-			<menu_item_check label="Küresel Aydınlatma (Deneysel)" name="Global Illumination"/>
 			<menu_item_check label="GL Hata Ayıklama" name="Debug GL"/>
 			<menu_item_check label="Ardışık Hata Ayıklama" name="Debug Pipeline"/>
 			<menu_item_check label="Otomatik Alfa Maskeleri (ertelenmiÅŸ)" name="Automatic Alpha Masks (deferred)"/>
@@ -331,9 +327,8 @@
 			<menu_item_call label="Kaydı Başlat" name="Start Record"/>
 			<menu_item_call label="Kaydı Durdur" name="Stop Record"/>
 		</menu>
-		<menu label="Dünya" name="World">
+		<menu label="Dünya" name="DevelopWorld">
 			<menu_item_check label="Sim Güneşi Geçersiz Kıl" name="Sim Sun Override"/>
-			<menu_item_check label="Yanıp Sönen İşaret" name="Cheesy Beacon"/>
 			<menu_item_check label="Sabit Hava Durumu" name="Fixed Weather"/>
 			<menu_item_call label="Bölge Nesne Önbelleğinin Dökümünü Al" name="Dump Region Object Cache"/>
 		</menu>
@@ -365,11 +360,11 @@
 		</menu>
 		<menu label="Avatar" name="Character">
 			<menu label="KaydedilmiÅŸ Dokuyu Al" name="Grab Baked Texture">
-				<menu_item_call label="Ä°ris" name="Iris"/>
-				<menu_item_call label="BaÅŸ" name="Head"/>
-				<menu_item_call label="Üst Gövde" name="Upper Body"/>
-				<menu_item_call label="Alt Gövde" name="Lower Body"/>
-				<menu_item_call label="Etek" name="Skirt"/>
+				<menu_item_call label="Ä°ris" name="Grab Iris"/>
+				<menu_item_call label="BaÅŸ" name="Grab Head"/>
+				<menu_item_call label="Üst Gövde" name="Grab Upper Body"/>
+				<menu_item_call label="Alt Gövde" name="Grab Lower Body"/>
+				<menu_item_call label="Etek" name="Grab Skirt"/>
 			</menu>
 			<menu label="Karakter Testleri" name="Character Tests">
 				<menu_item_call label="XML&apos;de Görünüm" name="Appearance To XML"/>
@@ -397,17 +392,25 @@
 		<menu_item_check label="HTTP Dokuları" name="HTTP Textures"/>
 		<menu_item_check label="HTTP Envanteri" name="HTTP Inventory"/>
 		<menu_item_call label="Görüntüleri Sıkıştır" name="Compress Images"/>
+		<menu_item_call label="Visual Leak Detector&apos;ı Etkinleştir" name="Enable Visual Leak Detector"/>
 		<menu_item_check label="Mini Döküm Dosyası Hata Ayıklama Çıktısı" name="Output Debug Minidump"/>
 		<menu_item_check label="Sonraki Çalışmada Konsol Penceresi" name="Console Window"/>
+		<menu label="Günlük Tutma Seviyesini Seç" name="Set Logging Level">
+			<menu_item_check label="Hata ayıkla" name="Debug"/>
+			<menu_item_check label="Bilgi" name="Info"/>
+			<menu_item_check label="Uyarı" name="Warning"/>
+			<menu_item_check label="Hata" name="Error"/>
+			<menu_item_check label="Hiçbiri" name="None"/>
+		</menu>
 		<menu_item_call label="Yönetici Durumu Talep Et" name="Request Admin Options"/>
 		<menu_item_call label="Yönetici Durumundan Ayrıl" name="Leave Admin Options"/>
 		<menu_item_check label="Yönetici Menüsünü Göster" name="View Admin Options"/>
 	</menu>
 	<menu label="Yönetici" name="Admin">
-		<menu label="Object">
-			<menu_item_call label="Kopya Al" name="Take Copy"/>
-			<menu_item_call label="Mülkiyetime Geçir" name="Force Owner To Me"/>
-			<menu_item_call label="İzinlerle Birlikte Mülkiyetime Geçir" name="Force Owner Permissive"/>
+		<menu label="Nesne" name="AdminObject">
+			<menu_item_call label="Kopya Al" name="Admin Take Copy"/>
+			<menu_item_call label="Zorunlu Olarak Mülkiyetime Geçir" name="Force Owner To Me"/>
+			<menu_item_call label="Sahibin İzinlerini Zorunlu Kıl" name="Force Owner Permissive"/>
 			<menu_item_call label="Sil" name="Delete"/>
 			<menu_item_call label="Kilitle" name="Lock"/>
 			<menu_item_call label="Varlık Kimliklerini Al" name="Get Assets IDs"/>
@@ -441,7 +444,7 @@
 			<menu_item_call label="Fizik" name="Physics"/>
 			<menu_item_call label="Tüm Giysiler" name="All Clothes"/>
 		</menu>
-		<menu label="Yardım" name="Help">
+		<menu label="Yardım" name="DeprecatedHelp">
 			<menu_item_call label="Resmi Linden Blog&apos;u" name="Official Linden Blog"/>
 			<menu_item_call label="Komut Dosyası Portalı" name="Scripting Portal"/>
 			<menu label="Hata Raporlama" name="Bug Reporting">
diff --git a/indra/newview/skins/default/xui/tr/notifications.xml b/indra/newview/skins/default/xui/tr/notifications.xml
index a268c103a6e366a9f018037f9648aeb16efbafe3..6681cdac7affacb6b216590ff983ae55b8b78b5f 100644
--- a/indra/newview/skins/default/xui/tr/notifications.xml
+++ b/indra/newview/skins/default/xui/tr/notifications.xml
@@ -86,17 +86,38 @@ Hata ayrıntıları: &apos;[_NAME]&apos; adlı bildirim notifications.xml içind
 		<usetemplate canceltext="Ä°ptal" name="yesnocancelbuttons" notext="Kaydetme" yestext="Kaydet"/>
 	</notification>
 	<notification name="ConfirmNoCopyToOutbox">
-		Bu öğeyi Pazaryeri Giden Kutunuza kopyalama izniniz yok. Aşağıdaki öğeyi taşımak istediğinize emin misiniz?
-        [ITEM_NAME]
-		<usetemplate name="okcancelbuttons" notext="Hayır" yestext="Evet"/>
+		Bu öğelerden bir veya daha fazlasını Satıcı Giden Kutusuna kopyalama izniniz yok.  Bunları taşıyabilir veya bırakabilirsiniz.
+		<usetemplate name="okcancelbuttons" notext="Öğeleri taşıma" yestext="Öğeleri taşı"/>
+	</notification>
+	<notification name="OutboxFolderCreated">
+		Satıcı Giden Kutunuzun üst seviyesine aktardığınız her bir öğe için yeni bir klasör oluşturuldu.
+		<usetemplate ignoretext="Satıcı Giden Kutusunda yeni bir klasör oluşturuldu" name="okignore" yestext="Tamam"/>
 	</notification>
-	<notification name="OutboxUploadComplete">
-		Pazaryerinin karşıya yüklenmesi tamamlandı.
-		<usetemplate name="okbutton" yestext="Yaşasın!"/>
+	<notification name="OutboxImportComplete">
+		Başarılı oldu
+
+Tüm klasörler başarıyla Pazaryerine gönderildi.
+		<usetemplate ignoretext="Tüm klasörler Pazaryerine gönderildi" name="okignore" yestext="Tamam"/>
 	</notification>
-	<notification name="OutboxUploadHadErrors">
-		Pazaryerinin karşıya yüklenmesi hatalarla tamamlandı!  Lütfen giden kutunuzdaki sorunları düzeltin ve tekrar deneyin.  Teşekkürler.
-		<usetemplate name="okbutton" yestext="Yuh!"/>
+	<notification name="OutboxImportHadErrors">
+		Bazı klasörler aktarılmadı
+
+Bazı klasörler Pazaryerine gönderildiğinde hatalar meydana geldi.  Bu klasörler hala Satıcı Giden Kutunuzda.
+
+Daha fazla bilgi için bkz. [[MARKETPLACE_IMPORTS_URL] hata günlüğü].
+		<usetemplate name="okbutton" yestext="Tamam"/>
+	</notification>
+	<notification name="OutboxImportFailed">
+		Aktarım başarılamadı
+
+Bir sistem veya ağ hatası nedeniyle Pazaryerine hiçbir klasör gönderilemedi.  Daha sonra tekrar deneyin.
+		<usetemplate name="okbutton" yestext="Tamam"/>
+	</notification>
+	<notification name="OutboxInitFailed">
+		Pazaryeri başlatılamadı.
+
+Bir sistem veya ağ hatası nedeniyle Pazaryeri başlatılamadı.  Daha sonra tekrar deneyin.
+		<usetemplate name="okbutton" yestext="Tamam"/>
 	</notification>
 	<notification name="CompileQueueSaveText">
 		Aşağıdaki nedenden dolayı, bir komut dosyası için metin karşıya yüklenirken bir sorun oluştu: [REASON]. Lütfen daha sonra tekrar deneyin.
@@ -649,7 +670,7 @@ Beklenen [VALIDS]
 		Çıkış dosyası oluşturulamıyor: [FILE]
 	</notification>
 	<notification name="DoNotSupportBulkAnimationUpload">
-		[APP_NAME] şu an için animasyon dosyalarının toplu olarak karşıya yüklenmesini desteklemiyor.
+		[APP_NAME] şu an için BVH formatında animasyon dosyalarının toplu olarak yüklenmesini desteklemiyor.
 	</notification>
 	<notification name="CannotUploadReason">
 		Aşağıdaki nedenden dolayı [FILE] dosyası karşıya yüklenemedi: [REASON]
@@ -979,7 +1000,7 @@ Etkin grubunuz adına arazi satın almak için gerekli izne sahip değilsiniz.
 		</form>
 	</notification>
 	<notification name="RemoveFromFriends">
-		[NAME] adlı kişiyi Arkadaş Listenizden çıkarmak istiyor musunuz?
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; adlı kişiyi Arkadaş Listenizden çıkarmak istiyor musunuz?
 		<usetemplate name="okcancelbuttons" notext="Ä°ptal" yestext="Tamam"/>
 	</notification>
 	<notification name="RemoveMultipleFromFriends">
@@ -1110,8 +1131,13 @@ Arazinin satış bedeli sahibine geri ödenmez. Devredilen bir parsel satılırs
 	<notification name="DisplaySetToSafe">
 		Güvenli seçeneği seçtiğiniz için görüntüleme ayarları güvenli düzeye ayarlandı.
 	</notification>
-	<notification name="DisplaySetToRecommended">
-		Görüntüleme ayarları sistem yapılandırmanız için önerilen düzeye ayarlandı.
+	<notification name="DisplaySetToRecommendedGPUChange">
+		Grafik kartınız değiştiği için görüntü ayarları tavsiye edilen seviyelere ayarlandı
+önceki: &apos;[LAST_GPU]&apos;
+sonraki: &apos;[THIS_GPU]&apos;
+	</notification>
+	<notification name="DisplaySetToRecommendedFeatureChange">
+		İşleme alt sistemindeki bir değişiklik nedeniyle görüntü ayarları tavsiye edilen seviyelere ayarlandı.
 	</notification>
 	<notification name="ErrorMessage">
 		[ERROR_MESSAGE]
@@ -1431,7 +1457,7 @@ Güncellemeyi kurmak için [APP_NAME] uygulamasını yeniden başlatmalısınız
 		<usetemplate ignoretext="Nesneleri sahiplerine iade etmeden önce doğrulama iste" name="okcancelignore" notext="İptal" yestext="Tamam"/>
 	</notification>
 	<notification name="GroupLeaveConfirmMember">
-		Şu anda [GROUP] grubunun bir üyesisiniz.
+		Şu anda &lt;nolink&gt;[GROUP]&lt;/nolink&gt; grubunun bir üyesisiniz.
 Gruptan ayrılmak istiyor musunuz?
 		<usetemplate name="okcancelbuttons" notext="Ä°ptal" yestext="Tamam"/>
 	</notification>
@@ -1910,7 +1936,13 @@ Envanter öğesi/öğeleri taşınsın mı?
 		<usetemplate ignoretext="Çıkmadan önce doğrulama iste" name="okcancelignore" notext="Çıkma" yestext="Çık"/>
 	</notification>
 	<notification name="ConfirmRestoreToybox">
-		Varsayılan düğmelerinizi ve araç çubuklarınızı geri yüklemek istediğinize emin misiniz? 
+		Bu eylem, varsayılan düğmelerinizi ve araç çubuklarınızı geri yükleyecek.
+
+Bu eylemi geri alamazsınız.
+		<usetemplate name="okcancelbuttons" notext="Ä°ptal" yestext="Tamam"/>
+	</notification>
+	<notification name="ConfirmClearAllToybox">
+		Bu eylem ile tüm düğmeler araç kutusuna döner ve araç çubuklarınız boş olur.
     
 Bu eylemi geri alamazsınız.
 		<usetemplate name="okcancelbuttons" notext="Ä°ptal" yestext="Tamam"/>
@@ -2119,10 +2151,10 @@ Bu adımda web tarayıcınızın başlatılacağına dikkat edin.
 		Konu: [SUBJECT], Ä°leti: [MESSAGE]
 	</notification>
 	<notification name="FriendOnline">
-		[NAME] Çevrimiçi
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; çevrimiçi
 	</notification>
 	<notification name="FriendOffline">
-		[NAME] Çevrimdışı
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; çevrimdışı
 	</notification>
 	<notification name="AddSelfFriend">
 		Çok iyi biri olduğunuza eminiz fakat kendinizi arkadaş olarak ekleyemezsiniz.
@@ -2236,14 +2268,16 @@ Lütfen tek bir nesne seçin.
 		Arama kartınız reddedildi.
 	</notification>
 	<notification name="TeleportToLandmark">
-		Ekranınızın sağ tarafındaki Yerler panelini açıp Yer İmleri sekmesini seçerek &apos;[NAME]&apos; gibi konumlara ışınlanabilirsiniz.
-Seçmek için herhangi bir yer iminin üzerini tıklatın ve ardından panelin en altındaki &apos;Işınla&apos; düğmesini tıklatın.
-(Yer iminin üzerini çift tıklatabilir veya sağ tıklayıp &apos;Işınla&apos;yı seçebilirsiniz.)
+		&apos;[NAME]&apos; gibi konumlara ışınlanmak için &quot;Yerler&quot; düğmesine tıklayın,
+    sonra açılan pencerede Yer İmleri sekmesini seçin. Herhangi bir
+    yer iminin üzerine tıklayarak bunu seçin ve ardından pencerenin en altındaki &apos;Işınla&apos; düğmesine tıklayın.
+    (Ayrıca yer imine çift tıklayabilir veya sağ tıklayarak
+    &apos;Işınla&apos; seçimini yapabilirsiniz.)
 	</notification>
 	<notification name="TeleportToPerson">
-		Ekranınızın sağ tarafındaki İnsanlar panelini açarak  &apos;[NAME]&apos; gibi Sakinler ile iletişim kurabilirsiniz.
-Sakini listeden seçin ve  panelin altındaki &apos;Aİ&quot; düğmesini tıklatın.
-(Listede adlarını çift tıklatarak veya sağ tıklatıp &quot;Aİ&quot;yi seçerek de bunu yapabilirsiniz.)
+		&apos;[NAME]&apos; gibi sakinlerle bağlantıya geçmek için &quot;Kişiler&quot; düğmesine tıklayın, açılan pencereden bir Sakin seçin ve sonra
+    pencerenin altında &apos;Anlık İleti&quot; üzerine tıklayın.
+    (Listede adlarına çift tıklayarak veya sağ tıklayıp &quot;Anlık İleti&quot;yi seçerek de bunu yapabilirsiniz.)
 	</notification>
 	<notification name="CantSelectLandFromMultipleRegions">
 		Sunucunun sınırları dışındaki arazi seçilemez.
@@ -2264,13 +2298,16 @@ Daha küçük bir arazi parçası seçmeyi deneyin.
 	<notification name="PaymentSent">
 		[MESSAGE]
 	</notification>
+	<notification name="PaymentFailure">
+		[MESSAGE]
+	</notification>
 	<notification name="EventNotification">
 		Etkinlik Bildirimi
 
 [NAME]
 [DATE]
 		<form name="form">
-			<button name="Details" text="Ayrıntılar"/>
+			<button name="Details" text="Ayrıntl"/>
 			<button name="Cancel" text="Ä°ptal"/>
 		</form>
 	</notification>
@@ -2518,10 +2555,10 @@ Lütfen biraz sonra tekrar deneyin.
 		</form>
 	</notification>
 	<notification name="FriendshipAccepted">
-		[NAME] arkadaşlık teklifinizi kabul etti.
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; arkadaşlık teklifinizi kabul etti.
 	</notification>
 	<notification name="FriendshipDeclined">
-		[NAME] arkadaşlık teklifinizi reddetti.
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; arkadaşlık teklifinizi reddetti.
 	</notification>
 	<notification name="FriendshipAcceptedByMe">
 		Arkadaşlık teklifi kabul edildi.
@@ -2593,16 +2630,16 @@ Talep kabul edilsin mi?
 		[NAME] adlı kişiye ait &apos;&lt;nolink&gt;[TITLE]&lt;/nolink&gt;&apos;
 [MESSAGE]
 		<form name="form">
-			<button name="Mute" text="Engelle"/>
-			<button name="Ignore" text="Yok say"/>
+			<button name="Client_Side_Mute" text="Engelle"/>
+			<button name="Client_Side_Ignore" text="Yok say"/>
 		</form>
 	</notification>
 	<notification name="ScriptDialogGroup">
 		[GROUPNAME] grubuna ait &apos;&lt;nolink&gt;[TITLE]&lt;/nolink&gt;&apos;
 [MESSAGE]
 		<form name="form">
-			<button name="Mute" text="Engelle"/>
-			<button name="Ignore" text="Yok say"/>
+			<button name="Client_Side_Mute" text="Engelle"/>
+			<button name="Client_Side_Ignore" text="Yok say"/>
 		</form>
 	</notification>
 	<notification name="BuyLindenDollarSuccess">
@@ -2797,6 +2834,18 @@ Ayrıntılar için günlük dosyasına bakın.
 
 Paylaşmanın yapılacağı Sakinler:
 
+[RESIDENTS]
+		<usetemplate name="okcancelbuttons" notext="Ä°ptal" yestext="Tamam"/>
+	</notification>
+	<notification name="ShareFolderConfirmation">
+		Bir defada sadece bir klasör paylaşılabilir.
+
+Aşağıdaki öğeleri paylaşmak istediğinize emin misiniz?
+
+&lt;nolink&gt;[ITEMS]&lt;/nolink&gt;
+
+Paylaşmanın yapılacağı Second Life Sakinleri:
+
 [RESIDENTS]
 		<usetemplate name="okcancelbuttons" notext="Ä°ptal" yestext="Tamam"/>
 	</notification>
diff --git a/indra/newview/skins/default/xui/tr/panel_edit_skin.xml b/indra/newview/skins/default/xui/tr/panel_edit_skin.xml
index 33fb787e0865f0e0d756a71209e351dd0f308cc6..fdf75100ed95585219d7ef806a8f552af11f024d 100644
--- a/indra/newview/skins/default/xui/tr/panel_edit_skin.xml
+++ b/indra/newview/skins/default/xui/tr/panel_edit_skin.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="edit_skin_panel">
 	<panel name="avatar_skin_color_panel">
-		<texture_picker label="Baş Dövmeleri" name="Head Tattoos" tool_tip="Bir resim seçmek için tıklayın"/>
-		<texture_picker label="Üst Gövde Dövmeleri" name="Upper Tattoos" tool_tip="Bir resim seçmek için tıklayın"/>
-		<texture_picker label="Alt Gövde Dövmeleri" name="Lower Tattoos" tool_tip="Bir resim seçmek için tıklayın"/>
+		<texture_picker label="Baş" name="Head" tool_tip="Bir resim seçmek için tıklayın"/>
+		<texture_picker label="Üst gövde" name="Upper Body" tool_tip="Bir resim seçmek için tıklayın"/>
+		<texture_picker label="Alt gövde" name="Lower Body" tool_tip="Bir resim seçmek için tıklayın"/>
 	</panel>
 	<panel name="accordion_panel">
 		<accordion name="wearable_accordion">
diff --git a/indra/newview/skins/default/xui/tr/panel_my_profile.xml b/indra/newview/skins/default/xui/tr/panel_my_profile.xml
deleted file mode 100644
index fc0b9b6e032c5ede884ea98d6dd715e61e73b690..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/tr/panel_my_profile.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Profil" name="panel_profile">
-	<string name="CaptionTextAcctInfo">
-		[ACCTTYPE]
-[PAYMENTINFO] [AGEVERIFICATION]
-	</string>
-	<string name="payment_update_link_url">
-		http://www.secondlife.com/account/billing.php?lang=en
-	</string>
-	<string name="partner_edit_link_url">
-		http://www.secondlife.com/account/partners.php?lang=en
-	</string>
-	<string name="my_account_link_url" value="http://secondlife.com/account"/>
-	<string name="no_partner_text" value="Hiçbiri"/>
-	<string name="no_group_text" value="Hiçbiri"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="scroll_content_panel">
-					<panel name="second_life_image_panel">
-						<text name="display_name_descr_text">
-							Kullanıcı adı
-						</text>
-						<text name="name_descr_text">
-							Görüntü Adı
-						</text>
-						<button label="Profil" name="see_profile_btn" tool_tip="Bu avatar profiline bak"/>
-					</panel>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/tr/panel_nearby_chat.xml b/indra/newview/skins/default/xui/tr/panel_nearby_chat.xml
index c405105e007570dacc5541ba2508f88db2bbb676..d238388b0eec421839e4df7d3353a182f7500f73 100644
--- a/indra/newview/skins/default/xui/tr/panel_nearby_chat.xml
+++ b/indra/newview/skins/default/xui/tr/panel_nearby_chat.xml
@@ -1,4 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="nearby_chat">
-	<check_box label="Sohbeti çevir" name="translate_chat_checkbox"/>
+	<layout_stack name="stack">
+		<layout_panel name="translate_chat_checkbox_lp">
+			<check_box label="Sohbeti çevir" name="translate_chat_checkbox"/>
+		</layout_panel>
+	</layout_stack>
 </panel>
diff --git a/indra/newview/skins/default/xui/tr/panel_notes.xml b/indra/newview/skins/default/xui/tr/panel_notes.xml
deleted file mode 100644
index ff5b60996abf5217aa4abe14a2eef90c4db9c03b..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/tr/panel_notes.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Notlar ve Gizlilik" name="panel_notes">
-	<layout_stack name="layout">
-		<layout_panel name="notes_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<text name="status_message" value="Özel notlarım:"/>
-					<text name="status_message2" value="Bu kiÅŸiye ÅŸu izinler verilsin:"/>
-					<check_box label="Çevrimiçi durumumu görme" name="status_check"/>
-					<check_box label="Beni haritada görme" name="map_check"/>
-					<check_box label="Nesnelerimi düzenleme, silme veya alma" name="objects_check"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-		<layout_panel name="notes_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="Arkadaş Ekle" name="add_friend" tool_tip="Sakine arkadaşlık öner"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="Aİ" name="im" tool_tip="Anlık ileti oturumu aç"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="Ara" name="call" tool_tip="Bu Sakini ara"/>
-				</layout_panel>
-				<layout_panel name="show_on_map_btn_lp">
-					<button label="Harita" name="show_on_map_btn" tool_tip="Sakini haritada göster"/>
-				</layout_panel>
-				<layout_panel name="teleport_btn_lp">
-					<button label="Işınla" name="teleport" tool_tip="Işınlama teklif et"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/tr/panel_people.xml b/indra/newview/skins/default/xui/tr/panel_people.xml
index 7d42e3ab7989ee9ca59ee41ab31d17ca9094df51..1a1e53bac20f28980a07a38a36feda5b0690bed1 100644
--- a/indra/newview/skins/default/xui/tr/panel_people.xml
+++ b/indra/newview/skins/default/xui/tr/panel_people.xml
@@ -24,7 +24,7 @@ Birlikte takılacak kişiler mi arıyorsunuz? [secondlife:///app/worldmap Dünya
 	<tab_container name="tabs">
 		<panel label="YAKIN" name="nearby_panel">
 			<panel label="bottom_panel" name="bottom_panel">
-				<menu_button name="nearby_view_sort_btn" tool_tip="Seçenekler"/>
+				<menu_button name="nearby_view_sort_btn" tool_tip="Seçenklr."/>
 				<button name="add_friend_btn" tool_tip="Seçilen Sakini arkadaş listene ekle"/>
 			</panel>
 		</panel>
@@ -49,14 +49,14 @@ Birlikte takılacak kişiler mi arıyorsunuz? [secondlife:///app/worldmap Dünya
 		</panel>
 		<panel label="GRUPLARIM" name="groups_panel">
 			<panel label="bottom_panel" name="bottom_panel">
-				<menu_button name="groups_viewsort_btn" tool_tip="Seçenekler"/>
+				<menu_button name="groups_viewsort_btn" tool_tip="Seçenklr."/>
 				<button name="plus_btn" tool_tip="Gruba katıl/yeni grup oluştur"/>
 				<button name="activate_btn" tool_tip="Seçilen grubu etkinleştir"/>
 			</panel>
 		</panel>
 		<panel label="SON" name="recent_panel">
 			<panel label="bottom_panel" name="bottom_panel">
-				<menu_button name="recent_viewsort_btn" tool_tip="Seçenekler"/>
+				<menu_button name="recent_viewsort_btn" tool_tip="Seçenklr."/>
 				<button name="add_friend_btn" tool_tip="Seçilen Sakini arkadaş listene ekle"/>
 			</panel>
 		</panel>
diff --git a/indra/newview/skins/default/xui/tr/panel_postcard_message.xml b/indra/newview/skins/default/xui/tr/panel_postcard_message.xml
new file mode 100644
index 0000000000000000000000000000000000000000..2361f4c1c3ef994e8d50fc81c42b8135928b6761
--- /dev/null
+++ b/indra/newview/skins/default/xui/tr/panel_postcard_message.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_postcard_message">
+	<text name="to_label">
+		Kime:
+	</text>
+	<text name="name_label">
+		Kimden:
+	</text>
+	<text name="subject_label">
+		Konu:
+	</text>
+	<line_editor label="Konunuzu buraya yazın." name="subject_form"/>
+	<text name="msg_label">
+		Ä°leti:
+	</text>
+	<text_editor name="msg_form">
+		İletinizi buraya yazın.
+	</text_editor>
+	<button label="Ä°ptal" name="cancel_btn"/>
+	<button label="Gönder" name="send_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/tr/panel_postcard_settings.xml b/indra/newview/skins/default/xui/tr/panel_postcard_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..bce0b21b9a609ca697e8ca0df1d30bd2854dcea3
--- /dev/null
+++ b/indra/newview/skins/default/xui/tr/panel_postcard_settings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_postcard_settings">
+	<combo_box label="Çözünürlük" name="postcard_size_combo">
+		<combo_box.item label="Mevcut Pencere" name="CurrentWindow"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="Özel" name="Custom"/>
+	</combo_box>
+	<layout_stack name="postcard_image_params_ls">
+		<layout_panel name="postcard_image_size_lp">
+			<spinner label="GeniÅŸlik" name="postcard_snapshot_width"/>
+			<spinner label="Yükseklik" name="postcard_snapshot_height"/>
+			<check_box label="Oranları koru" name="postcard_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="postcard_image_format_quality_lp">
+			<slider label="Görüntü kalitesi" name="image_quality_slider"/>
+			<text name="image_quality_level">
+				([QLVL])
+			</text>
+		</layout_panel>
+	</layout_stack>
+</panel>
diff --git a/indra/newview/skins/default/xui/tr/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/tr/panel_preferences_advanced.xml
index 787efa32f4c8a92bd55265c485358e51623eb86d..770cdc6efd4b2f66c4de8069cbfa0272aeb65530 100644
--- a/indra/newview/skins/default/xui/tr/panel_preferences_advanced.xml
+++ b/indra/newview/skins/default/xui/tr/panel_preferences_advanced.xml
@@ -6,11 +6,11 @@
 	<text name="Cache:">
 		Önbellek:
 	</text>
-	<spinner label="Önbellek büyüklüğü (64 - 9984 MB)" name="cachesizespinner"/>
+	<spinner label="Önbellek boyutu (64-9984 MB)" name="cachesizespinner"/>
 	<text name="text_box5">
 		MB
 	</text>
-	<button label="Önbelleği Temizle" label_selected="Önbelleği Temizle" name="clear_cache"/>
+	<button label="Önbelleği Sil" label_selected="Önbelleği Sil" name="clear_cache"/>
 	<text name="Cache location">
 		Önbellek konumu:
 	</text>
diff --git a/indra/newview/skins/default/xui/tr/panel_preferences_chat.xml b/indra/newview/skins/default/xui/tr/panel_preferences_chat.xml
index 9c9e960715cbdfc12079c4d1600b022e8fbc0894..9caf95a122da2229c732437de1473753482844d2 100644
--- a/indra/newview/skins/default/xui/tr/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/tr/panel_preferences_chat.xml
@@ -16,9 +16,9 @@
 		Aİ&apos;leri şurada göster:
 	</text>
 	<text name="requires_restart_label">
-		(yeniden baÅŸlatma gerektirir)
+		(tekrar baÅŸlatma gerekir)
 	</text>
-	<radio_group name="chat_window" tool_tip="Anlık İletilerinizi ayrı gezdiricilerde veya birden çok sekmeye sahip tek bir gezdiricide gösterin (Yeniden başlatma gerektirir)">
+	<radio_group name="chat_window" tool_tip="Anlık İletileri ayrı gezdiricilerde veya çoklu sekmelere sahip tek bir gezdiricide gösterin (tekrar başlatma gerekir)">
 		<radio_item label="Ayrı Pencereler" name="radio" value="0"/>
 		<radio_item label="Sekmeler" name="radio2" value="1"/>
 	</radio_group>
@@ -29,29 +29,5 @@
 	<check_box label="Aİ Sohbetleri" name="EnableIMChatPopups" tool_tip="Bir anlık ileti geldiğinde açılır pencereleri görmek için işaretle"/>
 	<spinner label="Yakındaki sohbet iletilerinin vurgulanma süresi:" name="nearby_toasts_lifetime"/>
 	<spinner label="Yakındaki sohbet iletilerinin sönme süresi:" name="nearby_toasts_fadingtime"/>
-	<text name="translate_chb_label">
-		Sohbet ederken makine çevirisi kullanılsın
-	</text>
-	<text name="translate_language_text">
-		Sohbeti şu dile çevir:
-	</text>
-	<combo_box name="translate_language_combobox">
-		<combo_box.item label="Sistem Varsayılanı" name="System Default Language"/>
-		<combo_box.item label="Ä°ngilizce" name="English"/>
-		<combo_box.item label="Dansk (Danca)" name="Danish"/>
-		<combo_box.item label="Deutsch (Almanca)" name="German"/>
-		<combo_box.item label="Español (İspanyolca)" name="Spanish"/>
-		<combo_box.item label="Français (Fransızca)" name="French"/>
-		<combo_box.item label="Italiano (Ä°talyanca)" name="Italian"/>
-		<combo_box.item label="Magyar (Macarca)" name="Hungarian"/>
-		<combo_box.item label="Nederlands (Flemenkçe)" name="Dutch"/>
-		<combo_box.item label="Polski (Lehçe)" name="Polish"/>
-		<combo_box.item label="Português (Portekizce)" name="Portugese"/>
-		<combo_box.item label="Русский (Rusça)" name="Russian"/>
-		<combo_box.item label="Türkçe (Türkçe)" name="Turkish"/>
-		<combo_box.item label="Українська (Ukraynaca)" name="Ukrainian"/>
-		<combo_box.item label="中文 (正體) (Çince)" name="Chinese"/>
-		<combo_box.item label="日本語 (Japonca)" name="Japanese"/>
-		<combo_box.item label="한국어 (Korece)" name="Korean"/>
-	</combo_box>
+	<button label="Sohbet Çevirisi Ayarları" name="ok_btn"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/tr/panel_preferences_general.xml b/indra/newview/skins/default/xui/tr/panel_preferences_general.xml
index fbfc07c4b8740bd9cb67378bde22ca6e721f195b..4a48b1588c1387bbf62c789b936f0c3d998b1182 100644
--- a/indra/newview/skins/default/xui/tr/panel_preferences_general.xml
+++ b/indra/newview/skins/default/xui/tr/panel_preferences_general.xml
@@ -22,7 +22,7 @@
 		(Yeniden baÅŸlatma gerekir)
 	</text>
 	<text name="maturity_desired_prompt">
-		Seviyelendirdiğim şu içeriğe erişim istiyorum:
+		Seviyelndrl. içeriğe erişim istiyorum::
 	</text>
 	<combo_box name="maturity_desired_combobox">
 		<combo_box.item label="Genel, Orta, YetiÅŸkin" name="Desired_Adult"/>
diff --git a/indra/newview/skins/default/xui/tr/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/tr/panel_preferences_graphics1.xml
index ba31640e9c926a9a44158e8f0238c35ee4776435..ddb83ffc695498f7d25da16d98643f0978c67bc0 100644
--- a/indra/newview/skins/default/xui/tr/panel_preferences_graphics1.xml
+++ b/indra/newview/skins/default/xui/tr/panel_preferences_graphics1.xml
@@ -51,7 +51,7 @@
 			<combo_box.item label="Tüm avatarlar ve nesneler" name="3"/>
 			<combo_box.item label="Her ÅŸey" name="4"/>
 		</combo_box>
-		<slider label="Avatarın Fiziksel Özellikleri:" name="AvatarPhysicsDetail"/>
+		<slider label="Avatar Fzk. Özlk.:" name="AvatarPhysicsDetail"/>
 		<text name="AvatarPhysicsDetailText">
 			Düşük
 		</text>
@@ -60,7 +60,7 @@
 			m
 		</text>
 		<slider label="Maks. parçacık sayısı:" name="MaxParticleCount"/>
-		<slider label="Düşük grafik özellikli olmayan maks. avatar sayısı:" name="MaxNumberAvatarDrawn"/>
+		<slider label="Düşük gr. özl. olmayan mks. avatar:" name="MaxNumberAvatarDrawn"/>
 		<slider label="Son iÅŸleme kalitesi:" name="RenderPostProcess"/>
 		<text name="MeshDetailText">
 			Örgü detayı:
diff --git a/indra/newview/skins/default/xui/tr/panel_preferences_privacy.xml b/indra/newview/skins/default/xui/tr/panel_preferences_privacy.xml
index e76616f667a1db06e45b8d00fa54066379d4a255..9111594979b338fe547fb776e0180476658bfe66 100644
--- a/indra/newview/skins/default/xui/tr/panel_preferences_privacy.xml
+++ b/indra/newview/skins/default/xui/tr/panel_preferences_privacy.xml
@@ -11,7 +11,7 @@
 	<check_box label="Çevrimiçi olduğumu sadece arkadaşlar ve gruplar bilsin" name="online_visibility"/>
 	<check_box label="Sadece arkadaşlar ve gruplar beni arasın veya Aİ göndersin" name="voice_call_friends_only_check"/>
 	<check_box label="Aramaları sonlandırırken mikrofonu kapat" name="auto_disengage_mic_check"/>
-	<check_box label="Oturum Açarken Favori Yer İmlerimi Göster (&apos;Buradan başla&apos; açılır menüsünden)" name="favorites_on_login_check"/>
+	<check_box label="Oturum Açarken Favori Yer İmlerimi Göster (&apos;Buradan başla&apos; menüsünden)" name="favorites_on_login_check"/>
 	<text name="Logs:">
 		Sohbet Günlükleri:
 	</text>
diff --git a/indra/newview/skins/default/xui/tr/panel_preferences_setup.xml b/indra/newview/skins/default/xui/tr/panel_preferences_setup.xml
index 12c175b8f53753b439e3296f9bd1f9d4f3c743d8..9d03d9b01d6007681905b00bf148dd5ee7f73e79 100644
--- a/indra/newview/skins/default/xui/tr/panel_preferences_setup.xml
+++ b/indra/newview/skins/default/xui/tr/panel_preferences_setup.xml
@@ -15,7 +15,7 @@
 		Web:
 	</text>
 	<radio_group name="use_external_browser">
-		<radio_item label="Tarayıcımı kullan (IE, Firefox, Safari)" name="external" tool_tip="Yardım, web bağlantıları vs. için sistemin varsayılan web tarayıcısını kullanın. Tam ekran çalıştırılıyorsa tavsiye edilmez." value="1"/>
+		<radio_item label="Tarayıcımı kullan (IE, Firefox, Safari)" name="external" tool_tip="Yardım, web bağlantıları vs. için sistemin varsayılan web tarayıcısını kullanın. Tam ekran çalıştırılıyorsa tavsiye edilmez." value="true"/>
 		<radio_item label="Yerleşik tarayıcıyı kullan" name="internal" tool_tip="Yardım, web bağlantıları vs. için dahili web tarayıcısını kullanın. Bu tarayıcı [APP_NAME] içerisinde yeni bir pencere olarak açılır." value=""/>
 	</radio_group>
 	<check_box initial_value="true" label="Eklentileri etkinleÅŸtir" name="browser_plugins_enabled"/>
diff --git a/indra/newview/skins/default/xui/tr/panel_profile.xml b/indra/newview/skins/default/xui/tr/panel_profile.xml
deleted file mode 100644
index 4b7a9645373d44f3427aebb3dd7d68bc49e1aea9..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/tr/panel_profile.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Profil" name="panel_profile">
-	<string name="CaptionTextAcctInfo">
-		[ACCTTYPE]
-[PAYMENTINFO] [AGEVERIFICATION]
-	</string>
-	<string name="payment_update_link_url">
-		http://www.secondlife.com/account/billing.php?lang=en
-	</string>
-	<string name="partner_edit_link_url">
-		http://www.secondlife.com/account/partners.php?lang=en
-	</string>
-	<string name="my_account_link_url" value="http://secondlife.com/account"/>
-	<string name="no_partner_text" value="Hiçbiri"/>
-	<string name="no_group_text" value="Hiçbiri"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<panel name="second_life_image_panel">
-						<text name="title_sl_descr_text" value="[SECOND_LIFE]:"/>
-					</panel>
-					<panel name="first_life_image_panel">
-						<text name="title_rw_descr_text" value="Gerçek Dünya:"/>
-					</panel>
-					<text name="title_member_text" value="Ne Zamandan Beri SL Sakini:"/>
-					<text name="title_acc_status_text" value="Hesap Durumu:"/>
-					<text name="title_partner_text" value="Partner:"/>
-					<panel name="partner_data_panel">
-						<text initial_value="(alınıyor)" name="partner_text"/>
-					</panel>
-					<text name="title_groups_text" value="Gruplar:"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-	<layout_stack name="layout_verb_buttons">
-		<layout_panel name="profile_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="Arkadaş Ekle" name="add_friend" tool_tip="Sakine arkadaşlık öner"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="Aİ" name="im" tool_tip="Anlık ileti oturumu aç"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="Ara" name="call" tool_tip="Bu Sakini ara"/>
-				</layout_panel>
-				<layout_panel name="chat_btn_lp">
-					<button label="Işınla" name="teleport" tool_tip="Işınlama teklif et"/>
-				</layout_panel>
-				<layout_panel name="overflow_btn_lp">
-					<menu_button label="▼" name="overflow_btn" tool_tip="Sakine para öde veya envanteri paylaş"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/tr/panel_profile_view.xml b/indra/newview/skins/default/xui/tr/panel_profile_view.xml
deleted file mode 100644
index 17c5002bd75472e55a6d29adb91ebfb198ba26f9..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/tr/panel_profile_view.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel name="panel_target_profile">
-	<string name="status_online">
-		Çevrimiçi
-	</string>
-	<string name="status_offline">
-		Çevrimdışı
-	</string>
-	<text name="display_name_label" value="Ekran Adı:"/>
-	<text name="solo_username_label" value="Kullanıcı Adı:"/>
-	<text name="status" value="Çevrimiçi"/>
-	<text name="user_name_small" value="Bak arkadaşım bu çok uzun bir ad"/>
-	<button name="copy_to_clipboard" tool_tip="Panoya Kopyala"/>
-	<text name="user_label" value="Kullanıcı Adı:"/>
-	<tab_container name="tabs">
-		<panel label="PROFÄ°L" name="panel_profile"/>
-		<panel label="SEÇMELER" name="panel_picks"/>
-		<panel label="NOTLAR &amp; GÄ°ZLÄ°LÄ°K" name="panel_notes"/>
-	</tab_container>
-</panel>
diff --git a/indra/newview/skins/default/xui/tr/panel_region_debug.xml b/indra/newview/skins/default/xui/tr/panel_region_debug.xml
index f16c666e86891be6c69af49e7a36d295ae3dcc08..6e15e0f6f6a487e55fedca41c0a0c8c753591266 100644
--- a/indra/newview/skins/default/xui/tr/panel_region_debug.xml
+++ b/indra/newview/skins/default/xui/tr/panel_region_debug.xml
@@ -21,14 +21,14 @@
 	</line_editor>
 	<button label="Seç" name="choose_avatar_btn"/>
 	<text name="options_text_lbl">
-		Seçenekler:
+		Seçenklr.:
 	</text>
 	<check_box label="Komut dosyaları ile" name="return_scripts" tool_tip="Sadece komut dosyaları olan nesneler iade edilsin"/>
 	<check_box label="Başkasına ait arazi üzerinde" name="return_other_land" tool_tip="Sadece başkasına ait arazi üzerinde olan nesneler iade edilsin"/>
 	<check_box label="Bu gayrimenkulu oluşturan bölgelerin tümünde" name="return_estate_wide" tool_tip="Bu gayrimenkulu oluşturan bölgelerin tümündeki nesneler iade edilsin"/>
 	<button label="Ä°ade Et" name="return_btn"/>
 	<button label="En Çok Çarpışanlar..." name="top_colliders_btn" tool_tip="En çok potansiyel çarpışma yaşayan nesnelerin listesi"/>
-	<button label="En Çok Komut Dosyası Çalıştıranlar..." name="top_scripts_btn" tool_tip="Komut dosyalarını çalıştırırken en çok zaman harcayan nesnelerin listesi"/>
+	<button label="En Çok Komut Dsy. Çalştr...." name="top_scripts_btn" tool_tip="Komut dosyalarını çalıştırırken en çok zaman harcayan nesnelerin listesi"/>
 	<button label="Bölgeyi Yeniden Başlat" name="restart_btn" tool_tip="2 dakikalık bir geri sayımdan sonra bölgeyi yeniden başlat"/>
 	<button label="Yeniden Başlatmayı Ertele" name="cancel_restart_btn" tool_tip="Bölgenin yeniden başlatılmasını 1 saat ertele"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/tr/panel_region_environment.xml b/indra/newview/skins/default/xui/tr/panel_region_environment.xml
index 851cd23f30daf505b5bb301a331e1922a42776dc..058ea91b70298753bcfbe6416e94663730b96e2b 100644
--- a/indra/newview/skins/default/xui/tr/panel_region_environment.xml
+++ b/indra/newview/skins/default/xui/tr/panel_region_environment.xml
@@ -15,7 +15,7 @@
 			<combo_box.item label="-Bir ön ayar seçin-" name="item0"/>
 		</combo_box>
 		<text name="sky_dayc_settings_title">
-			Gökyüzü / Gün Döngüsü
+			Gökyüzü/Gün Dön.
 		</text>
 		<radio_group name="sky_dayc_settings_radio_group">
 			<radio_item label="Sabit gökyüzü" name="my_sky_settings"/>
diff --git a/indra/newview/skins/default/xui/tr/panel_region_estate.xml b/indra/newview/skins/default/xui/tr/panel_region_estate.xml
index 4ba55cafb6eebcacfb796b5a97f24a906d097f36..f1df13df612af1dc9e5ee1a6f02ac75e6bca3d4b 100644
--- a/indra/newview/skins/default/xui/tr/panel_region_estate.xml
+++ b/indra/newview/skins/default/xui/tr/panel_region_estate.xml
@@ -20,10 +20,10 @@
 	<slider label="Faz" name="sun_hour_slider"/>
 	<check_box label="Kamusal EriÅŸime Ä°zin Ver" name="externally_visible_check"/>
 	<text name="Only Allow">
-		Erişimi şununla doğrulanan hesaplarla sınırla:
+		Sadece ÅŸu Sakinlere eriÅŸim izni verin:
 	</text>
-	<check_box label="Dosyadaki Ödeme Bilgileri" name="limit_payment" tool_tip="Tanınmayan Sakinleri Yasakla"/>
-	<check_box label="Yaş Doğrulama" name="limit_age_verified" tool_tip="Yaşını doğrulamayan Sakinleri yasakla Daha fazla bilgi için [SUPPORT_SITE] adresini ziyaret edin."/>
+	<check_box label="Ödeme bilgileri kayıtlı" name="limit_payment" tool_tip="Sakinlerin bu gayrimenkule erişebilmesi için ödeme bilgilerinin kayıtlı olması gerekir.  Daha fazla bilgi için [SUPPORT_SITE] adresini ziyaret edin."/>
+	<check_box label="Yaş doğrulaması yapılmış" name="limit_age_verified" tool_tip="Sakinlerin bu gayrimenkule erişebilmesi için yaş doğrulamalarının yapılmış olması gerekir. Daha fazla bilgi için [SUPPORT_SITE] adresini ziyaret edin."/>
 	<check_box label="Sesli Sohbete Ä°zin Ver" name="voice_chat_check"/>
 	<check_box label="Doğrudan Işınlamaya İzin Ver" name="allow_direct_teleport"/>
 	<button label="Uygula" name="apply_btn"/>
diff --git a/indra/newview/skins/default/xui/tr/panel_region_terrain.xml b/indra/newview/skins/default/xui/tr/panel_region_terrain.xml
index 874d27abfbbbcffc94777e6a0516f284b15a3a67..3226ee008e70635ca0ab4072b4c9c91d7cac040e 100644
--- a/indra/newview/skins/default/xui/tr/panel_region_terrain.xml
+++ b/indra/newview/skins/default/xui/tr/panel_region_terrain.xml
@@ -7,7 +7,7 @@
 		bilinmiyor
 	</text>
 	<spinner label="Su Yüksekliği" name="water_height_spin"/>
-	<spinner label="Yüzey Yükseltme Limiti" name="terrain_raise_spin"/>
+	<spinner label="Yüzey Yükslt. Limiti" name="terrain_raise_spin"/>
 	<spinner label="Yüzey Alçatma Limiti" name="terrain_lower_spin"/>
 	<text name="detail_texture_text">
 		Yüzey Dokuları (512x512, 24 bit .tga dosyalar gerektirir)
diff --git a/indra/newview/skins/default/xui/tr/panel_script_ed.xml b/indra/newview/skins/default/xui/tr/panel_script_ed.xml
index bc30320fa519c6d8a6fe5eed775ab6adb71cb878..7aa1da6fb2c33318f9dbfdaccb84edcdf29a8c2a 100644
--- a/indra/newview/skins/default/xui/tr/panel_script_ed.xml
+++ b/indra/newview/skins/default/xui/tr/panel_script_ed.xml
@@ -22,6 +22,8 @@
 		<menu label="Dosya" name="File">
 			<menu_item_call label="Kaydet" name="Save"/>
 			<menu_item_call label="Tüm Değişiklikleri Geri Çevir" name="Revert All Changes"/>
+			<menu_item_call label="Dosyadan yükle..." name="LoadFromFile"/>
+			<menu_item_call label="Dosyaya kaydet..." name="SaveToFile"/>
 		</menu>
 		<menu label="Düzenle" name="Edit">
 			<menu_item_call label="Geri Al" name="Undo"/>
diff --git a/indra/newview/skins/default/xui/tr/panel_snapshot_inventory.xml b/indra/newview/skins/default/xui/tr/panel_snapshot_inventory.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e3b22c639a6c80998d7e99be93e17bb41fc9e2b5
--- /dev/null
+++ b/indra/newview/skins/default/xui/tr/panel_snapshot_inventory.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_inventory">
+	<text name="title">
+		Envanterime Kaydet
+	</text>
+	<text name="hint_lbl">
+		Bir görüntüyü envanterinize kaydetmenin maliyeti L$[UPLOAD_COST] olur. Görüntünüzü bir doku olarak kaydetmek için kare formatlardan birini seçin.
+	</text>
+	<combo_box label="Çözünürlük" name="texture_size_combo">
+		<combo_box.item label="Mevcut Pencere" name="CurrentWindow"/>
+		<combo_box.item label="Küçük (128x128)" name="Small(128x128)"/>
+		<combo_box.item label="Orta (256x256)" name="Medium(256x256)"/>
+		<combo_box.item label="Büyük (512x512)" name="Large(512x512)"/>
+		<combo_box.item label="Özel" name="Custom"/>
+	</combo_box>
+	<spinner label="GeniÅŸlik" name="inventory_snapshot_width"/>
+	<spinner label="Yükseklik" name="inventory_snapshot_height"/>
+	<check_box label="Oranları koru" name="inventory_keep_aspect_check"/>
+	<button label="Ä°ptal" name="cancel_btn"/>
+	<button label="Kaydet" name="save_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/tr/panel_snapshot_local.xml b/indra/newview/skins/default/xui/tr/panel_snapshot_local.xml
new file mode 100644
index 0000000000000000000000000000000000000000..87d7677d73840a23a86aa5b461e6c2f41312fe14
--- /dev/null
+++ b/indra/newview/skins/default/xui/tr/panel_snapshot_local.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_local">
+	<text name="title">
+		Bilgisayarıma Kaydet
+	</text>
+	<combo_box label="Çözünürlük" name="local_size_combo">
+		<combo_box.item label="Mevcut Pencere" name="CurrentWindow"/>
+		<combo_box.item label="320x240" name="320x240"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="1280x1024" name="1280x1024"/>
+		<combo_box.item label="1600x1200" name="1600x1200"/>
+		<combo_box.item label="Özel" name="Custom"/>
+	</combo_box>
+	<layout_stack name="local_image_params_ls">
+		<layout_panel name="local_image_size_lp">
+			<spinner label="GeniÅŸlik" name="local_snapshot_width"/>
+			<spinner label="Yükseklik" name="local_snapshot_height"/>
+			<check_box label="Oranları koru" name="local_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="local_image_format_quality_lp">
+			<combo_box label="Format" name="local_format_combo">
+				<combo_box.item label="PNG (Kayıpsız)" name="PNG"/>
+				<combo_box.item label="JPEG" name="JPEG"/>
+				<combo_box.item label="BMP (Kayıpsız)" name="BMP"/>
+			</combo_box>
+			<slider label="Görüntü kalitesi" name="image_quality_slider"/>
+			<text name="image_quality_level">
+				([QLVL])
+			</text>
+		</layout_panel>
+	</layout_stack>
+	<button label="Ä°ptal" name="cancel_btn"/>
+	<flyout_button label="Kaydet" name="save_btn" tool_tip="Görüntüyü bir dosyaya kaydet">
+		<flyout_button.item label="Kaydet" name="save_item"/>
+		<flyout_button.item label="Farklı Kaydet..." name="saveas_item"/>
+	</flyout_button>
+</panel>
diff --git a/indra/newview/skins/default/xui/tr/panel_snapshot_options.xml b/indra/newview/skins/default/xui/tr/panel_snapshot_options.xml
new file mode 100644
index 0000000000000000000000000000000000000000..fd2e85fce51c79c9b206f5fcf3ce28fc8ba742bb
--- /dev/null
+++ b/indra/newview/skins/default/xui/tr/panel_snapshot_options.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_options">
+	<button label="Profil Akışımda Yayınla" name="save_to_profile_btn"/>
+	<button label="E-posta" name="save_to_email_btn"/>
+	<button label="Envanterime Kaydet (L$[AMOUNT])" name="save_to_inventory_btn"/>
+	<button label="Bilgisayarıma Kaydet" name="save_to_computer_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/tr/panel_snapshot_postcard.xml b/indra/newview/skins/default/xui/tr/panel_snapshot_postcard.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e999678a0d5cc71c115251f24fe78d0174d56f5d
--- /dev/null
+++ b/indra/newview/skins/default/xui/tr/panel_snapshot_postcard.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_postcard">
+	<string name="default_subject">
+		SECOND_LIFE]&apos;dan posta kartı.
+	</string>
+	<string name="default_message">
+		Buna bakın!
+	</string>
+	<string name="upload_message">
+		Gönderiyor...
+	</string>
+	<text name="title">
+		E-posta
+	</text>
+	<button label="Ä°leti" name="message_btn"/>
+	<button label="Ayarlar" name="settings_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/tr/panel_snapshot_profile.xml b/indra/newview/skins/default/xui/tr/panel_snapshot_profile.xml
new file mode 100644
index 0000000000000000000000000000000000000000..334fd52a48112567da0f8a7f15b84772fd9e7154
--- /dev/null
+++ b/indra/newview/skins/default/xui/tr/panel_snapshot_profile.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_snapshot_profile">
+	<text name="title">
+		Profil Akışımda Yayınla
+	</text>
+	<combo_box label="Çözünürlük" name="profile_size_combo">
+		<combo_box.item label="Mevcut Pencere" name="CurrentWindow"/>
+		<combo_box.item label="640x480" name="640x480"/>
+		<combo_box.item label="800x600" name="800x600"/>
+		<combo_box.item label="1024x768" name="1024x768"/>
+		<combo_box.item label="Özel" name="Custom"/>
+	</combo_box>
+	<layout_stack name="profile_image_params_ls">
+		<layout_panel name="profile_image_size_lp">
+			<spinner label="GeniÅŸlik" name="profile_snapshot_width"/>
+			<spinner label="Yükseklik" name="profile_snapshot_height"/>
+			<check_box label="Oranları koru" name="profile_keep_aspect_check"/>
+		</layout_panel>
+		<layout_panel name="profile_image_metadata_lp">
+			<text name="caption_label">
+				Resim yazısı:
+			</text>
+			<check_box initial_value="true" label="Konumu dahil et" name="add_location_cb"/>
+		</layout_panel>
+	</layout_stack>
+	<button label="Ä°ptal" name="cancel_btn"/>
+	<button label="Yayınla" name="post_btn"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/tr/panel_status_bar.xml b/indra/newview/skins/default/xui/tr/panel_status_bar.xml
index 63726b94e2121d6a7c9f92de2ebc02f7baf34971..178cbda4a2e000d64c0c39e08b3065417b09e91a 100644
--- a/indra/newview/skins/default/xui/tr/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/tr/panel_status_bar.xml
@@ -15,10 +15,10 @@
 	<panel.string name="buycurrencylabel">
 		L$ [AMT]
 	</panel.string>
-	<panel name="balance_bg">
+	<panel left="-425" name="balance_bg" width="215">
 		<text name="balance" tool_tip="L$ bakiyenizi yenilemek için buraya tıklayın" value="L$20"/>
 		<button label="L$ Satın Al" name="buyL" tool_tip="Daha fazla L$ satın almak için tıklayın"/>
-		<button label="Alışveriş yap" name="goShop" tool_tip="Second Life Pazaryeri Aç"/>
+		<button label="Alışveriş yap" name="goShop" tool_tip="Second Life Pazaryeri Aç" width="95"/>
 	</panel>
 	<text name="TimeText" tool_tip="Geçerli zaman (Pasifik)">
 		24:00 AM PST
diff --git a/indra/newview/skins/default/xui/tr/role_actions.xml b/indra/newview/skins/default/xui/tr/role_actions.xml
index 18f7d6dca2656a561185dac683665f7d7b3cc787..655ac641720e66e4529d4383316cc91399b714a3 100644
--- a/indra/newview/skins/default/xui/tr/role_actions.xml
+++ b/indra/newview/skins/default/xui/tr/role_actions.xml
@@ -44,7 +44,7 @@
 	<action_set description="Bu Yeteneklere, grubun sahip olduğu parsellere erişime izin verme veya buralara erişimi yasaklama ve Second Life Sakinlerini dondurma veya parselden dışarı çıkarma da dahildir." name="Parcel Access">
 		<action description="Parselin Erişim listelerini yönet" longdescription="Parselin Erişim listelerini Arazi Hakkında &gt; Erişim sekmesinden yönetin." name="land manage allowed" value="29"/>
 		<action description="Parselin Yasaklama listelerini yönet" longdescription="Parselin Yasaklama listelerini Arazi Hakkında &gt; Erişim sekmesinden yönetin." name="land manage banned" value="30"/>
-		<action description="Parselin &apos;Geçiş haklarını şuna sat&apos; ayarlarını değiştir" longdescription="Parselin &apos;Geçiş haklarını şuna sat&apos; ayarlarını Arazi Hakkında &gt; Erişim sekmesinden değiştirin." name="land manage passes" value="31"/>
+		<action description="Parselin &apos;Geçiş haklr. şuna sat&apos; ayarlarını değiştir" longdescription="Parselin &apos;Geçiş haklr. şuna sat&apos; ayarlarını Arazi Hakkında &gt; Erişim sekmesinden değiştirin." name="land manage passes" value="31"/>
 		<action description="Parsel üzerindeki Second Life Sakinlerini dışarı çıkar veya dondur" longdescription="Bu Yeteneğe sahip olan bir Roldeki Üyeler, grubun sahip olduğu bir parsel üzerinde olmasını istemedikleri bir Second Life sakininin üzerini sağ tıklatıp &apos;Dışarı Çıkar&apos; veya &apos;Dondur&apos;u seçebilirler." name="land admin" value="32"/>
 	</action_set>
 	<action_set description="Bu Yeteneklere üyelerin nesneleri iade etmelerine, Linden bitkilerini yerleştirmelerine ve bu bitkilerin yerlerini değiştirmelerine izin veren güçler de dahildir. Bu özellik, Üyelerin çöpleri temizlemeleri ve bahçe düzenlemesi yapmaları için kullanışlıdır; fakat dikkatle kullanılmalıdır, çünkü nesneleri iade etmenin geri alınma imkanı yoktur." name="Parcel Content">
diff --git a/indra/newview/skins/default/xui/tr/sidepanel_inventory.xml b/indra/newview/skins/default/xui/tr/sidepanel_inventory.xml
index 70c449b4024133eb2bb42d05947493bbc475635a..938b5a76d83ca146acae7cc8d065d2a60d40928c 100644
--- a/indra/newview/skins/default/xui/tr/sidepanel_inventory.xml
+++ b/indra/newview/skins/default/xui/tr/sidepanel_inventory.xml
@@ -2,47 +2,24 @@
 <panel label="EÅŸyalar" name="objects panel">
 	<panel label="" name="sidepanel__inventory_panel">
 		<layout_stack name="inventory_layout_stack">
-			<layout_panel name="inbox_outbox_layout_panel">
-				<layout_stack name="inbox_outbox_layout_stack">
-					<layout_panel name="inbox_layout_panel">
-						<panel label="" name="marketplace_inbox">
-							<string name="InboxLabelWithArg">
-								Alınan öğeler ([NUM])
-							</string>
-							<string name="InboxLabelNoArg">
-								Alınan öğeler
-							</string>
-							<button label="Alınan öğeler" name="inbox_btn"/>
-							<text name="inbox_fresh_new_count">
-								[NUM] yeni
-							</text>
-							<panel tool_tip="Drag and drop items to your inventory to manage and use them">
-								<text name="inbox_inventory_placeholder">
-									Pazaryerinden satın alınan öğeler buraya teslim edilir.
-								</text>
-							</panel>
-						</panel>
-					</layout_panel>
-					<layout_panel name="outbox_layout_panel">
-						<panel label="" name="marketplace_outbox">
-							<string name="OutboxLabelWithArg">
-								Satıcı giden kutusu ([NUM])
-							</string>
-							<string name="OutboxLabelNoArg">
-								Satıcı giden kutusu
-							</string>
-							<button label="Satıcı giden kutusu" name="outbox_btn"/>
-							<button label="" name="outbox_sync_btn" tool_tip="Pazaryeri Vitrinime Gönder"/>
-							<panel>
-								<panel name="outbox_inventory_placeholder_panel">
-									<text name="outbox_inventory_placeholder_title">
-										Yükleniyor...
-									</text>
-								</panel>
-							</panel>
-						</panel>
-					</layout_panel>
-				</layout_stack>
+			<layout_panel name="inbox_layout_panel">
+				<panel label="" name="marketplace_inbox">
+					<string name="InboxLabelWithArg">
+						Alınan öğeler ([NUM])
+					</string>
+					<string name="InboxLabelNoArg">
+						Alınan öğeler
+					</string>
+					<button label="Alınan öğeler" name="inbox_btn"/>
+					<text name="inbox_fresh_new_count">
+						[NUM] yeni
+					</text>
+					<panel name="inbox_inventory_placeholder_panel" tool_tip="Öğeleri kullanmak için bunları sürükleyin ve envanterinize bırakın">
+						<text name="inbox_inventory_placeholder">
+							Pazaryerinden satın alınan öğeler buraya teslim edilir.
+						</text>
+					</panel>
+				</panel>
 			</layout_panel>
 		</layout_stack>
 		<panel name="button_panel">
diff --git a/indra/newview/skins/default/xui/tr/sidepanel_task_info.xml b/indra/newview/skins/default/xui/tr/sidepanel_task_info.xml
index 28eeef02d35de153721520ebb2e563b91999d2f2..2fa6281f052ed07c1296b8420633b945f6b3f0af 100644
--- a/indra/newview/skins/default/xui/tr/sidepanel_task_info.xml
+++ b/indra/newview/skins/default/xui/tr/sidepanel_task_info.xml
@@ -118,6 +118,6 @@
 		<button label="Aç" name="open_btn"/>
 		<button label="Öde" name="pay_btn"/>
 		<button label="Satın Al" name="buy_btn"/>
-		<button label="Ayrıntılar" name="details_btn"/>
+		<button label="Ayrıntl" name="details_btn"/>
 	</panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/tr/strings.xml b/indra/newview/skins/default/xui/tr/strings.xml
index a17d78486d43ce64b8c5f68e17969b912afd9980..2a4e2c20a7e6d83eeb1c0fcddac7c1a0ecffa97f 100644
--- a/indra/newview/skins/default/xui/tr/strings.xml
+++ b/indra/newview/skins/default/xui/tr/strings.xml
@@ -181,7 +181,7 @@ Güncelleştirmeler için www.secondlife.com/status adresini kontrol edin.
 	</string>
 	<string name="LoginFailedPremiumOnly">
 		Second Life üzerindeki aktif kullanıcıların olası en iyi deneyimi yaşamasını sağlamak için, oturum açılması geçici olarak kısıtlanmıştır.
-	 	
+
 Second Life için ödeme yapmış olan kişilere öncelik tanımak amacıyla, ücretsiz hesaplara sahip kişiler bu süre içerisinde Second Life&apos;a erişemeyecekler.
 	</string>
 	<string name="LoginFailedComputerProhibited">
@@ -339,17 +339,35 @@ Lütfen bir dakika içerisinde tekrar oturum açmayı deneyin.
 		Buraya sadece bir öğe sürüklenebilir.
 	</string>
 	<string name="TooltipPrice" value="L$[AMOUNT]:"/>
+	<string name="TooltipOutboxDragToWorld">
+		Satıcı giden kutunuzda öğeler oluşturamazsınız
+	</string>
 	<string name="TooltipOutboxNoTransfer">
-		Bu nesnelerden bir veya daha fazlası başka bir kullanıcıya satılamaz veya aktarılamaz.
+		Bu nesnelerden bir veya daha fazlası satılamaz veya aktarılamaz.
+	</string>
+	<string name="TooltipOutboxNotInInventory">
+		Satıcı giden kutunuza sadece doğrudan kendi envanterinizden öğeler koyabilirsiniz
 	</string>
 	<string name="TooltipOutboxWorn">
-		Bu nesnelerden bir veya daha fazlasını giyiyorsunuz. Bunları avatarınızdan kaldırın ve tekrar taşımayı deneyin.
+		Giymekte olduğunuz öğeleri Satıcı giden kutunuza koyamazsınız.
+	</string>
+	<string name="TooltipOutboxCallingCard">
+		Satıcı giden kutunuza arama kartları koyamazsınız
 	</string>
 	<string name="TooltipOutboxFolderLevels">
-		Bu klasörde çok fazla alt klasör seviyesi var. Dahili klasörleri tekrar düzenleyerek maksimum 4 seviye derinliğe azaltın (Kök Klasör içinde A içinde B içinde C şeklinde).
+		İç içe geçmiş klasörlerin derinliği üçü geçiyor
+	</string>
+	<string name="TooltipOutboxTooManyFolders">
+		Üst seviyedeki klasördeki alt klasör sayısı 20&apos;yi geçiyor
 	</string>
 	<string name="TooltipOutboxTooManyObjects">
-		Bu klasörde 200&apos;den fazla nesne var. Nesne sayısını azaltmak için öğelerden bazılarını kutuya koyun.
+		Üst seviyedeki klasördeki öğe sayısı 200&apos;ü geçiyor
+	</string>
+	<string name="TooltipDragOntoOwnChild">
+		Bir klasörü alt klasörüne taşıyamazsınız
+	</string>
+	<string name="TooltipDragOntoSelf">
+		Bir klasörü kendi içine taşıyamazsınız
 	</string>
 	<string name="TooltipHttpUrl">
 		Bu web sayfasını görmek için tıklayın
@@ -814,6 +832,9 @@ Lütfen bir dakika içerisinde tekrar oturum açmayı deneyin.
 	<string name="anim_yes_head">
 		Evet
 	</string>
+	<string name="multiple_textures">
+		Birden Çok
+	</string>
 	<string name="texture_loading">
 		Yükleniyor...
 	</string>
@@ -973,6 +994,9 @@ Lütfen bir dakika içerisinde tekrar oturum açmayı deneyin.
 	<string name="choose_the_directory">
 		Dizin Seç
 	</string>
+	<string name="script_files">
+		Komut Dosyaları
+	</string>
 	<string name="AvatarSetNotAway">
 		Uzakta DeÄŸil
 	</string>
@@ -1211,43 +1235,36 @@ Lütfen bir dakika içerisinde tekrar oturum açmayı deneyin.
 		Envanterinizde bu dokunun kopyası yok
 	</string>
 	<string name="InventoryInboxNoItems">
-		Pazaryeri üzerinden satın alınan öğeler buraya teslim edilir.
+		Pazaryerinda satın aldıklarınız burada görünecektir. Bunları kullanmak için envanterinize sürükleyebilirsiniz.
 	</string>
 	<string name="MarketplaceURL">
-		http://marketplace.[DOMAIN_NAME]
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/
 	</string>
 	<string name="MarketplaceURL_CreateStore">
-		http://marketplace.[DOMAIN_NAME]/create_store
-	</string>
-	<string name="MarketplaceURL_LearnMore">
-		http://marketplace.[DOMAIN_NAME]/learn_more
+		http://community.secondlife.com/t5/English-Knowledge-Base/Selling-in-the-Marketplace/ta-p/700193#Section_.4
 	</string>
-	<string name="InventoryOutboxCreationErrorTitle">
-		Satıcı Giden Kutunuz düzgün yapılandırılmamıştır
+	<string name="MarketplaceURL_Dashboard">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/merchants/store/dashboard
 	</string>
-	<string name="InventoryOutboxCreationErrorTooltip">
-		Satıcı Giden Kutusu yapılandırma hatası
+	<string name="MarketplaceURL_Imports">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/merchants/store/imports
 	</string>
-	<string name="InventoryOutboxCreationError">
-		Sorunu düzeltmek için lütfen Müşteri Hizmetlerine başvurun.
+	<string name="MarketplaceURL_LearnMore">
+		https://marketplace.[MARKETPLACE_DOMAIN_NAME]/learn_more
 	</string>
 	<string name="InventoryOutboxNotMerchantTitle">
-		Pazaryerinde herkes öğe satabilir
-	</string>
-	<string name="InventoryOutboxNotMerchantTooltip">
-		Bir satıcı olun!
+		Pazaryerinde herkes öğe satabilir.
 	</string>
+	<string name="InventoryOutboxNotMerchantTooltip"/>
 	<string name="InventoryOutboxNotMerchant">
-		[[MARKETPLACE_URL] Second Life Pazaryeri] içerisinde bir milyondan fazla sanal ürün satışa sunulmuştur, bunların tümü Sakinler tarafından oluşturulmuştur. Siz de oluşturduğunuz öğeleri ve satın aldığınız öğelerin bazılarını satabilirsiniz. Bunu yapmak kolaydır, kurulum da ücretsizdir.  [[LEARN_MORE_URL] Daha fazla bilgi edinin] veya başlamak için Pazaryerinde [[CREATE_STORE_URL] bir mağaza açın].
+		Eğer bir satıcı olmak istiyorsanız, [Pazaryerinde [MARKETPLACE_CREATE_STORE_URL] bir mağaza açmanız gerekir].
 	</string>
 	<string name="InventoryOutboxNoItemsTitle">
-		Pazaryerine öğe göndermek için yeni bir yol
-	</string>
-	<string name="InventoryOutboxNoItemsTooltip">
-		Öğeleri Pazaryerinde satışa hazırlamak için sürükleyip buraya bırakın
+		Giden kutunuz boÅŸ.
 	</string>
+	<string name="InventoryOutboxNoItemsTooltip"/>
 	<string name="InventoryOutboxNoItems">
-		Satmak istediğiniz öğeleri veya klasörleri bu alana sürükleyin.  Öğenin bir kopyası burada görünür ve kopyalanamaz bir öğeyi sürüklemediyseniz, envanteriniz aynı kalır.  Öğeleri Pazaryerine göndermeye hazır olduğunuzda Karşıya Yükle düğmesine tıklayın. Öğeleriniz Pazaryeri Envanterinize taşındığında bu klasörden kaybolurlar.
+		Bu alana klasörleri sürükleyin ve bunları [[MARKETPLACE_DASHBOARD_URL] Pazaryerinde] satılık olarak duyurmak için &quot;Pazaryerine Gönder&quot; üzerine tıklayın.
 	</string>
 	<string name="Marketplace Error None">
 		Hata yok
@@ -1409,6 +1426,9 @@ Lütfen bir dakika içerisinde tekrar oturum açmayı deneyin.
 	<string name="no_attachments">
 		Giyilen aksesuar yok
 	</string>
+	<string name="Attachments remain">
+		Aksesuarlar ([COUNT] yuva mevcut)
+	</string>
 	<string name="Buy">
 		Satın Al
 	</string>
@@ -1535,6 +1555,12 @@ Lütfen bir dakika içerisinde tekrar oturum açmayı deneyin.
 	<string name="Right Pec">
 		Sağ Göğüs
 	</string>
+	<string name="Neck">
+		Boyun
+	</string>
+	<string name="Avatar Center">
+		Avatar Merkezi
+	</string>
 	<string name="Invalid Attachment">
 		Geçersiz Aksesuar Noktası
 	</string>
@@ -2160,7 +2186,7 @@ Lütfen bir dakika içerisinde tekrar oturum açmayı deneyin.
 		Aşağı
 	</string>
 	<string name="Any Category">
-		Herhangi Bir Kategori
+		Herh. Bir Kategori
 	</string>
 	<string name="Shopping">
 		Alışveriş
@@ -2190,7 +2216,7 @@ Lütfen bir dakika içerisinde tekrar oturum açmayı deneyin.
 		KiÅŸisel
 	</string>
 	<string name="None">
-		Hiçbiri
+		Renksiz
 	</string>
 	<string name="Linden Location">
 		Linden Konumu
@@ -2390,7 +2416,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Arka Perçem
 	</string>
 	<string name="Baggy">
-		Lüleler
+		Torbalı
 	</string>
 	<string name="Bangs">
 		Kahküller
@@ -2480,7 +2506,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		GeniÅŸ
 	</string>
 	<string name="Brow Size">
-		Kaş Büyüklüğü
+		Alın Genişliği
 	</string>
 	<string name="Bug Eyes">
 		Patlak Gözlü
@@ -2777,7 +2803,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Kaş Yüksekliği
 	</string>
 	<string name="Eyebrow Points">
-		Kaş Noktaları
+		Kaş Yapısı
 	</string>
 	<string name="Eyebrow Size">
 		Kaş Büyüklüğü
@@ -2846,13 +2872,13 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Ön Perçem
 	</string>
 	<string name="Full Back">
-		Saçlar Arkada
+		Arkası Düz
 	</string>
 	<string name="Full Eyeliner">
 		Çift Taraflı Göz Kalemi
 	</string>
 	<string name="Full Front">
-		Saçlar Önde
+		Önü Düz
 	</string>
 	<string name="Full Hair Sides">
 		Saçlar Yanda
@@ -2936,13 +2962,13 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Yüksek Topuklar
 	</string>
 	<string name="High Jaw">
-		Yüksek Çene Ucu
+		Ayrık
 	</string>
 	<string name="High Platforms">
-		Yüksek Topuklu Ayakkabılar
+		Yüksek Topuklu
 	</string>
 	<string name="High and Tight">
-		Tepede Bırakılmış Saç
+		Düşük
 	</string>
 	<string name="Higher">
 		Daha Yüksek
@@ -2954,7 +2980,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Kalça Genişliği
 	</string>
 	<string name="In">
-		İç
+		İçeri
 	</string>
 	<string name="In Shdw Color">
 		İç Gölge Rengi
@@ -2978,19 +3004,19 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Ceket Kırışıklıkları
 	</string>
 	<string name="Jaw Angle">
-		Çene Ucu Açısı
+		Çenenin Boyuna Uzaklığı
 	</string>
 	<string name="Jaw Jut">
-		Çene Ucu Çıkıntısı
+		Alt Çene Uzunluğu
 	</string>
 	<string name="Jaw Shape">
-		Çene Ucu Şekli
+		Çene Kemiği Genişliği
 	</string>
 	<string name="Join">
-		BirleÅŸtir
+		BirleÅŸik
 	</string>
 	<string name="Jowls">
-		Gıdıklar
+		Avurtlar
 	</string>
 	<string name="Knee Angle">
 		Diz Açısı
@@ -3029,7 +3055,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Daha Az Dolgun
 	</string>
 	<string name="Less Gravity">
-		Daha Az Yerçekimi
+		Dik Göğüs
 	</string>
 	<string name="Less Love">
 		Daha Ä°nce Bel
@@ -3047,7 +3073,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Daha Az Yuvarlak
 	</string>
 	<string name="Less Saddle">
-		Daha Dar Kalça
+		Basensiz
 	</string>
 	<string name="Less Square">
 		Daha Az Küt
@@ -3098,7 +3124,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Uzun Kafa
 	</string>
 	<string name="Long Hips">
-		Geniş Kalçalar
+		Yüksek kalça
 	</string>
 	<string name="Long Legs">
 		Uzun Bacaklar
@@ -3107,7 +3133,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Uzun Boyun
 	</string>
 	<string name="Long Pigtails">
-		Uzun Saç Örgüleri
+		Yandan Uzun Kuyruk
 	</string>
 	<string name="Long Ponytail">
 		Uzun AtkuyruÄŸu
@@ -3137,13 +3163,13 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Alçak Topuklar
 	</string>
 	<string name="Low Jaw">
-		Düşük Çene Ucu
+		BitiÅŸik
 	</string>
 	<string name="Low Platforms">
 		Alçak Topuklu
 	</string>
 	<string name="Low and Loose">
-		Serbest At KuyruÄŸu
+		Yüksek
 	</string>
 	<string name="Lower">
 		Daha Alçak
@@ -3182,7 +3208,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Daha Dolgun
 	</string>
 	<string name="More Gravity">
-		Daha Çok Yerçekimi
+		Sarkık Göğüs
 	</string>
 	<string name="More Lipstick">
 		Daha Çok Ruj
@@ -3191,7 +3217,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Daha Kalın Bel
 	</string>
 	<string name="More Lower Lip">
-		Daha Çok Alt Dudak
+		Daha Dolgun Alt Dudak
 	</string>
 	<string name="More Muscles">
 		Daha Çok Kas
@@ -3206,7 +3232,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Daha Yuvarlak
 	</string>
 	<string name="More Saddle">
-		Daha Geniş Kalça
+		Basenli
 	</string>
 	<string name="More Sloped">
 		Daha EÄŸimli
@@ -3215,7 +3241,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Daha Küt
 	</string>
 	<string name="More Upper Lip">
-		Daha Çok Üst Dudak
+		Daha Dolgun Ãœst Dudak
 	</string>
 	<string name="More Vertical">
 		Daha Dikey
@@ -3260,7 +3286,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Önü Dar
 	</string>
 	<string name="Narrow Lips">
-		Ä°nce Dudaklar
+		Küçük Dudaklar
 	</string>
 	<string name="Natural">
 		DoÄŸal
@@ -3359,7 +3385,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Turuncu
 	</string>
 	<string name="Out">
-		Dış
+		Dışarı
 	</string>
 	<string name="Out Shdw Color">
 		Dış Gölge Rengi
@@ -3377,7 +3403,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Dış Gölge
 	</string>
 	<string name="Overbite">
-		Üst Dişler Önde
+		Öne Doğru
 	</string>
 	<string name="Package">
 		Apış Arası Şişkinliği
@@ -3416,7 +3442,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Pigment
 	</string>
 	<string name="Pigtails">
-		Saç Örgüleri
+		Yan Kuyruklar
 	</string>
 	<string name="Pink">
 		Pembe
@@ -3431,7 +3457,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Topuk GeniÅŸliÄŸi
 	</string>
 	<string name="Pointy">
-		Sivri
+		Dar
 	</string>
 	<string name="Pointy Heels">
 		Sivri Topuklar
@@ -3482,25 +3508,25 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Dağınık Saç
 	</string>
 	<string name="Saddle Bags">
-		Kalça Kalınlığı
+		Basen GeniÅŸliÄŸi
 	</string>
 	<string name="Scrawny Leg">
 		Sıska Bacak
 	</string>
 	<string name="Separate">
-		Ayrı
+		Ayrık
 	</string>
 	<string name="Shallow">
 		Sığ
 	</string>
 	<string name="Shear Back">
-		Arkayı Dikey Kaydır
+		Arka DolgunluÄŸu
 	</string>
 	<string name="Shear Face">
 		Yüzü Dikey Kaydır
 	</string>
 	<string name="Shear Front">
-		Önü Dikey Kaydır
+		Ön Dolgunluğu
 	</string>
 	<string name="Shear Left Up">
 		Solu Yukarı Kaydır
@@ -3509,10 +3535,10 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Sağı Yukarı Kaydır
 	</string>
 	<string name="Sheared Back">
-		Arkası Dikey Kaydırılmış
+		Arkası Dolgun
 	</string>
 	<string name="Sheared Front">
-		Önü Dikey Kaydırılmış
+		Önü Dolgun
 	</string>
 	<string name="Shift Left">
 		Sola Kaydır
@@ -3548,7 +3574,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Kısa Boyun
 	</string>
 	<string name="Short Pigtails">
-		Kısa Atkuyrukları
+		Yandan Kısa Kuyruk
 	</string>
 	<string name="Short Ponytail">
 		Kısa Atkuyruğu
@@ -3560,7 +3586,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Kısa Gövde
 	</string>
 	<string name="Short hips">
-		Dar kalçalar
+		Düşük kalça
 	</string>
 	<string name="Shoulders">
 		Omuzlar
@@ -3638,7 +3664,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Dikleştirilmiş Saç
 	</string>
 	<string name="Square">
-		Kare
+		GeniÅŸ
 	</string>
 	<string name="Square Toe">
 		Küt Burunlu
@@ -3680,7 +3706,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Kalın Boyun
 	</string>
 	<string name="Thick Toe">
-		Kalın kabu Burnu
+		Kalın Ayak Ucu
 	</string>
 	<string name="Thin">
 		Ä°nce
@@ -3695,7 +3721,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Ä°nce Burun
 	</string>
 	<string name="Tight Chin">
-		Dar Çene
+		Çift Çene
 	</string>
 	<string name="Tight Cuffs">
 		Dar Paçalar
@@ -3710,7 +3736,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Dar Etek
 	</string>
 	<string name="Tight Sleeves">
-		Dar Kollar
+		Dar Kollu
 	</string>
 	<string name="Toe Shape">
 		Ayakkabu Burnu Åžekli
@@ -3728,13 +3754,13 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Sıska Gövde
 	</string>
 	<string name="Unattached">
-		Bağımsız
+		Ayrık
 	</string>
 	<string name="Uncreased">
 		BuruÅŸuk olmayan
 	</string>
 	<string name="Underbite">
-		Alt Dişler Önde
+		Geriye DoÄŸru
 	</string>
 	<string name="Unnatural">
 		DoÄŸal Olmayan
@@ -3770,7 +3796,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		GeniÅŸ
 	</string>
 	<string name="Wide Back">
-		Geniş Sırt
+		GeniÅŸ Arka
 	</string>
 	<string name="Wide Front">
 		Geniş Ön
@@ -3895,6 +3921,9 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 	<string name="Saved_message">
 		(Kaydedildi [LONG_TIMESTAMP])
 	</string>
+	<string name="IM_unblock_only_groups_friends">
+		Bu mesajı görmek için Tercihler/Gizlilik&apos;de &apos;Sadece arkadaşlar ve gruplar beni arasın veya Aİ göndersin&apos; seçeneğinin işaretini kaldırmalısınız.
+	</string>
 	<string name="answered_call">
 		Aramanız yanıtlandı
 	</string>
@@ -4027,6 +4056,18 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 	<string name="you_paid_ldollars_no_name">
 		[REASON] L$[AMOUNT] ödediniz.
 	</string>
+	<string name="you_paid_failure_ldollars">
+		[REASON] [NAME]&apos;e L$[AMOUNT] ödeyemediniz.
+	</string>
+	<string name="you_paid_failure_ldollars_no_info">
+		L$[AMOUNT] ödeyemediniz.
+	</string>
+	<string name="you_paid_failure_ldollars_no_reason">
+		[NAME]&apos;e L$[AMOUNT] ödeyemediniz.
+	</string>
+	<string name="you_paid_failure_ldollars_no_name">
+		[REASON] L$[AMOUNT] ödeyemediniz.
+	</string>
 	<string name="for item">
 		[ITEM] için.
 	</string>
@@ -4079,9 +4120,7 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
 		Çevrimiçi
 	</string>
 	<string name="uploading_abuse_report">
-		Karşıya Yükleniyor...
-  
-Kötüye Kullanımı Bildirme
+		Kötüye Kullanım Bildirimi Karşıya Yükleniyor...
 	</string>
 	<string name="New Shape">
 		Yeni Åžekil
@@ -4348,7 +4387,7 @@ Kötüye Kullanımı Bildirme
 	<string name="server_is_down">
 		Tüm çabalarımıza rağmen beklenmeyen bir hata meydana geldi.
 
-	Hizmetle ilişkili bilinen bir sorun olup olmadığını görmek için lütfen status.secondlifegrid.net adresine bakın.  
+	Hizmetle ilişkili bilinen bir sorun olup olmadığını görmek için lütfen status.secondlifegrid.net adresine bakın.
         Sorun yaşamaya devam ederseniz lütfen ağınızın ve güvenlik duvarınızın ayarlarına bakın.
 	</string>
 	<string name="dateTimeWeekdaysNames">
@@ -4437,6 +4476,12 @@ Düzenleyici yolunu çift tırnakla çevrelemeyi deneyin.
 	<string name="ExternalEditorFailedToRun">
 		Harici düzenleyici çalışmadı.
 	</string>
+	<string name="TranslationFailed">
+		Çeviri başarılamadı: [REASON]
+	</string>
+	<string name="TranslationResponseParseError">
+		Çeviri yanıtı ayrıştırılırken hata meydana geldi.
+	</string>
 	<string name="Esc">
 		Esc
 	</string>
@@ -4819,7 +4864,10 @@ Düzenleyici yolunu çift tırnakla çevrelemeyi deneyin.
 		Mini-harita
 	</string>
 	<string name="Command_Move_Label">
-		Hareket Et
+		Yürü / koş / uç
+	</string>
+	<string name="Command_Outbox_Label">
+		Satıcı giden kutusu
 	</string>
 	<string name="Command_People_Label">
 		KiÅŸiler
@@ -4846,10 +4894,10 @@ Düzenleyici yolunu çift tırnakla çevrelemeyi deneyin.
 		KonuÅŸ
 	</string>
 	<string name="Command_View_Label">
-		Görünüm
+		Kamera denetimleri
 	</string>
 	<string name="Command_Voice_Label">
-		Yakındaki ses
+		Ses ayarları
 	</string>
 	<string name="Command_AboutLand_Tooltip">
 		Ziyaret ettiÄŸiniz araziyle ilgili bilgi
@@ -4893,6 +4941,9 @@ Düzenleyici yolunu çift tırnakla çevrelemeyi deneyin.
 	<string name="Command_Move_Tooltip">
 		Avatarınızı hareket ettirmek
 	</string>
+	<string name="Command_Outbox_Tooltip">
+		Satmak amacıyla Pazaryerinize öğeler taşıyın
+	</string>
 	<string name="Command_People_Tooltip">
 		Arkadaşlar, gruplar ve yakındaki kişiler
 	</string>
@@ -4921,7 +4972,16 @@ Düzenleyici yolunu çift tırnakla çevrelemeyi deneyin.
 		Kamera açısını değiştirmek
 	</string>
 	<string name="Command_Voice_Tooltip">
-		Ses imkanına sahip yakındaki kişiler
+		Aramalar ve 	SL dünyası içinde size yakın kişiler için ses denetimleri
+	</string>
+	<string name="Toolbar_Bottom_Tooltip">
+		şu anda alt araç çubuğunuzda
+	</string>
+	<string name="Toolbar_Left_Tooltip">
+		şu anda sol araç çubuğunuzda
+	</string>
+	<string name="Toolbar_Right_Tooltip">
+		şu anda sağ araç çubuğunuzda
 	</string>
 	<string name="Retain%">
 		Koru %
@@ -4947,4 +5007,19 @@ Düzenleyici yolunu çift tırnakla çevrelemeyi deneyin.
 	<string name="Normal">
 		Normal
 	</string>
+	<string name="snapshot_quality_very_low">
+		Çok Düşük
+	</string>
+	<string name="snapshot_quality_low">
+		Düşük
+	</string>
+	<string name="snapshot_quality_medium">
+		Orta
+	</string>
+	<string name="snapshot_quality_high">
+		Yüksek
+	</string>
+	<string name="snapshot_quality_very_high">
+		Çok Yüksek
+	</string>
 </strings>
diff --git a/indra/newview/skins/default/xui/tr/teleport_strings.xml b/indra/newview/skins/default/xui/tr/teleport_strings.xml
index c506bb8a583c9370e91a2bfcc20dfb444d4c61eb..62aaaf671fb1460b205fbb758d82a77e03bc83d2 100644
--- a/indra/newview/skins/default/xui/tr/teleport_strings.xml
+++ b/indra/newview/skins/default/xui/tr/teleport_strings.xml
@@ -21,8 +21,8 @@ Hala ışınlanamıyorsanız, sorunu çözmek için lütfen çıkış yapıp otu
 Bir dakika sonra tekrar deneyin.
 		</message>
 		<message name="NoHelpIslandTP">
-You cannot teleport back to Welcome Island.
-Go to &apos;Welcome Island Public&apos; to repeat the tutorial.
+			Karşılama Ada&apos;sına geri ışınlanamazsınız.
+Öğreticiyi tekrarlamak için &apos;Karşılama Ada&apos;sı Kamusal Alanı&apos;na gidin.
 		</message>
 		<message name="noaccess_tport">
 			Üzgünüz, bu ışınlanma hedef konumuna erişim hakkına sahip değilsiniz.
diff --git a/indra/newview/skins/default/xui/zh/floater_buy_currency.xml b/indra/newview/skins/default/xui/zh/floater_buy_currency.xml
index d63e73c6f19e3d19f6d9a561ff38f7e917566f73..9f6591faf9f3293eec4858242913c0687a62b601 100644
--- a/indra/newview/skins/default/xui/zh/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/zh/floater_buy_currency.xml
@@ -46,7 +46,7 @@
 		L$ [AMT]
 	</text>
 	<text name="currency_links">
-		[http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] | [http://www.secondlife.com/my/account/exchange_rates.php exchange rate]
+		[http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency]
 	</text>
 	<text name="exchange_rate_note">
 		Re-enter amount to see the latest exchange rate.
diff --git a/indra/newview/skins/default/xui/zh/floater_camera.xml b/indra/newview/skins/default/xui/zh/floater_camera.xml
index f4db20684c5d1c153813d199e97dbdc4674a9760..b75474340c7ac7c47d0fea9a6b980e2af762f5ed 100644
--- a/indra/newview/skins/default/xui/zh/floater_camera.xml
+++ b/indra/newview/skins/default/xui/zh/floater_camera.xml
@@ -9,15 +9,6 @@
 	<floater.string name="move_tooltip">
 		Move Camera Up and Down, Left and Right
 	</floater.string>
-	<floater.string name="camera_modes_title">
-		攝影機模式
-	</floater.string>
-	<floater.string name="pan_mode_title">
-		環繞縮放平移
-	</floater.string>
-	<floater.string name="presets_mode_title">
-		預設視角
-	</floater.string>
 	<floater.string name="free_mode_title">
 		視角物件
 	</floater.string>
diff --git a/indra/newview/skins/default/xui/zh/menu_viewer.xml b/indra/newview/skins/default/xui/zh/menu_viewer.xml
index f7be781caca70580cc0b79307ab96da3f3d67f10..b6bb79bcbcc817aba6f36cf90fef5d4380650078 100644
--- a/indra/newview/skins/default/xui/zh/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/zh/menu_viewer.xml
@@ -20,8 +20,6 @@
 			<menu_item_call label="離開" name="Set Away"/>
 			<menu_item_call label="忙碌" name="Set Busy"/>
 		</menu>
-		<menu_item_call label="要求 Admin 狀態" name="Request Admin Options"/>
-		<menu_item_call label="離開 Admin 狀態" name="Leave Admin Options"/>
 		<menu_item_call label="結束退出 [APP_NAME]" name="Quit"/>
 	</menu>
 	<menu label="溝通" name="Communicate">
@@ -36,11 +34,10 @@
 		<menu_item_check label="搜尋" name="Search"/>
 		<menu_item_call label="拍攝快照" name="Take Snapshot"/>
 		<menu_item_call label="將此處記下地標" name="Create Landmark Here"/>
-		<menu label="地點檔案" name="Land">
-			<menu_item_call label="地點檔案" name="Place Profile"/>
-			<menu_item_call label="關於土地" name="About Land"/>
-			<menu_item_call label="地區 / 領地" name="Region/Estate"/>
-		</menu>
+		<menu_item_separator/>
+		<menu_item_call label="地點檔案" name="Place Profile"/>
+		<menu_item_call label="關於土地" name="About Land"/>
+		<menu_item_call label="地區 / 領地" name="Region/Estate"/>
 		<menu_item_call label="購買這塊土地" name="Buy Land"/>
 		<menu_item_call label="我的土地" name="My Land"/>
 		<menu label="顯示" name="LandShow">
@@ -56,7 +53,7 @@
 		</menu>
 		<menu_item_call label="瞬間瞬間傳送回家" name="Teleport Home"/>
 		<menu_item_call label="設定家在此處" name="Set Home to Here"/>
-		<menu label="太陽" name="Environment Settings">
+		<menu label="太陽" name="Sun">
 			<menu_item_call label="日出" name="Sunrise"/>
 			<menu_item_call label="中午" name="Noon"/>
 			<menu_item_call label="日落" name="Sunset"/>
@@ -154,22 +151,22 @@
 			<menu_item_check label="顯示第一人稱視角準星" name="ShowCrosshairs"/>
 		</menu>
 		<menu label="Rendering Types" name="Rendering Types">
-			<menu_item_check label="ç°¡å–®" name="Simple"/>
-			<menu_item_check label="半透明" name="Alpha"/>
-			<menu_item_check label="樹木" name="Tree"/>
-			<menu_item_check label="化身" name="Character"/>
-			<menu_item_check label="地表" name="SurfacePath"/>
-			<menu_item_check label="天空" name="Sky"/>
-			<menu_item_check label="æ°´æ–‡" name="Water"/>
-			<menu_item_check label="地面" name="Ground"/>
-			<menu_item_check label="體積" name="Volume"/>
-			<menu_item_check label="草地" name="Grass"/>
-			<menu_item_check label="雲彩" name="Clouds"/>
-			<menu_item_check label="粒子效果" name="Particles"/>
-			<menu_item_check label="碰撞" name="Bump"/>
+			<menu_item_check label="ç°¡å–®" name="Rendering Type Simple"/>
+			<menu_item_check label="半透明" name="Rendering Type Alpha"/>
+			<menu_item_check label="樹木" name="Rendering Type Tree"/>
+			<menu_item_check label="化身" name="Rendering Type Character"/>
+			<menu_item_check label="地表" name="Rendering Type Surface Patch"/>
+			<menu_item_check label="天空" name="Rendering Type Sky"/>
+			<menu_item_check label="æ°´æ–‡" name="Rendering Type Water"/>
+			<menu_item_check label="地面" name="Rendering Type Ground"/>
+			<menu_item_check label="體積" name="Rendering Type Volume"/>
+			<menu_item_check label="草地" name="Rendering Type Grass"/>
+			<menu_item_check label="雲彩" name="Rendering Type Clouds"/>
+			<menu_item_check label="粒子效果" name="Rendering Type Particles"/>
+			<menu_item_check label="碰撞" name="Rendering Type Bump"/>
 		</menu>
 		<menu label="Rendering Features" name="Rendering Features">
-			<menu_item_check label="UI" name="UI"/>
+			<menu_item_check label="UI" name="ToggleUI"/>
 			<menu_item_check label="Selected" name="Selected"/>
 			<menu_item_check label="Highlighted" name="Highlighted"/>
 			<menu_item_check label="Dynamic Textures" name="Dynamic Textures"/>
@@ -182,10 +179,7 @@
 		<menu_item_call label="清除群組快取資料" name="ClearGroupCache"/>
 		<menu_item_check label="滑鼠平滑移動" name="Mouse Smoothing"/>
 		<menu label="快速鍵" name="Shortcuts">
-			<menu_item_call label="圖像(L$[COST])..." name="Upload Image"/>
-			<menu_item_check label="搜尋" name="Search"/>
 			<menu_item_call label="釋出按鍵" name="Release Keys"/>
-			<menu_item_call label="設定使用者界面大小至預設值" name="Set UI Size to Default"/>
 			<menu_item_check label="顯示進階選單 - 舊版捷徑" name="Show Advanced Menu - legacy shortcut"/>
 			<menu_item_call label="關閉視窗" name="Close Window"/>
 			<menu_item_call label="關閉全部視窗" name="Close All Windows"/>
@@ -194,13 +188,6 @@
 			<menu_item_check label="Joystick Flycam" name="Joystick Flycam"/>
 			<menu_item_call label="重設視角" name="Reset View"/>
 			<menu_item_call label="注視上一位聊天者" name="Look at Last Chatter"/>
-			<menu label="選擇建造工具" name="Select Tool">
-				<menu_item_call label="聚焦工具" name="Focus"/>
-				<menu_item_call label="移動工具" name="Move"/>
-				<menu_item_call label="編輯工具" name="Edit"/>
-				<menu_item_call label="創造工具" name="Create"/>
-				<menu_item_call label="土地工具" name="Land"/>
-			</menu>
 			<menu_item_call label="Zoom In" name="Zoom In"/>
 			<menu_item_call label="Zoom Default" name="Zoom Default"/>
 			<menu_item_call label="Zoom Out" name="Zoom Out"/>
@@ -306,9 +293,8 @@
 			<menu_item_call label="開始錄製" name="Start Record"/>
 			<menu_item_call label="停止錄製" name="Stop Record"/>
 		</menu>
-		<menu label="世界" name="World">
+		<menu label="世界" name="DevelopWorld">
 			<menu_item_check label="模擬器太陽設定覆蓋" name="Sim Sun Override"/>
-			<menu_item_check label="Cheesy Beacon" name="Cheesy Beacon"/>
 			<menu_item_check label="固定天氣" name="Fixed Weather"/>
 			<menu_item_call label="傾印地區物件快取" name="Dump Region Object Cache"/>
 		</menu>
@@ -340,11 +326,11 @@
 		</menu>
 		<menu label="化身" name="Character">
 			<menu label="Grab Baked Texture" name="Grab Baked Texture">
-				<menu_item_call label="Iris" name="Iris"/>
-				<menu_item_call label="頭部" name="Head"/>
-				<menu_item_call label="Upper Body" name="Upper Body"/>
-				<menu_item_call label="Lower Body" name="Lower Body"/>
-				<menu_item_call label="裙子" name="Skirt"/>
+				<menu_item_call label="Iris" name="Grab Iris"/>
+				<menu_item_call label="頭部" name="Grab Head"/>
+				<menu_item_call label="Upper Body" name="Grab Upper Body"/>
+				<menu_item_call label="Lower Body" name="Grab Lower Body"/>
+				<menu_item_call label="裙子" name="Grab Skirt"/>
 			</menu>
 			<menu label="Character Tests" name="Character Tests">
 				<menu_item_call label="Appearance To XML" name="Appearance To XML"/>
@@ -378,8 +364,8 @@
 		<menu_item_check label="Show Admin Menu" name="View Admin Options"/>
 	</menu>
 	<menu label="Admin" name="Admin">
-		<menu label="Object">
-			<menu_item_call label="取得副本" name="Take Copy"/>
+		<menu label="Object" name="AdminObject">
+			<menu_item_call label="取得副本" name="Admin Take Copy"/>
 			<menu_item_call label="強制擁有者為我" name="Force Owner To Me"/>
 			<menu_item_call label="Force Owner Permissive" name="Force Owner Permissive"/>
 			<menu_item_call label="刪除" name="Delete"/>
@@ -415,7 +401,7 @@
 			<menu_item_call label="身體物理" name="Physics"/>
 			<menu_item_call label="全部衣服" name="All Clothes"/>
 		</menu>
-		<menu label="幫助" name="Help">
+		<menu label="幫助" name="DeprecatedHelp">
 			<menu_item_call label="林登官方部落格" name="Official Linden Blog"/>
 			<menu_item_call label="Scripting Portal" name="Scripting Portal"/>
 			<menu label="臭蟲回報" name="Bug Reporting">
diff --git a/indra/newview/skins/default/xui/zh/notifications.xml b/indra/newview/skins/default/xui/zh/notifications.xml
index 2d309a2af0b6f62552afcee70492ca7af74905ce..3fa8ff3f781cf21b0e177e49e3c878811d8b1017 100644
--- a/indra/newview/skins/default/xui/zh/notifications.xml
+++ b/indra/newview/skins/default/xui/zh/notifications.xml
@@ -966,7 +966,7 @@ Offer friendship to [NAME]?
 		</form>
 	</notification>
 	<notification name="RemoveFromFriends">
-		Do you want to remove [NAME] from your Friends List?
+		Do you want to remove &lt;nolink&gt;[NAME]&lt;/nolink&gt; from your Friends List?
 		<usetemplate name="okcancelbuttons" notext="取消" yestext="確定"/>
 	</notification>
 	<notification name="RemoveMultipleFromFriends">
@@ -1418,7 +1418,7 @@ We must restart [APP_NAME] to install the update.
 		<usetemplate ignoretext="在我退回物件給它們的擁有者前確認" name="okcancelignore" notext="取消" yestext="確定"/>
 	</notification>
 	<notification name="GroupLeaveConfirmMember">
-		你目前是 [GROUP] 群組的成員。
+		你目前是 &lt;nolink&gt;[GROUP]&lt;/nolink&gt; 群組的成員。
 是否要離開群組?
 		<usetemplate name="okcancelbuttons" notext="取消" yestext="確定"/>
 	</notification>
@@ -2109,10 +2109,10 @@ Link to this from a web page to give others easy access to this location, or try
 		Topic: [SUBJECT], Message: [MESSAGE]
 	</notification>
 	<notification name="FriendOnline">
-		[NAME] 上線
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; 上線
 	</notification>
 	<notification name="FriendOffline">
-		[NAME] 離線
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; 離線
 	</notification>
 	<notification name="AddSelfFriend">
 		Although you&apos;re very nice, you can&apos;t add yourself as a friend.
@@ -2491,10 +2491,10 @@ Please try again in a few moments.
 		</form>
 	</notification>
 	<notification name="FriendshipAccepted">
-		[NAME] accepted your friendship offer.
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; accepted your friendship offer.
 	</notification>
 	<notification name="FriendshipDeclined">
-		[NAME] 謝絕你的交友邀請。
+		&lt;nolink&gt;[NAME]&lt;/nolink&gt; 謝絕你的交友邀請。
 	</notification>
 	<notification name="FriendshipAcceptedByMe">
 		交友邀請被接受。
diff --git a/indra/newview/skins/default/xui/zh/panel_my_profile.xml b/indra/newview/skins/default/xui/zh/panel_my_profile.xml
deleted file mode 100644
index 79817d7be9eaf7757853285e0fabe54afe5d24b2..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/zh/panel_my_profile.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="檔案" name="panel_profile">
-	<string name="CaptionTextAcctInfo">
-		[ACCTTYPE]
-[PAYMENTINFO] [AGEVERIFICATION]
-	</string>
-	<string name="payment_update_link_url">
-		http://www.secondlife.com/account/billing.php?lang=en
-	</string>
-	<string name="partner_edit_link_url">
-		http://www.secondlife.com/account/partners.php?lang=en
-	</string>
-	<string name="my_account_link_url" value="http://secondlife.com/account"/>
-	<string name="no_partner_text" value="ç„¡"/>
-	<string name="no_group_text" value="ç„¡"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="scroll_content_panel">
-					<panel name="second_life_image_panel">
-						<text name="display_name_descr_text">
-							User name
-						</text>
-						<text name="name_descr_text">
-							顯示名稱
-						</text>
-						<button label="檔案" name="see_profile_btn" tool_tip="察看這位化身的檔案"/>
-					</panel>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/zh/panel_notes.xml b/indra/newview/skins/default/xui/zh/panel_notes.xml
deleted file mode 100644
index 875c6bb3284f1946fe8555221fe1a82ab69348b3..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/zh/panel_notes.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Notes &amp; Privacy" name="panel_notes">
-	<layout_stack name="layout">
-		<layout_panel name="notes_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<text name="status_message" value="My private notes:"/>
-					<text name="status_message2" value="允許這個人可以:"/>
-					<check_box label="看到我上線狀態" name="status_check"/>
-					<check_box label="在地圖上看見我" name="map_check"/>
-					<check_box label="邊輯,刪除或取下我的物件" name="objects_check"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-		<layout_panel name="notes_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="加為朋友" name="add_friend" tool_tip="向這個居民提出交友邀請"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="IM" name="im" tool_tip="開啟即時訊息會話"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="通話" name="call" tool_tip="與這位居民通話"/>
-				</layout_panel>
-				<layout_panel name="show_on_map_btn_lp">
-					<button label="地圖" name="show_on_map_btn" tool_tip="在地圖上顯示這個居民"/>
-				</layout_panel>
-				<layout_panel name="teleport_btn_lp">
-					<button label="瞬間傳送" name="teleport" tool_tip="發給瞬間傳送請求"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/zh/panel_profile.xml b/indra/newview/skins/default/xui/zh/panel_profile.xml
deleted file mode 100644
index 502449ac3abbb34adefd39e8d4f4ab3ec43545f5..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/zh/panel_profile.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="檔案" name="panel_profile">
-	<string name="CaptionTextAcctInfo">
-		[ACCTTYPE]
-[PAYMENTINFO] [AGEVERIFICATION]
-	</string>
-	<string name="payment_update_link_url">
-		http://www.secondlife.com/account/billing.php?lang=en
-	</string>
-	<string name="partner_edit_link_url">
-		http://www.secondlife.com/account/partners.php?lang=en
-	</string>
-	<string name="my_account_link_url" value="http://secondlife.com/account"/>
-	<string name="no_partner_text" value="ç„¡"/>
-	<string name="no_group_text" value="ç„¡"/>
-	<string name="RegisterDateFormat">
-		[REG_DATE] ([AGE])
-	</string>
-	<string name="name_text_args">
-		[NAME]
-	</string>
-	<string name="display_name_text_args">
-		[DISPLAY_NAME]
-	</string>
-	<layout_stack name="layout">
-		<layout_panel name="profile_stack">
-			<scroll_container name="profile_scroll">
-				<panel name="profile_scroll_panel">
-					<panel name="second_life_image_panel">
-						<text name="title_sl_descr_text" value="[SECOND_LIFE]:"/>
-					</panel>
-					<panel name="first_life_image_panel">
-						<text name="title_rw_descr_text" value="真實世界:"/>
-					</panel>
-					<text name="title_member_text" value="成為居民自:"/>
-					<text name="title_acc_status_text" value="帳戶狀態:"/>
-					<text name="title_partner_text" value="配偶:"/>
-					<panel name="partner_data_panel">
-						<text initial_value="(檢索中)" name="partner_text"/>
-					</panel>
-					<text name="title_groups_text" value="群組:"/>
-				</panel>
-			</scroll_container>
-		</layout_panel>
-	</layout_stack>
-	<layout_stack name="layout_verb_buttons">
-		<layout_panel name="profile_buttons_panel">
-			<layout_stack name="bottom_bar_ls">
-				<layout_panel name="add_friend_btn_lp">
-					<button label="加為朋友" name="add_friend" tool_tip="發出交友邀請給這居民"/>
-				</layout_panel>
-				<layout_panel name="im_btn_lp">
-					<button label="IM" name="im" tool_tip="開啟即時訊息會話"/>
-				</layout_panel>
-				<layout_panel name="call_btn_lp">
-					<button label="通話" name="call" tool_tip="與這位居民通話"/>
-				</layout_panel>
-				<layout_panel name="chat_btn_lp">
-					<button label="瞬間傳送" name="teleport" tool_tip="發給瞬間傳送請求"/>
-				</layout_panel>
-				<layout_panel name="overflow_btn_lp">
-					<menu_button label="▼" name="overflow_btn" tool_tip="支付金錢,或分享收納區給居民"/>
-				</layout_panel>
-			</layout_stack>
-		</layout_panel>
-	</layout_stack>
-</panel>
diff --git a/indra/newview/skins/default/xui/zh/panel_profile_view.xml b/indra/newview/skins/default/xui/zh/panel_profile_view.xml
deleted file mode 100644
index 2684287692f4fc0eab6ce10c4d647d96a3314530..0000000000000000000000000000000000000000
--- a/indra/newview/skins/default/xui/zh/panel_profile_view.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel name="panel_target_profile">
-	<string name="status_online">
-		上線
-	</string>
-	<string name="status_offline">
-		離線
-	</string>
-	<text name="display_name_label" value="顯示名稱:"/>
-	<text name="solo_username_label" value="使用者名稱:"/>
-	<text name="status" value="上線"/>
-	<text name="user_name_small" value="Jack oh look at me this is a super duper long name"/>
-	<button name="copy_to_clipboard" tool_tip="覆製到剪貼簿"/>
-	<text name="user_label" value="使用者名稱:"/>
-	<tab_container name="tabs">
-		<panel label="檔案" name="panel_profile"/>
-		<panel label="精選地點" name="panel_picks"/>
-		<panel label="NOTES &amp; PRIVACY" name="panel_notes"/>
-	</tab_container>
-</panel>
diff --git a/indra/newview/skins/paths.xml b/indra/newview/skins/paths.xml
index e6d68488ea0622426386bb12d705888d556f51c2..3c0da041c770566a813f364829177d42da85e1bb 100644
--- a/indra/newview/skins/paths.xml
+++ b/indra/newview/skins/paths.xml
@@ -1,4 +1,4 @@
-<paths>
+<paths> 
 	<directory>
     <subdir>xui</subdir>
     <subdir>en</subdir>
diff --git a/indra/newview/tests/llworldmipmap_test.cpp b/indra/newview/tests/llworldmipmap_test.cpp
index 4c0959d1a939205a414fa5a8c7662529a713a07c..e7ef0177608558651de83f6fa2d27a8d05dbf6c7 100644
--- a/indra/newview/tests/llworldmipmap_test.cpp
+++ b/indra/newview/tests/llworldmipmap_test.cpp
@@ -100,9 +100,9 @@ namespace tut
 	{
 		S32 level = mMap->scaleToLevel(0.0);
 		ensure("scaleToLevel() test 1 failed", level == LLWorldMipmap::MAP_LEVELS);
-		level = mMap->scaleToLevel(LLWorldMipmap::MAP_TILE_SIZE);
+		level = mMap->scaleToLevel((F32)LLWorldMipmap::MAP_TILE_SIZE);
 		ensure("scaleToLevel() test 2 failed", level == 1);
-		level = mMap->scaleToLevel(10 * LLWorldMipmap::MAP_TILE_SIZE);
+		level = mMap->scaleToLevel(10.f * LLWorldMipmap::MAP_TILE_SIZE);
 		ensure("scaleToLevel() test 3 failed", level == 1);
 	}
 	// Test 2 : globalToMipmap()
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
old mode 100755
new mode 100644
index 0931c4ec9b81b10557b1a3ecbd3d424a43180e0c..9bf755c8f8eba58148ed53617becf13039353ef4
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -1047,9 +1047,13 @@ def construct(self):
             self.path("libuuid.so.16")
             self.path("libuuid.so.16.0.22")
             self.path("libSDL-1.2.so.0.11.3")
+            self.path("libSDL-1.2.so.0")
             self.path("libdirectfb-1.4.so.5.0.4")
+            self.path("libdirectfb-1.4.so.5")
             self.path("libfusion-1.4.so.5.0.4")
+            self.path("libfusion-1.4.so.5")
             self.path("libdirect-1.4.so.5.0.4")
+            self.path("libdirect-1.4.so.5")
             self.path("libopenjpeg.so.1.4.0")
             self.path("libopenjpeg.so.1")
             self.path("libopenjpeg.so")
diff --git a/indra/test/llsd_new_tut.cpp b/indra/test/llsd_new_tut.cpp
index b2fa54a6886a37b27af742eb0a6bd65738203617..f928a1bad0e6176af82a175428298f3b4f637ad4 100644
--- a/indra/test/llsd_new_tut.cpp
+++ b/indra/test/llsd_new_tut.cpp
@@ -25,6 +25,7 @@
  * $/LicenseInfo$
  */
 
+#define LLSD_DEBUG_INFO
 #include <tut/tut.hpp>
 #include "linden_common.h"
 #include "lltut.h"
@@ -52,11 +53,11 @@ namespace tut
 	private:
 		U32	mOutstandingAtStart;
 	public:
-		SDCleanupCheck() : mOutstandingAtStart(LLSD::outstandingCount()) { }
+		SDCleanupCheck() : mOutstandingAtStart(llsd::outstandingCount()) { }
 		~SDCleanupCheck()
 		{
 			ensure_equals("SDCleanupCheck",
-				LLSD::outstandingCount(), mOutstandingAtStart);
+				llsd::outstandingCount(), mOutstandingAtStart);
 		}
 	};
 
@@ -70,12 +71,12 @@ namespace tut
 		SDAllocationCheck(const std::string& message, int expectedAllocations)
 			: mMessage(message),
 			mExpectedAllocations(expectedAllocations),
-			mAllocationAtStart(LLSD::allocationCount())
+			mAllocationAtStart(llsd::allocationCount())
 			{ }
 		~SDAllocationCheck()
 		{
 			ensure_equals(mMessage + " SDAllocationCheck",
-				LLSD::allocationCount() - mAllocationAtStart,
+				llsd::allocationCount() - mAllocationAtStart,
 				mExpectedAllocations);
 		}
 	};
@@ -753,6 +754,42 @@ namespace tut
 			w = "nice day";
 		}
 
+		{
+			SDAllocationCheck check("shared values test for threaded work", 9);
+
+			//U32 start_llsd_count = llsd::outstandingCount();
+
+			LLSD m = LLSD::emptyMap();
+
+			m["one"] = 1;
+			m["two"] = 2;
+			m["one_copy"] = m["one"];			// 3 (m, "one" and "two")
+
+			m["undef_one"] = LLSD();
+			m["undef_two"] = LLSD();
+			m["undef_one_copy"] = m["undef_one"];
+
+			{	// Ensure first_array gets freed to avoid counting it
+				LLSD first_array = LLSD::emptyArray();
+				first_array.append(1.0f);
+				first_array.append(2.0f);			
+				first_array.append(3.0f);			// 7
+
+				m["array"] = first_array;
+				m["array_clone"] = first_array;
+				m["array_copy"] = m["array"];		// 7
+			}
+
+			m["string_one"] = "string one value";
+			m["string_two"] = "string two value";
+			m["string_one_copy"] = m["string_one"];		// 9
+
+			//U32 llsd_object_count = llsd::outstandingCount();
+			//std::cout << "Using " << (llsd_object_count - start_llsd_count) << " LLSD objects" << std::endl;
+
+			//m.dumpStats();
+		}
+
 		{
 			SDAllocationCheck check("shared values test for threaded work", 9);
 
diff --git a/indra/test/lltut.cpp b/indra/test/lltut.cpp
index da7031b52a828e2bd2932ab5e14b4d4a38dae977..c43a8f0c7d7dba03e7ebc58cafc652b82ea6cc5c 100644
--- a/indra/test/lltut.cpp
+++ b/indra/test/lltut.cpp
@@ -34,6 +34,7 @@
 #include "llformat.h"
 #include "llsd.h"
 #include "lluri.h"
+#include "stringize.h"
 
 namespace tut
 {
@@ -144,6 +145,10 @@ namespace tut
 				}
 				return;
 			}
+			default:
+				// should never get here, but compiler produces warning if we
+				// don't cover this case, and at Linden warnings are fatal.
+				throw failure(STRINGIZE("invalid type field " << actual.type()));
 		}
 	}
 
diff --git a/indra/test/test.cpp b/indra/test/test.cpp
index ffdb0cb976a311f79a8233ddc4fa7409f139473e..e58e7293fb754e544c5f2b6f927e2bb118d3e087 100644
--- a/indra/test/test.cpp
+++ b/indra/test/test.cpp
@@ -37,6 +37,7 @@
 #include "linden_common.h"
 #include "llerrorcontrol.h"
 #include "lltut.h"
+#include "stringize.h"
 
 #include "apr_pools.h"
 #include "apr_getopt.h"
@@ -53,6 +54,22 @@
 #include <gtest/gtest.h>
 #endif
 
+#if LL_MSVC
+#pragma warning (push)
+#pragma warning (disable : 4702) // warning C4702: unreachable code
+#endif
+#include <boost/iostreams/tee.hpp>
+#include <boost/iostreams/stream.hpp>
+#if LL_MSVC
+#pragma warning (pop)
+#endif
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/make_shared.hpp>
+#include <boost/foreach.hpp>
+#include <boost/lambda/lambda.hpp>
+
 namespace tut
 {
 	std::string sSourceDir;
@@ -69,8 +86,24 @@ class LLTestCallback : public tut::callback
 	mPassedTests(0),
 	mFailedTests(0),
 	mSkippedTests(0),
-	mStream(stream)
+	// By default, capture a shared_ptr to std::cout, with a no-op "deleter"
+	// so that destroying the shared_ptr makes no attempt to delete std::cout.
+	mStream(boost::shared_ptr<std::ostream>(&std::cout, boost::lambda::_1))
 	{
+		if (stream)
+		{
+			// We want a boost::iostreams::tee_device that will stream to two
+			// std::ostreams.
+			typedef boost::iostreams::tee_device<std::ostream, std::ostream> TeeDevice;
+			// More than that, though, we want an actual stream using that
+			// device.
+			typedef boost::iostreams::stream<TeeDevice> TeeStream;
+			// Allocate and assign in two separate steps, per Herb Sutter.
+			// (Until we turn on C++11 support, have to wrap *stream with
+			// boost::ref() due to lack of perfect forwarding.)
+			boost::shared_ptr<std::ostream> pstream(new TeeStream(std::cout, boost::ref(*stream)));
+			mStream = pstream;
+		}
 	}
 
 	~LLTestCallback()
@@ -83,18 +116,21 @@ class LLTestCallback : public tut::callback
 	}
 
 	virtual void group_started(const std::string& name) {
-		std::cout << "Unit test group_started name=" << name << std::endl;
+		*mStream << "Unit test group_started name=" << name << std::endl;
 	}
 
 	virtual void group_completed(const std::string& name) {
-		std::cout << "Unit test group_completed name=" << name << std::endl;
+		*mStream << "Unit test group_completed name=" << name << std::endl;
 	}
 
 	virtual void test_completed(const tut::test_result& tr)
 	{
 		++mTotalTests;
 		std::ostringstream out;
-		out << "[" << tr.group << ", " << tr.test << "] ";
+		out << "[" << tr.group << ", " << tr.test;
+		if (! tr.name.empty())
+			out << ": " << tr.name;
+		out << "] ";
 		switch(tr.result)
 		{
 			case tut::test_result::ok:
@@ -123,56 +159,43 @@ class LLTestCallback : public tut::callback
 				break;
 			default:
 				++mFailedTests;
-				out << "unknown";
+				out << "unknown (tr.result == " << tr.result << ")";
 		}
 		if(mVerboseMode || (tr.result != tut::test_result::ok))
 		{
+			*mStream << out.str();
 			if(!tr.message.empty())
 			{
-				out << ": '" << tr.message << "'";
-			}
-			if (mStream)
-			{
-				*mStream << out.str() << std::endl;
+				*mStream << ": '" << tr.message << "'";
 			}
-			
-			std::cout << out.str() << std::endl;
-		}
-	}
-
-	virtual void run_completed()
-	{
-		if (mStream)
-		{
-			run_completed_(*mStream);
+			*mStream << std::endl;
 		}
-		run_completed_(std::cout);
 	}
 
 	virtual int getFailedTests() const { return mFailedTests; }
 
-	virtual void run_completed_(std::ostream &stream)
+	virtual void run_completed()
 	{
-		stream << "\tTotal Tests:\t" << mTotalTests << std::endl;
-		stream << "\tPassed Tests:\t" << mPassedTests;
+		*mStream << "\tTotal Tests:\t" << mTotalTests << std::endl;
+		*mStream << "\tPassed Tests:\t" << mPassedTests;
 		if (mPassedTests == mTotalTests)
 		{
-			stream << "\tYAY!! \\o/";
+			*mStream << "\tYAY!! \\o/";
 		}
-		stream << std::endl;
+		*mStream << std::endl;
 
 		if (mSkippedTests > 0)
 		{
-			stream << "\tSkipped known failures:\t" << mSkippedTests
+			*mStream << "\tSkipped known failures:\t" << mSkippedTests
 			<< std::endl;
 		}
 
 		if(mFailedTests > 0)
 		{
-			stream << "*********************************" << std::endl;
-			stream << "Failed Tests:\t" << mFailedTests << std::endl;
-			stream << "Please report or fix the problem." << std::endl;
-			stream << "*********************************" << std::endl;
+			*mStream << "*********************************" << std::endl;
+			*mStream << "Failed Tests:\t" << mFailedTests << std::endl;
+			*mStream << "Please report or fix the problem." << std::endl;
+			*mStream << "*********************************" << std::endl;
 		}
 	}
 
@@ -182,7 +205,7 @@ class LLTestCallback : public tut::callback
 	int mPassedTests;
 	int mFailedTests;
 	int mSkippedTests;
-	std::ostream *mStream;
+	boost::shared_ptr<std::ostream> mStream;
 };
 
 // TeamCity specific class which emits service messages
@@ -192,84 +215,111 @@ class LLTCTestCallback : public LLTestCallback
 {
 public:
 	LLTCTestCallback(bool verbose_mode, std::ostream *stream) :
-		LLTestCallback(verbose_mode, stream),
-		mTCStream()
+		LLTestCallback(verbose_mode, stream)
 	{
 	}
 
 	~LLTCTestCallback()
 	{
-	}	
+	}
 
 	virtual void group_started(const std::string& name) {
 		LLTestCallback::group_started(name);
-		mTCStream << "\n##teamcity[testSuiteStarted name='" << name << "']" << std::endl;
+		std::cout << "\n##teamcity[testSuiteStarted name='" << escape(name) << "']" << std::endl;
 	}
 
 	virtual void group_completed(const std::string& name) {
 		LLTestCallback::group_completed(name);
-		mTCStream << "##teamcity[testSuiteFinished name='" << name << "']" << std::endl;
+		std::cout << "##teamcity[testSuiteFinished name='" << escape(name) << "']" << std::endl;
 	}
 
 	virtual void test_completed(const tut::test_result& tr)
 	{
+		std::string testname(STRINGIZE(tr.group << "." << tr.test));
+		if (! tr.name.empty())
+		{
+			testname.append(":");
+			testname.append(tr.name);
+		}
+		testname = escape(testname);
+
+		// Sadly, tut::callback doesn't give us control at test start; have to
+		// backfill start message into TC output.
+		std::cout << "##teamcity[testStarted name='" << testname << "']" << std::endl;
+
+		// now forward call to base class so any output produced there is in
+		// the right TC context
 		LLTestCallback::test_completed(tr);
 
 		switch(tr.result)
 		{
 			case tut::test_result::ok:
-				mTCStream << "##teamcity[testStarted name='" << tr.group << "." << tr.test << "']" << std::endl;
-				mTCStream << "##teamcity[testFinished name='" << tr.group << "." << tr.test << "']" << std::endl;
 				break;
+
 			case tut::test_result::fail:
-				mTCStream << "##teamcity[testStarted name='" << tr.group << "." << tr.test << "']" << std::endl;
-				mTCStream << "##teamcity[testFailed name='" << tr.group << "." << tr.test << "' message='" << tr.message << "']" << std::endl;
-				mTCStream << "##teamcity[testFinished name='" << tr.group << "." << tr.test << "']" << std::endl;
-				break;
 			case tut::test_result::ex:
-				mTCStream << "##teamcity[testStarted name='" << tr.group << "." << tr.test << "']" << std::endl;
-				mTCStream << "##teamcity[testFailed name='" << tr.group << "." << tr.test << "' message='" << tr.message << "']" << std::endl;
-				mTCStream << "##teamcity[testFinished name='" << tr.group << "." << tr.test << "']" << std::endl;
-				break;
 			case tut::test_result::warn:
-				mTCStream << "##teamcity[testStarted name='" << tr.group << "." << tr.test << "']" << std::endl;
-				mTCStream << "##teamcity[testFailed name='" << tr.group << "." << tr.test << "' message='" << tr.message << "']" << std::endl;
-				mTCStream << "##teamcity[testFinished name='" << tr.group << "." << tr.test << "']" << std::endl;
-				break;
 			case tut::test_result::term:
-				mTCStream << "##teamcity[testStarted name='" << tr.group << "." << tr.test << "']" << std::endl;
-				mTCStream << "##teamcity[testFailed name='" << tr.group << "." << tr.test << "' message='" << tr.message << "']" << std::endl;
-				mTCStream << "##teamcity[testFinished name='" << tr.group << "." << tr.test << "']" << std::endl;
+				std::cout << "##teamcity[testFailed name='" << testname
+						  << "' message='" << escape(tr.message) << "']" << std::endl;
 				break;
+
 			case tut::test_result::skip:
-				mTCStream << "##teamcity[testStarted name='" << tr.group << "." << tr.test << "']" << std::endl;
-				mTCStream << "##teamcity[testIgnored name='" << tr.group << "." << tr.test << "']" << std::endl;
-				mTCStream << "##teamcity[testFinished name='" << tr.group << "." << tr.test << "']" << std::endl;
+				std::cout << "##teamcity[testIgnored name='" << testname << "']" << std::endl;
 				break;
+
 			default:
 				break;
 		}
 
+		std::cout << "##teamcity[testFinished name='" << testname << "']" << std::endl;
 	}
 
-	virtual void run_completed()
+	static std::string escape(const std::string& str)
 	{
-		LLTestCallback::run_completed();
-
-		// dump the TC reporting results to cout
-		tc_run_completed_(std::cout);
-	}
-
-	virtual void tc_run_completed_(std::ostream &stream)
-	{
-		
-		// dump the TC reporting results to cout
-		stream << mTCStream.str() << std::endl;
+		// Per http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ServiceMessages
+		std::string result;
+		BOOST_FOREACH(char c, str)
+		{
+			switch (c)
+			{
+			case '\'':
+				result.append("|'");
+				break;
+			case '\n':
+				result.append("|n");
+				break;
+			case '\r':
+				result.append("|r");
+				break;
+/*==========================================================================*|
+			// These are not possible 'char' values from a std::string.
+			case '\u0085':			// next line
+				result.append("|x");
+				break;
+			case '\u2028':			// line separator
+				result.append("|l");
+				break;
+			case '\u2029':			// paragraph separator
+				result.append("|p");
+				break;
+|*==========================================================================*/
+			case '|':
+				result.append("||");
+				break;
+			case '[':
+				result.append("|[");
+				break;
+			case ']':
+				result.append("|]");
+				break;
+			default:
+				result.push_back(c);
+				break;
+			}
+		}
+		return result;
 	}
-	
-protected:
-	std::ostringstream mTCStream;
-
 };
 
 
@@ -359,7 +409,7 @@ int main(int argc, char **argv)
 	apr_getopt_t* os = NULL;
 	if(APR_SUCCESS != apr_getopt_init(&os, pool, argc, argv))
 	{
-		std::cerr << "Unable to  pool" << std::endl;
+		std::cerr << "apr_getopt_init() failed" << std::endl;
 		return 1;
 	}
 
@@ -373,7 +423,7 @@ int main(int argc, char **argv)
 	apr_status_t apr_err;
 	const char* opt_arg = NULL;
 	int opt_id = 0;
-	std::ofstream *output = NULL;
+	boost::scoped_ptr<std::ofstream> output;
 	const char *touch = NULL;
 
 	while(true)
@@ -403,7 +453,7 @@ int main(int argc, char **argv)
 				verbose_mode = true;
 				break;
 			case 'o':
-				output = new std::ofstream;
+				output.reset(new std::ofstream);
 				output->open(opt_arg);
 				break;
 			case 's':	// --sourcedir
@@ -437,11 +487,11 @@ int main(int argc, char **argv)
 	LLTestCallback* mycallback;
 	if (getenv("TEAMCITY_PROJECT_NAME"))
 	{
-		mycallback = new LLTCTestCallback(verbose_mode, output);		
+		mycallback = new LLTCTestCallback(verbose_mode, output.get());		
 	}
 	else
 	{
-		mycallback = new LLTestCallback(verbose_mode, output);
+		mycallback = new LLTestCallback(verbose_mode, output.get());
 	}
 
 	tut::runner.get().set_callback(mycallback);
@@ -463,12 +513,6 @@ int main(int argc, char **argv)
 		std::cin.get();
 	}
 
-	if (output)
-	{
-		output->close();
-		delete output;
-	}
-
 	if (touch && success)
 	{
 		std::ofstream s;
diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp
index e88d1bf811d726056cf63c03ccb5a1910f20b3a4..19ac418e9efb197982fc03adbc61fba8bee3a6f6 100644
--- a/indra/viewer_components/updater/llupdatedownloader.cpp
+++ b/indra/viewer_components/updater/llupdatedownloader.cpp
@@ -39,7 +39,7 @@
 #include "llsdserialize.h"
 #include "llthread.h"
 #include "llupdaterservice.h"
-
+#include "llcurl.h"
 
 class LLUpdateDownloader::Implementation:
 	public LLThread
@@ -198,13 +198,19 @@ LLUpdateDownloader::Implementation::Implementation(LLUpdateDownloader::Client &
 
 LLUpdateDownloader::Implementation::~Implementation()
 {
-	if(isDownloading()) {
+	if(isDownloading()) 
+	{
 		cancel();
 		shutdown();
-	} else {
+	} 
+	else 
+	{
 		; // No op.
 	}
-	if(mCurl) curl_easy_cleanup(mCurl);
+	if(mCurl)
+	{
+		LLCurl::deleteEasyHandle(mCurl);
+	}
 }
 
 
@@ -406,9 +412,12 @@ void LLUpdateDownloader::Implementation::run(void)
 
 void LLUpdateDownloader::Implementation::initializeCurlGet(std::string const & url, bool processHeader)
 {
-	if(mCurl == 0) {
-		mCurl = curl_easy_init();
-	} else {
+	if(mCurl == 0) 
+	{
+		mCurl = LLCurl::newEasyHandle();
+	} 
+	else 
+	{
 		curl_easy_reset(mCurl);
 	}
 	
diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp
index 1888f191e2f4ed40c98bfe8439350ed59181dab6..2e18218667c3b7d0ba5708dcdeb43737ef31d109 100644
--- a/indra/viewer_components/updater/llupdaterservice.cpp
+++ b/indra/viewer_components/updater/llupdaterservice.cpp
@@ -447,7 +447,7 @@ void LLUpdaterServiceImpl::restartTimer(unsigned int seconds)
 	LL_INFOS("UpdaterService") << "will check for update again in " << 
 	seconds << " seconds" << LL_ENDL; 
 	mTimer.start();
-	mTimer.setTimerExpirySec(seconds);
+	mTimer.setTimerExpirySec((F32)seconds);
 	LLEventPumps::instance().obtain("mainloop").listen(
 		sListenerName, boost::bind(&LLUpdaterServiceImpl::onMainLoop, this, _1));
 }
diff --git a/indra/viewer_components/updater/scripts/darwin/update_install b/indra/viewer_components/updater/scripts/darwin/update_install
old mode 100755
new mode 100644
diff --git a/indra/viewer_components/updater/scripts/linux/update_install b/indra/viewer_components/updater/scripts/linux/update_install
old mode 100755
new mode 100644
diff --git a/indra/win_crash_logger/llcrashloggerwindows.cpp b/indra/win_crash_logger/llcrashloggerwindows.cpp
old mode 100755
new mode 100644