diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp
index 5f9556a870d66810af487f69807501b362bf54c9..b1f9a18d6fbb07912d0a6fea7a93bd065a824e87 100644
--- a/indra/newview/llfloatersidepanelcontainer.cpp
+++ b/indra/newview/llfloatersidepanelcontainer.cpp
@@ -67,15 +67,17 @@ void LLFloaterSidePanelContainer::onClickCloseBtn()
 		if (parent == this )
 		{
 			LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance*>(getPanel("appearance"));
-			if ( panel_appearance )
-			{
-				panel_appearance->getWearable()->onClose();
-				panel_appearance->showOutfitsInventoryPanel();
-			}
+			panel_appearance->onClose(this);			
 		}
 	}
-	
-	LLFloater::onClickCloseBtn();
+	else
+	{
+		LLFloater::onClickCloseBtn();
+	}
+}
+void LLFloaterSidePanelContainer::close()
+{
+		LLFloater::onClickCloseBtn();
 }
 
 LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_name, const LLSD& params)
diff --git a/indra/newview/llfloatersidepanelcontainer.h b/indra/newview/llfloatersidepanelcontainer.h
index 491723471fb1109211764fe9b6757234071b9cf4..940673b643ffe640de293b9993e330ef8f3809b2 100644
--- a/indra/newview/llfloatersidepanelcontainer.h
+++ b/indra/newview/llfloatersidepanelcontainer.h
@@ -55,6 +55,8 @@ class LLFloaterSidePanelContainer : public LLFloater
 
 	LLPanel* openChildPanel(const std::string& panel_name, const LLSD& params);
 
+	void close();
+
 	static void showPanel(const std::string& floater_name, const LLSD& key);
 
 	static void showPanel(const std::string& floater_name, const std::string& panel_name, const LLSD& key);
diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp
index 0b3268eb54f795a36bcfe53ac6e21159d4d4e89d..6ff16742ddc02c41228053bc6aacb50974fdec08 100644
--- a/indra/newview/llinspectavatar.cpp
+++ b/indra/newview/llinspectavatar.cpp
@@ -292,10 +292,7 @@ void LLInspectAvatar::processAvatarData(LLAvatarData* data)
 	delete mPropertiesRequest;
 	mPropertiesRequest = NULL;
 }
-/*
-prep#
-	virtual void httpFailure()
-	*/
+
 
 void LLInspectAvatar::updateVolumeSlider()
 {
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index 74fa5a87bba7b96cf49046ce58da33e501b2bf49..53b5593ac9d8ef8c567b293222f0c9041931285a 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -48,6 +48,8 @@
 #include "llviewerregion.h"
 #include "llvoavatarself.h"
 #include "llviewerwearable.h"
+#include "llnotificationsutil.h"
+#include "llfloatersidepanelcontainer.h"
 
 static LLRegisterPanelClassWrapper<LLSidepanelAppearance> t_appearance("sidepanel_appearance");
 
@@ -70,13 +72,84 @@ class LLCurrentlyWornFetchObserver : public LLInventoryFetchItemsObserver
 	LLSidepanelAppearance *mPanel;
 };
 
+bool LLSidepanelAppearance::callBackExitWithoutSaveViaBack(const LLSD& notification, const LLSD& response)
+{
+	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+	if ( option == 0 ) 
+	{		
+		gSavedSettings.setBOOL("ExitOutfitEditWithoutSave", TRUE);		
+		LLAppearanceMgr::instance().setOutfitDirty( true );		
+		showOutfitsInventoryPanel();
+		LLAppearanceMgr::getInstance()->wearBaseOutfit();		
+		return true;
+	}
+	gSavedSettings.setBOOL("ExitOutfitEditWithoutSave", FALSE);
+	return false;
+}
+
+bool LLSidepanelAppearance::callBackExitWithoutSaveViaClose(const LLSD& notification, const LLSD& response)
+{
+	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+	if ( option == 0 ) 
+	{		
+		gSavedSettings.setBOOL("ExitOutfitEditWithoutSave", TRUE);
+		mEditWearable->revertChanges();
+		LLAppearanceMgr::getInstance()->wearBaseOutfit();
+		mLLFloaterSidePanelContainer->close();
+		return true;
+	}
+	gSavedSettings.setBOOL("ExitOutfitEditWithoutSave", FALSE);	
+	return false;
+}
+
+void LLSidepanelAppearance::onClickConfirmExitWithoutSaveViaClose()
+{
+	if ( LLAppearanceMgr::getInstance()->isOutfitDirty() && !LLAppearanceMgr::getInstance()->isOutfitLocked() )
+	{
+		LLSidepanelAppearance* pSelf = (LLSidepanelAppearance *)this;
+		LLNotificationsUtil::add("ConfirmExitWithoutSave", LLSD(), LLSD(), boost::bind(&LLSidepanelAppearance::callBackExitWithoutSaveViaClose,pSelf,_1,_2) );
+	}
+	else
+	{
+		showOutfitsInventoryPanel();
+	}
+}
+
+void LLSidepanelAppearance::onClickConfirmExitWithoutSaveViaBack()
+{
+	if ( LLAppearanceMgr::getInstance()->isOutfitDirty() && !mSidePanelJustOpened && !LLAppearanceMgr::getInstance()->isOutfitLocked() )
+	{
+		LLSidepanelAppearance* pSelf = (LLSidepanelAppearance *)this;
+		LLNotificationsUtil::add("ConfirmExitWithoutSave", LLSD(), LLSD(), boost::bind(&LLSidepanelAppearance::callBackExitWithoutSaveViaBack,pSelf,_1,_2) );
+	}
+	else
+	{
+		showOutfitsInventoryPanel();
+	}
+}
+
+void LLSidepanelAppearance::onClose(LLFloaterSidePanelContainer* obj)
+{
+	mLLFloaterSidePanelContainer = obj;
+	if ( LLAppearanceMgr::getInstance()->isOutfitDirty() && !LLAppearanceMgr::getInstance()->isOutfitLocked() )
+	{
+		LLSidepanelAppearance* pSelf = (LLSidepanelAppearance *)this;
+		LLNotificationsUtil::add("ConfirmExitWithoutSave", LLSD(), LLSD(), boost::bind(&LLSidepanelAppearance::callBackExitWithoutSaveViaClose,pSelf,_1,_2) );
+	}
+	else
+	{
+		mLLFloaterSidePanelContainer->close();
+	}
+}
+
 LLSidepanelAppearance::LLSidepanelAppearance() :
 	LLPanel(),
 	mFilterSubString(LLStringUtil::null),
 	mFilterEditor(NULL),
 	mOutfitEdit(NULL),
 	mCurrOutfitPanel(NULL),
-	mOpened(false)
+	mOpened(false),
+	mSidePanelJustOpened(true)
 {
 	LLOutfitObserver& outfit_observer =  LLOutfitObserver::instance();
 	outfit_observer.addBOFReplacedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, ""));
@@ -85,6 +158,8 @@ LLSidepanelAppearance::LLSidepanelAppearance() :
 
 	gAgentWearables.addLoadingStartedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, true));
 	gAgentWearables.addLoadedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, false));
+
+
 }
 
 LLSidepanelAppearance::~LLSidepanelAppearance()
@@ -119,8 +194,8 @@ BOOL LLSidepanelAppearance::postBuild()
 	{
 		LLButton* back_btn = mOutfitEdit->getChild<LLButton>("back_btn");
 		if (back_btn)
-		{
-			back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitsInventoryPanel, this));
+		{			
+			back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onClickConfirmExitWithoutSaveViaBack, this));
 		}
 
 	}
@@ -144,6 +219,7 @@ BOOL LLSidepanelAppearance::postBuild()
 
 	setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChange,this,_2));
 
+
 	return TRUE;
 }
 
@@ -183,6 +259,12 @@ void LLSidepanelAppearance::onOpen(const LLSD& key)
 
 void LLSidepanelAppearance::onVisibilityChange(const LLSD &new_visibility)
 {
+	//handle leaving and subsequent user verification of discarding any unsaved data
+	if ( mSidePanelJustOpened )
+	{
+		mSidePanelJustOpened = false;
+	}
+
 	LLSD visibility;
 	visibility["visible"] = new_visibility.asBoolean();
 	visibility["reset_accordion"] = false;
diff --git a/indra/newview/llsidepanelappearance.h b/indra/newview/llsidepanelappearance.h
index 762f557a8004e471b1a9f9b14a255e3f0817ff17..85e7734567538a5f5992e903725824a4d96f9f9b 100644
--- a/indra/newview/llsidepanelappearance.h
+++ b/indra/newview/llsidepanelappearance.h
@@ -38,9 +38,11 @@ class LLCurrentlyWornFetchObserver;
 class LLPanelEditWearable;
 class LLViewerWearable;
 class LLPanelOutfitsInventory;
+class LLFloaterSidePanelContainer;
 
 class LLSidepanelAppearance : public LLPanel
-{
+{	
+
 	LOG_CLASS(LLSidepanelAppearance);
 public:
 	LLSidepanelAppearance();
@@ -48,6 +50,8 @@ class LLSidepanelAppearance : public LLPanel
 
 	/*virtual*/ BOOL postBuild();
 	/*virtual*/ void onOpen(const LLSD& key);	
+				void onClose(LLFloaterSidePanelContainer* obj);
+	void onClickCloseBtn();
 
 	void refreshCurrentOutfitName(const std::string& name = "");
 
@@ -65,6 +69,11 @@ class LLSidepanelAppearance : public LLPanel
 	void updateScrollingPanelList();
 	void updateToVisibility( const LLSD& new_visibility );
 	LLPanelEditWearable* getWearable(){ return mEditWearable; }
+	bool callBackExitWithoutSaveViaBack(const LLSD& notification, const LLSD& response);
+	void onClickConfirmExitWithoutSaveViaBack();
+	bool callBackExitWithoutSaveViaClose(const LLSD& notification, const LLSD& response);
+	void onClickConfirmExitWithoutSaveViaClose();
+
 
 private:
 	void onFilterEdit(const std::string& search_string);
@@ -85,6 +94,7 @@ class LLSidepanelAppearance : public LLPanel
 	LLButton*					mOpenOutfitBtn;
 	LLButton*					mEditAppearanceBtn;
 	LLButton*					mNewOutfitBtn;
+	
 	LLPanel*					mCurrOutfitPanel;
 
 	LLTextBox*					mCurrentLookName;
@@ -99,6 +109,10 @@ class LLSidepanelAppearance : public LLPanel
 
 	// Gets set to true when we're opened for the first time.
 	bool mOpened;
+	// Set to true if sidepanel has just been opened
+	bool mSidePanelJustOpened;
+	LLFloaterSidePanelContainer* mLLFloaterSidePanelContainer;
+
 };
 
 #endif //LL_LLSIDEPANELAPPEARANCE_H
diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp
index 3c3c699d17b6b3bb0b9b4f31a0ac3162af3cfcc3..bf209df863b9a777662d3310b270a96c092331f4 100644
--- a/indra/newview/llspeakers.cpp
+++ b/indra/newview/llspeakers.cpp
@@ -855,10 +855,7 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update)
 		}
 	}
 }
-/*prep#
-	virtual void httpFailure()
-		llwarns << dumpResponse() << llendl;
-		*/
+
 void LLIMSpeakerMgr::toggleAllowTextChat(const LLUUID& speaker_id)
 {
 	LLPointer<LLSpeaker> speakerp = findSpeaker(speaker_id);
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 105bef7321aec94bcb0e5b2394bd7e6c531c24e7..2170283af2fe0d61516e204a00a1f8449892c2fa 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -10030,5 +10030,18 @@ Cannot create large prims that intersect other players.  Please re-try when othe
      name="okignore"
      yestext="OK"/>
   </notification>
+
+
+  <notification
+   icon="alertmodal.tga"
+   name="ConfirmExitWithoutSave"
+   type="alertmodal">
+    Closing this window will discard any changes you have made.
+    <tag>confirm</tag>
+    <usetemplate
+     name="okcancelbuttons"
+     notext="Cancel"
+     yestext="OK"/>
+  </notification>
   
 </notifications>