diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index e201d56815fb5da572fea8379d3f812f3ddc17e4..24886b01fb9c8bd41d10590eae4553d03b5daa47 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -4505,7 +4505,7 @@ void LLAppViewer::saveFinalSnapshot()
 
 		std::string snap_filename = gDirUtilp->getLindenUserDir();
 		snap_filename += gDirUtilp->getDirDelimiter();
-		snap_filename += SCREEN_LAST_FILENAME;
+		snap_filename += LLStartUp::getScreenLastFilename();
 		// use full pixel dimensions of viewer window (not post-scale dimensions)
 		gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, TRUE);
 		mSavedFinalSnapshot = TRUE;
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index e9d3cfa993cac079d1ab6b3f78e2dc3c2a79d88b..e34a9beb49824075171e56290de57a40090dbee1 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -210,8 +210,8 @@
 bool gAgentMovementCompleted = false;
 S32  gMaxAgentGroups;
 
-std::string SCREEN_HOME_FILENAME = "screen_home.bmp";
-std::string SCREEN_LAST_FILENAME = "screen_last.bmp";
+const std::string SCREEN_HOME_FILENAME = "screen_home%s.bmp";
+const std::string SCREEN_LAST_FILENAME = "screen_last%s.bmp";
 
 LLPointer<LLViewerTexture> gStartTexture;
 
@@ -2577,6 +2577,34 @@ bool callback_choose_gender(const LLSD& notification, const LLSD& response)
 	return false;
 }
 
+std::string get_screen_filename(const std::string& pattern)
+{
+    if (LLGridManager::getInstance()->isInProductionGrid())
+    {
+        return llformat(pattern.c_str(), "");
+    }
+    else
+    {
+        const std::string& grid_id_str = LLGridManager::getInstance()->getGridId();
+        const std::string& grid_id_lower = utf8str_tolower(grid_id_str);
+        std::string grid = "." + grid_id_lower;
+        return llformat(pattern.c_str(), grid.c_str());
+    }
+}
+
+//static
+std::string LLStartUp::getScreenLastFilename()
+{
+    return get_screen_filename(SCREEN_LAST_FILENAME);
+}
+
+//static
+std::string LLStartUp::getScreenHomeFilename()
+{
+    return get_screen_filename(SCREEN_HOME_FILENAME);
+}
+
+//static
 void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
 								   const std::string& gender_name )
 {
@@ -2674,11 +2702,11 @@ void init_start_screen(S32 location_id)
 
 	if ((S32)START_LOCATION_ID_LAST == location_id)
 	{
-		temp_str += SCREEN_LAST_FILENAME;
+		temp_str += LLStartUp::getScreenLastFilename();
 	}
 	else
 	{
-		temp_str += SCREEN_HOME_FILENAME;
+		temp_str += LLStartUp::getScreenHomeFilename();
 	}
 
 	LLPointer<LLImageBMP> start_image_bmp = new LLImageBMP;
diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h
index d434e86f827130f4216b906411468063fd1ef84e..db372070228cbf6f1f267449e921a32637038e0e 100644
--- a/indra/newview/llstartup.h
+++ b/indra/newview/llstartup.h
@@ -41,10 +41,6 @@ bool idle_startup();
 void release_start_screen();
 bool login_alert_done(const LLSD& notification, const LLSD& response);
 
-// constants, variables,  & enumerations
-extern std::string SCREEN_HOME_FILENAME;
-extern std::string SCREEN_LAST_FILENAME;
-
 // start location constants
 enum EStartLocation
 {
@@ -95,6 +91,8 @@ class LLStartUp
 	static void setStartupState( EStartupState state );
 	static EStartupState getStartupState() { return gStartupState; };
 	static std::string getStartupStateString() { return startupStateToString(gStartupState); };
+	static std::string getScreenLastFilename(); // screenshot taken on exit
+	static std::string getScreenHomeFilename(); // screenshot taken on setting Home
 
 	static void multimediaInit();
 		// Initialize LLViewerMedia multimedia engine.
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index e2554bc9bc1c91509954c73adec3040142636f9f..fd49d3b3d3760591c8d14f57803cf9f25eeb99a4 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -1588,7 +1588,7 @@ void render_disconnected_background()
 		LL_INFOS() << "Loading last bitmap..." << LL_ENDL;
 
 		std::string temp_str;
-		temp_str = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + SCREEN_LAST_FILENAME;
+		temp_str = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + LLStartUp::getScreenLastFilename();
 
 		LLPointer<LLImageBMP> image_bmp = new LLImageBMP;
 		if( !image_bmp->load(temp_str) )
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index c8f75c79c4cd3784e788d13035812cf6a616e026..b70b07761806c51fb0133115682f7406254fcfb8 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -5107,7 +5107,7 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem)
 			// save the home location image to disk
 			std::string snap_filename = gDirUtilp->getLindenUserDir();
 			snap_filename += gDirUtilp->getDirDelimiter();
-			snap_filename += SCREEN_HOME_FILENAME;
+			snap_filename += LLStartUp::getScreenHomeFilename();
 			gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, FALSE);
 		}
 		
@@ -5190,7 +5190,7 @@ static void process_special_alert_messages(const std::string & message)
 		// save the home location image to disk
 		std::string snap_filename = gDirUtilp->getLindenUserDir();
 		snap_filename += gDirUtilp->getDirDelimiter();
-		snap_filename += SCREEN_HOME_FILENAME;
+		snap_filename += LLStartUp::getScreenHomeFilename();
 		gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, FALSE);
 	}
 }