diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp
index e4291d80803d3ecd465b6209e82833054623f339..30b1d66634bb389cb9a0e31c7d3008cd7bf52259 100644
--- a/indra/llinventory/llsettingsbase.cpp
+++ b/indra/llinventory/llsettingsbase.cpp
@@ -35,7 +35,7 @@
 //=========================================================================
 namespace
 {
-    const F32 BREAK_POINT = 0.5;
+    const F64 BREAK_POINT = 0.5;
 }
 
 //=========================================================================
@@ -44,7 +44,7 @@ const std::string LLSettingsBase::SETTING_NAME("name");
 const std::string LLSettingsBase::SETTING_HASH("hash");
 const std::string LLSettingsBase::SETTING_TYPE("type");
 
-const F32Seconds LLSettingsBlender::DEFAULT_THRESHOLD(0.01);
+const F64Seconds LLSettingsBlender::DEFAULT_THRESHOLD(0.01);
 
 //=========================================================================
 LLSettingsBase::LLSettingsBase():
@@ -60,7 +60,7 @@ LLSettingsBase::LLSettingsBase(const LLSD setting) :
 }
 
 //=========================================================================
-void LLSettingsBase::lerpSettings(const LLSettingsBase &other, F32 mix) 
+void LLSettingsBase::lerpSettings(const LLSettingsBase &other, F64 mix) 
 {
     mSettings = interpolateSDMap(mSettings, other.mSettings, mix);
     setDirtyFlag(true);
@@ -140,7 +140,7 @@ LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other) cons
     return newSettings;
 }
 
-LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F32 mix) const
+LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F64 mix) const
 {
     LLSD newSettings;
 
@@ -535,9 +535,9 @@ bool LLSettingsBase::Validator::verifyQuaternionNormal(LLSD &value)
 
 bool LLSettingsBase::Validator::verifyFloatRange(LLSD &value, LLSD range)
 {
-    F32 real = value.asReal();
+    F64 real = value.asReal();
 
-    F32 clampedval = llclamp(LLSD::Real(real), range[0].asReal(), range[1].asReal());
+    F64 clampedval = llclamp(LLSD::Real(real), range[0].asReal(), range[1].asReal());
 
     if (is_approx_equal(clampedval, real))
         return true;
@@ -561,7 +561,7 @@ bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range)
 
 //=========================================================================
 
-void LLSettingsBlender::update(F32Seconds timedelta)
+void LLSettingsBlender::update(F64Seconds timedelta)
 {
     mTimeSpent += timedelta;
 
@@ -573,7 +573,7 @@ void LLSettingsBlender::update(F32Seconds timedelta)
         return;
     }
 
-    F32 blendf = fmod(mTimeSpent.value(), mSeconds.value()) / mSeconds.value();
+    F64 blendf = fmod(mTimeSpent.value(), mSeconds.value()) / mSeconds.value();
 
     mTarget->replaceSettings(mInitial->getSettings());
     mTarget->blend(mFinal, blendf);
diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h
index 2b59a103ad0efd0c5623ed6ed05400d8659c0ee6..0a20754ffbb559b9724a2631e066ae4033e1ddd0 100644
--- a/indra/llinventory/llsettingsbase.h
+++ b/indra/llinventory/llsettingsbase.h
@@ -151,7 +151,7 @@ class LLSettingsBase :
         (const_cast<LLSettingsBase *>(this))->updateSettings();
     }
 
-    virtual void blend(const ptr_t &end, F32 blendf) = 0;
+    virtual void blend(const ptr_t &end, F64 blendf) = 0;
 
     virtual bool validate();
 
@@ -198,8 +198,8 @@ class LLSettingsBase :
     typedef std::set<std::string>   stringset_t;
     
     // combining settings objects. Customize for specific setting types
-    virtual void lerpSettings(const LLSettingsBase &other, F32 mix);
-    LLSD    interpolateSDMap(const LLSD &settings, const LLSD &other, F32 mix) const;
+    virtual void lerpSettings(const LLSettingsBase &other, F64 mix);
+    LLSD    interpolateSDMap(const LLSD &settings, const LLSD &other, F64 mix) const;
 
     /// when lerping between settings, some may require special handling.  
     /// Get a list of these key to be skipped by the default settings lerp.
@@ -240,10 +240,10 @@ class LLSettingsBlender : public boost::enable_shared_from_this<LLSettingsBlende
     typedef boost::signals2::signal<void(const ptr_t &)> finish_signal_t;
     typedef boost::signals2::connection     connection_t;
 
-    static const F32Seconds DEFAULT_THRESHOLD;
+    static const F64Seconds DEFAULT_THRESHOLD;
 
     LLSettingsBlender(const LLSettingsBase::ptr_t &target,
-        const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F32Seconds seconds) :
+        const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64Seconds seconds) :
         mTarget(target),
         mInitial(initsetting),
         mFinal(endsetting),
@@ -254,23 +254,34 @@ class LLSettingsBlender : public boost::enable_shared_from_this<LLSettingsBlende
         mTimeSpent(0.0f)
     {
         mTarget->replaceSettings(mInitial->getSettings());
-        mTimeStart = F32Seconds(LLDate::now().secondsSinceEpoch());
+        mTimeStart = F64Seconds(LLDate::now().secondsSinceEpoch());
         mLastUpdate = mTimeStart;
     }
 
     ~LLSettingsBlender() {}
 
+    void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 seconds )
+    {
+        mInitial = initsetting;
+        mFinal = endsetting;
+        mSeconds.value(seconds);
+        mTarget->replaceSettings(mInitial->getSettings());
+        mTimeStart.value(LLDate::now().secondsSinceEpoch());
+        mLastUpdate = mTimeStart;
+        mTimeSpent.value(0.0f);
+    }
+
     connection_t setOnFinished(const finish_signal_t::slot_type &onfinished)
     {
         return mOnFinished.connect(onfinished);
     }
 
-    void setUpdateThreshold(F32Seconds threshold)
+    void setUpdateThreshold(F64Seconds threshold)
     {
         mBlendThreshold = threshold;
     }
 
-    F32Seconds getUpdateThreshold() const
+    F64Seconds getUpdateThreshold() const
     {
         return mBlendThreshold;
     }
@@ -290,17 +301,17 @@ class LLSettingsBlender : public boost::enable_shared_from_this<LLSettingsBlende
         return mFinal;
     }
 
-    void update(F32Seconds time);
+    void update(F64Seconds time);
 private:
     LLSettingsBase::ptr_t   mTarget;
     LLSettingsBase::ptr_t   mInitial;
     LLSettingsBase::ptr_t   mFinal;
-    F32Seconds              mSeconds;
+    F64Seconds              mSeconds;
     finish_signal_t         mOnFinished;
-    F32Seconds              mBlendThreshold;
-    F32Seconds              mLastUpdate;
-    F32Seconds              mTimeSpent;
-    F32Seconds              mTimeStart;
+    F64Seconds              mBlendThreshold;
+    F64Seconds              mLastUpdate;
+    F64Seconds              mTimeSpent;
+    F64Seconds              mTimeStart;
 };
 
 #endif
diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp
index 687210e127d55346c331523e802884c2f4071f02..180992cd2951dbdb16d1d81ecee1a64fa0384edc 100644
--- a/indra/llinventory/llsettingsdaycycle.cpp
+++ b/indra/llinventory/llsettingsdaycycle.cpp
@@ -104,11 +104,14 @@ const std::string LLSettingsDay::SETTING_KEYHASH("key_hash");
 const std::string LLSettingsDay::SETTING_TRACKS("tracks");
 const std::string LLSettingsDay::SETTING_FRAMES("frames");
 
-const S64 LLSettingsDay::MINIMUM_DAYLENGTH(  300); // 5 mins
-
-//const S64 LLSettingsDay::MINIMUM_DAYLENGTH( 14400); // 4 hours
+const S64 LLSettingsDay::MINIMUM_DAYLENGTH(   300); // 5 mins
+const S64 LLSettingsDay::DEFAULT_DAYLENGTH( 14400); // 4 hours
 const S64 LLSettingsDay::MAXIMUM_DAYLENGTH(604800); // 7 days
 
+const S32 LLSettingsDay::MINIMUM_DAYOFFSET(    0);
+const S32 LLSettingsDay::DEFAULT_DAYOFFSET(57600);  // +16 hours == -8 hours (SLT time offset)
+const S32 LLSettingsDay::MAXIMUM_DAYOFFSET(86400);  // 24 hours
+
 const S32 LLSettingsDay::TRACK_WATER(0);   // water track is 0
 const S32 LLSettingsDay::TRACK_MAX(5);     // 5 tracks, 4 skys, 1 water
 const S32 LLSettingsDay::FRAME_MAX(56);
@@ -116,14 +119,18 @@ const S32 LLSettingsDay::FRAME_MAX(56);
 //=========================================================================
 LLSettingsDay::LLSettingsDay(const LLSD &data) :
     LLSettingsBase(data),
-    mInitialized(false)
+    mInitialized(false),
+    mDayLength(DEFAULT_DAYLENGTH),
+    mDayOffset(DEFAULT_DAYOFFSET)
 {
     mDayTracks.resize(TRACK_MAX);
 }
 
 LLSettingsDay::LLSettingsDay() :
     LLSettingsBase(),
-    mInitialized(false)
+    mInitialized(false),
+    mDayLength(DEFAULT_DAYLENGTH),
+    mDayOffset(DEFAULT_DAYOFFSET)
 {
     mDayTracks.resize(TRACK_MAX);
 }
@@ -266,7 +273,7 @@ LLSD LLSettingsDay::defaults()
     return dfltsetting;
 }
 
-void LLSettingsDay::blend(const LLSettingsBase::ptr_t &other, F32 mix)
+void LLSettingsDay::blend(const LLSettingsBase::ptr_t &other, F64 mix)
 {
     LL_ERRS("DAYCYCLE") << "Day cycles are not blendable!" << LL_ENDL;
 }
@@ -337,19 +344,30 @@ LLSettingsDay::validation_list_t LLSettingsDay::getValidationList() const
     return validation;
 }
 
+LLSettingsDay::CycleTrack_t &LLSettingsDay::getCycleTrack(S32 track)
+{
+    static CycleTrack_t emptyTrack;
+    if (mDayTracks.size() <= track)
+        return emptyTrack;
+
+    return mDayTracks[track];
+}
+
 //=========================================================================
 F32 LLSettingsDay::secondsToKeyframe(S64Seconds seconds)
 {
     S64Seconds daylength = getDayLength();
+    S64Seconds dayoffset = getDayOffset();
 
-    return llclamp(static_cast<F32>(seconds.value() % daylength.value()) / static_cast<F32>(daylength.value()), 0.0f, 1.0f);
+    return llclamp(static_cast<F32>((seconds.value() + dayoffset.value()) % daylength.value()) / static_cast<F32>(daylength.value()), 0.0f, 1.0f);
 }
 
 F64Seconds LLSettingsDay::keyframeToSeconds(F32 keyframe)
 {
     S64Seconds daylength = getDayLength();
+    S64Seconds dayoffset = getDayOffset();
 
-    return F64Seconds(static_cast<S32>(keyframe * static_cast<F32>(daylength.value())));
+    return F64Seconds(static_cast<S64>(keyframe * static_cast<F32>(daylength.value())) - dayoffset.value());
 }
 
 //=========================================================================
@@ -424,13 +442,6 @@ void LLSettingsDay::updateSettings()
 }
 
 //=========================================================================
-void LLSettingsDay::setDayLength(S64Seconds seconds)
-{
-    S32 val = llclamp(seconds.value(), MINIMUM_DAYLENGTH, MAXIMUM_DAYLENGTH);
-
-    setValue(SETTING_DAYLENGTH, val);
-}
-
 LLSettingsDay::KeyframeList_t LLSettingsDay::getTrackKeyframes(S32 trackno)
 {
     if ((trackno < 1) || (trackno >= TRACK_MAX))
diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h
index 3b24ce9f9749efbbe1ae72c1617101afb355169c..ae47a542708eb5f5b5ed90c3fbf586c163dd2919 100644
--- a/indra/llinventory/llsettingsdaycycle.h
+++ b/indra/llinventory/llsettingsdaycycle.h
@@ -48,8 +48,13 @@ class LLSettingsDay : public LLSettingsBase
     static const std::string    SETTING_FRAMES;
 
     static const S64            MINIMUM_DAYLENGTH;
+    static const S64            DEFAULT_DAYLENGTH;
     static const S64            MAXIMUM_DAYLENGTH;
 
+    static const S32            MINIMUM_DAYOFFSET;
+    static const S32            DEFAULT_DAYOFFSET;
+    static const S32            MAXIMUM_DAYOFFSET;
+
     static const S32            TRACK_WATER;
     static const S32            TRACK_MAX;
     static const S32            FRAME_MAX;
@@ -74,17 +79,30 @@ class LLSettingsDay : public LLSettingsBase
     virtual std::string         getSettingType() const { return std::string("daycycle"); }
 
     // Settings status 
-    virtual void                blend(const LLSettingsBase::ptr_t &other, F32 mix);
+    virtual void                blend(const LLSettingsBase::ptr_t &other, F64 mix);
 
     static LLSD                 defaults();
 
     //---------------------------------------------------------------------
     S64Seconds getDayLength() const
     {
-        return S64Seconds(mSettings[SETTING_DAYLENGTH].asInteger());
+        return mDayLength;
+    }
+
+    void setDayLength(S64Seconds seconds)
+    {
+        mDayLength = seconds;
+    }
+
+    S64Seconds getDayOffset() const
+    {
+        return mDayOffset;
     }
 
-    void setDayLength(S64Seconds seconds);
+    void setDayOffset(S64Seconds seconds)
+    {
+        mDayOffset = seconds;
+    }
 
     KeyframeList_t              getTrackKeyframes(S32 track);
     TimeList_t                  getTrackTimes(S32 track);
@@ -117,6 +135,7 @@ class LLSettingsDay : public LLSettingsBase
     virtual LLSettingsWaterPtr_t getNamedWater(const std::string &) const = 0;
 
     void    setInitialized(bool value = true) { mInitialized = value; }
+    CycleTrack_t &              getCycleTrack(S32 track);
 protected:
     LLSettingsDay();
 
@@ -137,6 +156,9 @@ class LLSettingsDay : public LLSettingsBase
 
     F64Seconds                  mLastUpdateTime;
 
+    S64Seconds                  mDayLength; 
+    S64Seconds                  mDayOffset;
+
     F32                         secondsToKeyframe(S64Seconds seconds);
     F64Seconds                  keyframeToSeconds(F32 keyframe);
 
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index ecc89165e811c59d3a66e11dc898cbaf436c631d..7fc9d83cae56adca05dcf2a7ca7f58a7d83f5678 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -96,7 +96,7 @@ LLSettingsSky::LLSettingsSky():
 {
 }
 
-void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F32 blendf) 
+void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) 
 {
     LLSettingsSky::ptr_t other = boost::static_pointer_cast<LLSettingsSky>(end);
     LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf);
diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h
index ff4b62f86e36abcf3baa0b1e108fbe67a45a64ac..12ea237ef307fcb70612f5dbb7abe73e08e6eb0e 100644
--- a/indra/llinventory/llsettingssky.h
+++ b/indra/llinventory/llsettingssky.h
@@ -75,7 +75,7 @@ class LLSettingsSky: public LLSettingsBase
     virtual std::string getSettingType() const { return std::string("sky"); }
 
     // Settings status 
-    virtual void blend(const LLSettingsBase::ptr_t &end, F32 blendf);
+    virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf);
     
     static LLSD defaults();
 
@@ -410,6 +410,10 @@ class LLSettingsSky: public LLSettingsBase
     }
 
 protected:
+    static const std::string SETTING_LEGACY_EAST_ANGLE;
+    static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL;
+    static const std::string SETTING_LEGACY_SUN_ANGLE;
+
     LLSettingsSky();
 
     virtual stringset_t getSlerpKeys() const;
@@ -421,10 +425,6 @@ class LLSettingsSky: public LLSettingsBase
     static LLSD     translateLegacySettings(LLSD legacy);
 
 private:
-    static const std::string SETTING_LEGACY_EAST_ANGLE;
-    static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL;
-    static const std::string SETTING_LEGACY_SUN_ANGLE;
-
     static const F32         NIGHTTIME_ELEVATION;
     static const F32         NIGHTTIME_ELEVATION_COS;
 
diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp
index 1b960746d57970ce42ccc828fdd5a78e40d31935..00f870bbb06c5b448647e6e4e08cf8e4756dbd82 100644
--- a/indra/llinventory/llsettingswater.cpp
+++ b/indra/llinventory/llsettingswater.cpp
@@ -159,7 +159,7 @@ LLSD LLSettingsWater::translateLegacySettings(LLSD legacy)
     return newsettings;
 }
 
-void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F32 blendf) 
+void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf) 
 {
     LLSettingsWater::ptr_t other = boost::static_pointer_cast<LLSettingsWater>(end);
     LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf);
diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h
index 5d6a482d56f3db495af63b7085dd31888837820d..d18caf68b199989b67a480fcac664748cf7668c0 100644
--- a/indra/llinventory/llsettingswater.h
+++ b/indra/llinventory/llsettingswater.h
@@ -60,7 +60,7 @@ class LLSettingsWater : public LLSettingsBase
     virtual std::string getSettingType() const { return std::string("water"); }
 
     // Settings status 
-    virtual void blend(const LLSettingsBase::ptr_t &end, F32 blendf);
+    virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf);
 
     static LLSD defaults();
 
@@ -199,16 +199,6 @@ class LLSettingsWater : public LLSettingsBase
     }
 
 protected:
-    LLSettingsWater();
-
-    virtual validation_list_t getValidationList() const;
-
-    static LLSD         translateLegacySettings(LLSD legacy);
-
-    LLVector4           mWaterPlane;
-    F32                 mWaterFogKS;
-
-private:
     static const std::string SETTING_LEGACY_BLUR_MULTIPILER;
     static const std::string SETTING_LEGACY_FOG_COLOR;
     static const std::string SETTING_LEGACY_FOG_DENSITY;
@@ -222,6 +212,17 @@ class LLSettingsWater : public LLSettingsBase
     static const std::string SETTING_LEGACY_WAVE1_DIR;
     static const std::string SETTING_LEGACY_WAVE2_DIR;
 
+    LLSettingsWater();
+
+    virtual validation_list_t getValidationList() const;
+
+    static LLSD         translateLegacySettings(LLSD legacy);
+
+    LLVector4           mWaterPlane;
+    F32                 mWaterFogKS;
+
+private:
+
 };
 
 #endif
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index e8c9db045c8286011411f71098953b9df5601352..e14265d950d1771425e985bb9afe6730033c2250 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -45,8 +45,11 @@
 #include "lldiriterator.h"
 
 #include "llsettingsvo.h"
+#include "llnotificationsutil.h"
 
 #include <boost/make_shared.hpp>
+
+#define EXPORT_PRESETS 1
 //=========================================================================
 namespace
 {
@@ -75,7 +78,9 @@ LLEnvironment::LLEnvironment():
     mDayCycleByName(),
     mDayCycleById(),
     mUserPrefs(),
-    mSelectedEnvironment(ENV_LOCAL)
+    mSelectedEnvironment(ENV_LOCAL),
+    mDayLength(LLSettingsDay::DEFAULT_DAYLENGTH),
+    mDayOffset(LLSettingsDay::DEFAULT_DAYOFFSET)
 {
     mSetSkys.resize(ENV_END);
     mSetWater.resize(ENV_END);
@@ -146,7 +151,8 @@ void LLEnvironment::onRegionChange()
 
 void LLEnvironment::requestRegionEnvironment()
 {
-    LLEnvironmentRequest::initiate();
+//    LLEnvironmentRequest::initiate();
+    requestRegion();
 }
 
 void LLEnvironment::onLegacyRegionSettings(LLSD data)
@@ -182,6 +188,20 @@ bool LLEnvironment::getIsDayTime() const
     return mCurrentSky->getSunDirection().mV[2] > NIGHTTIME_ELEVATION_COS;
 }
 
+void LLEnvironment::setDayLength(S64Seconds seconds)
+{
+    mDayLength = seconds;
+    if (mCurrentDay)
+        mCurrentDay->setDayLength(mDayLength);
+}
+
+void LLEnvironment::setDayOffset(S64Seconds seconds)
+{
+    mDayOffset = seconds;
+    if (mCurrentDay)
+        mCurrentDay->setDayOffset(seconds);
+}
+
 //-------------------------------------------------------------------------
 void LLEnvironment::update(const LLViewerCamera * cam)
 {
@@ -455,6 +475,8 @@ void LLEnvironment::selectDayCycle(const LLSettingsDay::ptr_t &daycycle, F32Seco
     }
 
     mCurrentDay = daycycle;
+    mCurrentDay->setDayLength(mDayLength);
+    mCurrentDay->setDayOffset(mDayOffset);
 
     daycycle->startDayCycle();
     selectWater(daycycle->getCurrentWater(), transition);
@@ -740,6 +762,238 @@ LLSettingsDay::ptr_t LLEnvironment::findDayCycleByName(std::string name) const
     return boost::static_pointer_cast<LLSettingsDay>((*it).second);
 }
 
+
+void LLEnvironment::applyEnvironment(LLSD environment)
+{
+    LL_WARNS("ENVIRONMENT") << "Have environment" << LL_ENDL;
+
+    S32 daylength(LLSettingsDay::DEFAULT_DAYLENGTH);
+    S32 dayoffset(LLSettingsDay::DEFAULT_DAYOFFSET);
+
+    if (environment.has("day_length"))
+        daylength = environment["day_length"].asInteger();
+    if (environment.has("day_offset"))
+        dayoffset = environment["day_cycle"].asInteger();
+
+    setDayLength(S64Seconds(daylength));
+    setDayOffset(S64Seconds(dayoffset));
+
+    if (environment.has("day_cycle"))
+    {
+        LLSettingsDay::ptr_t pday = LLSettingsVODay::buildFromEnvironmentMessage(environment["day_cycle"]);
+
+        if (pday)
+            selectDayCycle(pday);
+    }
+
+    /*TODO: track_altitudes*/
+}
+
+//=========================================================================
+void LLEnvironment::requestRegion()
+{
+    if (gAgent.getRegionCapability("ExtEnvironment").empty())
+    {
+        LLEnvironmentRequest::initiate();
+        return;
+    }
+
+    requestParcel(LLUUID::null);
+}
+
+void LLEnvironment::updateRegion(LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset)
+{
+    if (gAgent.getRegionCapability("ExtEnvironment").empty())
+    {
+        LLEnvironmentApply::initiateRequest( LLSettingsVODay::convertToLegacy(pday) );
+        return;
+    }
+
+    updateParcel(LLUUID::null, pday, day_length, day_offset);
+}
+
+void LLEnvironment::resetRegion()
+{
+    resetParcel(LLUUID::null);
+}
+
+void LLEnvironment::requestParcel(const LLUUID &parcel_id)
+{
+    std::string coroname =
+        LLCoros::instance().launch("LLEnvironment::coroRequestEnvironment",
+        boost::bind(&LLEnvironment::coroRequestEnvironment, this, parcel_id));
+
+}
+
+void LLEnvironment::updateParcel(const LLUUID &parcel_id, LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset)
+{
+    std::string coroname =
+        LLCoros::instance().launch("LLEnvironment::coroUpdateEnvironment",
+        boost::bind(&LLEnvironment::coroUpdateEnvironment, this, parcel_id, pday, day_length, day_offset));
+
+}
+
+void LLEnvironment::resetParcel(const LLUUID &parcel_id)
+{
+    std::string coroname =
+        LLCoros::instance().launch("LLEnvironment::coroResetEnvironment",
+        boost::bind(&LLEnvironment::coroResetEnvironment, this, parcel_id));
+
+}
+
+void LLEnvironment::coroRequestEnvironment(LLUUID parcel_id)
+{
+    LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
+    LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+        httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("ResetEnvironment", httpPolicy));
+    LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
+
+    std::string url = gAgent.getRegionCapability("ExtEnvironment");
+    if (url.empty())
+        return;
+
+    if (!parcel_id.isNull())
+        url += "?parcelid=" + parcel_id.asString();
+
+    LLSD result = httpAdapter->getAndSuspend(httpRequest, url);
+    // results that come back may contain the new settings
+
+    LLSD notify;
+
+    LLSD httpResults = result["http_result"];
+    LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+    if (!status)
+    {
+        LL_WARNS("WindlightCaps") << "Couldn't retrieve Windlight settings for " << (parcel_id.isNull() ? ("region!") : ("parcel!")) << LL_ENDL;
+
+        std::stringstream msg;
+        msg << status.toString() << " (Code " << status.toTerseString() << ")";
+        notify = LLSD::emptyMap();
+        notify["FAIL_REASON"] = msg.str();
+
+    }
+    else
+    {
+        LLSD environment = result["environment"];
+        if (environment.isDefined())
+        {
+            applyEnvironment(environment);
+        }
+    }
+
+    if (!notify.isUndefined())
+    {
+        LLNotificationsUtil::add("WLRegionApplyFail", notify);
+        //LLEnvManagerNew::instance().onRegionSettingsApplyResponse(false);
+    }
+}
+
+void LLEnvironment::coroUpdateEnvironment(LLUUID parcel_id, LLSettingsDay::ptr_t pday, S32 day_length, S32 day_offset)
+{
+    LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
+    LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+        httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("ResetEnvironment", httpPolicy));
+    LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
+
+    std::string url = gAgent.getRegionCapability("ExtEnvironment");
+    if (url.empty())
+        return;
+
+    LLSD body(LLSD::emptyMap());
+    body["environment"] = LLSD::emptyMap();
+
+    if (day_length >= 0)
+        body["environment"]["day_length"] = day_length;
+    if (day_offset >= 0)
+        body["environment"]["day_offset"] = day_offset;
+    if (pday)
+        body["environment"]["day_cycle"] = pday->getSettings();
+
+
+    if (!parcel_id.isNull())
+        url += "?parcelid=" + parcel_id.asString();
+
+    LLSD result = httpAdapter->putAndSuspend(httpRequest, url, body);
+    // results that come back may contain the new settings
+
+    LLSD notify;
+
+    LLSD httpResults = result["http_result"];
+    LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+    if (!status)
+    {
+        LL_WARNS("WindlightCaps") << "Couldn't update Windlight settings for " << (parcel_id.isNull() ? ("region!") : ("parcel!")) << LL_ENDL;
+
+        std::stringstream msg;
+        msg << status.toString() << " (Code " << status.toTerseString() << ")";
+        notify = LLSD::emptyMap();
+        notify["FAIL_REASON"] = msg.str();
+    }
+    else
+    {
+        LLSD environment = result["environment"];
+        if (environment.isDefined())
+        {
+            applyEnvironment(environment);
+        }
+    }
+
+    if (!notify.isUndefined())
+    {
+        LLNotificationsUtil::add("WLRegionApplyFail", notify);
+        //LLEnvManagerNew::instance().onRegionSettingsApplyResponse(false);
+    }
+}
+
+void LLEnvironment::coroResetEnvironment(LLUUID parcel_id)
+{
+    LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
+    LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+        httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("ResetEnvironment", httpPolicy));
+    LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
+
+    std::string url = gAgent.getRegionCapability("ExtEnvironment");
+    if (url.empty())
+        return;
+
+    if (!parcel_id.isNull())
+        url += "?parcelid=" + parcel_id.asString();
+
+    LLSD result = httpAdapter->deleteAndSuspend(httpRequest, url);
+    // results that come back may contain the new settings
+
+    LLSD notify; 
+
+    LLSD httpResults = result["http_result"];
+    LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+    if (!status)
+    {
+        LL_WARNS("WindlightCaps") << "Couldn't reset Windlight settings in " << (parcel_id.isNull() ? ("region!") : ("parcel!"))  << LL_ENDL;
+
+        std::stringstream msg;
+        msg << status.toString() << " (Code " << status.toTerseString() << ")";
+        notify = LLSD::emptyMap();
+        notify["FAIL_REASON"] = msg.str();
+        
+    }
+    else
+    {
+        LLSD environment = result["environment"];
+        if (environment.isDefined())
+        {
+            applyEnvironment(environment);
+        }        
+    }
+
+    if (!notify.isUndefined())
+    {
+        LLNotificationsUtil::add("WLRegionApplyFail", notify);
+        //LLEnvManagerNew::instance().onRegionSettingsApplyResponse(false);
+    }
+
+}
+
+
 //=========================================================================
 LLEnvironment::UserPrefs::UserPrefs():
     mUseRegionSettings(true),
@@ -906,6 +1160,18 @@ void LLEnvironment::legacyLoadAllPresets()
 
                 LLSettingsDay::ptr_t day = LLSettingsVODay::buildFromLegacyPreset(name, data);
                 LLEnvironment::instance().addDayCycle(day);
+
+#ifdef EXPORT_PRESETS
+                std::string exportfile = LLURI::escape(name) + "(new).xml";
+                std::string exportpath = gDirUtilp->add(getSysDir("new"), exportfile);
+
+                LLSD settings = day->getSettings();
+
+                std::ofstream daycyclefile(exportpath);
+                LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
+                formatter->format(settings, daycyclefile, LLSDFormatter::OPTIONS_PRETTY);
+                daycyclefile.close();
+#endif
             }
         }
     }
diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h
index 4d3d1f6a57d265255b2da525f53b653a5b9dc558..9e9c05b19480adbdf5381950d86a05c20e398d5e 100644
--- a/indra/newview/llenvironment.h
+++ b/indra/newview/llenvironment.h
@@ -181,6 +181,10 @@ class LLEnvironment : public LLSingleton<LLEnvironment>
     inline LLVector4            getClampedLightDirection() const { return LLVector4(mCurrentSky->getClampedLightDirection(), 0.0f); }
     inline LLVector4            getRotatedLight() const { return mRotatedLight; }
 
+    inline S64Seconds           getDayLength() const { return mDayLength; }
+    void                        setDayLength(S64Seconds seconds);
+    inline S64Seconds           getDayOffset() const { return mDayOffset; }
+    void                        setDayOffset(S64Seconds seconds);
     //-------------------------------------------
     connection_t                setSkyListChange(const change_signal_t::slot_type& cb);
     connection_t                setWaterListChange(const change_signal_t::slot_type& cb);
@@ -190,6 +194,13 @@ class LLEnvironment : public LLSingleton<LLEnvironment>
 
     void                        onLegacyRegionSettings(LLSD data);
 
+    void                        requestRegion();
+    void                        updateRegion(LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset);
+    void                        resetRegion();
+    void                        requestParcel(const LLUUID &parcel_id);
+    void                        updateParcel(const LLUUID &parcel_id, LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset);
+    void                        resetParcel(const LLUUID &parcel_id);
+
 protected:
     virtual void                initSingleton();
 
@@ -254,6 +265,9 @@ class LLEnvironment : public LLSingleton<LLEnvironment>
     change_signal_t             mWaterListChange;
     change_signal_t             mDayCycleListChange;
 
+    S64Seconds                  mDayLength;
+    S64Seconds                  mDayOffset;
+
     void onSkyTransitionDone(const LLSettingsBlender::ptr_t &blender);
     void onWaterTransitionDone(const LLSettingsBlender::ptr_t &blender);
 
@@ -278,6 +292,12 @@ class LLEnvironment : public LLSingleton<LLEnvironment>
 
     void onRegionChange();
 
+    void coroRequestEnvironment(LLUUID parcel_id);
+    void coroUpdateEnvironment(LLUUID parcel_id, LLSettingsDay::ptr_t pday, S32 day_length, S32 day_offset);
+    void coroResetEnvironment(LLUUID parcel_id);
+
+    void applyEnvironment(LLSD environment);
+
     //=========================================================================
     void                        legacyLoadAllPresets();
     LLSD                        legacyLoadPreset(const std::string& path);
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 76a67545738729fc53fe0efd49e065884d56ef18..cd32aa07a881d671bae1d508cb6e7a7d4fcbfc88 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -43,6 +43,30 @@
 #include "llenvironment.h"
 #include "llsky.h"
 
+#undef  VERIFY_LEGACY_CONVERSION
+
+//=========================================================================
+namespace 
+{
+LLSD ensureArray4(LLSD in, F32 fill)
+{
+    if (in.size() >= 4)
+        return in;
+    
+    LLSD out(LLSD::emptyArray());
+    
+    for (S32 idx = 0; idx < in.size(); ++idx)
+    {
+        out.append(in[idx]);
+    }
+    
+    while (out.size() < 4)
+    {
+        out.append(LLSD::Real(fill));
+    }
+    return out;
+}
+}
 //=========================================================================
 LLSettingsVOSky::LLSettingsVOSky(const LLSD &data):
     LLSettingsSky(data)
@@ -64,6 +88,18 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPreset(const std::string &n
 
     LLSettingsSky::ptr_t skyp = boost::make_shared<LLSettingsVOSky>(newsettings);
 
+#ifdef VERIFY_LEGACY_CONVERSION
+    LLSD oldsettings = LLSettingsVOSky::convertToLegacy(skyp);
+
+    if (!llsd_equals(legacy, oldsettings))
+    {
+        LL_WARNS("SKY") << "Conversion to/from legacy does not match!\n" 
+            << "Old: " << legacy
+            << "new: " << oldsettings << LL_ENDL;
+    }
+
+#endif
+
     if (skyp->validate())
         return skyp;
 
@@ -95,6 +131,43 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildClone()
     return LLSettingsSky::ptr_t();
 }
 
+LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky)
+{
+    LLSD legacy(LLSD::emptyMap());
+    LLSD settings = psky->getSettings();
+    
+    legacy[SETTING_AMBIENT] = ensureArray4(settings[SETTING_AMBIENT], 1.0f);
+    legacy[SETTING_BLUE_DENSITY] = ensureArray4(settings[SETTING_BLUE_DENSITY], 1.0);
+    legacy[SETTING_BLUE_HORIZON] = ensureArray4(settings[SETTING_BLUE_HORIZON], 1.0);
+    legacy[SETTING_CLOUD_COLOR] = ensureArray4(settings[SETTING_CLOUD_COLOR], 1.0);
+    legacy[SETTING_CLOUD_POS_DENSITY1] = ensureArray4(settings[SETTING_CLOUD_POS_DENSITY1], 1.0);
+    legacy[SETTING_CLOUD_POS_DENSITY2] = ensureArray4(settings[SETTING_CLOUD_POS_DENSITY2], 1.0);
+    legacy[SETTING_CLOUD_SCALE] = LLSDArray(settings[SETTING_CLOUD_SCALE])(LLSD::Real(0.0))(LLSD::Real(0.0))(LLSD::Real(1.0));
+       
+    legacy[SETTING_CLOUD_SCROLL_RATE] = settings[SETTING_CLOUD_SCROLL_RATE];
+    legacy[SETTING_LEGACY_ENABLE_CLOUD_SCROLL] = LLSDArray(LLSD::Boolean(!is_approx_zero(settings[SETTING_CLOUD_SCROLL_RATE][0].asReal())))
+        (LLSD::Boolean(!is_approx_zero(settings[SETTING_CLOUD_SCROLL_RATE][1].asReal())));
+     
+    legacy[SETTING_CLOUD_SHADOW] = LLSDArray(settings[SETTING_CLOUD_SHADOW].asReal())(0.0f)(0.0f)(1.0f);
+    legacy[SETTING_DENSITY_MULTIPLIER] = LLSDArray(settings[SETTING_DENSITY_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f);
+    legacy[SETTING_DISTANCE_MULTIPLIER] = LLSDArray(settings[SETTING_DISTANCE_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f);
+    legacy[SETTING_GAMMA] = LLSDArray(settings[SETTING_GAMMA])(0.0f)(0.0f)(1.0f);
+    legacy[SETTING_GLOW] = ensureArray4(settings[SETTING_GLOW], 1.0);
+    legacy[SETTING_HAZE_DENSITY] = LLSDArray(settings[SETTING_HAZE_DENSITY])(0.0f)(0.0f)(1.0f);
+    legacy[SETTING_HAZE_HORIZON] = LLSDArray(settings[SETTING_HAZE_HORIZON])(0.0f)(0.0f)(1.0f);
+    legacy[SETTING_LIGHT_NORMAL] = ensureArray4(psky->getLightDirection().getValue(), 0.0f);
+    legacy[SETTING_MAX_Y] = LLSDArray(settings[SETTING_MAX_Y])(0.0f)(0.0f)(1.0f);
+    legacy[SETTING_STAR_BRIGHTNESS] = settings[SETTING_STAR_BRIGHTNESS];
+    legacy[SETTING_SUNLIGHT_COLOR] = ensureArray4(settings[SETTING_SUNLIGHT_COLOR], 1.0f);
+    
+    LLSettingsSky::azimalt_t azialt = psky->getSunRotationAzAl();
+
+    legacy[SETTING_LEGACY_EAST_ANGLE] = azialt.first;
+    legacy[SETTING_LEGACY_SUN_ANGLE] = azialt.second;
+    
+    return legacy;    
+}
+
 //-------------------------------------------------------------------------
 void LLSettingsVOSky::updateSettings()
 {
@@ -176,6 +249,19 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPreset(const std::strin
 
     LLSettingsWater::ptr_t waterp = boost::make_shared<LLSettingsVOWater>(newsettings);
 
+#ifdef VERIFY_LEGACY_CONVERSION
+    LLSD oldsettings = LLSettingsVOWater::convertToLegacy(waterp);
+
+    if (!llsd_equals(legacy, oldsettings))
+    {
+        LL_WARNS("WATER") << "Conversion to/from legacy does not match!\n"
+            << "Old: " << legacy
+            << "new: " << oldsettings << LL_ENDL;
+    }
+
+#endif
+
+
     if (waterp->validate())
         return waterp;
 
@@ -207,6 +293,28 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildClone()
     return LLSettingsWater::ptr_t();
 }
 
+LLSD LLSettingsVOWater::convertToLegacy(const LLSettingsWater::ptr_t &pwater)
+{
+    LLSD legacy(LLSD::emptyMap());
+    LLSD settings = pwater->getSettings();
+
+    legacy[SETTING_LEGACY_BLUR_MULTIPILER] = settings[SETTING_BLUR_MULTIPILER];
+    legacy[SETTING_LEGACY_FOG_COLOR] = ensureArray4(settings[SETTING_FOG_COLOR], 1.0f);
+    legacy[SETTING_LEGACY_FOG_DENSITY] = settings[SETTING_FOG_DENSITY];
+    legacy[SETTING_LEGACY_FOG_MOD] = settings[SETTING_FOG_MOD];
+    legacy[SETTING_LEGACY_FRESNEL_OFFSET] = settings[SETTING_FRESNEL_OFFSET];
+    legacy[SETTING_LEGACY_FRESNEL_SCALE] = settings[SETTING_FRESNEL_SCALE];
+    legacy[SETTING_LEGACY_NORMAL_MAP] = settings[SETTING_NORMAL_MAP];
+    legacy[SETTING_LEGACY_NORMAL_SCALE] = settings[SETTING_NORMAL_SCALE];
+    legacy[SETTING_LEGACY_SCALE_ABOVE] = settings[SETTING_SCALE_ABOVE];
+    legacy[SETTING_LEGACY_SCALE_BELOW] = settings[SETTING_SCALE_BELOW];
+    legacy[SETTING_LEGACY_WAVE1_DIR] = settings[SETTING_WAVE1_DIR];
+    legacy[SETTING_LEGACY_WAVE2_DIR] = settings[SETTING_WAVE2_DIR];
+    
+    //_WARNS("LAPRAS") << "Legacy water: " << legacy << LL_ENDL;
+    return legacy;
+}
+//-------------------------------------------------------------------------
 //-------------------------------------------------------------------------
 void LLSettingsVOWater::applySpecial(void *ptarget)
 {
@@ -303,12 +411,26 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &n
 
     LLSettingsDay::ptr_t dayp = boost::make_shared<LLSettingsVODay>(newsettings);
 
+#ifdef VERIFY_LEGACY_CONVERSION
+    LLSD testsettings = LLSettingsVODay::convertToLegacy(dayp);
+
+    if (!llsd_equals(oldsettings, testsettings))
+    {
+        LL_WARNS("DAYCYCLE") << "Conversion to/from legacy does not match!\n" 
+            << "Old: " << oldsettings
+            << "new: " << testsettings << LL_ENDL;
+    }
+
+#endif
+
     if (dayp->validate())
     {
         dayp->initialize();
         return dayp;
     }
 
+
+
     return LLSettingsDay::ptr_t();
 }
 
@@ -370,6 +492,20 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildDefaultDayCycle()
     return LLSettingsDay::ptr_t();
 }
 
+LLSettingsDay::ptr_t LLSettingsVODay::buildFromEnvironmentMessage(LLSD settings)
+{
+    LLSettingsDay::ptr_t dayp = boost::make_shared<LLSettingsVODay>(settings);
+
+    if (dayp->validate())
+    {
+        dayp->initialize();
+        return dayp;
+    }
+
+    return LLSettingsDay::ptr_t();
+}
+
+
 LLSettingsDay::ptr_t LLSettingsVODay::buildClone()
 {
     LLSD settings = cloneSettings();
@@ -379,6 +515,55 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildClone()
     return dayp;
 }
 
+LLSD LLSettingsVODay::convertToLegacy(const LLSettingsVODay::ptr_t &pday)
+{
+    CycleTrack_t &trackwater = pday->getCycleTrack(TRACK_WATER);
+
+    LLSettingsWater::ptr_t pwater;
+    if (!trackwater.empty())
+    {
+        pwater = boost::static_pointer_cast<LLSettingsWater>((*trackwater.begin()).second);
+    }
+
+    if (!pwater)
+        pwater = LLSettingsVOWater::buildDefaultWater();
+    
+    LLSD llsdwater = LLSettingsVOWater::convertToLegacy(pwater);
+    
+    CycleTrack_t &tracksky = pday->getCycleTrack(1);   // first sky track
+    std::map<std::string, LLSettingsSky::ptr_t> skys;
+    
+    LLSD llsdcycle(LLSD::emptyArray());
+    
+    for(CycleTrack_t::iterator it = tracksky.begin(); it != tracksky.end(); ++it)
+    {
+        size_t hash = (*it).second->getHash();
+        std::stringstream name;
+        
+        name << hash;
+        
+        skys[name.str()] = boost::static_pointer_cast<LLSettingsSky>((*it).second);
+        
+        F32 frame = ((tracksky.size() == 1) && (it == tracksky.begin())) ? -1.0f : (*it).first;
+        llsdcycle.append( LLSDArray(LLSD::Real(frame))(name.str()) );
+    }
+    //_WARNS("LAPRAS") << "Cycle created with " << llsdcycle.size() << "entries: " << llsdcycle << LL_ENDL;
+
+    LLSD llsdskylist(LLSD::emptyMap());
+    
+    for (std::map<std::string, LLSettingsSky::ptr_t>::iterator its = skys.begin(); its != skys.end(); ++its)
+    {
+        LLSD llsdsky = LLSettingsVOSky::convertToLegacy((*its).second);
+        llsdsky[SETTING_NAME] = (*its).first;
+        
+        llsdskylist[(*its).first] = llsdsky;
+    }
+
+    //_WARNS("LAPRAS") << "Sky map with " << llsdskylist.size() << " entries created: " << llsdskylist << LL_ENDL;
+    
+    return LLSDArray(LLSD::emptyMap())(llsdcycle)(llsdskylist)(llsdwater);
+}
+
 LLSettingsSkyPtr_t  LLSettingsVODay::getDefaultSky() const
 {
     return LLSettingsVOSky::buildDefaultSky();
diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h
index 6ef7290ba451b12378f96d04bbdd998856e428fb..ba96a19d3e669d9ba787b0152df88588f0dc0dee 100644
--- a/indra/newview/llsettingsvo.h
+++ b/indra/newview/llsettingsvo.h
@@ -42,6 +42,7 @@ class LLSettingsVOSky : public LLSettingsSky
     static ptr_t    buildDefaultSky();
     virtual ptr_t   buildClone();
 
+    static LLSD     convertToLegacy(const ptr_t &);
 protected:
     LLSettingsVOSky();
 
@@ -63,6 +64,7 @@ class LLSettingsVOWater : public LLSettingsWater
     static ptr_t    buildDefaultWater();
     virtual ptr_t   buildClone();
 
+    static LLSD     convertToLegacy(const ptr_t &);
 protected:
     LLSettingsVOWater();
 
@@ -86,8 +88,11 @@ class LLSettingsVODay : public LLSettingsDay
     static ptr_t    buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings);
     static ptr_t    buildFromLegacyMessage(const LLUUID &regionId, LLSD daycycle, LLSD skys, LLSD water);
     static ptr_t    buildDefaultDayCycle();
+    static ptr_t    buildFromEnvironmentMessage(LLSD settings);
     virtual ptr_t   buildClone();
 
+    static LLSD     convertToLegacy(const ptr_t &);
+    
     virtual LLSettingsSkyPtr_t      getDefaultSky() const;
     virtual LLSettingsWaterPtr_t    getDefaultWater() const;
     virtual LLSettingsSkyPtr_t      buildSky(LLSD) const;
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 5b61eab5f7911bd844abd405131f25df416ad2ee..81be645c6abb06aaa376ffe2ba6f796224d6c57f 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -2823,6 +2823,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
 	capabilityNames.append("EnvironmentSettings");
 	capabilityNames.append("EstateChangeInfo");
 	capabilityNames.append("EventQueueGet");
+    capabilityNames.append("ExtEnvironment");
 	capabilityNames.append("FacebookConnect");
 	capabilityNames.append("FlickrConnect");
 	capabilityNames.append("TwitterConnect");
diff --git a/indra/newview/llwlhandlers.cpp b/indra/newview/llwlhandlers.cpp
index 0e4017a1c07478b989d3ce9a725d65d2922f5e95..cd3310d5cb0284e278c60a4dd3485e5cdfa16fc2 100644
--- a/indra/newview/llwlhandlers.cpp
+++ b/indra/newview/llwlhandlers.cpp
@@ -164,7 +164,7 @@ bool LLEnvironmentApply::initiateRequest(const LLSD& content)
 	sLastUpdate = current;
 
 	// Send update request.
-	std::string url = gAgent.getRegionCapability("EnvironmentSettings");
+	std::string url = gAgent.getRegionCapability("ExtEnvironment");
 	if (url.empty())
 	{
 		LL_WARNS("WindlightCaps") << "Applying windlight settings not supported" << LL_ENDL;
@@ -244,13 +244,11 @@ void LLEnvironmentApply::environmentApplyCoro(std::string url, LLSD content)
         }
 
         LL_DEBUGS("WindlightCaps") << "Success in applying windlight settings to region " << result["regionID"].asUUID() << LL_ENDL;
-        //LLEnvManagerNew::instance().onRegionSettingsApplyResponse(true);
 
     } while (false);
 
     if (!notify.isUndefined())
     {
         LLNotificationsUtil::add("WLRegionApplyFail", notify);
-        //LLEnvManagerNew::instance().onRegionSettingsApplyResponse(false);
     }
 }
diff --git a/indra/newview/llwlhandlers.h b/indra/newview/llwlhandlers.h
index eb2bbf9553596d85f38e1c4e9e31a4f64dc6c1fc..857ffa9bd32c7dd5413f42ebd78431e293319800 100644
--- a/indra/newview/llwlhandlers.h
+++ b/indra/newview/llwlhandlers.h
@@ -60,4 +60,6 @@ class LLEnvironmentApply
     static void environmentApplyCoro(std::string url, LLSD content);
 };
 
+
+
 #endif // LL_LLWLHANDLERS_H