diff --git a/.hgtags b/.hgtags
index 8d5f290ff62739cc926576c0b0710a89f7035eb8..2f6fd6e0e7b84d03cf99269eb32e24cf60a90c57 100644
--- a/.hgtags
+++ b/.hgtags
@@ -79,3 +79,13 @@ b53a0576eec80614d7767ed72b40ed67aeff27c9 2.5.2-release
 f1827b441e05bf37c68e2c15ebc6d09e9b03f527 2.6.0-start
 f1827b441e05bf37c68e2c15ebc6d09e9b03f527 2.6.0-start
 4e9eec6a347f89b2b3f295beb72f1cf7837dff66 2.6.0-start
+9283d6d1d7eb71dfe4c330e7c9144857e7356bde 2.6.0-beta1
+9283d6d1d7eb71dfe4c330e7c9144857e7356bde DRTVWR-40_2.6.0-beta1
+c5bdef3aaa2744626aef3c217ce29e1900d357b3 2.6.1-start
+c5bdef3aaa2744626aef3c217ce29e1900d357b3 DRTVWR-43_2.6.1-beta1
+c5bdef3aaa2744626aef3c217ce29e1900d357b3 2.6.1-beta1
+9e4641f4a7870c0f565a25a2971368d5a29516a1 DRTVWR-41_2.6.0-beta2
+9e4641f4a7870c0f565a25a2971368d5a29516a1 2.6.0-beta2
+56b2778c743c2a964d82e1caf11084d76a87de2c 2.6.2-start
+c5bdef3aaa2744626aef3c217ce29e1900d357b3 DRTVWR-43_2.6.1-beta1
+c5bdef3aaa2744626aef3c217ce29e1900d357b3 2.6.1-beta1
diff --git a/BuildParams b/BuildParams
index 3ce41adc3a7945a8ade15b86686d2478344da68c..3684a3f641388e60857d9b9df7c3a134f49fb277 100644
--- a/BuildParams
+++ b/BuildParams
@@ -156,7 +156,11 @@ media.build_viewer_update_version_manager = false
 # oz
 # ================
 
-oz_viewer-devreview.build_debug_release_separately = true
+oz-viewer-devreview.build_debug_release_separately = true
+oz_viewer-poreview.build_debug_release_separately = true
+oz-project-1.build_debug_release_separately = true
+oz-project-2.build_debug_release_separately = true
+oz-project-3.build_debug_release_separately = true
 
 # ========================================
 # enus
diff --git a/doc/contributions.txt b/doc/contributions.txt
index 560bedd518ef062f96be82462bc3a54563effd62..53ed2b97515bfba893f31dc2c37406c1a4225948 100644
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -413,6 +413,7 @@ Jonathan Yap
 	STORM-990
 	STORM-1020
 	STORM-1064
+	STORM-1077
 Kage Pixel
 	VWR-11
 Ken March
diff --git a/indra/integration_tests/CMakeLists.txt b/indra/integration_tests/CMakeLists.txt
index 67e8fbf1f2c0cd6fbaf6d9d7c9076a8281c6494a..5935f23fe9fe9ad725607b3b1a43f454b161c61b 100644
--- a/indra/integration_tests/CMakeLists.txt
+++ b/indra/integration_tests/CMakeLists.txt
@@ -1,3 +1,4 @@
 # -*- cmake -*-
 
 add_subdirectory(llui_libtest)
+add_subdirectory(llimage_libtest)
diff --git a/indra/integration_tests/llimage_libtest/CMakeLists.txt b/indra/integration_tests/llimage_libtest/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..f59440be6bfc1d437f0705f247f223431f44ec22
--- /dev/null
+++ b/indra/integration_tests/llimage_libtest/CMakeLists.txt
@@ -0,0 +1,131 @@
+# -*- cmake -*-
+
+# Integration tests of the llimage library (JPEG2000, PNG, jpeg, etc... images reading and writing)
+
+project (llimage_libtest)
+
+include(00-Common)
+include(LLCommon)
+include(Linking)
+include(LLSharedLibs)
+include(LLImage)
+include(LLImageJ2COJ) 
+include(LLKDU)
+include(LLMath)
+include(LLVFS)
+
+include_directories(
+    ${LLCOMMON_INCLUDE_DIRS}
+    ${LLVFS_INCLUDE_DIRS}
+    ${LLIMAGE_INCLUDE_DIRS}
+    ${LLMATH_INCLUDE_DIRS}
+    )
+
+set(llimage_libtest_SOURCE_FILES
+    llimage_libtest.cpp
+    )
+
+set(llimage_libtest_HEADER_FILES
+    CMakeLists.txt
+    llimage_libtest.h
+    )
+
+set_source_files_properties(${llimage_libtest_HEADER_FILES}
+                            PROPERTIES HEADER_FILE_ONLY TRUE)
+
+list(APPEND llimage_libtest_SOURCE_FILES ${llimage_libtest_HEADER_FILES})
+
+add_executable(llimage_libtest
+    WIN32
+    MACOSX_BUNDLE
+    ${llimage_libtest_SOURCE_FILES}
+)
+
+set_target_properties(llimage_libtest
+    PROPERTIES
+    WIN32_EXECUTABLE
+    FALSE
+)
+
+# OS-specific libraries
+if (DARWIN)
+  include(CMakeFindFrameworks)
+  find_library(COREFOUNDATION_LIBRARY CoreFoundation)
+  set(OS_LIBRARIES ${COREFOUNDATION_LIBRARY})
+elseif (WINDOWS)
+#  set(OS_LIBRARIES)
+elseif (LINUX)
+#  set(OS_LIBRARIES)
+else (DARWIN)
+  message(FATAL_ERROR "Unknown platform")
+endif (DARWIN)
+
+# Libraries on which this application depends on
+# Sort by high-level to low-level
+target_link_libraries(llimage_libtest
+	${LLCOMMON_LIBRARIES}
+	${LLVFS_LIBRARIES}
+    ${LLIMAGE_LIBRARIES}
+    ${LLKDU_LIBRARIES}
+    ${KDU_LIBRARY}
+    ${LLIMAGEJ2COJ_LIBRARIES}
+    ${OS_LIBRARIES}
+    )
+	
+if (DARWIN)
+  # Path inside the app bundle where we'll need to copy libraries
+  set(LLIMAGE_LIBTEST_DESTINATION_DIR
+    ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llimage_libtest.app/Contents/Resources
+  )
+  # Create the Contents/Resources directory
+  add_custom_command(
+    TARGET llimage_libtest POST_BUILD
+    COMMAND ${CMAKE_COMMAND}
+    ARGS
+      -E
+      make_directory
+      ${LLIMAGE_LIBTEST_DESTINATION_DIR}
+    COMMENT "Creating Resources directory in app bundle."
+  ) 
+else (DARWIN)
+  set(LLIMAGE_LIBTEST_DESTINATION_DIR
+    ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/
+  )
+endif (DARWIN)
+
+get_target_property(BUILT_LLCOMMON llcommon LOCATION)
+add_custom_command(TARGET llimage_libtest POST_BUILD
+  COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_LLCOMMON}  ${LLIMAGE_LIBTEST_DESTINATION_DIR}
+  DEPENDS ${BUILT_LLCOMMON}
+)
+
+if (DARWIN)
+  # Copy the required libraries to the package app
+  add_custom_command(TARGET llimage_libtest POST_BUILD
+    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libapr-1.0.3.7.dylib ${LLIMAGE_LIBTEST_DESTINATION_DIR}
+    DEPENDS ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libapr-1.0.3.7.dylib
+  )
+ add_custom_command(TARGET llimage_libtest POST_BUILD
+    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libaprutil-1.0.3.8.dylib ${LLIMAGE_LIBTEST_DESTINATION_DIR}
+    DEPENDS ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libaprutil-1.0.3.8.dylib
+  )
+  add_custom_command(TARGET llimage_libtest POST_BUILD
+    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libexception_handler.dylib ${LLIMAGE_LIBTEST_DESTINATION_DIR}
+    DEPENDS ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libexception_handler.dylib
+  )
+  add_custom_command(TARGET llimage_libtest POST_BUILD
+    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libexpat.0.5.0.dylib ${LLIMAGE_LIBTEST_DESTINATION_DIR}
+    DEPENDS ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libexpat.0.5.0.dylib
+  )
+endif (DARWIN)
+
+if (WINDOWS)
+  # Check indra/test_apps/llplugintest/CMakeLists.txt for an example of what to copy over for Windows and how
+endif (WINDOWS)
+
+# Ensure people working on the viewer don't break this library
+# *NOTE: This could be removed, or only built by TeamCity, if the build
+# and link times become too long.
+add_dependencies(viewer llimage_libtest)
+
+ll_deploy_sharedlibs_command(llimage_libtest) 
diff --git a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..365f5f758cdb9c5547814fb57fa6b151863b043a
--- /dev/null
+++ b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp
@@ -0,0 +1,437 @@
+/** 
+ * @file llimage_libtest.cpp
+ * @author Merov Linden
+ * @brief Integration test for the llimage library
+ *
+ * $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$
+ */
+#include "linden_common.h"
+#include "llpointer.h"
+#include "lltimer.h"
+
+#include "llimage_libtest.h"
+
+// Linden library includes
+#include "llimage.h"
+#include "llimagejpeg.h"
+#include "llimagepng.h"
+#include "llimagebmp.h"
+#include "llimagetga.h"
+#include "llimagej2c.h"
+#include "lldir.h"
+
+// system libraries
+#include <iostream>
+
+// doc string provided when invoking the program with --help 
+static const char USAGE[] = "\n"
+"usage:\tllimage_libtest [options]\n"
+"\n"
+" -h, --help\n"
+"        Print this help\n"
+" -i, --input <file1 .. file2>\n"
+"        List of image files to load and convert. Patterns with wild cards can be used.\n"
+" -o, --output <file1 .. file2> OR <type>\n"
+"        List of image files to create (assumes same order as for input files)\n"
+"        OR 3 letters file type extension to convert each input file into.\n"
+" -log, --logmetrics <metric>\n"
+"        Log performance data for <metric>. Results in <metric>.slp\n"
+"        Note: so far, only ImageCompressionTester has been tested.\n"
+" -r, --analyzeperformance\n"
+"        Create a report comparing <metric>_baseline.slp with current <metric>.slp\n"
+"        Results in <metric>_report.csv"
+" -s, --image-stats\n"
+"        Output stats for each input and output image.\n"
+"\n";
+
+// true when all image loading is done. Used by metric logging thread to know when to stop the thread.
+static bool sAllDone = false;
+
+// Create an empty formatted image instance of the correct type from the filename
+LLPointer<LLImageFormatted> create_image(const std::string &filename)
+{
+	std::string exten = gDirUtilp->getExtension(filename);
+	U32 codec = LLImageBase::getCodecFromExtension(exten);
+	
+	LLPointer<LLImageFormatted> image;
+	switch (codec)
+	{
+		case IMG_CODEC_BMP:
+			image = new LLImageBMP();
+			break;
+		case IMG_CODEC_TGA:
+			image = new LLImageTGA();
+			break;
+		case IMG_CODEC_JPEG:
+			image = new LLImageJPEG();
+			break;
+		case IMG_CODEC_J2C:
+			image = new LLImageJ2C();
+			break;
+		case IMG_CODEC_PNG:
+			image = new LLImagePNG();
+			break;
+		default:
+			return NULL;
+	}
+	
+	return image;
+}
+
+void output_image_stats(LLPointer<LLImageFormatted> image, const std::string &filename)
+{
+	// Print out some statistical data on the image
+	std::cout << "Image stats for : " << filename << ", extension : " << image->getExtension() << std::endl;
+
+	std::cout << "    with : " << (int)(image->getWidth())       << ", height : " << (int)(image->getHeight())       << std::endl;
+	std::cout << "    comp : " << (int)(image->getComponents())  << ", levels : " << (int)(image->getDiscardLevel()) << std::endl;
+	std::cout << "    head : " << (int)(image->calcHeaderSize()) << ",   data : " << (int)(image->getDataSize())     << std::endl;
+
+	return;
+}
+
+// Load an image from file and return a raw (decompressed) instance of its data
+LLPointer<LLImageRaw> load_image(const std::string &src_filename, bool output_stats)
+{
+	LLPointer<LLImageFormatted> image = create_image(src_filename);
+
+	if (!image->load(src_filename))
+	{
+		return NULL;
+	}
+	
+	if(	(image->getComponents() != 3) && (image->getComponents() != 4) )
+	{
+		std::cout << "Image files with less than 3 or more than 4 components are not supported\n";
+		return NULL;
+	}
+	
+	if (output_stats)
+	{
+		output_image_stats(image, src_filename);
+	}
+	
+	LLPointer<LLImageRaw> raw_image = new LLImageRaw;
+	if (!image->decode(raw_image, 0.0f))
+	{
+		return NULL;
+	}
+	
+	return raw_image;
+}
+
+// Save a raw image instance into a file
+bool save_image(const std::string &dest_filename, LLPointer<LLImageRaw> raw_image, bool output_stats)
+{
+	LLPointer<LLImageFormatted> image = create_image(dest_filename);
+	
+	if (!image->encode(raw_image, 0.0f))
+	{
+		return false;
+	}
+	
+	if (output_stats)
+	{
+		output_image_stats(image, dest_filename);
+	}
+
+	return image->save(dest_filename);
+}
+
+void store_input_file(std::list<std::string> &input_filenames, const std::string &path)
+{
+	// Break the incoming path in its components
+	std::string dir = gDirUtilp->getDirName(path);
+	std::string name = gDirUtilp->getBaseFileName(path);
+	std::string exten = gDirUtilp->getExtension(path);
+
+	// std::cout << "store_input_file : " << path << ", dir : " << dir << ", name : " << name << ", exten : " << exten << std::endl;
+	
+	// If extension is not an image type or "*", exit
+	// Note: we don't support complex patterns for the extension like "j??"
+	// Note: on most shells, the pattern expansion is done by the shell so that pattern matching limitation is actually not a problem
+	if ((exten.compare("*") != 0) && (LLImageBase::getCodecFromExtension(exten) == IMG_CODEC_INVALID))
+	{
+		return;
+	}
+
+	if ((name.find('*') != -1) || ((name.find('?') != -1)))
+	{
+		// If file name is a pattern, iterate to get each file name and store
+		std::string next_name;
+		while (gDirUtilp->getNextFileInDir(dir,name,next_name))
+		{
+			std::string file_name = dir + gDirUtilp->getDirDelimiter() + next_name;
+			input_filenames.push_back(file_name);
+		}
+	}
+	else
+	{
+		// Verify that the file does exist before storing 
+		if (gDirUtilp->fileExists(path))
+		{
+			input_filenames.push_back(path);
+		}
+		else
+		{
+			std::cout << "store_input_file : the file " << path << " could not be found" << std::endl;
+		}
+	}	
+}
+
+void store_output_file(std::list<std::string> &output_filenames, std::list<std::string> &input_filenames, const std::string &path)
+{
+	// Break the incoming path in its components
+	std::string dir = gDirUtilp->getDirName(path);
+	std::string name = gDirUtilp->getBaseFileName(path);
+	std::string exten = gDirUtilp->getExtension(path);
+	
+	// std::cout << "store_output_file : " << path << ", dir : " << dir << ", name : " << name << ", exten : " << exten << std::endl;
+	
+	if (dir.empty() && exten.empty())
+	{
+		// If dir and exten are empty, we interpret the name as a file extension type name and will iterate through input list to populate the output list
+		exten = name;
+		// Make sure the extension is an image type
+		if (LLImageBase::getCodecFromExtension(exten) == IMG_CODEC_INVALID)
+		{
+			return;
+		}
+		std::string delim = gDirUtilp->getDirDelimiter();
+		std::list<std::string>::iterator in_file  = input_filenames.begin();
+		std::list<std::string>::iterator end = input_filenames.end();
+		for (; in_file != end; ++in_file)
+		{
+			dir = gDirUtilp->getDirName(*in_file);
+			name = gDirUtilp->getBaseFileName(*in_file,true);
+			std::string file_name;
+			if (!dir.empty())
+			{
+				file_name = dir + delim + name + "." + exten;
+			}
+			else
+			{
+				file_name = name + "." + exten;
+			}
+			output_filenames.push_back(file_name);
+		}
+	}
+	else
+	{
+		// Make sure the extension is an image type
+		if (LLImageBase::getCodecFromExtension(exten) == IMG_CODEC_INVALID)
+		{
+			return;
+		}
+		// Store the path
+		output_filenames.push_back(path);
+	}
+}
+
+// Holds the metric gathering output in a thread safe way
+class LogThread : public LLThread
+{
+public:
+	std::string mFile;
+
+	LogThread(std::string& test_name) : LLThread("llimage_libtest log")
+	{
+		std::string file_name = test_name + std::string(".slp");
+		mFile = file_name;
+	}
+		
+	void run()
+	{
+		std::ofstream os(mFile.c_str());
+			
+		while (!sAllDone)
+		{
+			LLFastTimer::writeLog(os);
+			os.flush();
+			ms_sleep(32);
+		}
+		LLFastTimer::writeLog(os);
+		os.flush();
+		os.close();
+	}		
+};
+
+int main(int argc, char** argv)
+{
+	// List of input and output files
+	std::list<std::string> input_filenames;
+	std::list<std::string> output_filenames;
+	bool analyze_performance = false;
+	bool image_stats = false;
+
+	// Init whatever is necessary
+	ll_init_apr();
+	LLImage::initClass();
+	LogThread* fast_timer_log_thread = NULL;	// For performance and metric gathering
+
+	// Analyze command line arguments
+	for (int arg = 1; arg < argc; ++arg)
+	{
+		if (!strcmp(argv[arg], "--help") || !strcmp(argv[arg], "-h"))
+		{
+            // Send the usage to standard out
+            std::cout << USAGE << std::endl;
+			return 0;
+		}
+		else if ((!strcmp(argv[arg], "--input") || !strcmp(argv[arg], "-i")) && arg < argc-1)
+		{
+			std::string file_name = argv[arg+1];
+			while (file_name[0] != '-')		// if arg starts with '-', we consider it's not a file name but some other argument
+			{
+				// std::cout << "input file name : " << file_name << std::endl;				
+				store_input_file(input_filenames, file_name);
+				arg += 1;					// Skip that arg now we know it's a file name
+				if ((arg + 1) == argc)		// Break out of the loop if we reach the end of the arg list
+					break;
+				file_name = argv[arg+1];	// Next argument and loop over
+			}
+		}
+		else if ((!strcmp(argv[arg], "--output") || !strcmp(argv[arg], "-o")) && arg < argc-1)
+		{
+			std::string file_name = argv[arg+1];
+			while (file_name[0] != '-')		// if arg starts with '-', we consider it's not a file name but some other argument
+			{
+				// std::cout << "output file name : " << file_name << std::endl;				
+				store_output_file(output_filenames, input_filenames, file_name);
+				arg += 1;					// Skip that arg now we know it's a file name
+				if ((arg + 1) == argc)		// Break out of the loop if we reach the end of the arg list
+					break;
+				file_name = argv[arg+1];	// Next argument and loop over
+			}
+		}
+		else if (!strcmp(argv[arg], "--logmetrics") || !strcmp(argv[arg], "-log"))
+		{
+			// '--logmetrics' needs to be specified with a named test metric argument
+			// Note: for the moment, only ImageCompressionTester has been tested
+			std::string test_name;
+			if ((arg + 1) < argc)
+			{
+				test_name = argv[arg+1];
+			}
+			if (((arg + 1) >= argc) || (test_name[0] == '-'))
+			{
+				// We don't have an argument left in the arg list or the next argument is another option
+				std::cout << "No --logmetrics argument given, no perf data will be gathered" << std::endl;
+			}
+			else
+			{
+				LLFastTimer::sMetricLog = TRUE;
+				LLFastTimer::sLogName = test_name;
+				arg += 1;					// Skip that arg now we know it's a valid test name
+				if ((arg + 1) == argc)		// Break out of the loop if we reach the end of the arg list
+					break;
+			}
+		}
+		else if (!strcmp(argv[arg], "--analyzeperformance") || !strcmp(argv[arg], "-r"))
+		{
+			analyze_performance = true;
+		}
+		else if (!strcmp(argv[arg], "--image-stats") || !strcmp(argv[arg], "-s"))
+		{
+			image_stats = true;
+		}
+	}
+		
+	// Check arguments consistency. Exit with proper message if inconsistent.
+	if (input_filenames.size() == 0)
+	{
+		std::cout << "No input file, nothing to do -> exit" << std::endl;
+		return 0;
+	}
+	if (analyze_performance && !LLFastTimer::sMetricLog)
+	{
+		std::cout << "Cannot create perf report if no perf gathered (i.e. use argument -log <perf> with -r) -> exit" << std::endl;
+		return 0;
+	}
+	
+
+	// Create the logging thread if required
+	if (LLFastTimer::sMetricLog)
+	{
+		LLFastTimer::sLogLock = new LLMutex(NULL);
+		fast_timer_log_thread = new LogThread(LLFastTimer::sLogName);
+		fast_timer_log_thread->start();
+	}
+	
+	// Perform action on each input file
+	std::list<std::string>::iterator in_file  = input_filenames.begin();
+	std::list<std::string>::iterator out_file = output_filenames.begin();
+	std::list<std::string>::iterator in_end = input_filenames.end();
+	std::list<std::string>::iterator out_end = output_filenames.end();
+	for (; in_file != in_end; ++in_file)
+	{
+		// Load file
+		LLPointer<LLImageRaw> raw_image = load_image(*in_file, image_stats);
+		if (!raw_image)
+		{
+			std::cout << "Error: Image " << *in_file << " could not be loaded" << std::endl;
+			continue;
+		}
+	
+		// Save file
+		if (out_file != out_end)
+		{
+			if (!save_image(*out_file, raw_image, image_stats))
+			{
+				std::cout << "Error: Image " << *out_file << " could not be saved" << std::endl;
+			}
+			else
+			{
+				std::cout << *in_file << " -> " << *out_file << std::endl;
+			}
+			++out_file;
+		}
+	}
+
+	// Stop the perf gathering system if needed
+	if (LLFastTimer::sMetricLog)
+	{
+		LLMetricPerformanceTesterBasic::deleteTester(LLFastTimer::sLogName);
+		sAllDone = true;
+	}
+	
+	// Output perf data if requested by user
+	if (analyze_performance)
+	{
+		std::cout << "Analyzing performance" << std::endl;
+		
+		std::string baseline_name = LLFastTimer::sLogName + "_baseline.slp";
+		std::string current_name  = LLFastTimer::sLogName + ".slp"; 
+		std::string report_name   = LLFastTimer::sLogName + "_report.csv";
+		
+		LLMetricPerformanceTesterBasic::doAnalysisMetrics(baseline_name, current_name, report_name);
+	}
+	
+	// Cleanup and exit
+	LLImage::cleanupClass();
+	if (fast_timer_log_thread)
+	{
+		fast_timer_log_thread->shutdown();
+	}
+	
+	return 0;
+}
diff --git a/indra/integration_tests/llimage_libtest/llimage_libtest.h b/indra/integration_tests/llimage_libtest/llimage_libtest.h
new file mode 100644
index 0000000000000000000000000000000000000000..63f3d46b50b4710c3dc006789b35e6f065075182
--- /dev/null
+++ b/indra/integration_tests/llimage_libtest/llimage_libtest.h
@@ -0,0 +1,29 @@
+/** 
+ * @file llimage_libtest.h
+ *
+ * $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 LLIMAGE_LIBTEST_H
+#define LLIMAGE_LIBTEST_H
+
+
+#endif
diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp
index 5fa3a5ea070bfaeea313ba1a11d948d36dcc0f09..41d3eb0bf369881da267876ef9224e7bcfaf9446 100644
--- a/indra/llcommon/llmetricperformancetester.cpp
+++ b/indra/llcommon/llmetricperformancetester.cpp
@@ -63,7 +63,18 @@ BOOL LLMetricPerformanceTesterBasic::addTester(LLMetricPerformanceTesterBasic* t
 	sTesterMap.insert(std::make_pair(name, tester));
 	return TRUE;
 }
-	
+
+/*static*/ 
+void LLMetricPerformanceTesterBasic::deleteTester(std::string name)
+{
+	name_tester_map_t::iterator tester = sTesterMap.find(name);
+	if (tester != sTesterMap.end())
+	{
+		delete tester->second;
+		sTesterMap.erase(tester);
+	}
+}
+
 /*static*/ 
 LLMetricPerformanceTesterBasic* LLMetricPerformanceTesterBasic::getTester(std::string name) 
 {
@@ -83,7 +94,78 @@ BOOL LLMetricPerformanceTesterBasic::isMetricLogRequested(std::string name)
 	return (LLFastTimer::sMetricLog && ((LLFastTimer::sLogName == name) || (LLFastTimer::sLogName == DEFAULT_METRIC_NAME)));
 }
 
+/*static*/ 
+LLSD LLMetricPerformanceTesterBasic::analyzeMetricPerformanceLog(std::istream& is)
+{
+	LLSD ret;
+	LLSD cur;
+	
+	while (!is.eof() && LLSDSerialize::fromXML(cur, is))
+	{
+		for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter)
+		{
+			std::string label = iter->first;
+			
+			LLMetricPerformanceTesterBasic* tester = LLMetricPerformanceTesterBasic::getTester(iter->second["Name"].asString()) ;
+			if(tester)
+			{
+				ret[label]["Name"] = iter->second["Name"] ;
+				
+				S32 num_of_metrics = tester->getNumberOfMetrics() ;
+				for(S32 index = 0 ; index < num_of_metrics ; index++)
+				{
+					ret[label][ tester->getMetricName(index) ] = iter->second[ tester->getMetricName(index) ] ;
+				}
+			}
+		}
+	}
+	
+	return ret;
+}
+
+/*static*/ 
+void LLMetricPerformanceTesterBasic::doAnalysisMetrics(std::string baseline, std::string target, std::string output)
+{
+	if(!LLMetricPerformanceTesterBasic::hasMetricPerformanceTesters())
+	{
+		return ;
+	}
+	
+	// Open baseline and current target, exit if one is inexistent
+	std::ifstream base_is(baseline.c_str());
+	std::ifstream target_is(target.c_str());
+	if (!base_is.is_open() || !target_is.is_open())
+	{
+		llwarns << "'-analyzeperformance' error : baseline or current target file inexistent" << llendl;
+		base_is.close();
+		target_is.close();
+		return;
+	}
 	
+	//analyze baseline
+	LLSD base = analyzeMetricPerformanceLog(base_is);
+	base_is.close();
+	
+	//analyze current
+	LLSD current = analyzeMetricPerformanceLog(target_is);
+	target_is.close();
+	
+	//output comparision
+	std::ofstream os(output.c_str());
+	
+	os << "Label, Metric, Base(B), Target(T), Diff(T-B), Percentage(100*T/B)\n"; 
+	for(LLMetricPerformanceTesterBasic::name_tester_map_t::iterator iter = LLMetricPerformanceTesterBasic::sTesterMap.begin() ; 
+		iter != LLMetricPerformanceTesterBasic::sTesterMap.end() ; ++iter)
+	{
+		LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)iter->second) ;	
+		tester->analyzePerformance(&os, &base, &current) ;
+	}
+	
+	os.flush();
+	os.close();
+}
+
+
 //----------------------------------------------------------------------------------------------
 // LLMetricPerformanceTesterBasic : Tester instance methods
 //----------------------------------------------------------------------------------------------
diff --git a/indra/llcommon/llmetricperformancetester.h b/indra/llcommon/llmetricperformancetester.h
index 1372f48dcfec7da703e21ce1412137b09c9890b4..1a18cdf36fbf3a55e31f6c7c6cf5bd6a422332ab 100644
--- a/indra/llcommon/llmetricperformancetester.h
+++ b/indra/llcommon/llmetricperformancetester.h
@@ -62,6 +62,8 @@ class LL_COMMON_API LLMetricPerformanceTesterBasic
 	 */
 	virtual void analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) ;
 
+	static void doAnalysisMetrics(std::string baseline, std::string target, std::string output) ;
+
 	/**
 	 * @return Returns the number of the test metrics in this tester instance.
 	 */
@@ -116,6 +118,7 @@ class LL_COMMON_API LLMetricPerformanceTesterBasic
 private:
 	void preOutputTestResults(LLSD* sd) ;
 	void postOutputTestResults(LLSD* sd) ;
+	static LLSD analyzeMetricPerformanceLog(std::istream& is) ;
 
 	std::string mName ;							// Name of this tester instance
 	S32 mCount ;								// Current record count
@@ -134,6 +137,12 @@ class LL_COMMON_API LLMetricPerformanceTesterBasic
 	 */
 	static LLMetricPerformanceTesterBasic* getTester(std::string name) ;
 	
+	/**
+	 * @return Delete the named tester from the list 
+	 * @param[in] name - Name of the tester instance to delete.
+	 */
+	static void deleteTester(std::string name);
+
 	/**
 	 * @return Returns TRUE if that metric *or* the default catch all metric has been requested to be logged
 	 * @param[in] name - Name of the tester queried.
diff --git a/indra/llcommon/llprocesslauncher.cpp b/indra/llcommon/llprocesslauncher.cpp
index d46188104f994a238be5cbd41b443697fdc85795..10950181fd30bf0f182d19e5954a3847eb8ec1a7 100644
--- a/indra/llcommon/llprocesslauncher.cpp
+++ b/indra/llcommon/llprocesslauncher.cpp
@@ -103,10 +103,30 @@ int LLProcessLauncher::launch(void)
 	char *args2 = new char[args.size() + 1];
 	strcpy(args2, args.c_str());
 
-	if( ! CreateProcessA( NULL, args2, NULL, NULL, FALSE, 0, NULL, mWorkingDir.c_str(), &sinfo, &pinfo ) )
+	const char * working_directory = 0;
+	if(!mWorkingDir.empty()) working_directory = mWorkingDir.c_str();
+	if( ! CreateProcessA( NULL, args2, NULL, NULL, FALSE, 0, NULL, working_directory, &sinfo, &pinfo ) )
 	{
-		// TODO: do better than returning the OS-specific error code on failure...
 		result = GetLastError();
+
+		LPTSTR error_str = 0;
+		if(
+			FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+				NULL,
+				result,
+				0,
+				(LPTSTR)&error_str,
+				0,
+				NULL) 
+			!= 0) 
+		{
+			char message[256];
+			wcstombs(message, error_str, 256);
+			message[255] = 0;
+			llwarns << "CreateProcessA failed: " << message << llendl;
+			LocalFree(error_str);
+		}
+
 		if(result == 0)
 		{
 			// Make absolutely certain we return a non-zero value on failure.
diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h
index 117d96ffa699cb693e9b2f5ba3c337d343de3b41..488ec5b239476bbe8420eda14eab2e914a4e342c 100644
--- a/indra/llcommon/llversionviewer.h
+++ b/indra/llcommon/llversionviewer.h
@@ -29,7 +29,7 @@
 
 const S32 LL_VERSION_MAJOR = 2;
 const S32 LL_VERSION_MINOR = 6;
-const S32 LL_VERSION_PATCH = 1;
+const S32 LL_VERSION_PATCH = 3;
 const S32 LL_VERSION_BUILD = 0;
 
 const char * const LL_CHANNEL = "Second Life Developer";
diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h
index 825b9aab1a49cefd54b092e05d869d00b15a32b7..18444f393415b572c4e20140409ea8bf753b8eb9 100644
--- a/indra/llimage/llimage.h
+++ b/indra/llimage/llimage.h
@@ -266,13 +266,13 @@ class LLImageFormatted : public LLImageBase
 	// subclasses must return a prefered file extension (lowercase without a leading dot)
 	virtual std::string getExtension() = 0;
 	// calcHeaderSize() returns the maximum size of header;
-	//   0 indicates we don't know have a header and have to lead the entire file
+	//   0 indicates we don't have a header and have to read the entire file
 	virtual S32 calcHeaderSize() { return 0; };
 	// calcDataSize() returns how many bytes to read to load discard_level (including header)
 	virtual S32 calcDataSize(S32 discard_level);
 	// calcDiscardLevelBytes() returns the smallest valid discard level based on the number of input bytes
 	virtual S32 calcDiscardLevelBytes(S32 bytes);
-	// getRawDiscardLevel()by default returns mDiscardLevel, but may be overridden (LLImageJ2C)
+	// getRawDiscardLevel() by default returns mDiscardLevel, but may be overridden (LLImageJ2C)
 	virtual S8  getRawDiscardLevel() { return mDiscardLevel; }
 	
 	BOOL load(const std::string& filename);
diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp
index cb2a85fa917afa683954f342d45c488a3e284ec4..80fec7f8a04b571b8f172a1ef3e616eee9a5d1e5 100644
--- a/indra/llimage/llimagej2c.cpp
+++ b/indra/llimage/llimagej2c.cpp
@@ -474,6 +474,7 @@ LLImageCompressionTester::LLImageCompressionTester() : LLMetricPerformanceTester
 
 LLImageCompressionTester::~LLImageCompressionTester()
 {
+	outputTestResults();
 	LLImageJ2C::sTesterp = NULL;
 }
 
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 32d7be377a3386a34f769fbb20876712b7b0ef3f..f0374de98f2516195e0d4651e3b3c5d7079de62c 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -1936,9 +1936,15 @@ bool LLMenuGL::scrollItems(EScrollingDirection direction)
 	{
 		item_list_t::reverse_iterator first_visible_item_iter = mItems.rend();
 
+		// Need to scroll through number of actual existing items in menu.
+		// Otherwise viewer will hang for a time needed to scroll U32_MAX
+		// times in std::advance(). STORM-659.
+		size_t nitems = mItems.size();
+		U32 scrollable_items = nitems < mMaxScrollableItems ? nitems : mMaxScrollableItems;
+
 		// Advance by mMaxScrollableItems back from the end of the list
 		// to make the last item visible.
-		std::advance(first_visible_item_iter, mMaxScrollableItems);
+		std::advance(first_visible_item_iter, scrollable_items);
 		mFirstVisibleItem = *first_visible_item_iter;
 		break;
 	}
diff --git a/indra/newview/app_settings/ignorable_dialogs.xml b/indra/newview/app_settings/ignorable_dialogs.xml
index 89fd4e59358ceb9aa21b6d5f4a6f605d4f5248a3..17d3d3c9c5ba339193cc300a27e8d30fa19c7d22 100644
--- a/indra/newview/app_settings/ignorable_dialogs.xml
+++ b/indra/newview/app_settings/ignorable_dialogs.xml
@@ -122,7 +122,17 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
-
+    <key>FirstSpeak</key>
+    <map>
+      <key>Comment</key>
+      <string>Shows hint for Speak button</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>1</integer>
+    </map>
     <key>FirstSit</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 6a89f5681d62bbc2f70fde1f669739d63778d816..f0e28d4ae3bb2c5b1239c957e57689a92c76beea 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -3198,7 +3198,7 @@
     <key>FirstRunThisInstall</key>
     <map>
       <key>Comment</key>
-      <string>Specifies that you have not run the viewer since you installed the latest update</string>
+      <string>Specifies that you have not run the viewer since you performed a clean install</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
@@ -3206,7 +3206,18 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
-    <key>FirstSelectedDisabledPopups</key>
+  <key>FirstLoginThisInstall</key>
+  <map>
+    <key>Comment</key>
+    <string>Specifies that you have not logged in with the viewer since you performed a clean install</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>Boolean</string>
+    <key>Value</key>
+    <integer>1</integer>
+  </map>
+  <key>FirstSelectedDisabledPopups</key>
     <map>
       <key>Comment</key>
       <string>Return false if there is not disabled popup selected in the list of floater preferences popups</string>
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index d0f9cae0782051212f4a0a57a385cbf0583b837b..f6fe7ecd012b353e769dc34fc7e0c1b4c452ac48 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -2171,6 +2171,7 @@ bool LLAppViewer::initConfiguration()
 	if (gSavedSettings.getBOOL("FirstRunThisInstall"))
 	{
 		gSavedSettings.setString("SessionSettingsFile", "settings_minimal.xml");
+		gSavedSettings.setBOOL("FirstRunThisInstall", FALSE);
 	}
 
 	if (clp.hasOption("sessionsettings"))
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index 1fb83fe5673727d23c1feb1b341e44843887a656..0371b7be7132e76b0a1015a334877465f6c13dc9 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -55,6 +55,7 @@
 
 #include "llviewerwindow.h"
 #include "llsdserialize.h"
+#include "llfirstuse.h"
 
 // Distance from mouse down on which drag'n'drop should be started.
 #define DRAG_START_DISTANCE 3
@@ -381,7 +382,12 @@ void LLBottomTray::onChange(EStatusType status, const std::string &channelURI, b
 	// skipped to avoid button blinking
 	if (status != STATUS_JOINING && status!= STATUS_LEFT_CHANNEL)
 	{
-		mSpeakBtn->setFlyoutBtnEnabled(LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking());
+		bool voice_status = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
+		mSpeakBtn->setFlyoutBtnEnabled(voice_status);
+		if (voice_status)
+		{
+			LLFirstUse::speak(true);
+		}
 	}
 }
 
@@ -561,6 +567,7 @@ BOOL LLBottomTray::postBuild()
 
 	mSpeakPanel = getChild<LLPanel>("speak_panel");
 	mSpeakBtn = getChild<LLSpeakButton>("talk");
+	LLHints::registerHintTarget("speak_btn", mSpeakBtn->getHandle());
 
 	// Both parts of speak button should be initially disabled because
 	// it takes some time between logging in to world and connecting to voice channel.
diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp
index 328c3262787a2f94f83cbecb1650e892757253ac..945a760d059d51daf24628f4b9c744ca408a3dcb 100644
--- a/indra/newview/llcallfloater.cpp
+++ b/indra/newview/llcallfloater.cpp
@@ -50,6 +50,7 @@
 #include "llviewerwindow.h"
 #include "llvoicechannel.h"
 #include "llviewerparcelmgr.h"
+#include "llfirstuse.h"
 
 static void get_voice_participants_uuids(uuid_vec_t& speakers_uuids);
 void reshape_floater(LLCallFloater* floater, S32 delta_height);
@@ -170,13 +171,13 @@ BOOL LLCallFloater::postBuild()
 	updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730)
 	
 	updateSession();
-
 	return TRUE;
 }
 
 // virtual
 void LLCallFloater::onOpen(const LLSD& /*key*/)
 {
+	LLFirstUse::speak(false);
 }
 
 // virtual
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index d4ec377e03ddb3e606966734d30c489859ffecb3..c0c9ea145164b27d65ee4a0d0e201043e78d80d9 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -793,21 +793,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
 			if ( chat.mSourceType == CHAT_SOURCE_OBJECT && chat.mFromID.notNull())
 			{
 				// for object IMs, create a secondlife:///app/objectim SLapp
-				std::string url = LLSLURL("objectim", chat.mFromID, "").getSLURLString();
-				url += "?name=" + chat.mFromName;
-				url += "&owner=" + chat.mOwnerID.asString();
-
-				std::string slurl = args["slurl"].asString();
-				if (slurl.empty())
-				{
-				    LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent);
-				    if(region)
-				      {
-					LLSLURL region_slurl(region->getName(), chat.mPosAgent);
-					slurl = region_slurl.getLocationString();
-				      }
-				}
-				url += "&slurl=" + LLURI::escape(slurl);
+				std::string url = LLViewerChat::getSenderSLURL(chat, args);
 
 				// set the link for the object name to be the objectim SLapp
 				// (don't let object names with hyperlinks override our objectim Url)
diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp
index 899e0431e7c29634dd37c8e7ddd7c759151b8eca..8584885bc974e842e63d916ead326abf9e76db4d 100644
--- a/indra/newview/llchatitemscontainerctrl.cpp
+++ b/indra/newview/llchatitemscontainerctrl.cpp
@@ -213,17 +213,6 @@ void LLNearbyChatToastPanel::init(LLSD& notification)
 		{
 			LLStyle::Params style_params_name;
 
-			std::string href;
-
-			if (mSourceType == CHAT_SOURCE_AGENT)
-			{
-				href = LLSLURL("agent", mFromID, "about").getSLURLString();
-			}
-			else
-			{
-				href = LLSLURL("object", mFromID, "inspect").getSLURLString();
-			}
-
 			LLColor4 user_name_color = LLUIColorTable::instance().getColor("HTMLLinkColor");
 			style_params_name.color(user_name_color);
 
@@ -232,7 +221,7 @@ void LLNearbyChatToastPanel::init(LLSD& notification)
 			style_params_name.font.name(font_name);
 			style_params_name.font.size(font_style_size);
 
-			style_params_name.link_href = href;
+			style_params_name.link_href = notification["sender_slurl"].asString();
 			style_params_name.is_link = true;
 
 			msg_text->appendText(str_sender, FALSE, style_params_name);
diff --git a/indra/newview/llexternaleditor.cpp b/indra/newview/llexternaleditor.cpp
index 54968841ab1521461002482ad0631f39aecfa46f..ed1d7e860a0cfa672fe78857a6b8861059c5169f 100644
--- a/indra/newview/llexternaleditor.cpp
+++ b/indra/newview/llexternaleditor.cpp
@@ -27,6 +27,7 @@
 #include "llviewerprecompiledheaders.h"
 #include "llexternaleditor.h"
 
+#include "lltrans.h"
 #include "llui.h"
 
 // static
@@ -35,13 +36,13 @@ const std::string LLExternalEditor::sFilenameMarker = "%s";
 // static
 const std::string LLExternalEditor::sSetting = "ExternalEditor";
 
-bool LLExternalEditor::setCommand(const std::string& env_var, const std::string& override)
+LLExternalEditor::EErrorCode LLExternalEditor::setCommand(const std::string& env_var, const std::string& override)
 {
 	std::string cmd = findCommand(env_var, override);
 	if (cmd.empty())
 	{
-		llwarns << "Empty editor command" << llendl;
-		return false;
+		llwarns << "Editor command is empty or not set" << llendl;
+		return EC_NOT_SPECIFIED;
 	}
 
 	// Add the filename marker if missing.
@@ -55,7 +56,7 @@ bool LLExternalEditor::setCommand(const std::string& env_var, const std::string&
 	if (tokenize(tokens, cmd) < 2) // 2 = bin + at least one arg (%s)
 	{
 		llwarns << "Error parsing editor command" << llendl;
-		return false;
+		return EC_PARSE_ERROR;
 	}
 
 	// Check executable for existence.
@@ -63,7 +64,7 @@ bool LLExternalEditor::setCommand(const std::string& env_var, const std::string&
 	if (!LLFile::isfile(bin_path))
 	{
 		llwarns << "Editor binary [" << bin_path << "] not found" << llendl;
-		return false;
+		return EC_BINARY_NOT_FOUND;
 	}
 
 	// Save command.
@@ -76,16 +77,16 @@ bool LLExternalEditor::setCommand(const std::string& env_var, const std::string&
 	}
 	llinfos << "Setting command [" << bin_path << " " << mArgs << "]" << llendl;
 
-	return true;
+	return EC_SUCCESS;
 }
 
-bool LLExternalEditor::run(const std::string& file_path)
+LLExternalEditor::EErrorCode LLExternalEditor::run(const std::string& file_path)
 {
 	std::string args = mArgs;
 	if (mProcess.getExecutable().empty() || args.empty())
 	{
 		llwarns << "Editor command not set" << llendl;
-		return false;
+		return EC_NOT_SPECIFIED;
 	}
 
 	// Substitute the filename marker in the command with the actual passed file name.
@@ -111,7 +112,22 @@ bool LLExternalEditor::run(const std::string& file_path)
 		mProcess.orphan();
 	}
 
-	return result == 0;
+	return result == 0 ? EC_SUCCESS : EC_FAILED_TO_RUN;
+}
+
+// static
+std::string LLExternalEditor::getErrorMessage(EErrorCode code)
+{
+	switch (code)
+	{
+	case EC_SUCCESS: 			return LLTrans::getString("ok");
+	case EC_NOT_SPECIFIED: 		return LLTrans::getString("ExternalEditorNotSet");
+	case EC_PARSE_ERROR:		return LLTrans::getString("ExternalEditorCommandParseError");
+	case EC_BINARY_NOT_FOUND:	return LLTrans::getString("ExternalEditorNotFound");
+	case EC_FAILED_TO_RUN:		return LLTrans::getString("ExternalEditorFailedToRun");
+	}
+
+	return LLTrans::getString("Unknown");
 }
 
 // static
diff --git a/indra/newview/llexternaleditor.h b/indra/newview/llexternaleditor.h
index 6ea210d5e222d69dfc81ed3d4d9ab23758ad520b..ef5db56c6ee056e6ed1ee560c20ae2e1abe51e92 100644
--- a/indra/newview/llexternaleditor.h
+++ b/indra/newview/llexternaleditor.h
@@ -42,6 +42,14 @@ class LLExternalEditor
 
 public:
 
+	typedef enum e_error_code {
+		EC_SUCCESS,				/// No error.
+		EC_NOT_SPECIFIED,		/// Editor path not specified.
+		EC_PARSE_ERROR,			/// Editor command parsing error.
+		EC_BINARY_NOT_FOUND,	/// Could find the editor binary (missing or not quoted).
+		EC_FAILED_TO_RUN,		/// Could not execute the editor binary.
+	} EErrorCode;
+
 	/**
 	 * Set editor command.
 	 *
@@ -51,19 +59,25 @@ class LLExternalEditor
 	 * First tries the override, then a predefined setting (sSetting),
 	 * then the environment variable.
 	 *
-	 * @return Command if found, empty string otherwise.
+	 * @return EC_SUCCESS if command is valid and refers to an existing executable,
+	 *         EC_NOT_SPECIFIED or EC_FAILED_TO_RUNan on error.
 	 *
 	 * @see sSetting
 	 */
-	bool setCommand(const std::string& env_var, const std::string& override = LLStringUtil::null);
+	EErrorCode setCommand(const std::string& env_var, const std::string& override = LLStringUtil::null);
 
 	/**
 	 * Run the editor with the given file.
 	 *
 	 * @param file_path File to edit.
-	 * @return true on success, false on error.
+	 * @return EC_SUCCESS on success, error code on error.
+	 */
+	EErrorCode run(const std::string& file_path);
+
+	/**
+	 * Get a meaningful error message for the given status code.
 	 */
-	bool run(const std::string& file_path);
+	static std::string getErrorMessage(EErrorCode code);
 
 private:
 
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index 92a3b9b2f5716627f58e4785df7bbf7314c0d6c7..279904b74013201b5cf9ff88d81ee90aecccecfa 100644
--- a/indra/newview/llfasttimerview.cpp
+++ b/indra/newview/llfasttimerview.cpp
@@ -1149,36 +1149,6 @@ void LLFastTimerView::doAnalysisDefault(std::string baseline, std::string target
 	os.close();
 }
 
-//-------------------------
-//static
-LLSD LLFastTimerView::analyzeMetricPerformanceLog(std::istream& is)
-{
-	LLSD ret;
-	LLSD cur;
-
-	while (!is.eof() && LLSDSerialize::fromXML(cur, is))
-	{
-		for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter)
-		{
-			std::string label = iter->first;
-
-			LLMetricPerformanceTesterBasic* tester = LLMetricPerformanceTesterBasic::getTester(iter->second["Name"].asString()) ;
-			if(tester)
-			{
-				ret[label]["Name"] = iter->second["Name"] ;
-
-				S32 num_of_metrics = tester->getNumberOfMetrics() ;
-				for(S32 index = 0 ; index < num_of_metrics ; index++)
-				{
-					ret[label][ tester->getMetricName(index) ] = iter->second[ tester->getMetricName(index) ] ;
-				}
-			}
-		}
-	}
-		
-	return ret;
-}
-
 //static
 void LLFastTimerView::outputAllMetrics()
 {
@@ -1193,48 +1163,6 @@ void LLFastTimerView::outputAllMetrics()
 	}
 }
 
-//static
-void LLFastTimerView::doAnalysisMetrics(std::string baseline, std::string target, std::string output)
-{
-	if(!LLMetricPerformanceTesterBasic::hasMetricPerformanceTesters())
-	{
-		return ;
-	}
-
-	// Open baseline and current target, exit if one is inexistent
-	std::ifstream base_is(baseline.c_str());
-	std::ifstream target_is(target.c_str());
-	if (!base_is.is_open() || !target_is.is_open())
-	{
-		llwarns << "'-analyzeperformance' error : baseline or current target file inexistent" << llendl;
-		base_is.close();
-		target_is.close();
-		return;
-	}
-
-	//analyze baseline
-	LLSD base = analyzeMetricPerformanceLog(base_is);
-	base_is.close();
-
-	//analyze current
-	LLSD current = analyzeMetricPerformanceLog(target_is);
-	target_is.close();
-
-	//output comparision
-	std::ofstream os(output.c_str());
-	
-	os << "Label, Metric, Base(B), Target(T), Diff(T-B), Percentage(100*T/B)\n"; 
-	for(LLMetricPerformanceTesterBasic::name_tester_map_t::iterator iter = LLMetricPerformanceTesterBasic::sTesterMap.begin() ; 
-		iter != LLMetricPerformanceTesterBasic::sTesterMap.end() ; ++iter)
-	{
-		LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)iter->second) ;	
-		tester->analyzePerformance(&os, &base, &current) ;
-	}
-	
-	os.flush();
-	os.close();
-}
-
 //static
 void LLFastTimerView::doAnalysis(std::string baseline, std::string target, std::string output)
 {
@@ -1246,7 +1174,7 @@ void LLFastTimerView::doAnalysis(std::string baseline, std::string target, std::
 
 	if(LLFastTimer::sMetricLog)
 	{
-		doAnalysisMetrics(baseline, target, output) ;
+		LLMetricPerformanceTesterBasic::doAnalysisMetrics(baseline, target, output) ;
 		return ;
 	}
 }
diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h
index 1a54a53f09660975035eb5e17cacfcaeeaca4f64..b40d7ffc1a20642b39636c6936565fe3a71fa702 100644
--- a/indra/newview/llfasttimerview.h
+++ b/indra/newview/llfasttimerview.h
@@ -42,8 +42,6 @@ class LLFastTimerView : public LLFloater
 
 private:
 	static void doAnalysisDefault(std::string baseline, std::string target, std::string output) ;
-	static void doAnalysisMetrics(std::string baseline, std::string target, std::string output) ;
-	static LLSD analyzeMetricPerformanceLog(std::istream& is) ;
 	static LLSD analyzePerformanceLogDefault(std::istream& is) ;
 
 public:
diff --git a/indra/newview/llfirstuse.cpp b/indra/newview/llfirstuse.cpp
index e319418defe85f5037072632f0a3ffc0134dac50..d63685e1af291f56d2127efc28d8a581af53d3d9 100644
--- a/indra/newview/llfirstuse.cpp
+++ b/indra/newview/llfirstuse.cpp
@@ -77,6 +77,12 @@ void LLFirstUse::otherAvatarChatFirst(bool enable)
 	firstUseNotification("FirstOtherChatBeforeUser", enable, "HintChat", LLSD(), LLSD().with("target", "chat_bar").with("direction", "top_right").with("distance", 24));
 }
 
+// static
+void LLFirstUse::speak(bool enable)
+{
+	firstUseNotification("FirstSpeak", enable, "HintSpeak", LLSD(), LLSD().with("target", "speak_btn").with("direction", "top"));
+}
+
 // static
 void LLFirstUse::sit(bool enable)
 {
diff --git a/indra/newview/llfirstuse.h b/indra/newview/llfirstuse.h
index 42b2ec0c60a17278786dd36198b6189dc9d9784f..4c8c9d3cde6b00fd622014652d3cedc13e45b95f 100644
--- a/indra/newview/llfirstuse.h
+++ b/indra/newview/llfirstuse.h
@@ -68,6 +68,8 @@ object or from inventory.
 13. First time you open the debug menus (ctrl-alt-shift D)
 
 14. First time you create/edit a sculpted prim.
+
+15. Explanation of Speak&flyout buttons.
 */
 
 class LLNotification;
@@ -85,6 +87,7 @@ class LLFirstUse
 	static void resetFirstUse();
 
 	static void otherAvatarChatFirst(bool enable = true);
+	static void speak(bool enable = true);
 	static void sit(bool enable = true);
 	static void notUsingDestinationGuide(bool enable = true);
 	static void notUsingSidePanel(bool enable = true);
diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp
index 45d1cc2b53dd68c1b9c4604e9cab23db3797face..641e64247bab0c98ce43a27cb51c1e2a70eee00e 100644
--- a/indra/newview/llfloatermap.cpp
+++ b/indra/newview/llfloatermap.cpp
@@ -42,7 +42,6 @@
 #include "llviewercamera.h"
 #include "lldraghandle.h"
 #include "lltextbox.h"
-#include "llviewermenu.h"
 #include "llfloaterworldmap.h"
 #include "llagent.h"
 
@@ -63,7 +62,6 @@ const S32 MAP_PADDING_BOTTOM = 0;
 
 LLFloaterMap::LLFloaterMap(const LLSD& key) 
 	: LLFloater(key),
-	  mPopupMenu(NULL),
 	  mTextBoxEast(NULL),
 	  mTextBoxNorth(NULL),
 	  mTextBoxWest(NULL),
@@ -102,17 +100,6 @@ BOOL LLFloaterMap::postBuild()
 	mTextBoxSouthWest = getChild<LLTextBox> ("floater_map_southwest");
 	mTextBoxNorthWest = getChild<LLTextBox> ("floater_map_northwest");
 
-	LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
-	
-	registrar.add("Minimap.Zoom", boost::bind(&LLFloaterMap::handleZoom, this, _2));
-	registrar.add("Minimap.Tracker", boost::bind(&LLFloaterMap::handleStopTracking, this, _2));
-
-	mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_mini_map.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
-	if (mPopupMenu && !LLTracker::isTracking(0))
-	{
-		mPopupMenu->setItemEnabled ("Stop Tracking", false);
-	}
-
 	stretchMiniMap(getRect().getWidth() - MAP_PADDING_LEFT - MAP_PADDING_RIGHT
 		,getRect().getHeight() - MAP_PADDING_TOP - MAP_PADDING_BOTTOM);
 
@@ -163,17 +150,6 @@ BOOL LLFloaterMap::handleDoubleClick(S32 x, S32 y, MASK mask)
 	return TRUE;
 }
 
-BOOL LLFloaterMap::handleRightMouseDown(S32 x, S32 y, MASK mask)
-{
-	if (mPopupMenu)
-	{
-		mPopupMenu->buildDrawLabels();
-		mPopupMenu->updateParent(LLMenuGL::sMenuContainer);
-		LLMenuGL::showPopup(this, mPopupMenu, x, y);
-	}
-	return TRUE;
-}
-
 void LLFloaterMap::setDirectionPos( LLTextBox* text_box, F32 rotation )
 {
 	// Rotation is in radians.
@@ -244,11 +220,6 @@ void LLFloaterMap::draw()
 		getDragHandle()->setMouseOpaque(TRUE);
 	}
 	
-	if (LLTracker::isTracking(0))
-	{
-		mPopupMenu->setItemEnabled ("Stop Tracking", true);
-	}
-	
 	LLFloater::draw();
 }
 
@@ -315,14 +286,6 @@ void LLFloaterMap::handleZoom(const LLSD& userdata)
 	}
 }
 
-void LLFloaterMap::handleStopTracking (const LLSD& userdata)
-{
-	if (mPopupMenu)
-	{
-		mPopupMenu->setItemEnabled ("Stop Tracking", false);
-		LLTracker::stopTracking ((void*)LLTracker::isTracking(NULL));
-	}
-}
 void	LLFloaterMap::setMinimized(BOOL b)
 {
 	LLFloater::setMinimized(b);
diff --git a/indra/newview/llfloatermap.h b/indra/newview/llfloatermap.h
index 4cbb48fb3e1989335f8a4975f0386797d37f7545..5cf66a594bf249f9683f70b0621869e1e761b068 100644
--- a/indra/newview/llfloatermap.h
+++ b/indra/newview/llfloatermap.h
@@ -29,7 +29,6 @@
 
 #include "llfloater.h"
 
-class LLMenuGL;
 class LLNetMap;
 class LLTextBox;
 
@@ -44,7 +43,6 @@ class LLFloaterMap : public LLFloater
 	
 	/*virtual*/ BOOL 	postBuild();
 	/*virtual*/ BOOL	handleDoubleClick( S32 x, S32 y, MASK mask );
-	/*virtual*/ BOOL	handleRightMouseDown( S32 x, S32 y, MASK mask );
 	/*virtual*/ void	reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
 	/*virtual*/ void	draw();
 	/*virtual*/ void	onFocusLost();
@@ -54,14 +52,11 @@ class LLFloaterMap : public LLFloater
 	
 private:
 	void handleZoom(const LLSD& userdata);
-	void handleStopTracking (const LLSD& userdata);
 	void setDirectionPos( LLTextBox* text_box, F32 rotation );
 	void updateMinorDirections();
 
 	void stretchMiniMap(S32 width,S32 height);
 	
-	LLMenuGL*		mPopupMenu;
-
 	LLTextBox*		mTextBoxEast;
 	LLTextBox*		mTextBoxNorth;
 	LLTextBox*		mTextBoxWest;
diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp
index 2aaf403d5f76348bcf4fcf37af4a2013c14e4a66..19f6038b56b6f434bd0d33765d0ada3ed7955e83 100644
--- a/indra/newview/llfloatertopobjects.cpp
+++ b/indra/newview/llfloatertopobjects.cpp
@@ -185,7 +185,7 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data)
 			have_extended_data = true;
 			msg->getU32("DataExtended", "TimeStamp", time_stamp, block);
 			msg->getF32("DataExtended", "MonoScore", mono_score, block);
-			msg->getS32(_PREHASH_ReportData,"PublicURLs",public_urls,block);
+			msg->getS32("DataExtended", "PublicURLs", public_urls, block);
 		}
 
 		LLSD element;
diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp
index 11b3379814a52d3de44e343675abd7196417e5e9..0d8601410a1413677a645d24a3143315722f41d0 100644
--- a/indra/newview/llfloateruipreview.cpp
+++ b/indra/newview/llfloateruipreview.cpp
@@ -1037,18 +1037,29 @@ void LLFloaterUIPreview::onClickEditFloater()
 			cmd_override = bin + " " + args;
 		}
 	}
-	if (!mExternalEditor.setCommand("LL_XUI_EDITOR", cmd_override))
+
+	LLExternalEditor::EErrorCode status = mExternalEditor.setCommand("LL_XUI_EDITOR", cmd_override);
+	if (status != LLExternalEditor::EC_SUCCESS)
 	{
-		std::string warning = "Select an editor by setting the environment variable LL_XUI_EDITOR "
-			"or the ExternalEditor setting or specifying its path in the \"Editor Path\" field.";
+		std::string warning;
+
+		if (status == LLExternalEditor::EC_NOT_SPECIFIED) // Use custom message for this error.
+		{
+			warning = getString("ExternalEditorNotSet");
+		}
+		else
+		{
+			warning = LLExternalEditor::getErrorMessage(status);
+		}
+
 		popupAndPrintWarning(warning);
 		return;
 	}
 
 	// Run the editor.
-	if (!mExternalEditor.run(file_path))
+	if (mExternalEditor.run(file_path) != LLExternalEditor::EC_SUCCESS)
 	{
-		popupAndPrintWarning("Failed to run editor");
+		popupAndPrintWarning(LLExternalEditor::getErrorMessage(status));
 		return;
 	}
 }
diff --git a/indra/newview/llhudeffectblob.cpp b/indra/newview/llhudeffectblob.cpp
index 26e8251899a56de46ffcb1f59315dadd297b06b6..d8687eed8db022ba8267a0863b73c231d1d1b0db 100644
--- a/indra/newview/llhudeffectblob.cpp
+++ b/indra/newview/llhudeffectblob.cpp
@@ -30,13 +30,14 @@
 
 #include "llagent.h"
 #include "llviewercamera.h"
-#include "llrendersphere.h"
+#include "llui.h"
 
 LLHUDEffectBlob::LLHUDEffectBlob(const U8 type) 
 :	LLHUDEffect(type), 
 	mPixelSize(10)
 {
 	mTimer.start();
+	mImage = LLUI::getUIImage("Camera_Drag_Dot");
 }
 
 LLHUDEffectBlob::~LLHUDEffectBlob()
@@ -58,18 +59,29 @@ void LLHUDEffectBlob::render()
 	LLViewerCamera::instance().getPixelVectors(pos_agent, pixel_up, pixel_right);
 
 	LLGLSPipelineAlpha gls_pipeline_alpha;
-	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+	gGL.getTexUnit(0)->bind(mImage->getImage());
 
 	LLColor4U color = mColor;
 	color.mV[VALPHA] = (U8)clamp_rescale(time, 0.f, mDuration, 255.f, 0.f);
-	glColor4ubv(color.mV);
+	gGL.color4ubv(color.mV);
 
-	glPushMatrix();
-	glTranslatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
-	F32 scale = pixel_up.magVec() * (F32)mPixelSize;
-	glScalef(scale, scale, scale);
-	gSphere.render(0);
-	glPopMatrix();
+	{ gGL.pushMatrix();
+		gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
+		LLVector3 u_scale = pixel_right * (F32)mPixelSize;
+		LLVector3 v_scale = pixel_up * (F32)mPixelSize;
+		
+		{ gGL.begin(LLRender::QUADS);
+			gGL.texCoord2f(0.f, 1.f);
+			gGL.vertex3fv((v_scale - u_scale).mV);
+			gGL.texCoord2f(0.f, 0.f);
+			gGL.vertex3fv((-v_scale - u_scale).mV);
+			gGL.texCoord2f(1.f, 0.f);
+			gGL.vertex3fv((-v_scale + u_scale).mV);
+			gGL.texCoord2f(1.f, 1.f);
+			gGL.vertex3fv((v_scale + u_scale).mV);
+		} gGL.end();
+
+	} gGL.popMatrix();
 }
 
 void LLHUDEffectBlob::renderForTimer()
diff --git a/indra/newview/llhudeffectblob.h b/indra/newview/llhudeffectblob.h
index 5b0703cdaade6b8678cc0cf0581b3267c3b7d0c5..f4c1691108fded588d05c7c4335f275f0b28e32d 100644
--- a/indra/newview/llhudeffectblob.h
+++ b/indra/newview/llhudeffectblob.h
@@ -28,6 +28,7 @@
 #define LL_LLHUDEFFECTBLOB_H
 
 #include "llhudeffect.h"
+#include "lluiimage.h"
 
 class LLHUDEffectBlob : public LLHUDEffect
 {
@@ -45,6 +46,7 @@ class LLHUDEffectBlob : public LLHUDEffect
 private:
 	S32				mPixelSize;
 	LLFrameTimer	mTimer;
+	LLPointer<LLUIImage> mImage;
 };
 
 #endif // LL_LLHUDEFFECTBLOB_H
diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp
index de5439e4e03e5a88002a454a74e790cd503548db..0d9daeb44ead9302fbb14c5b818ec880ab4ee8ae 100644
--- a/indra/newview/llnearbychathandler.cpp
+++ b/indra/newview/llnearbychathandler.cpp
@@ -558,6 +558,7 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args)
 	}
 	*/
 
+	// Add a nearby chat toast.
 	LLUUID id;
 	id.generate();
 
@@ -583,6 +584,10 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args)
 		notification["text_color"] = r_color_name;
 		notification["color_alpha"] = r_color_alpha;
 		notification["font_size"] = (S32)LLViewerChat::getChatFontSize() ;
+
+		// Pass sender info so that it can be rendered properly (STORM-1021).
+		notification["sender_slurl"] = LLViewerChat::getSenderSLURL(chat_msg, args);
+
 		channel->addNotification(notification);	
 	}
 
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index e29078c5457248232e22286bf6467146c0da1d0f..981b4dbee3afc964ffb1c5d1a5a2f91ebb54d2a8 100644
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -112,10 +112,6 @@ BOOL LLNetMap::postBuild()
 	registrar.add("Minimap.Tracker", boost::bind(&LLNetMap::handleStopTracking, this, _2));
 
 	mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_mini_map.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
-	if (mPopupMenu && !LLTracker::isTracking(0))
-	{
-		mPopupMenu->setItemEnabled ("Stop Tracking", false);
-	}
 	return TRUE;
 }
 
@@ -510,13 +506,6 @@ void LLNetMap::draw()
 	gGL.popUIMatrix();
 
 	LLUICtrl::draw();
-
-	if (LLTracker::isTracking(0))
-	{
-		mPopupMenu->setItemEnabled ("Stop Tracking", true);
-	}
-	
-
 }
 
 void LLNetMap::reshape(S32 width, S32 height, BOOL called_from_parent)
@@ -886,6 +875,7 @@ BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask)
 	{
 		mPopupMenu->buildDrawLabels();
 		mPopupMenu->updateParent(LLMenuGL::sMenuContainer);
+		mPopupMenu->setItemEnabled("Stop Tracking", LLTracker::isTracking(0));
 		LLMenuGL::showPopup(this, mPopupMenu, x, y);
 	}
 	return TRUE;
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 22ff362b5a66d5c2c3869e78a7614ff7d1ed45e2..b19bf5d234c36544e12aee92ac14709ccc038add 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -956,16 +956,31 @@ void LLScriptEdCore::openInExternalEditor()
 	// Open it in external editor.
 	{
 		LLExternalEditor ed;
+		LLExternalEditor::EErrorCode status;
+		std::string msg;
 
-		if (!ed.setCommand("LL_SCRIPT_EDITOR"))
+		status = ed.setCommand("LL_SCRIPT_EDITOR");
+		if (status != LLExternalEditor::EC_SUCCESS)
 		{
-			std::string msg = "Select an editor by setting the environment variable LL_SCRIPT_EDITOR "
-				"or the ExternalEditor setting"; // *TODO: localize
+			if (status == LLExternalEditor::EC_NOT_SPECIFIED) // Use custom message for this error.
+			{
+				msg = getString("external_editor_not_set");
+			}
+			else
+			{
+				msg = LLExternalEditor::getErrorMessage(status);
+			}
+
 			LLNotificationsUtil::add("GenericAlert", LLSD().with("MESSAGE", msg));
 			return;
 		}
 
-		ed.run(filename);
+		status = ed.run(filename);
+		if (status != LLExternalEditor::EC_SUCCESS)
+		{
+			msg = LLExternalEditor::getErrorMessage(status);
+			LLNotificationsUtil::add("GenericAlert", LLSD().with("MESSAGE", msg));
+		}
 	}
 }
 
diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp
index a9bb01ac70a9b606856ac4dc6367c1f5aa9e9091..fcd200d24aef3ed3e8cfbe1d0e7a3fff9fb36969 100644
--- a/indra/newview/llsidetray.cpp
+++ b/indra/newview/llsidetray.cpp
@@ -686,7 +686,7 @@ LLPanel* LLSideTray::openChildPanel(LLSideTrayTab* tab, const std::string& panel
 		LLFloater* floater_tab = LLFloaterReg::getInstance("side_bar_tab", tab_name);
 		if (!floater_tab) return NULL;
 
-		floater_tab->openFloater(panel_name);
+		floater_tab->openFloater(tab_name);
 	}
 
 	LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(view->getParent());
diff --git a/indra/newview/llspeakbutton.cpp b/indra/newview/llspeakbutton.cpp
index c76ecae4a2b513d613ae616999d6f489269a9ddc..d52e0a6c8683c2214a138974eb73ed6c53b3e4fb 100644
--- a/indra/newview/llspeakbutton.cpp
+++ b/indra/newview/llspeakbutton.cpp
@@ -38,6 +38,7 @@
 #include "llspeakbutton.h"
 
 #include "llbottomtray.h"
+#include "llfirstuse.h"
 
 static LLDefaultChildRegistry::Register<LLSpeakButton> t1("talk_button");
 
@@ -176,6 +177,7 @@ void LLSpeakButton::onMouseDown_SpeakBtn()
 {
 	bool down = true;
 	LLVoiceClient::getInstance()->inputUserControlState(down); // this method knows/care about whether this translates into a toggle-to-talk or down-to-talk
+	LLFirstUse::speak(false);
 }
 void LLSpeakButton::onMouseUp_SpeakBtn()
 {
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 45159de66e300a83630761579b6bafe34f82dc7e..8fccb35886c658c976ae0d08e76ac18551ed80e6 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -1,3229 +1,3227 @@
-/** 
- * @file llstartup.cpp
- * @brief startup routines.
- *
- * $LicenseInfo:firstyear=2004&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 "llstartup.h"
-
-#if LL_WINDOWS
-#	include <process.h>		// _spawnl()
-#else
-#	include <sys/stat.h>		// mkdir()
-#endif
-
-#include "llviewermedia_streamingaudio.h"
-#include "llaudioengine.h"
-
-#ifdef LL_FMOD
-# include "llaudioengine_fmod.h"
-#endif
-
-#ifdef LL_OPENAL
-#include "llaudioengine_openal.h"
-#endif
-
-#include "llares.h"
-#include "llavatarnamecache.h"
-#include "lllandmark.h"
-#include "llcachename.h"
-#include "lldir.h"
-#include "llerrorcontrol.h"
-#include "llfloaterreg.h"
-#include "llfocusmgr.h"
-#include "llhttpsender.h"
-#include "llimfloater.h"
-#include "lllocationhistory.h"
-#include "llimageworker.h"
-
-#include "llloginflags.h"
-#include "llmd5.h"
-#include "llmemorystream.h"
-#include "llmessageconfig.h"
-#include "llmoveview.h"
-#include "llnearbychat.h"
-#include "llnotifications.h"
-#include "llnotificationsutil.h"
-#include "llteleporthistory.h"
-#include "llregionhandle.h"
-#include "llsd.h"
-#include "llsdserialize.h"
-#include "llsdutil_math.h"
-#include "llsecondlifeurls.h"
-#include "llstring.h"
-#include "lluserrelations.h"
-#include "llversioninfo.h"
-#include "llviewercontrol.h"
-#include "llvfs.h"
-#include "llxorcipher.h"	// saved password, MAC address
-#include "llwindow.h"
-#include "imageids.h"
-#include "message.h"
-#include "v3math.h"
-
-#include "llagent.h"
-#include "llagentcamera.h"
-#include "llagentpicksinfo.h"
-#include "llagentwearables.h"
-#include "llagentpilot.h"
-#include "llfloateravatarpicker.h"
-#include "llcallbacklist.h"
-#include "llcallingcard.h"
-#include "llconsole.h"
-#include "llcontainerview.h"
-#include "lldebugview.h"
-#include "lldrawable.h"
-#include "lleventnotifier.h"
-#include "llface.h"
-#include "llfeaturemanager.h"
-//#include "llfirstuse.h"
-#include "llfloaterhud.h"
-#include "llfloaterland.h"
-#include "llfloaterpreference.h"
-#include "llfloatertopobjects.h"
-#include "llfloaterworldmap.h"
-#include "llgesturemgr.h"
-#include "llgroupmgr.h"
-#include "llhudeffecttrail.h"
-#include "llhudmanager.h"
-#include "llhttpclient.h"
-#include "llimagebmp.h"
-#include "llinventorybridge.h"
-#include "llinventorymodel.h"
-#include "llinventorymodelbackgroundfetch.h"
-#include "llkeyboard.h"
-#include "llloginhandler.h"			// gLoginHandler, SLURL support
-#include "lllogininstance.h" // Host the login module.
-#include "llpanellogin.h"
-#include "llmutelist.h"
-#include "llavatarpropertiesprocessor.h"
-#include "llpanelclassified.h"
-#include "llpanelpick.h"
-#include "llpanelgrouplandmoney.h"
-#include "llpanelgroupnotices.h"
-#include "llpreview.h"
-#include "llpreviewscript.h"
-#include "llproductinforequest.h"
-#include "llsecondlifeurls.h"
-#include "llselectmgr.h"
-#include "llsky.h"
-#include "llsidetray.h"
-#include "llstatview.h"
-#include "llstatusbar.h"		// sendMoneyBalanceRequest(), owns L$ balance
-#include "llsurface.h"
-#include "lltexturecache.h"
-#include "lltexturefetch.h"
-#include "lltoolmgr.h"
-#include "lltrans.h"
-#include "llui.h"
-#include "llurldispatcher.h"
-#include "llurlentry.h"
-#include "llslurl.h"
-#include "llurlhistory.h"
-#include "llurlwhitelist.h"
-#include "llvieweraudio.h"
-#include "llviewerassetstorage.h"
-#include "llviewercamera.h"
-#include "llviewerdisplay.h"
-#include "llviewergenericmessage.h"
-#include "llviewergesture.h"
-#include "llviewertexturelist.h"
-#include "llviewermedia.h"
-#include "llviewermenu.h"
-#include "llviewermessage.h"
-#include "llviewernetwork.h"
-#include "llviewerobjectlist.h"
-#include "llviewerparcelmedia.h"
-#include "llviewerparcelmgr.h"
-#include "llviewerregion.h"
-#include "llviewerstats.h"
-#include "llviewerthrottle.h"
-#include "llviewerwindow.h"
-#include "llvoavatar.h"
-#include "llvoavatarself.h"
-#include "llvoclouds.h"
-#include "llweb.h"
-#include "llworld.h"
-#include "llworldmapmessage.h"
-#include "llxfermanager.h"
-#include "pipeline.h"
-#include "llappviewer.h"
-#include "llfasttimerview.h"
-#include "llfloatermap.h"
-#include "llweb.h"
-#include "llvoiceclient.h"
-#include "llnamelistctrl.h"
-#include "llnamebox.h"
-#include "llnameeditor.h"
-#include "llpostprocess.h"
-#include "llwlparammanager.h"
-#include "llwaterparammanager.h"
-#include "llagentlanguage.h"
-#include "llwearable.h"
-#include "llinventorybridge.h"
-#include "llappearancemgr.h"
-#include "llavatariconctrl.h"
-#include "llvoicechannel.h"
-
-#include "lllogin.h"
-#include "llevents.h"
-#include "llstartuplistener.h"
-
-#if LL_WINDOWS
-#include "lldxhardware.h"
-#endif
-
-//
-// exported globals
-//
-bool gAgentMovementCompleted = false;
-S32  gMaxAgentGroups;
-
-std::string SCREEN_HOME_FILENAME = "screen_home.bmp";
-std::string SCREEN_LAST_FILENAME = "screen_last.bmp";
-
-LLPointer<LLViewerTexture> gStartTexture;
-
-//
-// Imported globals
-//
-extern S32 gStartImageWidth;
-extern S32 gStartImageHeight;
-
-//
-// local globals
-//
-static bool gGotUseCircuitCodeAck = false;
-static std::string sInitialOutfit;
-static std::string sInitialOutfitGender;	// "male" or "female"
-static boost::signals2::connection sWearablesLoadedCon;
-
-static bool gUseCircuitCallbackCalled = false;
-
-EStartupState LLStartUp::gStartupState = STATE_FIRST;
-LLSLURL LLStartUp::sStartSLURL;
-
-static LLPointer<LLCredential> gUserCredential;
-static std::string gDisplayName;
-static BOOL gRememberPassword = TRUE;     
-
-static U64 gFirstSimHandle = 0;
-static LLHost gFirstSim;
-static std::string gFirstSimSeedCap;
-static LLVector3 gAgentStartLookAt(1.0f, 0.f, 0.f);
-static std::string gAgentStartLocation = "safe";
-static bool mLoginStatePastUI = false;
-
-
-boost::scoped_ptr<LLEventPump> LLStartUp::sStateWatcher(new LLEventStream("StartupState"));
-boost::scoped_ptr<LLStartupListener> LLStartUp::sListener(new LLStartupListener());
-
-//
-// local function declaration
-//
-
-void login_show();
-void login_callback(S32 option, void* userdata);
-void show_first_run_dialog();
-bool first_run_dialog_callback(const LLSD& notification, const LLSD& response);
-void set_startup_status(const F32 frac, const std::string& string, const std::string& msg);
-bool login_alert_status(const LLSD& notification, const LLSD& response);
-void login_packet_failed(void**, S32 result);
-void use_circuit_callback(void**, S32 result);
-void register_viewer_callbacks(LLMessageSystem* msg);
-void asset_callback_nothing(LLVFS*, const LLUUID&, LLAssetType::EType, void*, S32);
-bool callback_choose_gender(const LLSD& notification, const LLSD& response);
-void init_start_screen(S32 location_id);
-void release_start_screen();
-void reset_login();
-LLSD transform_cert_args(LLPointer<LLCertificate> cert);
-void general_cert_done(const LLSD& notification, const LLSD& response);
-void trust_cert_done(const LLSD& notification, const LLSD& response);
-void apply_udp_blacklist(const std::string& csv);
-bool process_login_success_response();
-void transition_back_to_login_panel(const std::string& emsg);
-
-void callback_cache_name(const LLUUID& id, const std::string& full_name, bool is_group)
-{
-	LLNameBox::refreshAll(id, full_name, is_group);
-	LLNameEditor::refreshAll(id, full_name, is_group);
-	
-	// TODO: Actually be intelligent about the refresh.
-	// For now, just brute force refresh the dialogs.
-	dialog_refresh_all();
-}
-
-//
-// exported functionality
-//
-
-//
-// local classes
-//
-
-namespace
-{
-	class LLNullHTTPSender : public LLHTTPSender
-	{
-		virtual void send(const LLHost& host, 
-						  const std::string& message, const LLSD& body, 
-						  LLHTTPClient::ResponderPtr response) const
-		{
-			LL_WARNS("AppInit") << " attemped to send " << message << " to " << host
-					<< " with null sender" << LL_ENDL;
-		}
-	};
-}
-
-void update_texture_fetch()
-{
-	LLAppViewer::getTextureCache()->update(1); // unpauses the texture cache thread
-	LLAppViewer::getImageDecodeThread()->update(1); // unpauses the image thread
-	LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread
-	gTextureList.updateImages(0.10f);
-}
-
-// Returns false to skip other idle processing. Should only return
-// true when all initialization done.
-bool idle_startup()
-{
-	LLMemType mt1(LLMemType::MTYPE_STARTUP);
-	
-	const F32 PRECACHING_DELAY = gSavedSettings.getF32("PrecachingDelay");
-	static LLTimer timeout;
-	static S32 timeout_count = 0;
-
-	static LLTimer login_time;
-
-	// until this is encapsulated, this little hack for the
-	// auth/transform loop will do.
-	static F32 progress = 0.10f;
-
-	static std::string auth_desc;
-	static std::string auth_message;
-
-	static LLVector3 initial_sun_direction(1.f, 0.f, 0.f);
-	static LLVector3 agent_start_position_region(10.f, 10.f, 10.f);		// default for when no space server
-
-	// last location by default
-	static S32  agent_location_id = START_LOCATION_ID_LAST;
-	static S32  location_which = START_LOCATION_ID_LAST;
-
-	static bool show_connect_box = true;
-
-	//static bool stipend_since_login = false;
-
-	// HACK: These are things from the main loop that usually aren't done
-	// until initialization is complete, but need to be done here for things
-	// to work.
-	gIdleCallbacks.callFunctions();
-	gViewerWindow->updateUI();
-	LLMortician::updateClass();
-
-	const std::string delims (" ");
-	std::string system;
-	int begIdx, endIdx;
-	std::string osString = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
-
-	begIdx = osString.find_first_not_of (delims);
-	endIdx = osString.find_first_of (delims, begIdx);
-	system = osString.substr (begIdx, endIdx - begIdx);
-	system += "Locale";
-
-	LLStringUtil::setLocale (LLTrans::getString(system));
-
-	if (!gNoRender)
-	{
-		//note: Removing this line will cause incorrect button size in the login screen. -- bao.
-		gTextureList.updateImages(0.01f) ;
-	}
-
-	if ( STATE_FIRST == LLStartUp::getStartupState() )
-	{
-		gViewerWindow->showCursor(); 
-		gViewerWindow->getWindow()->setCursor(UI_CURSOR_WAIT);
-
-		/////////////////////////////////////////////////
-		//
-		// Initialize stuff that doesn't need data from simulators
-		//
-
-		if (LLFeatureManager::getInstance()->isSafe())
-		{
-			LLNotificationsUtil::add("DisplaySetToSafe");
-		}
-		else if ((gSavedSettings.getS32("LastFeatureVersion") < LLFeatureManager::getInstance()->getVersion()) &&
-				 (gSavedSettings.getS32("LastFeatureVersion") != 0))
-		{
-			LLNotificationsUtil::add("DisplaySetToRecommended");
-		}
-		else if ((gSavedSettings.getS32("LastGPUClass") != LLFeatureManager::getInstance()->getGPUClass()) &&
-				 (gSavedSettings.getS32("LastGPUClass") != -1))
-		{
-			LLNotificationsUtil::add("DisplaySetToRecommended");
-		}
-		else if (!gViewerWindow->getInitAlert().empty())
-		{
-			LLNotificationsUtil::add(gViewerWindow->getInitAlert());
-		}
-			
-		gSavedSettings.setS32("LastFeatureVersion", LLFeatureManager::getInstance()->getVersion());
-		gSavedSettings.setS32("LastGPUClass", LLFeatureManager::getInstance()->getGPUClass());
-
-		// load dynamic GPU/feature tables from website (S3)
-		LLFeatureManager::getInstance()->fetchHTTPTables();
-		
-		std::string xml_file = LLUI::locateSkin("xui_version.xml");
-		LLXMLNodePtr root;
-		bool xml_ok = false;
-		if (LLXMLNode::parseFile(xml_file, root, NULL))
-		{
-			if( (root->hasName("xui_version") ) )
-			{
-				std::string value = root->getValue();
-				F32 version = 0.0f;
-				LLStringUtil::convertToF32(value, version);
-				if (version >= 1.0f)
-				{
-					xml_ok = true;
-				}
-			}
-		}
-		if (!xml_ok)
-		{
-			// If XML is bad, there's a good possibility that notifications.xml is ALSO bad.
-			// If that's so, then we'll get a fatal error on attempting to load it, 
-			// which will display a nontranslatable error message that says so.
-			// Otherwise, we'll display a reasonable error message that IS translatable.
-			LLAppViewer::instance()->earlyExit("BadInstallation");
-		}
-		//
-		// Statistics stuff
-		//
-
-		// Load autopilot and stats stuff
-		gAgentPilot.load(gSavedSettings.getString("StatsPilotFile"));
-
-		//gErrorStream.setTime(gSavedSettings.getBOOL("LogTimestamps"));
-
-		// Load the throttle settings
-		gViewerThrottle.load();
-
-		if (ll_init_ares() == NULL || !gAres->isInitialized())
-		{
-			std::string diagnostic = "Could not start address resolution system";
-			LL_WARNS("AppInit") << diagnostic << LL_ENDL;
-			LLAppViewer::instance()->earlyExit("LoginFailedNoNetwork", LLSD().with("DIAGNOSTIC", diagnostic));
-		}
-		
-		//
-		// Initialize messaging system
-		//
-		LL_DEBUGS("AppInit") << "Initializing messaging system..." << LL_ENDL;
-
-		std::string message_template_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"message_template.msg");
-
-		LLFILE* found_template = NULL;
-		found_template = LLFile::fopen(message_template_path, "r");		/* Flawfinder: ignore */
-		
-		#if LL_WINDOWS
-			// On the windows dev builds, unpackaged, the message_template.msg 
-			// file will be located in:
-			// build-vc**/newview/<config>/app_settings
-			if (!found_template)
-			{
-				message_template_path = gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "app_settings", "message_template.msg");
-				found_template = LLFile::fopen(message_template_path.c_str(), "r");		/* Flawfinder: ignore */
-			}	
-		#elif LL_DARWIN
-			// On Mac dev builds, message_template.msg lives in:
-			// indra/build-*/newview/<config>/Second Life/Contents/Resources/app_settings
-			if (!found_template)
-			{
-				message_template_path =
-					gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE,
-												   "../Resources/app_settings",
-												   "message_template.msg");
-				found_template = LLFile::fopen(message_template_path.c_str(), "r");		/* Flawfinder: ignore */
-			}		
-		#endif
-
-		if (found_template)
-		{
-			fclose(found_template);
-
-			U32 port = gSavedSettings.getU32("UserConnectionPort");
-
-			if ((NET_USE_OS_ASSIGNED_PORT == port) &&   // if nothing specified on command line (-port)
-			    (gSavedSettings.getBOOL("ConnectionPortEnabled")))
-			  {
-			    port = gSavedSettings.getU32("ConnectionPort");
-			  }
-
-			LLHTTPSender::setDefaultSender(new LLNullHTTPSender());
-
-			// TODO parameterize 
-			const F32 circuit_heartbeat_interval = 5;
-			const F32 circuit_timeout = 100;
-
-			const LLUseCircuitCodeResponder* responder = NULL;
-			bool failure_is_fatal = true;
-			
-			if(!start_messaging_system(
-				   message_template_path,
-				   port,
-				   LLVersionInfo::getMajor(),
-				   LLVersionInfo::getMinor(),
-				   LLVersionInfo::getPatch(),
-				   FALSE,
-				   std::string(),
-				   responder,
-				   failure_is_fatal,
-				   circuit_heartbeat_interval,
-				   circuit_timeout))
-			{
-				std::string diagnostic = llformat(" Error: %d", gMessageSystem->getErrorCode());
-				LL_WARNS("AppInit") << diagnostic << LL_ENDL;
-				LLAppViewer::instance()->earlyExit("LoginFailedNoNetwork", LLSD().with("DIAGNOSTIC", diagnostic));
-			}
-
-			#if LL_WINDOWS
-				// On the windows dev builds, unpackaged, the message.xml file will 
-				// be located in indra/build-vc**/newview/<config>/app_settings.
-				std::string message_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"message.xml");
-							
-				if (!LLFile::isfile(message_path.c_str())) 
-				{
-					LLMessageConfig::initClass("viewer", gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "app_settings", ""));
-				}
-				else
-				{
-					LLMessageConfig::initClass("viewer", gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, ""));
-				}
-			#else			
-				LLMessageConfig::initClass("viewer", gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, ""));
-			#endif
-
-		}
-		else
-		{
-			LLAppViewer::instance()->earlyExit("MessageTemplateNotFound", LLSD().with("PATH", message_template_path));
-		}
-
-		if(gMessageSystem && gMessageSystem->isOK())
-		{
-			// Initialize all of the callbacks in case of bad message
-			// system data
-			LLMessageSystem* msg = gMessageSystem;
-			msg->setExceptionFunc(MX_UNREGISTERED_MESSAGE,
-								  invalid_message_callback,
-								  NULL);
-			msg->setExceptionFunc(MX_PACKET_TOO_SHORT,
-								  invalid_message_callback,
-								  NULL);
-
-			// running off end of a packet is now valid in the case
-			// when a reader has a newer message template than
-			// the sender
-			/*msg->setExceptionFunc(MX_RAN_OFF_END_OF_PACKET,
-								  invalid_message_callback,
-								  NULL);*/
-			msg->setExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE,
-								  invalid_message_callback,
-								  NULL);
-
-			if (gSavedSettings.getBOOL("LogMessages"))
-			{
-				LL_DEBUGS("AppInit") << "Message logging activated!" << LL_ENDL;
-				msg->startLogging();
-			}
-
-			// start the xfer system. by default, choke the downloads
-			// a lot...
-			const S32 VIEWER_MAX_XFER = 3;
-			start_xfer_manager(gVFS);
-			gXferManager->setMaxIncomingXfers(VIEWER_MAX_XFER);
-			F32 xfer_throttle_bps = gSavedSettings.getF32("XferThrottle");
-			if (xfer_throttle_bps > 1.f)
-			{
-				gXferManager->setUseAckThrottling(TRUE);
-				gXferManager->setAckThrottleBPS(xfer_throttle_bps);
-			}
-			gAssetStorage = new LLViewerAssetStorage(msg, gXferManager, gVFS, gStaticVFS);
-
-
-			F32 dropPercent = gSavedSettings.getF32("PacketDropPercentage");
-			msg->mPacketRing.setDropPercentage(dropPercent);
-
-            F32 inBandwidth = gSavedSettings.getF32("InBandwidth"); 
-            F32 outBandwidth = gSavedSettings.getF32("OutBandwidth"); 
-			if (inBandwidth != 0.f)
-			{
-				LL_DEBUGS("AppInit") << "Setting packetring incoming bandwidth to " << inBandwidth << LL_ENDL;
-				msg->mPacketRing.setUseInThrottle(TRUE);
-				msg->mPacketRing.setInBandwidth(inBandwidth);
-			}
-			if (outBandwidth != 0.f)
-			{
-				LL_DEBUGS("AppInit") << "Setting packetring outgoing bandwidth to " << outBandwidth << LL_ENDL;
-				msg->mPacketRing.setUseOutThrottle(TRUE);
-				msg->mPacketRing.setOutBandwidth(outBandwidth);
-			}
-		}
-
-		LL_INFOS("AppInit") << "Message System Initialized." << LL_ENDL;
-		
-		//-------------------------------------------------
-		// Init audio, which may be needed for prefs dialog
-		// or audio cues in connection UI.
-		//-------------------------------------------------
-
-		if (FALSE == gSavedSettings.getBOOL("NoAudio"))
-		{
-			gAudiop = NULL;
-
-#ifdef LL_OPENAL
-			if (!gAudiop
-#if !LL_WINDOWS
-			    && NULL == getenv("LL_BAD_OPENAL_DRIVER")
-#endif // !LL_WINDOWS
-			    )
-			{
-				gAudiop = (LLAudioEngine *) new LLAudioEngine_OpenAL();
-			}
-#endif
-
-#ifdef LL_FMOD			
-			if (!gAudiop
-#if !LL_WINDOWS
-			    && NULL == getenv("LL_BAD_FMOD_DRIVER")
-#endif // !LL_WINDOWS
-			    )
-			{
-				gAudiop = (LLAudioEngine *) new LLAudioEngine_FMOD();
-			}
-#endif
-
-			if (gAudiop)
-			{
-#if LL_WINDOWS
-				// FMOD on Windows needs the window handle to stop playing audio
-				// when window is minimized. JC
-				void* window_handle = (HWND)gViewerWindow->getPlatformWindow();
-#else
-				void* window_handle = NULL;
-#endif
-				bool init = gAudiop->init(kAUDIO_NUM_SOURCES, window_handle);
-				if(init)
-				{
-					gAudiop->setMuted(TRUE);
-				}
-				else
-				{
-					LL_WARNS("AppInit") << "Unable to initialize audio engine" << LL_ENDL;
-					delete gAudiop;
-					gAudiop = NULL;
-				}
-
-				if (gAudiop)
-				{
-					// if the audio engine hasn't set up its own preferred handler for streaming audio then set up the generic streaming audio implementation which uses media plugins
-					if (NULL == gAudiop->getStreamingAudioImpl())
-					{
-						LL_INFOS("AppInit") << "Using media plugins to render streaming audio" << LL_ENDL;
-						gAudiop->setStreamingAudioImpl(new LLStreamingAudio_MediaPlugins());
-					}
-				}
-			}
-		}
-		
-		LL_INFOS("AppInit") << "Audio Engine Initialized." << LL_ENDL;
-		
-		if (LLTimer::knownBadTimer())
-		{
-			LL_WARNS("AppInit") << "Unreliable timers detected (may be bad PCI chipset)!!" << LL_ENDL;
-		}
-
-		//
-		// Log on to system
-		//
-		if (gUserCredential.isNull())
-		{
-			gUserCredential = gLoginHandler.initializeLoginInfo();
-		}
-		if (gUserCredential.isNull())
-		{
-			show_connect_box = TRUE;
-		}
-		else if (gSavedSettings.getBOOL("AutoLogin"))  
-		{
-			gRememberPassword = TRUE;
-			gSavedSettings.setBOOL("RememberPassword", TRUE);                                                      
-			show_connect_box = false;    			
-		}
-		else 
-		{
-			gRememberPassword = gSavedSettings.getBOOL("RememberPassword");
-			show_connect_box = TRUE;
-		}
-		// Go to the next startup state
-		LLStartUp::setStartupState( STATE_BROWSER_INIT );
-		return FALSE;
-	}
-
-	
-	if (STATE_BROWSER_INIT == LLStartUp::getStartupState())
-	{
-		LL_DEBUGS("AppInit") << "STATE_BROWSER_INIT" << LL_ENDL;
-		std::string msg = LLTrans::getString("LoginInitializingBrowser");
-		set_startup_status(0.03f, msg.c_str(), gAgent.mMOTD.c_str());
-		display_startup();
-		// LLViewerMedia::initBrowser();
-		LLStartUp::setStartupState( STATE_LOGIN_SHOW );
-		return FALSE;
-	}
-
-
-	if (STATE_LOGIN_SHOW == LLStartUp::getStartupState())
-	{
-		LL_DEBUGS("AppInit") << "Initializing Window" << LL_ENDL;
-
-		// if we've gone backwards in the login state machine, to this state where we show the UI
-		// AND the debug setting to exit in this case is true, then go ahead and bail quickly
-		if ( mLoginStatePastUI && gSavedSettings.getBOOL("QuitOnLoginActivated") )
-		{
-			// no requirement for notification here - just exit
-			LLAppViewer::instance()->earlyExitNoNotify();
-		}
-
-		gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW);
-
-		timeout_count = 0;
-
-		if (show_connect_box)
-		{
-			// Load all the name information out of the login view
-			// 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())                                                                          
-			{                                                                                                      
-				gUserCredential = gLoginHandler.initializeLoginInfo();                 
-			}     
-			if (gNoRender)
-			{
-				LL_ERRS("AppInit") << "Need to autologin or use command line with norender!" << LL_ENDL;
-			}
-			// Make sure the process dialog doesn't hide things
-			gViewerWindow->setShowProgress(FALSE);
-
-			initialize_edit_menu();
-
-			// Show the login dialog
-			login_show();
-			// connect dialog is already shown, so fill in the names
-			if (gUserCredential.notNull())                                                                         
-			{                                                                                                      
-				LLPanelLogin::setFields( gUserCredential, gRememberPassword);                                  
-			}     
-			LLPanelLogin::giveFocus();
-
-			gSavedSettings.setBOOL("FirstRunThisInstall", FALSE);
-
-			LLStartUp::setStartupState( STATE_LOGIN_WAIT );		// Wait for user input
-		}
-		else
-		{
-			// skip directly to message template verification
-			LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
-		}
-
-		// *NOTE: This is where LLViewerParcelMgr::getInstance() used to get allocated before becoming LLViewerParcelMgr::getInstance().
-
-		// *NOTE: This is where gHUDManager used to bet allocated before becoming LLHUDManager::getInstance().
-
-		// *NOTE: This is where gMuteList used to get allocated before becoming LLMuteList::getInstance().
-
-		// Login screen needs menus for preferences, but we can enter
-		// this startup phase more than once.
-		if (gLoginMenuBarView == NULL)
-		{
-			init_menus();
-		}
-		
-		gViewerWindow->setNormalControlsVisible( FALSE );	
-		gLoginMenuBarView->setVisible( TRUE );
-		gLoginMenuBarView->setEnabled( TRUE );
-		show_debug_menus();
-
-		// Hide the splash screen
-		LLSplashScreen::hide();
-
-		// Push our window frontmost
-		gViewerWindow->getWindow()->show();
-		display_startup();
-
-		// DEV-16927.  The following code removes errant keystrokes that happen while the window is being 
-		// first made visible.
-#ifdef _WIN32
-		MSG msg;
-		while( PeekMessage( &msg, /*All hWnds owned by this thread */ NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE ) );
-#endif
-		timeout.reset();
-		return FALSE;
-	}
-
-	if (STATE_LOGIN_WAIT == LLStartUp::getStartupState())
-	{
-		// when we get to this state, we've already been past the login UI
-		// (possiblely automatically) - flag this so we can test in the 
-		// STATE_LOGIN_SHOW state if we've gone backwards
-		mLoginStatePastUI = true;
-
-		// Don't do anything.  Wait for the login view to call the login_callback,
-		// which will push us to the next state.
-
-		// Sleep so we don't spin the CPU
-		ms_sleep(1);
-		return FALSE;
-	}
-
-	if (STATE_LOGIN_CLEANUP == LLStartUp::getStartupState())
-	{
-		//reset the values that could have come in from a slurl
-		// DEV-42215: Make sure they're not empty -- gUserCredential
-		// might already have been set from gSavedSettings, and it's too bad
-		// to overwrite valid values with empty strings.
-
-		if (show_connect_box)
-		{
-			// TODO if not use viewer auth
-			// Load all the name information out of the login view
-			LLPanelLogin::getFields(gUserCredential, gRememberPassword); 
-			// end TODO
-	 
-			// HACK: Try to make not jump on login
-			gKeyboard->resetKeys();
-		}
-
-		// when we get to this state, we've already been past the login UI
-		// (possiblely automatically) - flag this so we can test in the 
-		// STATE_LOGIN_SHOW state if we've gone backwards
-		mLoginStatePastUI = true;
-
-		// save the credentials                                                                                        
-		std::string userid = "unknown";                                                                                
-		if(gUserCredential.notNull())                                                                                  
-		{  
-			userid = gUserCredential->userID();                                                                    
-			gSecAPIHandler->saveCredential(gUserCredential, gRememberPassword);  
-		}
-		gSavedSettings.setBOOL("RememberPassword", gRememberPassword);                                                 
-		LL_INFOS("AppInit") << "Attempting login as: " << userid << LL_ENDL;                                           
-		gDebugInfo["LoginName"] = userid;                                                                              
-         
-		// create necessary directories
-		// *FIX: these mkdir's should error check
-		gDirUtilp->setLindenUserDir(userid);
-		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")));
-
-		// Note: can't store warnings files per account because some come up before login
-		
-		// Overwrite default user settings with user settings								 
-		LLAppViewer::instance()->loadSettingsFromDirectory("Account");
-
-		// Need to set the LastLogoff time here if we don't have one.  LastLogoff is used for "Recent Items" calculation
-		// and startup time is close enough if we don't have a real value.
-		if (gSavedPerAccountSettings.getU32("LastLogoff") == 0)
-		{
-			gSavedPerAccountSettings.setU32("LastLogoff", time_corrected());
-		}
-
-		//Default the path if one isn't set.
-		// *NOTE: unable to check variable differ from "InstantMessageLogPath" because it was
-		// provided in pre 2.0 viewer. See EXT-6661
-		if (gSavedPerAccountSettings.getString("InstantMessageLogPath").empty())
-		{
-			gDirUtilp->setChatLogsDir(gDirUtilp->getOSUserAppDir());
-			gSavedPerAccountSettings.setString("InstantMessageLogPath", gDirUtilp->getChatLogsDir());
-		}
-		else
-		{
-			gDirUtilp->setChatLogsDir(gSavedPerAccountSettings.getString("InstantMessageLogPath"));		
-		}
-		gDirUtilp->setPerAccountChatLogsDir(userid);  
-		
-		LLFile::mkdir(gDirUtilp->getChatLogsDir());
-		LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir());
-
-
-		//good a place as any to create user windlight directories
-		std::string user_windlight_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight", ""));
-		LLFile::mkdir(user_windlight_path_name.c_str());		
-
-		std::string user_windlight_skies_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", ""));
-		LLFile::mkdir(user_windlight_skies_path_name.c_str());
-
-		std::string user_windlight_water_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/water", ""));
-		LLFile::mkdir(user_windlight_water_path_name.c_str());
-
-		std::string user_windlight_days_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/days", ""));
-		LLFile::mkdir(user_windlight_days_path_name.c_str());
-
-
-		if (show_connect_box)
-		{
-			LLSLURL slurl;
-			LLPanelLogin::closePanel();
-		}
-
-		
-		// Load URL History File
-		LLURLHistory::loadFile("url_history.xml");
-		// Load location history 
-		LLLocationHistory::getInstance()->load();
-
-		// Load Avatars icons cache
-		LLAvatarIconIDCache::getInstance()->load();
-		
-		// Load media plugin cookies
-		LLViewerMedia::loadCookieFile();
-
-		//-------------------------------------------------
-		// Handle startup progress screen
-		//-------------------------------------------------
-
-		// on startup the user can request to go to their home,
-		// their last location, or some URL "-url //sim/x/y[/z]"
-		// All accounts have both a home and a last location, and we don't support
-		// more locations than that.  Choose the appropriate one.  JC
-		switch (LLStartUp::getStartSLURL().getType())
-		  {
-		  case LLSLURL::LOCATION:
-		    agent_location_id = START_LOCATION_ID_URL;
-		    location_which = START_LOCATION_ID_LAST;
-		    break;
-		  case LLSLURL::LAST_LOCATION:
-		    agent_location_id = START_LOCATION_ID_LAST;
-		    location_which = START_LOCATION_ID_LAST;
-		    break;
-		  default:
-		    agent_location_id = START_LOCATION_ID_HOME;
-		    location_which = START_LOCATION_ID_HOME;
-		    break;
-		  }
-
-		gViewerWindow->getWindow()->setCursor(UI_CURSOR_WAIT);
-
-		if (!gNoRender)
-		{
-			init_start_screen(agent_location_id);
-		}
-
-		// Display the startup progress bar.
-		gViewerWindow->setShowProgress(TRUE);
-		gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Quit"));
-
-		// Poke the VFS, which could potentially block for a while if
-		// Windows XP is acting up
-		set_startup_status(0.07f, LLTrans::getString("LoginVerifyingCache"), LLStringUtil::null);
-		display_startup();
-
-		gVFS->pokeFiles();
-
-		LLStartUp::setStartupState( STATE_LOGIN_AUTH_INIT );
-
-		return FALSE;
-	}
-
-	if(STATE_LOGIN_AUTH_INIT == LLStartUp::getStartupState())
-	{
-		gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridLabel();
-
-		// Update progress status and the display loop.
-		auth_desc = LLTrans::getString("LoginInProgress");
-		set_startup_status(progress, auth_desc, auth_message);
-		progress += 0.02f;
-		display_startup();
-
-		// Setting initial values...
-		LLLoginInstance* login = LLLoginInstance::getInstance();
-		login->setNotificationsInterface(LLNotifications::getInstance());
-		if(gNoRender)
-		{
-			// HACK, skip optional updates if you're running drones
-			login->setSkipOptionalUpdate(true);
-		}
-
-		login->setSerialNumber(LLAppViewer::instance()->getSerialNumber());
-		login->setLastExecEvent(gLastExecEvent);
-		login->setUpdaterLauncher(boost::bind(&LLAppViewer::launchUpdater, LLAppViewer::instance()));
-
-		// This call to LLLoginInstance::connect() starts the 
-		// authentication process.
-		login->connect(gUserCredential);
-
-		LLStartUp::setStartupState( STATE_LOGIN_CURL_UNSTUCK );
-		return FALSE;
-	}
-
-	if(STATE_LOGIN_CURL_UNSTUCK == LLStartUp::getStartupState())
-	{
-		// If we get here we have gotten past the potential stall
-		// in curl, so take "may appear frozen" out of progress bar. JC
-		auth_desc = LLTrans::getString("LoginInProgressNoFrozen");
-		set_startup_status(progress, auth_desc, auth_message);
-
-		LLStartUp::setStartupState( STATE_LOGIN_PROCESS_RESPONSE );
-		return FALSE;
-	}
-
-	if(STATE_LOGIN_PROCESS_RESPONSE == LLStartUp::getStartupState()) 
-	{
-		std::ostringstream emsg;
-		emsg << LLTrans::getString("LoginFailed") << "\n";
-		if(LLLoginInstance::getInstance()->authFailure())
-		{
-			LL_INFOS("LLStartup") << "Login failed, LLLoginInstance::getResponse(): "
-			                      << LLLoginInstance::getInstance()->getResponse() << LL_ENDL;
-			LLSD response = LLLoginInstance::getInstance()->getResponse();
-			// Still have error conditions that may need some 
-			// sort of handling.
-			std::string reason_response = response["reason"];
-			std::string message_response = response["message"];
-	
-			if(!message_response.empty())
-			{
-				// XUI: fix translation for strings returned during login
-				// We need a generic table for translations
-				std::string big_reason = LLAgent::sTeleportErrorMessages[ message_response ];
-				if ( big_reason.size() == 0 )
-				{
-					emsg << message_response;
-				}
-				else
-				{
-					emsg << big_reason;
-				}
-			}
-
-			if(reason_response == "key")
-			{
-				// Couldn't login because user/password is wrong
-				// Clear the credential
-				gUserCredential->clearAuthenticator();
-			}
-
-			if(reason_response == "update" 
-				|| reason_response == "optional")
-			{
-				// In the case of a needed update, quit.
-				// Its either downloading or declined.
-				// If optional was skipped this case shouldn't 
-				// be reached.
-				LLLoginInstance::getInstance()->disconnect();
-				LLAppViewer::instance()->forceQuit();
-			}
-			else 
-			{
-				if (reason_response != "tos") 
-				{
-					// Don't pop up a notification in the TOS case because
-					// LLFloaterTOS::onCancel() already scolded the user.
-					std::string error_code;
-					if(response.has("errorcode"))
-					{
-						error_code = response["errorcode"].asString();
-					}
-					if ((reason_response == "CURLError") && 
-						(error_code == "SSL_CACERT" || error_code == "SSL_PEER_CERTIFICATE") && 
-						response.has("certificate"))
-					{
-						// This was a certificate error, so grab the certificate
-						// and throw up the appropriate dialog.
-						LLPointer<LLCertificate> certificate = gSecAPIHandler->getCertificate(response["certificate"]);
-						if(certificate)
-						{
-							LLSD args = transform_cert_args(certificate);
-
-							if(error_code == "SSL_CACERT")
-							{
-								// if we are handling an untrusted CA, throw up the dialog                             
-								// with the 'trust this CA' button.                                                    
-								LLNotificationsUtil::add("TrustCertificateError", args, response,
-														trust_cert_done);
-								
-								show_connect_box = true;
-							}
-							else
-							{
-								// the certificate exception returns a unique string for each type of exception.       
-								// we grab this string via the LLUserAuth object, and use that to grab the localized   
-								// string.                                                                             
-								args["REASON"] = LLTrans::getString(message_response);
-								
-								LLNotificationsUtil::add("GeneralCertificateError", args, response,
-														 general_cert_done);
-								
-								reset_login();
-								gSavedSettings.setBOOL("AutoLogin", FALSE);
-								show_connect_box = true;
-								
-							}
-
-						}
-					}
-					else 
-					{
-						// This wasn't a certificate error, so throw up the normal
-						// notificatioin message.
-						LLSD args;
-						args["ERROR_MESSAGE"] = emsg.str();
-						LL_INFOS("LLStartup") << "Notification: " << args << LL_ENDL;
-						LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done);
-					}
-				}
-				//setup map of datetime strings to codes and slt & local time offset from utc
-				// *TODO: Does this need to be here?
-				LLStringOps::setupDatetimeInfo (false);
-				transition_back_to_login_panel(emsg.str());
-				show_connect_box = true;
-			}
-		}
-		else if(LLLoginInstance::getInstance()->authSuccess())
-		{
-			if(process_login_success_response())
-			{
-				// Pass the user information to the voice chat server interface.
-				LLVoiceClient::getInstance()->userAuthorized(gUserCredential->userID(), gAgentID);
-				// create the default proximal channel
-				LLVoiceChannel::initClass();
-				LLGridManager::getInstance()->setFavorite(); 
-				LLStartUp::setStartupState( STATE_WORLD_INIT);
-			}
-			else
-			{
-				LLSD args;
-				args["ERROR_MESSAGE"] = emsg.str();
-				LL_INFOS("LLStartup") << "Notification: " << args << LL_ENDL;
-				LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done);
-				transition_back_to_login_panel(emsg.str());
-				show_connect_box = true;
-				return FALSE;
-			}
-		}
-		return FALSE;
-	}
-
-	//---------------------------------------------------------------------
-	// World Init
-	//---------------------------------------------------------------------
-	if (STATE_WORLD_INIT == LLStartUp::getStartupState())
-	{
-		set_startup_status(0.30f, LLTrans::getString("LoginInitializingWorld"), gAgent.mMOTD);
-		display_startup();
-		// We should have an agent id by this point.
-		llassert(!(gAgentID == LLUUID::null));
-
-		// Finish agent initialization.  (Requires gSavedSettings, builds camera)
-		gAgent.init();
-		gAgentCamera.init();
-		set_underclothes_menu_options();
-
-		// 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();
-
-		//
-		// Initialize classes w/graphics stuff.
-		//
-		gTextureList.doPrefetchImages();		
-		LLSurface::initClasses();
-
-		LLFace::initClass();
-
-		LLDrawable::initClass();
-
-		// init the shader managers
-		LLPostProcess::initClass();
-		LLWLParamManager::initClass();
-		LLWaterParamManager::initClass();
-
-		LLViewerObject::initVOClasses();
-
-		// 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();
-
-		// 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:
-		// World initialization must be done after above window init
-
-		// User might have overridden far clip
-		LLWorld::getInstance()->setLandFarClip(gAgentCamera.mDrawDistance);
-
-		// 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));
-
-		LLWorld::getInstance()->addRegion(gFirstSimHandle, gFirstSim);
-
-		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;
-		
-		// Set agent's initial region to be the one we just created.
-		gAgent.setRegion(regionp);
-
-		// 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);
-
-		display_startup();
-		LLStartUp::setStartupState( STATE_MULTIMEDIA_INIT );
-		
-		return FALSE;
-	}
-
-
-	//---------------------------------------------------------------------
-	// Load QuickTime/GStreamer and other multimedia engines, can be slow.
-	// Do it while we're waiting on the network for our seed capability. JC
-	//---------------------------------------------------------------------
-	if (STATE_MULTIMEDIA_INIT == LLStartUp::getStartupState())
-	{
-		LLStartUp::multimediaInit();
-		LLStartUp::setStartupState( STATE_FONT_INIT );
-		return FALSE;
-	}
-
-	// Loading fonts takes several seconds
-	if (STATE_FONT_INIT == LLStartUp::getStartupState())
-	{
-		LLStartUp::fontInit();
-		LLStartUp::setStartupState( STATE_SEED_GRANTED_WAIT );
-		return FALSE;
-	}
-
-	//---------------------------------------------------------------------
-	// Wait for Seed Cap Grant
-	//---------------------------------------------------------------------
-	if(STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState())
-	{
-		return FALSE;
-	}
-
-
-	//---------------------------------------------------------------------
-	// Seed Capability Granted
-	// no newMessage calls should happen before this point
-	//---------------------------------------------------------------------
-	if (STATE_SEED_CAP_GRANTED == LLStartUp::getStartupState())
-	{
-		update_texture_fetch();
-
-		if ( gViewerWindow != NULL)
-		{	// This isn't the first logon attempt, so show the UI
-			gViewerWindow->setNormalControlsVisible( TRUE );
-		}	
-		gLoginMenuBarView->setVisible( FALSE );
-		gLoginMenuBarView->setEnabled( FALSE );
-
-		if (!gNoRender)
-		{
-			// direct logging to the debug console's line buffer
-			LLError::logToFixedBuffer(gDebugView->mDebugConsolep);
-			
-			// set initial visibility of debug console
-			gDebugView->mDebugConsolep->setVisible(gSavedSettings.getBOOL("ShowDebugConsole"));
-		}
-
-		//
-		// Set message handlers
-		//
-		LL_INFOS("AppInit") << "Initializing communications..." << LL_ENDL;
-
-		// register callbacks for messages. . . do this after initial handshake to make sure that we don't catch any unwanted
-		register_viewer_callbacks(gMessageSystem);
-
-		// Debugging info parameters
-		gMessageSystem->setMaxMessageTime( 0.5f );			// Spam if decoding all msgs takes more than 500 ms
-
-		#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
-
-		gXferManager->registerCallbacks(gMessageSystem);
-
-		LLStartUp::initNameCache();
-
-		// update the voice settings *after* gCacheName initialization
-		// so that we can construct voice UI that relies on the name cache
-		LLVoiceClient::getInstance()->updateSettings();
-
-		//gCacheName is required for nearby chat history loading
-		//so I just moved nearby history loading a few states further
-		if (!gNoRender && gSavedPerAccountSettings.getBOOL("LogShowHistory"))
-		{
-			LLNearbyChat* nearby_chat = LLNearbyChat::getInstance();
-			if (nearby_chat) nearby_chat->loadHistory();
-		}
-
-		// *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);
-
-		//reset statistics
-		LLViewerStats::getInstance()->resetStats();
-
-		display_startup();
-		//
-		// Set up region and surface defaults
-		//
-
-
-		// Sets up the parameters for the first simulator
-
-		LL_DEBUGS("AppInit") << "Initializing camera..." << LL_ENDL;
-		gFrameTime    = totalTime();
-		F32 last_time = gFrameTimeSeconds;
-		gFrameTimeSeconds = (S64)(gFrameTime - gStartTime)/SEC_TO_MICROSEC;
-
-		gFrameIntervalSeconds = gFrameTimeSeconds - last_time;
-		if (gFrameIntervalSeconds < 0.f)
-		{
-			gFrameIntervalSeconds = 0.f;
-		}
-
-		// Make sure agent knows correct aspect ratio
-		// FOV limits depend upon aspect ratio so this needs to happen before initializing the FOV below
-		LLViewerCamera::getInstance()->setViewHeightInPixels(gViewerWindow->getWorldViewHeightRaw());
-		LLViewerCamera::getInstance()->setAspect(gViewerWindow->getWorldViewAspectRatio());
-		// Initialize FOV
-		LLViewerCamera::getInstance()->setDefaultFOV(gSavedSettings.getF32("CameraAngle")); 
-
-		// Move agent to starting location. The position handed to us by
-		// the space server is in global coordinates, but the agent frame
-		// is in region local coordinates. Therefore, we need to adjust
-		// the coordinates handed to us to fit in the local region.
-
-		gAgent.setPositionAgent(agent_start_position_region);
-		gAgent.resetAxes(gAgentStartLookAt);
-		gAgentCamera.stopCameraAnimation();
-		gAgentCamera.resetCamera();
-
-		// Initialize global class data needed for surfaces (i.e. textures)
-		if (!gNoRender)
-		{
-			LL_DEBUGS("AppInit") << "Initializing sky..." << LL_ENDL;
-			// Initialize all of the viewer object classes for the first time (doing things like texture fetches.
-			LLGLState::checkStates();
-			LLGLState::checkTextureChannels();
-
-			gSky.init(initial_sun_direction);
-
-			LLGLState::checkStates();
-			LLGLState::checkTextureChannels();
-		}
-
-		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
-		const S32 DECODE_TIME_SEC = 2;
-		for (int i = 0; i < DECODE_TIME_SEC; i++)
-		{
-			F32 frac = (F32)i / (F32)DECODE_TIME_SEC;
-			set_startup_status(0.45f + frac*0.1f, LLTrans::getString("LoginDecodingImages"), gAgent.mMOTD);
-			display_startup();
-			gTextureList.decodeAllImages(1.f);
-		}
-		LLStartUp::setStartupState( STATE_WORLD_WAIT );
-
-		// JC - Do this as late as possible to increase likelihood Purify
-		// will run.
-		LLMessageSystem* msg = gMessageSystem;
-		if (!msg->mOurCircuitCode)
-		{
-			LL_WARNS("AppInit") << "Attempting to connect to simulator with a zero circuit code!" << LL_ENDL;
-		}
-
-		gUseCircuitCallbackCalled = false;
-
-		msg->enableCircuit(gFirstSim, TRUE);
-		// now, use the circuit info to tell simulator about us!
-		LL_INFOS("AppInit") << "viewer: UserLoginLocationReply() Enabling " << gFirstSim << " with code " << msg->mOurCircuitCode << LL_ENDL;
-		msg->newMessageFast(_PREHASH_UseCircuitCode);
-		msg->nextBlockFast(_PREHASH_CircuitCode);
-		msg->addU32Fast(_PREHASH_Code, msg->mOurCircuitCode);
-		msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
-		msg->addUUIDFast(_PREHASH_ID, gAgent.getID());
-		msg->sendReliable(
-			gFirstSim,
-			gSavedSettings.getS32("UseCircuitCodeMaxRetries"),
-			FALSE,
-			gSavedSettings.getF32("UseCircuitCodeTimeout"),
-			use_circuit_callback,
-			NULL);
-
-		timeout.reset();
-
-		return FALSE;
-	}
-
-	//---------------------------------------------------------------------
-	// Agent Send
-	//---------------------------------------------------------------------
-	if(STATE_WORLD_WAIT == LLStartUp::getStartupState())
-	{
-		LL_DEBUGS("AppInit") << "Waiting for simulator ack...." << LL_ENDL;
-		set_startup_status(0.59f, LLTrans::getString("LoginWaitingForRegionHandshake"), gAgent.mMOTD);
-		if(gGotUseCircuitCodeAck)
-		{
-			LLStartUp::setStartupState( STATE_AGENT_SEND );
-		}
-		LLMessageSystem* msg = gMessageSystem;
-		while (msg->checkAllMessages(gFrameCount, gServicePump))
-		{
-		}
-		msg->processAcks();
-		return FALSE;
-	}
-
-	//---------------------------------------------------------------------
-	// Agent Send
-	//---------------------------------------------------------------------
-	if (STATE_AGENT_SEND == LLStartUp::getStartupState())
-	{
-		LL_DEBUGS("AppInit") << "Connecting to region..." << LL_ENDL;
-		set_startup_status(0.60f, LLTrans::getString("LoginConnectingToRegion"), gAgent.mMOTD);
-		// register with the message system so it knows we're
-		// expecting this message
-		LLMessageSystem* msg = gMessageSystem;
-		msg->setHandlerFuncFast(
-			_PREHASH_AgentMovementComplete,
-			process_agent_movement_complete);
-		LLViewerRegion* regionp = gAgent.getRegion();
-		if(regionp)
-		{
-			send_complete_agent_movement(regionp->getHost());
-			gAssetStorage->setUpstream(regionp->getHost());
-			gCacheName->setUpstream(regionp->getHost());
-			msg->newMessageFast(_PREHASH_EconomyDataRequest);
-			gAgent.sendReliableMessage();
-		}
-
-		// Create login effect
-		// But not on first login, because you can't see your avatar then
-		if (!gAgent.isFirstLogin())
-		{
-			LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
-			effectp->setPositionGlobal(gAgent.getPositionGlobal());
-			effectp->setColor(LLColor4U(gAgent.getEffectColor()));
-			LLHUDManager::getInstance()->sendEffects();
-		}
-
-		LLStartUp::setStartupState( STATE_AGENT_WAIT );		// Go to STATE_AGENT_WAIT
-
-		timeout.reset();
-		return FALSE;
-	}
-
-	//---------------------------------------------------------------------
-	// Agent Wait
-	//---------------------------------------------------------------------
-	if (STATE_AGENT_WAIT == LLStartUp::getStartupState())
-	{
-		LLMessageSystem* msg = gMessageSystem;
-		while (msg->checkAllMessages(gFrameCount, gServicePump))
-		{
-			if (gAgentMovementCompleted)
-			{
-				// Sometimes we have more than one message in the
-				// queue. break out of this loop and continue
-				// processing. If we don't, then this could skip one
-				// or more login steps.
-				break;
-			}
-			else
-			{
-				LL_DEBUGS("AppInit") << "Awaiting AvatarInitComplete, got "
-				<< msg->getMessageName() << LL_ENDL;
-			}
-		}
-		msg->processAcks();
-
-		if (gAgentMovementCompleted)
-		{
-			LLStartUp::setStartupState( STATE_INVENTORY_SEND );
-		}
-
-		return FALSE;
-	}
-
-	//---------------------------------------------------------------------
-	// Inventory Send
-	//---------------------------------------------------------------------
-	if (STATE_INVENTORY_SEND == LLStartUp::getStartupState())
-	{
-		// Inform simulator of our language preference
-		LLAgentLanguage::update();
-
-		// unpack thin inventory
-		LLSD response = LLLoginInstance::getInstance()->getResponse();
-		//bool dump_buffer = false;
-
-		LLSD inv_lib_root = response["inventory-lib-root"];
-		if(inv_lib_root.isDefined())
-		{
-			// should only be one
-			LLSD id = inv_lib_root[0]["folder_id"];
-			if(id.isDefined())
-			{
-				gInventory.setLibraryRootFolderID(id.asUUID());
-			}
-		}
- 		
-		LLSD inv_lib_owner = response["inventory-lib-owner"];
-		if(inv_lib_owner.isDefined())
-		{
-			// should only be one
-			LLSD id = inv_lib_owner[0]["agent_id"];
-			if(id.isDefined())
-			{
-				gInventory.setLibraryOwnerID( LLUUID(id.asUUID()));
-			}
-		}
-
-		LLSD inv_skel_lib = response["inventory-skel-lib"];
- 		if(inv_skel_lib.isDefined() && gInventory.getLibraryOwnerID().notNull())
- 		{
- 			if(!gInventory.loadSkeleton(inv_skel_lib, gInventory.getLibraryOwnerID()))
- 			{
- 				LL_WARNS("AppInit") << "Problem loading inventory-skel-lib" << LL_ENDL;
- 			}
- 		}
-
-		LLSD inv_skeleton = response["inventory-skeleton"];
- 		if(inv_skeleton.isDefined())
- 		{
- 			if(!gInventory.loadSkeleton(inv_skeleton, gAgent.getID()))
- 			{
- 				LL_WARNS("AppInit") << "Problem loading inventory-skel-targets" << LL_ENDL;
- 			}
- 		}
-
-		LLSD buddy_list = response["buddy-list"];
- 		if(buddy_list.isDefined())
- 		{
-			LLAvatarTracker::buddy_map_t list;
-			LLUUID agent_id;
-			S32 has_rights = 0, given_rights = 0;
-			for(LLSD::array_const_iterator it = buddy_list.beginArray(),
-				end = buddy_list.endArray(); it != end; ++it)
-			{
-				LLSD buddy_id = (*it)["buddy_id"];
-				if(buddy_id.isDefined())
-				{
-					agent_id = buddy_id.asUUID();
-				}
-
-				LLSD buddy_rights_has = (*it)["buddy_rights_has"];
-				if(buddy_rights_has.isDefined())
-				{
-					has_rights = buddy_rights_has.asInteger();
-				}
-
-				LLSD buddy_rights_given = (*it)["buddy_rights_given"];
-				if(buddy_rights_given.isDefined())
-				{
-					given_rights = buddy_rights_given.asInteger();
-				}
-
-				list[agent_id] = new LLRelationship(given_rights, has_rights, false);
-			}
-			LLAvatarTracker::instance().addBuddyList(list);
- 		}
-
-		bool show_hud = false;
-		LLSD tutorial_setting = response["tutorial_setting"];
-		if(tutorial_setting.isDefined())
-		{
-			for(LLSD::array_const_iterator it = tutorial_setting.beginArray(),
-				end = tutorial_setting.endArray(); it != end; ++it)
-			{
-				LLSD tutorial_url = (*it)["tutorial_url"];
-				if(tutorial_url.isDefined())
-				{
-					// Tutorial floater will append language code
-					gSavedSettings.setString("TutorialURL", tutorial_url.asString());
-				}
-				
-				// For Viewer 2.0 we are not using the web-based tutorial
-				// If we reverse that decision, put this code back and use
-				// login.cgi to send a different URL with content that matches
-				// the Viewer 2.0 UI.
-				//LLSD use_tutorial = (*it)["use_tutorial"];
-				//if(use_tutorial.asString() == "true")
-				//{
-				//	show_hud = true;
-				//}
-			}
-		}
-		// 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
-		if (show_hud || gSavedSettings.getBOOL("ShowTutorial"))
-		{
-			LLFloaterReg::showInstance("hud", LLSD(), FALSE);
-		}
-
-		LLSD event_notifications = response["event_notifications"];
-		if(event_notifications.isDefined())
-		{
-			gEventNotifier.load(event_notifications);
-		}
-
-		LLSD classified_categories = response["classified_categories"];
-		if(classified_categories.isDefined())
-		{
-			LLClassifiedInfo::loadCategories(classified_categories);
-		}
-
-		// This method MUST be called before gInventory.findCategoryUUIDForType because of 
-		// gInventory.mIsAgentInvUsable is set to true in the gInventory.buildParentChildMap.
-		gInventory.buildParentChildMap();
-
-		//all categories loaded. lets create "My Favorites" category
-		gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE,true);
-
-		// set up callbacks
-		llinfos << "Registering Callbacks" << llendl;
-		LLMessageSystem* msg = gMessageSystem;
-		llinfos << " Inventory" << llendl;
-		LLInventoryModel::registerCallbacks(msg);
-		llinfos << " AvatarTracker" << llendl;
-		LLAvatarTracker::instance().registerCallbacks(msg);
-		llinfos << " Landmark" << llendl;
-		LLLandmark::registerCallbacks(msg);
-
-		// request mute list
-		llinfos << "Requesting Mute List" << llendl;
-		LLMuteList::getInstance()->requestFromServer(gAgent.getID());
-
-		// Get L$ and ownership credit information
-		llinfos << "Requesting Money Balance" << llendl;
-		LLStatusBar::sendMoneyBalanceRequest();
-
-		// request all group information
-		llinfos << "Requesting Agent Data" << llendl;
-		gAgent.sendAgentDataUpdateRequest();
-
-		// Create the inventory views
-		llinfos << "Creating Inventory Views" << llendl;
-		LLFloaterReg::getInstance("inventory");
-
-		LLStartUp::setStartupState( STATE_MISC );
-		return FALSE;
-	}
-
-
-	//---------------------------------------------------------------------
-	// Misc
-	//---------------------------------------------------------------------
-	if (STATE_MISC == LLStartUp::getStartupState())
-	{
-		// We have a region, and just did a big inventory download.
-		// We can estimate the user's connection speed, and set their
-		// max bandwidth accordingly.  JC
-		if (gSavedSettings.getBOOL("FirstLoginThisInstall"))
-		{
-			// This is actually a pessimistic computation, because TCP may not have enough
-			// time to ramp up on the (small) default inventory file to truly measure max
-			// bandwidth. JC
-			F64 rate_bps = LLLoginInstance::getInstance()->getLastTransferRateBPS();
-			const F32 FAST_RATE_BPS = 600.f * 1024.f;
-			const F32 FASTER_RATE_BPS = 750.f * 1024.f;
-			F32 max_bandwidth = gViewerThrottle.getMaxBandwidth();
-			if (rate_bps > FASTER_RATE_BPS
-				&& rate_bps > max_bandwidth)
-			{
-				LL_DEBUGS("AppInit") << "Fast network connection, increasing max bandwidth to " 
-					<< FASTER_RATE_BPS/1024.f 
-					<< " kbps" << LL_ENDL;
-				gViewerThrottle.setMaxBandwidth(FASTER_RATE_BPS / 1024.f);
-			}
-			else if (rate_bps > FAST_RATE_BPS
-				&& rate_bps > max_bandwidth)
-			{
-				LL_DEBUGS("AppInit") << "Fast network connection, increasing max bandwidth to " 
-					<< FAST_RATE_BPS/1024.f 
-					<< " kbps" << LL_ENDL;
-				gViewerThrottle.setMaxBandwidth(FAST_RATE_BPS / 1024.f);
-			}
-
-			// Set the show start location to true, now that the user has logged
-			// on with this install.
-			gSavedSettings.setBOOL("ShowStartLocation", TRUE);
-		}
-
-		// We're successfully logged in.
-		gSavedSettings.setBOOL("FirstLoginThisInstall", FALSE);
-
-		LLFloaterReg::showInitialVisibleInstances();
-
-		// 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" );
-		if ( nextLoginLocation.length() )
-		{
-			// clear it
-			gSavedSettings.setString( "NextLoginLocation", "" );
-
-			// and make sure it's saved
-			gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile") , TRUE );
-			LLUIColorTable::instance().saveUserSettings();
-		};
-
-		if (!gNoRender)
-		{
-			// JC: Initializing audio requests many sounds for download.
-			init_audio();
-
-			// JC: Initialize "active" gestures.  This may also trigger
-			// many gesture downloads, if this is the user's first
-			// time on this machine or -purge has been run.
-			LLSD gesture_options 
-				= LLLoginInstance::getInstance()->getResponse("gestures");
-			if (gesture_options.isDefined())
-			{
-				LL_DEBUGS("AppInit") << "Gesture Manager loading " << gesture_options.size()
-					<< LL_ENDL;
-				uuid_vec_t item_ids;
-				for(LLSD::array_const_iterator resp_it = gesture_options.beginArray(),
-					end = gesture_options.endArray(); resp_it != end; ++resp_it)
-				{
-					// If the id is not specifed in the LLSD,
-					// the LLSD operator[]() will return a null LLUUID. 
-					LLUUID item_id = (*resp_it)["item_id"];
-					LLUUID asset_id = (*resp_it)["asset_id"];
-
-					if (item_id.notNull() && asset_id.notNull())
-					{
-						// Could schedule and delay these for later.
-						const BOOL no_inform_server = FALSE;
-						const BOOL no_deactivate_similar = FALSE;
-						LLGestureMgr::instance().activateGestureWithAsset(item_id, asset_id,
-											 no_inform_server,
-											 no_deactivate_similar);
-						// We need to fetch the inventory items for these gestures
-						// so we have the names to populate the UI.
-						item_ids.push_back(item_id);
-					}
-				}
-				// no need to add gesture to inventory observer, it's already made in constructor 
-				LLGestureMgr::instance().setFetchIDs(item_ids);
-				LLGestureMgr::instance().startFetch();
-			}
-		}
-		gDisplaySwapBuffers = TRUE;
-
-		LLMessageSystem* msg = gMessageSystem;
-		msg->setHandlerFuncFast(_PREHASH_SoundTrigger,				process_sound_trigger);
-		msg->setHandlerFuncFast(_PREHASH_PreloadSound,				process_preload_sound);
-		msg->setHandlerFuncFast(_PREHASH_AttachedSound,				process_attached_sound);
-		msg->setHandlerFuncFast(_PREHASH_AttachedSoundGainChange,	process_attached_sound_gain_change);
-
-		LL_DEBUGS("AppInit") << "Initialization complete" << LL_ENDL;
-
-		gRenderStartTime.reset();
-		gForegroundTime.reset();
-
-		// HACK: Inform simulator of window size.
-		// Do this here so it's less likely to race with RegisterNewAgent.
-		// TODO: Put this into RegisterNewAgent
-		// JC - 7/20/2002
-		gViewerWindow->sendShapeToSim();
-
-		
-		// Ignore stipend information for now.  Money history is on the web site.
-		// if needed, show the L$ history window
-		//if (stipend_since_login && !gNoRender)
-		//{
-		//}
-
-		// The reason we show the alert is because we want to
-		// reduce confusion for when you log in and your provided
-		// location is not your expected location. So, if this is
-		// your first login, then you do not have an expectation,
-		// thus, do not show this alert.
-		if (!gAgent.isFirstLogin())
-		{
-			llinfos << "gAgentStartLocation : " << gAgentStartLocation << llendl;
-			LLSLURL start_slurl = LLStartUp::getStartSLURL();
-			
-			if (((start_slurl.getType() == LLSLURL::LOCATION) && (gAgentStartLocation == "url")) ||
-				((start_slurl.getType() == LLSLURL::LAST_LOCATION) && (gAgentStartLocation == "last")) ||
-				((start_slurl.getType() == LLSLURL::HOME_LOCATION) && (gAgentStartLocation == "home")))
-			{
-				// Start location is OK
-				// Disabled code to restore camera location and focus if logging in to default location
-				static bool samename = false;
-				if (samename)
-				{
-					// restore old camera pos
-					gAgentCamera.setFocusOnAvatar(FALSE, FALSE);
-					gAgentCamera.setCameraPosAndFocusGlobal(gSavedSettings.getVector3d("CameraPosOnLogout"), gSavedSettings.getVector3d("FocusPosOnLogout"), LLUUID::null);
-					BOOL limit_hit = FALSE;
-					gAgentCamera.calcCameraPositionTargetGlobal(&limit_hit);
-					if (limit_hit)
-					{
-						gAgentCamera.setFocusOnAvatar(TRUE, FALSE);
-					}
-					gAgentCamera.stopCameraAnimation();
-				}
-			}
-			else
-			{
-				std::string msg;
-				switch(start_slurl.getType())
-				{
-					case LLSLURL::LOCATION:
-					{
-						
-						msg = "AvatarMovedDesired";
-						break;
-					}
-					case LLSLURL::HOME_LOCATION:
-					{
-						msg = "AvatarMovedHome";
-						break;
-					}
-					default:
-					{
-						msg = "AvatarMovedLast";
-					}
-				}
-				LLNotificationsUtil::add(msg);
-			}
-		}
-
-        //DEV-17797.  get null folder.  Any items found here moved to Lost and Found
-        LLInventoryModelBackgroundFetch::instance().findLostItems();
-
-		LLStartUp::setStartupState( STATE_PRECACHE );
-		timeout.reset();
-		return FALSE;
-	}
-
-	if (STATE_PRECACHE == LLStartUp::getStartupState())
-	{
-		F32 timeout_frac = timeout.getElapsedTimeF32()/PRECACHING_DELAY;
-
-		// We now have an inventory skeleton, so if this is a user's first
-		// login, we can start setting up their clothing and avatar 
-		// appearance.  This helps to avoid the generic "Ruth" avatar in
-		// the orientation island tutorial experience. JC
-		if (gAgent.isFirstLogin()
-			&& !sInitialOutfit.empty()    // registration set up an outfit
-			&& !sInitialOutfitGender.empty() // and a gender
-			&& isAgentAvatarValid()	  // can't wear clothes without object
-			&& !gAgent.isGenderChosen() ) // nothing already loading
-		{
-			// Start loading the wearables, textures, gestures
-			LLStartUp::loadInitialOutfit( sInitialOutfit, sInitialOutfitGender );
-		}
-
-		// wait precache-delay and for agent's avatar or a lot longer.
-		if(((timeout_frac > 1.f) && isAgentAvatarValid())
-		   || (timeout_frac > 3.f))
-		{
-			LLStartUp::setStartupState( STATE_WEARABLES_WAIT );
-		}
-		else
-		{
-			update_texture_fetch();
-			set_startup_status(0.60f + 0.30f * timeout_frac,
-				LLTrans::getString("LoginPrecaching"),
-					gAgent.mMOTD);
-			display_startup();
-			if (!LLViewerShaderMgr::sInitialized)
-			{
-				LLViewerShaderMgr::sInitialized = TRUE;
-				LLViewerShaderMgr::instance()->setShaders();
-			}
-		}
-		
-		return TRUE;
-	}
-
-	if (STATE_WEARABLES_WAIT == LLStartUp::getStartupState())
-	{
-		static LLFrameTimer wearables_timer;
-
-		const F32 wearables_time = wearables_timer.getElapsedTimeF32();
-		const F32 MAX_WEARABLES_TIME = 10.f;
-
-		if (!gAgent.isGenderChosen())
-		{
-			// No point in waiting for clothing, we don't even
-			// know what gender we are.  Pop a dialog to ask and
-			// proceed to draw the world. JC
-			//
-			// *NOTE: We might hit this case even if we have an
-			// initial outfit, but if the load hasn't started
-			// already then something is wrong so fall back
-			// to generic outfits. JC
-			LLNotificationsUtil::add("WelcomeChooseSex", LLSD(), LLSD(),
-				callback_choose_gender);
-			LLStartUp::setStartupState( STATE_CLEANUP );
-			return TRUE;
-		}
-		
-		if (wearables_time > MAX_WEARABLES_TIME)
-		{
-			LLNotificationsUtil::add("ClothingLoading");
-			LLViewerStats::getInstance()->incStat(LLViewerStats::ST_WEARABLES_TOO_LONG);
-			LLStartUp::setStartupState( STATE_CLEANUP );
-			return TRUE;
-		}
-
-		if (gAgent.isFirstLogin())
-		{
-			// wait for avatar to be completely loaded
-			if (isAgentAvatarValid()
-				&& gAgentAvatarp->isFullyLoaded())
-			{
-				//llinfos << "avatar fully loaded" << llendl;
-				LLStartUp::setStartupState( STATE_CLEANUP );
-				return TRUE;
-			}
-		}
-		else
-		{
-			// OK to just get the wearables
-			if ( gAgentWearables.areWearablesLoaded() )
-			{
-				// We have our clothing, proceed.
-				//llinfos << "wearables loaded" << llendl;
-				LLStartUp::setStartupState( STATE_CLEANUP );
-				return TRUE;
-			}
-		}
-
-		update_texture_fetch();
-		set_startup_status(0.9f + 0.1f * wearables_time / MAX_WEARABLES_TIME,
-						 LLTrans::getString("LoginDownloadingClothing").c_str(),
-						 gAgent.mMOTD.c_str());
-		return TRUE;
-	}
-
-	if (STATE_CLEANUP == LLStartUp::getStartupState())
-	{
-		set_startup_status(1.0, "", "");
-
-		// Let the map know about the inventory.
-		LLFloaterWorldMap* floater_world_map = LLFloaterWorldMap::getInstance();
-		if(floater_world_map)
-		{
-			floater_world_map->observeInventory(&gInventory);
-			floater_world_map->observeFriends();
-		}
-		gViewerWindow->showCursor();
-		gViewerWindow->getWindow()->resetBusyCount();
-		gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW);
-		LL_DEBUGS("AppInit") << "Done releasing bitmap" << LL_ENDL;
-		gViewerWindow->setShowProgress(FALSE);
-		gViewerWindow->setProgressCancelButtonVisible(FALSE);
-
-		// We're not away from keyboard, even though login might have taken
-		// a while. JC
-		gAgent.clearAFK();
-
-		// Have the agent start watching the friends list so we can update proxies
-		gAgent.observeFriends();
-		if (gSavedSettings.getBOOL("LoginAsGod"))
-		{
-			gAgent.requestEnterGodMode();
-		}
-		
-		// Start automatic replay if the flag is set.
-		if (gSavedSettings.getBOOL("StatsAutoRun") || LLAgentPilot::sReplaySession)
-		{
-			LLUUID id;
-			LL_DEBUGS("AppInit") << "Starting automatic playback" << LL_ENDL;
-			gAgentPilot.startPlayback();
-		}
-
-		show_debug_menus(); // Debug menu visiblity and First Use trigger
-		
-		// If we've got a startup URL, dispatch it
-		LLStartUp::dispatchURL();
-
-		// Retrieve information about the land data
-		// (just accessing this the first time will fetch it,
-		// then the data is cached for the viewer's lifetime)
-		LLProductInfoRequestManager::instance();
-		
-		// *FIX:Mani - What do I do here?
-		// Need we really clear the Auth response data?
-		// Clean up the userauth stuff.
-		// LLUserAuth::getInstance()->reset();
-
-		LLStartUp::setStartupState( STATE_STARTED );
-
-		// Unmute audio if desired and setup volumes.
-		// Unmute audio if desired and setup volumes.
-		// This is a not-uncommon crash site, so surround it with
-		// llinfos output to aid diagnosis.
-		LL_INFOS("AppInit") << "Doing first audio_update_volume..." << LL_ENDL;
-		audio_update_volume();
-		LL_INFOS("AppInit") << "Done first audio_update_volume." << LL_ENDL;
-
-		// reset keyboard focus to sane state of pointing at world
-		gFocusMgr.setKeyboardFocus(NULL);
-
-#if 0 // sjb: enable for auto-enabling timer display 
-		gDebugView->mFastTimerView->setVisible(TRUE);
-#endif
-
-		LLAppViewer::instance()->handleLoginComplete();
-
-		// reset timers now that we are running "logged in" logic
-		LLFastTimer::reset();
-
-		LLAgentPicksInfo::getInstance()->requestNumberOfPicks();
-
-		LLIMFloater::initIMFloater();
-
-		return TRUE;
-	}
-
-	LL_WARNS("AppInit") << "Reached end of idle_startup for state " << LLStartUp::getStartupState() << LL_ENDL;
-	return TRUE;
-}
-
-//
-// local function definition
-//
-
-void login_show()
-{
-	LL_INFOS("AppInit") << "Initializing Login Screen" << LL_ENDL;
-
-#ifdef LL_RELEASE_FOR_DOWNLOAD
-	BOOL bUseDebugLogin = gSavedSettings.getBOOL("UseDebugLogin");
-#else
-	BOOL bUseDebugLogin = TRUE;
-#endif
-
-	LLPanelLogin::show(	gViewerWindow->getWindowRectScaled(),
-						bUseDebugLogin || gSavedSettings.getBOOL("SecondLifeEnterprise"),
-						login_callback, NULL );
-
-}
-
-// Callback for when login screen is closed.  Option 0 = connect, option 1 = quit.
-void login_callback(S32 option, void *userdata)
-{
-	const S32 CONNECT_OPTION = 0;
-	const S32 QUIT_OPTION = 1;
-
-	if (CONNECT_OPTION == option)
-	{
-		LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
-		return;
-	}
-	else if (QUIT_OPTION == option) // *TODO: THIS CODE SEEMS TO BE UNREACHABLE!!!!! login_callback is never called with option equal to QUIT_OPTION
-	{
-		if (!gSavedSettings.getBOOL("RememberPassword"))
-		{
-			// turn off the setting and write out to disk
-			gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile") , TRUE );
-			LLUIColorTable::instance().saveUserSettings();
-		}
-
-		// Next iteration through main loop should shut down the app cleanly.
-		LLAppViewer::instance()->userQuit();
-		
-		if (LLAppViewer::instance()->quitRequested())
-		{
-			LLPanelLogin::closePanel();
-		}
-		return;
-	}
-	else
-	{
-		LL_WARNS("AppInit") << "Unknown login button clicked" << LL_ENDL;
-	}
-}
-
-void show_first_run_dialog()
-{
-	LLNotificationsUtil::add("FirstRun", LLSD(), LLSD(), first_run_dialog_callback);
-}
-
-bool first_run_dialog_callback(const LLSD& notification, const LLSD& response)
-{
-	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-	if (0 == option)
-	{
-		LL_DEBUGS("AppInit") << "First run dialog cancelling" << LL_ENDL;
-		LLWeb::loadURLExternal(LLTrans::getString("create_account_url") );
-	}
-
-	LLPanelLogin::giveFocus();
-	return false;
-}
-
-
-
-void set_startup_status(const F32 frac, const std::string& string, const std::string& msg)
-{
-	gViewerWindow->setProgressPercent(frac*100);
-	gViewerWindow->setProgressString(string);
-
-	gViewerWindow->setProgressMessage(msg);
-}
-
-bool login_alert_status(const LLSD& notification, const LLSD& response)
-{
-	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-    // Buttons
-    switch( option )
-    {
-        case 0:     // OK
-            break;
-      //  case 1:     // Help
-      //      LLWeb::loadURL(LLNotifications::instance().getGlobalString("SUPPORT_URL") );
-      //      break;
-        case 2:     // Teleport
-            // Restart the login process, starting at our home locaton
-	  LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
-            LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
-            break;
-        default:
-            LL_WARNS("AppInit") << "Missing case in login_alert_status switch" << LL_ENDL;
-    }
-
-	LLPanelLogin::giveFocus();
-	return false;
-}
-
-
-void use_circuit_callback(void**, S32 result)
-{
-	// bail if we're quitting.
-	if(LLApp::isExiting()) return;
-	if( !gUseCircuitCallbackCalled )
-	{
-		gUseCircuitCallbackCalled = true;
-		if (result)
-		{
-			// Make sure user knows something bad happened. JC
-			LL_WARNS("AppInit") << "Backing up to login screen!" << LL_ENDL;
-			LLNotificationsUtil::add("LoginPacketNeverReceived", LLSD(), LLSD(), login_alert_status);
-			reset_login();
-		}
-		else
-		{
-			gGotUseCircuitCodeAck = true;
-		}
-	}
-}
-
-void register_viewer_callbacks(LLMessageSystem* msg)
-{
-	msg->setHandlerFuncFast(_PREHASH_LayerData,				process_layer_data );
-	msg->setHandlerFuncFast(_PREHASH_ImageData,				LLViewerTextureList::receiveImageHeader );
-	msg->setHandlerFuncFast(_PREHASH_ImagePacket,				LLViewerTextureList::receiveImagePacket );
-	msg->setHandlerFuncFast(_PREHASH_ObjectUpdate,				process_object_update );
-	msg->setHandlerFunc("ObjectUpdateCompressed",				process_compressed_object_update );
-	msg->setHandlerFunc("ObjectUpdateCached",					process_cached_object_update );
-	msg->setHandlerFuncFast(_PREHASH_ImprovedTerseObjectUpdate, process_terse_object_update_improved );
-	msg->setHandlerFunc("SimStats",				process_sim_stats);
-	msg->setHandlerFuncFast(_PREHASH_HealthMessage,			process_health_message );
-	msg->setHandlerFuncFast(_PREHASH_EconomyData,				process_economy_data);
-	msg->setHandlerFunc("RegionInfo", LLViewerRegion::processRegionInfo);
-
-	msg->setHandlerFuncFast(_PREHASH_ChatFromSimulator,		process_chat_from_simulator);
-	msg->setHandlerFuncFast(_PREHASH_KillObject,				process_kill_object,	NULL);
-	msg->setHandlerFuncFast(_PREHASH_SimulatorViewerTimeMessage,	process_time_synch,		NULL);
-	msg->setHandlerFuncFast(_PREHASH_EnableSimulator,			process_enable_simulator);
-	msg->setHandlerFuncFast(_PREHASH_DisableSimulator,			process_disable_simulator);
-	msg->setHandlerFuncFast(_PREHASH_KickUser,					process_kick_user,		NULL);
-
-	msg->setHandlerFunc("CrossedRegion", process_crossed_region);
-	msg->setHandlerFuncFast(_PREHASH_TeleportFinish, process_teleport_finish);
-
-	msg->setHandlerFuncFast(_PREHASH_AlertMessage,             process_alert_message);
-	msg->setHandlerFunc("AgentAlertMessage", process_agent_alert_message);
-	msg->setHandlerFuncFast(_PREHASH_MeanCollisionAlert,             process_mean_collision_alert_message,  NULL);
-	msg->setHandlerFunc("ViewerFrozenMessage",             process_frozen_message);
-
-	msg->setHandlerFuncFast(_PREHASH_NameValuePair,			process_name_value);
-	msg->setHandlerFuncFast(_PREHASH_RemoveNameValuePair,	process_remove_name_value);
-	msg->setHandlerFuncFast(_PREHASH_AvatarAnimation,		process_avatar_animation);
-	msg->setHandlerFuncFast(_PREHASH_AvatarAppearance,		process_avatar_appearance);
-	msg->setHandlerFunc("AgentCachedTextureResponse",	LLAgent::processAgentCachedTextureResponse);
-	msg->setHandlerFunc("RebakeAvatarTextures", LLVOAvatarSelf::processRebakeAvatarTextures);
-	msg->setHandlerFuncFast(_PREHASH_CameraConstraint,		process_camera_constraint);
-	msg->setHandlerFuncFast(_PREHASH_AvatarSitResponse,		process_avatar_sit_response);
-	msg->setHandlerFunc("SetFollowCamProperties",			process_set_follow_cam_properties);
-	msg->setHandlerFunc("ClearFollowCamProperties",			process_clear_follow_cam_properties);
-
-	msg->setHandlerFuncFast(_PREHASH_ImprovedInstantMessage,	process_improved_im);
-	msg->setHandlerFuncFast(_PREHASH_ScriptQuestion,			process_script_question);
-	msg->setHandlerFuncFast(_PREHASH_ObjectProperties,			LLSelectMgr::processObjectProperties, NULL);
-	msg->setHandlerFuncFast(_PREHASH_ObjectPropertiesFamily,	LLSelectMgr::processObjectPropertiesFamily, NULL);
-	msg->setHandlerFunc("ForceObjectSelect", LLSelectMgr::processForceObjectSelect);
-
-	msg->setHandlerFuncFast(_PREHASH_MoneyBalanceReply,		process_money_balance_reply,	NULL);
-	msg->setHandlerFuncFast(_PREHASH_CoarseLocationUpdate,		LLWorld::processCoarseUpdate, NULL);
-	msg->setHandlerFuncFast(_PREHASH_ReplyTaskInventory, 		LLViewerObject::processTaskInv,	NULL);
-	msg->setHandlerFuncFast(_PREHASH_DerezContainer,			process_derez_container, NULL);
-	msg->setHandlerFuncFast(_PREHASH_ScriptRunningReply,
-						&LLLiveLSLEditor::processScriptRunningReply);
-
-	msg->setHandlerFuncFast(_PREHASH_DeRezAck, process_derez_ack);
-
-	msg->setHandlerFunc("LogoutReply", process_logout_reply);
-
-	//msg->setHandlerFuncFast(_PREHASH_AddModifyAbility,
-	//					&LLAgent::processAddModifyAbility);
-	//msg->setHandlerFuncFast(_PREHASH_RemoveModifyAbility,
-	//					&LLAgent::processRemoveModifyAbility);
-	msg->setHandlerFuncFast(_PREHASH_AgentDataUpdate,
-						&LLAgent::processAgentDataUpdate);
-	msg->setHandlerFuncFast(_PREHASH_AgentGroupDataUpdate,
-						&LLAgent::processAgentGroupDataUpdate);
-	msg->setHandlerFunc("AgentDropGroup",
-						&LLAgent::processAgentDropGroup);
-	// land ownership messages
-	msg->setHandlerFuncFast(_PREHASH_ParcelOverlay,
-						LLViewerParcelMgr::processParcelOverlay);
-	msg->setHandlerFuncFast(_PREHASH_ParcelProperties,
-						LLViewerParcelMgr::processParcelProperties);
-	msg->setHandlerFunc("ParcelAccessListReply",
-		LLViewerParcelMgr::processParcelAccessListReply);
-	msg->setHandlerFunc("ParcelDwellReply",
-		LLViewerParcelMgr::processParcelDwellReply);
-
-	msg->setHandlerFunc("AvatarPropertiesReply",
-						&LLAvatarPropertiesProcessor::processAvatarPropertiesReply);
-	msg->setHandlerFunc("AvatarInterestsReply",
-						&LLAvatarPropertiesProcessor::processAvatarInterestsReply);
-	msg->setHandlerFunc("AvatarGroupsReply",
-						&LLAvatarPropertiesProcessor::processAvatarGroupsReply);
-	// ratings deprecated
-	//msg->setHandlerFuncFast(_PREHASH_AvatarStatisticsReply,
-	//					LLPanelAvatar::processAvatarStatisticsReply);
-	msg->setHandlerFunc("AvatarNotesReply",
-						&LLAvatarPropertiesProcessor::processAvatarNotesReply);
-	msg->setHandlerFunc("AvatarPicksReply",
-						&LLAvatarPropertiesProcessor::processAvatarPicksReply);
- 	msg->setHandlerFunc("AvatarClassifiedReply",
- 						&LLAvatarPropertiesProcessor::processAvatarClassifiedsReply);
-
-	msg->setHandlerFuncFast(_PREHASH_CreateGroupReply,
-						LLGroupMgr::processCreateGroupReply);
-	msg->setHandlerFuncFast(_PREHASH_JoinGroupReply,
-						LLGroupMgr::processJoinGroupReply);
-	msg->setHandlerFuncFast(_PREHASH_EjectGroupMemberReply,
-						LLGroupMgr::processEjectGroupMemberReply);
-	msg->setHandlerFuncFast(_PREHASH_LeaveGroupReply,
-						LLGroupMgr::processLeaveGroupReply);
-	msg->setHandlerFuncFast(_PREHASH_GroupProfileReply,
-						LLGroupMgr::processGroupPropertiesReply);
-
-	// ratings deprecated
-	// msg->setHandlerFuncFast(_PREHASH_ReputationIndividualReply,
-	//					LLFloaterRate::processReputationIndividualReply);
-
-	msg->setHandlerFuncFast(_PREHASH_AgentWearablesUpdate,
-						LLAgentWearables::processAgentInitialWearablesUpdate );
-
-	msg->setHandlerFunc("ScriptControlChange",
-						LLAgent::processScriptControlChange );
-
-	msg->setHandlerFuncFast(_PREHASH_ViewerEffect, LLHUDManager::processViewerEffect);
-
-	msg->setHandlerFuncFast(_PREHASH_GrantGodlikePowers, process_grant_godlike_powers);
-
-	msg->setHandlerFuncFast(_PREHASH_GroupAccountSummaryReply,
-							LLPanelGroupLandMoney::processGroupAccountSummaryReply);
-	msg->setHandlerFuncFast(_PREHASH_GroupAccountDetailsReply,
-							LLPanelGroupLandMoney::processGroupAccountDetailsReply);
-	msg->setHandlerFuncFast(_PREHASH_GroupAccountTransactionsReply,
-							LLPanelGroupLandMoney::processGroupAccountTransactionsReply);
-
-	msg->setHandlerFuncFast(_PREHASH_UserInfoReply,
-		process_user_info_reply);
-
-	msg->setHandlerFunc("RegionHandshake", process_region_handshake, NULL);
-
-	msg->setHandlerFunc("TeleportStart", process_teleport_start );
-	msg->setHandlerFunc("TeleportProgress", process_teleport_progress);
-	msg->setHandlerFunc("TeleportFailed", process_teleport_failed, NULL);
-	msg->setHandlerFunc("TeleportLocal", process_teleport_local, NULL);
-
-	msg->setHandlerFunc("ImageNotInDatabase", LLViewerTextureList::processImageNotInDatabase, NULL);
-
-	msg->setHandlerFuncFast(_PREHASH_GroupMembersReply,
-						LLGroupMgr::processGroupMembersReply);
-	msg->setHandlerFunc("GroupRoleDataReply",
-						LLGroupMgr::processGroupRoleDataReply);
-	msg->setHandlerFunc("GroupRoleMembersReply",
-						LLGroupMgr::processGroupRoleMembersReply);
-	msg->setHandlerFunc("GroupTitlesReply",
-						LLGroupMgr::processGroupTitlesReply);
-	// Special handler as this message is sometimes used for group land.
-	msg->setHandlerFunc("PlacesReply", process_places_reply);
-	msg->setHandlerFunc("GroupNoticesListReply", LLPanelGroupNotices::processGroupNoticesListReply);
-
-	msg->setHandlerFunc("AvatarPickerReply", LLFloaterAvatarPicker::processAvatarPickerReply);
-
-	msg->setHandlerFunc("MapBlockReply", LLWorldMapMessage::processMapBlockReply);
-	msg->setHandlerFunc("MapItemReply", LLWorldMapMessage::processMapItemReply);
-	msg->setHandlerFunc("EventInfoReply", LLEventNotifier::processEventInfoReply);
-	
-	msg->setHandlerFunc("PickInfoReply", &LLAvatarPropertiesProcessor::processPickInfoReply);
-//	msg->setHandlerFunc("ClassifiedInfoReply", LLPanelClassified::processClassifiedInfoReply);
-	msg->setHandlerFunc("ClassifiedInfoReply", LLAvatarPropertiesProcessor::processClassifiedInfoReply);
-	msg->setHandlerFunc("ParcelInfoReply", LLRemoteParcelInfoProcessor::processParcelInfoReply);
-	msg->setHandlerFunc("ScriptDialog", process_script_dialog);
-	msg->setHandlerFunc("LoadURL", process_load_url);
-	msg->setHandlerFunc("ScriptTeleportRequest", process_script_teleport_request);
-	msg->setHandlerFunc("EstateCovenantReply", process_covenant_reply);
-
-	// calling cards
-	msg->setHandlerFunc("OfferCallingCard", process_offer_callingcard);
-	msg->setHandlerFunc("AcceptCallingCard", process_accept_callingcard);
-	msg->setHandlerFunc("DeclineCallingCard", process_decline_callingcard);
-
-	msg->setHandlerFunc("ParcelObjectOwnersReply", LLPanelLandObjects::processParcelObjectOwnersReply);
-
-	msg->setHandlerFunc("InitiateDownload", process_initiate_download);
-	msg->setHandlerFunc("LandStatReply", LLFloaterTopObjects::handle_land_reply);
-	msg->setHandlerFunc("GenericMessage", process_generic_message);
-
-	msg->setHandlerFuncFast(_PREHASH_FeatureDisabled, process_feature_disabled_message);
-}
-
-void asset_callback_nothing(LLVFS*, const LLUUID&, LLAssetType::EType, void*, S32)
-{
-	// nothing
-}
-
-// *HACK: Must match name in Library or agent inventory
-const std::string ROOT_GESTURES_FOLDER = "Gestures";
-const std::string COMMON_GESTURES_FOLDER = "Common Gestures";
-const std::string MALE_GESTURES_FOLDER = "Male Gestures";
-const std::string FEMALE_GESTURES_FOLDER = "Female Gestures";
-const std::string SPEECH_GESTURES_FOLDER = "Speech Gestures";
-const std::string OTHER_GESTURES_FOLDER = "Other Gestures";
-const S32 OPT_CLOSED_WINDOW = -1;
-const S32 OPT_MALE = 0;
-const S32 OPT_FEMALE = 1;
-const S32 OPT_TRUST_CERT = 0;
-const S32 OPT_CANCEL_TRUST = 1;
-	
-bool callback_choose_gender(const LLSD& notification, const LLSD& response)
-{
-	
-    // These defaults are returned from the server on login.  They are set in login.xml.                  
-    // If no default is returned from the server, they are retrieved from settings.xml.                   
-	
-	S32 option = LLNotification::getSelectedOption(notification, response);
-	switch(option)
-	{
-		case OPT_MALE:
-			LLStartUp::loadInitialOutfit( gSavedSettings.getString("DefaultMaleAvatar"), "male" );
-			break;
-			
-        case OPT_FEMALE:
-        case OPT_CLOSED_WINDOW:
-        default:
-			LLStartUp::loadInitialOutfit( gSavedSettings.getString("DefaultFemaleAvatar"), "female" );
-			break;
-	}
-	return false;
-}
-
-void LLStartUp::copyLibraryGestures(const std::string& same_gender_gestures)
-{
-	llinfos << "Copying library gestures" << llendl;
-
-	// Copy gestures
-	LLUUID lib_gesture_cat_id =
-		gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE,false,true);
-	if (lib_gesture_cat_id.isNull())
-	{
-		llwarns << "Unable to copy gestures, source category not found" << llendl;
-	}
-	LLUUID dst_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE);
-
-	std::vector<std::string> gesture_folders_to_copy;
-	gesture_folders_to_copy.push_back(MALE_GESTURES_FOLDER);
-	gesture_folders_to_copy.push_back(FEMALE_GESTURES_FOLDER);
-	gesture_folders_to_copy.push_back(COMMON_GESTURES_FOLDER);
-	gesture_folders_to_copy.push_back(SPEECH_GESTURES_FOLDER);
-	gesture_folders_to_copy.push_back(OTHER_GESTURES_FOLDER);
-
-	for(std::vector<std::string>::iterator it = gesture_folders_to_copy.begin();
-		it != gesture_folders_to_copy.end();
-		++it)
-	{
-		std::string& folder_name = *it;
-
-		LLPointer<LLInventoryCallback> cb(NULL);
-
-		if (folder_name == same_gender_gestures ||
-			folder_name == COMMON_GESTURES_FOLDER ||
-			folder_name == OTHER_GESTURES_FOLDER)
-		{
-			cb = new ActivateGestureCallback;
-		}
-
-
-		LLUUID cat_id = findDescendentCategoryIDByName(lib_gesture_cat_id,folder_name);
-		if (cat_id.isNull())
-		{
-			llwarns << "failed to find gesture folder for " << folder_name << llendl;
-		}
-		else
-		{
-			llinfos << "initiating fetch and copy for " << folder_name << " cat_id " << cat_id << llendl;
-			LLAppearanceMgr* app_mgr = LLAppearanceMgr::getInstance();
-			callAfterCategoryFetch(cat_id,
-								   boost::bind(&LLAppearanceMgr::shallowCopyCategory,
-											   app_mgr,
-											   cat_id,
-											   dst_id,
-											   cb));
-		}
-	}
-}
-
-void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
-								   const std::string& gender_name )
-{
-	llinfos << "starting" << llendl;
-
-	// Not going through the processAgentInitialWearables path, so need to set this here.
-	LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true);
-	// Initiate creation of COF, since we're also bypassing that.
-	gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
-	
-	S32 gender = 0;
-	std::string same_gender_gestures;
-	if (gender_name == "male")
-	{
-		gender = OPT_MALE;
-		same_gender_gestures = MALE_GESTURES_FOLDER;
-	}
-	else
-	{
-		gender = OPT_FEMALE;
-		same_gender_gestures = FEMALE_GESTURES_FOLDER;
-	}
-
-	// try to find the outfit - if not there, create some default
-	// wearables.
-	LLUUID cat_id = findDescendentCategoryIDByName(
-		gInventory.getLibraryRootFolderID(),
-		outfit_folder_name);
-	if (cat_id.isNull())
-	{
-		gAgentWearables.createStandardWearables(gender);
-	}
-	else
-	{
-		sWearablesLoadedCon = gAgentWearables.addLoadedCallback(LLStartUp::saveInitialOutfit);
-
-		bool do_copy = true;
-		bool do_append = false;
-		LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id);
-		LLAppearanceMgr::instance().wearInventoryCategory(cat, do_copy, do_append);
-	}
-
-	// Copy gestures
-	copyLibraryGestures(same_gender_gestures);
-	
-	// This is really misnamed -- it means we have started loading
-	// an outfit/shape that will give the avatar a gender eventually. JC
-	gAgent.setGenderChosen(TRUE);
-
-}
-
-//static
-void LLStartUp::saveInitialOutfit()
-{
-	if (sInitialOutfit.empty()) return;
-	
-	if (sWearablesLoadedCon.connected())
-	{
-		sWearablesLoadedCon.disconnect();
-	}
-	LLAppearanceMgr::getInstance()->makeNewOutfitLinks(sInitialOutfit,false);
-}
-
-std::string& LLStartUp::getInitialOutfitName()
-{
-	return sInitialOutfit;
-}
-
-// Loads a bitmap to display during load
-void init_start_screen(S32 location_id)
-{
-	if (gStartTexture.notNull())
-	{
-		gStartTexture = NULL;
-		LL_INFOS("AppInit") << "re-initializing start screen" << LL_ENDL;
-	}
-
-	LL_DEBUGS("AppInit") << "Loading startup bitmap..." << LL_ENDL;
-
-	std::string temp_str = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter();
-
-	if ((S32)START_LOCATION_ID_LAST == location_id)
-	{
-		temp_str += SCREEN_LAST_FILENAME;
-	}
-	else
-	{
-		temp_str += SCREEN_HOME_FILENAME;
-	}
-
-	LLPointer<LLImageBMP> start_image_bmp = new LLImageBMP;
-	
-	// Turn off start screen to get around the occasional readback 
-	// driver bug
-	if(!gSavedSettings.getBOOL("UseStartScreen"))
-	{
-		LL_INFOS("AppInit")  << "Bitmap load disabled" << LL_ENDL;
-		return;
-	}
-	else if(!start_image_bmp->load(temp_str) )
-	{
-		LL_WARNS("AppInit") << "Bitmap load failed" << LL_ENDL;
-		return;
-	}
-
-	gStartImageWidth = start_image_bmp->getWidth();
-	gStartImageHeight = start_image_bmp->getHeight();
-
-	LLPointer<LLImageRaw> raw = new LLImageRaw;
-	if (!start_image_bmp->decode(raw, 0.0f))
-	{
-		LL_WARNS("AppInit") << "Bitmap decode failed" << LL_ENDL;
-		gStartTexture = NULL;
-		return;
-	}
-
-	raw->expandToPowerOfTwo();
-	gStartTexture = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE) ;
-}
-
-
-// frees the bitmap
-void release_start_screen()
-{
-	LL_DEBUGS("AppInit") << "Releasing bitmap..." << LL_ENDL;
-	gStartTexture = NULL;
-}
-
-
-// static
-std::string LLStartUp::startupStateToString(EStartupState state)
-{
-#define RTNENUM(E) case E: return #E
-	switch(state){
-		RTNENUM( STATE_FIRST );
-		RTNENUM( STATE_BROWSER_INIT );
-		RTNENUM( STATE_LOGIN_SHOW );
-		RTNENUM( STATE_LOGIN_WAIT );
-		RTNENUM( STATE_LOGIN_CLEANUP );
-		RTNENUM( STATE_LOGIN_AUTH_INIT );
-		RTNENUM( STATE_LOGIN_CURL_UNSTUCK );
-		RTNENUM( STATE_LOGIN_PROCESS_RESPONSE );
-		RTNENUM( STATE_WORLD_INIT );
-		RTNENUM( STATE_MULTIMEDIA_INIT );
-		RTNENUM( STATE_FONT_INIT );
-		RTNENUM( STATE_SEED_GRANTED_WAIT );
-		RTNENUM( STATE_SEED_CAP_GRANTED );
-		RTNENUM( STATE_WORLD_WAIT );
-		RTNENUM( STATE_AGENT_SEND );
-		RTNENUM( STATE_AGENT_WAIT );
-		RTNENUM( STATE_INVENTORY_SEND );
-		RTNENUM( STATE_MISC );
-		RTNENUM( STATE_PRECACHE );
-		RTNENUM( STATE_WEARABLES_WAIT );
-		RTNENUM( STATE_CLEANUP );
-		RTNENUM( STATE_STARTED );
-	default:
-		return llformat("(state #%d)", state);
-	}
-#undef RTNENUM
-}
-
-// static
-void LLStartUp::setStartupState( EStartupState state )
-{
-	LL_INFOS("AppInit") << "Startup state changing from " <<  
-		getStartupStateString() << " to " <<  
-		startupStateToString(state) << LL_ENDL;
-	gStartupState = state;
-	postStartupState();
-}
-
-void LLStartUp::postStartupState()
-{
-	LLSD stateInfo;
-	stateInfo["str"] = getStartupStateString();
-	stateInfo["enum"] = gStartupState;
-	sStateWatcher->post(stateInfo);
-}
-
-
-void reset_login()
-{
-	gAgentWearables.cleanup();
-	gAgentCamera.cleanup();
-	gAgent.cleanup();
-	LLWorld::getInstance()->destroyClass();
-
-	LLStartUp::setStartupState( STATE_LOGIN_SHOW );
-
-	if ( gViewerWindow )
-	{	// Hide menus and normal buttons
-		gViewerWindow->setNormalControlsVisible( FALSE );
-		gLoginMenuBarView->setVisible( TRUE );
-		gLoginMenuBarView->setEnabled( TRUE );
-	}
-
-	// Hide any other stuff
-	LLFloaterReg::hideVisibleInstances();
-}
-
-//---------------------------------------------------------------------------
-
-// Initialize all plug-ins except the web browser (which was initialized
-// early, before the login screen). JC
-void LLStartUp::multimediaInit()
-{
-	LL_DEBUGS("AppInit") << "Initializing Multimedia...." << LL_ENDL;
-	std::string msg = LLTrans::getString("LoginInitializingMultimedia");
-	set_startup_status(0.42f, msg.c_str(), gAgent.mMOTD.c_str());
-	display_startup();
-
-	// LLViewerMedia::initClass();
-	LLViewerParcelMedia::initClass();
-}
-
-void LLStartUp::fontInit()
-{
-	LL_DEBUGS("AppInit") << "Initializing fonts...." << LL_ENDL;
-	std::string msg = LLTrans::getString("LoginInitializingFonts");
-	set_startup_status(0.45f, msg.c_str(), gAgent.mMOTD.c_str());
-	display_startup();
-
-	LLFontGL::loadDefaultFonts();
-}
-
-void LLStartUp::initNameCache()
-{
-	// Can be called multiple times
-	if ( gCacheName ) return;
-
-	gCacheName = new LLCacheName(gMessageSystem);
-	gCacheName->addObserver(&callback_cache_name);
-	gCacheName->localizeCacheName("waiting", LLTrans::getString("AvatarNameWaiting"));
-	gCacheName->localizeCacheName("nobody", LLTrans::getString("AvatarNameNobody"));
-	gCacheName->localizeCacheName("none", LLTrans::getString("GroupNameNone"));
-	// Load stored cache if possible
-	LLAppViewer::instance()->loadNameCache();
-
-	// Start cache in not-running state until we figure out if we have
-	// capabilities for display name lookup
-	LLAvatarNameCache::initClass(false);
-	LLAvatarNameCache::setUseDisplayNames(gSavedSettings.getBOOL("UseDisplayNames"));
-}
-
-void LLStartUp::cleanupNameCache()
-{
-	LLAvatarNameCache::cleanupClass();
-
-	delete gCacheName;
-	gCacheName = NULL;
-}
-
-bool LLStartUp::dispatchURL()
-{
-	// ok, if we've gotten this far and have a startup URL
-        if (!getStartSLURL().isValid())
-	{
-	  return false;
-	}
-        if(getStartSLURL().getType() != LLSLURL::APP)
-	  {
-	    
-		// If we started with a location, but we're already
-		// at that location, don't pop dialogs open.
-		LLVector3 pos = gAgent.getPositionAgent();
-		LLVector3 slurlpos = getStartSLURL().getPosition();
-		F32 dx = pos.mV[VX] - slurlpos.mV[VX];
-		F32 dy = pos.mV[VY] - slurlpos.mV[VY];
-		const F32 SLOP = 2.f;	// meters
-
-		if( getStartSLURL().getRegion() != gAgent.getRegion()->getName()
-			|| (dx*dx > SLOP*SLOP)
-			|| (dy*dy > SLOP*SLOP) )
-		{
-			LLURLDispatcher::dispatch(getStartSLURL().getSLURLString(), 
-						  NULL, false);
-		}
-		return true;
-	}
-	return false;
-}
-
-void LLStartUp::setStartSLURL(const LLSLURL& slurl) 
-{
-  sStartSLURL = slurl;
-  switch(slurl.getType())
-    {
-    case LLSLURL::HOME_LOCATION:
-      {
-		  gSavedSettings.setString("LoginLocation", LLSLURL::SIM_LOCATION_HOME);
-	break;
-      }
-    case LLSLURL::LAST_LOCATION:
-      {
-	gSavedSettings.setString("LoginLocation", LLSLURL::SIM_LOCATION_LAST);
-	break;
-      }
-    default:
-			LLGridManager::getInstance()->setGridChoice(slurl.getGrid());
-			break;
-    }
-}
-
-bool login_alert_done(const LLSD& notification, const LLSD& response)
-{
-	LLPanelLogin::giveFocus();
-	return false;
-}
-
-// parse the certificate information into args for the 
-// certificate notifications
-LLSD transform_cert_args(LLPointer<LLCertificate> cert)
-{
-	LLSD args = LLSD::emptyMap();
-	std::string value;
-	LLSD cert_info;
-	cert->getLLSD(cert_info);
-	// convert all of the elements in the cert into                                        
-	// args for the xml dialog, so we have flexability to                                  
-	// display various parts of the cert by only modifying                                 
-	// the cert alert dialog xml.                                                          
-	for(LLSD::map_iterator iter = cert_info.beginMap();
-		iter != cert_info.endMap();
-		iter++)
-	{
-		// key usage and extended key usage                                            
-		// are actually arrays, and we want to format them as comma separated          
-		// strings, so special case those.                                             
-		LLSDSerialize::toXML(cert_info[iter->first], std::cout);
-		if((iter->first== std::string(CERT_KEY_USAGE)) |
-		   (iter->first == std::string(CERT_EXTENDED_KEY_USAGE)))
-		{
-			value = "";
-			LLSD usage = cert_info[iter->first];
-			for (LLSD::array_iterator usage_iter = usage.beginArray();
-				 usage_iter != usage.endArray();
-				 usage_iter++)
-			{
-				
-				if(usage_iter != usage.beginArray())
-				{
-					value += ", ";
-				}
-				
-				value += (*usage_iter).asString();
-			}
-			
-		}
-		else
-		{
-			value = iter->second.asString();
-		}
-		
-		std::string name = iter->first;
-		std::transform(name.begin(), name.end(), name.begin(),
-					   (int(*)(int))toupper);
-		args[name.c_str()] = value;
-	}
-	return args;
-}
-
-
-// when we handle a cert error, give focus back to the login panel
-void general_cert_done(const LLSD& notification, const LLSD& response)
-{
-	LLStartUp::setStartupState( STATE_LOGIN_SHOW );			
-	LLPanelLogin::giveFocus();
-}
-
-// check to see if the user wants to trust the cert.
-// if they do, add it to the cert store and 
-void trust_cert_done(const LLSD& notification, const LLSD& response)
-{
-	S32 option = LLNotification::getSelectedOption(notification, response);	
-	switch(option)
-	{
-		case OPT_TRUST_CERT:
-		{
-			LLPointer<LLCertificate> cert = gSecAPIHandler->getCertificate(notification["payload"]["certificate"]);
-			LLPointer<LLCertificateStore> store = gSecAPIHandler->getCertificateStore(gSavedSettings.getString("CertStore"));			
-			store->add(cert);
-			store->save();
-			LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );	
-			break;
-		}
-		case OPT_CANCEL_TRUST:
-			reset_login();
-			gSavedSettings.setBOOL("AutoLogin", FALSE);			
-			LLStartUp::setStartupState( STATE_LOGIN_SHOW );				
-		default:
-			LLPanelLogin::giveFocus();
-			break;
-	}
-
-}
-
-void apply_udp_blacklist(const std::string& csv)
-{
-
-	std::string::size_type start = 0;
-	std::string::size_type comma = 0;
-	do 
-	{
-		comma = csv.find(",", start);
-		if (comma == std::string::npos)
-		{
-			comma = csv.length();
-		}
-		std::string item(csv, start, comma-start);
-
-		lldebugs << "udp_blacklist " << item << llendl;
-		gMessageSystem->banUdpMessage(item);
-		
-		start = comma + 1;
-
-	}
-	while(comma < csv.length());
-	
-}
-
-bool process_login_success_response()
-{
-	LLSD response = LLLoginInstance::getInstance()->getResponse();
-
-	std::string text(response["udp_blacklist"]);
-	if(!text.empty())
-	{
-		apply_udp_blacklist(text);
-	}
-
-	// unpack login data needed by the application
-	text = response["agent_id"].asString();
-	if(!text.empty()) gAgentID.set(text);
-	gDebugInfo["AgentID"] = text;
-	
-	// Agent id needed for parcel info request in LLUrlEntryParcel
-	// to resolve parcel name.
-	LLUrlEntryParcel::setAgentID(gAgentID);
-
-	text = response["session_id"].asString();
-	if(!text.empty()) gAgentSessionID.set(text);
-	gDebugInfo["SessionID"] = text;
-
-	// Session id needed for parcel info request in LLUrlEntryParcel
-	// to resolve parcel name.
-	LLUrlEntryParcel::setSessionID(gAgentSessionID);
-	
-	text = response["secure_session_id"].asString();
-	if(!text.empty()) gAgent.mSecureSessionID.set(text);
-
-	// if the response contains a display name, use that,
-	// otherwise if the response contains a first and/or last name,
-	// use those.  Otherwise use the credential identifier
-
-	gDisplayName = "";
-	if (response.has("display_name"))
-	{
-		gDisplayName.assign(response["display_name"].asString());
-		if(!gDisplayName.empty())
-		{
-			// Remove quotes from string.  Login.cgi sends these to force
-			// names that look like numbers into strings.
-			LLStringUtil::replaceChar(gDisplayName, '"', ' ');
-			LLStringUtil::trim(gDisplayName);
-		}
-	}
-	if(gDisplayName.empty())
-	{
-		if(response.has("first_name"))
-		{
-			gDisplayName.assign(response["first_name"].asString());
-			LLStringUtil::replaceChar(gDisplayName, '"', ' ');
-			LLStringUtil::trim(gDisplayName);
-		}
-		if(response.has("last_name"))
-		{
-			text.assign(response["last_name"].asString());
-			LLStringUtil::replaceChar(text, '"', ' ');
-			LLStringUtil::trim(text);
-			if(!gDisplayName.empty())
-			{
-				gDisplayName += " ";
-			}
-			gDisplayName += text;
-		}
-	}
-	if(gDisplayName.empty())
-	{
-		gDisplayName.assign(gUserCredential->asString());
-	}
-
-	// this is their actual ability to access content
-	text = response["agent_access_max"].asString();
-	if (!text.empty())
-	{
-		// agent_access can be 'A', 'M', and 'PG'.
-		gAgent.setMaturity(text[0]);
-	}
-	
-	// this is the value of their preference setting for that content
-	// which will always be <= agent_access_max
-	text = response["agent_region_access"].asString();
-	if (!text.empty())
-	{
-		U32 preferredMaturity = (U32)LLAgent::convertTextToMaturity(text[0]);
-
-		gSavedSettings.setU32("PreferredMaturity", preferredMaturity);
-	}
-	// During the AO transition, this flag will be true. Then the flag will
-	// go away. After the AO transition, this code and all the code that
-	// uses it can be deleted.
-	text = response["ao_transition"].asString();
-	if (!text.empty())
-	{
-		if (text == "1")
-		{
-			gAgent.setAOTransition();
-		}
-	}
-
-	text = response["start_location"].asString();
-	if(!text.empty()) 
-	{
-		gAgentStartLocation.assign(text);
-	}
-
-	text = response["circuit_code"].asString();
-	if(!text.empty())
-	{
-		gMessageSystem->mOurCircuitCode = strtoul(text.c_str(), NULL, 10);
-	}
-	std::string sim_ip_str = response["sim_ip"];
-	std::string sim_port_str = response["sim_port"];
-	if(!sim_ip_str.empty() && !sim_port_str.empty())
-	{
-		U32 sim_port = strtoul(sim_port_str.c_str(), NULL, 10);
-		gFirstSim.set(sim_ip_str, sim_port);
-		if (gFirstSim.isOk())
-		{
-			gMessageSystem->enableCircuit(gFirstSim, TRUE);
-		}
-	}
-	std::string region_x_str = response["region_x"];
-	std::string region_y_str = response["region_y"];
-	if(!region_x_str.empty() && !region_y_str.empty())
-	{
-		U32 region_x = strtoul(region_x_str.c_str(), NULL, 10);
-		U32 region_y = strtoul(region_y_str.c_str(), NULL, 10);
-		gFirstSimHandle = to_region_handle(region_x, region_y);
-	}
-	
-	const std::string look_at_str = response["look_at"];
-	if (!look_at_str.empty())
-	{
-		size_t len = look_at_str.size();
-		LLMemoryStream mstr((U8*)look_at_str.c_str(), len);
-		LLSD sd = LLSDSerialize::fromNotation(mstr, len);
-		gAgentStartLookAt = ll_vector3_from_sd(sd);
-	}
-
-	text = response["seed_capability"].asString();
-	if (!text.empty()) gFirstSimSeedCap = text;
-				
-	text = response["seconds_since_epoch"].asString();
-	if(!text.empty())
-	{
-		U32 server_utc_time = strtoul(text.c_str(), NULL, 10);
-		if(server_utc_time)
-		{
-			time_t now = time(NULL);
-			gUTCOffset = (server_utc_time - now);
-		}
-	}
-
-	// this is the base used to construct help URLs
-	text = response["help_url_format"].asString();
-	if (!text.empty())
-	{
-		// replace the default help URL format
-		gSavedSettings.setString("HelpURLFormat",text);
-		
-		// don't fall back to Standalone's pre-connection static help
-		gSavedSettings.setBOOL("HelpUseLocal", false);
-	}
-			
-	std::string home_location = response["home"];
-	if(!home_location.empty())
-	{
-		size_t len = home_location.size();
-		LLMemoryStream mstr((U8*)home_location.c_str(), len);
-		LLSD sd = LLSDSerialize::fromNotation(mstr, len);
-		S32 region_x = sd["region_handle"][0].asInteger();
-		S32 region_y = sd["region_handle"][1].asInteger();
-		U64 region_handle = to_region_handle(region_x, region_y);
-		LLVector3 position = ll_vector3_from_sd(sd["position"]);
-		gAgent.setHomePosRegion(region_handle, position);
-	}
-
-	gAgent.mMOTD.assign(response["message"]);
-
-	// Options...
-	// Each 'option' is an array of submaps. 
-	// It appears that we only ever use the first element of the array.
-	LLUUID inv_root_folder_id = response["inventory-root"][0]["folder_id"];
-	if(inv_root_folder_id.notNull())
-	{
-		gInventory.setRootFolderID(inv_root_folder_id);
-		//gInventory.mock(gAgent.getInventoryRootID());
-	}
-
-	LLSD login_flags = response["login-flags"][0];
-	if(login_flags.size())
-	{
-		std::string flag = login_flags["ever_logged_in"];
-		if(!flag.empty())
-		{
-			gAgent.setFirstLogin((flag == "N") ? TRUE : FALSE);
-		}
-
-		/*  Flag is currently ignored by the viewer.
-		flag = login_flags["stipend_since_login"];
-		if(flag == "Y") 
-		{
-			stipend_since_login = true;
-		}
-		*/
-
-		flag = login_flags["gendered"].asString();
-		if(flag == "Y")
-		{
-			gAgent.setGenderChosen(TRUE);
-		}
-		
-		bool pacific_daylight_time = false;
-		flag = login_flags["daylight_savings"].asString();
-		if(flag == "Y")
-		{
-			pacific_daylight_time = (flag == "Y");
-		}
-
-		//setup map of datetime strings to codes and slt & local time offset from utc
-		LLStringOps::setupDatetimeInfo(pacific_daylight_time);
-	}
-
-	// set up the voice configuration.  Ultimately, we should pass this up as part of each voice
-	// channel if we need to move to multiple voice servers per grid.
-	LLSD voice_config_info = response["voice-config"];
-	if(voice_config_info.has("VoiceServerType"))
-	{
-		gSavedSettings.setString("VoiceServerType", voice_config_info["VoiceServerType"].asString()); 
-	}
-
-	// Request the map server url
-	std::string map_server_url = response["map-server-url"];
-	if(!map_server_url.empty())
-	{
-		// We got an answer from the grid -> use that for map for the current session
-		gSavedSettings.setString("CurrentMapServerURL", map_server_url); 
-		LL_INFOS("LLStartup") << "map-server-url : we got an answer from the grid : " << map_server_url << LL_ENDL;
-	}
-	else
-	{
-		// No answer from the grid -> use the default setting for current session 
-		map_server_url = gSavedSettings.getString("MapServerURL"); 
-		gSavedSettings.setString("CurrentMapServerURL", map_server_url); 
-		LL_INFOS("LLStartup") << "map-server-url : no map-server-url answer, we use the default setting for the map : " << map_server_url << LL_ENDL;
-	}
-	
-	// Default male and female avatars allowing the user to choose their avatar on first login.
-	// These may be passed up by SLE to allow choice of enterprise avatars instead of the standard
-	// "new ruth."  Not to be confused with 'initial-outfit' below 
-	LLSD newuser_config = response["newuser-config"][0];
-	if(newuser_config.has("DefaultFemaleAvatar"))
-	{
-		gSavedSettings.setString("DefaultFemaleAvatar", newuser_config["DefaultFemaleAvatar"].asString()); 		
-	}
-	if(newuser_config.has("DefaultMaleAvatar"))
-	{
-		gSavedSettings.setString("DefaultMaleAvatar", newuser_config["DefaultMaleAvatar"].asString()); 		
-	}
-	
-	// Initial outfit for the user.
-	// QUESTION: Why can't we simply simply set the users outfit directly
-	// from a web page into the user info on the server? - Roxie
-	LLSD initial_outfit = response["initial-outfit"][0];
-	if(initial_outfit.size())
-	{
-		std::string flag = initial_outfit["folder_name"];
-		if(!flag.empty())
-		{
-			// Initial outfit is a folder in your inventory,
-			// must be an exact folder-name match.
-			sInitialOutfit = flag;
-		}
-
-		flag = initial_outfit["gender"].asString();
-		if(!flag.empty())
-		{
-			sInitialOutfitGender = flag;
-		}
-	}
-
-	LLSD global_textures = response["global-textures"][0];
-	if(global_textures.size())
-	{
-		// Extract sun and moon texture IDs.  These are used
-		// in the LLVOSky constructor, but I can't figure out
-		// how to pass them in.  JC
-		LLUUID id = global_textures["sun_texture_id"];
-		if(id.notNull())
-		{
-			gSunTextureID = id;
-		}
-
-		id = global_textures["moon_texture_id"];
-		if(id.notNull())
-		{
-			gMoonTextureID = id;
-		}
-
-		id = global_textures["cloud_texture_id"];
-		if(id.notNull())
-		{
-			gCloudTextureID = id;
-		}
-	}
-
-	// Set the location of the snapshot sharing config endpoint
-	std::string snapshot_config_url = response["snapshot_config_url"];
-	if(!snapshot_config_url.empty())
-	{
-		gSavedSettings.setString("SnapshotConfigURL", snapshot_config_url);
-	}
-
-	// Start the process of fetching the OpenID session cookie for this user login
-	std::string openid_url = response["openid_url"];
-	if(!openid_url.empty())
-	{
-		std::string openid_token = response["openid_token"];
-		LLViewerMedia::openIDSetup(openid_url, openid_token);
-	}
-
-	if(response.has("max-agent-groups")) {		
-		std::string max_agent_groups(response["max-agent-groups"]);
-		gMaxAgentGroups = atoi(max_agent_groups.c_str());
-		LL_INFOS("LLStartup") << "gMaxAgentGroups read from login.cgi: "
-							  << gMaxAgentGroups << LL_ENDL;
-	}
-	else {
-		gMaxAgentGroups = DEFAULT_MAX_AGENT_GROUPS;
-		LL_INFOS("LLStartup") << "using gMaxAgentGroups default: "
-							  << gMaxAgentGroups << LL_ENDL;
-	}
-		
-	bool success = false;
-	// JC: gesture loading done below, when we have an asset system
-	// in place.  Don't delete/clear gUserCredentials until then.
-	if(gAgentID.notNull()
-	   && gAgentSessionID.notNull()
-	   && gMessageSystem->mOurCircuitCode
-	   && gFirstSim.isOk()
-	   && gInventory.getRootFolderID().notNull())
-	{
-		success = true;
-	}
-
-	return success;
-}
-
-void transition_back_to_login_panel(const std::string& emsg)
-{
-	if (gNoRender)
-	{
-		LL_WARNS("AppInit") << "Failed to login!" << LL_ENDL;
-		LL_WARNS("AppInit") << emsg << LL_ENDL;
-		exit(0);
-	}
-
-	// Bounce back to the login screen.
-	reset_login(); // calls LLStartUp::setStartupState( STATE_LOGIN_SHOW );
-	gSavedSettings.setBOOL("AutoLogin", FALSE);
-}
+/** 
+ * @file llstartup.cpp
+ * @brief startup routines.
+ *
+ * $LicenseInfo:firstyear=2004&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 "llstartup.h"
+
+#if LL_WINDOWS
+#	include <process.h>		// _spawnl()
+#else
+#	include <sys/stat.h>		// mkdir()
+#endif
+
+#include "llviewermedia_streamingaudio.h"
+#include "llaudioengine.h"
+
+#ifdef LL_FMOD
+# include "llaudioengine_fmod.h"
+#endif
+
+#ifdef LL_OPENAL
+#include "llaudioengine_openal.h"
+#endif
+
+#include "llares.h"
+#include "llavatarnamecache.h"
+#include "lllandmark.h"
+#include "llcachename.h"
+#include "lldir.h"
+#include "llerrorcontrol.h"
+#include "llfloaterreg.h"
+#include "llfocusmgr.h"
+#include "llhttpsender.h"
+#include "llimfloater.h"
+#include "lllocationhistory.h"
+#include "llimageworker.h"
+
+#include "llloginflags.h"
+#include "llmd5.h"
+#include "llmemorystream.h"
+#include "llmessageconfig.h"
+#include "llmoveview.h"
+#include "llnearbychat.h"
+#include "llnotifications.h"
+#include "llnotificationsutil.h"
+#include "llteleporthistory.h"
+#include "llregionhandle.h"
+#include "llsd.h"
+#include "llsdserialize.h"
+#include "llsdutil_math.h"
+#include "llsecondlifeurls.h"
+#include "llstring.h"
+#include "lluserrelations.h"
+#include "llversioninfo.h"
+#include "llviewercontrol.h"
+#include "llvfs.h"
+#include "llxorcipher.h"	// saved password, MAC address
+#include "llwindow.h"
+#include "imageids.h"
+#include "message.h"
+#include "v3math.h"
+
+#include "llagent.h"
+#include "llagentcamera.h"
+#include "llagentpicksinfo.h"
+#include "llagentwearables.h"
+#include "llagentpilot.h"
+#include "llfloateravatarpicker.h"
+#include "llcallbacklist.h"
+#include "llcallingcard.h"
+#include "llconsole.h"
+#include "llcontainerview.h"
+#include "lldebugview.h"
+#include "lldrawable.h"
+#include "lleventnotifier.h"
+#include "llface.h"
+#include "llfeaturemanager.h"
+//#include "llfirstuse.h"
+#include "llfloaterhud.h"
+#include "llfloaterland.h"
+#include "llfloaterpreference.h"
+#include "llfloatertopobjects.h"
+#include "llfloaterworldmap.h"
+#include "llgesturemgr.h"
+#include "llgroupmgr.h"
+#include "llhudeffecttrail.h"
+#include "llhudmanager.h"
+#include "llhttpclient.h"
+#include "llimagebmp.h"
+#include "llinventorybridge.h"
+#include "llinventorymodel.h"
+#include "llinventorymodelbackgroundfetch.h"
+#include "llkeyboard.h"
+#include "llloginhandler.h"			// gLoginHandler, SLURL support
+#include "lllogininstance.h" // Host the login module.
+#include "llpanellogin.h"
+#include "llmutelist.h"
+#include "llavatarpropertiesprocessor.h"
+#include "llpanelclassified.h"
+#include "llpanelpick.h"
+#include "llpanelgrouplandmoney.h"
+#include "llpanelgroupnotices.h"
+#include "llpreview.h"
+#include "llpreviewscript.h"
+#include "llproductinforequest.h"
+#include "llsecondlifeurls.h"
+#include "llselectmgr.h"
+#include "llsky.h"
+#include "llsidetray.h"
+#include "llstatview.h"
+#include "llstatusbar.h"		// sendMoneyBalanceRequest(), owns L$ balance
+#include "llsurface.h"
+#include "lltexturecache.h"
+#include "lltexturefetch.h"
+#include "lltoolmgr.h"
+#include "lltrans.h"
+#include "llui.h"
+#include "llurldispatcher.h"
+#include "llurlentry.h"
+#include "llslurl.h"
+#include "llurlhistory.h"
+#include "llurlwhitelist.h"
+#include "llvieweraudio.h"
+#include "llviewerassetstorage.h"
+#include "llviewercamera.h"
+#include "llviewerdisplay.h"
+#include "llviewergenericmessage.h"
+#include "llviewergesture.h"
+#include "llviewertexturelist.h"
+#include "llviewermedia.h"
+#include "llviewermenu.h"
+#include "llviewermessage.h"
+#include "llviewernetwork.h"
+#include "llviewerobjectlist.h"
+#include "llviewerparcelmedia.h"
+#include "llviewerparcelmgr.h"
+#include "llviewerregion.h"
+#include "llviewerstats.h"
+#include "llviewerthrottle.h"
+#include "llviewerwindow.h"
+#include "llvoavatar.h"
+#include "llvoavatarself.h"
+#include "llvoclouds.h"
+#include "llweb.h"
+#include "llworld.h"
+#include "llworldmapmessage.h"
+#include "llxfermanager.h"
+#include "pipeline.h"
+#include "llappviewer.h"
+#include "llfasttimerview.h"
+#include "llfloatermap.h"
+#include "llweb.h"
+#include "llvoiceclient.h"
+#include "llnamelistctrl.h"
+#include "llnamebox.h"
+#include "llnameeditor.h"
+#include "llpostprocess.h"
+#include "llwlparammanager.h"
+#include "llwaterparammanager.h"
+#include "llagentlanguage.h"
+#include "llwearable.h"
+#include "llinventorybridge.h"
+#include "llappearancemgr.h"
+#include "llavatariconctrl.h"
+#include "llvoicechannel.h"
+
+#include "lllogin.h"
+#include "llevents.h"
+#include "llstartuplistener.h"
+
+#if LL_WINDOWS
+#include "lldxhardware.h"
+#endif
+
+//
+// exported globals
+//
+bool gAgentMovementCompleted = false;
+S32  gMaxAgentGroups;
+
+std::string SCREEN_HOME_FILENAME = "screen_home.bmp";
+std::string SCREEN_LAST_FILENAME = "screen_last.bmp";
+
+LLPointer<LLViewerTexture> gStartTexture;
+
+//
+// Imported globals
+//
+extern S32 gStartImageWidth;
+extern S32 gStartImageHeight;
+
+//
+// local globals
+//
+static bool gGotUseCircuitCodeAck = false;
+static std::string sInitialOutfit;
+static std::string sInitialOutfitGender;	// "male" or "female"
+static boost::signals2::connection sWearablesLoadedCon;
+
+static bool gUseCircuitCallbackCalled = false;
+
+EStartupState LLStartUp::gStartupState = STATE_FIRST;
+LLSLURL LLStartUp::sStartSLURL;
+
+static LLPointer<LLCredential> gUserCredential;
+static std::string gDisplayName;
+static BOOL gRememberPassword = TRUE;     
+
+static U64 gFirstSimHandle = 0;
+static LLHost gFirstSim;
+static std::string gFirstSimSeedCap;
+static LLVector3 gAgentStartLookAt(1.0f, 0.f, 0.f);
+static std::string gAgentStartLocation = "safe";
+static bool mLoginStatePastUI = false;
+
+
+boost::scoped_ptr<LLEventPump> LLStartUp::sStateWatcher(new LLEventStream("StartupState"));
+boost::scoped_ptr<LLStartupListener> LLStartUp::sListener(new LLStartupListener());
+
+//
+// local function declaration
+//
+
+void login_show();
+void login_callback(S32 option, void* userdata);
+void show_first_run_dialog();
+bool first_run_dialog_callback(const LLSD& notification, const LLSD& response);
+void set_startup_status(const F32 frac, const std::string& string, const std::string& msg);
+bool login_alert_status(const LLSD& notification, const LLSD& response);
+void login_packet_failed(void**, S32 result);
+void use_circuit_callback(void**, S32 result);
+void register_viewer_callbacks(LLMessageSystem* msg);
+void asset_callback_nothing(LLVFS*, const LLUUID&, LLAssetType::EType, void*, S32);
+bool callback_choose_gender(const LLSD& notification, const LLSD& response);
+void init_start_screen(S32 location_id);
+void release_start_screen();
+void reset_login();
+LLSD transform_cert_args(LLPointer<LLCertificate> cert);
+void general_cert_done(const LLSD& notification, const LLSD& response);
+void trust_cert_done(const LLSD& notification, const LLSD& response);
+void apply_udp_blacklist(const std::string& csv);
+bool process_login_success_response();
+void transition_back_to_login_panel(const std::string& emsg);
+
+void callback_cache_name(const LLUUID& id, const std::string& full_name, bool is_group)
+{
+	LLNameBox::refreshAll(id, full_name, is_group);
+	LLNameEditor::refreshAll(id, full_name, is_group);
+	
+	// TODO: Actually be intelligent about the refresh.
+	// For now, just brute force refresh the dialogs.
+	dialog_refresh_all();
+}
+
+//
+// exported functionality
+//
+
+//
+// local classes
+//
+
+namespace
+{
+	class LLNullHTTPSender : public LLHTTPSender
+	{
+		virtual void send(const LLHost& host, 
+						  const std::string& message, const LLSD& body, 
+						  LLHTTPClient::ResponderPtr response) const
+		{
+			LL_WARNS("AppInit") << " attemped to send " << message << " to " << host
+					<< " with null sender" << LL_ENDL;
+		}
+	};
+}
+
+void update_texture_fetch()
+{
+	LLAppViewer::getTextureCache()->update(1); // unpauses the texture cache thread
+	LLAppViewer::getImageDecodeThread()->update(1); // unpauses the image thread
+	LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread
+	gTextureList.updateImages(0.10f);
+}
+
+// Returns false to skip other idle processing. Should only return
+// true when all initialization done.
+bool idle_startup()
+{
+	LLMemType mt1(LLMemType::MTYPE_STARTUP);
+	
+	const F32 PRECACHING_DELAY = gSavedSettings.getF32("PrecachingDelay");
+	static LLTimer timeout;
+	static S32 timeout_count = 0;
+
+	static LLTimer login_time;
+
+	// until this is encapsulated, this little hack for the
+	// auth/transform loop will do.
+	static F32 progress = 0.10f;
+
+	static std::string auth_desc;
+	static std::string auth_message;
+
+	static LLVector3 initial_sun_direction(1.f, 0.f, 0.f);
+	static LLVector3 agent_start_position_region(10.f, 10.f, 10.f);		// default for when no space server
+
+	// last location by default
+	static S32  agent_location_id = START_LOCATION_ID_LAST;
+	static S32  location_which = START_LOCATION_ID_LAST;
+
+	static bool show_connect_box = true;
+
+	//static bool stipend_since_login = false;
+
+	// HACK: These are things from the main loop that usually aren't done
+	// until initialization is complete, but need to be done here for things
+	// to work.
+	gIdleCallbacks.callFunctions();
+	gViewerWindow->updateUI();
+	LLMortician::updateClass();
+
+	const std::string delims (" ");
+	std::string system;
+	int begIdx, endIdx;
+	std::string osString = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
+
+	begIdx = osString.find_first_not_of (delims);
+	endIdx = osString.find_first_of (delims, begIdx);
+	system = osString.substr (begIdx, endIdx - begIdx);
+	system += "Locale";
+
+	LLStringUtil::setLocale (LLTrans::getString(system));
+
+	if (!gNoRender)
+	{
+		//note: Removing this line will cause incorrect button size in the login screen. -- bao.
+		gTextureList.updateImages(0.01f) ;
+	}
+
+	if ( STATE_FIRST == LLStartUp::getStartupState() )
+	{
+		gViewerWindow->showCursor(); 
+		gViewerWindow->getWindow()->setCursor(UI_CURSOR_WAIT);
+
+		/////////////////////////////////////////////////
+		//
+		// Initialize stuff that doesn't need data from simulators
+		//
+
+		if (LLFeatureManager::getInstance()->isSafe())
+		{
+			LLNotificationsUtil::add("DisplaySetToSafe");
+		}
+		else if ((gSavedSettings.getS32("LastFeatureVersion") < LLFeatureManager::getInstance()->getVersion()) &&
+				 (gSavedSettings.getS32("LastFeatureVersion") != 0))
+		{
+			LLNotificationsUtil::add("DisplaySetToRecommended");
+		}
+		else if ((gSavedSettings.getS32("LastGPUClass") != LLFeatureManager::getInstance()->getGPUClass()) &&
+				 (gSavedSettings.getS32("LastGPUClass") != -1))
+		{
+			LLNotificationsUtil::add("DisplaySetToRecommended");
+		}
+		else if (!gViewerWindow->getInitAlert().empty())
+		{
+			LLNotificationsUtil::add(gViewerWindow->getInitAlert());
+		}
+			
+		gSavedSettings.setS32("LastFeatureVersion", LLFeatureManager::getInstance()->getVersion());
+		gSavedSettings.setS32("LastGPUClass", LLFeatureManager::getInstance()->getGPUClass());
+
+		// load dynamic GPU/feature tables from website (S3)
+		LLFeatureManager::getInstance()->fetchHTTPTables();
+		
+		std::string xml_file = LLUI::locateSkin("xui_version.xml");
+		LLXMLNodePtr root;
+		bool xml_ok = false;
+		if (LLXMLNode::parseFile(xml_file, root, NULL))
+		{
+			if( (root->hasName("xui_version") ) )
+			{
+				std::string value = root->getValue();
+				F32 version = 0.0f;
+				LLStringUtil::convertToF32(value, version);
+				if (version >= 1.0f)
+				{
+					xml_ok = true;
+				}
+			}
+		}
+		if (!xml_ok)
+		{
+			// If XML is bad, there's a good possibility that notifications.xml is ALSO bad.
+			// If that's so, then we'll get a fatal error on attempting to load it, 
+			// which will display a nontranslatable error message that says so.
+			// Otherwise, we'll display a reasonable error message that IS translatable.
+			LLAppViewer::instance()->earlyExit("BadInstallation");
+		}
+		//
+		// Statistics stuff
+		//
+
+		// Load autopilot and stats stuff
+		gAgentPilot.load(gSavedSettings.getString("StatsPilotFile"));
+
+		//gErrorStream.setTime(gSavedSettings.getBOOL("LogTimestamps"));
+
+		// Load the throttle settings
+		gViewerThrottle.load();
+
+		if (ll_init_ares() == NULL || !gAres->isInitialized())
+		{
+			std::string diagnostic = "Could not start address resolution system";
+			LL_WARNS("AppInit") << diagnostic << LL_ENDL;
+			LLAppViewer::instance()->earlyExit("LoginFailedNoNetwork", LLSD().with("DIAGNOSTIC", diagnostic));
+		}
+		
+		//
+		// Initialize messaging system
+		//
+		LL_DEBUGS("AppInit") << "Initializing messaging system..." << LL_ENDL;
+
+		std::string message_template_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"message_template.msg");
+
+		LLFILE* found_template = NULL;
+		found_template = LLFile::fopen(message_template_path, "r");		/* Flawfinder: ignore */
+		
+		#if LL_WINDOWS
+			// On the windows dev builds, unpackaged, the message_template.msg 
+			// file will be located in:
+			// build-vc**/newview/<config>/app_settings
+			if (!found_template)
+			{
+				message_template_path = gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "app_settings", "message_template.msg");
+				found_template = LLFile::fopen(message_template_path.c_str(), "r");		/* Flawfinder: ignore */
+			}	
+		#elif LL_DARWIN
+			// On Mac dev builds, message_template.msg lives in:
+			// indra/build-*/newview/<config>/Second Life/Contents/Resources/app_settings
+			if (!found_template)
+			{
+				message_template_path =
+					gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE,
+												   "../Resources/app_settings",
+												   "message_template.msg");
+				found_template = LLFile::fopen(message_template_path.c_str(), "r");		/* Flawfinder: ignore */
+			}		
+		#endif
+
+		if (found_template)
+		{
+			fclose(found_template);
+
+			U32 port = gSavedSettings.getU32("UserConnectionPort");
+
+			if ((NET_USE_OS_ASSIGNED_PORT == port) &&   // if nothing specified on command line (-port)
+			    (gSavedSettings.getBOOL("ConnectionPortEnabled")))
+			  {
+			    port = gSavedSettings.getU32("ConnectionPort");
+			  }
+
+			LLHTTPSender::setDefaultSender(new LLNullHTTPSender());
+
+			// TODO parameterize 
+			const F32 circuit_heartbeat_interval = 5;
+			const F32 circuit_timeout = 100;
+
+			const LLUseCircuitCodeResponder* responder = NULL;
+			bool failure_is_fatal = true;
+			
+			if(!start_messaging_system(
+				   message_template_path,
+				   port,
+				   LLVersionInfo::getMajor(),
+				   LLVersionInfo::getMinor(),
+				   LLVersionInfo::getPatch(),
+				   FALSE,
+				   std::string(),
+				   responder,
+				   failure_is_fatal,
+				   circuit_heartbeat_interval,
+				   circuit_timeout))
+			{
+				std::string diagnostic = llformat(" Error: %d", gMessageSystem->getErrorCode());
+				LL_WARNS("AppInit") << diagnostic << LL_ENDL;
+				LLAppViewer::instance()->earlyExit("LoginFailedNoNetwork", LLSD().with("DIAGNOSTIC", diagnostic));
+			}
+
+			#if LL_WINDOWS
+				// On the windows dev builds, unpackaged, the message.xml file will 
+				// be located in indra/build-vc**/newview/<config>/app_settings.
+				std::string message_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"message.xml");
+							
+				if (!LLFile::isfile(message_path.c_str())) 
+				{
+					LLMessageConfig::initClass("viewer", gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "app_settings", ""));
+				}
+				else
+				{
+					LLMessageConfig::initClass("viewer", gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, ""));
+				}
+			#else			
+				LLMessageConfig::initClass("viewer", gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, ""));
+			#endif
+
+		}
+		else
+		{
+			LLAppViewer::instance()->earlyExit("MessageTemplateNotFound", LLSD().with("PATH", message_template_path));
+		}
+
+		if(gMessageSystem && gMessageSystem->isOK())
+		{
+			// Initialize all of the callbacks in case of bad message
+			// system data
+			LLMessageSystem* msg = gMessageSystem;
+			msg->setExceptionFunc(MX_UNREGISTERED_MESSAGE,
+								  invalid_message_callback,
+								  NULL);
+			msg->setExceptionFunc(MX_PACKET_TOO_SHORT,
+								  invalid_message_callback,
+								  NULL);
+
+			// running off end of a packet is now valid in the case
+			// when a reader has a newer message template than
+			// the sender
+			/*msg->setExceptionFunc(MX_RAN_OFF_END_OF_PACKET,
+								  invalid_message_callback,
+								  NULL);*/
+			msg->setExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE,
+								  invalid_message_callback,
+								  NULL);
+
+			if (gSavedSettings.getBOOL("LogMessages"))
+			{
+				LL_DEBUGS("AppInit") << "Message logging activated!" << LL_ENDL;
+				msg->startLogging();
+			}
+
+			// start the xfer system. by default, choke the downloads
+			// a lot...
+			const S32 VIEWER_MAX_XFER = 3;
+			start_xfer_manager(gVFS);
+			gXferManager->setMaxIncomingXfers(VIEWER_MAX_XFER);
+			F32 xfer_throttle_bps = gSavedSettings.getF32("XferThrottle");
+			if (xfer_throttle_bps > 1.f)
+			{
+				gXferManager->setUseAckThrottling(TRUE);
+				gXferManager->setAckThrottleBPS(xfer_throttle_bps);
+			}
+			gAssetStorage = new LLViewerAssetStorage(msg, gXferManager, gVFS, gStaticVFS);
+
+
+			F32 dropPercent = gSavedSettings.getF32("PacketDropPercentage");
+			msg->mPacketRing.setDropPercentage(dropPercent);
+
+            F32 inBandwidth = gSavedSettings.getF32("InBandwidth"); 
+            F32 outBandwidth = gSavedSettings.getF32("OutBandwidth"); 
+			if (inBandwidth != 0.f)
+			{
+				LL_DEBUGS("AppInit") << "Setting packetring incoming bandwidth to " << inBandwidth << LL_ENDL;
+				msg->mPacketRing.setUseInThrottle(TRUE);
+				msg->mPacketRing.setInBandwidth(inBandwidth);
+			}
+			if (outBandwidth != 0.f)
+			{
+				LL_DEBUGS("AppInit") << "Setting packetring outgoing bandwidth to " << outBandwidth << LL_ENDL;
+				msg->mPacketRing.setUseOutThrottle(TRUE);
+				msg->mPacketRing.setOutBandwidth(outBandwidth);
+			}
+		}
+
+		LL_INFOS("AppInit") << "Message System Initialized." << LL_ENDL;
+		
+		//-------------------------------------------------
+		// Init audio, which may be needed for prefs dialog
+		// or audio cues in connection UI.
+		//-------------------------------------------------
+
+		if (FALSE == gSavedSettings.getBOOL("NoAudio"))
+		{
+			gAudiop = NULL;
+
+#ifdef LL_OPENAL
+			if (!gAudiop
+#if !LL_WINDOWS
+			    && NULL == getenv("LL_BAD_OPENAL_DRIVER")
+#endif // !LL_WINDOWS
+			    )
+			{
+				gAudiop = (LLAudioEngine *) new LLAudioEngine_OpenAL();
+			}
+#endif
+
+#ifdef LL_FMOD			
+			if (!gAudiop
+#if !LL_WINDOWS
+			    && NULL == getenv("LL_BAD_FMOD_DRIVER")
+#endif // !LL_WINDOWS
+			    )
+			{
+				gAudiop = (LLAudioEngine *) new LLAudioEngine_FMOD();
+			}
+#endif
+
+			if (gAudiop)
+			{
+#if LL_WINDOWS
+				// FMOD on Windows needs the window handle to stop playing audio
+				// when window is minimized. JC
+				void* window_handle = (HWND)gViewerWindow->getPlatformWindow();
+#else
+				void* window_handle = NULL;
+#endif
+				bool init = gAudiop->init(kAUDIO_NUM_SOURCES, window_handle);
+				if(init)
+				{
+					gAudiop->setMuted(TRUE);
+				}
+				else
+				{
+					LL_WARNS("AppInit") << "Unable to initialize audio engine" << LL_ENDL;
+					delete gAudiop;
+					gAudiop = NULL;
+				}
+
+				if (gAudiop)
+				{
+					// if the audio engine hasn't set up its own preferred handler for streaming audio then set up the generic streaming audio implementation which uses media plugins
+					if (NULL == gAudiop->getStreamingAudioImpl())
+					{
+						LL_INFOS("AppInit") << "Using media plugins to render streaming audio" << LL_ENDL;
+						gAudiop->setStreamingAudioImpl(new LLStreamingAudio_MediaPlugins());
+					}
+				}
+			}
+		}
+		
+		LL_INFOS("AppInit") << "Audio Engine Initialized." << LL_ENDL;
+		
+		if (LLTimer::knownBadTimer())
+		{
+			LL_WARNS("AppInit") << "Unreliable timers detected (may be bad PCI chipset)!!" << LL_ENDL;
+		}
+
+		//
+		// Log on to system
+		//
+		if (gUserCredential.isNull())
+		{
+			gUserCredential = gLoginHandler.initializeLoginInfo();
+		}
+		if (gUserCredential.isNull())
+		{
+			show_connect_box = TRUE;
+		}
+		else if (gSavedSettings.getBOOL("AutoLogin"))  
+		{
+			gRememberPassword = TRUE;
+			gSavedSettings.setBOOL("RememberPassword", TRUE);                                                      
+			show_connect_box = false;    			
+		}
+		else 
+		{
+			gRememberPassword = gSavedSettings.getBOOL("RememberPassword");
+			show_connect_box = TRUE;
+		}
+		// Go to the next startup state
+		LLStartUp::setStartupState( STATE_BROWSER_INIT );
+		return FALSE;
+	}
+
+	
+	if (STATE_BROWSER_INIT == LLStartUp::getStartupState())
+	{
+		LL_DEBUGS("AppInit") << "STATE_BROWSER_INIT" << LL_ENDL;
+		std::string msg = LLTrans::getString("LoginInitializingBrowser");
+		set_startup_status(0.03f, msg.c_str(), gAgent.mMOTD.c_str());
+		display_startup();
+		// LLViewerMedia::initBrowser();
+		LLStartUp::setStartupState( STATE_LOGIN_SHOW );
+		return FALSE;
+	}
+
+
+	if (STATE_LOGIN_SHOW == LLStartUp::getStartupState())
+	{
+		LL_DEBUGS("AppInit") << "Initializing Window" << LL_ENDL;
+
+		// if we've gone backwards in the login state machine, to this state where we show the UI
+		// AND the debug setting to exit in this case is true, then go ahead and bail quickly
+		if ( mLoginStatePastUI && gSavedSettings.getBOOL("QuitOnLoginActivated") )
+		{
+			// no requirement for notification here - just exit
+			LLAppViewer::instance()->earlyExitNoNotify();
+		}
+
+		gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW);
+
+		timeout_count = 0;
+
+		if (show_connect_box)
+		{
+			// Load all the name information out of the login view
+			// 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())                                                                          
+			{                                                                                                      
+				gUserCredential = gLoginHandler.initializeLoginInfo();                 
+			}     
+			if (gNoRender)
+			{
+				LL_ERRS("AppInit") << "Need to autologin or use command line with norender!" << LL_ENDL;
+			}
+			// Make sure the process dialog doesn't hide things
+			gViewerWindow->setShowProgress(FALSE);
+
+			initialize_edit_menu();
+
+			// Show the login dialog
+			login_show();
+			// connect dialog is already shown, so fill in the names
+			if (gUserCredential.notNull())                                                                         
+			{                                                                                                      
+				LLPanelLogin::setFields( gUserCredential, gRememberPassword);                                  
+			}     
+			LLPanelLogin::giveFocus();
+
+			LLStartUp::setStartupState( STATE_LOGIN_WAIT );		// Wait for user input
+		}
+		else
+		{
+			// skip directly to message template verification
+			LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
+		}
+
+		// *NOTE: This is where LLViewerParcelMgr::getInstance() used to get allocated before becoming LLViewerParcelMgr::getInstance().
+
+		// *NOTE: This is where gHUDManager used to bet allocated before becoming LLHUDManager::getInstance().
+
+		// *NOTE: This is where gMuteList used to get allocated before becoming LLMuteList::getInstance().
+
+		// Login screen needs menus for preferences, but we can enter
+		// this startup phase more than once.
+		if (gLoginMenuBarView == NULL)
+		{
+			init_menus();
+		}
+		
+		gViewerWindow->setNormalControlsVisible( FALSE );	
+		gLoginMenuBarView->setVisible( TRUE );
+		gLoginMenuBarView->setEnabled( TRUE );
+		show_debug_menus();
+
+		// Hide the splash screen
+		LLSplashScreen::hide();
+
+		// Push our window frontmost
+		gViewerWindow->getWindow()->show();
+		display_startup();
+
+		// DEV-16927.  The following code removes errant keystrokes that happen while the window is being 
+		// first made visible.
+#ifdef _WIN32
+		MSG msg;
+		while( PeekMessage( &msg, /*All hWnds owned by this thread */ NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE ) );
+#endif
+		timeout.reset();
+		return FALSE;
+	}
+
+	if (STATE_LOGIN_WAIT == LLStartUp::getStartupState())
+	{
+		// when we get to this state, we've already been past the login UI
+		// (possiblely automatically) - flag this so we can test in the 
+		// STATE_LOGIN_SHOW state if we've gone backwards
+		mLoginStatePastUI = true;
+
+		// Don't do anything.  Wait for the login view to call the login_callback,
+		// which will push us to the next state.
+
+		// Sleep so we don't spin the CPU
+		ms_sleep(1);
+		return FALSE;
+	}
+
+	if (STATE_LOGIN_CLEANUP == LLStartUp::getStartupState())
+	{
+		//reset the values that could have come in from a slurl
+		// DEV-42215: Make sure they're not empty -- gUserCredential
+		// might already have been set from gSavedSettings, and it's too bad
+		// to overwrite valid values with empty strings.
+
+		if (show_connect_box)
+		{
+			// TODO if not use viewer auth
+			// Load all the name information out of the login view
+			LLPanelLogin::getFields(gUserCredential, gRememberPassword); 
+			// end TODO
+	 
+			// HACK: Try to make not jump on login
+			gKeyboard->resetKeys();
+		}
+
+		// when we get to this state, we've already been past the login UI
+		// (possiblely automatically) - flag this so we can test in the 
+		// STATE_LOGIN_SHOW state if we've gone backwards
+		mLoginStatePastUI = true;
+
+		// save the credentials                                                                                        
+		std::string userid = "unknown";                                                                                
+		if(gUserCredential.notNull())                                                                                  
+		{  
+			userid = gUserCredential->userID();                                                                    
+			gSecAPIHandler->saveCredential(gUserCredential, gRememberPassword);  
+		}
+		gSavedSettings.setBOOL("RememberPassword", gRememberPassword);                                                 
+		LL_INFOS("AppInit") << "Attempting login as: " << userid << LL_ENDL;                                           
+		gDebugInfo["LoginName"] = userid;                                                                              
+         
+		// create necessary directories
+		// *FIX: these mkdir's should error check
+		gDirUtilp->setLindenUserDir(userid);
+		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")));
+
+		// Note: can't store warnings files per account because some come up before login
+		
+		// Overwrite default user settings with user settings								 
+		LLAppViewer::instance()->loadSettingsFromDirectory("Account");
+
+		// Need to set the LastLogoff time here if we don't have one.  LastLogoff is used for "Recent Items" calculation
+		// and startup time is close enough if we don't have a real value.
+		if (gSavedPerAccountSettings.getU32("LastLogoff") == 0)
+		{
+			gSavedPerAccountSettings.setU32("LastLogoff", time_corrected());
+		}
+
+		//Default the path if one isn't set.
+		// *NOTE: unable to check variable differ from "InstantMessageLogPath" because it was
+		// provided in pre 2.0 viewer. See EXT-6661
+		if (gSavedPerAccountSettings.getString("InstantMessageLogPath").empty())
+		{
+			gDirUtilp->setChatLogsDir(gDirUtilp->getOSUserAppDir());
+			gSavedPerAccountSettings.setString("InstantMessageLogPath", gDirUtilp->getChatLogsDir());
+		}
+		else
+		{
+			gDirUtilp->setChatLogsDir(gSavedPerAccountSettings.getString("InstantMessageLogPath"));		
+		}
+		gDirUtilp->setPerAccountChatLogsDir(userid);  
+		
+		LLFile::mkdir(gDirUtilp->getChatLogsDir());
+		LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir());
+
+
+		//good a place as any to create user windlight directories
+		std::string user_windlight_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight", ""));
+		LLFile::mkdir(user_windlight_path_name.c_str());		
+
+		std::string user_windlight_skies_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", ""));
+		LLFile::mkdir(user_windlight_skies_path_name.c_str());
+
+		std::string user_windlight_water_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/water", ""));
+		LLFile::mkdir(user_windlight_water_path_name.c_str());
+
+		std::string user_windlight_days_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/days", ""));
+		LLFile::mkdir(user_windlight_days_path_name.c_str());
+
+
+		if (show_connect_box)
+		{
+			LLSLURL slurl;
+			LLPanelLogin::closePanel();
+		}
+
+		
+		// Load URL History File
+		LLURLHistory::loadFile("url_history.xml");
+		// Load location history 
+		LLLocationHistory::getInstance()->load();
+
+		// Load Avatars icons cache
+		LLAvatarIconIDCache::getInstance()->load();
+		
+		// Load media plugin cookies
+		LLViewerMedia::loadCookieFile();
+
+		//-------------------------------------------------
+		// Handle startup progress screen
+		//-------------------------------------------------
+
+		// on startup the user can request to go to their home,
+		// their last location, or some URL "-url //sim/x/y[/z]"
+		// All accounts have both a home and a last location, and we don't support
+		// more locations than that.  Choose the appropriate one.  JC
+		switch (LLStartUp::getStartSLURL().getType())
+		  {
+		  case LLSLURL::LOCATION:
+		    agent_location_id = START_LOCATION_ID_URL;
+		    location_which = START_LOCATION_ID_LAST;
+		    break;
+		  case LLSLURL::LAST_LOCATION:
+		    agent_location_id = START_LOCATION_ID_LAST;
+		    location_which = START_LOCATION_ID_LAST;
+		    break;
+		  default:
+		    agent_location_id = START_LOCATION_ID_HOME;
+		    location_which = START_LOCATION_ID_HOME;
+		    break;
+		  }
+
+		gViewerWindow->getWindow()->setCursor(UI_CURSOR_WAIT);
+
+		if (!gNoRender)
+		{
+			init_start_screen(agent_location_id);
+		}
+
+		// Display the startup progress bar.
+		gViewerWindow->setShowProgress(TRUE);
+		gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Quit"));
+
+		// Poke the VFS, which could potentially block for a while if
+		// Windows XP is acting up
+		set_startup_status(0.07f, LLTrans::getString("LoginVerifyingCache"), LLStringUtil::null);
+		display_startup();
+
+		gVFS->pokeFiles();
+
+		LLStartUp::setStartupState( STATE_LOGIN_AUTH_INIT );
+
+		return FALSE;
+	}
+
+	if(STATE_LOGIN_AUTH_INIT == LLStartUp::getStartupState())
+	{
+		gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridLabel();
+
+		// Update progress status and the display loop.
+		auth_desc = LLTrans::getString("LoginInProgress");
+		set_startup_status(progress, auth_desc, auth_message);
+		progress += 0.02f;
+		display_startup();
+
+		// Setting initial values...
+		LLLoginInstance* login = LLLoginInstance::getInstance();
+		login->setNotificationsInterface(LLNotifications::getInstance());
+		if(gNoRender)
+		{
+			// HACK, skip optional updates if you're running drones
+			login->setSkipOptionalUpdate(true);
+		}
+
+		login->setSerialNumber(LLAppViewer::instance()->getSerialNumber());
+		login->setLastExecEvent(gLastExecEvent);
+		login->setUpdaterLauncher(boost::bind(&LLAppViewer::launchUpdater, LLAppViewer::instance()));
+
+		// This call to LLLoginInstance::connect() starts the 
+		// authentication process.
+		login->connect(gUserCredential);
+
+		LLStartUp::setStartupState( STATE_LOGIN_CURL_UNSTUCK );
+		return FALSE;
+	}
+
+	if(STATE_LOGIN_CURL_UNSTUCK == LLStartUp::getStartupState())
+	{
+		// If we get here we have gotten past the potential stall
+		// in curl, so take "may appear frozen" out of progress bar. JC
+		auth_desc = LLTrans::getString("LoginInProgressNoFrozen");
+		set_startup_status(progress, auth_desc, auth_message);
+
+		LLStartUp::setStartupState( STATE_LOGIN_PROCESS_RESPONSE );
+		return FALSE;
+	}
+
+	if(STATE_LOGIN_PROCESS_RESPONSE == LLStartUp::getStartupState()) 
+	{
+		std::ostringstream emsg;
+		emsg << LLTrans::getString("LoginFailed") << "\n";
+		if(LLLoginInstance::getInstance()->authFailure())
+		{
+			LL_INFOS("LLStartup") << "Login failed, LLLoginInstance::getResponse(): "
+			                      << LLLoginInstance::getInstance()->getResponse() << LL_ENDL;
+			LLSD response = LLLoginInstance::getInstance()->getResponse();
+			// Still have error conditions that may need some 
+			// sort of handling.
+			std::string reason_response = response["reason"];
+			std::string message_response = response["message"];
+	
+			if(!message_response.empty())
+			{
+				// XUI: fix translation for strings returned during login
+				// We need a generic table for translations
+				std::string big_reason = LLAgent::sTeleportErrorMessages[ message_response ];
+				if ( big_reason.size() == 0 )
+				{
+					emsg << message_response;
+				}
+				else
+				{
+					emsg << big_reason;
+				}
+			}
+
+			if(reason_response == "key")
+			{
+				// Couldn't login because user/password is wrong
+				// Clear the credential
+				gUserCredential->clearAuthenticator();
+			}
+
+			if(reason_response == "update" 
+				|| reason_response == "optional")
+			{
+				// In the case of a needed update, quit.
+				// Its either downloading or declined.
+				// If optional was skipped this case shouldn't 
+				// be reached.
+				LLLoginInstance::getInstance()->disconnect();
+				LLAppViewer::instance()->forceQuit();
+			}
+			else 
+			{
+				if (reason_response != "tos") 
+				{
+					// Don't pop up a notification in the TOS case because
+					// LLFloaterTOS::onCancel() already scolded the user.
+					std::string error_code;
+					if(response.has("errorcode"))
+					{
+						error_code = response["errorcode"].asString();
+					}
+					if ((reason_response == "CURLError") && 
+						(error_code == "SSL_CACERT" || error_code == "SSL_PEER_CERTIFICATE") && 
+						response.has("certificate"))
+					{
+						// This was a certificate error, so grab the certificate
+						// and throw up the appropriate dialog.
+						LLPointer<LLCertificate> certificate = gSecAPIHandler->getCertificate(response["certificate"]);
+						if(certificate)
+						{
+							LLSD args = transform_cert_args(certificate);
+
+							if(error_code == "SSL_CACERT")
+							{
+								// if we are handling an untrusted CA, throw up the dialog                             
+								// with the 'trust this CA' button.                                                    
+								LLNotificationsUtil::add("TrustCertificateError", args, response,
+														trust_cert_done);
+								
+								show_connect_box = true;
+							}
+							else
+							{
+								// the certificate exception returns a unique string for each type of exception.       
+								// we grab this string via the LLUserAuth object, and use that to grab the localized   
+								// string.                                                                             
+								args["REASON"] = LLTrans::getString(message_response);
+								
+								LLNotificationsUtil::add("GeneralCertificateError", args, response,
+														 general_cert_done);
+								
+								reset_login();
+								gSavedSettings.setBOOL("AutoLogin", FALSE);
+								show_connect_box = true;
+								
+							}
+
+						}
+					}
+					else 
+					{
+						// This wasn't a certificate error, so throw up the normal
+						// notificatioin message.
+						LLSD args;
+						args["ERROR_MESSAGE"] = emsg.str();
+						LL_INFOS("LLStartup") << "Notification: " << args << LL_ENDL;
+						LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done);
+					}
+				}
+				//setup map of datetime strings to codes and slt & local time offset from utc
+				// *TODO: Does this need to be here?
+				LLStringOps::setupDatetimeInfo (false);
+				transition_back_to_login_panel(emsg.str());
+				show_connect_box = true;
+			}
+		}
+		else if(LLLoginInstance::getInstance()->authSuccess())
+		{
+			if(process_login_success_response())
+			{
+				// Pass the user information to the voice chat server interface.
+				LLVoiceClient::getInstance()->userAuthorized(gUserCredential->userID(), gAgentID);
+				// create the default proximal channel
+				LLVoiceChannel::initClass();
+				LLGridManager::getInstance()->setFavorite(); 
+				LLStartUp::setStartupState( STATE_WORLD_INIT);
+			}
+			else
+			{
+				LLSD args;
+				args["ERROR_MESSAGE"] = emsg.str();
+				LL_INFOS("LLStartup") << "Notification: " << args << LL_ENDL;
+				LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done);
+				transition_back_to_login_panel(emsg.str());
+				show_connect_box = true;
+				return FALSE;
+			}
+		}
+		return FALSE;
+	}
+
+	//---------------------------------------------------------------------
+	// World Init
+	//---------------------------------------------------------------------
+	if (STATE_WORLD_INIT == LLStartUp::getStartupState())
+	{
+		set_startup_status(0.30f, LLTrans::getString("LoginInitializingWorld"), gAgent.mMOTD);
+		display_startup();
+		// We should have an agent id by this point.
+		llassert(!(gAgentID == LLUUID::null));
+
+		// Finish agent initialization.  (Requires gSavedSettings, builds camera)
+		gAgent.init();
+		gAgentCamera.init();
+		set_underclothes_menu_options();
+
+		// 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();
+
+		//
+		// Initialize classes w/graphics stuff.
+		//
+		gTextureList.doPrefetchImages();		
+		LLSurface::initClasses();
+
+		LLFace::initClass();
+
+		LLDrawable::initClass();
+
+		// init the shader managers
+		LLPostProcess::initClass();
+		LLWLParamManager::initClass();
+		LLWaterParamManager::initClass();
+
+		LLViewerObject::initVOClasses();
+
+		// 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();
+
+		// 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:
+		// World initialization must be done after above window init
+
+		// User might have overridden far clip
+		LLWorld::getInstance()->setLandFarClip(gAgentCamera.mDrawDistance);
+
+		// 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));
+
+		LLWorld::getInstance()->addRegion(gFirstSimHandle, gFirstSim);
+
+		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;
+		
+		// Set agent's initial region to be the one we just created.
+		gAgent.setRegion(regionp);
+
+		// 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);
+
+		display_startup();
+		LLStartUp::setStartupState( STATE_MULTIMEDIA_INIT );
+		
+		return FALSE;
+	}
+
+
+	//---------------------------------------------------------------------
+	// Load QuickTime/GStreamer and other multimedia engines, can be slow.
+	// Do it while we're waiting on the network for our seed capability. JC
+	//---------------------------------------------------------------------
+	if (STATE_MULTIMEDIA_INIT == LLStartUp::getStartupState())
+	{
+		LLStartUp::multimediaInit();
+		LLStartUp::setStartupState( STATE_FONT_INIT );
+		return FALSE;
+	}
+
+	// Loading fonts takes several seconds
+	if (STATE_FONT_INIT == LLStartUp::getStartupState())
+	{
+		LLStartUp::fontInit();
+		LLStartUp::setStartupState( STATE_SEED_GRANTED_WAIT );
+		return FALSE;
+	}
+
+	//---------------------------------------------------------------------
+	// Wait for Seed Cap Grant
+	//---------------------------------------------------------------------
+	if(STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState())
+	{
+		return FALSE;
+	}
+
+
+	//---------------------------------------------------------------------
+	// Seed Capability Granted
+	// no newMessage calls should happen before this point
+	//---------------------------------------------------------------------
+	if (STATE_SEED_CAP_GRANTED == LLStartUp::getStartupState())
+	{
+		update_texture_fetch();
+
+		if ( gViewerWindow != NULL)
+		{	// This isn't the first logon attempt, so show the UI
+			gViewerWindow->setNormalControlsVisible( TRUE );
+		}	
+		gLoginMenuBarView->setVisible( FALSE );
+		gLoginMenuBarView->setEnabled( FALSE );
+
+		if (!gNoRender)
+		{
+			// direct logging to the debug console's line buffer
+			LLError::logToFixedBuffer(gDebugView->mDebugConsolep);
+			
+			// set initial visibility of debug console
+			gDebugView->mDebugConsolep->setVisible(gSavedSettings.getBOOL("ShowDebugConsole"));
+		}
+
+		//
+		// Set message handlers
+		//
+		LL_INFOS("AppInit") << "Initializing communications..." << LL_ENDL;
+
+		// register callbacks for messages. . . do this after initial handshake to make sure that we don't catch any unwanted
+		register_viewer_callbacks(gMessageSystem);
+
+		// Debugging info parameters
+		gMessageSystem->setMaxMessageTime( 0.5f );			// Spam if decoding all msgs takes more than 500 ms
+
+		#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
+
+		gXferManager->registerCallbacks(gMessageSystem);
+
+		LLStartUp::initNameCache();
+
+		// update the voice settings *after* gCacheName initialization
+		// so that we can construct voice UI that relies on the name cache
+		LLVoiceClient::getInstance()->updateSettings();
+
+		//gCacheName is required for nearby chat history loading
+		//so I just moved nearby history loading a few states further
+		if (!gNoRender && gSavedPerAccountSettings.getBOOL("LogShowHistory"))
+		{
+			LLNearbyChat* nearby_chat = LLNearbyChat::getInstance();
+			if (nearby_chat) nearby_chat->loadHistory();
+		}
+
+		// *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);
+
+		//reset statistics
+		LLViewerStats::getInstance()->resetStats();
+
+		display_startup();
+		//
+		// Set up region and surface defaults
+		//
+
+
+		// Sets up the parameters for the first simulator
+
+		LL_DEBUGS("AppInit") << "Initializing camera..." << LL_ENDL;
+		gFrameTime    = totalTime();
+		F32 last_time = gFrameTimeSeconds;
+		gFrameTimeSeconds = (S64)(gFrameTime - gStartTime)/SEC_TO_MICROSEC;
+
+		gFrameIntervalSeconds = gFrameTimeSeconds - last_time;
+		if (gFrameIntervalSeconds < 0.f)
+		{
+			gFrameIntervalSeconds = 0.f;
+		}
+
+		// Make sure agent knows correct aspect ratio
+		// FOV limits depend upon aspect ratio so this needs to happen before initializing the FOV below
+		LLViewerCamera::getInstance()->setViewHeightInPixels(gViewerWindow->getWorldViewHeightRaw());
+		LLViewerCamera::getInstance()->setAspect(gViewerWindow->getWorldViewAspectRatio());
+		// Initialize FOV
+		LLViewerCamera::getInstance()->setDefaultFOV(gSavedSettings.getF32("CameraAngle")); 
+
+		// Move agent to starting location. The position handed to us by
+		// the space server is in global coordinates, but the agent frame
+		// is in region local coordinates. Therefore, we need to adjust
+		// the coordinates handed to us to fit in the local region.
+
+		gAgent.setPositionAgent(agent_start_position_region);
+		gAgent.resetAxes(gAgentStartLookAt);
+		gAgentCamera.stopCameraAnimation();
+		gAgentCamera.resetCamera();
+
+		// Initialize global class data needed for surfaces (i.e. textures)
+		if (!gNoRender)
+		{
+			LL_DEBUGS("AppInit") << "Initializing sky..." << LL_ENDL;
+			// Initialize all of the viewer object classes for the first time (doing things like texture fetches.
+			LLGLState::checkStates();
+			LLGLState::checkTextureChannels();
+
+			gSky.init(initial_sun_direction);
+
+			LLGLState::checkStates();
+			LLGLState::checkTextureChannels();
+		}
+
+		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
+		const S32 DECODE_TIME_SEC = 2;
+		for (int i = 0; i < DECODE_TIME_SEC; i++)
+		{
+			F32 frac = (F32)i / (F32)DECODE_TIME_SEC;
+			set_startup_status(0.45f + frac*0.1f, LLTrans::getString("LoginDecodingImages"), gAgent.mMOTD);
+			display_startup();
+			gTextureList.decodeAllImages(1.f);
+		}
+		LLStartUp::setStartupState( STATE_WORLD_WAIT );
+
+		// JC - Do this as late as possible to increase likelihood Purify
+		// will run.
+		LLMessageSystem* msg = gMessageSystem;
+		if (!msg->mOurCircuitCode)
+		{
+			LL_WARNS("AppInit") << "Attempting to connect to simulator with a zero circuit code!" << LL_ENDL;
+		}
+
+		gUseCircuitCallbackCalled = false;
+
+		msg->enableCircuit(gFirstSim, TRUE);
+		// now, use the circuit info to tell simulator about us!
+		LL_INFOS("AppInit") << "viewer: UserLoginLocationReply() Enabling " << gFirstSim << " with code " << msg->mOurCircuitCode << LL_ENDL;
+		msg->newMessageFast(_PREHASH_UseCircuitCode);
+		msg->nextBlockFast(_PREHASH_CircuitCode);
+		msg->addU32Fast(_PREHASH_Code, msg->mOurCircuitCode);
+		msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+		msg->addUUIDFast(_PREHASH_ID, gAgent.getID());
+		msg->sendReliable(
+			gFirstSim,
+			gSavedSettings.getS32("UseCircuitCodeMaxRetries"),
+			FALSE,
+			gSavedSettings.getF32("UseCircuitCodeTimeout"),
+			use_circuit_callback,
+			NULL);
+
+		timeout.reset();
+
+		return FALSE;
+	}
+
+	//---------------------------------------------------------------------
+	// Agent Send
+	//---------------------------------------------------------------------
+	if(STATE_WORLD_WAIT == LLStartUp::getStartupState())
+	{
+		LL_DEBUGS("AppInit") << "Waiting for simulator ack...." << LL_ENDL;
+		set_startup_status(0.59f, LLTrans::getString("LoginWaitingForRegionHandshake"), gAgent.mMOTD);
+		if(gGotUseCircuitCodeAck)
+		{
+			LLStartUp::setStartupState( STATE_AGENT_SEND );
+		}
+		LLMessageSystem* msg = gMessageSystem;
+		while (msg->checkAllMessages(gFrameCount, gServicePump))
+		{
+		}
+		msg->processAcks();
+		return FALSE;
+	}
+
+	//---------------------------------------------------------------------
+	// Agent Send
+	//---------------------------------------------------------------------
+	if (STATE_AGENT_SEND == LLStartUp::getStartupState())
+	{
+		LL_DEBUGS("AppInit") << "Connecting to region..." << LL_ENDL;
+		set_startup_status(0.60f, LLTrans::getString("LoginConnectingToRegion"), gAgent.mMOTD);
+		// register with the message system so it knows we're
+		// expecting this message
+		LLMessageSystem* msg = gMessageSystem;
+		msg->setHandlerFuncFast(
+			_PREHASH_AgentMovementComplete,
+			process_agent_movement_complete);
+		LLViewerRegion* regionp = gAgent.getRegion();
+		if(regionp)
+		{
+			send_complete_agent_movement(regionp->getHost());
+			gAssetStorage->setUpstream(regionp->getHost());
+			gCacheName->setUpstream(regionp->getHost());
+			msg->newMessageFast(_PREHASH_EconomyDataRequest);
+			gAgent.sendReliableMessage();
+		}
+
+		// Create login effect
+		// But not on first login, because you can't see your avatar then
+		if (!gAgent.isFirstLogin())
+		{
+			LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
+			effectp->setPositionGlobal(gAgent.getPositionGlobal());
+			effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+			LLHUDManager::getInstance()->sendEffects();
+		}
+
+		LLStartUp::setStartupState( STATE_AGENT_WAIT );		// Go to STATE_AGENT_WAIT
+
+		timeout.reset();
+		return FALSE;
+	}
+
+	//---------------------------------------------------------------------
+	// Agent Wait
+	//---------------------------------------------------------------------
+	if (STATE_AGENT_WAIT == LLStartUp::getStartupState())
+	{
+		LLMessageSystem* msg = gMessageSystem;
+		while (msg->checkAllMessages(gFrameCount, gServicePump))
+		{
+			if (gAgentMovementCompleted)
+			{
+				// Sometimes we have more than one message in the
+				// queue. break out of this loop and continue
+				// processing. If we don't, then this could skip one
+				// or more login steps.
+				break;
+			}
+			else
+			{
+				LL_DEBUGS("AppInit") << "Awaiting AvatarInitComplete, got "
+				<< msg->getMessageName() << LL_ENDL;
+			}
+		}
+		msg->processAcks();
+
+		if (gAgentMovementCompleted)
+		{
+			LLStartUp::setStartupState( STATE_INVENTORY_SEND );
+		}
+
+		return FALSE;
+	}
+
+	//---------------------------------------------------------------------
+	// Inventory Send
+	//---------------------------------------------------------------------
+	if (STATE_INVENTORY_SEND == LLStartUp::getStartupState())
+	{
+		// Inform simulator of our language preference
+		LLAgentLanguage::update();
+
+		// unpack thin inventory
+		LLSD response = LLLoginInstance::getInstance()->getResponse();
+		//bool dump_buffer = false;
+
+		LLSD inv_lib_root = response["inventory-lib-root"];
+		if(inv_lib_root.isDefined())
+		{
+			// should only be one
+			LLSD id = inv_lib_root[0]["folder_id"];
+			if(id.isDefined())
+			{
+				gInventory.setLibraryRootFolderID(id.asUUID());
+			}
+		}
+ 		
+		LLSD inv_lib_owner = response["inventory-lib-owner"];
+		if(inv_lib_owner.isDefined())
+		{
+			// should only be one
+			LLSD id = inv_lib_owner[0]["agent_id"];
+			if(id.isDefined())
+			{
+				gInventory.setLibraryOwnerID( LLUUID(id.asUUID()));
+			}
+		}
+
+		LLSD inv_skel_lib = response["inventory-skel-lib"];
+ 		if(inv_skel_lib.isDefined() && gInventory.getLibraryOwnerID().notNull())
+ 		{
+ 			if(!gInventory.loadSkeleton(inv_skel_lib, gInventory.getLibraryOwnerID()))
+ 			{
+ 				LL_WARNS("AppInit") << "Problem loading inventory-skel-lib" << LL_ENDL;
+ 			}
+ 		}
+
+		LLSD inv_skeleton = response["inventory-skeleton"];
+ 		if(inv_skeleton.isDefined())
+ 		{
+ 			if(!gInventory.loadSkeleton(inv_skeleton, gAgent.getID()))
+ 			{
+ 				LL_WARNS("AppInit") << "Problem loading inventory-skel-targets" << LL_ENDL;
+ 			}
+ 		}
+
+		LLSD buddy_list = response["buddy-list"];
+ 		if(buddy_list.isDefined())
+ 		{
+			LLAvatarTracker::buddy_map_t list;
+			LLUUID agent_id;
+			S32 has_rights = 0, given_rights = 0;
+			for(LLSD::array_const_iterator it = buddy_list.beginArray(),
+				end = buddy_list.endArray(); it != end; ++it)
+			{
+				LLSD buddy_id = (*it)["buddy_id"];
+				if(buddy_id.isDefined())
+				{
+					agent_id = buddy_id.asUUID();
+				}
+
+				LLSD buddy_rights_has = (*it)["buddy_rights_has"];
+				if(buddy_rights_has.isDefined())
+				{
+					has_rights = buddy_rights_has.asInteger();
+				}
+
+				LLSD buddy_rights_given = (*it)["buddy_rights_given"];
+				if(buddy_rights_given.isDefined())
+				{
+					given_rights = buddy_rights_given.asInteger();
+				}
+
+				list[agent_id] = new LLRelationship(given_rights, has_rights, false);
+			}
+			LLAvatarTracker::instance().addBuddyList(list);
+ 		}
+
+		bool show_hud = false;
+		LLSD tutorial_setting = response["tutorial_setting"];
+		if(tutorial_setting.isDefined())
+		{
+			for(LLSD::array_const_iterator it = tutorial_setting.beginArray(),
+				end = tutorial_setting.endArray(); it != end; ++it)
+			{
+				LLSD tutorial_url = (*it)["tutorial_url"];
+				if(tutorial_url.isDefined())
+				{
+					// Tutorial floater will append language code
+					gSavedSettings.setString("TutorialURL", tutorial_url.asString());
+				}
+				
+				// For Viewer 2.0 we are not using the web-based tutorial
+				// If we reverse that decision, put this code back and use
+				// login.cgi to send a different URL with content that matches
+				// the Viewer 2.0 UI.
+				//LLSD use_tutorial = (*it)["use_tutorial"];
+				//if(use_tutorial.asString() == "true")
+				//{
+				//	show_hud = true;
+				//}
+			}
+		}
+		// 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
+		if (show_hud || gSavedSettings.getBOOL("ShowTutorial"))
+		{
+			LLFloaterReg::showInstance("hud", LLSD(), FALSE);
+		}
+
+		LLSD event_notifications = response["event_notifications"];
+		if(event_notifications.isDefined())
+		{
+			gEventNotifier.load(event_notifications);
+		}
+
+		LLSD classified_categories = response["classified_categories"];
+		if(classified_categories.isDefined())
+		{
+			LLClassifiedInfo::loadCategories(classified_categories);
+		}
+
+		// This method MUST be called before gInventory.findCategoryUUIDForType because of 
+		// gInventory.mIsAgentInvUsable is set to true in the gInventory.buildParentChildMap.
+		gInventory.buildParentChildMap();
+
+		//all categories loaded. lets create "My Favorites" category
+		gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE,true);
+
+		// set up callbacks
+		llinfos << "Registering Callbacks" << llendl;
+		LLMessageSystem* msg = gMessageSystem;
+		llinfos << " Inventory" << llendl;
+		LLInventoryModel::registerCallbacks(msg);
+		llinfos << " AvatarTracker" << llendl;
+		LLAvatarTracker::instance().registerCallbacks(msg);
+		llinfos << " Landmark" << llendl;
+		LLLandmark::registerCallbacks(msg);
+
+		// request mute list
+		llinfos << "Requesting Mute List" << llendl;
+		LLMuteList::getInstance()->requestFromServer(gAgent.getID());
+
+		// Get L$ and ownership credit information
+		llinfos << "Requesting Money Balance" << llendl;
+		LLStatusBar::sendMoneyBalanceRequest();
+
+		// request all group information
+		llinfos << "Requesting Agent Data" << llendl;
+		gAgent.sendAgentDataUpdateRequest();
+
+		// Create the inventory views
+		llinfos << "Creating Inventory Views" << llendl;
+		LLFloaterReg::getInstance("inventory");
+
+		LLStartUp::setStartupState( STATE_MISC );
+		return FALSE;
+	}
+
+
+	//---------------------------------------------------------------------
+	// Misc
+	//---------------------------------------------------------------------
+	if (STATE_MISC == LLStartUp::getStartupState())
+	{
+		// We have a region, and just did a big inventory download.
+		// We can estimate the user's connection speed, and set their
+		// max bandwidth accordingly.  JC
+		if (gSavedSettings.getBOOL("FirstLoginThisInstall"))
+		{
+			// This is actually a pessimistic computation, because TCP may not have enough
+			// time to ramp up on the (small) default inventory file to truly measure max
+			// bandwidth. JC
+			F64 rate_bps = LLLoginInstance::getInstance()->getLastTransferRateBPS();
+			const F32 FAST_RATE_BPS = 600.f * 1024.f;
+			const F32 FASTER_RATE_BPS = 750.f * 1024.f;
+			F32 max_bandwidth = gViewerThrottle.getMaxBandwidth();
+			if (rate_bps > FASTER_RATE_BPS
+				&& rate_bps > max_bandwidth)
+			{
+				LL_DEBUGS("AppInit") << "Fast network connection, increasing max bandwidth to " 
+					<< FASTER_RATE_BPS/1024.f 
+					<< " kbps" << LL_ENDL;
+				gViewerThrottle.setMaxBandwidth(FASTER_RATE_BPS / 1024.f);
+			}
+			else if (rate_bps > FAST_RATE_BPS
+				&& rate_bps > max_bandwidth)
+			{
+				LL_DEBUGS("AppInit") << "Fast network connection, increasing max bandwidth to " 
+					<< FAST_RATE_BPS/1024.f 
+					<< " kbps" << LL_ENDL;
+				gViewerThrottle.setMaxBandwidth(FAST_RATE_BPS / 1024.f);
+			}
+
+			// Set the show start location to true, now that the user has logged
+			// on with this install.
+			gSavedSettings.setBOOL("ShowStartLocation", TRUE);
+		}
+
+		// We're successfully logged in.
+		gSavedSettings.setBOOL("FirstLoginThisInstall", FALSE);
+
+		LLFloaterReg::showInitialVisibleInstances();
+
+		// 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" );
+		if ( nextLoginLocation.length() )
+		{
+			// clear it
+			gSavedSettings.setString( "NextLoginLocation", "" );
+
+			// and make sure it's saved
+			gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile") , TRUE );
+			LLUIColorTable::instance().saveUserSettings();
+		};
+
+		if (!gNoRender)
+		{
+			// JC: Initializing audio requests many sounds for download.
+			init_audio();
+
+			// JC: Initialize "active" gestures.  This may also trigger
+			// many gesture downloads, if this is the user's first
+			// time on this machine or -purge has been run.
+			LLSD gesture_options 
+				= LLLoginInstance::getInstance()->getResponse("gestures");
+			if (gesture_options.isDefined())
+			{
+				LL_DEBUGS("AppInit") << "Gesture Manager loading " << gesture_options.size()
+					<< LL_ENDL;
+				uuid_vec_t item_ids;
+				for(LLSD::array_const_iterator resp_it = gesture_options.beginArray(),
+					end = gesture_options.endArray(); resp_it != end; ++resp_it)
+				{
+					// If the id is not specifed in the LLSD,
+					// the LLSD operator[]() will return a null LLUUID. 
+					LLUUID item_id = (*resp_it)["item_id"];
+					LLUUID asset_id = (*resp_it)["asset_id"];
+
+					if (item_id.notNull() && asset_id.notNull())
+					{
+						// Could schedule and delay these for later.
+						const BOOL no_inform_server = FALSE;
+						const BOOL no_deactivate_similar = FALSE;
+						LLGestureMgr::instance().activateGestureWithAsset(item_id, asset_id,
+											 no_inform_server,
+											 no_deactivate_similar);
+						// We need to fetch the inventory items for these gestures
+						// so we have the names to populate the UI.
+						item_ids.push_back(item_id);
+					}
+				}
+				// no need to add gesture to inventory observer, it's already made in constructor 
+				LLGestureMgr::instance().setFetchIDs(item_ids);
+				LLGestureMgr::instance().startFetch();
+			}
+		}
+		gDisplaySwapBuffers = TRUE;
+
+		LLMessageSystem* msg = gMessageSystem;
+		msg->setHandlerFuncFast(_PREHASH_SoundTrigger,				process_sound_trigger);
+		msg->setHandlerFuncFast(_PREHASH_PreloadSound,				process_preload_sound);
+		msg->setHandlerFuncFast(_PREHASH_AttachedSound,				process_attached_sound);
+		msg->setHandlerFuncFast(_PREHASH_AttachedSoundGainChange,	process_attached_sound_gain_change);
+
+		LL_DEBUGS("AppInit") << "Initialization complete" << LL_ENDL;
+
+		gRenderStartTime.reset();
+		gForegroundTime.reset();
+
+		// HACK: Inform simulator of window size.
+		// Do this here so it's less likely to race with RegisterNewAgent.
+		// TODO: Put this into RegisterNewAgent
+		// JC - 7/20/2002
+		gViewerWindow->sendShapeToSim();
+
+		
+		// Ignore stipend information for now.  Money history is on the web site.
+		// if needed, show the L$ history window
+		//if (stipend_since_login && !gNoRender)
+		//{
+		//}
+
+		// The reason we show the alert is because we want to
+		// reduce confusion for when you log in and your provided
+		// location is not your expected location. So, if this is
+		// your first login, then you do not have an expectation,
+		// thus, do not show this alert.
+		if (!gAgent.isFirstLogin())
+		{
+			llinfos << "gAgentStartLocation : " << gAgentStartLocation << llendl;
+			LLSLURL start_slurl = LLStartUp::getStartSLURL();
+			
+			if (((start_slurl.getType() == LLSLURL::LOCATION) && (gAgentStartLocation == "url")) ||
+				((start_slurl.getType() == LLSLURL::LAST_LOCATION) && (gAgentStartLocation == "last")) ||
+				((start_slurl.getType() == LLSLURL::HOME_LOCATION) && (gAgentStartLocation == "home")))
+			{
+				// Start location is OK
+				// Disabled code to restore camera location and focus if logging in to default location
+				static bool samename = false;
+				if (samename)
+				{
+					// restore old camera pos
+					gAgentCamera.setFocusOnAvatar(FALSE, FALSE);
+					gAgentCamera.setCameraPosAndFocusGlobal(gSavedSettings.getVector3d("CameraPosOnLogout"), gSavedSettings.getVector3d("FocusPosOnLogout"), LLUUID::null);
+					BOOL limit_hit = FALSE;
+					gAgentCamera.calcCameraPositionTargetGlobal(&limit_hit);
+					if (limit_hit)
+					{
+						gAgentCamera.setFocusOnAvatar(TRUE, FALSE);
+					}
+					gAgentCamera.stopCameraAnimation();
+				}
+			}
+			else
+			{
+				std::string msg;
+				switch(start_slurl.getType())
+				{
+					case LLSLURL::LOCATION:
+					{
+						
+						msg = "AvatarMovedDesired";
+						break;
+					}
+					case LLSLURL::HOME_LOCATION:
+					{
+						msg = "AvatarMovedHome";
+						break;
+					}
+					default:
+					{
+						msg = "AvatarMovedLast";
+					}
+				}
+				LLNotificationsUtil::add(msg);
+			}
+		}
+
+        //DEV-17797.  get null folder.  Any items found here moved to Lost and Found
+        LLInventoryModelBackgroundFetch::instance().findLostItems();
+
+		LLStartUp::setStartupState( STATE_PRECACHE );
+		timeout.reset();
+		return FALSE;
+	}
+
+	if (STATE_PRECACHE == LLStartUp::getStartupState())
+	{
+		F32 timeout_frac = timeout.getElapsedTimeF32()/PRECACHING_DELAY;
+
+		// We now have an inventory skeleton, so if this is a user's first
+		// login, we can start setting up their clothing and avatar 
+		// appearance.  This helps to avoid the generic "Ruth" avatar in
+		// the orientation island tutorial experience. JC
+		if (gAgent.isFirstLogin()
+			&& !sInitialOutfit.empty()    // registration set up an outfit
+			&& !sInitialOutfitGender.empty() // and a gender
+			&& isAgentAvatarValid()	  // can't wear clothes without object
+			&& !gAgent.isGenderChosen() ) // nothing already loading
+		{
+			// Start loading the wearables, textures, gestures
+			LLStartUp::loadInitialOutfit( sInitialOutfit, sInitialOutfitGender );
+		}
+
+		// wait precache-delay and for agent's avatar or a lot longer.
+		if(((timeout_frac > 1.f) && isAgentAvatarValid())
+		   || (timeout_frac > 3.f))
+		{
+			LLStartUp::setStartupState( STATE_WEARABLES_WAIT );
+		}
+		else
+		{
+			update_texture_fetch();
+			set_startup_status(0.60f + 0.30f * timeout_frac,
+				LLTrans::getString("LoginPrecaching"),
+					gAgent.mMOTD);
+			display_startup();
+			if (!LLViewerShaderMgr::sInitialized)
+			{
+				LLViewerShaderMgr::sInitialized = TRUE;
+				LLViewerShaderMgr::instance()->setShaders();
+			}
+		}
+		
+		return TRUE;
+	}
+
+	if (STATE_WEARABLES_WAIT == LLStartUp::getStartupState())
+	{
+		static LLFrameTimer wearables_timer;
+
+		const F32 wearables_time = wearables_timer.getElapsedTimeF32();
+		const F32 MAX_WEARABLES_TIME = 10.f;
+
+		if (!gAgent.isGenderChosen())
+		{
+			// No point in waiting for clothing, we don't even
+			// know what gender we are.  Pop a dialog to ask and
+			// proceed to draw the world. JC
+			//
+			// *NOTE: We might hit this case even if we have an
+			// initial outfit, but if the load hasn't started
+			// already then something is wrong so fall back
+			// to generic outfits. JC
+			LLNotificationsUtil::add("WelcomeChooseSex", LLSD(), LLSD(),
+				callback_choose_gender);
+			LLStartUp::setStartupState( STATE_CLEANUP );
+			return TRUE;
+		}
+		
+		if (wearables_time > MAX_WEARABLES_TIME)
+		{
+			LLNotificationsUtil::add("ClothingLoading");
+			LLViewerStats::getInstance()->incStat(LLViewerStats::ST_WEARABLES_TOO_LONG);
+			LLStartUp::setStartupState( STATE_CLEANUP );
+			return TRUE;
+		}
+
+		if (gAgent.isFirstLogin())
+		{
+			// wait for avatar to be completely loaded
+			if (isAgentAvatarValid()
+				&& gAgentAvatarp->isFullyLoaded())
+			{
+				//llinfos << "avatar fully loaded" << llendl;
+				LLStartUp::setStartupState( STATE_CLEANUP );
+				return TRUE;
+			}
+		}
+		else
+		{
+			// OK to just get the wearables
+			if ( gAgentWearables.areWearablesLoaded() )
+			{
+				// We have our clothing, proceed.
+				//llinfos << "wearables loaded" << llendl;
+				LLStartUp::setStartupState( STATE_CLEANUP );
+				return TRUE;
+			}
+		}
+
+		update_texture_fetch();
+		set_startup_status(0.9f + 0.1f * wearables_time / MAX_WEARABLES_TIME,
+						 LLTrans::getString("LoginDownloadingClothing").c_str(),
+						 gAgent.mMOTD.c_str());
+		return TRUE;
+	}
+
+	if (STATE_CLEANUP == LLStartUp::getStartupState())
+	{
+		set_startup_status(1.0, "", "");
+
+		// Let the map know about the inventory.
+		LLFloaterWorldMap* floater_world_map = LLFloaterWorldMap::getInstance();
+		if(floater_world_map)
+		{
+			floater_world_map->observeInventory(&gInventory);
+			floater_world_map->observeFriends();
+		}
+		gViewerWindow->showCursor();
+		gViewerWindow->getWindow()->resetBusyCount();
+		gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW);
+		LL_DEBUGS("AppInit") << "Done releasing bitmap" << LL_ENDL;
+		gViewerWindow->setShowProgress(FALSE);
+		gViewerWindow->setProgressCancelButtonVisible(FALSE);
+
+		// We're not away from keyboard, even though login might have taken
+		// a while. JC
+		gAgent.clearAFK();
+
+		// Have the agent start watching the friends list so we can update proxies
+		gAgent.observeFriends();
+		if (gSavedSettings.getBOOL("LoginAsGod"))
+		{
+			gAgent.requestEnterGodMode();
+		}
+		
+		// Start automatic replay if the flag is set.
+		if (gSavedSettings.getBOOL("StatsAutoRun") || LLAgentPilot::sReplaySession)
+		{
+			LLUUID id;
+			LL_DEBUGS("AppInit") << "Starting automatic playback" << LL_ENDL;
+			gAgentPilot.startPlayback();
+		}
+
+		show_debug_menus(); // Debug menu visiblity and First Use trigger
+		
+		// If we've got a startup URL, dispatch it
+		LLStartUp::dispatchURL();
+
+		// Retrieve information about the land data
+		// (just accessing this the first time will fetch it,
+		// then the data is cached for the viewer's lifetime)
+		LLProductInfoRequestManager::instance();
+		
+		// *FIX:Mani - What do I do here?
+		// Need we really clear the Auth response data?
+		// Clean up the userauth stuff.
+		// LLUserAuth::getInstance()->reset();
+
+		LLStartUp::setStartupState( STATE_STARTED );
+
+		// Unmute audio if desired and setup volumes.
+		// Unmute audio if desired and setup volumes.
+		// This is a not-uncommon crash site, so surround it with
+		// llinfos output to aid diagnosis.
+		LL_INFOS("AppInit") << "Doing first audio_update_volume..." << LL_ENDL;
+		audio_update_volume();
+		LL_INFOS("AppInit") << "Done first audio_update_volume." << LL_ENDL;
+
+		// reset keyboard focus to sane state of pointing at world
+		gFocusMgr.setKeyboardFocus(NULL);
+
+#if 0 // sjb: enable for auto-enabling timer display 
+		gDebugView->mFastTimerView->setVisible(TRUE);
+#endif
+
+		LLAppViewer::instance()->handleLoginComplete();
+
+		// reset timers now that we are running "logged in" logic
+		LLFastTimer::reset();
+
+		LLAgentPicksInfo::getInstance()->requestNumberOfPicks();
+
+		LLIMFloater::initIMFloater();
+
+		return TRUE;
+	}
+
+	LL_WARNS("AppInit") << "Reached end of idle_startup for state " << LLStartUp::getStartupState() << LL_ENDL;
+	return TRUE;
+}
+
+//
+// local function definition
+//
+
+void login_show()
+{
+	LL_INFOS("AppInit") << "Initializing Login Screen" << LL_ENDL;
+
+#ifdef LL_RELEASE_FOR_DOWNLOAD
+	BOOL bUseDebugLogin = gSavedSettings.getBOOL("UseDebugLogin");
+#else
+	BOOL bUseDebugLogin = TRUE;
+#endif
+
+	LLPanelLogin::show(	gViewerWindow->getWindowRectScaled(),
+						bUseDebugLogin || gSavedSettings.getBOOL("SecondLifeEnterprise"),
+						login_callback, NULL );
+
+}
+
+// Callback for when login screen is closed.  Option 0 = connect, option 1 = quit.
+void login_callback(S32 option, void *userdata)
+{
+	const S32 CONNECT_OPTION = 0;
+	const S32 QUIT_OPTION = 1;
+
+	if (CONNECT_OPTION == option)
+	{
+		LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
+		return;
+	}
+	else if (QUIT_OPTION == option) // *TODO: THIS CODE SEEMS TO BE UNREACHABLE!!!!! login_callback is never called with option equal to QUIT_OPTION
+	{
+		if (!gSavedSettings.getBOOL("RememberPassword"))
+		{
+			// turn off the setting and write out to disk
+			gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile") , TRUE );
+			LLUIColorTable::instance().saveUserSettings();
+		}
+
+		// Next iteration through main loop should shut down the app cleanly.
+		LLAppViewer::instance()->userQuit();
+		
+		if (LLAppViewer::instance()->quitRequested())
+		{
+			LLPanelLogin::closePanel();
+		}
+		return;
+	}
+	else
+	{
+		LL_WARNS("AppInit") << "Unknown login button clicked" << LL_ENDL;
+	}
+}
+
+void show_first_run_dialog()
+{
+	LLNotificationsUtil::add("FirstRun", LLSD(), LLSD(), first_run_dialog_callback);
+}
+
+bool first_run_dialog_callback(const LLSD& notification, const LLSD& response)
+{
+	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+	if (0 == option)
+	{
+		LL_DEBUGS("AppInit") << "First run dialog cancelling" << LL_ENDL;
+		LLWeb::loadURLExternal(LLTrans::getString("create_account_url") );
+	}
+
+	LLPanelLogin::giveFocus();
+	return false;
+}
+
+
+
+void set_startup_status(const F32 frac, const std::string& string, const std::string& msg)
+{
+	gViewerWindow->setProgressPercent(frac*100);
+	gViewerWindow->setProgressString(string);
+
+	gViewerWindow->setProgressMessage(msg);
+}
+
+bool login_alert_status(const LLSD& notification, const LLSD& response)
+{
+	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+    // Buttons
+    switch( option )
+    {
+        case 0:     // OK
+            break;
+      //  case 1:     // Help
+      //      LLWeb::loadURL(LLNotifications::instance().getGlobalString("SUPPORT_URL") );
+      //      break;
+        case 2:     // Teleport
+            // Restart the login process, starting at our home locaton
+	  LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
+            LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
+            break;
+        default:
+            LL_WARNS("AppInit") << "Missing case in login_alert_status switch" << LL_ENDL;
+    }
+
+	LLPanelLogin::giveFocus();
+	return false;
+}
+
+
+void use_circuit_callback(void**, S32 result)
+{
+	// bail if we're quitting.
+	if(LLApp::isExiting()) return;
+	if( !gUseCircuitCallbackCalled )
+	{
+		gUseCircuitCallbackCalled = true;
+		if (result)
+		{
+			// Make sure user knows something bad happened. JC
+			LL_WARNS("AppInit") << "Backing up to login screen!" << LL_ENDL;
+			LLNotificationsUtil::add("LoginPacketNeverReceived", LLSD(), LLSD(), login_alert_status);
+			reset_login();
+		}
+		else
+		{
+			gGotUseCircuitCodeAck = true;
+		}
+	}
+}
+
+void register_viewer_callbacks(LLMessageSystem* msg)
+{
+	msg->setHandlerFuncFast(_PREHASH_LayerData,				process_layer_data );
+	msg->setHandlerFuncFast(_PREHASH_ImageData,				LLViewerTextureList::receiveImageHeader );
+	msg->setHandlerFuncFast(_PREHASH_ImagePacket,				LLViewerTextureList::receiveImagePacket );
+	msg->setHandlerFuncFast(_PREHASH_ObjectUpdate,				process_object_update );
+	msg->setHandlerFunc("ObjectUpdateCompressed",				process_compressed_object_update );
+	msg->setHandlerFunc("ObjectUpdateCached",					process_cached_object_update );
+	msg->setHandlerFuncFast(_PREHASH_ImprovedTerseObjectUpdate, process_terse_object_update_improved );
+	msg->setHandlerFunc("SimStats",				process_sim_stats);
+	msg->setHandlerFuncFast(_PREHASH_HealthMessage,			process_health_message );
+	msg->setHandlerFuncFast(_PREHASH_EconomyData,				process_economy_data);
+	msg->setHandlerFunc("RegionInfo", LLViewerRegion::processRegionInfo);
+
+	msg->setHandlerFuncFast(_PREHASH_ChatFromSimulator,		process_chat_from_simulator);
+	msg->setHandlerFuncFast(_PREHASH_KillObject,				process_kill_object,	NULL);
+	msg->setHandlerFuncFast(_PREHASH_SimulatorViewerTimeMessage,	process_time_synch,		NULL);
+	msg->setHandlerFuncFast(_PREHASH_EnableSimulator,			process_enable_simulator);
+	msg->setHandlerFuncFast(_PREHASH_DisableSimulator,			process_disable_simulator);
+	msg->setHandlerFuncFast(_PREHASH_KickUser,					process_kick_user,		NULL);
+
+	msg->setHandlerFunc("CrossedRegion", process_crossed_region);
+	msg->setHandlerFuncFast(_PREHASH_TeleportFinish, process_teleport_finish);
+
+	msg->setHandlerFuncFast(_PREHASH_AlertMessage,             process_alert_message);
+	msg->setHandlerFunc("AgentAlertMessage", process_agent_alert_message);
+	msg->setHandlerFuncFast(_PREHASH_MeanCollisionAlert,             process_mean_collision_alert_message,  NULL);
+	msg->setHandlerFunc("ViewerFrozenMessage",             process_frozen_message);
+
+	msg->setHandlerFuncFast(_PREHASH_NameValuePair,			process_name_value);
+	msg->setHandlerFuncFast(_PREHASH_RemoveNameValuePair,	process_remove_name_value);
+	msg->setHandlerFuncFast(_PREHASH_AvatarAnimation,		process_avatar_animation);
+	msg->setHandlerFuncFast(_PREHASH_AvatarAppearance,		process_avatar_appearance);
+	msg->setHandlerFunc("AgentCachedTextureResponse",	LLAgent::processAgentCachedTextureResponse);
+	msg->setHandlerFunc("RebakeAvatarTextures", LLVOAvatarSelf::processRebakeAvatarTextures);
+	msg->setHandlerFuncFast(_PREHASH_CameraConstraint,		process_camera_constraint);
+	msg->setHandlerFuncFast(_PREHASH_AvatarSitResponse,		process_avatar_sit_response);
+	msg->setHandlerFunc("SetFollowCamProperties",			process_set_follow_cam_properties);
+	msg->setHandlerFunc("ClearFollowCamProperties",			process_clear_follow_cam_properties);
+
+	msg->setHandlerFuncFast(_PREHASH_ImprovedInstantMessage,	process_improved_im);
+	msg->setHandlerFuncFast(_PREHASH_ScriptQuestion,			process_script_question);
+	msg->setHandlerFuncFast(_PREHASH_ObjectProperties,			LLSelectMgr::processObjectProperties, NULL);
+	msg->setHandlerFuncFast(_PREHASH_ObjectPropertiesFamily,	LLSelectMgr::processObjectPropertiesFamily, NULL);
+	msg->setHandlerFunc("ForceObjectSelect", LLSelectMgr::processForceObjectSelect);
+
+	msg->setHandlerFuncFast(_PREHASH_MoneyBalanceReply,		process_money_balance_reply,	NULL);
+	msg->setHandlerFuncFast(_PREHASH_CoarseLocationUpdate,		LLWorld::processCoarseUpdate, NULL);
+	msg->setHandlerFuncFast(_PREHASH_ReplyTaskInventory, 		LLViewerObject::processTaskInv,	NULL);
+	msg->setHandlerFuncFast(_PREHASH_DerezContainer,			process_derez_container, NULL);
+	msg->setHandlerFuncFast(_PREHASH_ScriptRunningReply,
+						&LLLiveLSLEditor::processScriptRunningReply);
+
+	msg->setHandlerFuncFast(_PREHASH_DeRezAck, process_derez_ack);
+
+	msg->setHandlerFunc("LogoutReply", process_logout_reply);
+
+	//msg->setHandlerFuncFast(_PREHASH_AddModifyAbility,
+	//					&LLAgent::processAddModifyAbility);
+	//msg->setHandlerFuncFast(_PREHASH_RemoveModifyAbility,
+	//					&LLAgent::processRemoveModifyAbility);
+	msg->setHandlerFuncFast(_PREHASH_AgentDataUpdate,
+						&LLAgent::processAgentDataUpdate);
+	msg->setHandlerFuncFast(_PREHASH_AgentGroupDataUpdate,
+						&LLAgent::processAgentGroupDataUpdate);
+	msg->setHandlerFunc("AgentDropGroup",
+						&LLAgent::processAgentDropGroup);
+	// land ownership messages
+	msg->setHandlerFuncFast(_PREHASH_ParcelOverlay,
+						LLViewerParcelMgr::processParcelOverlay);
+	msg->setHandlerFuncFast(_PREHASH_ParcelProperties,
+						LLViewerParcelMgr::processParcelProperties);
+	msg->setHandlerFunc("ParcelAccessListReply",
+		LLViewerParcelMgr::processParcelAccessListReply);
+	msg->setHandlerFunc("ParcelDwellReply",
+		LLViewerParcelMgr::processParcelDwellReply);
+
+	msg->setHandlerFunc("AvatarPropertiesReply",
+						&LLAvatarPropertiesProcessor::processAvatarPropertiesReply);
+	msg->setHandlerFunc("AvatarInterestsReply",
+						&LLAvatarPropertiesProcessor::processAvatarInterestsReply);
+	msg->setHandlerFunc("AvatarGroupsReply",
+						&LLAvatarPropertiesProcessor::processAvatarGroupsReply);
+	// ratings deprecated
+	//msg->setHandlerFuncFast(_PREHASH_AvatarStatisticsReply,
+	//					LLPanelAvatar::processAvatarStatisticsReply);
+	msg->setHandlerFunc("AvatarNotesReply",
+						&LLAvatarPropertiesProcessor::processAvatarNotesReply);
+	msg->setHandlerFunc("AvatarPicksReply",
+						&LLAvatarPropertiesProcessor::processAvatarPicksReply);
+ 	msg->setHandlerFunc("AvatarClassifiedReply",
+ 						&LLAvatarPropertiesProcessor::processAvatarClassifiedsReply);
+
+	msg->setHandlerFuncFast(_PREHASH_CreateGroupReply,
+						LLGroupMgr::processCreateGroupReply);
+	msg->setHandlerFuncFast(_PREHASH_JoinGroupReply,
+						LLGroupMgr::processJoinGroupReply);
+	msg->setHandlerFuncFast(_PREHASH_EjectGroupMemberReply,
+						LLGroupMgr::processEjectGroupMemberReply);
+	msg->setHandlerFuncFast(_PREHASH_LeaveGroupReply,
+						LLGroupMgr::processLeaveGroupReply);
+	msg->setHandlerFuncFast(_PREHASH_GroupProfileReply,
+						LLGroupMgr::processGroupPropertiesReply);
+
+	// ratings deprecated
+	// msg->setHandlerFuncFast(_PREHASH_ReputationIndividualReply,
+	//					LLFloaterRate::processReputationIndividualReply);
+
+	msg->setHandlerFuncFast(_PREHASH_AgentWearablesUpdate,
+						LLAgentWearables::processAgentInitialWearablesUpdate );
+
+	msg->setHandlerFunc("ScriptControlChange",
+						LLAgent::processScriptControlChange );
+
+	msg->setHandlerFuncFast(_PREHASH_ViewerEffect, LLHUDManager::processViewerEffect);
+
+	msg->setHandlerFuncFast(_PREHASH_GrantGodlikePowers, process_grant_godlike_powers);
+
+	msg->setHandlerFuncFast(_PREHASH_GroupAccountSummaryReply,
+							LLPanelGroupLandMoney::processGroupAccountSummaryReply);
+	msg->setHandlerFuncFast(_PREHASH_GroupAccountDetailsReply,
+							LLPanelGroupLandMoney::processGroupAccountDetailsReply);
+	msg->setHandlerFuncFast(_PREHASH_GroupAccountTransactionsReply,
+							LLPanelGroupLandMoney::processGroupAccountTransactionsReply);
+
+	msg->setHandlerFuncFast(_PREHASH_UserInfoReply,
+		process_user_info_reply);
+
+	msg->setHandlerFunc("RegionHandshake", process_region_handshake, NULL);
+
+	msg->setHandlerFunc("TeleportStart", process_teleport_start );
+	msg->setHandlerFunc("TeleportProgress", process_teleport_progress);
+	msg->setHandlerFunc("TeleportFailed", process_teleport_failed, NULL);
+	msg->setHandlerFunc("TeleportLocal", process_teleport_local, NULL);
+
+	msg->setHandlerFunc("ImageNotInDatabase", LLViewerTextureList::processImageNotInDatabase, NULL);
+
+	msg->setHandlerFuncFast(_PREHASH_GroupMembersReply,
+						LLGroupMgr::processGroupMembersReply);
+	msg->setHandlerFunc("GroupRoleDataReply",
+						LLGroupMgr::processGroupRoleDataReply);
+	msg->setHandlerFunc("GroupRoleMembersReply",
+						LLGroupMgr::processGroupRoleMembersReply);
+	msg->setHandlerFunc("GroupTitlesReply",
+						LLGroupMgr::processGroupTitlesReply);
+	// Special handler as this message is sometimes used for group land.
+	msg->setHandlerFunc("PlacesReply", process_places_reply);
+	msg->setHandlerFunc("GroupNoticesListReply", LLPanelGroupNotices::processGroupNoticesListReply);
+
+	msg->setHandlerFunc("AvatarPickerReply", LLFloaterAvatarPicker::processAvatarPickerReply);
+
+	msg->setHandlerFunc("MapBlockReply", LLWorldMapMessage::processMapBlockReply);
+	msg->setHandlerFunc("MapItemReply", LLWorldMapMessage::processMapItemReply);
+	msg->setHandlerFunc("EventInfoReply", LLEventNotifier::processEventInfoReply);
+	
+	msg->setHandlerFunc("PickInfoReply", &LLAvatarPropertiesProcessor::processPickInfoReply);
+//	msg->setHandlerFunc("ClassifiedInfoReply", LLPanelClassified::processClassifiedInfoReply);
+	msg->setHandlerFunc("ClassifiedInfoReply", LLAvatarPropertiesProcessor::processClassifiedInfoReply);
+	msg->setHandlerFunc("ParcelInfoReply", LLRemoteParcelInfoProcessor::processParcelInfoReply);
+	msg->setHandlerFunc("ScriptDialog", process_script_dialog);
+	msg->setHandlerFunc("LoadURL", process_load_url);
+	msg->setHandlerFunc("ScriptTeleportRequest", process_script_teleport_request);
+	msg->setHandlerFunc("EstateCovenantReply", process_covenant_reply);
+
+	// calling cards
+	msg->setHandlerFunc("OfferCallingCard", process_offer_callingcard);
+	msg->setHandlerFunc("AcceptCallingCard", process_accept_callingcard);
+	msg->setHandlerFunc("DeclineCallingCard", process_decline_callingcard);
+
+	msg->setHandlerFunc("ParcelObjectOwnersReply", LLPanelLandObjects::processParcelObjectOwnersReply);
+
+	msg->setHandlerFunc("InitiateDownload", process_initiate_download);
+	msg->setHandlerFunc("LandStatReply", LLFloaterTopObjects::handle_land_reply);
+	msg->setHandlerFunc("GenericMessage", process_generic_message);
+
+	msg->setHandlerFuncFast(_PREHASH_FeatureDisabled, process_feature_disabled_message);
+}
+
+void asset_callback_nothing(LLVFS*, const LLUUID&, LLAssetType::EType, void*, S32)
+{
+	// nothing
+}
+
+// *HACK: Must match name in Library or agent inventory
+const std::string ROOT_GESTURES_FOLDER = "Gestures";
+const std::string COMMON_GESTURES_FOLDER = "Common Gestures";
+const std::string MALE_GESTURES_FOLDER = "Male Gestures";
+const std::string FEMALE_GESTURES_FOLDER = "Female Gestures";
+const std::string SPEECH_GESTURES_FOLDER = "Speech Gestures";
+const std::string OTHER_GESTURES_FOLDER = "Other Gestures";
+const S32 OPT_CLOSED_WINDOW = -1;
+const S32 OPT_MALE = 0;
+const S32 OPT_FEMALE = 1;
+const S32 OPT_TRUST_CERT = 0;
+const S32 OPT_CANCEL_TRUST = 1;
+	
+bool callback_choose_gender(const LLSD& notification, const LLSD& response)
+{
+	
+    // These defaults are returned from the server on login.  They are set in login.xml.                  
+    // If no default is returned from the server, they are retrieved from settings.xml.                   
+	
+	S32 option = LLNotification::getSelectedOption(notification, response);
+	switch(option)
+	{
+		case OPT_MALE:
+			LLStartUp::loadInitialOutfit( gSavedSettings.getString("DefaultMaleAvatar"), "male" );
+			break;
+			
+        case OPT_FEMALE:
+        case OPT_CLOSED_WINDOW:
+        default:
+			LLStartUp::loadInitialOutfit( gSavedSettings.getString("DefaultFemaleAvatar"), "female" );
+			break;
+	}
+	return false;
+}
+
+void LLStartUp::copyLibraryGestures(const std::string& same_gender_gestures)
+{
+	llinfos << "Copying library gestures" << llendl;
+
+	// Copy gestures
+	LLUUID lib_gesture_cat_id =
+		gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE,false,true);
+	if (lib_gesture_cat_id.isNull())
+	{
+		llwarns << "Unable to copy gestures, source category not found" << llendl;
+	}
+	LLUUID dst_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE);
+
+	std::vector<std::string> gesture_folders_to_copy;
+	gesture_folders_to_copy.push_back(MALE_GESTURES_FOLDER);
+	gesture_folders_to_copy.push_back(FEMALE_GESTURES_FOLDER);
+	gesture_folders_to_copy.push_back(COMMON_GESTURES_FOLDER);
+	gesture_folders_to_copy.push_back(SPEECH_GESTURES_FOLDER);
+	gesture_folders_to_copy.push_back(OTHER_GESTURES_FOLDER);
+
+	for(std::vector<std::string>::iterator it = gesture_folders_to_copy.begin();
+		it != gesture_folders_to_copy.end();
+		++it)
+	{
+		std::string& folder_name = *it;
+
+		LLPointer<LLInventoryCallback> cb(NULL);
+
+		if (folder_name == same_gender_gestures ||
+			folder_name == COMMON_GESTURES_FOLDER ||
+			folder_name == OTHER_GESTURES_FOLDER)
+		{
+			cb = new ActivateGestureCallback;
+		}
+
+
+		LLUUID cat_id = findDescendentCategoryIDByName(lib_gesture_cat_id,folder_name);
+		if (cat_id.isNull())
+		{
+			llwarns << "failed to find gesture folder for " << folder_name << llendl;
+		}
+		else
+		{
+			llinfos << "initiating fetch and copy for " << folder_name << " cat_id " << cat_id << llendl;
+			LLAppearanceMgr* app_mgr = LLAppearanceMgr::getInstance();
+			callAfterCategoryFetch(cat_id,
+								   boost::bind(&LLAppearanceMgr::shallowCopyCategory,
+											   app_mgr,
+											   cat_id,
+											   dst_id,
+											   cb));
+		}
+	}
+}
+
+void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
+								   const std::string& gender_name )
+{
+	llinfos << "starting" << llendl;
+
+	// Not going through the processAgentInitialWearables path, so need to set this here.
+	LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true);
+	// Initiate creation of COF, since we're also bypassing that.
+	gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
+	
+	S32 gender = 0;
+	std::string same_gender_gestures;
+	if (gender_name == "male")
+	{
+		gender = OPT_MALE;
+		same_gender_gestures = MALE_GESTURES_FOLDER;
+	}
+	else
+	{
+		gender = OPT_FEMALE;
+		same_gender_gestures = FEMALE_GESTURES_FOLDER;
+	}
+
+	// try to find the outfit - if not there, create some default
+	// wearables.
+	LLUUID cat_id = findDescendentCategoryIDByName(
+		gInventory.getLibraryRootFolderID(),
+		outfit_folder_name);
+	if (cat_id.isNull())
+	{
+		gAgentWearables.createStandardWearables(gender);
+	}
+	else
+	{
+		sWearablesLoadedCon = gAgentWearables.addLoadedCallback(LLStartUp::saveInitialOutfit);
+
+		bool do_copy = true;
+		bool do_append = false;
+		LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id);
+		LLAppearanceMgr::instance().wearInventoryCategory(cat, do_copy, do_append);
+	}
+
+	// Copy gestures
+	copyLibraryGestures(same_gender_gestures);
+	
+	// This is really misnamed -- it means we have started loading
+	// an outfit/shape that will give the avatar a gender eventually. JC
+	gAgent.setGenderChosen(TRUE);
+
+}
+
+//static
+void LLStartUp::saveInitialOutfit()
+{
+	if (sInitialOutfit.empty()) return;
+	
+	if (sWearablesLoadedCon.connected())
+	{
+		sWearablesLoadedCon.disconnect();
+	}
+	LLAppearanceMgr::getInstance()->makeNewOutfitLinks(sInitialOutfit,false);
+}
+
+std::string& LLStartUp::getInitialOutfitName()
+{
+	return sInitialOutfit;
+}
+
+// Loads a bitmap to display during load
+void init_start_screen(S32 location_id)
+{
+	if (gStartTexture.notNull())
+	{
+		gStartTexture = NULL;
+		LL_INFOS("AppInit") << "re-initializing start screen" << LL_ENDL;
+	}
+
+	LL_DEBUGS("AppInit") << "Loading startup bitmap..." << LL_ENDL;
+
+	std::string temp_str = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter();
+
+	if ((S32)START_LOCATION_ID_LAST == location_id)
+	{
+		temp_str += SCREEN_LAST_FILENAME;
+	}
+	else
+	{
+		temp_str += SCREEN_HOME_FILENAME;
+	}
+
+	LLPointer<LLImageBMP> start_image_bmp = new LLImageBMP;
+	
+	// Turn off start screen to get around the occasional readback 
+	// driver bug
+	if(!gSavedSettings.getBOOL("UseStartScreen"))
+	{
+		LL_INFOS("AppInit")  << "Bitmap load disabled" << LL_ENDL;
+		return;
+	}
+	else if(!start_image_bmp->load(temp_str) )
+	{
+		LL_WARNS("AppInit") << "Bitmap load failed" << LL_ENDL;
+		return;
+	}
+
+	gStartImageWidth = start_image_bmp->getWidth();
+	gStartImageHeight = start_image_bmp->getHeight();
+
+	LLPointer<LLImageRaw> raw = new LLImageRaw;
+	if (!start_image_bmp->decode(raw, 0.0f))
+	{
+		LL_WARNS("AppInit") << "Bitmap decode failed" << LL_ENDL;
+		gStartTexture = NULL;
+		return;
+	}
+
+	raw->expandToPowerOfTwo();
+	gStartTexture = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE) ;
+}
+
+
+// frees the bitmap
+void release_start_screen()
+{
+	LL_DEBUGS("AppInit") << "Releasing bitmap..." << LL_ENDL;
+	gStartTexture = NULL;
+}
+
+
+// static
+std::string LLStartUp::startupStateToString(EStartupState state)
+{
+#define RTNENUM(E) case E: return #E
+	switch(state){
+		RTNENUM( STATE_FIRST );
+		RTNENUM( STATE_BROWSER_INIT );
+		RTNENUM( STATE_LOGIN_SHOW );
+		RTNENUM( STATE_LOGIN_WAIT );
+		RTNENUM( STATE_LOGIN_CLEANUP );
+		RTNENUM( STATE_LOGIN_AUTH_INIT );
+		RTNENUM( STATE_LOGIN_CURL_UNSTUCK );
+		RTNENUM( STATE_LOGIN_PROCESS_RESPONSE );
+		RTNENUM( STATE_WORLD_INIT );
+		RTNENUM( STATE_MULTIMEDIA_INIT );
+		RTNENUM( STATE_FONT_INIT );
+		RTNENUM( STATE_SEED_GRANTED_WAIT );
+		RTNENUM( STATE_SEED_CAP_GRANTED );
+		RTNENUM( STATE_WORLD_WAIT );
+		RTNENUM( STATE_AGENT_SEND );
+		RTNENUM( STATE_AGENT_WAIT );
+		RTNENUM( STATE_INVENTORY_SEND );
+		RTNENUM( STATE_MISC );
+		RTNENUM( STATE_PRECACHE );
+		RTNENUM( STATE_WEARABLES_WAIT );
+		RTNENUM( STATE_CLEANUP );
+		RTNENUM( STATE_STARTED );
+	default:
+		return llformat("(state #%d)", state);
+	}
+#undef RTNENUM
+}
+
+// static
+void LLStartUp::setStartupState( EStartupState state )
+{
+	LL_INFOS("AppInit") << "Startup state changing from " <<  
+		getStartupStateString() << " to " <<  
+		startupStateToString(state) << LL_ENDL;
+	gStartupState = state;
+	postStartupState();
+}
+
+void LLStartUp::postStartupState()
+{
+	LLSD stateInfo;
+	stateInfo["str"] = getStartupStateString();
+	stateInfo["enum"] = gStartupState;
+	sStateWatcher->post(stateInfo);
+}
+
+
+void reset_login()
+{
+	gAgentWearables.cleanup();
+	gAgentCamera.cleanup();
+	gAgent.cleanup();
+	LLWorld::getInstance()->destroyClass();
+
+	LLStartUp::setStartupState( STATE_LOGIN_SHOW );
+
+	if ( gViewerWindow )
+	{	// Hide menus and normal buttons
+		gViewerWindow->setNormalControlsVisible( FALSE );
+		gLoginMenuBarView->setVisible( TRUE );
+		gLoginMenuBarView->setEnabled( TRUE );
+	}
+
+	// Hide any other stuff
+	LLFloaterReg::hideVisibleInstances();
+}
+
+//---------------------------------------------------------------------------
+
+// Initialize all plug-ins except the web browser (which was initialized
+// early, before the login screen). JC
+void LLStartUp::multimediaInit()
+{
+	LL_DEBUGS("AppInit") << "Initializing Multimedia...." << LL_ENDL;
+	std::string msg = LLTrans::getString("LoginInitializingMultimedia");
+	set_startup_status(0.42f, msg.c_str(), gAgent.mMOTD.c_str());
+	display_startup();
+
+	// LLViewerMedia::initClass();
+	LLViewerParcelMedia::initClass();
+}
+
+void LLStartUp::fontInit()
+{
+	LL_DEBUGS("AppInit") << "Initializing fonts...." << LL_ENDL;
+	std::string msg = LLTrans::getString("LoginInitializingFonts");
+	set_startup_status(0.45f, msg.c_str(), gAgent.mMOTD.c_str());
+	display_startup();
+
+	LLFontGL::loadDefaultFonts();
+}
+
+void LLStartUp::initNameCache()
+{
+	// Can be called multiple times
+	if ( gCacheName ) return;
+
+	gCacheName = new LLCacheName(gMessageSystem);
+	gCacheName->addObserver(&callback_cache_name);
+	gCacheName->localizeCacheName("waiting", LLTrans::getString("AvatarNameWaiting"));
+	gCacheName->localizeCacheName("nobody", LLTrans::getString("AvatarNameNobody"));
+	gCacheName->localizeCacheName("none", LLTrans::getString("GroupNameNone"));
+	// Load stored cache if possible
+	LLAppViewer::instance()->loadNameCache();
+
+	// Start cache in not-running state until we figure out if we have
+	// capabilities for display name lookup
+	LLAvatarNameCache::initClass(false);
+	LLAvatarNameCache::setUseDisplayNames(gSavedSettings.getBOOL("UseDisplayNames"));
+}
+
+void LLStartUp::cleanupNameCache()
+{
+	LLAvatarNameCache::cleanupClass();
+
+	delete gCacheName;
+	gCacheName = NULL;
+}
+
+bool LLStartUp::dispatchURL()
+{
+	// ok, if we've gotten this far and have a startup URL
+        if (!getStartSLURL().isValid())
+	{
+	  return false;
+	}
+        if(getStartSLURL().getType() != LLSLURL::APP)
+	  {
+	    
+		// If we started with a location, but we're already
+		// at that location, don't pop dialogs open.
+		LLVector3 pos = gAgent.getPositionAgent();
+		LLVector3 slurlpos = getStartSLURL().getPosition();
+		F32 dx = pos.mV[VX] - slurlpos.mV[VX];
+		F32 dy = pos.mV[VY] - slurlpos.mV[VY];
+		const F32 SLOP = 2.f;	// meters
+
+		if( getStartSLURL().getRegion() != gAgent.getRegion()->getName()
+			|| (dx*dx > SLOP*SLOP)
+			|| (dy*dy > SLOP*SLOP) )
+		{
+			LLURLDispatcher::dispatch(getStartSLURL().getSLURLString(), 
+						  NULL, false);
+		}
+		return true;
+	}
+	return false;
+}
+
+void LLStartUp::setStartSLURL(const LLSLURL& slurl) 
+{
+  sStartSLURL = slurl;
+  switch(slurl.getType())
+    {
+    case LLSLURL::HOME_LOCATION:
+      {
+		  gSavedSettings.setString("LoginLocation", LLSLURL::SIM_LOCATION_HOME);
+	break;
+      }
+    case LLSLURL::LAST_LOCATION:
+      {
+	gSavedSettings.setString("LoginLocation", LLSLURL::SIM_LOCATION_LAST);
+	break;
+      }
+    default:
+			LLGridManager::getInstance()->setGridChoice(slurl.getGrid());
+			break;
+    }
+}
+
+bool login_alert_done(const LLSD& notification, const LLSD& response)
+{
+	LLPanelLogin::giveFocus();
+	return false;
+}
+
+// parse the certificate information into args for the 
+// certificate notifications
+LLSD transform_cert_args(LLPointer<LLCertificate> cert)
+{
+	LLSD args = LLSD::emptyMap();
+	std::string value;
+	LLSD cert_info;
+	cert->getLLSD(cert_info);
+	// convert all of the elements in the cert into                                        
+	// args for the xml dialog, so we have flexability to                                  
+	// display various parts of the cert by only modifying                                 
+	// the cert alert dialog xml.                                                          
+	for(LLSD::map_iterator iter = cert_info.beginMap();
+		iter != cert_info.endMap();
+		iter++)
+	{
+		// key usage and extended key usage                                            
+		// are actually arrays, and we want to format them as comma separated          
+		// strings, so special case those.                                             
+		LLSDSerialize::toXML(cert_info[iter->first], std::cout);
+		if((iter->first== std::string(CERT_KEY_USAGE)) |
+		   (iter->first == std::string(CERT_EXTENDED_KEY_USAGE)))
+		{
+			value = "";
+			LLSD usage = cert_info[iter->first];
+			for (LLSD::array_iterator usage_iter = usage.beginArray();
+				 usage_iter != usage.endArray();
+				 usage_iter++)
+			{
+				
+				if(usage_iter != usage.beginArray())
+				{
+					value += ", ";
+				}
+				
+				value += (*usage_iter).asString();
+			}
+			
+		}
+		else
+		{
+			value = iter->second.asString();
+		}
+		
+		std::string name = iter->first;
+		std::transform(name.begin(), name.end(), name.begin(),
+					   (int(*)(int))toupper);
+		args[name.c_str()] = value;
+	}
+	return args;
+}
+
+
+// when we handle a cert error, give focus back to the login panel
+void general_cert_done(const LLSD& notification, const LLSD& response)
+{
+	LLStartUp::setStartupState( STATE_LOGIN_SHOW );			
+	LLPanelLogin::giveFocus();
+}
+
+// check to see if the user wants to trust the cert.
+// if they do, add it to the cert store and 
+void trust_cert_done(const LLSD& notification, const LLSD& response)
+{
+	S32 option = LLNotification::getSelectedOption(notification, response);	
+	switch(option)
+	{
+		case OPT_TRUST_CERT:
+		{
+			LLPointer<LLCertificate> cert = gSecAPIHandler->getCertificate(notification["payload"]["certificate"]);
+			LLPointer<LLCertificateStore> store = gSecAPIHandler->getCertificateStore(gSavedSettings.getString("CertStore"));			
+			store->add(cert);
+			store->save();
+			LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );	
+			break;
+		}
+		case OPT_CANCEL_TRUST:
+			reset_login();
+			gSavedSettings.setBOOL("AutoLogin", FALSE);			
+			LLStartUp::setStartupState( STATE_LOGIN_SHOW );				
+		default:
+			LLPanelLogin::giveFocus();
+			break;
+	}
+
+}
+
+void apply_udp_blacklist(const std::string& csv)
+{
+
+	std::string::size_type start = 0;
+	std::string::size_type comma = 0;
+	do 
+	{
+		comma = csv.find(",", start);
+		if (comma == std::string::npos)
+		{
+			comma = csv.length();
+		}
+		std::string item(csv, start, comma-start);
+
+		lldebugs << "udp_blacklist " << item << llendl;
+		gMessageSystem->banUdpMessage(item);
+		
+		start = comma + 1;
+
+	}
+	while(comma < csv.length());
+	
+}
+
+bool process_login_success_response()
+{
+	LLSD response = LLLoginInstance::getInstance()->getResponse();
+
+	std::string text(response["udp_blacklist"]);
+	if(!text.empty())
+	{
+		apply_udp_blacklist(text);
+	}
+
+	// unpack login data needed by the application
+	text = response["agent_id"].asString();
+	if(!text.empty()) gAgentID.set(text);
+	gDebugInfo["AgentID"] = text;
+	
+	// Agent id needed for parcel info request in LLUrlEntryParcel
+	// to resolve parcel name.
+	LLUrlEntryParcel::setAgentID(gAgentID);
+
+	text = response["session_id"].asString();
+	if(!text.empty()) gAgentSessionID.set(text);
+	gDebugInfo["SessionID"] = text;
+
+	// Session id needed for parcel info request in LLUrlEntryParcel
+	// to resolve parcel name.
+	LLUrlEntryParcel::setSessionID(gAgentSessionID);
+	
+	text = response["secure_session_id"].asString();
+	if(!text.empty()) gAgent.mSecureSessionID.set(text);
+
+	// if the response contains a display name, use that,
+	// otherwise if the response contains a first and/or last name,
+	// use those.  Otherwise use the credential identifier
+
+	gDisplayName = "";
+	if (response.has("display_name"))
+	{
+		gDisplayName.assign(response["display_name"].asString());
+		if(!gDisplayName.empty())
+		{
+			// Remove quotes from string.  Login.cgi sends these to force
+			// names that look like numbers into strings.
+			LLStringUtil::replaceChar(gDisplayName, '"', ' ');
+			LLStringUtil::trim(gDisplayName);
+		}
+	}
+	if(gDisplayName.empty())
+	{
+		if(response.has("first_name"))
+		{
+			gDisplayName.assign(response["first_name"].asString());
+			LLStringUtil::replaceChar(gDisplayName, '"', ' ');
+			LLStringUtil::trim(gDisplayName);
+		}
+		if(response.has("last_name"))
+		{
+			text.assign(response["last_name"].asString());
+			LLStringUtil::replaceChar(text, '"', ' ');
+			LLStringUtil::trim(text);
+			if(!gDisplayName.empty())
+			{
+				gDisplayName += " ";
+			}
+			gDisplayName += text;
+		}
+	}
+	if(gDisplayName.empty())
+	{
+		gDisplayName.assign(gUserCredential->asString());
+	}
+
+	// this is their actual ability to access content
+	text = response["agent_access_max"].asString();
+	if (!text.empty())
+	{
+		// agent_access can be 'A', 'M', and 'PG'.
+		gAgent.setMaturity(text[0]);
+	}
+	
+	// this is the value of their preference setting for that content
+	// which will always be <= agent_access_max
+	text = response["agent_region_access"].asString();
+	if (!text.empty())
+	{
+		U32 preferredMaturity = (U32)LLAgent::convertTextToMaturity(text[0]);
+
+		gSavedSettings.setU32("PreferredMaturity", preferredMaturity);
+	}
+	// During the AO transition, this flag will be true. Then the flag will
+	// go away. After the AO transition, this code and all the code that
+	// uses it can be deleted.
+	text = response["ao_transition"].asString();
+	if (!text.empty())
+	{
+		if (text == "1")
+		{
+			gAgent.setAOTransition();
+		}
+	}
+
+	text = response["start_location"].asString();
+	if(!text.empty()) 
+	{
+		gAgentStartLocation.assign(text);
+	}
+
+	text = response["circuit_code"].asString();
+	if(!text.empty())
+	{
+		gMessageSystem->mOurCircuitCode = strtoul(text.c_str(), NULL, 10);
+	}
+	std::string sim_ip_str = response["sim_ip"];
+	std::string sim_port_str = response["sim_port"];
+	if(!sim_ip_str.empty() && !sim_port_str.empty())
+	{
+		U32 sim_port = strtoul(sim_port_str.c_str(), NULL, 10);
+		gFirstSim.set(sim_ip_str, sim_port);
+		if (gFirstSim.isOk())
+		{
+			gMessageSystem->enableCircuit(gFirstSim, TRUE);
+		}
+	}
+	std::string region_x_str = response["region_x"];
+	std::string region_y_str = response["region_y"];
+	if(!region_x_str.empty() && !region_y_str.empty())
+	{
+		U32 region_x = strtoul(region_x_str.c_str(), NULL, 10);
+		U32 region_y = strtoul(region_y_str.c_str(), NULL, 10);
+		gFirstSimHandle = to_region_handle(region_x, region_y);
+	}
+	
+	const std::string look_at_str = response["look_at"];
+	if (!look_at_str.empty())
+	{
+		size_t len = look_at_str.size();
+		LLMemoryStream mstr((U8*)look_at_str.c_str(), len);
+		LLSD sd = LLSDSerialize::fromNotation(mstr, len);
+		gAgentStartLookAt = ll_vector3_from_sd(sd);
+	}
+
+	text = response["seed_capability"].asString();
+	if (!text.empty()) gFirstSimSeedCap = text;
+				
+	text = response["seconds_since_epoch"].asString();
+	if(!text.empty())
+	{
+		U32 server_utc_time = strtoul(text.c_str(), NULL, 10);
+		if(server_utc_time)
+		{
+			time_t now = time(NULL);
+			gUTCOffset = (server_utc_time - now);
+		}
+	}
+
+	// this is the base used to construct help URLs
+	text = response["help_url_format"].asString();
+	if (!text.empty())
+	{
+		// replace the default help URL format
+		gSavedSettings.setString("HelpURLFormat",text);
+		
+		// don't fall back to Standalone's pre-connection static help
+		gSavedSettings.setBOOL("HelpUseLocal", false);
+	}
+			
+	std::string home_location = response["home"];
+	if(!home_location.empty())
+	{
+		size_t len = home_location.size();
+		LLMemoryStream mstr((U8*)home_location.c_str(), len);
+		LLSD sd = LLSDSerialize::fromNotation(mstr, len);
+		S32 region_x = sd["region_handle"][0].asInteger();
+		S32 region_y = sd["region_handle"][1].asInteger();
+		U64 region_handle = to_region_handle(region_x, region_y);
+		LLVector3 position = ll_vector3_from_sd(sd["position"]);
+		gAgent.setHomePosRegion(region_handle, position);
+	}
+
+	gAgent.mMOTD.assign(response["message"]);
+
+	// Options...
+	// Each 'option' is an array of submaps. 
+	// It appears that we only ever use the first element of the array.
+	LLUUID inv_root_folder_id = response["inventory-root"][0]["folder_id"];
+	if(inv_root_folder_id.notNull())
+	{
+		gInventory.setRootFolderID(inv_root_folder_id);
+		//gInventory.mock(gAgent.getInventoryRootID());
+	}
+
+	LLSD login_flags = response["login-flags"][0];
+	if(login_flags.size())
+	{
+		std::string flag = login_flags["ever_logged_in"];
+		if(!flag.empty())
+		{
+			gAgent.setFirstLogin((flag == "N") ? TRUE : FALSE);
+		}
+
+		/*  Flag is currently ignored by the viewer.
+		flag = login_flags["stipend_since_login"];
+		if(flag == "Y") 
+		{
+			stipend_since_login = true;
+		}
+		*/
+
+		flag = login_flags["gendered"].asString();
+		if(flag == "Y")
+		{
+			gAgent.setGenderChosen(TRUE);
+		}
+		
+		bool pacific_daylight_time = false;
+		flag = login_flags["daylight_savings"].asString();
+		if(flag == "Y")
+		{
+			pacific_daylight_time = (flag == "Y");
+		}
+
+		//setup map of datetime strings to codes and slt & local time offset from utc
+		LLStringOps::setupDatetimeInfo(pacific_daylight_time);
+	}
+
+	// set up the voice configuration.  Ultimately, we should pass this up as part of each voice
+	// channel if we need to move to multiple voice servers per grid.
+	LLSD voice_config_info = response["voice-config"];
+	if(voice_config_info.has("VoiceServerType"))
+	{
+		gSavedSettings.setString("VoiceServerType", voice_config_info["VoiceServerType"].asString()); 
+	}
+
+	// Request the map server url
+	std::string map_server_url = response["map-server-url"];
+	if(!map_server_url.empty())
+	{
+		// We got an answer from the grid -> use that for map for the current session
+		gSavedSettings.setString("CurrentMapServerURL", map_server_url); 
+		LL_INFOS("LLStartup") << "map-server-url : we got an answer from the grid : " << map_server_url << LL_ENDL;
+	}
+	else
+	{
+		// No answer from the grid -> use the default setting for current session 
+		map_server_url = gSavedSettings.getString("MapServerURL"); 
+		gSavedSettings.setString("CurrentMapServerURL", map_server_url); 
+		LL_INFOS("LLStartup") << "map-server-url : no map-server-url answer, we use the default setting for the map : " << map_server_url << LL_ENDL;
+	}
+	
+	// Default male and female avatars allowing the user to choose their avatar on first login.
+	// These may be passed up by SLE to allow choice of enterprise avatars instead of the standard
+	// "new ruth."  Not to be confused with 'initial-outfit' below 
+	LLSD newuser_config = response["newuser-config"][0];
+	if(newuser_config.has("DefaultFemaleAvatar"))
+	{
+		gSavedSettings.setString("DefaultFemaleAvatar", newuser_config["DefaultFemaleAvatar"].asString()); 		
+	}
+	if(newuser_config.has("DefaultMaleAvatar"))
+	{
+		gSavedSettings.setString("DefaultMaleAvatar", newuser_config["DefaultMaleAvatar"].asString()); 		
+	}
+	
+	// Initial outfit for the user.
+	// QUESTION: Why can't we simply simply set the users outfit directly
+	// from a web page into the user info on the server? - Roxie
+	LLSD initial_outfit = response["initial-outfit"][0];
+	if(initial_outfit.size())
+	{
+		std::string flag = initial_outfit["folder_name"];
+		if(!flag.empty())
+		{
+			// Initial outfit is a folder in your inventory,
+			// must be an exact folder-name match.
+			sInitialOutfit = flag;
+		}
+
+		flag = initial_outfit["gender"].asString();
+		if(!flag.empty())
+		{
+			sInitialOutfitGender = flag;
+		}
+	}
+
+	LLSD global_textures = response["global-textures"][0];
+	if(global_textures.size())
+	{
+		// Extract sun and moon texture IDs.  These are used
+		// in the LLVOSky constructor, but I can't figure out
+		// how to pass them in.  JC
+		LLUUID id = global_textures["sun_texture_id"];
+		if(id.notNull())
+		{
+			gSunTextureID = id;
+		}
+
+		id = global_textures["moon_texture_id"];
+		if(id.notNull())
+		{
+			gMoonTextureID = id;
+		}
+
+		id = global_textures["cloud_texture_id"];
+		if(id.notNull())
+		{
+			gCloudTextureID = id;
+		}
+	}
+
+	// Set the location of the snapshot sharing config endpoint
+	std::string snapshot_config_url = response["snapshot_config_url"];
+	if(!snapshot_config_url.empty())
+	{
+		gSavedSettings.setString("SnapshotConfigURL", snapshot_config_url);
+	}
+
+	// Start the process of fetching the OpenID session cookie for this user login
+	std::string openid_url = response["openid_url"];
+	if(!openid_url.empty())
+	{
+		std::string openid_token = response["openid_token"];
+		LLViewerMedia::openIDSetup(openid_url, openid_token);
+	}
+
+	if(response.has("max-agent-groups")) {		
+		std::string max_agent_groups(response["max-agent-groups"]);
+		gMaxAgentGroups = atoi(max_agent_groups.c_str());
+		LL_INFOS("LLStartup") << "gMaxAgentGroups read from login.cgi: "
+							  << gMaxAgentGroups << LL_ENDL;
+	}
+	else {
+		gMaxAgentGroups = DEFAULT_MAX_AGENT_GROUPS;
+		LL_INFOS("LLStartup") << "using gMaxAgentGroups default: "
+							  << gMaxAgentGroups << LL_ENDL;
+	}
+		
+	bool success = false;
+	// JC: gesture loading done below, when we have an asset system
+	// in place.  Don't delete/clear gUserCredentials until then.
+	if(gAgentID.notNull()
+	   && gAgentSessionID.notNull()
+	   && gMessageSystem->mOurCircuitCode
+	   && gFirstSim.isOk()
+	   && gInventory.getRootFolderID().notNull())
+	{
+		success = true;
+	}
+
+	return success;
+}
+
+void transition_back_to_login_panel(const std::string& emsg)
+{
+	if (gNoRender)
+	{
+		LL_WARNS("AppInit") << "Failed to login!" << LL_ENDL;
+		LL_WARNS("AppInit") << emsg << LL_ENDL;
+		exit(0);
+	}
+
+	// Bounce back to the login screen.
+	reset_login(); // calls LLStartUp::setStartupState( STATE_LOGIN_SHOW );
+	gSavedSettings.setBOOL("AutoLogin", FALSE);
+}
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index 582f50ba3747d55de2bf604e920bdc335c370497..9549f180df661e8302bb08a95dce1b6b717fc18e 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -83,7 +83,7 @@ LLToolPie::LLToolPie()
 	mMouseOutsideSlop( false ),
 	mMouseSteerX(-1),
 	mMouseSteerY(-1),
-	mAbortClickToWalk(false),
+	mBlockClickToWalk(false),
 	mClickAction(0),
 	mClickActionBuyEnabled( gSavedSettings.getBOOL("ClickActionBuyEnabled") ),
 	mClickActionPayEnabled( gSavedSettings.getBOOL("ClickActionPayEnabled") )
@@ -303,7 +303,7 @@ BOOL LLToolPie::handleLeftClickPick()
 	if (gFocusMgr.getKeyboardFocus())
 	{
 		// don't click to walk on attempt to give focus to world
-		mAbortClickToWalk = true;
+		mBlockClickToWalk = true;
 		gFocusMgr.setKeyboardFocus(NULL);
 	}
 
@@ -625,7 +625,7 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask)
 	// let media have first pass at click
 	if (handleMediaMouseUp() || LLViewerMediaFocus::getInstance()->getFocus())
 	{
-		mAbortClickToWalk = true;
+		mBlockClickToWalk = true;
 	}
 	stopCameraSteering();
 	mMouseButtonDown = false;
@@ -633,7 +633,7 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask)
 	if (click_action == CLICK_ACTION_NONE				// not doing 1-click action
 		&& gSavedSettings.getBOOL("ClickToWalk")		// click to walk enabled
 		&& !gAgent.getFlying()							// don't auto-navigate while flying until that works
-		&& !mAbortClickToWalk							// another behavior hasn't cancelled click to walk
+		&& !mBlockClickToWalk							// another behavior hasn't cancelled click to walk
 		&& !mPick.mPosGlobal.isExactlyZero()			// valid coordinates for pick
 		&& (mPick.mPickType == LLPickInfo::PICK_LAND	// we clicked on land
 			|| mPick.mObjectID.notNull()))				// or on an object
@@ -658,11 +658,11 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask)
 		mAutoPilotDestination = (LLHUDEffectBlob *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BLOB, FALSE);
 		mAutoPilotDestination->setPositionGlobal(mPick.mPosGlobal);
 		mAutoPilotDestination->setPixelSize(5);
-		mAutoPilotDestination->setColor(LLColor4U(50, 50, 200));
+		mAutoPilotDestination->setColor(LLColor4U(170, 210, 190));
 		mAutoPilotDestination->setDuration(3.f);
 
 		handle_go_to();
-		mAbortClickToWalk = false;
+		mBlockClickToWalk = false;
 
 		return TRUE;
 	}
@@ -675,7 +675,7 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask)
 	LLToolMgr::getInstance()->clearTransientTool();
 	gAgentCamera.setLookAt(LOOKAT_TARGET_CONVERSATION, obj); // maybe look at object/person clicked on
 
-	mAbortClickToWalk = false;
+	mBlockClickToWalk = false;
 	return LLTool::handleMouseUp(x, y, mask);
 }
 
@@ -1298,7 +1298,8 @@ void LLToolPie::VisitHomePage(const LLPickInfo& info)
 
 void LLToolPie::handleSelect()
 {
-	mAbortClickToWalk = true;	
+	// tool is reselected when app gets focus, etc.
+	mBlockClickToWalk = true;	
 }
 
 void LLToolPie::handleDeselect()
@@ -1738,7 +1739,7 @@ bool intersect_ray_with_sphere( const LLVector3& ray_pt, const LLVector3& ray_di
 void LLToolPie::startCameraSteering()
 {
 	mMouseOutsideSlop = true;
-	mAbortClickToWalk = true;
+	mBlockClickToWalk = true;
 
 	if (gAgentCamera.getFocusOnAvatar())
 	{
@@ -1777,7 +1778,7 @@ void LLToolPie::startCameraSteering()
 		if (mMouseSteerGrabPoint) { mMouseSteerGrabPoint->markDead(); }
 		mMouseSteerGrabPoint = (LLHUDEffectBlob *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BLOB, FALSE);
 		mMouseSteerGrabPoint->setPositionGlobal(mSteerPick.mPosGlobal);
-		mMouseSteerGrabPoint->setColor(LLColor4U(50, 50, 200));
+		mMouseSteerGrabPoint->setColor(LLColor4U(170, 210, 190));
 		mMouseSteerGrabPoint->setPixelSize(5);
 		mMouseSteerGrabPoint->setDuration(2.f);
 	}
diff --git a/indra/newview/lltoolpie.h b/indra/newview/lltoolpie.h
index 22e77a31594aa6606f31d3972c5a420e03b277c3..22359a6db841d665a2053a6de8bb3ae7d671bf97 100644
--- a/indra/newview/lltoolpie.h
+++ b/indra/newview/lltoolpie.h
@@ -66,6 +66,7 @@ class LLToolPie : public LLTool, public LLSingleton<LLToolPie>
 	LLViewerObject*		getClickActionObject() { return mClickActionObject; }
 	LLObjectSelection*	getLeftClickSelection() { return (LLObjectSelection*)mLeftClickSelection; }
 	void 				resetSelection();
+	void				blockClickToWalk() { mBlockClickToWalk = true; }
 	
 	static void			selectionPropertiesReceived();
 
@@ -105,7 +106,7 @@ class LLToolPie : public LLTool, public LLSingleton<LLToolPie>
 	LLPointer<LLHUDEffectBlob>	mAutoPilotDestination;
 	LLPointer<LLHUDEffectBlob>	mMouseSteerGrabPoint;
 	bool				mClockwise;			
-	bool				mAbortClickToWalk;
+	bool				mBlockClickToWalk;
 	LLUUID				mMediaMouseCaptureID;
 	LLPickInfo			mPick;
 	LLPickInfo			mHoverPick;
diff --git a/indra/newview/lltracker.h b/indra/newview/lltracker.h
index c0c154abe831dde4c86fd6518625f44bf8cf1b20..8e916af31580582017c4771049cfea962c495ffc 100644
--- a/indra/newview/lltracker.h
+++ b/indra/newview/lltracker.h
@@ -75,7 +75,7 @@ class LLTracker
 	// these are static so that they can be used a callbacks
 	static ETrackingStatus getTrackingStatus() { return instance()->mTrackingStatus; }
 	static ETrackingLocationType getTrackedLocationType() { return instance()->mTrackingLocationType; }
-	static BOOL isTracking(void*) { return (BOOL) instance()->mTrackingStatus; }
+	static BOOL isTracking(void*) { return instance()->mTrackingStatus != TRACKING_NOTHING; }
 	static void stopTracking(void*);
 	static void clearFocus();
 	
diff --git a/indra/newview/llviewerchat.cpp b/indra/newview/llviewerchat.cpp
index 0af850a46b015b2de2e60d9c2cb4d7328e0a101a..286b16bab2ede0749a22b2ffbc91f679fd0c5856 100644
--- a/indra/newview/llviewerchat.cpp
+++ b/indra/newview/llviewerchat.cpp
@@ -31,6 +31,8 @@
 #include "llagent.h" 	// gAgent		
 #include "lluicolortable.h"
 #include "llviewercontrol.h" // gSavedSettings
+#include "llviewerregion.h"
+#include "llworld.h"
 #include "llinstantmessage.h" //SYSTEM_FROM
 
 // LLViewerChat
@@ -214,3 +216,43 @@ void LLViewerChat::formatChatMsg(const LLChat& chat, std::string& formated_msg)
 
 }
 
+//static
+std::string LLViewerChat::getSenderSLURL(const LLChat& chat, const LLSD& args)
+{
+	switch (chat.mSourceType)
+	{
+	case CHAT_SOURCE_AGENT:
+		return LLSLURL("agent", chat.mFromID, "about").getSLURLString();
+
+	case CHAT_SOURCE_OBJECT:
+		return getObjectImSLURL(chat, args);
+
+	default:
+		llwarns << "Getting SLURL for an unsupported sender type: " << chat.mSourceType << llendl;
+	}
+
+	return LLStringUtil::null;
+}
+
+//static
+std::string LLViewerChat::getObjectImSLURL(const LLChat& chat, const LLSD& args)
+{
+	std::string url = LLSLURL("objectim", chat.mFromID, "").getSLURLString();
+	url += "?name=" + chat.mFromName;
+	url += "&owner=" + chat.mOwnerID.asString();
+
+	std::string slurl = args["slurl"].asString();
+	if (slurl.empty())
+	{
+		LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent);
+		if(region)
+		{
+			LLSLURL region_slurl(region->getName(), chat.mPosAgent);
+			slurl = region_slurl.getLocationString();
+		}
+	}
+
+	url += "&slurl=" + LLURI::escape(slurl);
+
+	return url;
+}
diff --git a/indra/newview/llviewerchat.h b/indra/newview/llviewerchat.h
index a9f9a98960f06b60cc7c07d7ae390bbca65b83d4..0f15d29f04ec3a0a8f884d328d4b9cd78b3193dc 100644
--- a/indra/newview/llviewerchat.h
+++ b/indra/newview/llviewerchat.h
@@ -40,6 +40,10 @@ class LLViewerChat
 	static LLFontGL* getChatFont();
 	static S32 getChatFontSize();
 	static void formatChatMsg(const LLChat& chat, std::string& formated_msg);
+	static std::string getSenderSLURL(const LLChat& chat, const LLSD& args);
+
+private:
+	static std::string getObjectImSLURL(const LLChat& chat, const LLSD& args);
 
 };
 
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 75cf2efc69f511a21a4a24f0f76d480ae42d8a34..ec72df79d1efc515e8680cb02d55c6bcdb38584b 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -846,9 +846,13 @@ class LLAdvancedCheckFeature : public view_listener_t
 void toggle_destination_and_avatar_picker(const LLSD& show)
 {
 	S32 panel_idx = show.isDefined() ? show.asInteger() : -1;
-	LLView* container = gViewerWindow->getRootView()->getChildView("avatar_picker_and_destination_guide_container");
+	LLView* container = gViewerWindow->getRootView()->findChildView("avatar_picker_and_destination_guide_container");
+	if (!container) return;
+
 	LLMediaCtrl* destinations = container->findChild<LLMediaCtrl>("destination_guide_contents");
 	LLMediaCtrl* avatar_picker = container->findChild<LLMediaCtrl>("avatar_picker_contents");
+	if (!destinations || !avatar_picker) return;
+
 	LLButton* avatar_btn = gViewerWindow->getRootView()->getChildView("bottom_tray")->getChild<LLButton>("avatar_btn");
 	LLButton* destination_btn = gViewerWindow->getRootView()->getChildView("bottom_tray")->getChild<LLButton>("destination_btn");
 
@@ -7158,7 +7162,13 @@ LLViewerMenuHolderGL::LLViewerMenuHolderGL(const LLViewerMenuHolderGL::Params& p
 
 BOOL LLViewerMenuHolderGL::hideMenus()
 {
-	BOOL handled = LLMenuHolderGL::hideMenus();
+	BOOL handled = FALSE;
+	
+	if (LLMenuHolderGL::hideMenus())
+	{
+		LLToolPie::instance().blockClickToWalk();
+		handled = TRUE;
+	}
 
 	// drop pie menu selection
 	mParcelSelection = NULL;
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 147163a9c0b7f2dd1b2e2917c0ea00747590719a..aa83bcb68b446ed739e9b5657b982eff7789be47 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1799,6 +1799,11 @@ void LLViewerWindow::initWorldUI()
 		avatar_picker->navigateTo(gSavedSettings.getString("AvatarPickerURL"), "text/html");
 	}
 
+	if (gSavedSettings.getBOOL("FirstLoginThisInstall"))
+	{
+		toggle_destination_and_avatar_picker(0);
+		gSavedSettings.setBOOL("FirstLoginThisInstall", FALSE);
+	}
 }
 
 // Destroy the UI
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index cec2942b35af5f6d920c51a30f9f1a633b5f255a..d79d6607244c7a62a9ed3c2ac2747b5af83e2a5a 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -673,4 +673,5 @@ with the same filename but different name
 
   <texture name="Yellow_Gradient" file_name="windows/yellow_gradient.png"/>
   <texture name="Popup_Caution" file_name="icons/pop_up_caution.png"/>
+  <texture name="Camera_Drag_Dot" file_name="world/CameraDragDot.png"/>
 </textures>
diff --git a/indra/newview/skins/default/textures/world/CameraDragDot.png b/indra/newview/skins/default/textures/world/CameraDragDot.png
new file mode 100644
index 0000000000000000000000000000000000000000..57698e19560dc119f045667b0ae3d49e611d3b36
Binary files /dev/null and b/indra/newview/skins/default/textures/world/CameraDragDot.png differ
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 12c45617530885b9677f4c40f7920e35f816b5db..3921cfcd2c92ffff9e226d134457e9a36840df25 100644
--- a/indra/newview/skins/default/xui/en/floater_ui_preview.xml
+++ b/indra/newview/skins/default/xui/en/floater_ui_preview.xml
@@ -12,6 +12,10 @@
  title="XUI PREVIEW TOOL"
  translate="false"
  width="750">
+    <string name="ExternalEditorNotSet">
+Select an editor by setting the environment variable LL_XUI_EDITOR
+or the ExternalEditor setting
+or specifying its path in the "Editor Path" field.</string>
     <panel
      bottom="640"
      follows="left|top|right|bottom"
diff --git a/indra/newview/skins/default/xui/en/menu_attachment_self.xml b/indra/newview/skins/default/xui/en/menu_attachment_self.xml
index 84e81397beb465b0df1b180f7cd845ab60decc93..b8128da358631e2885fae37b4ebd0d72ba49eb66 100644
--- a/indra/newview/skins/default/xui/en/menu_attachment_self.xml
+++ b/indra/newview/skins/default/xui/en/menu_attachment_self.xml
@@ -68,7 +68,7 @@ name="Stand Up">
      function="Self.EnableStandUp" />
   </menu_item_call>
   <menu_item_call
-  label="Change Outfit"
+  label="My Appearance"
   name="Change Outfit">
     <menu_item_call.on_click
      function="CustomizeAvatar" />
diff --git a/indra/newview/skins/default/xui/en/menu_avatar_self.xml b/indra/newview/skins/default/xui/en/menu_avatar_self.xml
index 2afa29ec100e4fcc500d3500feef858c2d16ac17..d727294cc8ebf23ff96af095c4d55c65d982936e 100644
--- a/indra/newview/skins/default/xui/en/menu_avatar_self.xml
+++ b/indra/newview/skins/default/xui/en/menu_avatar_self.xml
@@ -193,7 +193,7 @@
         </menu_item_call>
     </context_menu>
      <menu_item_call
-     label="Change Outfit"
+     label="My Appearance"
      layout="topleft"
      name="Chenge Outfit">
         <menu_item_call.on_click
diff --git a/indra/newview/skins/default/xui/en/menu_bottomtray.xml b/indra/newview/skins/default/xui/en/menu_bottomtray.xml
index 1b55fa4fd3c8aa1430b4552dfd09e2a35fd06ee6..07dabe1909e0618954fe2d56aebe7b685c88d75d 100644
--- a/indra/newview/skins/default/xui/en/menu_bottomtray.xml
+++ b/indra/newview/skins/default/xui/en/menu_bottomtray.xml
@@ -9,7 +9,7 @@
  visible="false"
  width="128">
     <menu_item_check
-         label="Voice Enabled"
+         label="Speak Button"
          layout="topleft"
          name="EnableVoiceChat">
            <menu_item_check.on_click
@@ -19,7 +19,6 @@
              function="CheckControl"
              parameter="EnableVoiceChat" />
     </menu_item_check>
-    <menu_item_separator/>
     <menu_item_check
          label="Gesture button"
          layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 606ff695991077a49c8ddb769e53acb9a2c49b03..934cae93db0f83e8f75b2bca8a93ec67d865dcb6 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -41,7 +41,7 @@
              parameter="agent" />
         </menu_item_call>
         <menu_item_call
-         label="Change Outfit"
+         label="My Appearance"
          name="ChangeOutfit">
             <menu_item_call.on_click
              function="CustomizeAvatar" />
@@ -261,6 +261,17 @@
              function="Floater.Toggle"
              parameter="world_map" />
         </menu_item_check>
+        <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
          label="Snapshot"
          name="Take Snapshot"
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 6ecaef1bf3050927b370d0d81cf9f9d136cc7bfb..433f623273cca2cdcf1f1c6b331c6df274db9174 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -819,22 +819,6 @@ You need to enter either the Username or both the First and Last name of your av
   </notification>
   
 
-  <notification
-   icon="alertmodal.tga"
-   name="AddClassified"
-   type="alertmodal">
-Classified ads appear in the &apos;Classified&apos; section of the Search directory and on [http://secondlife.com/community/classifieds secondlife.com] for one week.
-Fill out your ad, then click &apos;Publish...&apos; to add it to the directory.
-You&apos;ll be asked for a price to pay when clicking Publish.
-Paying more makes your ad appear higher in the list, and also appear higher when people search for keywords.
-    <tag>confirm</tag>
-    <usetemplate
-     ignoretext="How to create a new Classified ad"
-     name="okcancelignore"
-     notext="Cancel"
-     yestext="OK"/>
-  </notification>
-
   <notification
    icon="alertmodal.tga"
    name="DeleteClassified"
@@ -7001,6 +6985,18 @@ Mute everyone?
     To stand up and exit the sitting position, click the Stand button.
   </notification>
 
+  <notification
+  name="HintSpeak"
+  label="Speak"
+  type="hint"
+  unique="true">
+Click the Speak button to turn your microphone on and off.
+
+Click on the up arrow to see the voice control panel.
+
+Hiding the Speak button will disable the voice feature.
+  </notification>
+
   <notification
   name="HintDestinationGuide"
   label="Explore the World"
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 627b12cfe17a71f088ff2293474425d03207f7ca..8d420243864c56e4cda3fa1d0f53e2b7ad2e00d1 100644
--- a/indra/newview/skins/default/xui/en/panel_script_ed.xml
+++ b/indra/newview/skins/default/xui/en/panel_script_ed.xml
@@ -28,6 +28,10 @@
      name="Title">
         Script: [NAME]
     </panel.string>
+    <panel.string
+     name="external_editor_not_set">
+        Select an editor by setting the environment variable LL_SCRIPT_EDITOR or the ExternalEditor setting.
+    </panel.string>
     <menu_bar
      bg_visible="false"
      follows="left|top"
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index d0625d975579978820c61aeb1de426520b41314f..14ea43a8f80b5a85c39320ce07a299ac058aec24 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -3310,6 +3310,14 @@ 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.
+Try enclosing path to the editor with double quotes.
+(e.g. "/path to my/editor" "%s")</string>
+ <string name="ExternalEditorCommandParseError">Error parsing the external editor command.</string>
+ <string name="ExternalEditorFailedToRun">External editor failed to run.</string>
 
   <!-- Key names begin -->
   <string name="Esc">Esc</string>
diff --git a/indra/newview/skins/default/xui/es/panel_landmark_info.xml b/indra/newview/skins/default/xui/es/panel_landmark_info.xml
index 49a9f84cfe7cde9aa680d83353c7a58b872dd2ab..1a0ac3ba79c7d68c154105b63cde73a866a3f9af 100644
--- a/indra/newview/skins/default/xui/es/panel_landmark_info.xml
+++ b/indra/newview/skins/default/xui/es/panel_landmark_info.xml
@@ -19,7 +19,7 @@
 		[wkday,datetime,local][day,datetime,local] [mth,datetime,local] [year,datetime,local][hour,datetime,local]:[min,datetime,local]:[second,datetime,local]
 	</string>
 	<button name="back_btn" tool_tip="Atrás"/>
-	<text name="title" value="Añadir el perfil"/>
+	<text name="title" value="Perfil del lugar"/>
 	<scroll_container name="place_scroll">
 		<panel name="scrolling_panel">
 			<text name="maturity_value" value="desconocido"/>
diff --git a/indra/newview/skins/default/xui/es/panel_place_profile.xml b/indra/newview/skins/default/xui/es/panel_place_profile.xml
index 524ba2253b6fddec01442812752e196178177498..3c363859a40754b7f5ca4b0d723963fc4616e417 100644
--- a/indra/newview/skins/default/xui/es/panel_place_profile.xml
+++ b/indra/newview/skins/default/xui/es/panel_place_profile.xml
@@ -5,7 +5,7 @@
 	<string name="anyone" value="Cualquiera"/>
 	<string name="available" value="disponible"/>
 	<string name="allocated" value="asignados"/>
-	<string name="title_place" value="Añadir el perfil"/>
+	<string name="title_place" value="Perfil del lugar"/>
 	<string name="title_teleport_history" value="Historial de teleportes"/>
 	<string name="not_available" value="(No disp.)"/>
 	<string name="unknown" value="(desconocido)"/>
@@ -42,7 +42,7 @@
 		[wkday,datetime,local][day,datetime,local] [mth,datetime,local] [year,datetime,local][hour,datetime,local]:[min,datetime,local]:[second,datetime,local]
 	</string>
 	<button name="back_btn" tool_tip="Atrás"/>
-	<text name="title" value="Añadir el perfil"/>
+	<text name="title" value="Perfil del lugar"/>
 	<scroll_container name="place_scroll">
 		<panel name="scrolling_panel">
 			<text name="owner_label" value="Propietario:"/>
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 67f9a929f68c2b58076977788ed8511386d86fb5..0b304fe2872f99ccd126f43c1ad7eb081a2a70dd 100644
--- a/indra/newview/skins/default/xui/es/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/es/panel_preferences_chat.xml
@@ -27,9 +27,9 @@
 	</text>
 	<check_box label="Chats de grupo" name="EnableGroupChatPopups" tool_tip="Activa esta casilla para ver una ventana emergente cada vez que recibas un mensaje de un grupo de chat"/>
 	<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 en los chats:" name="nearby_toasts_lifetime"/>
-	<spinner label="Tiempo restante de los interlocutores favoritos en los chats:" name="nearby_toasts_fadingtime"/>
-	<check_box label="Utiliza la herramienta de traducción automática mientras utilizas el chat (mediante Google)" name="translate_chat_checkbox"/>
+	<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 label="Usar la traducción automática (con Google) en el chat" name="translate_chat_checkbox"/>
 	<text name="translate_language_text">
 		Traducir el chat al:
 	</text>
diff --git a/indra/newview/skins/default/xui/es/panel_preferences_general.xml b/indra/newview/skins/default/xui/es/panel_preferences_general.xml
index 91cf9524a3639b459044c78c5090320aa8fbd545..790c7be5819ca4eef20dd1a9eef09ddf4710855b 100644
--- a/indra/newview/skins/default/xui/es/panel_preferences_general.xml
+++ b/indra/newview/skins/default/xui/es/panel_preferences_general.xml
@@ -55,7 +55,7 @@
 	</text>
 	<radio_group name="inworld_typing_preference">
 		<radio_item label="Inicia el chat local" name="radio_start_chat" value="1"/>
-		<radio_item label="Se verá afectado el movimiento (por ejemplo, mediante las teclas WASD)" name="radio_move" value="0"/>
+		<radio_item label="Afecta al movimiento (por ejemplo, en las teclas WASD)" name="radio_move" value="0"/>
 	</radio_group>
 	<text name="title_afk_text">
 		Ausente tras:
diff --git a/indra/newview/skins/default/xui/es/panel_preferences_privacy.xml b/indra/newview/skins/default/xui/es/panel_preferences_privacy.xml
index 5eaa345c988e2e1df63878b5895486f8ae3803ad..adc0862cf1dfbd3edd148a9db585bf6677678615 100644
--- a/indra/newview/skins/default/xui/es/panel_preferences_privacy.xml
+++ b/indra/newview/skins/default/xui/es/panel_preferences_privacy.xml
@@ -11,7 +11,7 @@
 	<check_box label="Sólo saben si estoy conectado mis amigos y grupos" name="online_visibility"/>
 	<check_box label="Sólo pueden llamarme o mandarme un MI mis amigos y grupos" name="voice_call_friends_only_check"/>
 	<check_box label="Desconectar el micrófono cuando finalicen las llamadas" name="auto_disengage_mic_check"/>
-	<check_box label="Mostrar mis Hitos favoritos en Inicio de sesión (mediante el menú desplegable &quot;Empezar en&quot;)" name="favorites_on_login_check"/>
+	<check_box label="Mostrar mis Hitos favoritos al Inicio de sesión (menú desplegable &quot;Empezar en&quot;)" name="favorites_on_login_check"/>
 	<text name="Logs:">
 		Registros de chat:
 	</text>
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 68484645b7ed917043b7f9e09bde7dde8f2042b8..9b453fd807f98ace9c4c151b1767c8fa7422bbe4 100644
--- a/indra/newview/skins/default/xui/es/panel_preferences_setup.xml
+++ b/indra/newview/skins/default/xui/es/panel_preferences_setup.xml
@@ -32,7 +32,7 @@
 	<check_box initial_value="true" label="Activar plugins" name="browser_plugins_enabled"/>
 	<check_box initial_value="true" label="Aceptar las &apos;cookies&apos;" name="cookies_enabled"/>
 	<check_box initial_value="true" label="Activar Javascript" name="browser_javascript_enabled"/>
-	<check_box initial_value="falso" label="Permitir ventanas emergentes de navegadores de medios" name="media_popup_enabled"/>
+	<check_box initial_value="falso" label="Permitir las ventanas emergentes en el navegador" name="media_popup_enabled"/>
 	<check_box initial_value="false" label="Activar web proxy" name="web_proxy_enabled"/>
 	<text name="Proxy location">
 		Localización del proxy:
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 6e6409725fd97a2e0711325363a8f99af250bab2..a33c0344f73b546123a70504915c218eade294da 100644
--- a/indra/newview/skins/default/xui/fr/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/fr/floater_about_land.xml
@@ -248,7 +248,7 @@ ou divisé.
 			<text name="group_objects_text">
 				[COUNT]
 			</text>
-			<button label="Afficher" label_selected="Afficher" name="ShowGroup" />
+			<button label="Afficher" label_selected="Afficher" name="ShowGroup"/>
 			<button label="Retour" label_selected="Renvoyer..." name="ReturnGroup..." tool_tip="Renvoyer les objets à leurs propriétaires."/>
 			<text name="Owned by others:">
 				Appartenant à d&apos;autres :
@@ -336,7 +336,7 @@ Seules les parcelles de grande taille peuvent apparaître dans la recherche.
 				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="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"/>
 			<combo_box name="land category with adult">
 				<combo_box.item label="Toutes catégories" name="item0"/>
@@ -351,6 +351,7 @@ Seules les parcelles de grande taille peuvent apparaître dans la recherche.
 				<combo_box.item label="Parcs et Nature" name="item9"/>
 				<combo_box.item label="Résidentiel" name="item10"/>
 				<combo_box.item label="Shopping" name="item11"/>
+				<combo_box.item label="Location" name="item13"/>
 				<combo_box.item label="Autre" name="item12"/>
 			</combo_box>
 			<combo_box name="land category">
@@ -365,6 +366,7 @@ Seules les parcelles de grande taille peuvent apparaître dans la recherche.
 				<combo_box.item label="Parcs et Nature" name="item9"/>
 				<combo_box.item label="Résidentiel" name="item10"/>
 				<combo_box.item label="Shopping" name="item11"/>
+				<combo_box.item label="Location" name="item13"/>
 				<combo_box.item label="Autre" name="item12"/>
 			</combo_box>
 			<check_box label="Contenu Modéré" name="MatureCheck" tool_tip=""/>
@@ -444,7 +446,7 @@ musique :
 				(défini par le domaine
 			</panel.string>
 			<panel.string name="allow_public_access">
-				Autoriser l&apos;accès public ([MATURITY])
+				Autoriser l&apos;accès public ([MATURITY]) (Remarque : des lignes d&apos;interdiction seront créées si cette case n&apos;est pas cochée)
 			</panel.string>
 			<panel.string name="estate_override">
 				Au moins une de ces options est définie au niveau du domaine.
diff --git a/indra/newview/skins/default/xui/fr/floater_map.xml b/indra/newview/skins/default/xui/fr/floater_map.xml
index 04afe89c7b4f3ceae0df5ca2552b6b23a9e17942..8675fb8ef9a155a08191ba720b59c2c7e8236acf 100644
--- a/indra/newview/skins/default/xui/fr/floater_map.xml
+++ b/indra/newview/skins/default/xui/fr/floater_map.xml
@@ -1,32 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="Map" title="">
-	<floater.string name="mini_map_north">
-		N
-	</floater.string>
-	<floater.string name="mini_map_east">
-		E
-	</floater.string>
-	<floater.string name="mini_map_west">
-		O
-	</floater.string>
-	<floater.string name="mini_map_south">
-		S
-	</floater.string>
-	<floater.string name="mini_map_southeast">
-		SE
-	</floater.string>
-	<floater.string name="mini_map_northeast">
-		NE
-	</floater.string>
-	<floater.string name="mini_map_southwest">
-		SO
-	</floater.string>
-	<floater.string name="mini_map_northwest">
-		NO
-	</floater.string>
 	<floater.string name="ToolTipMsg">
 		[REGION](Carte : double-clic ; Panoramique : Maj + faire glisser)
 	</floater.string>
+	<floater.string name="AltToolTipMsg">
+		[REGION](Téléportation : double-clic ; Panoramique : Maj + faire glisser)
+	</floater.string>
 	<floater.string name="mini_map_caption">
 		MINI-CARTE
 	</floater.string>
diff --git a/indra/newview/skins/default/xui/fr/floater_tools.xml b/indra/newview/skins/default/xui/fr/floater_tools.xml
index 01274b4cbcc590ab4992c73b4a630f9fd0c1e8e9..fd72e6ac1531c137063257fb68f0df3f1cec53ef 100644
--- a/indra/newview/skins/default/xui/fr/floater_tools.xml
+++ b/indra/newview/skins/default/xui/fr/floater_tools.xml
@@ -64,6 +64,8 @@
 		<radio_item label="Choisir une face" name="radio select face"/>
 	</radio_group>
 	<check_box label="Modification liée" name="checkbox edit linked parts"/>
+	<button label="Lien" name="link_btn"/>
+	<button label="Annuler le lien" name="unlink_btn"/>
 	<text name="RenderingCost" tool_tip="Affiche le coût du rendu calculé pour cet objet">
 		þ : [COUNT]
 	</text>
diff --git a/indra/newview/skins/default/xui/fr/menu_attachment_self.xml b/indra/newview/skins/default/xui/fr/menu_attachment_self.xml
index 78198fb5a8f6e2a8c2cec399b0aba8abcc50aebc..6af2064e440d0d397986dad0de776b590a285531 100644
--- a/indra/newview/skins/default/xui/fr/menu_attachment_self.xml
+++ b/indra/newview/skins/default/xui/fr/menu_attachment_self.xml
@@ -5,7 +5,7 @@
 	<menu_item_call label="Détacher" name="Detach"/>
 	<menu_item_call label="M&apos;asseoir" name="Sit Down Here"/>
 	<menu_item_call label="Me lever" name="Stand Up"/>
-	<menu_item_call label="Changer de tenue" name="Change Outfit"/>
+	<menu_item_call label="Mon apparence" name="Change Outfit"/>
 	<menu_item_call label="Modifier ma tenue" name="Edit Outfit"/>
 	<menu_item_call label="Modifier ma silhouette" name="Edit My Shape"/>
 	<menu_item_call label="Mes amis" name="Friends..."/>
diff --git a/indra/newview/skins/default/xui/fr/menu_avatar_self.xml b/indra/newview/skins/default/xui/fr/menu_avatar_self.xml
index c7ee2e9f883428c773c5553e1b7bcb53e165297d..21528cd43b5cce2e6fad10f45ce1d38a632d1864 100644
--- a/indra/newview/skins/default/xui/fr/menu_avatar_self.xml
+++ b/indra/newview/skins/default/xui/fr/menu_avatar_self.xml
@@ -21,7 +21,7 @@
 		<context_menu label="Détacher" name="Object Detach"/>
 		<menu_item_call label="Tout détacher" name="Detach All"/>
 	</context_menu>
-	<menu_item_call label="Changer de tenue" name="Chenge Outfit"/>
+	<menu_item_call label="Mon apparence" name="Chenge Outfit"/>
 	<menu_item_call label="Modifier ma tenue" name="Edit Outfit"/>
 	<menu_item_call label="Modifier ma silhouette" name="Edit My Shape"/>
 	<menu_item_call label="Mes amis" name="Friends..."/>
diff --git a/indra/newview/skins/default/xui/fr/menu_bottomtray.xml b/indra/newview/skins/default/xui/fr/menu_bottomtray.xml
index bfdc89c5bbcf85b5ab9d0dffefd2fec7dcacfbca..ddaea517fce639e6c34e88b510afb61829e1b5cf 100644
--- a/indra/newview/skins/default/xui/fr/menu_bottomtray.xml
+++ b/indra/newview/skins/default/xui/fr/menu_bottomtray.xml
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="hide_camera_move_controls_menu">
+	<menu_item_check label="Voix activée" name="EnableVoiceChat"/>
 	<menu_item_check label="Bouton Geste" name="ShowGestureButton"/>
 	<menu_item_check label="Bouton Bouger" name="ShowMoveButton"/>
 	<menu_item_check label="Bouton Affichage" name="ShowCameraButton"/>
 	<menu_item_check label="Bouton Photo" name="ShowSnapshotButton"/>
-	<menu_item_check label="Bouton Panneau latéral" name="ShowSidebarButton"/>
 	<menu_item_check label="Bouton Construire" name="ShowBuildButton"/>
 	<menu_item_check label="Bouton Rechercher" name="ShowSearchButton"/>
 	<menu_item_check label="Bouton Carte" name="ShowWorldMapButton"/>
diff --git a/indra/newview/skins/default/xui/fr/menu_inspect_avatar_gear.xml b/indra/newview/skins/default/xui/fr/menu_inspect_avatar_gear.xml
index 17254ff325f1802100a79d37524276917b93acb5..53f22bb44a43420cf8e64ba7edba45506adc72fe 100644
--- a/indra/newview/skins/default/xui/fr/menu_inspect_avatar_gear.xml
+++ b/indra/newview/skins/default/xui/fr/menu_inspect_avatar_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="Voir le profil" name="view_profile"/>
 	<menu_item_call label="Devenir amis" name="add_friend"/>
 	<menu_item_call label="IM" name="im"/>
@@ -11,9 +11,11 @@
 	<menu_item_call label="Signaler" name="report"/>
 	<menu_item_call label="Figer" name="freeze"/>
 	<menu_item_call label="Expulser" name="eject"/>
+	<menu_item_call label="Éjecter" name="kick"/>
+	<menu_item_call label="Représentant de l&apos;Assistance client" name="csr"/>
 	<menu_item_call label="Déboguer les textures" name="debug"/>
 	<menu_item_call label="Situer sur la carte" name="find_on_map"/>
 	<menu_item_call label="Zoomer en avant" name="zoom_in"/>
 	<menu_item_call label="Payer" name="pay"/>
 	<menu_item_call label="Partager" name="share"/>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/fr/menu_inspect_self_gear.xml b/indra/newview/skins/default/xui/fr/menu_inspect_self_gear.xml
index 3bc164788a6e193b8189ea20eada2aabafa93701..ac70df472df969c40c35d2b307b1eeddf52119e8 100644
--- a/indra/newview/skins/default/xui/fr/menu_inspect_self_gear.xml
+++ b/indra/newview/skins/default/xui/fr/menu_inspect_self_gear.xml
@@ -1,10 +1,31 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu name="Gear Menu">
-	<menu_item_call label="M&apos;asseoir" name="sit_down_here"/>
-	<menu_item_call label="Me lever" name="stand_up"/>
-	<menu_item_call label="Changer de tenue" name="change_outfit"/>
-	<menu_item_call label="Mon profil" name="my_profile"/>
-	<menu_item_call label="Mes amis" name="my_friends"/>
-	<menu_item_call label="Mes groupes" name="my_groups"/>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<toggleable_menu name="Gear Menu">
+	<menu_item_call label="M&apos;asseoir" name="Sit Down Here"/>
+	<menu_item_call label="Me lever" name="Stand Up"/>
+	<context_menu label="Enlever" name="Take Off &gt;">
+		<context_menu label="Habits" name="Clothes &gt;">
+			<menu_item_call label="Chemise" name="Shirt"/>
+			<menu_item_call label="Pantalon" name="Pants"/>
+			<menu_item_call label="Jupe" name="Skirt"/>
+			<menu_item_call label="Chaussures" name="Shoes"/>
+			<menu_item_call label="Chaussettes" name="Socks"/>
+			<menu_item_call label="Veste" name="Jacket"/>
+			<menu_item_call label="Gants" name="Gloves"/>
+			<menu_item_call label="Débardeur" name="Self Undershirt"/>
+			<menu_item_call label="Caleçon" name="Self Underpants"/>
+			<menu_item_call label="Tatouage" name="Self Tattoo"/>
+			<menu_item_call label="Alpha" name="Self Alpha"/>
+			<menu_item_call label="Tous les habits" name="All Clothes"/>
+		</context_menu>
+		<context_menu label="HUD" name="Object Detach HUD"/>
+		<context_menu label="Détacher" name="Object Detach"/>
+		<menu_item_call label="Tout détacher" name="Detach All"/>
+	</context_menu>
+	<menu_item_call label="Changer de tenue" name="Chenge Outfit"/>
+	<menu_item_call label="Modifier ma tenue" name="Edit Outfit"/>
+	<menu_item_call label="Modifier ma silhouette" name="Edit My Shape"/>
+	<menu_item_call label="Mes amis" name="Friends..."/>
+	<menu_item_call label="Mes groupes" name="Groups..."/>
+	<menu_item_call label="Mon profil" name="Profile..."/>
 	<menu_item_call label="Déboguer les textures" name="Debug..."/>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/fr/menu_inventory_gear_default.xml b/indra/newview/skins/default/xui/fr/menu_inventory_gear_default.xml
index f28918ae1421eebbac64771c05266973a8ed74f3..364872c875d2ec89e04f3e06031767d0474292b2 100644
--- a/indra/newview/skins/default/xui/fr/menu_inventory_gear_default.xml
+++ b/indra/newview/skins/default/xui/fr/menu_inventory_gear_default.xml
@@ -3,6 +3,7 @@
 	<menu_item_call label="Nouvelle fenêtre d&apos;inventaire" name="new_window"/>
 	<menu_item_check label="Trier par nom" name="sort_by_name"/>
 	<menu_item_check label="Trier en commençant par le plus récent" name="sort_by_recent"/>
+	<menu_item_check label="Toujours trier les dossiers par nom" name="sort_folders_by_name"/>
 	<menu_item_check label="Dossiers système en premier" name="sort_system_folders_to_top"/>
 	<menu_item_call label="Afficher les filtres" name="show_filters"/>
 	<menu_item_call label="Réinitialiser les filtres" name="reset_filters"/>
diff --git a/indra/newview/skins/default/xui/fr/menu_object.xml b/indra/newview/skins/default/xui/fr/menu_object.xml
index a50a9df4b10dd5b88847aaa2fbac7204b603e53c..c6db48a31cfa1ad66c5f0152d0c278bcecce590b 100644
--- a/indra/newview/skins/default/xui/fr/menu_object.xml
+++ b/indra/newview/skins/default/xui/fr/menu_object.xml
@@ -16,14 +16,14 @@
 		<context_menu label="Attacher" name="Object Attach"/>
 		<context_menu label="Attacher HUD" name="Object Attach HUD"/>
 	</context_menu>
-	<context_menu label="Supprimer" name="Remove">
+	<context_menu label="Gérer" name="Remove">
 		<menu_item_call label="Signaler une infraction" name="Report Abuse..."/>
 		<menu_item_call label="Ignorer" name="Object Mute"/>
 		<menu_item_call label="Retour" name="Return..."/>
-		<menu_item_call label="Supprimer" name="Delete"/>
 	</context_menu>
 	<menu_item_call label="Prendre" name="Pie Object Take"/>
 	<menu_item_call label="Prendre une copie" name="Take Copy"/>
 	<menu_item_call label="Payer" name="Pay..."/>
 	<menu_item_call label="Acheter" name="Buy..."/>
+	<menu_item_call label="Supprimer" name="Delete"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/fr/menu_places_gear_folder.xml b/indra/newview/skins/default/xui/fr/menu_places_gear_folder.xml
index 3570bdec7f4b355fb4baceccfc4ed4a3f7921eeb..3fdf3bf3c495f31ba2ddc2b47f6a23de6180674e 100644
--- a/indra/newview/skins/default/xui/fr/menu_places_gear_folder.xml
+++ b/indra/newview/skins/default/xui/fr/menu_places_gear_folder.xml
@@ -1,7 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<menu name="menu_folder_gear">
+<toggleable_menu name="menu_folder_gear">
 	<menu_item_call label="Ajouter un repère" name="add_landmark"/>
 	<menu_item_call label="Ajouter un dossier" name="add_folder"/>
+	<menu_item_call label="Restaurer l&apos;article" name="restore_item"/>
 	<menu_item_call label="Couper" name="cut"/>
 	<menu_item_call label="Copier" name="copy_folder"/>
 	<menu_item_call label="Coller" name="paste"/>
@@ -12,4 +13,4 @@
 	<menu_item_call label="Développer tous les dossiers" name="expand_all"/>
 	<menu_item_call label="Réduire tous les dossiers" name="collapse_all"/>
 	<menu_item_check label="Trier par date" name="sort_by_date"/>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/fr/menu_places_gear_landmark.xml b/indra/newview/skins/default/xui/fr/menu_places_gear_landmark.xml
index 5491c1b3fcf7803e1073d1dd90eb68b5d039a7c9..b48f6ea693a81f7dc4ded91ba27b7954e66b58d6 100644
--- a/indra/newview/skins/default/xui/fr/menu_places_gear_landmark.xml
+++ b/indra/newview/skins/default/xui/fr/menu_places_gear_landmark.xml
@@ -1,10 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<menu name="menu_ladmark_gear">
+<toggleable_menu name="menu_ladmark_gear">
 	<menu_item_call label="Téléporter" name="teleport"/>
 	<menu_item_call label="Plus d&apos;informations" name="more_info"/>
 	<menu_item_call label="Voir sur la carte" name="show_on_map"/>
 	<menu_item_call label="Ajouter un repère" name="add_landmark"/>
 	<menu_item_call label="Ajouter un dossier" name="add_folder"/>
+	<menu_item_call label="Restaurer l&apos;article" name="restore_item"/>
 	<menu_item_call label="Couper" name="cut"/>
 	<menu_item_call label="Copier le repère" name="copy_landmark"/>
 	<menu_item_call label="Copier la SLurl" name="copy_slurl"/>
@@ -15,4 +16,4 @@
 	<menu_item_call label="Réduire tous les dossiers" name="collapse_all"/>
 	<menu_item_check label="Trier par date" name="sort_by_date"/>
 	<menu_item_call label="Créer un favori" name="create_pick"/>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/fr/menu_viewer.xml b/indra/newview/skins/default/xui/fr/menu_viewer.xml
index 65a00c2e6c61d56e38ccc0176562d88dd8aabed1..ee1ab8c60181afd649de7f21dfd6570fd816cd0b 100644
--- a/indra/newview/skins/default/xui/fr/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/fr/menu_viewer.xml
@@ -7,7 +7,7 @@
 		</menu_item_call>
 		<menu_item_call label="Acheter des L$" name="Buy and Sell L$"/>
 		<menu_item_call label="Mon profil" name="Profile"/>
-		<menu_item_call label="Changer de tenue" name="ChangeOutfit"/>
+		<menu_item_call label="Mon apparence" name="ChangeOutfit"/>
 		<menu_item_check label="Mon inventaire" name="Inventory"/>
 		<menu_item_check label="Mon inventaire" name="ShowSidetrayInventory"/>
 		<menu_item_check label="Mes gestes" name="Gestures"/>
@@ -35,6 +35,7 @@
 	<menu label="Monde" name="World">
 		<menu_item_check label="Mini-carte" name="Mini-Map"/>
 		<menu_item_check label="Carte du monde" name="World Map"/>
+		<menu_item_check label="Rechercher" name="Search"/>
 		<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">
@@ -227,8 +228,10 @@
 		<menu label="Afficher les infos" name="Display Info">
 			<menu_item_check label="Afficher l&apos;heure" name="Show Time"/>
 			<menu_item_check label="Afficher les infos de rendu" name="Show Render Info"/>
+			<menu_item_check label="Afficher les infos de texture" name="Show Texture Info"/>
 			<menu_item_check label="Afficher les matrices" name="Show Matrices"/>
 			<menu_item_check label="Afficher la couleur sous le curseur" name="Show Color Under Cursor"/>
+			<menu_item_check label="Afficher la mémoire" name="Show Memory"/>
 			<menu_item_check label="Afficher les mises à jour des objets" name="Show Updates"/>
 		</menu>
 		<menu label="Forcer une erreur" name="Force Errors">
@@ -253,6 +256,7 @@
 			<menu_item_check label="Shadow Frusta" name="Shadow Frusta"/>
 			<menu_item_check label="Occlusion" name="Occlusion"/>
 			<menu_item_check label="Lots de rendu" name="Render Batches"/>
+			<menu_item_check label="Type de mise à jour" name="Update Type"/>
 			<menu_item_check label="Texture Anim" name="Texture Anim"/>
 			<menu_item_check label="Priorité de la texture" name="Texture Priority"/>
 			<menu_item_check label="Zone de texture" name="Texture Area"/>
diff --git a/indra/newview/skins/default/xui/fr/notifications.xml b/indra/newview/skins/default/xui/fr/notifications.xml
index 603b8f0edcd3ba16d839480d95b114626abb609c..e984ea66ed2070ba90791d8addec90ce4fb98355 100644
--- a/indra/newview/skins/default/xui/fr/notifications.xml
+++ b/indra/newview/skins/default/xui/fr/notifications.xml
@@ -73,7 +73,7 @@ Détails de l&apos;erreur : La notification, appelée &apos;[_NAME]&apos;, est i
 	</notification>
 	<notification name="LoginFailedNoNetwork">
 		Connexion à [SECOND_LIFE_GRID] impossible.
-&apos;[DIAGNOSTIC]&apos;
+    &apos;[DIAGNOSTIC]&apos;
 Veuillez vérifier votre connexion Internet.
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
@@ -332,13 +332,6 @@ Pour entrer dans [SECOND_LIFE], vous devez disposer d&apos;un compte. Voulez-vou
 	<notification name="InvalidCredentialFormat">
 		Saisissez soit le nom d&apos;utilisateur soit à la fois le prénom et le nom de votre avatar dans le champ Nom d&apos;utilisateur, puis connectez-vous.
 	</notification>
-	<notification name="AddClassified">
-		Les petites annonces sont publiées à l&apos;onglet Petites annonces de la section Recherche et sur [http://secondlife.com/community/classifieds secondlife.com] pendant une semaine.
-Rédigez votre annonce, puis cliquez sur Publier pour l&apos;ajouter à la liste des annonces.
-Au moment de cliquer sur Publier, vous serez invité à payer des frais.
-Plus vous payez cher, plus votre annonce est visible dans la liste ainsi que dans les résultats de recherche de mots-clés.
-		<usetemplate ignoretext="Comment ajouter une nouvelle petite annonce" name="okcancelignore" notext="Annuler" yestext="OK"/>
-	</notification>
 	<notification name="DeleteClassified">
 		Supprimer l&apos;annonce [NAME] ?
 Une fois payés, les frais ne sont pas remboursables.
@@ -2848,9 +2841,6 @@ Ignorer les autres ?
 	<notification label="Explorer le monde" name="HintDestinationGuide">
 		Le Guide des destinations comprend des milliers d&apos;endroits nouveaux à découvrir. Sélectionnez-en un, puis cliquez sur Téléporter pour commencer à l&apos;explorer.
 	</notification>
-	<notification label="Changer d&apos;apparence" name="HintAvatarPicker">
-		Vous souhaitez changer de look ? Cliquez sur le bouton ci-dessous pour voir plus d&apos;avatars.
-	</notification>
 	<notification label="Panneau latéral" name="HintSidePanel">
 		Obtenir un accès rapide à votre inventaire, à vos habits, à vos profils et bien plus encore dans le panneau latéral.
 	</notification>
@@ -2888,6 +2878,38 @@ Ignorer les autres ?
 			<button name="cancel" text="Annuler"/>
 		</form>
 	</notification>
+	<notification label="" name="ModeChange">
+		Vous devez quitter et redémarrer l&apos;application afin de changer de mode.
+		<usetemplate name="okcancelbuttons" notext="Ne pas quitter" yestext="Quitter"/>
+	</notification>
+	<notification label="" name="NoClassifieds">
+		Pour créer et modifier des petites annonces, vous devez utiliser le mode Avancé. Voulez-vous quitter l&apos;application afin de changer de mode ? Le sélecteur de mode se trouve sur l&apos;écran de connexion.
+		<usetemplate name="okcancelbuttons" notext="Ne pas quitter" yestext="Quitter"/>
+	</notification>
+	<notification label="" name="NoGroupInfo">
+		Pour créer et modifier des groupes, vous devez utiliser le mode Avancé. Voulez-vous quitter l&apos;application afin de changer de mode ? Le sélecteur de mode se trouve sur l&apos;écran de connexion.
+		<usetemplate name="okcancelbuttons" notext="Ne pas quitter" yestext="Quitter"/>
+	</notification>
+	<notification label="" name="NoPicks">
+		Pour créer et modifier des favoris, vous devez utiliser le mode Avancé. Voulez-vous quitter l&apos;application afin de changer de mode ? Le sélecteur de mode se trouve sur l&apos;écran de connexion.
+		<usetemplate name="okcancelbuttons" notext="Ne pas quitter" yestext="Quitter"/>
+	</notification>
+	<notification label="" name="NoWorldMap">
+		Pour afficher la carte du monde, vous devez utiliser le mode Avancé. Voulez-vous quitter l&apos;application afin de changer de mode ? Le sélecteur de mode se trouve sur l&apos;écran de connexion.
+		<usetemplate name="okcancelbuttons" notext="Ne pas quitter" yestext="Quitter"/>
+	</notification>
+	<notification label="" name="NoVoiceCall">
+		Les appels vocaux sont uniquement disponibles en mode Avancé. Voulez-vous quitter l&apos;application afin de changer de mode ?
+		<usetemplate name="okcancelbuttons" notext="Ne pas quitter" yestext="Quitter"/>
+	</notification>
+	<notification label="" name="NoAvatarShare">
+		Le partage est uniquement disponible en mode Avancé. Voulez-vous quitter l&apos;application afin de changer de mode ?
+		<usetemplate name="okcancelbuttons" notext="Ne pas quitter" yestext="Quitter"/>
+	</notification>
+	<notification label="" name="NoAvatarPay">
+		Pour pouvoir payer d&apos;autres résidents, vous devez utiliser le mode Avancé. Voulez-vous quitter l&apos;application afin de changer de mode ?
+		<usetemplate name="okcancelbuttons" notext="Ne pas quitter" yestext="Quitter"/>
+	</notification>
 	<global name="UnsupportedCPU">
 		- Votre processeur ne remplit pas les conditions minimum requises.
 	</global>
diff --git a/indra/newview/skins/default/xui/fr/panel_login.xml b/indra/newview/skins/default/xui/fr/panel_login.xml
index ef55ba7991da384d73fd7ed1cc010dc755fcbadd..e54b36644c207e57509b33d0cded081414d4948e 100644
--- a/indra/newview/skins/default/xui/fr/panel_login.xml
+++ b/indra/newview/skins/default/xui/fr/panel_login.xml
@@ -17,6 +17,13 @@
 			</text>
 			<check_box label="Enregistrer" name="remember_check"/>
 			<button label="Connexion" name="connect_btn"/>
+			<text name="mode_selection_text">
+				Mode :
+			</text>
+			<combo_box name="mode_combo" tool_tip="Sélectionnez un mode. Pour une exploration facile et rapide avec chat, choisissez Basique. Pour accéder à plus de fonctionnalités, choisissez Avancé.">
+				<combo_box.item label="Basique" name="Basic"/>
+				<combo_box.item label="Avancé" name="Advanced"/>
+			</combo_box>
 			<text name="start_location_text">
 				Lieu de départ :
 			</text>
diff --git a/indra/newview/skins/default/xui/fr/panel_nearby_media.xml b/indra/newview/skins/default/xui/fr/panel_nearby_media.xml
index 66bfd01a2aa5fc6064e954caa459de2c097aa59f..7b7b67041a4343fac9967dee1e5f927d43ee2283 100644
--- a/indra/newview/skins/default/xui/fr/panel_nearby_media.xml
+++ b/indra/newview/skins/default/xui/fr/panel_nearby_media.xml
@@ -19,7 +19,7 @@
 		<button label="Arrêter" name="all_nearby_media_disable_btn" tool_tip="Désactiver tous les médias près de vous"/>
 		<button label="Lire" name="all_nearby_media_enable_btn" tool_tip="Activer tous les médias près de vous"/>
 		<button name="open_prefs_btn" tool_tip="Ouvrir les préférences de média"/>
-		<button label="Plus &gt;&gt;" label_selected="Moins &lt;&lt;" name="more_btn" tool_tip="Options avancées"/>
+		<button label="Plus &gt;&gt;" label_selected="&lt;&lt; Moins" name="more_btn" tool_tip="Options avancées"/>
 		<button label="Plus &gt;&gt;" label_selected="Moins &lt;&lt;" name="less_btn" tool_tip="Options avancées"/>
 	</panel>
 	<panel name="nearby_media_panel">
diff --git a/indra/newview/skins/default/xui/fr/panel_people.xml b/indra/newview/skins/default/xui/fr/panel_people.xml
index eecbabae2b3071eb3ca32cc230bc72ee9d57a63b..166f04b3e47ce7437342c57b6b7d4c910b6c663c 100644
--- a/indra/newview/skins/default/xui/fr/panel_people.xml
+++ b/indra/newview/skins/default/xui/fr/panel_people.xml
@@ -18,6 +18,8 @@ Pour rechercher des résidents avec qui passer du temps, utilisez [secondlife://
 	<string name="groups_filter_label" value="Filtrer les groupes"/>
 	<string name="no_filtered_groups_msg" value="Vous n&apos;avez pas trouvé ce que vous cherchiez ? Essayez [secondlife:///app/search/groups/[SEARCH_TERM] Rechercher]."/>
 	<string name="no_groups_msg" value="Vous souhaitez trouver des groupes à rejoindre ? Utilisez [secondlife:///app/search/groups Rechercher]."/>
+	<string name="MiniMapToolTipMsg" value="[REGION](Carte : double-clic ; Panoramique : Maj + faire glisser)"/>
+	<string name="AltMiniMapToolTipMsg" value="[REGION](Téléportation : double-clic ; Panoramique : Maj + faire glisser)"/>
 	<filter_editor label="Filtre" name="filter_input"/>
 	<tab_container name="tabs">
 		<panel label="PRÈS DE VOUS" name="nearby_panel">
diff --git a/indra/newview/skins/default/xui/fr/panel_profile.xml b/indra/newview/skins/default/xui/fr/panel_profile.xml
index 6b611923af1f7d9f6d1aa81bd72a1689a422e054..9aa6fe97a1e7b1c4c09edb5345467682b0781337 100644
--- a/indra/newview/skins/default/xui/fr/panel_profile.xml
+++ b/indra/newview/skins/default/xui/fr/panel_profile.xml
@@ -16,6 +16,12 @@
 	<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">
@@ -34,7 +40,7 @@
 					</text_editor>
 					<text name="title_partner_text" value="Partenaire :"/>
 					<panel name="partner_data_panel">
-						<name_box initial_value="(récupération en cours)" name="partner_text"/>
+						<text initial_value="(récupération en cours)" name="partner_text"/>
 					</panel>
 					<text name="title_groups_text" value="Groupes :"/>
 				</panel>
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 2c86dd72b65cc049f79df8950f7685fd471c0df3..2b08ae56c55885d15656e1782d986ccfa8c46b9e 100644
--- a/indra/newview/skins/default/xui/fr/panel_script_ed.xml
+++ b/indra/newview/skins/default/xui/fr/panel_script_ed.xml
@@ -15,6 +15,9 @@
 	<panel.string name="Title">
 		Script : [NAME]
 	</panel.string>
+	<panel.string name="external_editor_not_set">
+		Sélectionnez un éditeur en définissant la variable d&apos;environnement LL_SCRIPT_EDITOR ou le paramètre ExternalEditor.
+	</panel.string>
 	<menu_bar name="script_menu">
 		<menu label="Fichier" name="File">
 			<menu_item_call label="Enregistrer" name="Save"/>
diff --git a/indra/newview/skins/default/xui/fr/strings.xml b/indra/newview/skins/default/xui/fr/strings.xml
index 74c1fd8622d46e296945cabb29825341dd761220..a7c71dc0f0b00df328133549ba4dc7b63e15957c 100644
--- a/indra/newview/skins/default/xui/fr/strings.xml
+++ b/indra/newview/skins/default/xui/fr/strings.xml
@@ -1067,7 +1067,7 @@
 	<string name="PermNo">
 		Non
 	</string>
-	<string name="Chat" value=" Chat :"/>
+	<string name="Chat Message" value="Chat :"/>
 	<string name="Sound" value=" Son :"/>
 	<string name="Wait" value=" --- Attendre :"/>
 	<string name="AnimFlagStop" value=" Arrêter l&apos;animation :"/>
@@ -1864,12 +1864,6 @@
 	<string name="accel-win-shift">
 		Maj+
 	</string>
-	<string name="Esc">
-		Échap
-	</string>
-	<string name="Home">
-		Début
-	</string>
 	<string name="FileSaved">
 		Fichier enregistré
 	</string>
@@ -1889,7 +1883,7 @@
 		PDT
 	</string>
 	<string name="Direction_Forward">
-		Vers l&apos;avant
+		Avant
 	</string>
 	<string name="Direction_Left">
 		Gauche
@@ -1987,6 +1981,9 @@
 	<string name="Other">
 		Autre
 	</string>
+	<string name="Rental">
+		Location
+	</string>
 	<string name="Any">
 		Aucun
 	</string>
@@ -3966,7 +3963,7 @@ de l&apos;infraction signalée
 	<string name="Notices">
 		Notices
 	</string>
-	<string name="Chat">
+	<string name="Chat" value=" Chat :">
 		Chat
 	</string>
 	<string name="DeleteItems">
@@ -3978,4 +3975,348 @@ de l&apos;infraction signalée
 	<string name="EmptyOutfitText">
 		Cette tenue ne contient aucun article.
 	</string>
+	<string name="ExternalEditorNotSet">
+		Sélectionnez un éditeur à l&apos;aide du paramètre ExternalEditor.
+	</string>
+	<string name="ExternalEditorNotFound">
+		Éditeur externe spécifié introuvable.
+Essayez avec le chemin d&apos;accès à l&apos;éditeur entre guillemets doubles
+(par ex. : &quot;/chemin_accès/editor&quot; &quot;%s&quot;).
+	</string>
+	<string name="ExternalEditorCommandParseError">
+		Erreur lors de l&apos;analyse de la commande d&apos;éditeur externe.
+	</string>
+	<string name="ExternalEditorFailedToRun">
+		Échec d&apos;exécution de l&apos;éditeur externe.
+	</string>
+	<string name="Esc">
+		Échap
+	</string>
+	<string name="Space">
+		Space
+	</string>
+	<string name="Enter">
+		Enter
+	</string>
+	<string name="Tab">
+		Tab
+	</string>
+	<string name="Ins">
+		Ins
+	</string>
+	<string name="Del">
+		Del
+	</string>
+	<string name="Backsp">
+		Backsp
+	</string>
+	<string name="Shift">
+		Shift
+	</string>
+	<string name="Ctrl">
+		Ctrl
+	</string>
+	<string name="Alt">
+		Alt
+	</string>
+	<string name="CapsLock">
+		CapsLock
+	</string>
+	<string name="Home">
+		Début
+	</string>
+	<string name="End">
+		End
+	</string>
+	<string name="PgUp">
+		PgUp
+	</string>
+	<string name="PgDn">
+		PgDn
+	</string>
+	<string name="F1">
+		F1
+	</string>
+	<string name="F2">
+		F2
+	</string>
+	<string name="F3">
+		F3
+	</string>
+	<string name="F4">
+		F4
+	</string>
+	<string name="F5">
+		F5
+	</string>
+	<string name="F6">
+		F6
+	</string>
+	<string name="F7">
+		F7
+	</string>
+	<string name="F8">
+		F8
+	</string>
+	<string name="F9">
+		F9
+	</string>
+	<string name="F10">
+		F10
+	</string>
+	<string name="F11">
+		F11
+	</string>
+	<string name="F12">
+		F12
+	</string>
+	<string name="Add">
+		Ajouter
+	</string>
+	<string name="Subtract">
+		Soustraire
+	</string>
+	<string name="Multiply">
+		Multiplier
+	</string>
+	<string name="Divide">
+		Diviser
+	</string>
+	<string name="PAD_DIVIDE">
+		PAD_DIVIDE
+	</string>
+	<string name="PAD_LEFT">
+		PAD_LEFT
+	</string>
+	<string name="PAD_RIGHT">
+		PAD_RIGHT
+	</string>
+	<string name="PAD_DOWN">
+		PAD_DOWN
+	</string>
+	<string name="PAD_UP">
+		PAD_UP
+	</string>
+	<string name="PAD_HOME">
+		PAD_HOME
+	</string>
+	<string name="PAD_END">
+		PAD_END
+	</string>
+	<string name="PAD_PGUP">
+		PAD_PGUP
+	</string>
+	<string name="PAD_PGDN">
+		PAD_PGDN
+	</string>
+	<string name="PAD_CENTER">
+		PAD_CENTER
+	</string>
+	<string name="PAD_INS">
+		PAD_INS
+	</string>
+	<string name="PAD_DEL">
+		PAD_DEL
+	</string>
+	<string name="PAD_Enter">
+		PAD_Enter
+	</string>
+	<string name="PAD_BUTTON0">
+		PAD_BUTTON0
+	</string>
+	<string name="PAD_BUTTON1">
+		PAD_BUTTON1
+	</string>
+	<string name="PAD_BUTTON2">
+		PAD_BUTTON2
+	</string>
+	<string name="PAD_BUTTON3">
+		PAD_BUTTON3
+	</string>
+	<string name="PAD_BUTTON4">
+		PAD_BUTTON4
+	</string>
+	<string name="PAD_BUTTON5">
+		PAD_BUTTON5
+	</string>
+	<string name="PAD_BUTTON6">
+		PAD_BUTTON6
+	</string>
+	<string name="PAD_BUTTON7">
+		PAD_BUTTON7
+	</string>
+	<string name="PAD_BUTTON8">
+		PAD_BUTTON8
+	</string>
+	<string name="PAD_BUTTON9">
+		PAD_BUTTON9
+	</string>
+	<string name="PAD_BUTTON10">
+		PAD_BUTTON10
+	</string>
+	<string name="PAD_BUTTON11">
+		PAD_BUTTON11
+	</string>
+	<string name="PAD_BUTTON12">
+		PAD_BUTTON12
+	</string>
+	<string name="PAD_BUTTON13">
+		PAD_BUTTON13
+	</string>
+	<string name="PAD_BUTTON14">
+		PAD_BUTTON14
+	</string>
+	<string name="PAD_BUTTON15">
+		PAD_BUTTON15
+	</string>
+	<string name="-">
+		-
+	</string>
+	<string name="=">
+		=
+	</string>
+	<string name="`">
+		`
+	</string>
+	<string name=";">
+		;
+	</string>
+	<string name="[">
+		[
+	</string>
+	<string name="]">
+		]
+	</string>
+	<string name="\">
+		\
+	</string>
+	<string name="0">
+		0
+	</string>
+	<string name="1">
+		1
+	</string>
+	<string name="2">
+		2
+	</string>
+	<string name="3">
+		3
+	</string>
+	<string name="4">
+		4
+	</string>
+	<string name="5">
+		5
+	</string>
+	<string name="6">
+		6
+	</string>
+	<string name="7">
+		7
+	</string>
+	<string name="8">
+		8
+	</string>
+	<string name="9">
+		9
+	</string>
+	<string name="A">
+		A
+	</string>
+	<string name="B">
+		B
+	</string>
+	<string name="C">
+		C
+	</string>
+	<string name="D">
+		D
+	</string>
+	<string name="E">
+		E
+	</string>
+	<string name="F">
+		F
+	</string>
+	<string name="G">
+		G
+	</string>
+	<string name="H">
+		H
+	</string>
+	<string name="I">
+		I
+	</string>
+	<string name="J">
+		J
+	</string>
+	<string name="K">
+		K
+	</string>
+	<string name="L">
+		L
+	</string>
+	<string name="M">
+		M
+	</string>
+	<string name="N">
+		N
+	</string>
+	<string name="O">
+		O
+	</string>
+	<string name="P">
+		P
+	</string>
+	<string name="Q">
+		Q
+	</string>
+	<string name="R">
+		R
+	</string>
+	<string name="S">
+		S
+	</string>
+	<string name="T">
+		T
+	</string>
+	<string name="U">
+		U
+	</string>
+	<string name="V">
+		V
+	</string>
+	<string name="W">
+		W
+	</string>
+	<string name="X">
+		X
+	</string>
+	<string name="Y">
+		Y
+	</string>
+	<string name="Z">
+		Z
+	</string>
+	<string name="BeaconParticle">
+		Affichage des balises de particule (bleu)
+	</string>
+	<string name="BeaconPhysical">
+		Affichage des balises d&apos;objet physique (vert)
+	</string>
+	<string name="BeaconScripted">
+		Affichage des balises d&apos;objet scripté (rouge)
+	</string>
+	<string name="BeaconScriptedTouch">
+		Affichage des balises d&apos;objet scripté avec fonction de toucher (rouge)
+	</string>
+	<string name="BeaconSound">
+		Affichage des balises de son (jaune)
+	</string>
+	<string name="BeaconMedia">
+		Affichage des balises de média (blanc)
+	</string>
+	<string name="ParticleHiding">
+		Masquage des particules
+	</string>
 </strings>
diff --git a/indra/newview/skins/minimal/xui/de/floater_media_browser.xml b/indra/newview/skins/minimal/xui/de/floater_media_browser.xml
new file mode 100644
index 0000000000000000000000000000000000000000..63cf4a6cba3ea65b1e9d3dbca26ed33ff7034c7f
--- /dev/null
+++ b/indra/newview/skins/minimal/xui/de/floater_media_browser.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_about" title="MEDIEN-BROWSER">
+	<floater.string name="home_page_url">
+		http://www.secondlife.com
+	</floater.string>
+	<floater.string name="support_page_url">
+		http://support.secondlife.com
+	</floater.string>
+	<layout_stack name="stack1">
+		<layout_panel name="nav_controls">
+			<button label="Zurück" name="back"/>
+			<button label="Vorwärts" name="forward"/>
+			<button label="Neu laden" name="reload"/>
+			<button label="Los" name="go"/>
+		</layout_panel>
+		<layout_panel name="time_controls">
+			<button label="zurück" name="rewind"/>
+			<button label="anhalten" name="stop"/>
+			<button label="vorwärts" name="seek"/>
+		</layout_panel>
+		<layout_panel name="parcel_owner_controls">
+			<button label="Aktuelle Seite an Parzelle senden" name="assign"/>
+		</layout_panel>
+		<layout_panel name="external_controls">
+			<button label="In meinem Browser öffnen" name="open_browser"/>
+			<check_box label="Immer in meinem Browser öffnen" name="open_always"/>
+			<button label="Schließen" name="close"/>
+		</layout_panel>
+	</layout_stack>
+</floater>
diff --git a/indra/newview/skins/minimal/xui/de/floater_web_content.xml b/indra/newview/skins/minimal/xui/de/floater_web_content.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6ab119eeab2b9a54049181e2b9af2a198e87019d
--- /dev/null
+++ b/indra/newview/skins/minimal/xui/de/floater_web_content.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_web_content" title="">
+	<layout_stack name="stack1">
+		<layout_panel name="nav_controls">
+			<button name="back" tool_tip="Rückwärts"/>
+			<button name="forward" tool_tip="Vorwärts"/>
+			<button name="stop" tool_tip="Navigation stoppen"/>
+			<button name="reload" tool_tip="Seite neu laden"/>
+			<combo_box name="address" tool_tip="URL hier eingeben"/>
+			<icon name="media_secure_lock_flag" tool_tip="Sicheres Browsen"/>
+			<button name="popexternal" tool_tip="Aktuelle URL im Desktop-Browser öffnen"/>
+		</layout_panel>
+	</layout_stack>
+</floater>
diff --git a/indra/newview/skins/minimal/xui/de/menu_inspect_self_gear.xml b/indra/newview/skins/minimal/xui/de/menu_inspect_self_gear.xml
index 851a96cc0997e4407964b42670548c61bdfac843..443092319b5049a5ea9d7a905d202c58c4d95d31 100644
--- a/indra/newview/skins/minimal/xui/de/menu_inspect_self_gear.xml
+++ b/indra/newview/skins/minimal/xui/de/menu_inspect_self_gear.xml
@@ -1,10 +1,8 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu name="Gear Menu">
-	<menu_item_call label="Hinsetzen" name="sit_down_here"/>
-	<menu_item_call label="Aufstehen" name="stand_up"/>
-	<menu_item_call label="Outfit ändern" name="change_outfit"/>
-	<menu_item_call label="Mein Profil" name="my_profile"/>
-	<menu_item_call label="Meine Freunde" name="my_friends"/>
-	<menu_item_call label="Meine Gruppen" name="my_groups"/>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<toggleable_menu name="Self Pie">
+	<menu_item_call label="Hinsetzen" name="Sit Down Here"/>
+	<menu_item_call label="Aufstehen" name="Stand Up"/>
+	<menu_item_call label="Meine Freunde" name="Friends..."/>
+	<menu_item_call label="Mein Profil" name="Profile..."/>
 	<menu_item_call label="Fehler in Texturen beseitigen" name="Debug..."/>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/minimal/xui/de/notifications.xml b/indra/newview/skins/minimal/xui/de/notifications.xml
new file mode 100644
index 0000000000000000000000000000000000000000..1eee1d1c9b867b93e19c6d9ef6b139706fdf3a93
--- /dev/null
+++ b/indra/newview/skins/minimal/xui/de/notifications.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<notifications>
+	<notification name="UserGiveItem">
+		[NAME_SLURL] bietet Ihnen [ITEM_SLURL] an. Zur Verwendung dieses Artikels müssen Sie in den erweiterten Modus umschalten, wo Sie den Artikel in Ihrem Inventar finden werden. Um in den erweiterten Modus umzuschalten, beenden Sie die Anwendung, starten Sie sie neu und ändern Sie die Moduseinstellung auf dem Anmeldebildschirm.
+		<form name="form">
+			<button name="Show" text="Artikel behalten"/>
+			<button name="Discard" text="Artikel ablehnen"/>
+			<button name="Mute" text="Benutzer blockieren"/>
+		</form>
+	</notification>
+	<notification name="ObjectGiveItem">
+		Ein Objekt namens &lt;nolink&gt;[OBJECTFROMNAME]&lt;/nolink&gt;, das [NAME_SLURL] gehört, bietet Ihnen [ITEM_SLURL] an. Zur Verwendung dieses Artikels müssen Sie in den erweiterten Modus umschalten, wo Sie den Artikel in Ihrem Inventar finden werden. Um in den erweiterten Modus umzuschalten, beenden Sie die Anwendung, starten Sie sie neu und ändern Sie die Moduseinstellung auf dem Anmeldebildschirm.
+		<form name="form">
+			<button name="Keep" text="Artikel behalten"/>
+			<button name="Discard" text="Artikel ablehnen"/>
+			<button name="Mute" text="Objekt blockieren"/>
+		</form>
+	</notification>
+</notifications>
diff --git a/indra/newview/skins/minimal/xui/de/panel_bottomtray.xml b/indra/newview/skins/minimal/xui/de/panel_bottomtray.xml
index ea7cccbdf8957fa0355a03cea7f3a6e2b92b676f..a4d80921ece5d14f326bb65fa99b6e2f7cf9ffd2 100644
--- a/indra/newview/skins/minimal/xui/de/panel_bottomtray.xml
+++ b/indra/newview/skins/minimal/xui/de/panel_bottomtray.xml
@@ -11,10 +11,10 @@
 			<bottomtray_button label="Ansicht" name="camera_btn" tool_tip="Kamerasteuerung anzeigen/ausblenden"/>
 		</layout_panel>
 		<layout_panel name="avatar_and_destinations_panel">
-			<radio_group name="avatar_and_destination_btns">
-				<radio_item name="destination_btn" value="0"/>
-				<radio_item name="avatar_btn" value="1"/>
-			</radio_group>
+			<bottomtray_button label="Ziele" name="destination_btn" tool_tip="Zeigt Leutefenster an"/>
+		</layout_panel>
+		<layout_panel name="avatar_and_destinations_panel">
+			<bottomtray_button label="Mein Avatar" name="avatar_btn"/>
 		</layout_panel>
 		<layout_panel name="people_panel">
 			<bottomtray_button label="Leute" name="show_people_button" tool_tip="Zeigt Leutefenster an"/>
diff --git a/indra/newview/skins/minimal/xui/de/panel_group_control_panel.xml b/indra/newview/skins/minimal/xui/de/panel_group_control_panel.xml
new file mode 100644
index 0000000000000000000000000000000000000000..81e6040f84174461f81c8aae0850f990e816e851
--- /dev/null
+++ b/indra/newview/skins/minimal/xui/de/panel_group_control_panel.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_im_control_panel">
+	<layout_stack name="vertical_stack">
+		<layout_panel name="end_call_btn_panel">
+			<button label="Anruf beenden" name="end_call_btn"/>
+		</layout_panel>
+		<layout_panel name="voice_ctrls_btn_panel">
+			<button label="Voice-Steuerung öffnen" name="voice_ctrls_btn"/>
+		</layout_panel>
+	</layout_stack>
+</panel>
diff --git a/indra/newview/skins/minimal/xui/de/panel_login.xml b/indra/newview/skins/minimal/xui/de/panel_login.xml
index dff70d6994f2ca626c443bfba2efa3fe18dbfdfe..2e82453aab1efee11edeaddecf0b18fa23e09c66 100644
--- a/indra/newview/skins/minimal/xui/de/panel_login.xml
+++ b/indra/newview/skins/minimal/xui/de/panel_login.xml
@@ -20,8 +20,8 @@
 			<text name="mode_selection_text">
 				Modus:
 			</text>
-			<combo_box name="mode_combo">
-				<combo_box.item label="Einfach (Standard)" name="Basic"/>
+			<combo_box name="mode_combo" tool_tip="Wählen Sie den gewünschten Modus aus. Basis: schnelles, einfaches Erkunden und Chatten. Erweitert: Zugriff auf zusätzliche Funktionen.">
+				<combo_box.item label="Basis" name="Basic"/>
 				<combo_box.item label="Erweitert" name="Advanced"/>
 			</combo_box>
 		</layout_panel>
diff --git a/indra/newview/skins/minimal/xui/en/floater_help_browser.xml b/indra/newview/skins/minimal/xui/en/floater_help_browser.xml
index eddfe41c25627ff94e3e1431731e5fd13dfb6398..cc551f7d58448b75f4a0ce56a6d5604a9c273628 100644
--- a/indra/newview/skins/minimal/xui/en/floater_help_browser.xml
+++ b/indra/newview/skins/minimal/xui/en/floater_help_browser.xml
@@ -8,12 +8,12 @@
  min_height="360"
  left="645"
  top="10" 
- min_width="300"
+ min_width="345"
  name="floater_help_browser"
  save_rect="true"
  single_instance="true"
  title="HOW TO"
- width="300">
+ width="335">
     <floater.string
      name="loading_text">
         Loading...
@@ -29,14 +29,14 @@
      orientation="vertical" 
      name="stack1"
      top="20"
-     width="290">
+     width="325">
         <layout_panel
          layout="topleft"
          left_delta="0"
          top_delta="0"
          name="external_controls"
          user_resize="false"
-         width="280">
+         width="325">
             <web_browser
               trusted_content="true" 
              bottom="-5"
@@ -46,7 +46,7 @@
              name="browser"
              top="0"
              height="300"
-             width="280" />
+             width="325" />
         </layout_panel>
     </layout_stack>
 </floater>
diff --git a/indra/newview/skins/minimal/xui/es/floater_media_browser.xml b/indra/newview/skins/minimal/xui/es/floater_media_browser.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a7086c2d6d25108179bf931a724b7fc79749cb01
--- /dev/null
+++ b/indra/newview/skins/minimal/xui/es/floater_media_browser.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_about" title="EXPLORADOR DE MEDIA">
+	<floater.string name="home_page_url">
+		http://www.secondlife.com
+	</floater.string>
+	<floater.string name="support_page_url">
+		http://support.secondlife.com
+	</floater.string>
+	<layout_stack name="stack1">
+		<layout_panel name="nav_controls">
+			<button label="Atrás" name="back"/>
+			<button label="Adelante" name="forward"/>
+			<button label="Recargar" name="reload"/>
+			<button label="Ir" name="go"/>
+		</layout_panel>
+		<layout_panel name="time_controls">
+			<button label="rebobinar" name="rewind"/>
+			<button label="parar" name="stop"/>
+			<button label="avanzar" name="seek"/>
+		</layout_panel>
+		<layout_panel name="parcel_owner_controls">
+			<button label="Enviar a la parcela la página actual" name="assign"/>
+		</layout_panel>
+		<layout_panel name="external_controls">
+			<button label="Abrir en mi propio navegador" name="open_browser"/>
+			<check_box label="Abrir siempre en mi propio navegador" name="open_always"/>
+			<button label="Cerrar" name="close"/>
+		</layout_panel>
+	</layout_stack>
+</floater>
diff --git a/indra/newview/skins/minimal/xui/es/floater_web_content.xml b/indra/newview/skins/minimal/xui/es/floater_web_content.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b0128096794af5d9ac9b8621066770b746bfee09
--- /dev/null
+++ b/indra/newview/skins/minimal/xui/es/floater_web_content.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_web_content" title="">
+	<layout_stack name="stack1">
+		<layout_panel name="nav_controls">
+			<button name="back" tool_tip="Navegar hacia atrás"/>
+			<button name="forward" tool_tip="Navegar hacia adelante"/>
+			<button name="stop" tool_tip="Parar navegación"/>
+			<button name="reload" tool_tip="Recargar página"/>
+			<combo_box name="address" tool_tip="Escribe la URL aquí"/>
+			<icon name="media_secure_lock_flag" tool_tip="Navegación segura"/>
+			<button name="popexternal" tool_tip="Abrir la URL actual en tu explorador de escritorio"/>
+		</layout_panel>
+	</layout_stack>
+</floater>
diff --git a/indra/newview/skins/minimal/xui/es/menu_inspect_self_gear.xml b/indra/newview/skins/minimal/xui/es/menu_inspect_self_gear.xml
index c8a1e9d9da82bda2da74bcba2e93cf7b7faf3fac..1a49efb9d027903c07257b43dbd75b89f5a3838a 100644
--- a/indra/newview/skins/minimal/xui/es/menu_inspect_self_gear.xml
+++ b/indra/newview/skins/minimal/xui/es/menu_inspect_self_gear.xml
@@ -1,10 +1,8 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu name="Gear Menu">
-	<menu_item_call label="Sentarte" name="sit_down_here"/>
-	<menu_item_call label="Levantarme" name="stand_up"/>
-	<menu_item_call label="Cambiar vestuario" name="change_outfit"/>
-	<menu_item_call label="Mi perfil" name="my_profile"/>
-	<menu_item_call label="Mis amigos" name="my_friends"/>
-	<menu_item_call label="Mis grupos" name="my_groups"/>
-	<menu_item_call label="Depurar las texturas" name="Debug..."/>
-</menu>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<toggleable_menu name="Self Pie">
+	<menu_item_call label="Sentarme" name="Sit Down Here"/>
+	<menu_item_call label="Levantarme" name="Stand Up"/>
+	<menu_item_call label="Mis amigos" name="Friends..."/>
+	<menu_item_call label="Mi perfil" name="Profile..."/>
+	<menu_item_call label="Depurar texturas" name="Debug..."/>
+</toggleable_menu>
diff --git a/indra/newview/skins/minimal/xui/es/notifications.xml b/indra/newview/skins/minimal/xui/es/notifications.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b08ebb5f767be8ab80d59c2b86c36404b0b42435
--- /dev/null
+++ b/indra/newview/skins/minimal/xui/es/notifications.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<notifications>
+	<notification name="UserGiveItem">
+		[NAME_SLURL] te ofrece un/a [ITEM_SLURL]. Para utilizar este ítem, cambia al modo Avanzado y búscalo en el inventario. Para cambiar al modo Avanzado, sal de la aplicación, reiníciala y cambia el ajuste de modo en la pantalla de inicio de sesión.
+		<form name="form">
+			<button name="Show" text="Conservar ítem"/>
+			<button name="Discard" text="Rechazar ítem"/>
+			<button name="Mute" text="Bloquear usuario"/>
+		</form>
+	</notification>
+	<notification name="ObjectGiveItem">
+		Un objeto de nombre &lt;nolink&gt;[OBJECTFROMNAME]&lt;/nolink&gt;, propiedad de [NAME_SLURL], te ofrece un/a [ITEM_SLURL]. Para utilizar este ítem, cambia al modo Avanzado y búscalo en el inventario. Para cambiar al modo Avanzado, sal de la aplicación, reiníciala y cambia el ajuste de modo en la pantalla de inicio de sesión.
+		<form name="form">
+			<button name="Keep" text="Conservar ítem"/>
+			<button name="Discard" text="Rechazar ítem"/>
+			<button name="Mute" text="Bloquear objeto"/>
+		</form>
+	</notification>
+</notifications>
diff --git a/indra/newview/skins/minimal/xui/es/panel_bottomtray.xml b/indra/newview/skins/minimal/xui/es/panel_bottomtray.xml
index 9ab30b5613d6636e96f083c78ed03b89edfe1f82..f782d66ae79609ed747d7ca92b6f7214c9592c48 100644
--- a/indra/newview/skins/minimal/xui/es/panel_bottomtray.xml
+++ b/indra/newview/skins/minimal/xui/es/panel_bottomtray.xml
@@ -11,10 +11,10 @@
 			<bottomtray_button label="Visión" name="camera_btn" tool_tip="Muestra/Oculta los controles de la cámara"/>
 		</layout_panel>
 		<layout_panel name="avatar_and_destinations_panel">
-			<radio_group name="avatar_and_destination_btns">
-				<radio_item name="destination_btn" value="0"/>
-				<radio_item name="avatar_btn" value="1"/>
-			</radio_group>
+			<bottomtray_button label="Destinos" name="destination_btn" tool_tip="Muestra la ventana de gente"/>
+		</layout_panel>
+		<layout_panel name="avatar_and_destinations_panel">
+			<bottomtray_button label="Mi avatar" name="avatar_btn"/>
 		</layout_panel>
 		<layout_panel name="people_panel">
 			<bottomtray_button label="Gente" name="show_people_button" tool_tip="Muestra la ventana de gente"/>
diff --git a/indra/newview/skins/minimal/xui/es/panel_group_control_panel.xml b/indra/newview/skins/minimal/xui/es/panel_group_control_panel.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e77156b0d415248d7c2dfe3a99ca668cb0945814
--- /dev/null
+++ b/indra/newview/skins/minimal/xui/es/panel_group_control_panel.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_im_control_panel">
+	<layout_stack name="vertical_stack">
+		<layout_panel name="end_call_btn_panel">
+			<button label="Colgar" name="end_call_btn"/>
+		</layout_panel>
+		<layout_panel name="voice_ctrls_btn_panel">
+			<button label="Abrir los controles de la voz" name="voice_ctrls_btn"/>
+		</layout_panel>
+	</layout_stack>
+</panel>
diff --git a/indra/newview/skins/minimal/xui/es/panel_login.xml b/indra/newview/skins/minimal/xui/es/panel_login.xml
index 161ea19b0e99db38f1c3e813fadcd6d63f7412cb..689a71e277899738bba12b0adb353b9e1f420da1 100644
--- a/indra/newview/skins/minimal/xui/es/panel_login.xml
+++ b/indra/newview/skins/minimal/xui/es/panel_login.xml
@@ -20,8 +20,8 @@
 			<text name="mode_selection_text">
 				Modo:
 			</text>
-			<combo_box name="mode_combo">
-				<combo_box.item label="Básico (Predeterminado)" name="Basic"/>
+			<combo_box name="mode_combo" tool_tip="Selecciona el modo. Elige Básico para una exploración rápida y fácil y para chatear. Elige Avanzado para tener acceso a más funciones.">
+				<combo_box.item label="Básico" name="Basic"/>
 				<combo_box.item label="Avanzado" name="Advanced"/>
 			</combo_box>
 		</layout_panel>
diff --git a/indra/newview/skins/minimal/xui/fr/floater_media_browser.xml b/indra/newview/skins/minimal/xui/fr/floater_media_browser.xml
new file mode 100644
index 0000000000000000000000000000000000000000..ba171c6363feb3d2c569fea2a9ef96268223c28b
--- /dev/null
+++ b/indra/newview/skins/minimal/xui/fr/floater_media_browser.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_about" title="NAVIGATEUR DE MÉDIAS">
+	<floater.string name="home_page_url">
+		http://www.secondlife.com
+	</floater.string>
+	<floater.string name="support_page_url">
+		http://support.secondlife.com
+	</floater.string>
+	<layout_stack name="stack1">
+		<layout_panel name="nav_controls">
+			<button label="Préc." name="back"/>
+			<button label="Suiv." name="forward"/>
+			<button label="Recharger" name="reload"/>
+			<button label="OK" name="go"/>
+		</layout_panel>
+		<layout_panel name="time_controls">
+			<button label="retour" name="rewind"/>
+			<button label="stop" name="stop"/>
+			<button label="avance" name="seek"/>
+		</layout_panel>
+		<layout_panel name="parcel_owner_controls">
+			<button label="Envoyer la page actuelle à la parcelle" name="assign"/>
+		</layout_panel>
+		<layout_panel name="external_controls">
+			<button label="Ouvrir dans mon navigateur Web" name="open_browser"/>
+			<check_box label="Toujours ouvrir dans mon navigateur Web" name="open_always"/>
+			<button label="Fermer" name="close"/>
+		</layout_panel>
+	</layout_stack>
+</floater>
diff --git a/indra/newview/skins/minimal/xui/fr/floater_web_content.xml b/indra/newview/skins/minimal/xui/fr/floater_web_content.xml
new file mode 100644
index 0000000000000000000000000000000000000000..71f44b6ec3686cbcfb440b45887179c092b081ef
--- /dev/null
+++ b/indra/newview/skins/minimal/xui/fr/floater_web_content.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_web_content" title="">
+	<layout_stack name="stack1">
+		<layout_panel name="nav_controls">
+			<button name="back" tool_tip="Précédente"/>
+			<button name="forward" tool_tip="Suivante"/>
+			<button name="stop" tool_tip="Arrêter"/>
+			<button name="reload" tool_tip="Recharger la page"/>
+			<combo_box name="address" tool_tip="Saisir une URL ici"/>
+			<icon name="media_secure_lock_flag" tool_tip="Navigation sécurisée"/>
+			<button name="popexternal" tool_tip="Ouvrir l&apos;URL actuelle dans votre navigateur de bureau"/>
+		</layout_panel>
+	</layout_stack>
+</floater>
diff --git a/indra/newview/skins/minimal/xui/fr/menu_inspect_self_gear.xml b/indra/newview/skins/minimal/xui/fr/menu_inspect_self_gear.xml
index 3bc164788a6e193b8189ea20eada2aabafa93701..fd48aa4f7d7bb76329cd11c989bff4ceab786e62 100644
--- a/indra/newview/skins/minimal/xui/fr/menu_inspect_self_gear.xml
+++ b/indra/newview/skins/minimal/xui/fr/menu_inspect_self_gear.xml
@@ -1,10 +1,8 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu name="Gear Menu">
-	<menu_item_call label="M&apos;asseoir" name="sit_down_here"/>
-	<menu_item_call label="Me lever" name="stand_up"/>
-	<menu_item_call label="Changer de tenue" name="change_outfit"/>
-	<menu_item_call label="Mon profil" name="my_profile"/>
-	<menu_item_call label="Mes amis" name="my_friends"/>
-	<menu_item_call label="Mes groupes" name="my_groups"/>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<toggleable_menu name="Self Pie">
+	<menu_item_call label="M&apos;asseoir" name="Sit Down Here"/>
+	<menu_item_call label="Me lever" name="Stand Up"/>
+	<menu_item_call label="Mes amis" name="Friends..."/>
+	<menu_item_call label="Mon profil" name="Profile..."/>
 	<menu_item_call label="Déboguer les textures" name="Debug..."/>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/minimal/xui/fr/menu_people_nearby.xml b/indra/newview/skins/minimal/xui/fr/menu_people_nearby.xml
index 26bd3978a9bd08581bade90e0ada568019f19a48..f153ed15ae7610a6535ec3ddb0cc54ae7861923e 100644
--- a/indra/newview/skins/minimal/xui/fr/menu_people_nearby.xml
+++ b/indra/newview/skins/minimal/xui/fr/menu_people_nearby.xml
@@ -9,5 +9,5 @@
 	<menu_item_call label="Partager" name="Share"/>
 	<menu_item_call label="Payer" name="Pay"/>
 	<menu_item_check label="Ignorer/Ne plus ignorer" name="Block/Unblock"/>
-	<menu_item_call label="Proposer une téléportation" name="teleport"/>
+	<menu_item_call label="Téléporter" name="teleport"/>
 </context_menu>
diff --git a/indra/newview/skins/minimal/xui/fr/notifications.xml b/indra/newview/skins/minimal/xui/fr/notifications.xml
new file mode 100644
index 0000000000000000000000000000000000000000..41dd42c39fbba205be5a4ebcb4da46afc755dc42
--- /dev/null
+++ b/indra/newview/skins/minimal/xui/fr/notifications.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<notifications>
+	<notification name="UserGiveItem">
+		[NAME_SLURL] vous offre [ITEM_SLURL]. Pour utiliser cet article, vous devez passer en mode Avancé. L&apos;article se trouve dans votre inventaire. Pour changer de mode, quittez l&apos;application, redémarrez-la, puis sélectionnez un autre mode sur l&apos;écran de connexion.
+		<form name="form">
+			<button name="Show" text="Garder l&apos;article"/>
+			<button name="Discard" text="Refuser l&apos;article"/>
+			<button name="Mute" text="Ignorer l&apos;utilisateur"/>
+		</form>
+	</notification>
+	<notification name="ObjectGiveItem">
+		Un objet nommé &lt;nolink&gt;[OBJECTFROMNAME]&lt;/nolink&gt; appartenant à [NAME_SLURL] vous offre [ITEM_SLURL]. Pour utiliser cet article, vous devez passer en mode Avancé. L&apos;article se trouve dans votre inventaire. Pour changer de mode, quittez l&apos;application, redémarrez-la, puis sélectionnez un autre mode sur l&apos;écran de connexion.
+		<form name="form">
+			<button name="Keep" text="Garder l&apos;article"/>
+			<button name="Discard" text="Refuser l&apos;article"/>
+			<button name="Mute" text="Ignorer l&apos;objet"/>
+		</form>
+	</notification>
+</notifications>
diff --git a/indra/newview/skins/minimal/xui/fr/panel_bottomtray.xml b/indra/newview/skins/minimal/xui/fr/panel_bottomtray.xml
index 3a01571f54c93a832b28c7235a28771887ba84d2..ef62901e9912a590960bac6c846472280a90d5cd 100644
--- a/indra/newview/skins/minimal/xui/fr/panel_bottomtray.xml
+++ b/indra/newview/skins/minimal/xui/fr/panel_bottomtray.xml
@@ -11,10 +11,10 @@
 			<bottomtray_button label="Affichage" name="camera_btn" tool_tip="Affiche/Masque le contrôle de la caméra"/>
 		</layout_panel>
 		<layout_panel name="avatar_and_destinations_panel">
-			<radio_group name="avatar_and_destination_btns">
-				<radio_item name="destination_btn" value="0"/>
-				<radio_item name="avatar_btn" value="1"/>
-			</radio_group>
+			<bottomtray_button label="Destinations" name="destination_btn" tool_tip="Afficher la fenêtre des personnes."/>
+		</layout_panel>
+		<layout_panel name="avatar_and_destinations_panel">
+			<bottomtray_button label="Mon avatar" name="avatar_btn"/>
 		</layout_panel>
 		<layout_panel name="people_panel">
 			<bottomtray_button label="Personnes" name="show_people_button" tool_tip="Afficher la fenêtre des personnes."/>
diff --git a/indra/newview/skins/minimal/xui/fr/panel_group_control_panel.xml b/indra/newview/skins/minimal/xui/fr/panel_group_control_panel.xml
new file mode 100644
index 0000000000000000000000000000000000000000..676fa1d2229c358bf76f0804e064ef90e4d277c0
--- /dev/null
+++ b/indra/newview/skins/minimal/xui/fr/panel_group_control_panel.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_im_control_panel">
+	<layout_stack name="vertical_stack">
+		<layout_panel name="end_call_btn_panel">
+			<button label="Quitter l&apos;appel" name="end_call_btn"/>
+		</layout_panel>
+		<layout_panel name="voice_ctrls_btn_panel">
+			<button label="Ouvrir contrôles vocaux" name="voice_ctrls_btn"/>
+		</layout_panel>
+	</layout_stack>
+</panel>
diff --git a/indra/newview/skins/minimal/xui/fr/panel_login.xml b/indra/newview/skins/minimal/xui/fr/panel_login.xml
index cb4822e96bb9a88baeb1af647e6d08f435baa157..0869778a547b7dfcb8929663678adf19159071a4 100644
--- a/indra/newview/skins/minimal/xui/fr/panel_login.xml
+++ b/indra/newview/skins/minimal/xui/fr/panel_login.xml
@@ -20,8 +20,8 @@
 			<text name="mode_selection_text">
 				Mode :
 			</text>
-			<combo_box name="mode_combo">
-				<combo_box.item label="Basique (par défaut)" name="Basic"/>
+			<combo_box name="mode_combo" tool_tip="Sélectionnez un mode. Pour une exploration facile et rapide avec chat, choisissez Basique. Pour accéder à plus de fonctionnalités, choisissez Avancé.">
+				<combo_box.item label="Basique" name="Basic"/>
 				<combo_box.item label="Avancé" name="Advanced"/>
 			</combo_box>
 		</layout_panel>
diff --git a/indra/newview/skins/minimal/xui/pt/floater_media_browser.xml b/indra/newview/skins/minimal/xui/pt/floater_media_browser.xml
new file mode 100644
index 0000000000000000000000000000000000000000..da7428007e5b1e27f41e8b040940bb910d796662
--- /dev/null
+++ b/indra/newview/skins/minimal/xui/pt/floater_media_browser.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_about" title="NAVEGADOR DE MÍDIA">
+	<floater.string name="home_page_url">
+		http://www.secondlife.com
+	</floater.string>
+	<floater.string name="support_page_url">
+		http://support.secondlife.com
+	</floater.string>
+	<layout_stack name="stack1">
+		<layout_panel name="nav_controls">
+			<button label="Atrás" name="back"/>
+			<button label="Frente" name="forward"/>
+			<button label="Recarregar" name="reload"/>
+			<button label="OK" name="go"/>
+		</layout_panel>
+		<layout_panel name="time_controls">
+			<button label="p/ trás" name="rewind"/>
+			<button label="parar" name="stop"/>
+			<button label="p/ frente" name="seek"/>
+		</layout_panel>
+		<layout_panel name="parcel_owner_controls">
+			<button label="Enviar esta página para lote" name="assign"/>
+		</layout_panel>
+		<layout_panel name="external_controls">
+			<button label="Abrir no meu navegador" name="open_browser"/>
+			<check_box label="Abrir sempre no meu navegador" name="open_always"/>
+			<button label="Fechar" name="close"/>
+		</layout_panel>
+	</layout_stack>
+</floater>
diff --git a/indra/newview/skins/minimal/xui/pt/floater_web_content.xml b/indra/newview/skins/minimal/xui/pt/floater_web_content.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5101579c6f21e8fde127f7e08487b5f6c50a29b4
--- /dev/null
+++ b/indra/newview/skins/minimal/xui/pt/floater_web_content.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<floater name="floater_web_content" title="">
+	<layout_stack name="stack1">
+		<layout_panel name="nav_controls">
+			<button name="back" tool_tip="Navegar para trás"/>
+			<button name="forward" tool_tip="Navegar para frente"/>
+			<button name="stop" tool_tip="Parar a navegação"/>
+			<button name="reload" tool_tip="Recarregar página"/>
+			<combo_box name="address" tool_tip="Digite a URL aqui"/>
+			<icon name="media_secure_lock_flag" tool_tip="Navegação segura"/>
+			<button name="popexternal" tool_tip="Abrir a URL atual no navegador do seu computador"/>
+		</layout_panel>
+	</layout_stack>
+</floater>
diff --git a/indra/newview/skins/minimal/xui/pt/menu_inspect_self_gear.xml b/indra/newview/skins/minimal/xui/pt/menu_inspect_self_gear.xml
index 7e67f4cfd41556b197405452f418563a8970882c..c1f27e765d797fe223fc1042ae3940570ee0f400 100644
--- a/indra/newview/skins/minimal/xui/pt/menu_inspect_self_gear.xml
+++ b/indra/newview/skins/minimal/xui/pt/menu_inspect_self_gear.xml
@@ -1,10 +1,8 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu name="Gear Menu">
-	<menu_item_call label="Sentar" name="sit_down_here"/>
-	<menu_item_call label="Ficar de pé" name="stand_up"/>
-	<menu_item_call label="Trocar de look" name="change_outfit"/>
-	<menu_item_call label="Meu perfil" name="my_profile"/>
-	<menu_item_call label="Meus amigos" name="my_friends"/>
-	<menu_item_call label="Meus grupos" name="my_groups"/>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<toggleable_menu name="Self Pie">
+	<menu_item_call label="Sentar" name="Sit Down Here"/>
+	<menu_item_call label="Ficar de pé" name="Stand Up"/>
+	<menu_item_call label="Meus amigos" name="Friends..."/>
+	<menu_item_call label="Meu perfil" name="Profile..."/>
 	<menu_item_call label="Depurar texturas" name="Debug..."/>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/minimal/xui/pt/menu_people_nearby.xml b/indra/newview/skins/minimal/xui/pt/menu_people_nearby.xml
index 7c720f262bae51f07ac232916877ba5fa0bc3d09..b446a2fe81af14d3715688e821387716cb052f9a 100644
--- a/indra/newview/skins/minimal/xui/pt/menu_people_nearby.xml
+++ b/indra/newview/skins/minimal/xui/pt/menu_people_nearby.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Avatar Context Menu">
 	<menu_item_call label="Ver perfil" name="View Profile"/>
-	<menu_item_call label="Adicionar amigo..." name="Add Friend"/>
-	<menu_item_call label="Remover amigo..." name="Remove Friend"/>
-	<menu_item_call label="MI" name="IM"/>
+	<menu_item_call label="Adicionar amigo" name="Add Friend"/>
+	<menu_item_call label="Remover amigo" name="Remove Friend"/>
+	<menu_item_call label="IM" name="IM"/>
 	<menu_item_call label="Ligar" name="Call"/>
 	<menu_item_call label="Mapa" name="Map"/>
 	<menu_item_call label="Compartilhar" name="Share"/>
diff --git a/indra/newview/skins/minimal/xui/pt/notifications.xml b/indra/newview/skins/minimal/xui/pt/notifications.xml
new file mode 100644
index 0000000000000000000000000000000000000000..30ba6f68bf2fcff2508ccd7072ccbd8c1d2bf727
--- /dev/null
+++ b/indra/newview/skins/minimal/xui/pt/notifications.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<notifications>
+	<notification name="UserGiveItem">
+		[NAME_SLURL] quer lhe dar [ITEM_SLURL].  Esta ação requer o modo Avançado. Passe para o modo avançado e você verá o item em seu inventário. Para passar para o modo avançado, feche e reinicialize esse aplicativo e mude o modo (indicado na tela de login).
+		<form name="form">
+			<button name="Show" text="Guardar item"/>
+			<button name="Discard" text="Recusar item"/>
+			<button name="Mute" text="Bloquear usuário"/>
+		</form>
+	</notification>
+	<notification name="ObjectGiveItem">
+		Um objeto chamado &lt;nolink&gt;[OBJECTFROMNAME]&lt;/nolink&gt;, de [NAME_SLURL], está lhe oferecendo [ITEM_SLURL].  Esta ação requer o modo Avançado. Passe para o modo Avançado e você verá o item em seu Inventário. Para passar para o modo Avançado, feche e reinicialize esse aplicativo e mude o modo (indicado na tela de login).
+		<form name="form">
+			<button name="Keep" text="Guardar item"/>
+			<button name="Discard" text="Recusar item"/>
+			<button name="Mute" text="Bloquear objeto"/>
+		</form>
+	</notification>
+</notifications>
diff --git a/indra/newview/skins/minimal/xui/pt/panel_bottomtray.xml b/indra/newview/skins/minimal/xui/pt/panel_bottomtray.xml
index 243f323f093cb970ed15912a2f978ba2c1c5d76b..f67823dbd80dfc140b0f20d31f84b7c0eea3a940 100644
--- a/indra/newview/skins/minimal/xui/pt/panel_bottomtray.xml
+++ b/indra/newview/skins/minimal/xui/pt/panel_bottomtray.xml
@@ -11,10 +11,10 @@
 			<bottomtray_button label="Exibir" name="camera_btn" tool_tip="Mostra/oculta os controles da câmera"/>
 		</layout_panel>
 		<layout_panel name="avatar_and_destinations_panel">
-			<radio_group name="avatar_and_destination_btns">
-				<radio_item name="destination_btn" value="0"/>
-				<radio_item name="avatar_btn" value="1"/>
-			</radio_group>
+			<bottomtray_button label="Destinos" name="destination_btn" tool_tip="Exibe janela de pessoas"/>
+		</layout_panel>
+		<layout_panel name="avatar_and_destinations_panel">
+			<bottomtray_button label="Meu avatar" name="avatar_btn"/>
 		</layout_panel>
 		<layout_panel name="people_panel">
 			<bottomtray_button label="Pessoas" name="show_people_button" tool_tip="Exibe as pessoas"/>
diff --git a/indra/newview/skins/minimal/xui/pt/panel_group_control_panel.xml b/indra/newview/skins/minimal/xui/pt/panel_group_control_panel.xml
new file mode 100644
index 0000000000000000000000000000000000000000..177cee28a648d10fb6e28890de05b1eceb365923
--- /dev/null
+++ b/indra/newview/skins/minimal/xui/pt/panel_group_control_panel.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="panel_im_control_panel">
+	<layout_stack name="vertical_stack">
+		<layout_panel name="end_call_btn_panel">
+			<button label="Desligar" name="end_call_btn"/>
+		</layout_panel>
+		<layout_panel name="voice_ctrls_btn_panel">
+			<button label="Abrir controles de voz" name="voice_ctrls_btn"/>
+		</layout_panel>
+	</layout_stack>
+</panel>
diff --git a/indra/newview/skins/minimal/xui/pt/panel_login.xml b/indra/newview/skins/minimal/xui/pt/panel_login.xml
index cd529b0b066b595e1aeb8f96b76b88ff503016a6..de9717874f375926e4d46f25a17c74aec5c593f9 100644
--- a/indra/newview/skins/minimal/xui/pt/panel_login.xml
+++ b/indra/newview/skins/minimal/xui/pt/panel_login.xml
@@ -20,8 +20,8 @@
 			<text name="mode_selection_text">
 				Modo:
 			</text>
-			<combo_box name="mode_combo">
-				<combo_box.item label="Básico (padrão)" name="Basic"/>
+			<combo_box name="mode_combo" tool_tip="Selecione o modo. O modo Básico é mais rápido e ideal para explorar e conversar. Use o modo Avançado para acessar mais recursos.">
+				<combo_box.item label="Básico" name="Basic"/>
 				<combo_box.item label="Avançado" name="Advanced"/>
 			</combo_box>
 		</layout_panel>