
if (not Nurfed_Dropdown) then
	
	local utility = Nurfed_Utility:New();

	Nurfed_Dropdown = {};

	Nurfed_Dropdown.Menu = {
		[1] = {text = NURFEDMICROHEADER, isTitle = 1, level = 2 },
		[2] = {text = NURFEDPAPERDOLL, func = function() ToggleCharacter("PaperDollFrame"); end, level = 2 },
		[3] = {text = NURFEDSPELLBOOK, func = function() ToggleSpellBook(BOOKTYPE_SPELL) end, level = 2 },
		[4] = {text = NURFEDTALENTS, func = ToggleTalentFrame, level = 2 },
		[5] = {text = NURFEDQUESTLOG, func = ToggleQuestLog, level = 2 },
		[6] = {text = NURFEDFRIENDS, func = ToggleFriendsFrame, level = 2 },
		[7] = {text = NURFEDHELPMENU, func = ToggleHelpFrame, level = 2 },
	};

	Nurfed_Dropdown.AddOns = {
		[1] = {text = NURFEDADDONHEADER, isTitle = 1, nurfed = 1 },
		[2] = {text = NURFEDOTHERADDONS, isTitle = 1, level = 2 },
	};

	Nurfed_Dropdown.AddOnList = {
		["Nurfed_ActionBars"] = { text = "Nurfed ActionBars", func = function() Nurfed_ActionBarsMenu() end, nurfed = true },
		["Nurfed_General"] = { text = "Nurfed General", func = function() Nurfed_General_Config() end, nurfed = true },
		["Nurfed_Hud"] = { text = "Nurfed Hud", func = function() Nurfed_Hud_Config() end, nurfed = true },
		["Nurfed_UnitFrames"] = { text = "Nurfed UnitFrames", func = function() Nurfed_UnitFrames_Config() end, nurfed = true },
		["Nurfed_CombatLog"] = { text = "Nurfed CombatLog", func = function() Nurfed_CombatLog_Config() end, nurfed = true },
		["AutoBar"] = { text = "Autobar Config", func = function() AutoBar_ToggleConfig() end },
		["Sct"] = { text = "SCT Menu", func = function() SCT_showMenu() end },
		["AF_Tooltip"] = { text = "AF_Tooltip Menu", func = function() aftt_toggleFrames() end },
		["TipBuddy"] = { text = "TipBuddy Menu", func = function() TipBuddy_ToggleOptionsFrame() end },
	}

	function Nurfed_Dropdown:New()
		local object = {};
		setmetatable(object, self);
		self.__index = self;
		return object;
	end

	function Nurfed_Dropdown:Spacer()
		local info = {};
		info.disabled = 1;
		UIDropDownMenu_AddButton(info, level);
	end

	function Nurfed_Dropdown:GenerateLockMenu(frame)
		if (this and not frame) then
			frame = this;
		elseif (not frame) then
			return;
		end

		if (not frame.updated) then
			for k, v in self.AddOnList do
				if (IsAddOnLoaded(k)) then
					self:AddItem(v.text, v.func, v.nurfed);
				end
			end
			frame.updated = true;
		end

		frame.initialize = function ()
			local info = {};
			if ( UIDROPDOWNMENU_MENU_LEVEL == 1 ) then
				for k, v in self.AddOns do
					if (v.nurfed == 1) then
						info = {};
						info.text = v.text;
						info.func = v.func;
						info.isTitle = v.isTitle;
						info.notCheckable = 1;
						UIDropDownMenu_AddButton(info);
					end
				end

				info = {};
				info.text = NURFEDOTHERADDONS;
				info.value = "Other AddOns";
				info.hasArrow = 1;
				UIDropDownMenu_AddButton(info);

				info = {};
				info.text = NURFEDMICROHEADER;
				info.value = "Micro Buttons";
				info.hasArrow = 1;
				UIDropDownMenu_AddButton(info);
				return;
			end

			if (UIDROPDOWNMENU_MENU_VALUE == "Micro Buttons") then
				for k, v in self.Menu do
					info = {};
					info.text = v.text;
					info.func = v.func;
					info.isTitle = v.isTitle;
					info.notCheckable = 1;
					UIDropDownMenu_AddButton(info, v.level);
				end
				return;
			end

			if (UIDROPDOWNMENU_MENU_VALUE == "Other AddOns") then
				for k, v in self.AddOns do
					if (v.nurfed ~= 1) then
						info = {};
						info.text = v.text;
						info.func = v.func;
						info.isTitle = v.isTitle;
						info.notCheckable = 1;
						UIDropDownMenu_AddButton(info, v.level);
					end
				end
				return;
			end
		end
	end

	function Nurfed_Dropdown:ShowLockMenu(frame)
		if (this and not frame) then
			frame = this;
		elseif (not frame) then
			return;
		end
		
		ToggleDropDownMenu(1, nil, getglobal(frame:GetName().."DropDown"), frame:GetName(), 0, 0);
		
		if (GameTooltip:IsOwned(frame)) then
			GameTooltip:Hide();
		end

		utility:PositionDropDown(frame);
	end

	function Nurfed_Dropdown:GetIndex(text)
		local i;
		for i = 1, table.getn(self.AddOns) do
			if (self.AddOns[i].text == text) then
				return i;
			end
		end
		return nil;
	end

	function Nurfed_Dropdown:AddItem(text, func, nurfed)
		local index = self:GetIndex(text);
		if (index == nil) then
			index = table.getn(self.AddOns) + 1;
			table.setn(self.AddOns, index);
			self.AddOns[index] = {};
			self.AddOns[index].text = text;
			self.AddOns[index].func = func;
			if (nurfed) then
				self.AddOns[index].nurfed = 1;
			else
				self.AddOns[index].level = 2;
			end
		end
	end
end