-- << LOCAL FUNCTIONS >>

local function setupOriginalZIndex(frame, forceOnTop)
	for a,b in pairs(frame:GetDescendants()) do
		if b:IsA("GuiObject") and b:FindFirstChild("OriginalZIndex") == nil then
			local iValue = Instance.new("IntValue")
			iValue.Name = "OriginalZIndex"
			local zValue = b.ZIndex
			if forceOnTop then
				zValue = zValue + 10000
			end
			iValue.Value = zValue
			iValue.Parent = b
		end
	end
end
local function updateZIndex(list, specificFrame)
	for i,v in pairs(main.commandMenus) do
		for a,b in pairs(v:GetDescendants()) do
			if b:IsA("GuiObject") then
				if b:FindFirstChild("OriginalZIndex") and (not specificFrame or v == specificFrame) then
					b.ZIndex = b.OriginalZIndex.Value + ((i-1)*10) - 1000
				end
			end
		end
	end
end


