diff --git a/gui/gui.cpp b/gui/gui.cpp
index c755a98..ebd7053 100644
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -734,6 +734,7 @@
 
 int gui_changeOverlay(std::string overlay)
 {
+	LOGINFO("Set overlay: '%s'\n", overlay.c_str());
 	PageManager::ChangeOverlay(overlay);
 	gForceRender.set_value(1);
 	return 0;
diff --git a/gui/pages.cpp b/gui/pages.cpp
index 23cfcd8..7107c92 100644
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -655,7 +655,6 @@
 {
 	mResources = new ResourceManager;
 	mCurrentPage = NULL;
-	mOverlayPage = NULL;
 
 	mXmlFile = xmlFile;
 	if (xmlFile)
@@ -666,6 +665,7 @@
 
 PageSet::~PageSet()
 {
+	mOverlays.clear();
 	for (std::vector<Page*>::iterator itr = mPages.begin(); itr != mPages.end(); ++itr)
 		delete *itr;
 
@@ -931,12 +931,27 @@
 
 int PageSet::SetOverlay(Page* page)
 {
-	if (mOverlayPage)   mOverlayPage->SetPageFocus(0);
-	mOverlayPage = page;
-	if (mOverlayPage)
-	{
-		mOverlayPage->SetPageFocus(1);
-		mOverlayPage->NotifyVarChange("", "");
+	if (page) {
+		if (mOverlays.size() >= 10) {
+			LOGERR("Too many overlays requested, max is 10.\n");
+			return -1;
+		}
+		page->SetPageFocus(1);
+		page->NotifyVarChange("", "");
+
+		if (!mOverlays.empty())
+			mOverlays.back()->SetPageFocus(0);
+
+		mOverlays.push_back(page);
+	} else {
+		if (!mOverlays.empty()) {
+			mOverlays.back()->SetPageFocus(0);
+			mOverlays.pop_back();
+			if (!mOverlays.empty())
+				mOverlays.back()->SetPageFocus(1);
+			else if (mCurrentPage)
+				mCurrentPage->SetPageFocus(1); // Just in case somehow the regular page lost focus, we'll set it again
+		}
 	}
 	return 0;
 }
@@ -1055,7 +1070,14 @@
 	ret = (mCurrentPage ? mCurrentPage->Render() : -1);
 	if (ret < 0)
 		return ret;
-	ret = (mOverlayPage ? mOverlayPage->Render() : -1);
+
+	std::vector<Page*>::iterator iter;
+
+	for (iter = mOverlays.begin(); iter != mOverlays.end(); iter++) {
+		ret = ((*iter) ? (*iter)->Render() : -1);
+		if (ret < 0)
+			return ret;
+	}
 	return ret;
 }
 
@@ -1066,46 +1088,55 @@
 	ret = (mCurrentPage ? mCurrentPage->Update() : -1);
 	if (ret < 0 || ret > 1)
 		return ret;
-	ret = (mOverlayPage ? mOverlayPage->Update() : -1);
+
+	std::vector<Page*>::iterator iter;
+
+	for (iter = mOverlays.begin(); iter != mOverlays.end(); iter++) {
+		ret = ((*iter) ? (*iter)->Update() : -1);
+		if (ret < 0)
+			return ret;
+	}
 	return ret;
 }
 
 int PageSet::NotifyTouch(TOUCH_STATE state, int x, int y)
 {
-	if (mOverlayPage)
-		return (mOverlayPage->NotifyTouch(state, x, y));
+	if (!mOverlays.empty())
+		return mOverlays.back()->NotifyTouch(state, x, y);
 
 	return (mCurrentPage ? mCurrentPage->NotifyTouch(state, x, y) : -1);
 }
 
 int PageSet::NotifyKey(int key, bool down)
 {
-	if (mOverlayPage)
-		return (mOverlayPage->NotifyKey(key, down));
+	if (!mOverlays.empty())
+		return mOverlays.back()->NotifyKey(key, down);
 
 	return (mCurrentPage ? mCurrentPage->NotifyKey(key, down) : -1);
 }
 
 int PageSet::NotifyKeyboard(int key)
 {
-	if (mOverlayPage)
-		return (mOverlayPage->NotifyKeyboard(key));
+	if (!mOverlays.empty())
+		return mOverlays.back()->NotifyKeyboard(key);
 
 	return (mCurrentPage ? mCurrentPage->NotifyKeyboard(key) : -1);
 }
 
 int PageSet::SetKeyBoardFocus(int inFocus)
 {
-	if (mOverlayPage)
-		return (mOverlayPage->SetKeyBoardFocus(inFocus));
+	if (!mOverlays.empty())
+		return mOverlays.back()->SetKeyBoardFocus(inFocus);
 
 	return (mCurrentPage ? mCurrentPage->SetKeyBoardFocus(inFocus) : -1);
 }
 
 int PageSet::NotifyVarChange(std::string varName, std::string value)
 {
-	if (mOverlayPage)
-		mOverlayPage->NotifyVarChange(varName, value);
+	std::vector<Page*>::iterator iter;
+
+	for (iter = mOverlays.begin(); iter != mOverlays.end(); iter++)
+		(*iter)->NotifyVarChange(varName, value);
 
 	return (mCurrentPage ? mCurrentPage->NotifyVarChange(varName, value) : -1);
 }
diff --git a/gui/pages.hpp b/gui/pages.hpp
index 50155d0..f0b2155 100644
--- a/gui/pages.hpp
+++ b/gui/pages.hpp
@@ -115,7 +115,7 @@
 	std::vector<Page*> mPages;
 	std::vector<xml_node<>*> templates;
 	Page* mCurrentPage;
-	Page* mOverlayPage; // This is a special case, used for "locking" the screen
+	std::vector<Page*> mOverlays; // Special case for popup dialogs and the lock screen
 	std::vector<xml_document<>*> mIncludedDocs;
 };
 
