-------------------------------------------------------------------------------
-- FUNCTION
-------------------------------------------------------------------------------
local num = 0
local rotAuth = false
function STimer()
	if stateMainForm:GetChildChecked("ContextGuild", true):IsVisible() then
		num = num + 1
		if num == 3 then
			num = 0
			rotAuth = not rotAuth
			local Auth
			if rotAuth == true then
				for i = 0, stateMainForm:GetChildChecked("ContextGuild", true):GetChildChecked("MainPanel", false):GetChildChecked("GuildMembers", false):GetChildChecked("Container", false):GetElementCount() - 1 do
					local widget = stateMainForm:GetChildChecked("ContextGuild", true):GetChildChecked("MainPanel", false):GetChildChecked("GuildMembers", false):GetChildChecked("Container", false):At(i)
					local wName = common.ExtractWStringFromValuedText(widget:GetChildChecked("Name", false):GetValuedText())
					Auth = guild.GetMemberInfo(guild.GetMember(wName)).authority
					widget:GetChildChecked("Authority", false):SetFormat(userMods.ToWString("<body alignx='center' class='StatNormal'>T: "..Auth.."</body>"))
				end
			else
				for i = 0, stateMainForm:GetChildChecked("ContextGuild", true):GetChildChecked("MainPanel", false):GetChildChecked("GuildMembers", false):GetChildChecked("Container", false):GetElementCount() - 1 do
					local widget = stateMainForm:GetChildChecked("ContextGuild", true):GetChildChecked("MainPanel", false):GetChildChecked("GuildMembers", false):GetChildChecked("Container", false):At(i)
					local wName = common.ExtractWStringFromValuedText(widget:GetChildChecked("Name", false):GetValuedText())
					Auth = guild.GetMemberInfo(guild.GetMember(wName)).monthAuthority
					widget:GetChildChecked("Authority", false):SetFormat(userMods.ToWString("<body alignx='center' class='StatNormal'>M: "..Auth.."</body>"))
				end
			end
		end
	end
end
--------------------------------------------------------------------------------
-- INITIALIZATION
--------------------------------------------------------------------------------
function Init()
	for i = 0, stateMainForm:GetChildChecked("ContextGuild", true):GetChildChecked("MainPanel", false):GetChildChecked("GuildMembers", false):GetChildChecked("Container", false):GetElementCount() - 1 do
		local widget = stateMainForm:GetChildChecked("ContextGuild", true):GetChildChecked("MainPanel", false):GetChildChecked("GuildMembers", false):GetChildChecked("Container", false):At(i)
		local wName = common.ExtractWStringFromValuedText(widget:GetChildChecked("Name", false):GetValuedText())
		local AuthTot = guild.GetMemberInfo(guild.GetMember(wName)).authority
		widget:GetChildChecked("Authority", false):SetFormat(userMods.ToWString("<body alignx='center' class='StatNormal'>T: "..AuthTot.."</body>"))
	end
	common.RegisterEventHandler(STimer, "EVENT_SECOND_TIMER")

	for i, v in avatar.GetDeviceList() do
		common.LogInfo("blah", object.GetName(v), tostring(object.IsUsable(v)))
	end
end
--------------------------------------------------------------------------------
common.RegisterEventHandler( Init, "EVENT_AVATAR_CREATED")
if avatar.IsExist() then
Init()
end
--------------------------------------------------------------------------------