diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index ccd22ee050fc9cbb962a7f1d4f0401c8040dab73..223998569b929dc0ce19f459dab6f2479809715c 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -40,6 +40,7 @@
 #include "llscrollcontainer.h"
 #include "llstl.h"
 #include "lltextparser.h"
+#include "lltextutil.h"
 #include "lltooltip.h"
 #include "lluictrl.h"
 #include "llurlaction.h"
@@ -1595,6 +1596,9 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para
 		while ( LLUrlRegistry::instance().findUrl(text, match,
 		        boost::bind(&LLTextBase::replaceUrlLabel, this, _1, _2)) )
 		{
+			
+			LLTextUtil::processUrlMatch(&match,this);
+
 			start = match.getStart();
 			end = match.getEnd()+1;
 
@@ -1619,22 +1623,6 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para
 				std::string subtext=text.substr(0,start);
 				appendAndHighlightText(subtext, part, style_params); 
 			}
-
-			// output an optional icon before the Url
-			if (! match.getIcon().empty())
-			{
-				LLUIImagePtr image = LLUI::getUIImage(match.getIcon());
-				if (image)
-				{
-					LLStyle::Params icon;
-					icon.image = image;
-					// Text will be replaced during rendering with the icon,
-					// but string cannot be empty or the segment won't be
-					// added (or drawn).
-					appendImageSegment(icon);
-				}
-			}
-
 			// output the styled Url (unless we've been asked to suppress hyperlinking)
 			if (match.isLinkDisabled())
 			{
@@ -1716,7 +1704,14 @@ void LLTextBase::appendImageSegment(const LLStyle::Params& style_params)
 	insertStringNoUndo(getLength(), utf8str_to_wstring(" "), &segments);
 }
 
+void LLTextBase::appendWidget(const LLInlineViewSegment::Params& params, const std::string& text, bool allow_undo)
+{
+	segment_vec_t segments;
+	LLWString widget_wide_text = utf8str_to_wstring(text);
+	segments.push_back(new LLInlineViewSegment(params, getLength(), getLength() + widget_wide_text.size()));
 
+	insertStringNoUndo(getLength(), widget_wide_text, &segments);
+}
 
 void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 highlight_part, const LLStyle::Params& style_params)
 {
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index ff63cc26f552151e4410ded57b720610c14a1ad9..300ee0f05f84ed4945fa0692dc6e29e9533d7ede 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -47,8 +47,170 @@
 #include <boost/signals2.hpp>
 
 class LLContextMenu;
-class LLTextSegment;
-class LLNormalTextSegment;
+class LLUrlMatch;
+
+///
+/// A text segment is used to specify a subsection of a text string
+/// that should be formatted differently, such as a hyperlink. It
+/// includes a start/end offset from the start of the string, a
+/// style to render with, an optional tooltip, etc.
+///
+class LLTextSegment : public LLRefCount, public LLMouseHandler
+{
+public:
+	LLTextSegment(S32 start, S32 end) : mStart(start), mEnd(end){};
+	virtual ~LLTextSegment();
+
+	virtual bool				getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
+	virtual S32					getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const;
+	virtual S32					getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
+	virtual void				updateLayout(const class LLTextBase& editor);
+	virtual F32					draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
+	virtual bool				canEdit() const;
+	virtual void				unlinkFromDocument(class LLTextBase* editor);
+	virtual void				linkToDocument(class LLTextBase* editor);
+
+	virtual const LLColor4&		getColor() const;
+	//virtual void 				setColor(const LLColor4 &color);
+	virtual LLStyleConstSP		getStyle() const;
+	virtual void 				setStyle(LLStyleConstSP style);
+	virtual void				setToken( LLKeywordToken* token );
+	virtual LLKeywordToken*		getToken() const;
+	virtual void				setToolTip(const std::string& tooltip);
+	virtual void				dump() const;
+
+	// LLMouseHandler interface
+	/*virtual*/ BOOL			handleMouseDown(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL			handleMouseUp(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL			handleMiddleMouseDown(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL			handleMiddleMouseUp(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL			handleRightMouseDown(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL			handleRightMouseUp(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL			handleDoubleClick(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL			handleHover(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL			handleScrollWheel(S32 x, S32 y, S32 clicks);
+	/*virtual*/ BOOL			handleToolTip(S32 x, S32 y, MASK mask);
+	/*virtual*/ std::string		getName() const;
+	/*virtual*/ void			onMouseCaptureLost();
+	/*virtual*/ void			screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const;
+	/*virtual*/ void			localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const;
+	/*virtual*/ BOOL			hasMouseCapture();
+
+	S32							getStart() const 					{ return mStart; }
+	void						setStart(S32 start)					{ mStart = start; }
+	S32							getEnd() const						{ return mEnd; }
+	void						setEnd( S32 end )					{ mEnd = end; }
+
+protected:
+	S32				mStart;
+	S32				mEnd;
+};
+
+class LLNormalTextSegment : public LLTextSegment
+{
+public:
+	LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor );
+	LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE);
+	~LLNormalTextSegment();
+
+	/*virtual*/ bool				getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
+	/*virtual*/ S32					getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const;
+	/*virtual*/ S32					getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
+	/*virtual*/ F32					draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
+	/*virtual*/ bool				canEdit() const { return true; }
+	/*virtual*/ const LLColor4&		getColor() const					{ return mStyle->getColor(); }
+	/*virtual*/ LLStyleConstSP		getStyle() const					{ return mStyle; }
+	/*virtual*/ void 				setStyle(LLStyleConstSP style)	{ mStyle = style; }
+	/*virtual*/ void				setToken( LLKeywordToken* token )	{ mToken = token; }
+	/*virtual*/ LLKeywordToken*		getToken() const					{ return mToken; }
+	/*virtual*/ BOOL				getToolTip( std::string& msg ) const;
+	/*virtual*/ void				setToolTip(const std::string& tooltip);
+	/*virtual*/ void				dump() const;
+
+	/*virtual*/ BOOL				handleHover(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL				handleRightMouseDown(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL				handleMouseDown(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL				handleMouseUp(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL				handleToolTip(S32 x, S32 y, MASK mask);
+
+protected:
+	F32					drawClippedSegment(S32 seg_start, S32 seg_end, S32 selection_start, S32 selection_end, LLRect rect);
+
+protected:
+	class LLTextBase&	mEditor;
+	LLStyleConstSP		mStyle;
+	S32					mFontHeight;
+	LLKeywordToken* 	mToken;
+	std::string     	mTooltip;
+	boost::signals2::connection mImageLoadedConnection;
+};
+
+class LLIndexSegment : public LLTextSegment
+{
+public:
+	LLIndexSegment(S32 pos) : LLTextSegment(pos, pos) {}
+};
+
+class LLInlineViewSegment : public LLTextSegment
+{
+public:
+	struct Params : public LLInitParam::Block<Params>
+	{
+		Mandatory<LLView*>		view;
+		Optional<bool>			force_newline;
+		Optional<S32>			left_pad,
+								right_pad,
+								bottom_pad,
+								top_pad;
+	};
+
+	LLInlineViewSegment(const Params& p, S32 start, S32 end);
+	~LLInlineViewSegment();
+	/*virtual*/ bool		getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
+	/*virtual*/ S32			getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
+	/*virtual*/ void		updateLayout(const class LLTextBase& editor);
+	/*virtual*/ F32			draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
+	/*virtual*/ bool		canEdit() const { return false; }
+	/*virtual*/ void		unlinkFromDocument(class LLTextBase* editor);
+	/*virtual*/ void		linkToDocument(class LLTextBase* editor);
+
+private:
+	S32 mLeftPad;
+	S32 mRightPad;
+	S32 mTopPad;
+	S32 mBottomPad;
+	LLView* mView;
+	bool	mForceNewLine;
+};
+
+class LLLineBreakTextSegment : public LLTextSegment
+{
+public:
+
+	LLLineBreakTextSegment(LLStyleConstSP style,S32 pos);
+	LLLineBreakTextSegment(S32 pos);
+	~LLLineBreakTextSegment();
+	bool		getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
+	S32			getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
+	F32			draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
+
+private:
+	S32			mFontHeight;
+};
+
+class LLImageTextSegment : public LLTextSegment
+{
+public:
+	LLImageTextSegment(LLStyleConstSP style,S32 pos,class LLTextBase& editor);
+	~LLImageTextSegment();
+	bool		getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
+	S32			getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
+	F32			draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
+
+private:
+	class LLTextBase&	mEditor;
+	LLStyleConstSP	mStyle;
+};
 
 typedef LLPointer<LLTextSegment> LLTextSegmentPtr;
 
@@ -196,8 +358,9 @@ class LLTextBase
 
 	const LLFontGL*			getDefaultFont() const					{ return mDefaultFont; }
 
-	void					appendLineBreakSegment(const LLStyle::Params& style_params);
-	void					appendImageSegment(const LLStyle::Params& style_params);
+	virtual void			appendLineBreakSegment(const LLStyle::Params& style_params);
+	virtual void			appendImageSegment(const LLStyle::Params& style_params);
+	virtual void			appendWidget(const LLInlineViewSegment::Params& params, const std::string& text, bool allow_undo);
 
 public:
 	// Fired when a URL link is clicked
@@ -386,167 +549,4 @@ class LLTextBase
 
 };
 
-///
-/// A text segment is used to specify a subsection of a text string
-/// that should be formatted differently, such as a hyperlink. It
-/// includes a start/end offset from the start of the string, a
-/// style to render with, an optional tooltip, etc.
-///
-class LLTextSegment : public LLRefCount, public LLMouseHandler
-{
-public:
-	LLTextSegment(S32 start, S32 end) : mStart(start), mEnd(end){};
-	virtual ~LLTextSegment();
-
-	virtual bool				getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
-	virtual S32					getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const;
-	virtual S32					getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
-	virtual void				updateLayout(const class LLTextBase& editor);
-	virtual F32					draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
-	virtual bool				canEdit() const;
-	virtual void				unlinkFromDocument(class LLTextBase* editor);
-	virtual void				linkToDocument(class LLTextBase* editor);
-
-	virtual const LLColor4&		getColor() const;
-	//virtual void 				setColor(const LLColor4 &color);
-	virtual LLStyleConstSP		getStyle() const;
-	virtual void 				setStyle(LLStyleConstSP style);
-	virtual void				setToken( LLKeywordToken* token );
-	virtual LLKeywordToken*		getToken() const;
-	virtual void				setToolTip(const std::string& tooltip);
-	virtual void				dump() const;
-
-	// LLMouseHandler interface
-	/*virtual*/ BOOL			handleMouseDown(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL			handleMouseUp(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL			handleMiddleMouseDown(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL			handleMiddleMouseUp(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL			handleRightMouseDown(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL			handleRightMouseUp(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL			handleDoubleClick(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL			handleHover(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL			handleScrollWheel(S32 x, S32 y, S32 clicks);
-	/*virtual*/ BOOL			handleToolTip(S32 x, S32 y, MASK mask);
-	/*virtual*/ std::string		getName() const;
-	/*virtual*/ void			onMouseCaptureLost();
-	/*virtual*/ void			screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const;
-	/*virtual*/ void			localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const;
-	/*virtual*/ BOOL			hasMouseCapture();
-
-	S32							getStart() const 					{ return mStart; }
-	void						setStart(S32 start)					{ mStart = start; }
-	S32							getEnd() const						{ return mEnd; }
-	void						setEnd( S32 end )					{ mEnd = end; }
-
-protected:
-	S32				mStart;
-	S32				mEnd;
-};
-
-class LLNormalTextSegment : public LLTextSegment
-{
-public:
-	LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor );
-	LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE);
-	~LLNormalTextSegment();
-
-	/*virtual*/ bool				getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
-	/*virtual*/ S32					getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const;
-	/*virtual*/ S32					getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
-	/*virtual*/ F32					draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
-	/*virtual*/ bool				canEdit() const { return true; }
-	/*virtual*/ const LLColor4&		getColor() const					{ return mStyle->getColor(); }
-	/*virtual*/ LLStyleConstSP		getStyle() const					{ return mStyle; }
-	/*virtual*/ void 				setStyle(LLStyleConstSP style)	{ mStyle = style; }
-	/*virtual*/ void				setToken( LLKeywordToken* token )	{ mToken = token; }
-	/*virtual*/ LLKeywordToken*		getToken() const					{ return mToken; }
-	/*virtual*/ BOOL				getToolTip( std::string& msg ) const;
-	/*virtual*/ void				setToolTip(const std::string& tooltip);
-	/*virtual*/ void				dump() const;
-
-	/*virtual*/ BOOL				handleHover(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL				handleRightMouseDown(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL				handleMouseDown(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL				handleMouseUp(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL				handleToolTip(S32 x, S32 y, MASK mask);
-
-protected:
-	F32					drawClippedSegment(S32 seg_start, S32 seg_end, S32 selection_start, S32 selection_end, LLRect rect);
-
-protected:
-	class LLTextBase&	mEditor;
-	LLStyleConstSP		mStyle;
-	S32					mFontHeight;
-	LLKeywordToken* 	mToken;
-	std::string     	mTooltip;
-	boost::signals2::connection mImageLoadedConnection;
-};
-
-class LLIndexSegment : public LLTextSegment
-{
-public:
-	LLIndexSegment(S32 pos) : LLTextSegment(pos, pos) {}
-};
-
-class LLInlineViewSegment : public LLTextSegment
-{
-public:
-	struct Params : public LLInitParam::Block<Params>
-	{
-		Mandatory<LLView*>		view;
-		Optional<bool>			force_newline;
-		Optional<S32>			left_pad,
-								right_pad,
-								bottom_pad,
-								top_pad;
-	};
-
-	LLInlineViewSegment(const Params& p, S32 start, S32 end);
-	~LLInlineViewSegment();
-	/*virtual*/ bool		getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
-	/*virtual*/ S32			getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
-	/*virtual*/ void		updateLayout(const class LLTextBase& editor);
-	/*virtual*/ F32			draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
-	/*virtual*/ bool		canEdit() const { return false; }
-	/*virtual*/ void		unlinkFromDocument(class LLTextBase* editor);
-	/*virtual*/ void		linkToDocument(class LLTextBase* editor);
-
-private:
-	S32 mLeftPad;
-	S32 mRightPad;
-	S32 mTopPad;
-	S32 mBottomPad;
-	LLView* mView;
-	bool	mForceNewLine;
-};
-
-class LLLineBreakTextSegment : public LLTextSegment
-{
-public:
-
-	LLLineBreakTextSegment(LLStyleConstSP style,S32 pos);
-	LLLineBreakTextSegment(S32 pos);
-	~LLLineBreakTextSegment();
-	bool		getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
-	S32			getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
-	F32			draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
-
-private:
-	S32			mFontHeight;
-};
-
-class LLImageTextSegment : public LLTextSegment
-{
-public:
-	LLImageTextSegment(LLStyleConstSP style,S32 pos,class LLTextBase& editor);
-	~LLImageTextSegment();
-	bool		getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
-	S32			getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
-	F32			draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
-
-private:
-	class LLTextBase&	mEditor;
-	LLStyleConstSP	mStyle;
-};
-
 #endif
diff --git a/indra/llui/lltextutil.cpp b/indra/llui/lltextutil.cpp
index c5f3929fb126806aa7bbef98ec22518af363f7b0..56664071b79433501df9ba825bbd0e3f6619019b 100644
--- a/indra/llui/lltextutil.cpp
+++ b/indra/llui/lltextutil.cpp
@@ -34,7 +34,9 @@
 
 #include "lluicolor.h"
 #include "lltextbox.h"
+#include "llurlmatch.h"
 
+boost::function<bool(LLUrlMatch*,LLTextBase*)>	LLTextUtil::TextHelpers::iconCallbackCreationFunction = 0;
 
 void LLTextUtil::textboxSetHighlightedVal(LLTextBox *txtbox, const LLStyle::Params& normal_style, const std::string& text, const std::string& hl)
 {
@@ -76,4 +78,36 @@ const std::string& LLTextUtil::formatPhoneNumber(const std::string& phone_str)
 	return formatted_phone_str;
 }
 
+bool LLTextUtil::processUrlMatch(LLUrlMatch* match,LLTextBase* text_base)
+{
+	if (match == 0 || text_base == 0)
+		return false;
+
+	if(match->getID() != LLUUID::null && TextHelpers::iconCallbackCreationFunction)
+	{
+		bool segment_created = TextHelpers::iconCallbackCreationFunction(match,text_base);
+		if(segment_created)
+			return true;
+	}
+
+	// output an optional icon before the Url
+	if (!match->getIcon().empty() )
+	{
+		LLUIImagePtr image = LLUI::getUIImage(match->getIcon());
+		if (image)
+		{
+			LLStyle::Params icon;
+			icon.image = image;
+			// Text will be replaced during rendering with the icon,
+			// but string cannot be empty or the segment won't be
+			// added (or drawn).
+			text_base->appendImageSegment(icon);
+
+			return true;
+		}
+	}
+	
+	return false;
+}
+
 // EOF
diff --git a/indra/llui/lltextutil.h b/indra/llui/lltextutil.h
index 325c3c5b7c1f3e9a0d5c15ce690089b2783aa987..407880d19505c2b1f9839ddf08a9cb5fce6cc6f6 100644
--- a/indra/llui/lltextutil.h
+++ b/indra/llui/lltextutil.h
@@ -36,6 +36,8 @@
 #include "llstyle.h"
 
 class LLTextBox;
+class LLUrlMatch;
+class LLTextBase;
 
 namespace LLTextUtil
 {
@@ -67,6 +69,19 @@ namespace LLTextUtil
 	 * @return reference to string with formatted phone number
 	 */
 	const std::string& formatPhoneNumber(const std::string& phone_str);
+
+	bool processUrlMatch(LLUrlMatch* match,LLTextBase* text_base);
+
+	class TextHelpers
+	{
+
+		//we need this special callback since we need to create LLAvataIconCtrls while parsing
+		//avatar/group url but can't create LLAvataIconCtrl from LLUI
+		public:
+			static boost::function<bool(LLUrlMatch*,LLTextBase*)> iconCallbackCreationFunction;
+	};
+
+	
 }
 
 #endif // LL_LLTEXTUTIL_H
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index fd56a87345904e778a8cbe6ac3858bac6f1c6fe6..e075699a6ece2404448caa4486c0a92a4f7bb181 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -326,6 +326,11 @@ void LLUrlEntryAgent::onAgentNameReceived(const LLUUID& id,
 	callObservers(id.asString(), first + " " + last);
 }
 
+LLUUID	LLUrlEntryAgent::getID(const std::string &string) const
+{
+	return LLUUID(getIDStringFromUrl(string));
+}
+
 std::string LLUrlEntryAgent::getTooltip(const std::string &string) const
 {
 	// return a tooltip corresponding to the URL type instead of the generic one
@@ -434,6 +439,8 @@ LLUrlEntryGroup::LLUrlEntryGroup()
 	mColor = LLUIColorTable::instance().getColor("GroupLinkColor");
 }
 
+
+
 void LLUrlEntryGroup::onGroupNameReceived(const LLUUID& id,
 										  const std::string& first,
 										  const std::string& last,
@@ -443,6 +450,12 @@ void LLUrlEntryGroup::onGroupNameReceived(const LLUUID& id,
 	callObservers(id.asString(), first);
 }
 
+LLUUID	LLUrlEntryGroup::getID(const std::string &string) const
+{
+	return LLUUID(getIDStringFromUrl(string));
+}
+
+
 std::string LLUrlEntryGroup::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
 {
 	if (!gCacheName)
diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h
index 3c21fe8d61462b3029f0b53b6e03b160db623f6b..7d718b67a937183748f5a110b7160f79fa87f3b1 100644
--- a/indra/llui/llurlentry.h
+++ b/indra/llui/llurlentry.h
@@ -172,6 +172,7 @@ class LLUrlEntryAgent : public LLUrlEntryBase
 	LLUrlEntryAgent();
 	/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);
 	/*virtual*/ std::string getTooltip(const std::string &string) const;
+	/*virtual*/ LLUUID	getID(const std::string &string) const;
 private:
 	void onAgentNameReceived(const LLUUID& id, const std::string& first,
 							 const std::string& last, BOOL is_group);
@@ -186,6 +187,7 @@ class LLUrlEntryGroup : public LLUrlEntryBase
 public:
 	LLUrlEntryGroup();
 	/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);
+	/*virtual*/ LLUUID	getID(const std::string &string) const;
 private:
 	void onGroupNameReceived(const LLUUID& id, const std::string& first,
 							 const std::string& last, BOOL is_group);
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index dc514eafe7798ff4b960673a90da59fc9515f362..682e3eb87451522ca156a4d379c9c0b958c288d6 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -82,6 +82,8 @@
 #include "llvoavatarself.h"
 #include "llsidetray.h"
 #include "llfeaturemanager.h"
+#include "llurlmatch.h"
+#include "lltextutil.h"
 
 #include "llweb.h"
 #include "llsecondlifeurls.h"
@@ -192,6 +194,7 @@
 #include "llviewerthrottle.h"
 #include "llparcel.h"
 #include "llavatariconctrl.h"
+#include "llgroupiconctrl.h"
 
 // Include for security api initialization
 #include "llsecapi.h"
@@ -351,6 +354,45 @@ static void ui_audio_callback(const LLUUID& uuid)
 	}
 }
 
+bool	create_text_segment_icon_from_url_match(LLUrlMatch* match,LLTextBase* base)
+{
+	if(!match || !base)
+		return false;
+
+	LLUUID match_id = match->getID();
+
+	LLIconCtrl* icon;
+
+	if(gAgent.isInGroup(match_id, TRUE))
+	{
+		LLGroupIconCtrl::Params icon_params = LLUICtrlFactory::instance().getDefaultParams<LLGroupIconCtrl>();
+		icon_params.group_id = match_id;
+		icon_params.rect = LLRect(0, 16, 16, 0);
+		icon_params.visible = true;
+		icon = LLUICtrlFactory::instance().createWidget<LLGroupIconCtrl>(icon_params);
+	}
+	else
+	{
+		LLAvatarIconCtrl::Params icon_params = LLUICtrlFactory::instance().getDefaultParams<LLAvatarIconCtrl>();
+		icon_params.avatar_id = match_id;
+		icon_params.rect = LLRect(0, 16, 16, 0);
+		icon_params.visible = true;
+		icon = LLUICtrlFactory::instance().createWidget<LLAvatarIconCtrl>(icon_params);
+	}
+
+	LLInlineViewSegment::Params params;
+	params.force_newline = false;
+	params.view = icon;
+	params.left_pad = 4;
+	params.right_pad = 4;
+	params.top_pad = 2;
+	params.bottom_pad = 2;
+
+	base->appendWidget(params," ",false);
+	
+	return true;
+}
+
 void request_initial_instant_messages()
 {
 	static BOOL requested = FALSE;
@@ -887,6 +929,7 @@ bool LLAppViewer::init()
 	}
 	
 	LLViewerMedia::initClass();
+	LLTextUtil::TextHelpers::iconCallbackCreationFunction = create_text_segment_icon_from_url_match;
 
 	//EXT-7013 - On windows for some locale (Japanese) standard 
 	//datetime formatting functions didn't support some parameters such as "weekday".
diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp
index 472d2ccf243fa39600bcf892d60d75e718b7fdc8..f278fb6a7b767fcfc8f119af6fa915a30b619d7d 100644
--- a/indra/newview/llcofwearables.cpp
+++ b/indra/newview/llcofwearables.cpp
@@ -372,6 +372,11 @@ void LLCOFWearables::refresh()
 		 iter != iter_end; ++iter)
 	{
 		LLFlatListView* list = iter->first;
+		if (!list) continue;
+
+		//restoring selection should not fire commit callbacks
+		list->setCommitOnSelectionChange(false);
+
 		const values_vector_t& values = iter->second;
 		for (values_vector_t::const_iterator
 				 value_it = values.begin(),
@@ -385,6 +390,8 @@ void LLCOFWearables::refresh()
 				list->selectItemByValue(*value_it);
 			}
 		}
+
+		list->setCommitOnSelectionChange(true);
 	}
 }
 
diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp
index 709bb83fe42097ab83fbe86fe86100687a3870d1..b79a4f359ad6fb506dc4be1bc88436b84e7080a9 100644
--- a/indra/newview/llpanelimcontrolpanel.cpp
+++ b/indra/newview/llpanelimcontrolpanel.cpp
@@ -37,6 +37,7 @@
 #include "llpanelimcontrolpanel.h"
 
 #include "llagent.h"
+#include "llappviewer.h" // for gDisconnected
 #include "llavataractions.h"
 #include "llavatariconctrl.h"
 #include "llbutton.h"
@@ -163,7 +164,7 @@ BOOL LLPanelIMControlPanel::postBuild()
 	childSetAction("pay_btn", boost::bind(&LLPanelIMControlPanel::onPayButtonClicked, this));
 	childSetEnabled("add_friend_btn", !LLAvatarActions::isFriend(getChild<LLAvatarIconCtrl>("avatar_icon")->getAvatarId()));
 
-	
+	setFocusReceivedCallback(boost::bind(&LLPanelIMControlPanel::onFocusReceived, this));
 	
 	return LLPanelChatControlPanel::postBuild();
 }
@@ -194,6 +195,15 @@ void LLPanelIMControlPanel::onShareButtonClicked()
 	LLAvatarActions::share(mAvatarID);
 }
 
+void LLPanelIMControlPanel::onFocusReceived()
+{
+	// Disable all the buttons (Call, Teleport, etc) if disconnected.
+	if (gDisconnected)
+	{
+		setAllChildrenEnabled(FALSE);
+	}
+}
+
 void LLPanelIMControlPanel::setSessionId(const LLUUID& session_id)
 {
 	LLPanelChatControlPanel::setSessionId(session_id);
diff --git a/indra/newview/llpanelimcontrolpanel.h b/indra/newview/llpanelimcontrolpanel.h
index ce8fc58e5604b35d9bb65d5c4d895cc3d330a04e..0a1fd70c087d15af71546ec3baeb65f07b5472a0 100644
--- a/indra/newview/llpanelimcontrolpanel.h
+++ b/indra/newview/llpanelimcontrolpanel.h
@@ -95,6 +95,7 @@ class LLPanelIMControlPanel : public LLPanelChatControlPanel, LLFriendObserver
 	void onShareButtonClicked();
 	void onTeleportButtonClicked();
 	void onPayButtonClicked();
+	void onFocusReceived();
 
 	LLUUID mAvatarID;
 };
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index fa7e06d3236a92f7df37bbd0fd9b1e757c1c5ecc..29ce3449d17ef9559b42f7fa556e82fb04df8bef 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -53,6 +53,8 @@
 #include "lltooldraganddrop.h"
 #include "llviewermenu.h"
 #include "llviewertexturelist.h"
+#include "llsidepanelinventory.h"
+#include "llsidetray.h"
 
 const std::string FILTERS_FILENAME("filters.xml");
 
@@ -1163,6 +1165,12 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata)
 		return FALSE;
 	}
 
+	if (command_name == "share")
+	{
+		LLSidepanelInventory* parent = dynamic_cast<LLSidepanelInventory*>(LLSideTray::getInstance()->getPanel("sidepanel_inventory"));
+		return parent ? parent->canShare() : FALSE;
+	}
+
 	return TRUE;
 }
 
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index ffd879dfd75000d0b5882869f6dbe53d76a63484..a7e901cbfa8518748d7a77b6407402e41b78b8f3 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -726,24 +726,36 @@ void LLPanelOutfitEdit::filterWearablesBySelectedItem(void)
 	bool more_than_one_selected = ids.size() > 1;
 	bool is_dummy_item = (ids.size() && dynamic_cast<LLPanelDummyClothingListItem*>(mCOFWearables->getSelectedItem()));
 
-	//resetting selection if no item is selected or than one item is selected
-	if (nothing_selected || more_than_one_selected)
+	//expanded accordion tab determines filtering when no item is selected
+	if (nothing_selected)
 	{
-		if (nothing_selected)
-		{
-			showWearablesFolderView();
-			applyFolderViewFilter(FVIT_ALL);
-		}
+		showWearablesListView();
 
-		if (more_than_one_selected)
+		switch (mCOFWearables->getExpandedAccordionAssetType())
 		{
-			showWearablesListView();
-			applyListViewFilter(LVIT_ALL);
+		case LLAssetType::AT_OBJECT:
+			applyListViewFilter(LVIT_ATTACHMENT);
+			break;
+		case LLAssetType::AT_BODYPART:
+			applyListViewFilter(LVIT_BODYPART);
+			break;
+		case LLAssetType::AT_CLOTHING:
+		default: 
+			applyListViewFilter(LVIT_CLOTHING);
+			break;
 		}
 
 		return;
 	}
 
+	//resetting selection if more than one item is selected
+	if (more_than_one_selected)
+	{
+		showWearablesListView();
+		applyListViewFilter(LVIT_ALL);
+		return;
+	}
+
 
 	//filter wearables by a type represented by a dummy item
 	if (one_selected && is_dummy_item)
diff --git a/indra/newview/llsidepanelinventory.h b/indra/newview/llsidepanelinventory.h
index 951fdd630ca5c921b9252177a3060ada2030cf40..f2f2509f9a5cfd57c92acf20ac1babd9947b46fc 100644
--- a/indra/newview/llsidepanelinventory.h
+++ b/indra/newview/llsidepanelinventory.h
@@ -58,6 +58,9 @@ class LLSidepanelInventory : public LLPanel
 	void showTaskInfoPanel();
 	void showInventoryPanel();
 
+	// checks can share selected item(s)
+	bool canShare();
+
 protected:
 	// Tracks highlighted (selected) item in inventory panel.
 	LLInventoryItem *getSelectedItem();
@@ -65,8 +68,6 @@ class LLSidepanelInventory : public LLPanel
 	void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
 	// "wear", "teleport", etc.
 	void performActionOnSelection(const std::string &action);
-	bool canShare();
-
 	void updateVerbs();
 
 	//
diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp
index d24bd8499da25b84fa713c4b9e6a7a5eec570aa3..9f9a9bef352b9c4e72a5247790c5beccbf6ceae9 100644
--- a/indra/newview/llwearableitemslist.cpp
+++ b/indra/newview/llwearableitemslist.cpp
@@ -269,13 +269,13 @@ LLPanelAttachmentListItem* LLPanelAttachmentListItem::create(LLViewerInventoryIt
 void LLPanelAttachmentListItem::updateItem(const std::string& name,
 										   EItemState item_state)
 {
-	std::string title_joint;
+	std::string title_joint = name;
 
 	LLViewerInventoryItem* inv_item = getItem();
 	if (inv_item && isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(inv_item->getLinkedUUID()))
 	{
 		std::string joint = LLTrans::getString(gAgentAvatarp->getAttachedPointName(inv_item->getLinkedUUID()));
-		title_joint = name + " (" + joint + ")";
+		title_joint =  title_joint + " (" + joint + ")";
 	}
 
 	LLPanelInventoryListItemBase::updateItem(title_joint, item_state);
diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml
index 72ab6195bcf9ab155128b53065b6daccbc77b538..a1ca910cbbb96b7d84d29d5526f675b980dba296 100644
--- a/indra/newview/skins/default/xui/en/main_view.xml
+++ b/indra/newview/skins/default/xui/en/main_view.xml
@@ -199,7 +199,15 @@
          mouse_opaque="false"
          name="popup_holder"
          class="popup_holder"
-         width="1024"/>
+         width="1024">
+    <icon follows="right|bottom"
+          image_name="Resize_Corner"
+          right="-1"
+          name="resize_corner"
+          width="11"
+          bottom="-1"
+          height="11" />
+  </panel>
   <menu_holder top="0"
                follows="all"
                height="768"
diff --git a/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml b/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml
index 62365f7cc281b6398693d82dd6fb7998007fb68a..c3947000816edb47eaa692dada293ee85067a293 100644
--- a/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml
+++ b/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml
@@ -81,6 +81,17 @@
 			 function="Inventory.GearDefault.Enable"
 			 parameter="save_texture" />
         </menu_item_call>
+    <menu_item_call
+     label="Share"
+     layout="topleft"
+     name="Share"
+     visible="true">
+     <on_click
+         function="Inventory.Share" />
+     <on_enable
+         function="Inventory.GearDefault.Enable"
+         parameter="share" />
+    </menu_item_call>
     <menu_item_call 
          label="Find Original"
          layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml
index 4eff5bc48aec9bf8bc53f84495d280a87a6b10b8..4b622691b383fc34a9dc565c0b6366de2c4200f8 100644
--- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml
+++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml
@@ -503,5 +503,17 @@ image_pressed_selected  "Lit" + "Selected" - there are new messages and the Well
                 </button>
             </chiclet_notification>
         </layout_panel>
+      <icon
+         auto_resize="false"
+         color="0 0 0 0"
+         follows="left|right"
+         height="10"
+         image_name="spacer24.tga"
+         layout="topleft"
+         left="0"
+         min_width="4"
+         name="DUMMY2"
+         top="0"
+         width="8" />
     </layout_stack>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_cof_wearables.xml b/indra/newview/skins/default/xui/en/panel_cof_wearables.xml
index d5943ea156ecc4802d005870781499866a42060d..f438e3d42d3f8bf2c0ce99a034529effa330e703 100644
--- a/indra/newview/skins/default/xui/en/panel_cof_wearables.xml
+++ b/indra/newview/skins/default/xui/en/panel_cof_wearables.xml
@@ -22,40 +22,40 @@
      width="311">
         <accordion_tab
          layout="topleft"
-         name="tab_attachments"
-         title="Attachments">
+         name="tab_clothing"
+         title="Clothing">
             <flat_list_view
              allow_select="true"
              follows="all"
              height="10"
              item_pad="3"
+             keep_selection_visible_on_reshape="true"
              layout="topleft"
              left="0"
-             keep_selection_visible_on_reshape="true"
              multi_select="true"
-             name="list_attachments"
+             name="list_clothing"
              top="0"
-             width="311">
-              <flat_list_view.no_items_text
-               value="No attachments worn" />
-              </flat_list_view>
+             width="311" />
         </accordion_tab>
         <accordion_tab
          layout="topleft"
-         name="tab_clothing"
-         title="Clothing">
+         name="tab_attachments"
+         title="Attachments">
             <flat_list_view
              allow_select="true"
              follows="all"
              height="10"
              item_pad="3"
-             keep_selection_visible_on_reshape="true"
              layout="topleft"
              left="0"
+             keep_selection_visible_on_reshape="true"
              multi_select="true"
-             name="list_clothing"
+             name="list_attachments"
              top="0"
-             width="311" />
+             width="311">
+              <flat_list_view.no_items_text
+               value="No attachments worn" />
+              </flat_list_view>
         </accordion_tab>
         <accordion_tab
          layout="topleft"