// Multiple calls to showInstance("inspect_avatar", foo) will provide different
// LLSD for foo, which we will catch here.
//virtual
void LLInspectAvatar::onOpen(const LLSD& data)
{
	// Start open animation
	LLInspect::onOpen(data);

	// Extract appropriate avatar id
	mAvatarID = data["avatar_id"];

	BOOL self = mAvatarID == gAgent.getID();
	
	getChild<LLUICtrl>("gear_self_btn")->setVisible(self);
	getChild<LLUICtrl>("gear_btn")->setVisible(!self);

	// Position the inspector relative to the mouse cursor
	// Similar to how tooltips are positioned
	// See LLToolTipMgr::createToolTip
	if (data.has("pos"))
	{
		LLUI::positionViewNearMouse(this, data["pos"]["x"].asInteger(), data["pos"]["y"].asInteger());
	}
	else
	{
		LLUI::positionViewNearMouse(this);
	}

	// can't call from constructor as widgets are not built yet
	requestUpdate();

	updateVolumeSlider();

	updateModeratorPanel();
}
// Multiple calls to showInstance("inspect_avatar", foo) will provide different
// LLSD for foo, which we will catch here.
//virtual
void LLInspectAvatar::onOpen(const LLSD& data)
{
	// Start open animation
	LLInspect::onOpen(data);

	// Extract appropriate avatar id
	mAvatarID = data["avatar_id"];

	// <FS:Ansariel> Undo CHUI-90 and make avatar inspector useful again
	BOOL self = mAvatarID == gAgent.getID();
	
	getChild<LLUICtrl>("gear_self_btn")->setVisible(self);
	getChild<LLUICtrl>("gear_btn")->setVisible(!self);
	// </FS:Ansariel>

	// Position the inspector relative to the mouse cursor
	// Similar to how tooltips are positioned
	// See LLToolTipMgr::createToolTip
	if (data.has("pos"))
	{
		LLUI::positionViewNearMouse(this, data["pos"]["x"].asInteger(), data["pos"]["y"].asInteger());
	}
	else
	{
		LLUI::positionViewNearMouse(this);
	}

	// Generate link to avatar profile.
	// <FS:Ansariel> Undo CHUI-90 and make avatar inspector useful again
	//getChild<LLUICtrl>("avatar_profile_link")->setTextArg("[LINK]", LLSLURL("agent", mAvatarID, "about").getSLURLString());

	// can't call from constructor as widgets are not built yet
	requestUpdate();

	updateVolumeSlider();

	// <FS:Ansariel> Undo CHUI-90 and make avatar inspector useful again
	updateModeratorPanel();
}